ZHANGYUXUAN-zR commited on
Commit
c8ab17d
·
verified ·
1 Parent(s): 6bb2026

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/4qR3coiNaIv/4qR3coiNaIv.md +313 -0
  2. md/train/6vWuYzkp8d/6vWuYzkp8d.md +280 -0
  3. md/train/78GFU9e56Dq/78GFU9e56Dq.md +235 -0
  4. md/train/B1MbDj0ctQ/B1MbDj0ctQ.md +373 -0
  5. md/train/B1nLkl-0Z/B1nLkl-0Z.md +368 -0
  6. md/train/B1xtd1HtPS/B1xtd1HtPS.md +536 -0
  7. md/train/BJIgi_eCZ/BJIgi_eCZ.md +691 -0
  8. md/train/BJe-DsC5Fm/BJe-DsC5Fm.md +0 -0
  9. md/train/BJh6Ztuxl/BJh6Ztuxl.md +316 -0
  10. md/train/Bkgwp3NtDH/Bkgwp3NtDH.md +190 -0
  11. md/train/ByKWUeWA-/ByKWUeWA-.md +483 -0
  12. md/train/ByeUBANtvB/ByeUBANtvB.md +609 -0
  13. md/train/H1xsSjC9Ym/H1xsSjC9Ym.md +390 -0
  14. md/train/HJeOekHKwr/HJeOekHKwr.md +0 -0
  15. md/train/Hk3mPK5gg/Hk3mPK5gg.md +207 -0
  16. md/train/HkxnclHKDr/HkxnclHKDr.md +0 -0
  17. md/train/HyenWc5gx/HyenWc5gx.md +277 -0
  18. md/train/HylzTiC5Km/HylzTiC5Km.md +227 -0
  19. md/train/LuyryrCs6Ez/LuyryrCs6Ez.md +0 -0
  20. md/train/N6JECD-PI5w/N6JECD-PI5w.md +288 -0
  21. md/train/NPOWF_ZLfC5/NPOWF_ZLfC5.md +403 -0
  22. md/train/OkFPq7ZtsQ/OkFPq7ZtsQ.md +278 -0
  23. md/train/PdauS7wZBfC/PdauS7wZBfC.md +533 -0
  24. md/train/Rt5mjXAqHrY/Rt5mjXAqHrY.md +295 -0
  25. md/train/S1fduCl0b/S1fduCl0b.md +356 -0
  26. md/train/SJA7xfb0b/SJA7xfb0b.md +0 -0
  27. md/train/SJg7KhVKPH/SJg7KhVKPH.md +410 -0
  28. md/train/SJi9WOeRb/SJi9WOeRb.md +598 -0
  29. md/train/SJk01vogl/SJk01vogl.md +0 -0
  30. md/train/SJl98sR5tX/SJl98sR5tX.md +423 -0
  31. md/train/SJx9GQb0-/SJx9GQb0-.md +382 -0
  32. md/train/SJxbHkrKDH/SJxbHkrKDH.md +434 -0
  33. md/train/SJzRZ-WCZ/SJzRZ-WCZ.md +439 -0
  34. md/train/UoVpP8R2Vn/UoVpP8R2Vn.md +349 -0
  35. md/train/jnMjOctlfbZ/jnMjOctlfbZ.md +338 -0
  36. md/train/m4PC1eUknQG/m4PC1eUknQG.md +418 -0
  37. md/train/onxoVA9FxMw/onxoVA9FxMw.md +470 -0
  38. md/train/r1HhRfWRZ/r1HhRfWRZ.md +359 -0
  39. md/train/r1VGvBcxl/r1VGvBcxl.md +233 -0
  40. md/train/r1lnxTEYPS/r1lnxTEYPS.md +367 -0
  41. md/train/rJqBEPcxe/rJqBEPcxe.md +247 -0
  42. md/train/rkeYL1SFvH/rkeYL1SFvH.md +245 -0
  43. md/train/rkevMnRqYQ/rkevMnRqYQ.md +397 -0
  44. md/train/rkjZ2Pcxe/rkjZ2Pcxe.md +333 -0
  45. md/train/rsRq--gsiE/rsRq--gsiE.md +246 -0
  46. md/train/rsf1z-JSj87/rsf1z-JSj87.md +490 -0
  47. md/train/ryfMLoCqtQ/ryfMLoCqtQ.md +476 -0
  48. md/train/ryiAv2xAZ/ryiAv2xAZ.md +337 -0
  49. md/train/wRXzOa2z5T/wRXzOa2z5T.md +333 -0
  50. md/train/wpSWuz_hyqA/wpSWuz_hyqA.md +279 -0
md/train/4qR3coiNaIv/4qR3coiNaIv.md ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SCALABLE BAYESIAN INVERSE REINFORCEMENT LEARNING
2
+
3
+ Alex J. Chan University of Cambridge, Cambridge, UK alexjchan@maths.cam.ac.uk
4
+
5
+ Mihaela van der Schaar
6
+ University of Cambridge, Cambridge, UK University of California, Los Angeles, USA Cambridge Centre for AI in Medicine, UK The Alan Turing Institute, London, UK
7
+ mv472@cam.ac.uk
8
+
9
+ # ABSTRACT
10
+
11
+ Bayesian inference over the reward presents an ideal solution to the ill-posed nature of the inverse reinforcement learning problem. Unfortunately current methods generally do not scale well beyond the small tabular setting due to the need for an inner-loop MDP solver, and even non-Bayesian methods that do themselves scale often require extensive interaction with the environment to perform well, being inappropriate for high stakes or costly applications such as healthcare. In this paper we introduce our method, Approximate Variational Reward Imitation Learning (AVRIL), that addresses both of these issues by jointly learning an approximate posterior distribution over the reward that scales to arbitrarily complicated state spaces alongside an appropriate policy in a completely offline manner through a variational approach to said latent reward. Applying our method to real medical data alongside classic control simulations, we demonstrate Bayesian reward inference in environments beyond the scope of current methods, as well as task performance competitive with focused offline imitation learning algorithms.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ For applications in complicated and high-stakes environments it can often mean operating in the minimal possible setting - that is with no access to knowledge of the environment dynamics nor intrinsic reward, nor even the ability to interact and test policies. In this case learning and inference must be done solely on the basis of logged trajectories from a competent demonstrator showing only the states visited and the the action taken in each case.
16
+
17
+ Clinical decision making is an important example of this, where there is great interest in learning policies from medical professionals but is completely impractical and unethical to deploy policies on patients mid-training. Moreover this is an area where it is not only the policies, but also knowledge of the demonstrator’s preferences and goals, that we are interested in. While imitation learning (IL) generally deals with the problem of producing appropriate policies to match a demonstrator, with the added layer of understanding motivations this would then usually be approached through inverse reinforcement learning (IRL). Here attempting to learn the assumed underlying reward driving the demonstrator, before secondarily learning a policy that is optimal with respect to the reward using some forward reinforcement learning (RL) technique. By composing the RL and IRL procedures in order to perform IL we arrive at apprenticeship learning (AL), which introduces its own challenges, particularly in the offline setting. Notably for any given set of demonstrations there are (infinitely) many rewards for which the actions would be optimal $\mathrm { N g }$ et al., 2000). Max-margin (Abbeel & $\mathrm { N g }$ , 2004) and max-entropy (Ziebart et al., 2008) methods for heuristically differentiating plausible rewards do so at the cost of potentially dismissing the true reward for not possessing desirable qualities. On the other hand a Bayesian approach to IRL (BIRL) is more conceptually satisfying, taking a probabilistic view of the reward, we are interested in the posterior distribution having seen the demonstrations (Ramachandran & Amir, 2007), accounting for all possibilities. BIRL is not without its own drawbacks though, as noted in Brown & Niekum (2019), making it inappropriate for modern complicated environments: assuming linear rewards; small, solvable environments; and repeated, inner-loop, calls to forward RL.
18
+
19
+ ![](images/d9cfdc5b1bc6f3e16d989317572e562d90d7f13f159f7755e10beb37ec13d22b.jpg)
20
+ Figure 1: Overview. AVRIL is a framework for BIRL that works through an approximation in the variational Bayesian framework, considering the reward to be a latent representation of behaviour. A distribution over the reward, which is amortised over the demonstration space, is learnt that then informs an imitator $Q$ -function policy. The dotted line represents a departure from a traditional auto-encoder as the input, alongside the latent reward, informs the decoder.
21
+
22
+ The main contribution then of this paper is a method for advancing BIRL beyond these obstacles, allowing for approximate reward inference using an arbitrarily flexible class of functions, in any environment, without costly inner-loop operations, and importantly entirely offline. This leads to our algorithm AVRIL, depicted in figure 1, which represents a framework for jointly learning a variational posterior distribution over the reward alongside an imitator policy in an auto-encoderesque manner. In what follows we review the modern methods for offline IRL/IL (Section 2) with a focus on the approach of Bayesian IRL and the issues it faces when confronted with challenging environments. We then address the above issues by introducing our contributions (Section 3), and demonstrate the gains of our algorithm in real medical data and simulated control environments, notably that it is now possible to achieve Bayesian reward inference in such settings (Section 4). Finally we wrap up with some concluding thoughts and directions (Section 5). Code for AVRIL and our experiments is made available at https://github.com/XanderJC/scalable-birl and https://github.com/vanderschaarlab/mlforhealthlabpub.
23
+
24
+ # 2 APPROACHING APPRENTICESHIP AND IMITATION OFFLINE
25
+
26
+ Preliminaries. We consider the standard Markov decision process (MDP) environment, with states $s \in \mathcal { S }$ , actions $a \in \mathcal A$ , transitions $T \in \Delta ( { \cal S } ) ^ { s \times { \cal A } }$ , rewards $\vec { R } \in \mathbb { R } ^ { S \times A 1 }$ , and discount $\gamma \in [ 0 , 1 ]$ . For a policy $\pi \in \Delta ( \mathcal { A } ) ^ { s }$ let $\begin{array} { r } { \rho _ { \pi } ( s , a ) = \mathbb { E } _ { \pi , T } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \mathbb { 1 } _ { \{ s _ { t } = s , a _ { t } = a \} } ] } \end{array}$ be the induced unique occupancy measure alongside the state-only occupancy measure $\begin{array} { r } { \rho _ { \pi } ( s ) = \sum _ { a \in \mathcal { A } } \rho _ { \pi } ( s , a ) } \end{array}$ . Despite this full environment model, the only information available to us is the $\mathbf { M D P } \backslash R T$ , in that we have no access to either the underlying reward or the transitions, with our lacking knowledge of the transitions being also strong in the sense that further we are unable to simulate the environment to sample them. The learning signal is then given by access to $m$ -many trajectories of some demonstrator assumed to be acting optimally w.r.t. the MDP, following a policy $\pi _ { D }$ , making up a data set $\mathcal { D } _ { r a w } = \{ ( s _ { 1 } ^ { ( i ) } , a _ { 1 } ^ { ( i ) } , \dotsc , s _ { \tau ^ { ( i ) } } ^ { ( \bar { i } ) } , a _ { \tau ^ { ( i ) } } ^ { ( i ) } ) \} _ { i = 1 } ^ { m }$ where $s _ { t } ^ { ( i ) }$ is the state and $a _ { t } ^ { ( i ) }$ is the action taken at step $t$ during the $i$ th demonstration, and $\tau ^ { ( i ) }$ is the (max) time horizon of the ith demonstration. Given the Markov assumption though it is sufficient and convenient to consider the demonstrations simply as a collection of $n$ -many state, action, next state, next action tuples such that $\mathcal { D } = \{ ( s _ { i } , a _ { i } , s _ { i } ^ { \prime } , a _ { i } ^ { \prime } ) \} _ { i = 1 } ^ { n }$ with $\begin{array} { r } { n = \sum _ { i = 1 } ^ { m } ( \tau ^ { ( i ) } - 1 ) } \end{array}$ .
27
+
28
+ Apprenticeship through rewards. Typically AL proceeds by first inferring an appropriate reward function with an IRL procedure $\mathrm { N g }$ et al., 2000; Ramachandran & Amir, 2007; Rothkopf & Dimitrakakis, 2011; Ziebart et al., 2008) before running forward RL to obtain an appropriate policy. This allows for easy mix-and-match procedures, swapping in different standard RL and IRL methods depending on the situation. These algorithms though depend on either knowledge of $T$ in order to solve exactly or the ability to perform roll-outs in the environment, with little previous work focusing on the entirely offline setting. One simple solution is through attempting to learn the dynamics (Herman et al., 2016), though without a large supply of diverse demonstrations or a small environment this becomes impractical given imperfections in the model. Alternatively Klein et al. (2011) and Lee et al. (2019) attempt off-policy feature matching through least-squared temporal difference and deep neural networks to uncover appropriate feature representations.
29
+
30
+ Implicit-reward policy learning. Recent work has often forgone an explicit representation of the reward. Moving within the maximum-entropy RL framework (Ziebart, 2010; Levine, 2018), Ho & Ermon (2016) noted that the full procedure ${ \mathrm { ~ R L ~ o ~ I R L } }$ ) can be interpreted equivalently as the minimisation of some divergence between occupancy measures of the imitator and demonstrator:
31
+
32
+ $$
33
+ \underset { \pi } { \arg \operatorname* { m i n } } \{ \psi ^ { * } ( \rho _ { \pi } - \rho _ { \pi _ { D } } ) - H ( \pi ) \} ,
34
+ $$
35
+
36
+ with $H ( \pi )$ being the discounted causal entropy (Bloem & Bambos, 2014) of the policy and $\psi ^ { * }$ the Fenchel conjugate of a chosen regulariser on the form of the reward. These are typically optimised in an adversarial fashion (Goodfellow et al., 2014) and given the focus on evaluating $\rho _ { \pi }$ this often requires extensive interaction with the environment, otherwise banking on approximations over a replay buffer (Kostrikov et al., 2018) or a reformulation of the divergence to allow for off-policy evaluation (Kostrikov et al., 2019). Bear in mind that optimal policies within the maximum-entropy framework are parameterised by a Boltzmann distribution:
37
+
38
+ $$
39
+ \pi ( a | s ) = \frac { \exp ( Q ( s , a ) ) } { \sum _ { b \in \cal { A } } \exp ( Q ( s , b ) ) } ,
40
+ $$
41
+
42
+ with $Q ( s , a )$ the soft $Q$ -function, defined recursively via the soft Bellman-equation:
43
+
44
+ $$
45
+ Q ( s , a ) \triangleq R ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim \rho _ { \pi } } \Big [ \operatorname { s o f t } _ { a ^ { \prime } } \operatorname { m a x } Q ( s ^ { \prime } , a ^ { \prime } ) ) \Big ] .
46
+ $$
47
+
48
+ Then for a learnt parameterised policy given in terms of $Q$ -values from a function approximator $Q _ { \theta }$ we can obtain an implied reward given by:
49
+
50
+ $$
51
+ R _ { Q _ { \theta } } ( s , a ) = Q _ { \theta } ( s , a ) - \gamma \mathbb { E } _ { s ^ { \prime } \sim \rho _ { \pi } } \Bigg [ \log \Bigg ( \sum _ { a ^ { \prime } \in \mathcal { A } } \exp ( Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) ) \Bigg ) \Bigg ] .
52
+ $$
53
+
54
+ A number of algorithms make use of this fact with Piot et al. (2014) and Reddy et al. (2019) working by essentially placing a sparsity prior on this implied reward, encouraging it towards zero, and thus incorporating subsequent state information. Alternatively Jarrett et al. (2020) show that even the simple behavioural cloning (Bain & Sammut, 1995) is implicitly maximising some reward with an approximation that the expectation over states is taken with respect to the demonstrator, not the learnt policy. They then attempt to rectify part of this approximation using the properties of the energy-based model implied by the policy (Grathwohl et al., 2019).
55
+
56
+ The problem with learning an implicit reward in an offline setting is that it remains just that, implicit, only able to be evaluated at points seen in the demonstrations, and even then only approximately. Thus even if their consideration improves imitator policies performance they offer no real improvement for interpretation.
57
+
58
+ # 2.1 BAYESIAN INVERSE REINFORCEMENT LEARNING
59
+
60
+ We are then resigned to directly reason about the underlying reward, bringing us back to the question of IRL, and in particular BIRL for a principled approach to reasoning under uncertainty. Given a prior over possible functions, having seen some demonstrations, we calculate the posterior over the function using a theoretically simple application of Bayes rule. Ramachandran $\&$ Amir (2007) defines the likelihood of an action at a state as a Boltzmann distribution with inverse temperature and respective state-action values, yielding a probabilistic demonstrator policy given by:
61
+
62
+ $$
63
+ \pi _ { D } ( a | s , R ) = \frac { \exp ( \beta Q _ { R } ^ { \pi _ { D } } ( s , a ) ) } { \sum _ { b \in \cal { A } } \exp ( \beta Q _ { R } ^ { \pi _ { D } } ( s , b ) ) } ,
64
+ $$
65
+
66
+ where $\beta \in [ 0 , \infty )$ represents the the confidence in the optimality of the demonstrator. Note that despite similarities, moving forward we are no longer within the maximum-entropy framework and $Q _ { R } ^ { \pi } ( s , a )$ now denotes the traditional, not soft (as in equation 3), state-action value ( $Q$ -value) funcRtion given a reward $R$ and policy $\pi$ such that $\begin{array} { r } { Q _ { R } ^ { \pi } ( s , \bar { a } ) = \mathbb { E } _ { \pi , T } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } ) | s _ { 0 } = s , a _ { 0 } = a ] } \end{array}$ Unsurprisingly this yields an intractable posterior distribution leading to a Markov chain Monte Carlo (MCMC) algorithm based on a random grid-walk to sample from the posterior.
67
+
68
+ Issues in complex and unknown environments. This original formulation, alongside extensions that consider maximum-a-posteriori inference (Choi & Kim, 2011) and multiple rewards (Choi & Kim, 2012; Dimitrakakis & Rothkopf, 2011), suffer from three major drawbacks that make them impractical for modern, complicated, and model-free task environments.
69
+
70
+ 1. The reward is a linear combination of state features. Naturally this is a very restrictive class of functions and assumes access to carefully hand-crafted features of the state space. 2. The cardinality of the state-space is finite, $| S | < \infty$ . Admittedly this can be relaxed in practical terms, although it does mean the rapid-mixing bounds derived by Ramachandran & Amir (2007) do not hold at all in the infinite case. For finite approximations they scale at $\mathcal { O } ( | S | ^ { 2 } )$ , rapidly becoming vacuous and causing BIRL to inherit the usual MCMC difficulties on assessing convergence and sequential computation (Gamerman & Lopes, 2006). 3. The requirement of an inner-loop MDP solve. Most importantly at every step a new reward is sampled and the likelihood of the data must then be evaluated. This requires calculating the $Q$ -values of the policy with respect to the reward, in other words running forward RL. While not an insurmountable problem in the simple cases where everything is known and can be quickly solved with a procedure guaranteed to converge correctly, this becomes an issue in the realm where only deep function approximation works adequately (i.e. the nontabular setting). DQN training for example easily stretches into hours (Mnih et al., 2013) and will have to be repeated thousands of times, making it completely untenable.
71
+
72
+ We have seen that even in the most simple setting the problem of exact Bayesian inference over the reward is intractable, and the above limitations of the current MCMC methods are not trivial to overcome. Consequently very little work has been done in the area and there still remain very open challenges. Levine et al. (2011) addressed linearity through a Gaussian process approach, allowing for a significantly more flexible and non-linear representation though introducing issues of its own, namely the computational complexity of inverting large matrices (Rasmussen, 2003). More recently Brown & Niekum (2019) have presented the only current solution to the inner-loop problem by introducing an alternative formulation of the likelihood, one based on human recorded pairwise preferences over demonstrations that significantly reduces the complexity of likelihood. However labelled preferences certainly can’t be assumed always available and while very effective for the given task is not appropriate in the general case. One of the key aspects of our contribution is that we are able to deal with all three of these issues while also not requiring any additional information.
73
+
74
+ The usefulness of uncertainty. On top of the philosophical consistency of Bayesian inference there are a number of reasons for wanting a measure of uncertainty over any uncovered reward that are not available from regular IRL algorithms. First that the (epistemic) uncertainty revealed by Bayesian inference tells us a lot about what areas of the state-space we really cannot say anything about because we haven’t seen any demonstrations there - potentially informing future data collection if that is possible (Mindermann et al., 2018). Additionally in the cases we are mostly concerned about (e.g. medicine) we have to be very careful about letting algorithms pick actions in practice and we are interested in performing safe or risk-averse imitation, for which a degree of confidence over learnt rewards is necessary. Brown et al. (2020) for example use a distribution over reward to optimise a conditional value-at-risk instead of expected return so as to bound potential downsides.
75
+
76
+ # 3 APPROXIMATE VARIATIONAL REWARD IMITATION LEARNING
77
+
78
+ A variational Bayesian approach. In this section we detail our method, AVRIL, for efficiently learning an imitator policy and performing reward inference simultaneously. Unlike the previously mentioned sampling or MAP-based methods, we employ variational inference (Blei et al., 2017) to reason about the posterior. Here we posit a surrogate distribution $q _ { \phi } ( R )$ , parameterised by $\phi$ , and aim to minimise the Kullback-Leibler (KL) divergence to the posterior, resulting in an objective:
79
+
80
+ $$
81
+ \operatorname* { m i n } _ { \phi } \{ D _ { \mathrm { K L } } ( q _ { \phi } ( R ) | | p ( R | \mathcal { D } ) ) \} .
82
+ $$
83
+
84
+ This divergence is still as troubling as the posterior to evaluate, leading to an auxiliary objective function in the Evidence Lower BOund (ELBO):
85
+
86
+ $$
87
+ \mathcal { F } ( \phi ) = \mathbb { E } _ { q _ { \phi } } \big [ \log p ( \mathcal { D } | R ) \big ] - D _ { K L } \big ( q _ { \phi } ( R ) | | p ( R ) \big ) ,
88
+ $$
89
+
90
+ where it can be seen that maximisation over $\phi$ is equivalent to (6). We are agnostic towards the form of both the prior and variational distribution, for simplicity here we assume a Gaussian process prior with mean zero and unit variance over $R$ alongside the variational posterior distribution given by:
91
+
92
+ $$
93
+ q _ { \phi } ( R ) = \mathcal { N } ( R ; \mu , \sigma ^ { 2 } ) ,
94
+ $$
95
+
96
+ where $\mu , \sigma ^ { 2 }$ are the outputs of an encoder neural network taking $s$ as input and parameterised by $\phi$ . Note that for the algorithm that we will describe these choices are not a necessity and can be easily substituted for more expressive distributions if appropriate. Maintaining the assumption of Boltzmann rationality on the part of the demonstrator, our objective takes the form:
97
+
98
+ $$
99
+ \mathcal { F } ( \phi ) = \mathbb { E } _ { q _ { \phi } } \left[ \sum _ { ( s , a ) \in \mathcal { D } } \log \frac { \exp ( \beta Q _ { R } ^ { \pi _ { D } } ( s , a ) ) } { \sum _ { b \in \mathcal { A } } \exp ( \beta Q _ { R } ^ { \pi _ { D } } ( s , b ) ) } \right] - D _ { K L } \big ( q _ { \phi } ( R ) | | p ( R ) \big ) .
100
+ $$
101
+
102
+ The most interesting (and problematic) part of this objective as ever centres on the evaluation of $Q _ { R } ^ { \pi _ { D } } ( s , a )$ . Notice that what is really required here is an expression of the $Q$ -values as a smooth function of the reward such that with samples of $R$ we could take gradients w.r.t. $\phi$ . Of course there is little hope of obtaining this simply, by itself it is a harder problem than that of forward RL which only attempts to evaluate the $Q$ -values for a specific $R$ and already in complicated environments has to rely on function approximation and limited guarantees.
103
+
104
+ A naive approach would be to sample $\hat { R }$ and then approximate the $Q$ -values with a second neural network, solving offline over the batched data using a least-squared $\mathrm { T D } / Q$ -learning algorithm, as is the approach forced on sampling based BIRL methods. It is in fact though doubly inappropriate for this setting, not only does this require a solve as an inner-loop but importantly differentiating through the solving operation is extremely impractical, it requires backpropagating through a number of gradient updates that are essentially unbounded as the complexity of the environment increases.
105
+
106
+ A further approximation. This raises an important question - is it possible to jointly optimise a policy and variational distribution only once instead of requiring a repeated solve? This is theoretically suspect, the $Q$ -values are defined on a singular reward, constrained as $R ( s , a ) \ =$ $\mathbb { E } _ { s ^ { \prime } , a ^ { \prime } \sim \pi , T } [ \bar { Q } _ { R } ^ { \pi } ( { \bar { s , } } a ) - \gamma Q _ { R } ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ]$ so we cannot learn a particular standard $Q$ -function that reflects the entire distribution. But can we learn a policy that reflects the expected reward using a second policy neural network $Q _ { \theta } ?$ We can’t simply optimise $\theta$ alongside $\phi$ to maximise the ELBO though as that completely ignores the fact that the learnt policy is intimately related to the distribution over the reward. Our solution to ensure then that they behave as intended is by constraining $q _ { \phi }$ and $Q _ { \theta }$ to be consistent with each other, specifically that the implied reward of the policy is sufficiently likely under the variational posterior (equivalently that the negative log-likelihood is sufficiently low). Thus we arrive at a constrained optimisation objective given by:
107
+
108
+ $$
109
+ \operatorname* { m a x } _ { \phi , \theta } \sum _ { ( s , a ) \in \mathcal { D } } \log \frac { \exp ( \beta Q _ { \theta } ( s , a ) ) } { \sum _ { b \in \mathcal { A } } \exp ( \beta Q _ { \theta } ( s , b ) ) } - D _ { K L } \big ( q _ { \phi } ( R ) | | p ( R ) \big ) ,
110
+ $$
111
+
112
+ with $\epsilon$ reflecting the strength of the constraint. Rewriting (10) as a Lagrangian under the KKT conditions (Karush, 1939; Kuhn $\&$ Tucker, 1951), and given complimentary slackness, we obtain a practical objective function:
113
+
114
+ $$
115
+ \begin{array} { r l } { \mathcal { F } ( \phi , \theta , \mathcal { D } ) = \displaystyle \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal { D } } \log \frac { \exp \beta Q _ { \theta } ( s , a ) ) } { \sum _ { b \in A } \exp ( \beta Q _ { \theta } ( s , b ) ) } - D _ { K L } \big ( q _ { \phi } ( R ( s , a ) ) | | p ( R ( s , a ) ) \big ) } & { } \\ { + \lambda \log q _ { \phi } ( Q _ { \theta } ( s , a ) - \gamma Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) ) . } & { } \end{array}
116
+ $$
117
+
118
+ Here the KL divergence between processes is approximated over a countable set, and $\lambda$ is introduced to control the strength of constraint.
119
+
120
+ On the implementation. Optimisation is simple as both networks are maximising the same objective and gradients can be easily obtained through backpropagation while being amenable to minibatching, allowing you to call your favourite gradient-based stochastic optimisation scheme. We re-iterate though that AVRIL really represents a framework for doing BIRL and not a specific model
121
+
122
+ # Algorithm 1: Approximate Variational Reward Imitation Learning (AVRIL)
123
+
124
+ Result: Parameters $\phi$ of variational distribution and $\theta$ of policy Q-function
125
+ Input: $\mathcal { D } , S , A , \gamma , \lambda$ , learning rate $\eta$ , mini-batch size $b$ ;
126
+ Initialise $\phi , \theta$ ; $\triangleright$ Can concatenate into single vector $( \phi , \theta )$
127
+ while not converged do Sample $\mathcal { D } _ { m i n i }$ from $\mathcal { D }$ ; $\begin{array} { r } { \mathcal { F } ( \phi , \theta , \mathcal { D } ) = \mathbb { E } [ \frac { n } { b } \mathcal { F } ( \phi , \theta , \mathcal { D } _ { m i n i } ) ] } \end{array}$ ; . MC estimate total loss $( \phi ^ { \prime } , \theta ^ { \prime } ) ( \phi , \theta ) + \eta \nabla _ { \phi , \theta } \mathcal { F } ( \phi , \theta , \mathcal { D } )$ ; . Gradient step for $\phi , \theta$ $\phi , \theta \phi ^ { \prime } , \theta ^ { \prime }$
128
+ end
129
+ Return: $\phi , \theta$
130
+
131
+ since $Q _ { \theta }$ and $q _ { \phi }$ represent arbitrary function approximators. So far we have presented both as neural networks, but this does not have to be the case. Of course the advantage of them is their flexibility and ease of training but they are still inherently black box. It is then perfectly possible to swap in any particular function approximator if the task requires it, using simple linear models for example may slightly hurt performance but allow for more insight. Despite the specific focus on infinite state-spaces, AVRIL can still even be applied in the tabular setting by simply representing the policy and variational distribution with multi-dimensional tensors. Having settled on their forms, equation (11) is calculated simply and the joint gradient with respect to $\theta$ and $\phi$ is straight-forwardly returned using any standard auto-diff package. The whole process is summarised in Algorithm 1.
132
+
133
+ We can now see how AVRIL does not suffer the issues outlined in section 2.1. Our form of $q _ { \phi } ( R )$ is flexible and easily accommodates a non-linear form of the reward given a neural architecture - this also removes any restriction on $s$ , or at least allows for any state space that is commonly tackled within the IL/RL literature. Additionally we have a single objective for which all parameters are maximised simultaneously - there are no inner-loops, costly or otherwise, meaning training is faster than the MCMC methods by a factor equal roughly to the number of samples they would require.
134
+
135
+ The generative model view. Ultimately a policy represents a generative model for the behavioural data we see. Ho & Ermon (2016) explicitly make use of this fact by casting the problem in the GAN framework (Goodfellow et al., 2014). Our method is more analogous to a VAE (Kingma & Welling, 2013), though not exactly, where given the graphical model in figure 2 the reward can be seen as a latent representation of the policy. Our approach takes the seen data and amortises the inference, encoding over the state space. The policy does not act as a decoder in precisely taking any given encoded reward and outputting a policy, but it does take the whole reward posterior and translate it into actions and therefore behaviour. This approach has its advantages, in both meaningful interpretation of the latent reward (which is non-existent in adversarial methods), and that we forgo the practical difficulties of alternating min-max optimisation (Kodali et al., 2017) while maintaining a generative view of the policy.
136
+
137
+ ![](images/787d6d634246cb213461ef2627f55b1feb1315b21e4be42cc9a37cfd4f67f240.jpg)
138
+ Figure 2: Graphical model for Bayesian IRL
139
+
140
+ Temporal consistency through reward regularisation. Considering only the first term of (11) yields the standard behavioural cloning setup (where the logits output can be interpreted as the $Q$ - values) as it removes the reward from the equation and just focuses on matching actions to states. AVRIL can then be seen as a policy-learning method regularised by the need for the implied reward to be consistent. Note that this does not induce any necessary bias since the logits normally contain an extra degree of freedom allowing them to arbitrarily shift by some scale factor. This factor is now explicitly constrained by giving the logits additional meaning in that they represent $Q$ -values. This places great importance on the KL term, since every parameterisation of a policy will have an associated implied reward, the KL regularises these to be not so far from the prior and preventing the reward from overfitting to the policy and becoming pointless. It also is able to double as a regularising term in a similar manor to previous reward-regularisation methods (Piot et al., 2014; Reddy et al., 2019) depending on the chosen prior, encouraging the reward to be close to zero:
141
+
142
+ Proposition 1 (Reward Regularisation) Assume that the constraint in (10) is satisfied in that $\begin{array} { r } { { \mathbb E } _ { q _ { \phi } } [ R ( s , a ) ] = { \mathbb E } _ { \pi , T } [ Q _ { \theta } ( s , a ) - \gamma Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) ] } \end{array}$ , then given a standard normal prior $p ( R ) = \mathcal { N } ( R ; 0 , 1 )$ the $\mathrm { K L }$ divergence yields a sparsity regulator on the implied reward:
143
+
144
+ $$
145
+ \mathcal { L } _ { r e g } = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal { D } } \frac { 1 } { 2 } \big ( Q _ { \theta } ( s , a ) - \gamma Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) \big ) ^ { 2 } + g ( \mathrm { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) .
146
+ $$
147
+
148
+ Proof. Appendix.  This follows immediately from the fact that the divergence evaluates as DK $\begin{array} { r } { \overset { \vartriangle } { \boldsymbol { \mathrm { \iota } } } \big ( q _ { \phi } ( \hat { R } ( s , a ) ) | | p ( R ( s , a ) ) \big ) = \frac { 1 } { 2 } ( - \log ( \operatorname { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) - 1 + \operatorname { V a r } _ { q _ { \phi } } [ R ( s , a ) ] + \mathbb { E } _ { q _ { \phi } } [ R ( s , a ) ] ^ { 2 } ) } \end{array}$
149
+
150
+ This then allows AVRIL to inherit the benefit of these methods while also explicitly learning a reward that can be queried at any point. We are also allowed the choice of whether it is state-only or state-action. This has so far been arbitrary, but it is important to consider that a state-only reward is a necessary and sufficient condition for a reward that is fully disentangled from the dynamics $\operatorname { F u }$ et al., 2018). Thus by learning such a reward and given the final term of (11) that directly connects one-step rewards in terms of the policy, this forces the policy (not the reward) to account for the dynamics of the system ensuring temporal consistency in a way that BC for example simply can’t. Alternatively using a state-action reward means that inevitably some of the temporal information leaks out of the policy and into the reward - ultimately to the detriment of the policy but potentially allowing for a more interpretable (or useful) form of reward depending on the task at hand.
151
+
152
+ # 4 EXPERIMENTS
153
+
154
+ Experimental setup. We are primarily concerned with the case of medical environments, which is exactly where the issue of learning without interaction is most crucial, you just cannot let a policy sample treatments for a patient to try to learn more about the dynamics. It is also where a level of interpretability in what has been learnt is important, since the consequence of actions are potentially very impactful on human lives. As such we focus our evaluation on learning on a real-life healthcare problem, with demonstrations taken from the Medical Information Mart for Intensive Care (MIMIC-III) dataset (Johnson et al., 2016). The data contains trajectories of patients in intensive care recording their condition and theraputic interventions at one day intervals. We evaluate the ability of the methods to learn a medical policy in both the two and four action setting - specifically whether the patient should be placed on a ventilator, and the decision for ventilation in combination with antibiotic treatment. These represent the two most common, and important, clinical interventions recorded in the data. Without a recorded notion of reward, performance is measured with respect to action matching against a held out test set of demonstrations with cross-validation.
155
+
156
+ Alongside the healthcare data and for the purposes of demonstrating generalisability, we provide additional results on standard environments of varying complexity in the RL literature, the standard control problems of: CartPole, a classic control environment aiming to swing up and balance a pendulum; Acrobot, which aims to maintain a sequence of joints above a given height; and LunarLander, guiding a landing module to a safe touchdown on the moon surface. In these settings given sufficient demonstration data all benchmarks are very much capable of reaching demonstrator level performance, so we test the algorithms on their ability to handle sample complexity in the low data regime by testing their performance when given access to a select number of trajectories which we adjust, replicating the setup in Jarrett et al. (2020). With access to a simulation through the OpenAI gym (Brockman et al., 2016), we measure performance by deploying the learnt policies live and calculating their average return over 300 episodes.
157
+
158
+ Benchmarks. We test our method (AVRIL) against a number of benchmarks from the offline IRL/IL setting: Deep Successor Feature Network (DSFN) (Lee et al., 2019), an offline adaptation of max-margin IRL that generalises past the linear methods using a deep network with leastsquares temporal-difference learning, the only other method that produces both a reward and policy; Reward-regularized Classification for Apprenticeship Learning (RCAL) (Piot et al., 2014), where an explicit regulariser on the sparsity of the implied reward is introduced in order to account for the dynamics information; ValueDICE (VDICE) (Kostrikov et al., 2019), an adversarial imitation learning, adapted for the offline setting by removing the replay regularisation; Energy-based Distribution Matching (EDM) (Jarrett et al., 2020), the state-of-the-art in offline imitation learning; and finally the standard example of Behavioural Cloning (BC). To provide evidence that we are indeed learning an appropriate reward we show an ablation of our method on the MIMIC data: we take the reward learnt by AVRIL and use it as the ‘true’ reward used to train a $Q$ -network offline to learn a policy (A-RL). Note that we have not included previous BIRL methods for the reasons explained in section 2.1, training a network just once in these environments takes in the order of minutes and repeating this sequentially thousands of times is just not practical. For aid in comparison all methods share the same network architecture of two hidden layers of 64 units with ELU activation functions and are trained using Adam (Kingma & Ba, 2014) with learning rates individually tuned. Further details on experimental setup and the implementation of benchmarks can be found in the appendix.
159
+
160
+ ![](images/99c662ff38503bdc43e89701fae5833c8fdd14b9ef6e894424ecac8256a1baf1.jpg)
161
+ Figure 3: Control environments performance. We plot the average returns received by the policies when deployed live in the environment against the number of trajectories seen during training.
162
+
163
+ Table 1: Healthcare performance. Comparison of methods on the MIMIC-III dataset. Performance of the policy is evaluated on the quality of action matching against a held out test set of demonstrations. We report the accuracy (ACC), area under the receiving operator characteristic curve (AUC) and average precision score (APS).
164
+
165
+ <table><tr><td></td><td colspan="3">Ventilator</td><td colspan="3">Ventilator + Antibiotics</td></tr><tr><td>Metric</td><td>ACC</td><td>AUC</td><td>APS</td><td>ACC</td><td>AUC</td><td>APS</td></tr><tr><td>BC</td><td>0.873 ± 0.007</td><td>0.916 ± 0.002</td><td>0.904±0.003</td><td>0.700±0.009</td><td>0.864 ± 0.003</td><td>0.665 ± 0.009</td></tr><tr><td>VDICE</td><td>0.879 ±0.002</td><td>0.915 ± 0.002</td><td>0.904±0.003</td><td>0.710 ±0.005</td><td>0.863 ±0.002</td><td>0.675 ±0.004</td></tr><tr><td>RCAL</td><td>0.870 ± 0.012</td><td>0.916 ± 0.003</td><td>0.904±0.005</td><td>0.702 ±0.008</td><td>0.865 ± 0.004</td><td>0.669 ± 0.006</td></tr><tr><td>DSFN</td><td>0.869 ± 0.005</td><td>0.905 ± 0.003</td><td>0.885 ±0.001</td><td>0.683 ± 0.007</td><td>0.856 ±0.002</td><td>0.670 ± 0.004</td></tr><tr><td>EDM</td><td>0.882 ± 0.011</td><td>0.920±0.002</td><td>0.909 ± 0.003</td><td>0.716 ±0.008</td><td>0.873±0.002</td><td>0.682 ± 0.004</td></tr><tr><td>A-RL</td><td>10.875±0.010</td><td>0.904±0.002</td><td>0.927±0.002</td><td>0.718 ± 0.010</td><td>0.864±0.002</td><td>0.665±0.005</td></tr><tr><td>AVRIL</td><td>0.891±0.002 0.917 ± 0.001</td><td></td><td>0.940±0.001</td><td></td><td>0.754± 0.001 0.884 ± 0.000 0.708 ± 0.002</td><td></td></tr></table>
166
+
167
+ Evaluation. We see for all tasks AVRIL learns an appropriate policy that performs strongly across the board, being competitive in all cases and in places beating out all of the other benchmarks. The results for our healthcare example are given in table 1, with AVRIL performing very strongly, having the highest accuracy and precision score in both tasks. The results for the control environments are shown in figure 3. AVRIL performs competitively and is easily capable of reaching demonstrator level performance in the samples given for these tasks, though not always as quickly as some of the dedicated offline IL methods.
168
+
169
+ Reward insight. Remember though that task performance is not exactly our goal. Rather the key aspect of AVRIL is the inference over the unseen reward in order to gain information about the preferences of the agent that other black-box policy methods can’t. In the previous experiments our reward encoder was a neural network for maximum flexibility and we can see from the performance of A-RL we learn a representation of the reward that can be used to relearn in the environment very effectively, albeit not quite to the same standard of AVRIL. Note this also reflects an original motivation for AVRIL in that offpolicy RL on top of a learnt reward suffers. In figure 4 we explore how to gain more insight from the learnt reward using different parameterisations of the reward. The top graph shows how a learnt state-action reward changes as a function of blood-oxygen level for an otherwise healthy patient, and it can be seen that as it drops below average the reward for ventilating the patient becomes much higher (note this is average for patients in the ICU, not across the general population). While this is intuitive we still have to query a neural network repeatedly over the state space to gain insight, the bottom graph of figure 4 presents then a simpler but perhaps more useful representation. In this case we learn a state-only reward as before but as a linear model. This is not as strong a constraint on the policy since that is still free to be non-linear as a neural network but simultaneously allows us the insight of what our model considers high value in the environment as we plot the relative model coefficients for each covariate. We can see here for example that the biggest impact on the overall estimated quality of a state is given by blood pressure, well known as an important indicator of health (Hepworth et al., 1994), strongly impacted by trauma and infection.
170
+
171
+ ![](images/ca7c32b8888060a1a5cb258f469a662fd368830830a97e61c43ea9064d01b67d.jpg)
172
+ Figure 5: Gridworld example. Scaled heat-maps of: the ground truth reward; the relative state occupancy of the expert demonstrations; the reward posterior mean; and reward standard deviation.
173
+
174
+ Gridworld ground-truth comparison While environments like MIMIC are the main focus of this work they do not lend them selves to inspection of the uncovered reward as the ground truth simply is not available to us. We thus demonstrate on a toy gridworld environment, in order to clearly see the effect of learning a posterior distribution over the reward. In this (finite) example both the encoder and decoder are represented by tensors but otherwise the procedure remains the same. Figure 5 plots scaled heat-maps of: a) the ground truth reward; b) the relative state occupancy of the expert demonstrations, obtained using value-iteration; c) the reward posterior mean; and d) the reward standard deviation. The interesting thing to note is that the standard deviation of the learnt reward essentially resembles the complement of the state occupancy - revealing the epistemic uncertainty around that part of the state-space given we haven’t seen any demonstrations there.
175
+
176
+ # 5 CONCLUSIONS
177
+
178
+ We have presented a novel algorithm, Approximate Variational Reward Imitation Learning, for addressing the scalability issues that prevent current Bayesian IRL methods being used in large and unknown environments. We show that this performs strongly on real and toy data for learning imitation policies completely offline and importantly recovers a reward that is both effective for retraining policies but also offers useful insight into the preferences of the demonstrator. Of course this still represents an approximation, and there is room for further, more exact methods or else guarantees on the maximum divergence. We have focused on simply obtaining the appropriate uncertainty over reward as well as imitation in high stakes environments - in these settings it is crucial that learnt policies avoid catastrophic failure and so how exactly to use the uncertainty in order to achieve truly safe imitation (or indeed better-that-demonstrator apprenticeship) is increasingly of interest.
179
+
180
+ ![](images/10c9875b3e37b7a44561ac5529ce0724c415439487c6fd0baa51655f4911daf4.jpg)
181
+ Figure 4: (Top) A state-action reward is learnt and plotted for an otherwise average patient as their blood oxygen level changes. (Bottom) The associated weights given a state-only reward as a linear function of the state-space.
182
+
183
+ # ACKNOWLEDGEMENTS
184
+
185
+ AJC would like to acknowledge and thank Microsoft Research for its support through its PhD Scholarship Program with the EPSRC. This work was additionally supported by the Office of Naval Research (ONR) and the NSF (Grant number: 1722516). We would like to thank all of the anonymous reviewers on OpenReview, alongside the many members of the van der Schaar lab, for their input, comments, and suggestions at various stages that have ultimately improved the manuscript.
186
+
187
+ # REFERENCES
188
+
189
+ Pieter Abbeel and Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ . Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, pp. 1, 2004.
190
+
191
+ Michael Bain and Claude Sammut. A framework for behavioural cloning. In Machine Intelligence 15, pp. 103–129, 1995.
192
+
193
+ David M Blei, Alp Kucukelbir, and Jon D McAuliffe. Variational inference: A review for statisticians. Journal of the American statistical Association, 112(518):859–877, 2017.
194
+
195
+ Michael Bloem and Nicholas Bambos. Infinite time horizon maximum causal entropy inverse reinforcement learning. In 53rd IEEE Conference on Decision and Control, pp. 4911–4916. IEEE, 2014.
196
+
197
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
198
+
199
+ Daniel Brown, Scott Niekum, and Marek Petrik. Bayesian robust optimization for imitation learning. Advances in Neural Information Processing Systems, 33, 2020.
200
+
201
+ Daniel S Brown and Scott Niekum. Deep bayesian reward learning from preferences. arXiv preprint arXiv:1912.04472, 2019.
202
+
203
+ Jaedeug Choi and Kee-Eung Kim. Map inference for bayesian inverse reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1989–1997, 2011.
204
+
205
+ Jaedeug Choi and Kee-Eung Kim. Nonparametric bayesian inverse reinforcement learning for multiple reward functions. In Advances in Neural Information Processing Systems, pp. 305–313, 2012.
206
+
207
+ Christos Dimitrakakis and Constantin A Rothkopf. Bayesian multitask inverse reinforcement learning. In European workshop on reinforcement learning, pp. 273–284. Springer, 2011.
208
+
209
+ Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adverserial inverse reinforcement learning. In International Conference on Learning Representations, 2018.
210
+
211
+ Dani Gamerman and Hedibert F Lopes. Markov chain Monte Carlo: stochastic simulation for Bayesian inference. CRC Press, 2006.
212
+
213
+ 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.
214
+
215
+ Will Grathwohl, Kuan-Chieh Wang, Joern-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, and Kevin Swersky. Your classifier is secretly an energy based model and you should treat it like one. In International Conference on Learning Representations, 2019.
216
+
217
+ Joseph T Hepworth, Sherry Garrett Hendrickson, and Jean Lopez. Time series analysis of physiological response during icu visitation. Western journal of nursing research, 16(6):704–717, 1994.
218
+
219
+ Michael Herman, Tobias Gindele, Jorg Wagner, Felix Schmitt, and Wolfram Burgard. Inverse rein-¨ forcement learning with simultaneous estimation of rewards and dynamics. In Artificial Intelligence and Statistics, pp. 102–110. PMLR, 2016.
220
+
221
+ Ashley Hill, Antonin Raffin, Maximilian Ernestus, Adam Gleave, Anssi Kanervisto, Rene Traore, Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, and Yuhuai Wu. Stable baselines. https://github. com/hill-a/stable-baselines, 2018.
222
+
223
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in neural information processing systems, pp. 4565–4573, 2016.
224
+
225
+ Daniel Jarrett, Ioana Bica, and Mihaela van der Schaar. Strictly batch imitation learning by energybased distribution matching. Advances in Neural Information Processing Systems, 33, 2020.
226
+
227
+ Alistair EW Johnson, Tom J Pollard, Lu Shen, H Lehman Li-Wei, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. Mimic-iii, a freely accessible critical care database. Scientific data, 3(1):1–9, 2016.
228
+
229
+ William Karush. Minima of functions of several variables with inequalities as side constraints. M. Sc. Dissertation. Dept. of Mathematics, Univ. of Chicago, 1939.
230
+
231
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
232
+
233
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
234
+
235
+ Edouard Klein, Matthieu Geist, and Olivier Pietquin. Batch, off-policy and model-free apprenticeship learning. In European Workshop on Reinforcement Learning, pp. 285–296. Springer, 2011.
236
+
237
+ Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of gans. arXiv preprint arXiv:1705.07215, 2017.
238
+
239
+ Ilya Kostrikov, Kumar Krishna Agrawal, Debidatta Dwibedi, Sergey Levine, and Jonathan Tompson. Discriminator-actor-critic: Addressing sample inefficiency and reward bias in adversarial imitation learning. In International Conference on Learning Representations, 2018.
240
+
241
+ Ilya Kostrikov, Ofir Nachum, and Jonathan Tompson. Imitation learning via off-policy distribution matching. International Conference on Learning Representations (ICLR), 2019.
242
+
243
+ HW Kuhn and AW Tucker. Nonlinear programming. In Proceedings of the Second Berkeley Symposium on Mathematical Statistics and Probability. The Regents of the University of California, 1951.
244
+
245
+ Donghun Lee, Srivatsan Srinivasan, and Finale Doshi-Velez. Truly batch apprenticeship learning with deep successor features. International Joint Conference on Artificial Intelligence (IJCAI), 2019.
246
+
247
+ Sergey Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909, 2018.
248
+
249
+ Sergey Levine, Zoran Popovic, and Vladlen Koltun. Nonlinear inverse reinforcement learning with gaussian processes. In Advances in Neural Information Processing Systems, pp. 19–27, 2011.
250
+
251
+ Soren Mindermann, Rohin Shah, Adam Gleave, and Dylan Hadfield-Menell. Active inverse reward ¨ design. arXiv preprint arXiv:1809.03060, 2018.
252
+
253
+ 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.
254
+
255
+ Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. In Icml, volume 1, pp. 2, 2000.
256
+
257
+ Bilal Piot, Matthieu Geist, and Olivier Pietquin. Boosted and reward-regularized classification for apprenticeship learning. In Proceedings of the 2014 international conference on Autonomous agents and multi-agent systems, pp. 1249–1256. International Foundation for Autonomous Agents and Multiagent Systems, 2014.
258
+
259
+ Antonin Raffin. Rl baselines zoo. https://github.com/araffin/rl-baselines-zoo, 2018.
260
+
261
+ Deepak Ramachandran and Eyal Amir. Bayesian inverse reinforcement learning. In IJCAI, volume 7, pp. 2586–2591, 2007.
262
+
263
+ Carl Edward Rasmussen. Gaussian processes in machine learning. In Summer School on Machine Learning, pp. 63–71. Springer, 2003.
264
+
265
+ Siddharth Reddy, Anca D Dragan, and Sergey Levine. Sqil: Imitation learning via reinforcement learning with sparse rewards. In International Conference on Learning Representations, 2019.
266
+
267
+ Constantin A Rothkopf and Christos Dimitrakakis. Preference elicitation and inverse reinforcement learning. In Joint European conference on machine learning and knowledge discovery in databases, pp. 34–48. Springer, 2011.
268
+
269
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
270
+
271
+ Brian D Ziebart. Modeling Purposeful Adaptive Behavior with the Principle of Maximum Causal Entropy. PhD thesis, University of Washington, 2010.
272
+
273
+ Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In Aaai, volume 8, pp. 1433–1438. Chicago, IL, USA, 2008.
274
+
275
+ # A EXPERIMENTAL SETUP
276
+
277
+ Expert Demonstrators. Demonstrations are produced by running pre-trained and hyperparmeteroptimised agents taken from the RL Baselines Zoo (Raffin, 2018) in OpenAI Stable Baselines (Hill et al., 2018). For Acrobot and LunarLander these are DQNs (Mnih et al., 2013), while CartPole uses PPO2 (Schulman et al., 2017). Trajectories were then sub-sampled for every 20th step in Acrobot and CartPole, and every 5th step in LunarLander.
278
+
279
+ Testing setup. For control environments algorithms were presented with (1,3,7,10,15) trajectories uniformly sampled from a pool of 1000 expert trajectories. Each algorithm was then trained until convergence and tested by performing 300 live roll-outs in the simulated environment and recording the average accumulated reward received in each episode. This whole process was then repeated 10 times, consequently with different initialisations and seen trajectories.
280
+
281
+ Implementations. All methods are neural network based and so in experiments they share the same architecture of 2 hidden layers of 64 units each connected by exponential linear unit (ELU) activation functions.
282
+
283
+ Publicly available code was used in the implementations of a number of the benchmarks, specifically:
284
+
285
+ • VDICE (Kostrikov et al., 2019): https://github.com/google-research/google-research/tree/ master/value_dice
286
+ • DSFN (Lee et al., 2019): https://github.com/dtak/batch-apprenticeship-learning
287
+ • EDM (Jarrett et al., 2020): https://github.com/wgrathwohl/JEM
288
+
289
+ Note that VDICE was originally designed for continuous actions with a Normal distribution output which we adapt for the experiments by replacing with a Gumbel-softmax.
290
+
291
+ # B PROOFS
292
+
293
+ Proof of proposition 1. Assuming the constraint is satisfied, we are maximising the following objective:
294
+
295
+ $$
296
+ \mathcal { F } ( \phi , \theta ) = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal { D } } \log \frac { \exp \beta Q _ { \theta } ( s , a ) ) } { \sum _ { b \in \mathcal { A } } \exp ( \beta Q _ { \theta } ( s , b ) ) } - D _ { K L } \big ( q _ { \phi } ( R ( s , a ) ) | | p ( R ( s , a ) ) \big )
297
+ $$
298
+
299
+ Which is equivalent to minimising the negative value
300
+
301
+ $$
302
+ \mathcal { F } ( \phi , \theta ) = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal { D } } - \log \frac { \exp \beta Q _ { \theta } ( s , a ) ) } { \sum _ { b \in \mathcal { A } } \exp ( \beta Q _ { \theta } ( s , b ) ) } + \underbrace { D _ { K L } \big ( q _ { \phi } ( R ( s , a ) ) | | p ( R ( s , a ) ) \big ) } _ { \mathcal { L } _ { r e g } } ,
303
+ $$
304
+
305
+ with the first term $\mathcal { L } _ { B C }$ being the negative log-likelihood of the data and the classic behavioural cloning objective. Now given a standard Gaussian prior then the $\mathrm { K L }$ divergence of a Gaussian with mean $\mu$ and variance $\sigma ^ { 2 }$ from the prior is given by $\begin{array} { r } { \frac { 1 } { 2 } ( - \log ( \sigma ^ { 2 } ) + \sigma ^ { 2 } - 1 + \bar { \mu } ^ { 2 } ) } \end{array}$ (Kingma & Welling,
306
+
307
+ 2013). Then given our prior $p ( R ( s , a ) ) = \mathcal { N } ( R ; 0 , 1 )$ , the KL evaluates as:
308
+
309
+ $$
310
+ \begin{array} { l } { { \displaystyle { \mathcal L } _ { r e g } = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal D } _ { K L } \big ( q _ { \phi } ( R ( s , a ) ) | | p ( R ( s , a ) ) \big ) } } \\ { { = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal D } \frac { 1 } { 2 } \big ( - \log ( \operatorname { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) + \operatorname { V a r } _ { q _ { \phi } } [ R ( s , a ) ] - 1 + \mathbb { E } _ { q _ { \phi } } [ R ( s , a ) ] ^ { 2 } \big ) } } \\ { { = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal D } \frac { 1 } { 2 } \big ( \mathbb { E } _ { q _ { \phi } } [ R ( s , a ) ] ^ { 2 } ) + g ( \operatorname { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) } } \\ { { = \sum _ { ( s , a , s ^ { \prime } , a ^ { \prime } ) \in \mathcal D } \frac { 1 } { 2 } \big ( Q _ { \theta } ( s , a ) - \gamma Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) \big ) ^ { 2 } + g ( \operatorname { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) } } \end{array}
311
+ $$
312
+
313
+ Since by assumption $\mathbb { E } _ { q _ { \phi } } [ R ( s , a ) ] ~ = ~ \mathbb { E } _ { \pi , T } [ Q _ { \theta } ( s , a ) ~ - ~ \gamma Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) ]$ with the expectation approximated over samples in the data and considering a definition of the function $g$ to be $\begin{array} { r } { \dot { g } ( \mathrm { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) = \frac { 1 } { 2 } ( - \log ( \mathrm { V a r } _ { q _ { \phi } } [ R ( s , a ) ] ) + \mathrm { V a r } _ { q _ { \phi } } [ \bar { R } ( s , a ) ] - 1 ) . } \end{array}$ . 
md/train/6vWuYzkp8d/6vWuYzkp8d.md ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Discovering and Achieving Goals via World Models
2
+
3
+ Russell Mendonca\* Carnegie Mellon University
4
+
5
+ Oleh Rybkin\* University of Pennsylvania
6
+
7
+ Kostas Daniilidis University of Pennsylvania
8
+
9
+ Danijar Hafner University of Toronto
10
+
11
+ Deepak Pathak Carnegie Mellon University
12
+
13
+ # Abstract
14
+
15
+ How can artificial agents learn to solve many diverse tasks in complex visual environments without any supervision? We decompose this question into two challenges: discovering new goals and learning to reliably achieve them. Our proposed agent, Latent Explorer Achiever (LEXA), addresses both challenges by learning a world model from image inputs and using it to train an explorer and an achiever policy via imagined rollouts. Unlike prior methods that explore by reaching previously visited states, the explorer plans to discover unseen surprising states through foresight, which are then used as diverse targets for the achiever to practice. After the unsupervised phase, LEXA solves tasks specified as goal images zero-shot without any additional learning. LEXA substantially outperforms previous approaches to unsupervised goal reaching, both on prior benchmarks and on a new challenging benchmark with 40 test tasks spanning across four robotic manipulation and locomotion domains. LEXA further achieves goals that require interacting with multiple objects in sequence.
16
+
17
+ # 1 Introduction
18
+
19
+ How can we build an agent that learns to solve hundreds of tasks in complex visual environments, such as rearranging objects with a robot arm or completing chores in a kitchen? While traditional reinforcement learning (RL) has been successful for individual tasks, it requires a substantial amount of human effort for every new task. Specifying task rewards requires domain knowledge, access to object positions, is timeconsuming, and prone to human errors. Moreover, traditional RL would require environment interaction to explore and practice in the environment for every new task. Instead, we approach learning hundreds of tasks through the paradigm of unsupervised goal-conditioned RL, where the agent learns many diverse skills in the environment in the complete absence of supervision, to later solve tasks via user-specified goal images immediately without further training [2, 26, 40].
20
+
21
+ Challenges Exploring the environment and learning to solve many different tasks is substantially more challenging than traditional RL with a dense reward function or learning from
22
+
23
+ ![](images/e9bbfaebb889bb3a54b1b8ad20dd535aa53cac17ad26150666466df10a82aed2.jpg)
24
+ Figure 1: LEXA learns a world model without any supervision, and leverages it to train two policies in imagination. The explorer finds new images and the achiever learns to reliably reach them. Once trained, the achiever reaches user-specified goals zero-shot without further training at test time.
25
+
26
+ ![](images/ab01d515c5043880effb1e5122d6556dd9c7a184f2bc430aef795af4ecd91478.jpg)
27
+ Figure 2: We benchmark LEXA across four visual control environments. A representative sample of the test-time goals is shown here. RoboYoga features complex locomotion and precise control of high-dimensional agents, RoboBins manipulation with multiple objects, and RoboKitchen a variety of diverse tasks that require complex control strategies such as opening a cabinet.
28
+
29
+ expert demonstrations. Existing methods are limited to simple tasks, such as picking or pushing a puck [13, 32, 37] or controlling simple 2D robots [50]. The key challenge in improving the performance of unsupervised RL is exploration. In particular, previous approaches explore by either revisiting previously seen rare goals [14, 18, 55] or sampling goals from a generative model [32, 37]. However, in both these approaches, the policy as well as the generative model are trained on previously visited states from the replay buffer, and hence the sampled goals are either within or near the frontier of agent’s experience. Ideally, we would like the agent to discover goals much beyond its frontier for efficient exploration, but how does an agent generate goals that it is yet to encounter? This is an open question not just for AI but for cognitive science too [42].
30
+
31
+ Approach To rectify this issue, we leverage a learned world model to train a separate explorer and achiever policy in imagination. Instead of randomly sampling or generating goals, our explorer policy discovers distant goals by first planning a sequence of actions optimized in imagination of the world model to find novel states with high expected information gain [30, 43, 44]. It then executes those imagined actions in the environment to discover interesting states without the need to generate them. Note these actions are likely to lead the agent to states which are several steps outside the frontier because otherwise the model wouldn’t have had high uncertainty or information gain. Finally, these discovered states are used as diverse targets for the achiever to practice. We train the achiever from on-policy imagination rollouts within the world model and without relying on experience relabeling, therefore leveraging foresight over hindsight. After this unsupervised training phase, the achiever solves tasks specified as goal images zero-shot without any additional learning at deployment. Unlike in the conventional RL paradigm [31, 47], our method is trained once and then used to achieve several tasks at test time without any supervision during training or testing.
32
+
33
+ Contributions We introduce Latent Explorer Achiever (LEXA), an unsupervised goal reaching agent that trains an explorer and an achiever within a shared world model. At training, LEXA unlocks diverse data for goal reaching in environments where exploration is nontrivial. At test time, the achiever solves challenging locomotion and manipulation tasks provided as user-specified goal images. Our contributions are summarized as follows:
34
+
35
+ • We propose to learn separate explorer and achiever policies as an approach to overcome the exploration problem of unsupervised goal-conditioned RL.
36
+ • We show that forward-looking exploration by planning with a learned world model substantially outperforms previous strategies for goal exploration.
37
+ • To evaluate on challenging tasks, we introduce a new goal reaching benchmark with a total of 40
38
+ diverse goal images across 4 different robot locomotion and manipulation environments.
39
+ • LEXA outperforms prior methods, being the first to show success in the Kitchen robotic manipulation environment, and achieves goal images where multiple objects need to be moved.
40
+
41
+ ![](images/261b4f4a6881305424cba99bcd987917803949b8856632917f699dbdedfd6295.jpg)
42
+ Figure 3: Latent Explorer Achiever (LEXA) learns a general world model that is used to train an explorer and a goal achiever policy. The explorer (left) is trained on imagined latent state rollouts of the world model $s _ { t : T }$ to maximize the disagreement objective $r _ { t } ^ { e } = \mathrm { V a r } ( \bar { s ^ { \prime } } )$ . The goal achiever (right) is conditioned on a goal $g$ and is also trained on imagined rollouts to minimize a distance function $d ( s _ { t } , e _ { g } )$ . Goals are sampled randomly from replay buffer images. For training a temporal distance, we use the imagined rollouts of the achiever and predict the number of time steps between each two states. By combining forward-looking exploration and data-efficient training of the achiever, LEXA provides a simple and powerful solution for unsupervised reinforcement learning.
43
+
44
+ # 2 Latent Explorer Achiever (LEXA)
45
+
46
+ Our aim is to build an agent that can achieve arbitrary user-specified goals after learning in the environment without any supervision. This presents two challenges - collecting trajectories that contain diverse goals and learning to achieve these goals when specified as a goal image. We introduce a simple solution based on a world model and imagination training that addresses both challenges. The world model represents the agent’s current knowledge about the environment and is used for training two policies, the explorer and the achiever. To explore novel situations, we construct an estimate of which states the world model is still uncertain about. To achieve goals, we train the goal-conditioned achiever in imagination, using the images found so far as unsupervised goals. At test time, the achiever is deployed to reach user-specified goals. The training procedure is in Algorithm 1.
47
+
48
+ # 2.1 World Model
49
+
50
+ To efficiently predict potential outcomes of future actions in environments with high-dimensional image inputs, we leverage a Recurrent State Space Model (RSSM) [23] that learns to predict forward using compact model states that facilitate planning [7, 51]. In contrast to predicting forward in image space, the model states enable efficient parallel planning with a large batch size and can reduce accumulating errors [39]. The world model consists of the following components:
51
+
52
+ $$
53
+ { \begin{array} { l l l } { e _ { t } = \operatorname { e n c } _ { \phi } ( x _ { t } ) } & { { \mathrm { P o s t e r i o r : } } } & { \ q _ { \phi } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , e _ { t } ) } \\ { p _ { \phi } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) } & { { \mathrm { I m a g e ~ d e c o d e r : } } } & { \ p _ { \phi } ( x _ { t } \mid s _ { t } ) } \end{array} }
54
+ $$
55
+
56
+ The model states $s _ { t }$ contain a deterministic component $h _ { t }$ and a stochastic component $z _ { t }$ with diagonalcovariance Gaussian distribution. $h _ { t }$ is the recurrent state of a Gated Recurrent Unit (GRU) [11]. The encoder and decoder are convolutional neural networks (CNNs) and the remaining components are multi-layer perceptrons (MLPs). The world model is trained end-to-end by optimizing the evidence lower bound (ELBO) via stochastic backpropagation [28, 38] with the Adam optimizer [27].
57
+
58
+ # 2.2 Explorer
59
+
60
+ To efficiently explore, we seek out surprising states imagined by the world model [6, 41, 43, 44, 46], as opposed to retrospectively exploring by revisiting previously novel states [4, 5, 8, 34]. As the world model can predict model states that correspond to unseen situations in the environment, the imagined trajectories contain more novel goals, compared to model-free exploration that is limited to the replay buffer. To collect informative novel trajectories in the environment, we train an exploration
61
+
62
+ 1: initialize: World model $\mathcal { M }$ , Replay buffer $\mathcal { D }$ , Explorer $\pi ^ { \mathrm { e } } ( a _ { t } \mid z _ { t } )$ , Achiever $\pi ^ { \mathbf { g } } ( a _ { t } \mid z _ { t } , g )$
63
+ 2: while exploring do
64
+ 3: Train $\mathcal { M }$ on $\mathcal { D }$
65
+ 4: Train $\pi ^ { \mathrm { e } }$ in imagination of $\mathcal { M }$ to maximize exploration rewards $\textstyle \sum _ { t } r _ { t } ^ { \mathrm { e } }$ .
66
+ 5: Train $\pi ^ { \mathrm { g } }$ in imagination of $\mathcal { M }$ to maximize $\textstyle \sum _ { t } r _ { t } ^ { \mathrm { g } } ( z _ { t } , g )$ for images $g \sim \mathcal { D }$ .
67
+ 6: (Optional) Train $d ( z _ { i } , z _ { j } )$ to predict distances $j - i$ on the imagination data from last step.
68
+ 7: Deploy $\pi ^ { \mathrm { e } }$ in the environment to explore and grow $\mathcal { D }$ .
69
+ 8: Deploy $\pi ^ { \mathrm { g } }$ in the environment to achieve a goal image $g \sim \mathcal { D }$ to grow $\mathcal { D }$ .
70
+ 9: end while
71
+ 10: while evaluating do
72
+ 11: given: Evaluation goal $g$
73
+ 12: Deploy $\pi ^ { \mathrm { g } }$ in the world to reach $g$ .
74
+ 13: end while
75
+
76
+ policy $\pi ^ { e }$ from the model states $s _ { t }$ in imagination of the world model to maximize an exploration reward:
77
+
78
+ $$
79
+ { \mathrm { E x p l o r e r : } } \qquad \pi ^ { e } ( a _ { t } \mid s _ { t } ) \qquad { \mathrm { E x p l o r e r ~ V a l u e : } } \qquad v ^ { e } ( s _ { t } )
80
+ $$
81
+
82
+ To explore the most informative model states, we estimate the epistemic uncertainty as a disagreement of an ensemble of transition functions. We train an ensemble of 1-step models to predict the next model state from the current model state. The ensemble model is trained alongside the world model on model states produced by the encoder $q _ { \phi }$ . Because the ensemble models are initialized at random, they will differ, especially for inputs that they have not been trained on [29, 36]:
83
+
84
+ $$
85
+ \mathrm { E n s e m b l e : } \quad f ( s _ { t } , \theta ^ { k } ) = \hat { z } _ { t + 1 } ^ { k } \quad \mathrm { f o r } \quad k = 1 . . K
86
+ $$
87
+
88
+ Leveraging the ensemble, we estimate the epistemic uncertainty as the ensemble disagreement. The exploration reward is the variance of the ensemble predictions averaged across dimension of the model state, which approximates the expected information gain [3, 43]:
89
+
90
+ $$
91
+ r _ { t } ^ { \mathrm { e } } ( s _ { t } ) \doteq \frac { 1 } { N } \sum _ { n } \operatorname { V a r } _ { \{ \mathrm { k } \} } \left[ f ( s _ { t } , \theta _ { k } ) \right] _ { n }
92
+ $$
93
+
94
+ The explorer $\pi ^ { e }$ maximizes the sum of future exploration rewards $\boldsymbol { r } _ { t } ^ { e }$ using the Dreamer algorithm [24], which considers long-term rewards into the future by maximizing $\lambda$ -returns under a learned value function. As a result, the explorer is trained to seek out situations are as informative as possible from imagined latent trajectories of the world model, and is periodically deployed in the environment to add novel trajectories to the replay buffer, so the world model and goal achiever policy can improve.
95
+
96
+ # 2.3 Achiever
97
+
98
+ To leverage the knowledge obtained by exploration for learning to reach goals, we train a goal achiever policy $\pi ^ { g }$ that receives a model state and a goal as input. Our aim is to train a general policy that is capable of reaching many diverse goals. To achieve this in a data-efficient way, it is crucial that environment trajectories that were collected with one goal in mind are reused to also learn how to reach other goals. While prior work addressed this by goal relabeling which makes off-policy policy optimization a necessity [2], we instead leverage past trajectories via the world model trained on them that lets us generate an unlimited amount of new imagined trajectories for training the goal achiever on-policy in imagination. This simplifies policy optimization and can improve stability, while still sharing all collected experience across many goals.
99
+
100
+ $$
101
+ \pi ^ { g } ( a _ { t } \mid s _ { t } , e _ { g } ) \qquad \mathrm { A c h i e v e r ~ V a l u e } ; \qquad v ^ { g } ( s _ { t } , e _ { g } )
102
+ $$
103
+
104
+ To train the goal achiever, we sample a goal image $x _ { g }$ from the replay buffer and compute its embedding $e _ { g } = \mathrm { e n c } _ { \phi } ( x _ { g } )$ . The achiever aims to maximize an unsupervised goal-reaching reward $r ^ { g } ( s _ { t } , e _ { g } )$ . We discuss different choices for this reward in Section 2.4. We again use the Dreamer algorithm [24] for training, where now the value function also receives the goal embedding as input. In addition to imagination training, it can also be important to perform practice trials with the goal achiever in the true environment, so that any model inaccuracies along the goal reaching trajectories may be corrected. To perform practice trials, we sample a goal from the replay buffer and execute the goal achiever policy for that goal in the environment. These trials are interleaved with exploration episodes collected by the exploration policy in equal proportion. We note that the goal achiever learning is entirely unsupervised because the practice goals are simply images the agent encountered through exploration or during previous practice trails.
105
+
106
+ ![](images/8833211f2fc46aac053a0c19271c2751e3ee461c189b8c3a201cf26bcb97a95e.jpg)
107
+ Figure 4: Successful LEXA trajectories. When given a goal image from the test set, LEXA’s achiever is used in the environment to reach that image. On RoboKitchen, LEXA manipulates up to three different objects together from a single goal image (kettle, light switch, and cabinet). On RoboBins, LEXA performs temporally extended tasks such as picking and placing two objects in a row.
108
+
109
+ # 2.4 Latent Distances
110
+
111
+ Training the achiever policy requires us to define a goal achievement reward $r ^ { g } ( s _ { t } , e _ { g } )$ that measures how close the latent state $s _ { t }$ should be considered to the goal $e _ { g }$ . One simple measure is the cosine distance in the latent space obtained by inputting image observations into the world-model. However, such a distance function brings visually similar states together even if they could be farther apart in temporal manner as measured by actions needed to reach from one to other. This bias makes this suitable only to scenarios where most of pixels in the observations are directly controllable, e.g., trying to arrange robot’s body in certain shape, such as RoboYoga poses in Figure 2. However, many environments contain agent as well as the world, such as manipulation involves interacting with objects that are not directly controllable. The cosine distance would try matching the entire goal image, and thus places a large weight on both matching the robot and object positions with the desired goal. Since the robot position is directly controllable it is much easier to match, but this metric overly focuses on it, yielding poor policies that ignore objects. We address this is by using the number of timesteps it takes to move from one image to another as a distance measure [25, 26]. This ignores large changes in robot position, since these can be completed in very few steps, and will instead focus more on the objects. This temporal cost function can be learned purely in imagination rollouts from our world model allowing as much data as needed without taking any steps in the real world.
112
+
113
+ Cosine Distance To use cosine distance with LEXA, for a latent state $s _ { t }$ , and a goal embedding $e ^ { g }$ , we use the latent inference network $q$ to infer $s ^ { g }$ , and define the reward as the cosine similarity [54]:
114
+
115
+ $$
116
+ r _ { t } ^ { g } ( s _ { t } , e _ { g } ) \doteq \sum _ { i } \overline { { s } } _ { t i } \overline { { s } } _ { g i } , \quad \mathrm { w h e r e } \quad \overline { { s } } _ { t } = s _ { t } / \| s _ { t } \| _ { 2 } , \quad \overline { { s } } _ { g } = s _ { g } / \| s _ { g } \| _ { 2 } ,
117
+ $$
118
+
119
+ i.e. the cosine of the angle between the two vectors $s _ { t } , s _ { g }$ in the $N -$ dimensional latent space.
120
+
121
+ Temporal Distance To use temporal distances with LEXA, we train a neural network $d$ to predict the number of time steps between two embeddings. We train it by sampling pairs of states $s _ { t }$ , $s _ { t + k }$ from an imagined rollout of the achiever and predicting the distance $k$ . We implement the temporal distance in terms of predicted image embeddings $\boldsymbol { \hat { e } } _ { t + k }$ in order to remove extra recurrent information:
122
+
123
+ Predicted embedding: $\mathrm { e m b } ( s _ { t } ) = \hat { e } _ { t } \approx e _ { t } { \quad } \mathrm { T e m p o r a l ~ d i s t a n c e } ; \quad d _ { \omega } ( \hat { e } _ { t } , \hat { e } _ { t + k } ) \approx k / H ,$ where $H$ is the maximum distance equal to the imagination horizon. Training distance function only on imagination data from the same trajectory would cause it to predict poor distance to far away states coming from other trajectories, such as images that are impossible to reach during one episode. In order to incorporate learning signal from such far-away goals, we include them by sampling images from a different trajectory. We annotate these negative samples with the maximum possible distance, so that the agent always prefers images that were seen in the same trajectory.
124
+
125
+ ![](images/b02095cdb02ada544f65d40a4cf2610dc2db333769a1afaf5a6454034a90d495.jpg)
126
+ Figure 5: Coincidental goal success achieved during the unsupervised exploration phase. The forwardlooking explorer policy of LEXA results in substantially better coverage compared to SkewFit, a popular method for goal based exploration.
127
+
128
+ $$
129
+ r _ { t } ^ { g } ( s _ { t } , e _ { g } ) = - d _ { \omega } ( \hat { e } _ { t } , e _ { g } ) , \quad \mathrm { w h e r e } \quad \hat { e } _ { t } = \mathrm { e m b } ( s _ { t } ) , \quad e _ { g } = \mathrm { e n c } _ { \phi } ( x _ { g } )
130
+ $$
131
+
132
+ The learned distance function depends on the training data policy. However, as the policy becomes more competent, the distance estimates will be closer to the optimal number of time steps to reach a particular goal, and the policy converges to the optimal solution [25]. LEXA always uses the latest data to train the distance function using imagination, ensuring that the convergence is fast.
133
+
134
+ # 3 Experiments
135
+
136
+ Our evaluation focuses on the following scientific questions:
137
+
138
+ 1. Does LEXA outperform prior work on previous benchmarks and a new challenging benchmark?
139
+ 2. How does forward-looking exploration of goals compare to previous goal exploration strategies?
140
+ 3. How does the distance function affect the ability to reach goals in different types of environments?
141
+ 4. Can we train one general LEXA to control different robots across visually distinct environments?
142
+ 5. What components of LEXA are important for performance?
143
+
144
+ We evaluate LEXA on prior benchmarks used by SkewFit [37], DISCERN [50], and Plan2Explore [43] in Section 3.3. Since these benchmarks are largely saturated, we also introduce a new challenging benchmark shown in Figure 2. We evaluate LEXA on this benchmark is Section 3.2.
145
+
146
+ # 3.1 Experimental setup
147
+
148
+ As not many prior methods have shown success on reaching diverse goals from image inputs, we perform an apples-to-apples comparison by implementing the baselines using the same world model and policy optimization as our method:
149
+
150
+ • SkewFit SkewFit [37] uses model-free hindsight experience replay and explores by sampling goals from the latent space of a variational autoencoder [28, 38]. Being one of the state-of-the-art agents, we use the original implementation that does not use a world model or explorer policy.
151
+ • DDL Dynamic Distance Learning [25] trains a temporal distance function similar to our method. Following the original algorithm, DDL uses greedy exploration and trains the distance function on the replay buffer instead of in imagination.
152
+ • DIAYN Diversity is All You Need [15] learns a latent skill space and uses mutual information between skills and reached states as the objective. We augment DIAYN with our explorer policy and train a learned skill predictor to obtain a skill for a given test image [12].
153
+ • GCSL Goal-Conditioned Supervised Learning [20] trains the goal policy on replay buffer goals and mimics the actions that previously led to the goal. We also augment GCSL with our explorer policy, as we found no learning success without it.
154
+
155
+ Our new benchmark defines goal images for a diverse set of four existing environments as follows:
156
+
157
+ ![](images/1310ecf4c91afe8a97fdd0a2ff16844020c1a947729ce1b05b3d97a0c5844f2a.jpg)
158
+ Figure 6: Evaluation of goal reaching agents on our four benchmarks. A single agent is trained from images without rewards and then evaluated on reaching goal images from the test set (see Figure 1). Both LEXA agents solve many of the tasks and significantly outperform prior work. SkewFit and DLL struggle with exploration, while DIAYN and GCSL use our explorer but still are not able to learn a good downstream policy. Refer table 1 for final success percentage (averaged across tasks) for each method and benchmark domain.
159
+
160
+ • RoboYoga We use the walker and quadruped domains of the DeepMind Control Suite [48] to define the RoboYoga benchmark, consisting of 12 goal images that correspond to different body poses for each of the two environments, such as lying down, standing up, and balancing. • RoboBins Based on MetaWorld [53], we create a scene with a Sawyer robotic arm, two bins, and two blocks of different colors. The goal images specify tasks that include reaching, manipulating only one block, and manipulating both blocks. • RoboKitchen The last benchmark involves the challenging kitchen environment from [22], where a franka robot can interact with various objects including a burner, light switch, sliding cabinet, hinge cabinet, microwave, or kettle. The goal images we include describe tasks that require interacting with only one object, as well as interacting with two objects.
161
+
162
+ # 3.2 Performance on New Benchmark
163
+
164
+ We show the results on our main benchmark in Figure 6 and include heatmaps that show per-task success on each of the evaluation tasks from the benchmarks in the Appendix. Further, we report success averaged across tasks for each domain at the end of training in Table 1. We visualize example successful trajectory executions for tasks that require manipulating multiple objects in Fig. 4.
165
+
166
+ RoboYoga The environments in this benchmark are directly controllable since they contain no other objects except the robot. We recall that for such settings we expect the cosine distance to be effective, as perceptual distance is quite accurate. Training is thus faster compared to using learned temporal distances, where the metric is learned from scratch. From Table 1 and Figure 6 we see that this is indeed the case for these environments (Walker and Quadruped), as LEXA with the cosine metric outperforms all prior approaches. Furthermore with temporal distances LEXA makes better progress compared to prior work on a much larger number of goals as can be seen from the per-task performance (Figures ??, ??), even though average success over goals looks similar to that of DDL.
167
+
168
+ RoboBins This environment involves interaction with block objects, and thus is not directly controllable, and so we expect LEXA to perform better with the temporal distance metric. From Table 1 and
169
+
170
+ <table><tr><td>Method</td><td>Kitchen</td><td>RoboBins</td><td>Quadruped</td><td>Walker</td></tr><tr><td>DDL</td><td>0.00</td><td>35.42</td><td>22.50</td><td>40.00</td></tr><tr><td>DIAYN</td><td>0.00</td><td>13.69</td><td>13.81</td><td>0.28</td></tr><tr><td>GCSL</td><td>0.00</td><td>7.94</td><td>15.83</td><td>1.11</td></tr><tr><td>SkewFit</td><td>0.23</td><td>15.77</td><td>5.52</td><td>0.01</td></tr><tr><td>LEXA + Temporal (Ours)</td><td>37.50</td><td>69.44</td><td>31.39</td><td>36.72</td></tr><tr><td>LEXA + Cosine (Ours)</td><td>6.02</td><td>45.83</td><td>56.11</td><td>73.06</td></tr></table>
171
+
172
+ Table 1: Performance on our new challenging benchmark, spanning across the four domains shown in Figure 2. The number are goal success rates, averaged over test goals within each environment.
173
+
174
+ ![](images/1ef7c10b47d9d98a8e1a64e538f880461c2ee0273a63c335f48dbd65f5cbaaed.jpg)
175
+ Figure 7: Success rates on RoboBin. In line with the prior literature, previous methods are successful at reaching and sometimes pushing. LEXA pushes the state-of-the-art by picking and placing multiple objects to reach challenging goal images. Analogous heat maps for the other domains are included in the appendix.
176
+
177
+ Figure 6, we see that LEXA gets higher average success than all prior approaches. Further from the per-task performance in 7, LEXA with the temporal distance metric is the only approach that makes progress on all goals in the benchmark. The main difference in performance between using temporal and cosine distance can be seen in the tasks involving two blocks, which are the most complex tasks in this environment (the last 3 columns of the per-task plot). The best performing prior method is DDL which solves reaching, and can perform simple pushing tasks. This method performs poorly due to poor exploration, as shown in Figure 5. We see that while other prior methods make some progress on reaching, they fail on harder tasks.
178
+
179
+ RoboKitchen This benchmark involves diverse objects that require different manipulation behavior. From Table 1 and Figure 6 and ?? we find that LEXA with temporal distance is able to learn multiple RoboKitchen tasks, some of which require sequentially completing 2 tasks in the environment. All prior methods barely make progress due to the challenging nature of this benchmark, and furthermore using the cosine distance function makes very limited progress. The gap in performance between using the two distance functions is much larger in this environment compared to RoboBins since there are many more objects and they are not as clearly visible as the blocks.
180
+
181
+ # Single Agent Across All Environments
182
+
183
+ In the previous sections we have shown that our approach can achieve diverse goals in different environments. However, we trained a new agent for every new environment, which doesn’t scale well to large numbers of environments. Thus we investigate if we can train a train a single agent across four environments in the benchmark. From Figure ?? we see that our approach with learned temporal distance is able to make progress on tasks from RoboKitchen, RoboBins Reaching, RoboBins Pick & Place and Walker, while the best prior method on the single-environment tasks (DDL) mainly solves walker tasks and reaching from RoboBin.
184
+
185
+ # 3.3 Performance on Prior benchmarks
186
+
187
+ To further verify the results obtained on our benchmark, we evaluate LEXA on previously used benchmarks. We observe that LEXA significantly outperforms prior work on these benchmarks, and is often close to the optimal policy. Additional details are provided in ??????.
188
+
189
+ SkewFit Benchmark SkewFit [37] introduces a robotic manipulation benchmark for unsupervised methods with simple tasks like planar pushing or picking. We evaluate on this benchmark in Table 2.
190
+
191
+ Table 2: Goal distance for SkewFit goals [37].
192
+
193
+ <table><tr><td>Method</td><td>Pusher</td><td>Pickup</td></tr><tr><td>RIG [32]</td><td>7.7cm</td><td>3.7cm</td></tr><tr><td>RIG + HER [2]</td><td>7.5cm</td><td>3.5cm</td></tr><tr><td>Skew-Fit [37]</td><td>4.9cm</td><td>1.8cm</td></tr><tr><td>LEXA + Temporal</td><td>2.3cm</td><td>1.4cm</td></tr></table>
194
+
195
+ Baseline results are taken from [37]. LEXA significantly outperforms prior work on these tasks. Pushing and picking up blocks from images is largely solved and future work can focus on harder benchmarks such as those introduced in our paper.
196
+
197
+ DISCERN Benchmark We attempted to replicate the tasks described in [50] that are based on simple two-dimensional robots [48]. While the original tasks are not released, we followed the procedure for generating the goals described in the paper. Despite following the exact procedure, we were not able to obtain similar goals to the ones used in the original paper. Nevertheless, we show the goal completion percentage results obtained with our reproduced evaluation compared to DISCERN results from the original paper. LEXA results were obtained with early stopping. In Table 3 we see that our agent solves many of the tasks in this benchmark.
198
+
199
+ Table 3: Success for DISCERN goals [50].
200
+
201
+ <table><tr><td>Task</td><td>LEXA</td><td>DISCERN</td></tr><tr><td>Cup</td><td>84.0%</td><td>76.5%</td></tr><tr><td>Cartpole</td><td>35.9%</td><td>21.3%</td></tr><tr><td>Finger</td><td>40.9%</td><td>21.8%</td></tr><tr><td>Pendulum</td><td>79.1%</td><td>75.7%</td></tr><tr><td>Pointmass</td><td>83.2%</td><td>49.6%</td></tr><tr><td>Reacher</td><td>100.0%</td><td>87.1%</td></tr></table>
202
+
203
+ Plan2Explore Benchmark We provide a comparison on the standard reward-based DM control tasks [48] in Table 4. To compare on this benchmark, we create goal images that correspond to the reward functions. This setup is arguably harder for our agent, but is much more practical. Note our agent never observes the reward function and only observes the goal at test time. Plan2Explore adapts to new tasks but it needs the reward function to be known at test time, while DrQV2 is an oracle agent that observes the reward at training time. Baseline results are taken from [43, 52]. LEXA results were obtained with early stopping. LEXA outperforms Plan2Explore on most tasks and even performs comparably to state of the art oracle agents (DrQ, DrQv2, Dreamer) that use true task rewards during training.
204
+
205
+ Table 4: Zero-shot return on P2E tasks [43].
206
+
207
+ <table><tr><td>Task Zero-Shot</td><td>LEXA [</td><td>P2E</td><td>DrQv2 X</td></tr><tr><td>Walker Stand</td><td>957</td><td>331</td><td>968</td></tr><tr><td>Hopper Stand</td><td>840</td><td>841</td><td>957</td></tr><tr><td>Cartpole Balance</td><td>886</td><td>950</td><td>989</td></tr><tr><td>Cartpole Bal. Sparse</td><td>996</td><td>860</td><td>983</td></tr><tr><td>Pendulum Swing Up</td><td>788</td><td>792</td><td>837</td></tr><tr><td>Cup Catch</td><td>969</td><td>962</td><td>909</td></tr><tr><td>Reacher Hard</td><td>937</td><td>66</td><td>970</td></tr></table>
208
+
209
+ # 3.4 Analysis
210
+
211
+ Prior work Most work we compared against struggles with exploration, such as SkewFit and DLL methods. DIAYN is augmented with our explorer, but still fails to leverage the exploration data to learn a diverse set of skills. GCSL struggles to fit the exploration data and produces behavior that does not solve the task, perhaps because the exploration data is too diverse. We observed that all baselines make progress on the simple reaching, but struggle with other tasks. We have experimented with several versions and improvements to the baselines and report the best obtained performance.
212
+
213
+ Ablation of different components We ablated components of LEXA on the RoboBins environment in Figure 8. Using a separate explorer policy crucial as without it the agent does not discover the more interesting tasks. Without negative sampling the agent learns slower, perhaps because the distance function doesn’t produce reasonable outputs when queried on images that are more than horizon length apart. Training the distance function with real data converges to slightly lower success than using imagination data, since real data is sampled in an off-policy manner due to its limited quantity.
214
+
215
+ ![](images/e74e622cfc1a92b2076d60433d82e8c9de54acaa1e72a8a8ad12dea1ef790bc6.jpg)
216
+ Figure 8: Ablations on RoboBins. A separate explorer is crucial for most tasks. Training temporal distance on negative samples speeds up learning, and both negative sampling and training in imagination as opposed to real data are important for the hardest tasks.
217
+
218
+ Exploration performance Due to importance of exploration, we further examine the diversity of the data collected during training. We log the instances where the agent coincidentally solves an evaluation task during exploration, for the RoboKitchen and RoboBins environments. In Figure 5, we see that our method encounters harder tasks involving multiple objects much more often.
219
+
220
+ # 4 Related Work
221
+
222
+ Learning to Achieve Goals The problem of learning to reach many different goals has been commonly addressed with model-free methods that learn a single goal-conditioned policy [2, 26, 40]. Recent work has combined these approaches with various ways to generate training goals, such as asymmetric self-play [33, 45] or by sampling goals of intermediate difficulty [14, 18]. These approaches can achieve remarkable performance in simulated robotic domains, however, they focus on the settings where the agent can directly perceive the low-dimensional environment state.
223
+
224
+ A few works have attempted to scale these model-free methods to visual goals by using contrastive [50] or reconstructive [32, 37] representation learning. However, these approaches struggle to perform meaningful exploration as no clear reward signal is available to guide the agent toward solving interesting tasks. Some works [10, 49] avoid this challenge by using a large dataset of interesting behaviors. Other works [37, 55] attempt to explore by generating goals similar to those that have already been seen, but do not try to explore truly novel states.
225
+
226
+ A particularly relevant set of approaches used model-based methods to achieve goals via planning [13, 17] or learning model-regularized policies [35]. However, these approaches are limited by short planning horizons. In contrast, we learn long-horizon goal-conditioned value functions which allows us to solve more challenging tasks. More generally, most of the above approaches are limited by simplistic exploration, while our method leverages model imagination to search for novel states, which significantly improves exploration and in turn the downstream capabilities of the agent.
227
+
228
+ Learning Distance Functions A crucial challenge for visual goal reaching is the choice of the reward or the cost function for the goal achieving policy. Several approaches use representation learning to create a distance in the feature space [9, 32, 50, 51]. However, this naive distance may not be most reflective of how hard a particular goal is to reach. One line of research has proposed using the mutual information between the current state and the goal as the distance metric [1, 12, 15, 21], however, it remains to be seen whether this approach can scale to more complex tasks.
229
+
230
+ Other works proposed temporal distances that measure the amount of time it takes to reach the goal. One approach is to learn the distance with approximate dynamic programming using Q-learning methods [16, 19, 26]. Our distance function is most similar to Hartikainen et al. [25], who learn a temporal distance with supervised learning on recent policy experience. In contrast to [25], we always train the distance on-policy in imagination, and we further integrate this achiever policy into our latent explorer achiever framework to discover novel goals for the achiever to practice on.
231
+
232
+ # 5 Conclusion
233
+
234
+ We presented Latent Explorer Achiever (LEXA), an agent for unsupervised RL that explores its environment, learns to achieve the discovered goals, and solves image-based tasks in a zero-shot way. By planning for novelty in imagination, LEXA prospectively explores to discover meaningful behaviors in substantially more diverse environments than considered by prior work. Further, LEXA is able to solve challenging downstream tasks specified as images without any supervision such as rewards or demonstrations. By proposing a challenging benchmark and the first agent to achieve meaningful performance on these tasks, we hope to stimulate future research on unsupervised agents, which we believe are fundamentally more scalable than traditional agents that require a human to design the tasks and rewards for learning.
235
+
236
+ Many challenges remain for building unsupervised agents. Many tasks in our benchmark are still unsolved and there remains room for progress on the algorithmic side both for the world model and policy optimization. Further, it is important to demonstrate the benefits of unsupervised agents on real-world systems to verify their scalability. Finally, for widespread adoption, it is crucial to consider the problem of goal specification and design methods that act on goals that are easy to specify, such as via natural language. We believe LEXA will enable future work to tackle these goals effectively.
237
+
238
+ Acknowledgements We thank Ben Eysenbach, Stephen Tian, Sergey Levine, Dinesh Jayaraman, Karl Pertsch, Ed Hu and the members of GRASP lab and Pathak lab for insightful discussions. We also thank Murtaza Dalal and Chuning Zhu for help with MuJoCo environments. Finally, DP would like to thank Laura Schulz, Josh Tenenbaum and Alison Gopnik for seeding the idea of goal-setting in children, and Pulkit Agrawal for several crucial discussions (over gelato) since then. OR and KD were supported by ARL DCIST CRA W911NF-17-2-0181, ONR N00014-17-1-2093, and by Honda Research Institute. This work was partially supported by GoodAI Research Award and DARPA Machine Common Sense grant.
239
+
240
+ References [1] J. Achiam, H. Edwards, D. Amodei, and P. Abbeel. Variational option discovery algorithms. arXiv preprint arXiv:1807.10299, 2018. 10 [2] M. Andrychowicz, F. Wolski, A. Ray, J. Schneider, R. Fong, P. Welinder, B. McGrew, J. Tobin, P. Abbeel, and W. Zaremba. Hindsight experience replay. arXiv preprint arXiv:1707.01495,
241
+ 2017. 1, 4, 8, 10 [3] P. Ball, J. Parker-Holder, A. Pacchiano, K. Choromanski, and S. Roberts. Ready policy one: World building through active learning. In International Conference on Machine Learning, pages 591–601. PMLR, 2020. 4 [4] M. Bellemare, S. Srinivasan, G. Ostrovski, T. Schaul, D. Saxton, and R. Munos. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems, pages 1471–1479, 2016. 3 [5] L. Beyer, D. Vincent, O. Teboul, S. Gelly, M. Geist, and O. Pietquin. Mulex: Disentangling exploitation from exploration in deep rl. arXiv preprint arXiv:1907.00868, 2019. 3 [6] B. Bucher, K. Schmeckpeper, N. Matni, and K. Daniilidis. Adversarial curiosity. arXiv preprint arXiv:2003.06082, 2020. 3 [7] L. Buesing, T. Weber, S. Racaniere, S. Eslami, D. Rezende, D. P. Reichert, F. Viola, F. Besse, K. Gregor, D. Hassabis, et al. Learning and querying fast generative models for reinforcement learning. arXiv preprint arXiv:1802.03006, 2018. 3 [8] Y. Burda, H. Edwards, A. Storkey, and O. Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018. 3 [9] V. Campos, A. Trott, C. Xiong, R. Socher, X. Giró-i Nieto, and J. Torres. Explore, discover and learn: Unsupervised discovery of state-covering skills. In International Conference on Machine Learning, pages 1317–1327. PMLR, 2020. 10 [10] Y. Chebotar, K. Hausman, Y. Lu, T. Xiao, D. Kalashnikov, J. Varley, A. Irpan, B. Eysenbach, R. Julian, C. Finn, et al. Actionable models: Unsupervised offline reinforcement learning of robotic skills. arXiv preprint arXiv:2104.07749, 2021. 10 [11] K. Cho, B. Van Merriënboer, C. Gulcehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014. 3 [12] J. Choi, A. Sharma, S. Levine, H. Lee, and S. S. Gu. Variational empowerment as representation learning for goal-based reinforcement learning. In Deep Reinforcement Learning workshop at the Conference on Neural Information Processing Systems (DRL), 2020. 6, 10 [13] F. Ebert, C. Finn, S. Dasari, A. Xie, A. Lee, and S. Levine. Visual foresight: Model-based deep reinforcement learning for vision-based robotic control. arXiv preprint arXiv:1812.00568, 2018.
242
+ 2, 10 [14] A. Ecoffet, J. Huizinga, J. Lehman, K. O. Stanley, and J. Clune. Go-explore: a new approach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019. 2, 10 [15] B. Eysenbach, A. Gupta, J. Ibarz, and S. Levine. Diversity is all you need: learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018. 6, 10 [16] B. Eysenbach, R. Salakhutdinov, and S. Levine. Search on the replay buffer: Bridging planning and reinforcement learning. arXiv preprint arXiv:1906.05253, 2019. 10 [17] C. Finn and S. Levine. Deep visual foresight for planning robot motion. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pages 2786–2793. IEEE, 2017. 10 [18] C. Florensa, D. Held, X. Geng, and P. Abbeel. Automatic goal generation for reinforcement learning agents. In International conference on machine learning, pages 1515–1528. PMLR,
243
+ 2018. 2, 10
244
+ [19] C. Florensa, J. Degrave, N. Heess, J. T. Springenberg, and M. Riedmiller. Self-supervised learning of image embedding for continuous control. arXiv preprint arXiv:1901.00943, 2019. 10
245
+ [20] D. Ghosh, A. Gupta, J. Fu, A. Reddy, C. Devin, B. Eysenbach, and S. Levine. Learning to reach goals without reinforcement learning. arXiv preprint arXiv:1912.06088, 2019. 6
246
+ [21] K. Gregor, D. J. Rezende, and D. Wierstra. Variational intrinsic control. arXiv preprint arXiv:1611.07507, 2016. 10
247
+ [22] A. Gupta, V. Kumar, C. Lynch, S. Levine, and K. Hausman. Relay policy learning: Solving long-horizon tasks via imitation and reinforcement learning. arXiv preprint arXiv:1910.11956, 2019. 7
248
+ [23] D. Hafner, T. Lillicrap, I. Fischer, R. Villegas, D. Ha, H. Lee, and J. Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018. 3
249
+ [24] D. Hafner, T. Lillicrap, J. Ba, and M. Norouzi. Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603, 2019. 4
250
+ [25] K. Hartikainen, X. Geng, T. Haarnoja, and S. Levine. Dynamical distance learning for semisupervised and unsupervised skill discovery. ICLR, 2020. 5, 6, 10
251
+ [26] L. P. Kaelbling. Learning to achieve goals. In IJCAI, pages 1094–1099. Citeseer, 1993. 1, 5, 10
252
+ [27] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 3
253
+ [28] D. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. 3, 6
254
+ [29] B. Lakshminarayanan, A. Pritzel, and C. Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. arXiv preprint arXiv:1612.01474, 2016. 4
255
+ [30] D. V. Lindley et al. On a measure of the information provided by an experiment. The Annals of Mathematical Statistics, 27(4):986–1005, 1956. 2
256
+ [31] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015. 2
257
+ [32] A. V. Nair, V. Pong, M. Dalal, S. Bahl, S. Lin, and S. Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, pages 9191–9200, 2018. 2, 8, 10
258
+ [33] O. OpenAI, M. Plappert, R. Sampedro, T. Xu, I. Akkaya, V. Kosaraju, P. Welinder, R. D’Sa, A. Petron, H. P. d. O. Pinto, et al. Asymmetric self-play for automatic goal discovery in robotic manipulation. arXiv preprint arXiv:2101.04882, 2021. 10
259
+ [34] D. Pathak, P. Agrawal, A. A. Efros, and T. Darrell. Curiosity-driven exploration by selfsupervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 16–17, 2017. 3
260
+ [35] D. Pathak, P. Mahmoudieh, G. Luo, P. Agrawal, D. Chen, Y. Shentu, E. Shelhamer, J. Malik, A. A. Efros, and T. Darrell. Zero-shot visual imitation. In Proceedings of the IEEE conference on computer vision and pattern recognition workshops, pages 2050–2053, 2018. 10
261
+ [36] D. Pathak, D. Gandhi, and A. Gupta. Self-supervised exploration via disagreement. In International Conference on Machine Learning, pages 5062–5071, 2019. 4
262
+ [37] V. H. Pong, M. Dalal, S. Lin, A. Nair, S. Bahl, and S. Levine. Skew-fit: State-covering self-supervised reinforcement learning. arXiv preprint arXiv:1903.03698, 2019. 2, 6, 8, 10
263
+ [38] D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. 3, 6
264
+ [39] V. Saxena, J. Ba, and D. Hafner. Clockwork variational autoencoders. arXiv preprint arXiv:2102.09532, 2021. 3
265
+ [40] T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal value function approximators. In International conference on machine learning, pages 1312–1320. PMLR, 2015. 1, 10
266
+ [41] J. Schmidhuber. Curious model-building control systems. In [Proceedings] 1991 IEEE International Joint Conference on Neural Networks, pages 1458–1463. IEEE, 1991. 3
267
+ [42] L. Schulz. Finding new facts; thinking new thoughts. Advances in child development and behavior, 43:269–294, 2012. 2
268
+ [43] R. Sekar, O. Rybkin, K. Daniilidis, P. Abbeel, D. Hafner, and D. Pathak. Planning to explore via self-supervised world models. ICML, 2020. 2, 3, 4, 6, 9
269
+ [44] P. Shyam, W. Jaskowski, and F. Gomez. Model-based active exploration. ´ arXiv preprint arXiv:1810.12162, 2018. 2, 3
270
+ [45] S. Sukhbaatar, Z. Lin, I. Kostrikov, G. Synnaeve, A. Szlam, and R. Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. ICLR, 2018. 10
271
+ [46] Y. Sun, F. Gomez, and J. Schmidhuber. Planning to be surprised: Optimal bayesian exploration in dynamic environments. In International Conference on Artificial General Intelligence, pages 41–51. Springer, 2011. 3
272
+ [47] R. S. Sutton and A. G. Barto. Reinforcement learning: An introduction. MIT press, 2018. 2
273
+ [48] Y. Tassa, Y. Doron, A. Muldal, T. Erez, Y. Li, D. d. L. Casas, D. Budden, A. Abdolmaleki, J. Merel, A. Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018. 7, 9
274
+ [49] S. Tian, S. Nair, F. Ebert, S. Dasari, B. Eysenbach, C. Finn, and S. Levine. Model-based visual planning with self-supervised functional distances. arXiv preprint arXiv:2012.15373, 2020. 10
275
+ [50] D. Warde-Farley, T. Van de Wiele, T. Kulkarni, C. Ionescu, S. Hansen, and V. Mnih. Unsupervised control through non-parametric discriminative rewards. arXiv preprint arXiv:1811.11359, 2018. 2, 6, 9, 10
276
+ [51] M. Watter, J. T. Springenberg, J. Boedecker, and M. Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. 2015. 3, 10
277
+ [52] D. Yarats, R. Fergus, A. Lazaric, and L. Pinto. Mastering visual continuous control: Improved data-augmented reinforcement learning. arXiv preprint arXiv:2107.09645, 2021. 9
278
+ [53] T. Yu, D. Quillen, Z. He, R. Julian, K. Hausman, C. Finn, and S. Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, pages 1094–1100. PMLR, 2020. 7
279
+ [54] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 586–595, 2018. 5
280
+ [55] Y. Zhang, P. Abbeel, and L. Pinto. Automatic curriculum learning through value disagreement. Advances in Neural Information Processing Systems, 33, 2020. 2, 10
md/train/78GFU9e56Dq/78GFU9e56Dq.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOLQ: Segmenting Objects by Learning Queries
2
+
3
+ Bin Dong ∗ Fangao Zeng ∗ Tiancai Wang ∗ Xiangyu Zhang Yichen Wei MEGVII Technology {dongbin,zengfangao,wangtiancai,zhangxiangyu,weiyichen}@megvii.com
4
+
5
+ # Abstract
6
+
7
+ In this paper, we propose an end-to-end framework for instance segmentation. Based on the recently introduced DETR [1], our method, termed SOLQ, segments objects by learning unified queries. In SOLQ, each query represents one object and has multiple representations: class, location and mask. The object queries learned perform classification, box regression and mask encoding simultaneously in an unified vector form. During training phase, the mask vectors encoded are supervised by the compression coding of raw spatial masks. In inference time, mask vectors produced can be directly transformed to spatial masks by the inverse process of compression coding. Experimental results show that SOLQ can achieve state-of-the-art performance, surpassing most of existing approaches. Moreover, the joint learning of unified query representation can greatly improve the detection performance of DETR. We hope our SOLQ can serve as a strong baseline for the Transformer-based instance segmentation. Code is available at https://github. com/megvii-research/SOLQ.
8
+
9
+ # 1 Introduction
10
+
11
+ Instance segmentation, serving as one of visual detection tasks, not only locates instances of different categories but also generates pixel-level mask for each instance. State-of-the-art instance segmentation methods [2, 3, 4, 5] follow the two-stage paradigm, which first performs object detection and then segments the masks within detected boxes by RoIAlign [2]. Those methods are relatively easy to be optimized thanks to the deployment of mature object detectors [6, 7]. However, the segmentation branch heavily relies on the detection branch, making it hard to achieve better joint learning of multiple tasks. Some recent works [8, 9, 10, 11] build instance segmentation frameworks on top of anchorfree object detectors [12, 13] to remove the ROI-Cropping operation, reducing the effect of feature misalignment. For example, CondInst [9] based on FCOS [12] employs dynamic convolutions [14] to perform instance segmentation. YOLACT [8] models the instance segmentation as a combination of prototypes weighted by learned mask coefficients for each anchor. However, the weights of dynamic convolutions or the mask coefficients are still generated by instance proposals.
12
+
13
+ Regardless of the bounding boxes, SOLO [15] introduces the notion of "instance categories" and segments objects by locations. SOLOv2 [16] further solves the problem of inefficient mask representation by introducing dynamic convolution and so-called matrix Non-Maximum Suppression (NMS). Though SOLO directly outputs instance masks based on locations, hand-crafted post-processes, like NMS, are still required to remove duplicated predictions. Also, the performance of small objects is far from satisfactory due to the imbalance of location samples between the large and small objects. Building an end-to-end instance segmentation framework is still a remaining problem.
14
+
15
+ Our work is inspired by DETR [1], which first proposes the end-to-end solution for object detection. In DETR, object detection is regarded as a set prediction problem and objects are represented by learnable query embeddings. How to encode the spatial binary mask into such an end-to-end system is an opening question. As shown in Fig. 1(a), DETR is further extended to panoptic segmentation by directly reshaping the learnable embeddings into spatial domain and building a FPN-style [17] network to produce the final mask predictions. However, both the Transformer encoder and decoder fail to model the spatial information well. Therefore, it is inappropriate to generate the spatial mask based on such query embeddings. Besides, the spatial mask labels used for supervision are of large resolutions, which results in high computation cost and makes it separated to learn the detection and mask branches2. So we need to find one mask representation that satisfies the following conditions: 1) The representation can naturally convert object mask from spatial domain to embedding domain; 2) The process that encodes the spatial masks into embeddings should be reversible; 3) Mask embeddings encoded can keep the principle components of spatial mask. We turn to methods in literature for help and surprisingly find that classical compression coding methods (e.g. Sparse Coding [18]) just satisfy these conditions mentioned above. The mask embeddings can be simply generated from the learnable queries. In training phase, ground-truth spatial mask of each instance can be projected into low-dimensional mask embedding by compression coding and the mask embeddings are used to supervise the learning of predicted mask embeddings. In inference phase, binary spatial mask can be reconstructed from predicted mask embedding by the inverse process of compression coding.
16
+
17
+ With these analysis, we explore how to better encode the spatial mask into the end-to-end object detectors in this paper. Based on DETR, our proposed method, termed SOLQ, segments objects by learning queries. In SOLQ, we formulate the instance segmentation as the joint learning of unified query representation (UQR). The UQR learned can be used to perform parallel predictions for three sub-tasks (classification, localization and segmentation) simultaneously and all predictions are obtained in a regression manner (see Fig. 1(b)). In this way, SOLQ directly outputs instance masks together with corresponding class confidences and box coordinates. The learning of UQR can be divided into two parts: generating instance-aware query embeddings and joint supervision of multi-task learning. Specifically, all candidate instances are initialized with several learnable queries, which interact with extracted image features in Transformer decoder to produce the instance-aware query embeddings. The instance-aware query embeddings are further input to three branches of sub-tasks, which contains several linear projection layers, to generate three sub-task vectors. For the classification and regression branches, we follow the same supervisions as in DETR [1]. For the mask branch, we conduct implicit supervision with the help of mask compression coding mentioned above.
18
+
19
+ To summarize, our contributions are:
20
+
21
+ • We propose an end-to-end framework for instance segmentation based on DETR. SOLQ formulates the instance segmentation as the joint learning of UQR. In UQR, the mask representation can be converted from spatial domain into embedding domain, which is consistent with the learnable query embeddings in DETR. Experiments show that SOLQ with ResNet101 achieves $4 0 . 9 \%$ mask AP and $4 8 . 7 \%$ box AP on the challenging MS COCO dataset [19] without bells and whistles, outperforming SOLOv2 by $1 . 2 \%$ mask AP and $6 . 1 \%$ box AP. It is worthy noting that SOLQ can improve $2 . 0 \%$ in box AP compared to DETR thanks to the joint learning of UQR.
22
+
23
+ # 2 Related Work
24
+
25
+ Instance Segmentation Instance segmentation is a classic but challenging computer vision task. It is required to output each object instance in image with instance-level category label and localization, along with pixel-level mask simultaneously. Currently, there are mainly three categories of instance segmentation methods: top-down, bottom-up and directly-predict methods. Top-down approaches [20, 2, 8, 21, 22, 23, 3, 5, 24] follow the detect-then-segment pipeline. They first generate bounding boxes by object detectors and segment the masks by ROIAlign [2] or dynamic convolutions [9]. Bottom-up methods [25, 26, 27, 28] learn per-pixel embeddings via semantic label and then cluster them into instance groups. For directly-predict methods, PolarMask [29] employs polar coordinates to represent mask contours. Latest SOLO [15] and SOLOv2 [16] directly segment the objects by locations without dependence on bounding boxes or embedding learning. QueryInst [24] and ISTR [30] extend the Sparse RCNN [31] to perform end-to-end instance segmentation. In this paper, we explore an end-to-end instance segmentation solution by learning an unified query representation without any post-processing procedures, like Non-Maximal Suppression (NMS).
26
+
27
+ Transformer in Vision Transformer [32] introduces the self-attention mechanism to model longrange dependencies, and has been widely applied in natural language processing (NLP). Recently, several works attempted to involve the Transformer architecture into various computer vision tasks and showed promising performances. The non-local block [33] is first proposed to enhance video recognition by aggregating spatial information. After that, CCNet [34] further extends the selfattention via sparse attention in semantic segmentation. DETR [1] and Deformable DETR [35] adopt learnable queries and Transformer architecture together with bipartite matching to perform object detection in end-to-end fashion, without any hand-crafted process such as NMS. IPT [36] proposes a transformer-based pretrained network for low-level image processing. ViT series [37, 38, 39, 40] take an image as a sequence of patches and achieve the cross-patch interactions by Transformer architecture in image classification.
28
+
29
+ Compression Coding in Vision Consider the advantage of low-dimension representation and less computation cost, some recent works have attempted to introduce compression coding methods, like Sparse Coding [41], Principal Component Analysis (PCA) [42] and Discrete Cosine Transform (DCT) [43], into computer vision field. For image classification, [44] takes the DCT coefficients obtained from RGB images as the inputs of convolutional neural networks (CNNs) to reduce the communication bandwidth between CPU and GPU. DCT-Mask [45], based on Mask R-CNN, employs DCT supervision to produce high-quality mask representation. Analogously, [46] performed semantic segmentation on the DCT representation and fed the rearranged DCT coefficients to CNNs. MEInst [21] and ISTR [30] encode binary masks into fixed-dimensional mask vectors produced by PCA.
30
+
31
+ # 3 Method
32
+
33
+ # 3.1 Reviewing DETR
34
+
35
+ Recently, DETR [1] succeed in object detection. It formulates object detection as a set prediction problem and introduces object queries, a set of learnable embeddings, to represent objects. In DETR, each object query predicts an object for a given input image and set prediction loss is adopted to achieve one-to-one matching between the predicted and ground-truth objects in training phase. Further, the transformer encoder-decoder architecture is employed to model the relation between query embeddings and instances for better one-to-one set prediction.
36
+
37
+ Set Prediction Loss Let $\boldsymbol { y } _ { \boldsymbol { \mathbf { \lambda } } } = ( \boldsymbol { c } , \boldsymbol { b } )$ and $\hat { y } = ( \hat { c } , \hat { b } )$ denote the ground truths $y$ and the set of predictions $\hat { y }$ , respectively. $c , \hat { c } \in \mathbb { R } ^ { J \times S }$ are the corresponding class labels and predicted class scores, where $J$ and $S$ are the object number and class number. $\boldsymbol { b } , \boldsymbol { \hat { b } } \in \mathbb { R } ^ { J \times 4 }$ are the corresponding ground-truth and predicted box coordinates. $\boldsymbol { \omega } \in \Omega _ { J }$ is the assignment between the ground truths and predictions. Then the optimal one-to-one assignment $\omega ^ { * }$ can be calculated by bipartite matching [47] as:
38
+
39
+ $$
40
+ \omega ^ { * } = a r g \operatorname* { m i n } _ { \omega \in \Omega _ { J } } \mathcal { L } ^ { d e t } ( y , \omega ( \hat { y } ) )
41
+ $$
42
+
43
+ where the bipartite matching loss for object detection $\mathcal { L } _ { d e t }$ can be summarised as:
44
+
45
+ $$
46
+ \mathcal { L } _ { d e t } ( y , \hat { y } ) = \lambda _ { c l s } \cdot \mathcal { L } _ { c l s } ( c , \hat { c } ) + \lambda _ { L _ { 1 } } \cdot \mathcal { L } _ { L _ { 1 } } ( b , \hat { b } ) + \lambda _ { g i o u } \cdot \mathcal { L } _ { g i o u } ( b , \hat { b } )
47
+ $$
48
+
49
+ Here $\mathcal { L } _ { c l s }$ denotes the focal loss [48] for classifications, $\mathcal { L } _ { L _ { 1 } }$ and $\mathcal { L } _ { g i o u }$ are L1 loss and generalized IoU loss [49] for box coordinates, respectively. $\lambda _ { c l s } , \lambda _ { L _ { 1 } }$ and $\lambda _ { g i o u }$ are corresponding coefficients.
50
+
51
+ Extension on Segmentation As shown in Fig. 1(a), DETR is further generalized to panoptic segmentation task by adding a multi-head attention (MHA) and FPN-style CNN after the Transformer decoder. Features from the encoder and learned query embeddings from the decoder are reshaped to spatial domain and then interact in MHA. The produced features are then gradually upsampled to the image size by the FPN-Style CNN to obtain spatial masks. It’s easy to adapt this framework to perform instance segmentation by cropping instance masks within detected bounding boxes.
52
+
53
+ Object Representation In DETR, objects are represented as a set of object queries. Object queries are initialized by the learnable query embeddings and then interact with the image features in the transformer decoder to update their representation. Finally, object query, as an unified representation, is directly used to classify and localize objects. However, the representation of spatial mask is built by compulsorily reshaping the query embeddings to spatial domain in instance segmentation task. Such design leads to different representation forms compared to detection branch. Besides, the two-stage training process makes DETR fail to enjoy the benefit from multi-task learning.
54
+
55
+ # 3.2 Network Architecture
56
+
57
+ To encode the spatial mask into the end-to-end object detector in an unified form, we present a simple but efficient framework for instance segmentation based on DETR. The unified query representation (UQR) is proposed to perform instance-level localization and pixel-level segmentation simultaneously. The compression coding is further introduced to project the spatial mask into embedding domain for high-quality and efficient mask representation. The overall architecture of SOLQ is showed in Fig. 1(b). SOLQ can be divided into three parts: feature extraction network, Transformer decoder and unified query representation. We will describe our method in detail as follows.
58
+
59
+ ![](images/bad93820f944601496528366792633e3ff63d5a9ab1c30fec11d263513faf804.jpg)
60
+ Figure 1: Architecture comparison between the naive DETR and the proposed SOLQ for instance segmentation. "Res2-Res5" are different stages of ResNet [50]. "DConv" and "MHA" are deconvolution [51] layer and multi-head attention, respectively. "MLPs" means multi-layer perceptions and "UQR" denotes unified query representation, which is introduced in detail via Fig. 2. $\bar { q ^ { 0 } }$ is initial learnable object queries. "Frozen" means that train object detector firstly, and then freeze weights of the object detector to train instance segmentation branch, separately.
61
+
62
+ Feature Extraction Network The feature extraction network consists of the backbone and Transformer encoder. Given an image $\mathrm { I } \in \mathbb { R } ^ { H \times W \times 3 }$ , ResNet [50] is used as the backbone to extract basic feature map $x ^ { 0 } \in \mathbb { R } ^ { C \times \frac { H } { 3 2 } \times \frac { W } { 3 2 } }$ , where $H$ , $W$ , $C$ are the height, width and channels of feature map, respectively. Then the basis feature $x ^ { 0 }$ is fed into $K$ Transformer encoder layers to get the refined feature map xK ∈ RC× HW322 via $\{ x ^ { k } = \mathcal { F } ^ { k } ( x ^ { k - 1 } ) \} _ { k = 1 } ^ { K }$ , iteratively. Each Transformer encoder layer $\mathcal { F } ^ { k } ( \cdot )$ is composed of a multi-head self-attention (MHSA) and a feed-forward network (FFN).
63
+
64
+ Transformer Decoder Given the learnable object queries, we generate the instance-aware query embeddings for the unified query representation by the Transformer decoder. In details, a set of learnable object queries $q ^ { 0 } \in \mathbb { R } ^ { J \times C }$ are firstly randomly initialized. Then the initial object queries $q ^ { 0 }$ interact with the refined feature map $x ^ { K }$ in $K$ Transformer decoder layers to obtain instance-aware query embeddings $q ^ { K } \in \mathbb { R } ^ { J \times C }$ by $\{ q ^ { k } = \mathcal { H } ^ { k } ( q ^ { k - 1 } , x ^ { K } ) \} _ { k = 1 } ^ { K }$ . Each Transformer decoder layer $\mathcal { H } ^ { k } ( \cdot )$ has an extra multi-head cross-attention layer compared to the Transformer encoder layer. The instance-aware query embeddings $q ^ { K }$ are then fed into unified query representation part to generate predictions for three sub-tasks, including classification, localization and segmentation.
65
+
66
+ Unified Query Representation After Transformer decoder, each instance-aware query embedding in $q ^ { K }$ represents the features of corresponding instance. The supervision of three sub-tasks (classification, localization and segmentation) in an unified form (e.g. vector) is the last piece of the puzzle to achieve parallel predictions. Fig. 2 shows the learning of UQR. We mainly describes the joint supervision of multi-task learning as well as the training and inference processes of mask branch.
67
+
68
+ In details, UQR is learned under the supervision of classification, localization and mask branches. Both classification and localization branches are the same as in DETR [1]. The classification branch is a fully-connected (FC) layer that predicts the class confidences $\hat { c }$ . The localization branch is a multi-layer perception (MLP) with hidden size 256 and predicts 4 box coordinates $\hat { b }$ . Similar to localization branch, the mask branch is also a multi-layer perception with hidden size 1024 and predicts mask vectors $\boldsymbol { \hat { v } } \in \mathbb { R } ^ { J \times n _ { k } }$ , $n _ { k }$ is the dimension of each mask vector. During training, the mask (Inference)vectors predicted are supervised by the ground-truth mask vectors $v \in \mathbb { R } ^ { J \times n _ { k } }$ Mask vector labelgenerated from spatial UQmask $\boldsymbol { m } \in \mathbb { R } ^ { J \times N \times N }$ epresentationby the mask compression coding described below, $N$ is the spatial dimension of binary mask. While for the inference, the predicted mask vectors $\hat { v }$ can be used to reconstruct the spatial masks $\hat { m }$ by the inverse process of compression coding. Note that each Transformer decoder layer learns such an UQR and auxiliary supervision is adopted for better performance.
69
+
70
+ ![](images/5f3a498a72e89c99fc205099f789ee5cec508700416c9a69d5950dfa8d098444.jpg)
71
+ ? ??7Figure 2: The learning of the proposed unified query representation. $q ^ { K }$ refers to the learned >instance-aware query embeddings. cˆ, $\hat { b } , \hat { v }$ Class vectorEncoding are predicted class, box and mask vectors, respectively. $\hat { m }$ MLP ℒ%&is the binary masks reconstructed. $m$ ()\*+and $v$ (Training)denote ground-truth binary masks and mask vectors, :correspondingly. $\mathcal { L } _ { c l s }$ , $\mathcal { L } _ { L _ { 1 } } \& \mathcal { L } _ { g i o u }$ and $\mathcal { L } _ { v e c }$ Box vectorℒ./"are the losses for classification, box regression and ?mask segmentation, respectively.
72
+
73
+ Mask Compression Coding As mentioned above, predicted mask vectors $\hat { v }$ generated by the mask branch are supervised by the ground-truth mask vectors $v$ . Here, we explore three compression coding methods to transform 2D spatial binary masks into 1D mask vectors, including Sparse Coding [41], Principal Component Analysis (PCA) [42] and Discrete Cosine Transform (DCT) [43].
74
+
75
+ Sparse Coding compresses the binary mask as a sparse combination of $n _ { k }$ atoms from an overcomplete dictionary $\mathbf { D } \in \mathbb { R } ^ { n _ { k } \times N ^ { 2 } }$ . Ground-truth mask vectors $v$ can be obtained from $m$ through solving the minimum of Lasso [52] problem:
76
+
77
+ $$
78
+ ( v ^ { * } , \mathrm { D } ^ { * } ) = \underset { ( v , \mathrm { D } ) } { a r g m i n } ( \frac { 1 } { 2 } | | m - v \mathrm { D } | | _ { 2 } ^ { 2 } + \beta | | v | | _ { 1 } ) , s . t . | | \mathrm { D } _ { e } | | _ { 2 } = 1 , \forall e \in [ 1 , n _ { k } ]
79
+ $$
80
+
81
+ where $\beta$ is the regular coefficient. The binary masks $\hat { m }$ can be reconstructed via $\hat { m } = \hat { v } \mathbf { D }$ .
82
+
83
+ $\pmb { P C A }$ transforms binary masks to low-dimensional mask vectors via matrix factorization. The process can be summarized as the following optimization problem:
84
+
85
+ $$
86
+ \mathrm { P } ^ { * } = a r g \underset { \mathrm { P } } { \operatorname* { m i n } } | | m - m \mathrm { P P } ^ { T } | | ^ { 2 } , s . t . \mathrm { P P } ^ { T } = \mathrm { U } _ { n _ { k } }
87
+ $$
88
+
89
+ where $\mathrm { P } \in \mathbb { R } ^ { N ^ { 2 } \times n _ { k } }$ and $\mathrm { U } _ { n _ { k } } \in \mathbb { R } ^ { n _ { k } \times n _ { k } }$ are the projection matrix and unit matrix, respectively. Ground-truth mask vectors $v$ can be represented as $v \ = \ m \mathrm { P }$ meanwhile binary masks can be reconstructed by mˆ = ˆvPT .
90
+
91
+ $\pmb { D } \pmb { C } \pmb { T }$ first transforms ground-truth binary masks $m$ into frequency domain according to $f = \mathrm { A } m \mathrm { A } ^ { T }$ , where $\mathbf { A } \in \mathbb { R } ^ { N \times N }$ is the transform matrix and the $( h , l )$ element of A can be calculated by $\mathrm { A } _ { h , l } =$ $\begin{array} { r } { \sqrt { \frac { 1 + s i g n ( h ) } { N } } c o s [ \frac { ( l + 0 . 5 ) \pi } { N } h ] | } \end{array}$ s[ (l+0.5)πN h]|. The ground-truth mask vectors v can be encoded by sampling the lowfrequency components from $f$ . The binary masks $\hat { m }$ can be recovered through the inverse sampling and transformation $\hat { m } = \mathrm { A } ^ { - 1 } \hat { f } ( \mathrm { A } ^ { T } ) ^ { - 1 }$ , where $\hat { f }$ is the inverse sampling result from $\hat { v }$ .
92
+
93
+ Loss Function We extend object ground-truths with mask vectors as $\boldsymbol { y } = \left( c , b , v \right)$ and corresponding predictions are $\boldsymbol { \hat { y } } = ( \boldsymbol { \hat { c } } , \boldsymbol { \hat { b } } , \boldsymbol { \hat { v } } )$ . The overall loss function for supervision can be expressed as:
94
+
95
+ $$
96
+ \mathcal { L } _ { i n s t } = \mathcal { L } _ { d e t } + \lambda _ { v e c } \cdot \mathcal { L } _ { v e c } ( v , \hat { v } )
97
+ $$
98
+
99
+ where $\mathcal { L } _ { v e c }$ is the mask vector loss and we use L1 loss in practice. $\lambda _ { v e c }$ is the corresponding weight and $\mathcal { L } _ { d e t }$ is same as Eq. 2. Note that mask loss is not included in bipartite matching. The participation of mask loss may affect the global matching between the object queries and ground-truths.
100
+
101
+ # 3.3 Discussion
102
+
103
+ Whereas our SOLQ shares similarities with MEInst [21], DCT-Mask [45] and ISTR [30] in the compression coding of spatial mask, the main differences are described as follows. SOLQ produces the instance masks together with the instance class and the location in a parallel way. It aims to learn an unified query representation for better multi-task learning. The predictions of three sub-tasks are all obtained in a regression manner. Also, SOLQ is an end-to-end instance segmentation framework without any post-processes, like NMS. In contrast, DCT-Mask encodes the instance masks based on the RoI features cropped by the bounding boxes from detection branch. The mask encoding in MEInst and ISTR requires extra optimization process to obtain the optimal project matrix for reconstructing spatial masks. So they are not learned in an end-to-end manner. Also, our concurrent work, QueryInst [24] performs instance segmentation in an end-to-end fashion based on Sparse RCNN [31]. The overall architecture mainly follows ‘detect-then-segment’ paradigm. The features cropped by bounding boxes interact with the updated queries to generate the segmentation masks.
104
+
105
+ # 4 Experiments
106
+
107
+ # 4.1 Dataset and Metrics
108
+
109
+ We validate our method on COCO benchmark [19]. COCO contains $1 1 5 \mathrm { k }$ images for training, $5 \mathrm { k }$ for validation and $2 0 \mathrm { k }$ for testing, involving 80 object categories with instance-level segmentation annotations. We report results on COCO 2017 test-dev set for state-of-the-art comparison and the results on COCO 2017 val set for ablation studies. Consistent with Mask R-CNN [2], the standard COCO metrics including $\mathsf { A P } ^ { b o x }$ , $\mathbf { A P } _ { S } ^ { b o x }$ , $\mathbf { A P } _ { M } ^ { b o x }$ , $\mathrm { A P } _ { L } ^ { b o x }$ , and ${ \bf A } ^ { s e g }$ , $\mathbf { A P } _ { S } ^ { s e g }$ g , APseg , M APsegL are used to evaluate the performance of object detection and segmentation.
110
+
111
+ # 4.2 Implementation Details
112
+
113
+ For fast convergence, we build the SOLQ on top of Deformable DETR [35] in practice. ResNet [53], pretrained on the ImageNet [54] is employed as the backbone and multi-scale feature maps from C3 to C6 stages are used. For the deformable attention, the number of heads is set as 8 and the number of sampling points is set as 4. For the mask branch, $n _ { k }$ is set to 256, hidden dim of MLP is 1024 and $\lambda _ { v e c }$ is 3.0. Following DETR, $\lambda _ { c l s } = 2$ , $\lambda _ { L 1 } = 5$ , $\lambda _ { g i o u } = 2$ . We train our model with Adam optimizer with weight decay of $1 . 0 \times 1 0 ^ { - 4 }$ . Models are trained for 50 epochs with the initial learning rate $2 . 0 \times 1 0 ^ { - 4 }$ and decayed at $4 0 ^ { t h }$ epoch by a factor 0.1. Multi-scale training is adopted, where the shorter side is randomly chosen within [408, 800] and the longer side is less or equal to 1333. All experiments are conducted over 8 Tesla V100 GPUs with batch size 32 except the comparison in Sec. 4.4. Since the D-DETR with SQR can only be trained with batch size 16, we also perform the D-DETR with UQR under the same setting for fair comparison.
114
+
115
+ # 4.3 Comparison with State-of-the-arts
116
+
117
+ As shown in Tab. 1, we compare SOLQ with state-of-the-art methods on COCO test-dev set. Our method achieves best performance on both ${ \bf A } ^ { s e g }$ and $\mathsf { A P } ^ { b o x }$ metrics. Compared to the typical twostage methods Mask R-CNN [2] and Cascade Mask R-CNN [7], SOLQ with ResNet-101 surpasses in ${ \bf A } ^ { s e g }$ by $2 . 1 \%$ and $0 . 9 \%$ , respectively. Besides, we also compare SOLQ with state-of-the-art one-stage methods CondInst [9] and SOLOv2 [16], which are built based on dynamic convolution. Our method outperforms them $1 . 8 \%$ and $1 . 2 \%$ in $\mathbf { A P } ^ { s e g }$ , respectively. Further, based on the recently introduced Swin Transformer [40], our SOLQ will serve as a fully-Transformer framework for instance segmentation and it can achieve $4 6 . 7 \%$ ${ \bf A } ^ { s e g }$ and $5 6 . 5 \%$ $\ { \dot { \mathbf { A } } } { \mathbf { P } } ^ { b o x }$ . To further validate the quality of boundary prediction, we also evaluate SOLQ using the Boundary AP [55] in Appendix A.1.
118
+
119
+ It is worthy noting that SOLQ performs well on objects of different scales, especially on small and middle scale objects. For example, SOLQ with ResNet-101 surpasses SOLOv2 byseg $5 . 2 \%$ in $\mathbf { A P } _ { S } ^ { s e g }$ andbin inask , respectively. It should be owing to the mask compression encoding of spOLOv2, the mask predictions are supervised by the ground-truth mask of $1 / 4$ instance size so the performance of small objects are not optimized well. For our SOLQ, the mask compression encoding encodes the high-resolution binary mask (e.g. $1 2 8 \times 1 2 8 )$ into low-dimension mask vectors using the sparsity characteristic of the binary mask and keeps the principle information.
120
+
121
+ Table 1: State-of-the-art comparison on the COCO 2017 test-dev set. All the models are trained with multi-scale and tested with single scale. ‘†’ and ‘\*’ are the results reported in ISTR [24] and QueryInst [24], respectively. For experiments with Swin-L backbone [40], the shorter side of input is randomly chosen within [400, 1200] and the longer side is less or equal to 1536.
122
+
123
+ <table><tr><td>Method</td><td>Backbone</td><td>Epochs</td><td>APseg</td><td>APg</td><td>AP</td><td>APeg L</td><td>APbox</td><td>AP</td><td>APM</td><td>AP</td></tr><tr><td>Mask R-CNN† [2]</td><td>R50-FPN</td><td>36</td><td>37.5</td><td>21.1</td><td>39.6</td><td>48.3</td><td>41.3</td><td>24.2</td><td>43.6</td><td>51.7</td></tr><tr><td>Cascade Mask R-CNN* [7]</td><td>R50-FPN</td><td>36</td><td>38.6</td><td>21.7</td><td>40.8</td><td>49.6</td><td>44.5</td><td>-</td><td>-</td><td>-</td></tr><tr><td>HTC*[4]</td><td>R50-FPN</td><td>36</td><td>39.7</td><td>22.6</td><td>42.2</td><td>50.6</td><td>44.9</td><td>1</td><td>1</td><td>-</td></tr><tr><td>MEInst [21]</td><td>R50-FPN</td><td>36</td><td>33.5</td><td>19.3</td><td>35.7</td><td>42.1</td><td>42.5</td><td>25.6</td><td>45.1</td><td>52.2</td></tr><tr><td>CondInst [9]</td><td>R50-FPN</td><td>36</td><td>37.8</td><td>21.0</td><td>40.3</td><td>48.7</td><td>42.1</td><td>25.1</td><td>44.5</td><td>52.1</td></tr><tr><td>BlendMask [22]</td><td>R50-FPN</td><td>36</td><td>37.8</td><td>18.8</td><td>40.9</td><td>53.6</td><td>43.0</td><td>25.3</td><td>45.4</td><td>54.0</td></tr><tr><td>SOLOv2[16]</td><td>R50-FPN</td><td>72</td><td>38.8</td><td>16.5</td><td>41.7</td><td>56.2</td><td>40.4</td><td>20.5</td><td>44.2</td><td>53.9</td></tr><tr><td>QueryInst [24]</td><td>R50-FPN</td><td>36</td><td>40.6</td><td>23.4</td><td>42.5</td><td>52.8</td><td>45.6</td><td>-</td><td>1</td><td>=</td></tr><tr><td>ISTR [30]</td><td>R50-FPN</td><td>36</td><td>38.6</td><td>22.1</td><td>40.4</td><td>50.6</td><td>46.8</td><td>27.8</td><td>48.7</td><td>59.9</td></tr><tr><td>SOLQ,ours</td><td>R50</td><td>50</td><td>39.7</td><td>21.5</td><td>42.5</td><td>53.1</td><td>47.8</td><td>27.6</td><td>50.9</td><td>61.6</td></tr><tr><td>Mask R-CNN† [2]</td><td>R101-FPN</td><td>36</td><td>38.8</td><td>21.8</td><td>41.4</td><td>50.5</td><td>43.1</td><td>25.1</td><td>46.0</td><td>54.3</td></tr><tr><td>Cascade Mask R-CNN* [7]</td><td>R101-FPN</td><td>36</td><td>40.0</td><td>22.5</td><td>42.5</td><td>51.2</td><td>46.2</td><td>1</td><td>1</td><td>-</td></tr><tr><td>HTC*[4]</td><td>R101-FPN</td><td>36</td><td>40.8</td><td>23.0</td><td>43.5</td><td>52.6</td><td>46.3</td><td>-</td><td>1</td><td>-</td></tr><tr><td>MEInst† [21]</td><td>R101-FPN</td><td>36</td><td>35.3</td><td>20.4</td><td>37.8</td><td>44.5</td><td>44.5</td><td>26.8</td><td>47.3</td><td>54.9</td></tr><tr><td>CondInst [9]</td><td>R101-FPN</td><td>36</td><td>39.1</td><td>21.5</td><td>41.7</td><td>50.9</td><td>43.5</td><td>25.8</td><td>46.0</td><td>54.1</td></tr><tr><td>BlendMask [22]</td><td>R101-FPN</td><td>36</td><td>39.6</td><td>22.4</td><td>42.2</td><td>51.4</td><td>44.7</td><td>26.6</td><td>47.5</td><td>55.6</td></tr><tr><td>DCT-Mask [45]</td><td>R101-FPN</td><td>36</td><td>40.1</td><td>22.7</td><td>42.7</td><td>51.8</td><td>-</td><td>1</td><td>-</td><td>-</td></tr><tr><td>SOLOv2[16]</td><td>R101-FPN</td><td>72</td><td>39.7</td><td>17.3</td><td>42.9</td><td>57.4</td><td>42.6</td><td>22.3</td><td>46.7</td><td>56.3</td></tr><tr><td>QueryInst [24]</td><td>R101-FPN</td><td>36</td><td>42.8</td><td>24.6</td><td>45.0</td><td>55.5</td><td>48.1</td><td>-</td><td></td><td>=</td></tr><tr><td>ISTR [30]</td><td>R101-FPN</td><td>36</td><td>39.9</td><td>22.8</td><td>41.9</td><td>52.3</td><td>48.1</td><td>28.7</td><td>50.4</td><td>61.5</td></tr><tr><td>SOLQ,ours</td><td>R101</td><td>50</td><td>40.9</td><td>22.5</td><td>43.8</td><td>54.6</td><td>48.7</td><td>28.6</td><td>51.7</td><td>63.1</td></tr><tr><td>QueryInst [24]</td><td>Swin-L</td><td>50</td><td>49.1</td><td>31.5</td><td>51.8</td><td>63.2</td><td>56.1</td><td>1</td><td>1</td><td>-</td></tr><tr><td>SOLQ, our s</td><td>Swin-L</td><td>50</td><td>46.7</td><td>29.2</td><td>50.1</td><td>60.9</td><td>56.5</td><td>37.6</td><td>60.0</td><td>70.6</td></tr></table>
124
+
125
+ # 4.4 UQR vs. SQR
126
+
127
+ In this section, we show the comparison between the separate query representation (SQR) (see Fig. 1(a)) in DETR and the UQR used in SOLQ (see Fig. 1(b)). As shown in Tab. 2, we surprisingly find that UQR in SOLQ can boost the detection performance of DETR with a great margin, improving $\mathsf { A P } ^ { b o x }$ by $2 . 3 \%$ and $2 . 0 \%$ with ResNet50 and ResNet101. While in comparison, separate query representation (SQR) only improve the $\mathsf { A P } ^ { b o x }$ by $0 . 1 \%$ and the segmentation performance with 33.4 ${ \bf A } ^ { s e g }$ is much lower than that of UQR. The large improvement in $\mathsf { A P } ^ { b o x }$ shows the effectiveness of our proposed UQR, owing to the unified learning of query representation. For efficiency comparison between them, please refer to the Appendix A.2.
128
+
129
+ We also report the detection performance of both Faster R-CNN and Mask R-CNN since Mask R-CNN is built on top of Faster R-CNN. Compared to Faster R-CNN, Mask R-CNN improves $\mathbf { A P } ^ { b o x }$ by $0 . 6 \%$ and $1 . 1 \%$ with ResNet50-FPN and ResNet101-FPN, respectively. As we see, multi-task learning tends to improve the performance with each other and the performance can be further improved if these sub-tasks are learned using an unified representation. SOLQ learns the UQR to perform classification, localization and segmentation simultaneously in a regression manner. For both SQR and Mask R-CNN, full-connected layers are employed to classify the objects and regress box coordinates while the mask generated by full convolution network is supervised by 2D spatial mask.
130
+
131
+ Further, Fig. 3 shows the visualization comparison between the DETR with SQR and our SOLQ. Overall, SOLQ generates much more fine-grained masks and provides better object detection performance. We also show some failure cases in occluded environments (see Appendix A.5).
132
+
133
+ # 4.5 Ablation Studies
134
+
135
+ In this section, we also ablate several critical factors in SOLQ by progressively adjusting each factor in the system. It can be seen that each factor contributes to the final success of the SOLQ. Note that our ablation experiments are conducted using the single feature level with C5 and validated on the COCO 2017 val set.
136
+
137
+ Table 2: Comparisons between Unified Query Representation (UQR) and Separate Query Representation (SQR) on the COCO 2017 val set. D-DETR denotes Defoemable DETR and D-DETR∗ refers our reimplementment version. D-DETR∗ with SQR means that add an extra FPN-style branch as shown in Fig. 1(a) to perform instance segmentation on top of D-DETR∗. ‘†’ and $\mathit { \Psi } _ { \ddag } ^ { \ast } \cdot \mathit { \Pi } _ { \ddag } ^ { \ast } \cdot$ are the results reported in ISTR [24] and Sparse RCNN [24], respectively.
138
+
139
+ <table><tr><td>Method</td><td>Backbone</td><td>Epochs</td><td>APseg</td><td>APbox</td><td>APb</td><td>APM</td><td>AP</td></tr><tr><td>Faster RCNNt [6]</td><td>R50-FPN</td><td>36</td><td>-</td><td>40.2</td><td>24.2</td><td>43.5</td><td>52.0</td></tr><tr><td>Mask R-CNNt [2]</td><td>R50-FPN</td><td>36</td><td>37.0</td><td>40.8 (+0.6)</td><td>24.0</td><td>44.4</td><td>52.9</td></tr><tr><td>D-DETR [35]</td><td>R50</td><td>50</td><td>1</td><td>45.4</td><td>26.8</td><td>48.3</td><td>61.7</td></tr><tr><td>D-DETR*</td><td>R50</td><td>50</td><td>1</td><td>45.5</td><td>27.3</td><td>48.7</td><td>62.0</td></tr><tr><td>D-DETR*+SQR</td><td>R50</td><td>50</td><td>32.2</td><td>45.6 (+0.1)</td><td>27.2</td><td>48.8</td><td>61.5</td></tr><tr><td>D-DETR*+UQR</td><td>R50</td><td>50</td><td>39.5 (+7.3)</td><td>47.8 (+2.3)</td><td>28.7</td><td>51.1</td><td>63.7</td></tr><tr><td>Faster RCNN‡ [6] Mask R-CNNt [2]</td><td>R101-FPN</td><td>36</td><td>1</td><td>42.0</td><td>26.6</td><td>45.4</td><td>53.4</td></tr><tr><td></td><td>R101-FPN</td><td>36</td><td>38.8</td><td>43.1 1(+1.1)</td><td>25.1</td><td>46.0</td><td>54.3</td></tr><tr><td>D-DETR *</td><td>R101</td><td>50</td><td>1</td><td>46.3</td><td>28.1</td><td>49.7</td><td>62.3</td></tr><tr><td>D-DETR*+SQR</td><td>R101</td><td>50</td><td>33.4</td><td>46.4 (+0.1)</td><td>28.1</td><td>49.9</td><td>62.2</td></tr><tr><td>D-DETR*+UQR</td><td>R101</td><td>50</td><td>40.2 (+6.8)</td><td>48.3 (+2.0)</td><td>29.9</td><td>52.1</td><td>64.6</td></tr></table>
140
+
141
+ ![](images/20230f9214411b3568b4f333a255658620355e9ce7b9488c139c5597a44ddfd4.jpg)
142
+ Figure 3: Visualization comparisons between Unified Query Representation (UQR) and Separate Query Representation (SQR) on the COCO 2017 val set. For more visualization comparison, please refer to Appendix A.4.
143
+
144
+ Mask Compression Coding Methods We compare the impact of different compression coding methods to encode binary masks. As shown in Tab. 3a, flatting the spatial masks into 1D mask vectors directly for supervision can obtain decent segmentation result while improving $\mathsf { A P } ^ { b o x }$ by $1 \%$ . DCT produce the best performance in both $\mathbf { A P } ^ { s e g }$ and $\mathsf { A P } ^ { b o x }$ metrics. The main reason is that the loss of mask compression caused by DCT is relatively small, compared to the Sparse Coding and PCA methods. Also, DCT can be employed for each image in an online manner while Sparse Coding and PCA are performed on the whole training set to get "principal components" or "dictionary" in an offline way. Therefore, we choose DCT as our default method for mask compression coding.
145
+
146
+ Mask Vector Loss Weight Tab. 3b shows the effect of adjusting the weight of mask vector loss. When the weight of mask vector loss $\lambda _ { v e c }$ is set as 3.0, SOLQ gets the best performance in both $\mathbf { A P } ^ { s e g }$ and $\mathsf { A P } ^ { \bar { b } o x }$ . The regression dimension of DCT vector (e.g. 256) is usually larger than that of the bounding box (e.g. 4), so the magnitude of mask vector loss is larger than that of the regression loss. Therefore, an appropriate $\lambda _ { v e c }$ can keep the balance between the mask branch and localization branch such that these two branches can be jointly optimized better.
147
+
148
+ Mask Vector Loss Stage We also ablate the impact of the number of decoder stages enabling mask vector loss in Tab. 3c. It can be seen that adding auxiliary mask vector loss on all decoders can improve by $2 . 9 \%$ and $1 . 1 \%$ on ${ \bf A } ^ { s e g }$ and $\mathsf { A P } ^ { b o x }$ , respectively. The experimental results show that auxiliary loss employed in multiple decoders is helpful to both mask and detection branches. Note that auxiliary loss of detection branch is enabled in all decoder stages in this ablation, so the gain of detection branch is not as large as the gain of the mask branch.
149
+
150
+ Spatial Resolution of Binary Mask As mentioned above, mask compression coding projects the 2D $N \times N$ ground-truth binary masks into 1D mask vectors for supervision. In Tab. 3d, we explore the impact of the spatial resolution of ground truth binary mask. The segmentation performance ${ \bf A } ^ { s e g }$ is improved from 30.8 to 32.6 as $N$ increases from 64 to 128 and ${ \bf A } ^ { s e g }$ no longer improves when $N$ is greater than 128. Ground-truth binary mask with high resolution can keep more instance details but needs high-dimension mask vectors to reconstruct. Therefore, once the number of coefficients $n _ { k }$ is chosen, $N$ has the most suitable value corresponding to $n _ { k }$ .
151
+
152
+ Dimension of Mask Vector Similar to the spatial resolution of ground truth binary mask, there is also a suitable value $n _ { k }$ for given $N$ . Tab. 3e shows that $n _ { k } = 2 5 6$ achieves the best performance in both ${ \bf A } ^ { s e g }$ and $\mathsf { A P } ^ { b o x }$ when the spatial resolution $N$ is set as 128. Theoretically, mask vector with higher dimension should reconstruct a better binary mask. However, high-dimension mask vector will enlarge the regression dimension, making it hard to optimize the mask branch. As a result, the quality of the binary mask reconstructed reduces a lot.
153
+
154
+ Table 3: Ablation studies validated on the COCO 2017 val set. All experiments use the single feature level with C5 in ResNet50.
155
+ (a) Impact of different binary mask encoding-decoding methods. Flatten means that reshape the 2D binary masks (28x28) into 1D mask vectors (784) directly, then optimize with L2 and dice loss jointly.
156
+
157
+ <table><tr><td>Type</td><td>APseg</td><td>AP</td><td>APM</td><td>AP</td><td>APbox</td><td>APbx</td><td>AP</td><td>APOr</td></tr><tr><td>det</td><td>=</td><td>=</td><td>=</td><td>=</td><td>39.4</td><td>20.6</td><td>43.0</td><td>55.5</td></tr><tr><td>Flatten</td><td>29.7</td><td>11.6</td><td>33.4</td><td>49.3</td><td>40.4</td><td>20.2</td><td>44.7</td><td>58.8</td></tr><tr><td>Sparse Coding</td><td>11.3</td><td>6.2</td><td>12.0</td><td>17.5</td><td>40.6</td><td>20.6</td><td>44.6</td><td>59.3</td></tr><tr><td>PCA</td><td>31.6</td><td>12.5</td><td>35.4</td><td>52.7</td><td>41.0</td><td>20.5</td><td>45.2</td><td>60.0</td></tr><tr><td>DCT</td><td>32.6</td><td>12.8</td><td>37.1</td><td>54.5</td><td>41.3</td><td>20.7</td><td>45.4</td><td>60.1</td></tr></table>
158
+
159
+ (b) Affect of adjusting mask vector loss weight. Mask vector loss is enabled only in the last decoder layer, $n _ { k } = 2 5 6$ . Spatial resolution of ground truth binary mask $N = 1 2 8$ .
160
+
161
+ (c) Ablation of the number of decoder stages enabling mask vector loss. For example, when stage is 4, it means that enable the last 4 decoder layer with mask vector loss and $\lambda _ { v e c } = 3$ , $n _ { k } = 2 5 6$ .
162
+
163
+ <table><tr><td>Xuec</td><td>APseg</td><td>APeg 50</td><td>AP5</td><td>APbox</td><td>AP0</td><td>AP</td></tr><tr><td>0.3</td><td>25.2</td><td>51.0</td><td>22.2</td><td>39.3</td><td>59.9</td><td>41.8</td></tr><tr><td>0.7</td><td>26.7</td><td>52.1</td><td>24.4</td><td>39.6</td><td>60.1</td><td>42.5</td></tr><tr><td>1</td><td>27.2</td><td>53.4</td><td>24.6</td><td>39.7</td><td>61.3</td><td>43.3</td></tr><tr><td>2</td><td>28.9</td><td>53.5</td><td>27.7</td><td>40.0</td><td>60.4</td><td>42.8</td></tr><tr><td>3</td><td>29.7</td><td>53.5</td><td>28.4</td><td>40.2</td><td>60.4</td><td>42.8</td></tr><tr><td>4</td><td>29.6</td><td>52.3</td><td>25.6</td><td>40.2</td><td>60.1</td><td>42.4</td></tr></table>
164
+
165
+ <table><tr><td>Num.</td><td>APseg</td><td>AP50</td><td>AP</td><td>APbox</td><td>AP5</td><td>AP</td></tr><tr><td>1</td><td>29.7</td><td>53.5</td><td>27.7</td><td>40.2</td><td>60.4</td><td>42.8</td></tr><tr><td></td><td>31.8</td><td>55.4</td><td>32.1</td><td>40.8</td><td>61.2</td><td>43.3</td></tr><tr><td>2345</td><td>32.0</td><td>55.2</td><td>32.4</td><td>40.7</td><td>61.0</td><td>42.9</td></tr><tr><td></td><td>32.4</td><td>55.7</td><td>33.1</td><td>41.0</td><td>61.2</td><td>43.5</td></tr><tr><td></td><td>32.3</td><td>55.3</td><td>33.1</td><td>40.9</td><td>60.9</td><td>43.4</td></tr><tr><td>6</td><td>32.6</td><td>55.9</td><td>33.4</td><td>41.3</td><td>61.7</td><td>43.4</td></tr></table>
166
+
167
+ (d) Effect of the spatial resolution of ground truth binary mask. Mask vector loss is enabled in all decoder layers and $\lambda _ { v e c } = 3$ , $n _ { k } = 2 5 6$ .
168
+
169
+ (e) Impact of the dimension of mask vector. Mask vector loss is enabled in all decoder layers. $\lambda _ { v e c } =$ 3 and spatial resolution of binary mask $N = 1 2 8$ .
170
+
171
+ <table><tr><td>N</td><td>Apseg</td><td>AP5</td><td>AP7</td><td>APbox</td><td>AP0</td><td>APbg 75</td></tr><tr><td>64</td><td>30.8</td><td>54.8</td><td>30.8</td><td>40.5</td><td>61.2</td><td>42.7</td></tr><tr><td>96</td><td>31.5</td><td>55.4</td><td>31.8</td><td>40.7</td><td>61.4</td><td>43.1</td></tr><tr><td>128</td><td>32.6</td><td>55.9</td><td>33.4</td><td>41.3</td><td>61.7</td><td>43.4</td></tr><tr><td>256</td><td>32.3</td><td>55.4</td><td>32.8</td><td>40.6</td><td>60.7</td><td>43.3</td></tr></table>
172
+
173
+ <table><tr><td>nk</td><td>APseg</td><td>AP</td><td>AP</td><td>APboT</td><td>AP50</td><td>APb 75</td></tr><tr><td>144 256 300</td><td>31.5 32.6 31.0</td><td>55.6 55.9 54.7</td><td>31.6 33.4 30.9</td><td>40.9 41.3 40.4</td><td>61.3 61.7 60.8</td><td>43.4 43.4 42.8</td></tr></table>
174
+
175
+ # 5 Conclusion
176
+
177
+ In this paper, we present SOLQ, a new instance segmentation framework. Based on DETR, SOLQ learns an unified query representation, which is used to predict the instance masks parallel with object detection in an end-to-end manner. To make the mask representation consistent with the query embedding, SOLQ projects the high-resolution spatial masks into low-dimensional mask vectors and regards mask prediction as the regression of mask vectors. SOLQ is a truly one shot framework without any two-stage operations, like ROIAlign. On the challenging COCO dataset, SOLQ achieves state-of-the-art performance on instance segmentation task and greatly improves the detection performance of DETR thanks to the multi-task learning. We believe that SOLQ will serve as a strong baseline for instance segmentation for its excellent performance and simplicity.
178
+
179
+ # References
180
+
181
+ Zagoruyko. End-to-end object detection with transformers. In Proc. Eur. Conf. Comp. Vis., 2020.
182
+ [2] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proc. IEEE Int. Conf. Comp. Vis., 2017.
183
+ [3] Zhaojin Huang, Lichao Huang, Yongchao Gong, Chang Huang, and Xinggang Wang. Mask scoring r-cnn. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2019.
184
+ [4] 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 Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2019.
185
+ [5] Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2018.
186
+ [6] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Proc. Advances in Neural Inf. Process. Syst., 2015.
187
+ [7] Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2018.
188
+ [8] Daniel Bolya, Chong Zhou, Fanyi Xiao, and Yong Jae Lee. Yolact: Real-time instance segmentation. In Proc. IEEE Int. Conf. Comp. Vis., 2019.
189
+ [9] Zhi Tian, Chunhua Shen, and Hao Chen. Conditional convolutions for instance segmentation. Proc. Eur. Conf. Comp. Vis., 2020.
190
+ [10] Youngwan Lee and Jongyoul Park. Centermask: Real-time anchor-free instance segmentation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2020.
191
+ [11] Sida Peng, Wen Jiang, Huaijin Pi, Xiuli Li, Hujun Bao, and Xiaowei Zhou. Deep snake for real-time instance segmentation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2020.
192
+ [12] Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In Proc. IEEE Int. Conf. Comp. Vis., 2019.
193
+ [13] Kaiwen Duan, Song Bai, Lingxi Xie, Honggang Qi, Qingming Huang, and Qi Tian. Centernet: Keypoint triplets for object detection. In Proc. IEEE Int. Conf. Comp. Vis., 2019.
194
+ [14] Xu Jia, Bert De Brabandere, Tinne Tuytelaars, and Luc Van Gool. Dynamic filter networks. In Proc. Advances in Neural Inf. Process. Syst., 2016.
195
+ [15] Xinlong Wang, Tao Kong, Chunhua Shen, Yuning Jiang, and Lei Li. Solo: Segmenting objects by locations. In Proc. Eur. Conf. Comp. Vis., 2020.
196
+ [16] Xinlong Wang, Rufeng Zhang, Tao Kong, Lei Li, and Chunhua Shen. Solov2: Dynamic, faster and stronger. Proc. Advances in Neural Inf. Process. Syst., 2020.
197
+ [17] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2017.
198
+ [18] Lingling Tao, Fatih Porikli, and René Vidal. Sparse dictionaries for semantic segmentation. In Proc. Eur. Conf. Comp. Vis., 2014.
199
+ [19] 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 Proc. Eur. Conf. Comp. Vis., 2014.
200
+ [20] Yi Li, Haozhi Qi, Jifeng Dai, Xiangyang Ji, and Yichen Wei. Fully convolutional instance-aware semantic segmentation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2017.
201
+ [21] Rufeng Zhang, Zhi Tian, Chunhua Shen, Mingyu You, and Youliang Yan. Mask encoding for single shot instance segmentation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2020.
202
+ [22] Hao Chen, Kunyang Sun, Zhi Tian, Chunhua Shen, Yongming Huang, and Youliang Yan. Blendmask: Top-down meets bottom-up for instance segmentation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2020.
203
+ [23] Xinlei Chen, Ross Girshick, Kaiming He, and Piotr Dollár. Tensormask: A foundation for dense object segmentation. In Proc. IEEE Int. Conf. Comp. Vis., 2019.
204
+ [24] Yuxin Fang, Shusheng Yang, Xinggang Wang, Yu Li, Chen Fang, Ying Shan, Bin Feng, and Wenyu Liu. Instances as queries. Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2021.
205
+ [25] Naiyu Gao, Yanhu Shan, Yupei Wang, Xin Zhao, Yinan Yu, Ming Yang, and Kaiqi Huang. Ssap: Single-shot instance segmentation with affinity pyramid. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2019.
206
+ [26] Shu Liu, Jiaya Jia, Sanja Fidler, and Raquel Urtasun. Sgn: Sequential grouping networks for instance segmentation. In Proc. IEEE Int. Conf. Comp. Vis., 2017.
207
+ [27] Bert De Brabandere, Davy Neven, and Luc Van Gool. Semantic instance segmentation with a discriminative loss function. arXiv:1708.02551, 2017.
208
+ [28] Alejandro Newell, Zhiao Huang, and Jia Deng. Associative embedding: End-to-end learning for joint detection and grouping. arXiv:1611.05424, 2016.
209
+ [29] Enze Xie, Peize Sun, Xiaoge Song, Wenhai Wang, Xuebo Liu, Ding Liang, Chunhua Shen, and Ping Luo. Polarmask: Single shot instance segmentation with polar representation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2020.
210
+ [30] Jie Hu, Liujuan Cao, Yao Lu, ShengChuan Zhang, Yan Wang, Ke Li, Feiyue Huang, Ling Shao, and Rongrong Ji. Istr: End-to-end instance segmentation with transformers. arXiv preprint arXiv:2105.00637, 2021.
211
+ [31] Peize Sun, Rufeng Zhang, Yi Jiang, Tao Kong, Chenfeng Xu, Wei Zhan, Masayoshi Tomizuka, Lei Li, Zehuan Yuan, Changhu Wang, et al. Sparse r-cnn: End-to-end object detection with learnable proposals. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2021.
212
+ [32] 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. Advances in Neural Inf. Process. Syst., 2017.
213
+ [33] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2018.
214
+ [34] Zilong Huang, Xinggang Wang, Lichao Huang, Chang Huang, Yunchao Wei, and Wenyu Liu. Ccnet: Criss-cross attention for semantic segmentation. In Proc. IEEE Int. Conf. Comp. Vis., 2019.
215
+ [35] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv:2010.04159, 2020.
216
+ [36] Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, and Wen Gao. Pre-trained image processing transformer. arXiv:2012.00364, 2020.
217
+ [37] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv:2010.11929, 2020.
218
+ [38] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv:2012.12877, 2020.
219
+ [39] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv:2102.12122, 2021.
220
+ [40] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv:2103.14030, 2021.
221
+ [41] David L Donoho. Compressed sensing. Proc. IEEE. Trans. Inf. The., 2006.
222
+ [42] Svante Wold, Kim Esbensen, and Paul Geladi. Principal component analysis. Proc. Chem. Int. Lab. Syst., 1987.
223
+ [43] Nasir Ahmed, T_ Natarajan, and Kamisetty R Rao. Discrete cosine transform. Proc. IEEE. Trans. Comp., 1974.
224
+ [44] Kai Xu, Minghai Qin, Fei Sun, Yuhao Wang, Yen-Kuang Chen, and Fengbo Ren. Learning in the frequency domain. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2020.
225
+ [45] Xing Shen, Jirui Yang, Chunbo Wei, Bing Deng, Jianqiang Huang, Xiansheng Hua, Xiaoliang Cheng, and Kewei Liang. Dct-mask: Discrete cosine transform mask representation for instance segmentation. arXiv:2011.09876, 2020.
226
+ [46] Shao-Yuan Lo and Hsueh-Ming Hang. Exploring semantic segmentation on the dct representation. In ACM Int. Conf. Mul. Med. Asia. 2019.
227
+ [47] Harold W Kuhn. The hungarian method for the assignment problem. Nav Res. Log. Qua., 1955.
228
+ [48] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In Proc. IEEE Int. Conf. Comp. Vis., 2017.
229
+ [49] Hamid Rezatofighi, Nathan Tsoi, JunYoung Gwak, Amir Sadeghian, Ian Reid, and Silvio Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2019.
230
+ [50] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2016.
231
+ [51] Matthew D Zeiler, Dilip Krishnan, Graham W Taylor, and Rob Fergus. Deconvolutional networks. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2010.
232
+ [52] Robert Tibshirani. Regression shrinkage and selection via the lasso. Jour. Roy. Stat. Soc., 1996.
233
+ [53] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2016.
234
+ [54] 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. Int. Jour. Comp. Vis., 2015.
235
+ [55] Bowen Cheng, Ross Girshick, Piotr Dollár, Alexander C Berg, and Alexander Kirillov. Boundary iou: Improving object-centric image segmentation evaluation. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2021.
md/train/B1MbDj0ctQ/B1MbDj0ctQ.md ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SWITCHING LINEAR DYNAMICS FOR VARIATIONAL BAYES FILTERING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ System identification of complex and nonlinear systems is a central problem for model predictive control and model-based reinforcement learning. Despite their complexity, such systems can often be approximated well by a set of linear dynamical systems if broken into appropriate subsequences. This mechanism not only helps us find good approximations of dynamics, but also gives us deeper insight into the underlying system. Leveraging Bayesian inference and Variational Autoencoders, we show how to learn a richer and more meaningful state space, e.g. encoding joint constraints and collisions with walls in a maze, from partial and high-dimensional observations. This representation translates into a gain of accuracy of the learned dynamics which we showcase on various simulated tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Learning dynamics from raw data (also known as system identification) is a key component of model predictive control and model-based reinforcement learning. Problematically, environments of interest often give rise to very complex and highly nonlinear dynamics which are seemingly difficult to approximate. However, switching linear dynamical systems (SLDS) approaches claim that those environments can often be broken down into simpler units made up of areas of equal and linear dynamics (Ackerson & Fu, 1970; Chang & Athans, 1978). Not only are those approaches capable of good predictive performance, which often is the sole goal of learning a system’s dynamics, they also encode valuable information into so called switching variables which determine the dynamics of the next transition. For example, when looking at the movement of an arm, one is intuitively aware of certain restrictions of possible movements, e.g. constraints to the movement due to joint constraints or obstacles. The knowledge is present without the need to simulate; it’s explicit. Exactly this kind of information will be encoded when successfully learning switching dynamics. Our goal in this work will therefore entail the search for richer representations in the form of latent state space models which encode knowledge about the underlying system dynamics. In turn, we expect this to improve the accuracy of our simulation as well. Such a representation alone could then be used in a reinforcement learning approach that possibly only takes advantage of the learned latent features but not necessarily its learned dynamics.
12
+
13
+ To learn richer representations, we identify one common problem with prevalent recurrent Variational Autoencoder models (Karl et al., 2017a; Krishnan et al., 2015; Chung et al., 2015; Fraccaro et al., 2016): the non-probabilistic treatment of the transition dynamics often modeled by a powerful nonlinear function approximator. From the history of the Autoencoder to the Variational Autoencoder, we know that in order to detect features in an unsupervised manner, probabilistic treatment of the latent space is paramount. As our starting point, we will build on previously proposed approaches by Krishnan et al. (2017) and Karl et al. (2017a). The latter already made use of locally linear dynamics, but only in a deterministic fashion. We extend their approaches by a stochastic switching LDS model and show that such treatment is vital for learning richer representations and simulation accuracy.
14
+
15
+ # 2 BACKGROUND
16
+
17
+ We consider discretized time-series data consisting of continuous observations $x _ { t } \in \mathcal { X } \subset \mathbb { R } ^ { n _ { x } }$ and control inputs $u _ { t } \in \mathcal { U } \subset \mathbb { R } ^ { n _ { u } }$ that we would like to model by corresponding latent states $z _ { t } \in \mathcal { Z } \subset \mathbb { R } ^ { n _ { z } }$ . We’ll denote sequences of variables by $x _ { 1 : T } = ( x _ { 1 } , x _ { 2 } , . . . , x _ { T } )$ .
18
+
19
+ ![](images/da18197c9717341f6caf03dbb955c01e82140562065970885fef03304c9f77aa.jpg)
20
+ Figure 1: (a) $s _ { t }$ denote discrete switch variables, $z _ { t }$ are continuous latent variables, $x _ { t }$ continuous observed variables, $u _ { t }$ are (optional) continuous control inputs. (b) By introducing a special latent variable $w$ used for initial state inference, we want to make explicit that the first step is treated differently from the rest of the sequence.
21
+
22
+ # 2.1 SWITCHING LINEAR DYNAMICAL SYSTEMS
23
+
24
+ Switching Linear Dynamical System models (SLDS) enable us to model nonlinear time series data by splitting it into sequences of linear dynamical models. At each time $t = 1 , 2 , . . . , T$ , a discrete switch variable $s _ { t } \in { 1 , . . . , M }$ chooses of a set LDSs a system which is to be used to transform our continuous latent state $z _ { t }$ to the next time step (Barber, 2012).
25
+
26
+ $$
27
+ \begin{array} { r l r l } & { z _ { t } = A ( s _ { t } ) z _ { t - 1 } + B ( s _ { t } ) u _ { t - 1 } + \epsilon ( s _ { t } ) \quad } & & { \epsilon ( s _ { t } ) \sim { \mathcal N } ( 0 , Q ( s _ { t } ) ) } \\ & { x _ { t } = H ( s _ { t } ) z _ { t } + \eta ( s _ { t } ) \quad } & & { \eta ( s _ { t } ) \sim { \mathcal N } ( 0 , R ( s _ { t } ) ) } \end{array}
28
+ $$
29
+
30
+ Here $A \in \mathbb { R } ^ { n _ { z } \times n _ { z } }$ is the state matrix, $B \in \mathbb { R } ^ { n _ { z } \times n _ { u } }$ control matrix, $\epsilon$ the transition noise with covariance matrix $Q$ and $\eta$ the emission/sensor noise with covariance matrix $R$ . Finally, the observation matrix $H \in \mathbb { R } ^ { n _ { x } \times n _ { z } }$ defines a linear mapping from latent to observation space which we will replace by a nonlinear transformation parameterized by a neural net. These equations imply the following joint distribution:
31
+
32
+ $$
33
+ p \left( { x _ { 1 : T } , z _ { 1 : T } , s _ { 1 : T } } \mid { u _ { 1 : T } } \right) = \prod _ { t = 1 } ^ { T } p \left( { x _ { t } } \mid { z _ { t } } \right) p \left( { z _ { t } } \mid { z _ { t - 1 } , u _ { t - 1 } , s _ { t } } \right) p \left( { s _ { t } } \mid { z _ { t - 1 } , u _ { t - 1 } , s _ { t - 1 } } \right)
34
+ $$
35
+
36
+ with $p ( z _ { 1 } \mid z _ { 0 } , u _ { 0 } , s _ { 1 } ) = p ( z _ { 1 } )$ being the initial state distribution. The corresponding graphical model is shown in figure 1a.
37
+
38
+ # 2.2 STOCHASTIC GRADIENT VARIATIONAL BAYES
39
+
40
+ $$
41
+ p ( x ) = \int p ( x , z ) \mathrm { d } z = \int p ( x \mid z ) p ( z ) \mathrm { d } z
42
+ $$
43
+
44
+ Given the simple graphical model in equation (3), Kingma & Welling (2014) and Rezende et al. (2014) introduced the Variational Autoencoder (VAE) which overcomes the intractability of posterior inference of $q ( z \mid x )$ by maximizing the evidence lower bound (ELBO) of the model log-likelihood.
45
+
46
+ $$
47
+ \mathcal { L } _ { \mathrm { E L B O } } ( x ; \theta , \phi ) = \mathbb { E } _ { q _ { \phi } ( z | x ) } [ \ln p _ { \theta } ( x \mid z ) ] - D _ { \mathrm { K L } } ( q _ { \phi } ( z \mid x ) \mid | p ( z ) ) \le \log p ( x )
48
+ $$
49
+
50
+ Their main innovation was to approximate the intractable posterior distribution by a recognition network $q _ { \phi } ( z | x )$ from which they can sample via the reparameterization trick to allow for stochastic backpropagation through both the recognition and generative model at once. Assuming that the latent state is normally distributed, a simple transformation allows us to obtain a Monte Carlo gradient estimate of $\mathbb { E } _ { q _ { \phi } ( z | x ) } \left[ \ln p _ { \theta } ( x | z ) \right]$ w.r.t. to $\phi$ . Given that $z \sim \mathcal { N } ( \mu , \sigma ^ { 2 } )$ , we can generate samples by drawing from an auxiliary variable $\epsilon \sim \mathcal { N } ( 0 , 1 )$ and applying the deterministic and differentiable transformation $z = \mu + \sigma \epsilon$ .
51
+
52
+ # 2.3 THE CONCRETE DISTRIBUTION
53
+
54
+ One simple and efficient way to obtain samples $d$ from a $k$ -dimensional categorical distribution with class probabilities $\alpha$ is the Gumbel-Max trick:
55
+
56
+ $$
57
+ d = \mathrm { o n e \_ h o t } \left( \mathrm { a r g m a x } \big [ g _ { i } + \log \alpha _ { i } \big ] \right) , \quad \mathrm { w i t h } \ g _ { 1 } , \dots , g _ { k } \sim \mathrm { G u m b e l } ( 0 , 1 )
58
+ $$
59
+
60
+ However, since the derivative of the argmax is 0 everywhere except at the boundary of state changes, where it is undefined, we can’t learn a parameterization by backpropagation. The Gumbel-Softmax trick approximates the argmax by a softmax which gives us a probability vector (Maddison et al., 2017; Jang et al., 2017). We can then draw samples via
61
+
62
+ $$
63
+ d _ { k } = \frac { \exp ( ( \log \alpha _ { k } + g _ { k } ) / \lambda ) } { \sum _ { i = 1 } ^ { n } \exp ( ( \log \alpha _ { i } + g _ { i } ) / \lambda ) } , \quad \mathrm { w i t h ~ } g _ { 1 } , \dots , g _ { k } \sim \mathrm { G u m b e l } ( 0 , 1 )
64
+ $$
65
+
66
+ This softmax computation approaches the discrete argmax as temperature $\lambda 0$ , for $\lambda \to \infty$ it approaches a uniform distribution.
67
+
68
+ # 3 RELATED WORK
69
+
70
+ Our model can be viewed as a Deep Kalman Filter (Krishnan et al., 2015) with structured inference (Krishnan et al., 2017). In our case, structured inference entails another stochastic variable model with parameter sharing inspired by Karl et al. (2017b) and Karl et al. (2017a) which pointed out the importance of backpropagating the reconstruction error through the transition. We are different to a number of stochastic sequential models like Bayer & Osendorfer (2014); Chung et al. (2015); Shabanian et al. (2017); Goyal et al. (2017) by directly transitioning the stochastic latent variable over time instead of having an RNN augmented by stochastic inputs. Fraccaro et al. (2016) has a transition over both a deterministic and a stochastic latent state sequence, wanting to combine the best of both worlds.
71
+
72
+ Previous models (Watter et al., 2015; Karl et al., 2017a; Fraccaro et al., 2017) have already combined locally linear models with recurrent Variational Autoencoders, however they provide a weaker structural incentive for learning latent variables determining the transition function. Van Steenkiste et al. (2018) approach a similar multi bouncing ball problem (see section 5.1) by first distributing the representation of different balls into their own entities without supervision and then structurally hardwiring a transition function with interactions based on an attention mechanism.
73
+
74
+ Recurrent switching linear dynamical systems (Linderman et al., 2016) uses message passing for approximate inference, but has restricted itself to low-dimensional observations and a multi-stage training process. Johnson et al. (2016) propose a similar model to ours but combine message passing for discrete switching variables with a neural network encoder for observations learned by stochastic backpropagation. Tackling the problem of propagating state uncertainty over time, various combinations of neural networks for inference and Gaussian processes for transition dynamics have been proposed (Eleftheriadis et al., 2017; Doerr et al., 2018). However, these models have not been demonstrated to work with high-dimensional observation spaces like images. One feature a switching LDS model may learn are interactions which have recently been approached by employing Graph Neural Networks (Battaglia et al., 2016; Kipf et al., 2018). These methods are similar in that they predict edges which encode interactions between components of the state space (nodes).
75
+
76
+ # 4 PROPOSED APPROACH
77
+
78
+ Our goal is to fit a series of continuous state $z _ { 1 : T }$ and switching variables $s _ { 2 : T }$ to a given sequence of observations $x _ { 1 : T }$ . We assume a nonlinear mapping between observations and latent space which we generally approximate by neural networks, apart from the transition which is modeled by a locally linear function. Our generative model is shown in figure 1b an our inference model in figure 2a.
79
+
80
+ # 4.1 GENERATIVE MODEL
81
+
82
+ Our generative model for a single $x _ { t }$ is described by
83
+
84
+ $$
85
+ p ( x _ { t } ) = \int _ { s \leq t } \int _ { z \leq t } p ( x _ { t } \mid z _ { t } ) p ( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } ) p ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } ) p ( z _ { t - 1 } , s _ { t - 1 } ) d s _ { t } d t .
86
+ $$
87
+
88
+ which is close to the one of the original SLDS model (see figure 1a). Latent states $z _ { t }$ are continuous and represent the state of the system while states $s _ { t }$ are the switching variables determining the transition. We approximate the discrete switching variables by a continuous relaxation, namely the Concrete distribution.1 Differently to the original model, we do not condition the likelihood of the current observation $p _ { \theta } ( x _ { t } \mid z _ { t } )$ directly on the switching variables. This limits the influence of the switching variables to choosing a proper transition dynamic for the continuous latent space. The likelihood model is parameterized by a neural network with either a Gaussian or a Bernoulli distribution as output depending on the data.
89
+
90
+ There is both a transition on the continuous states $z _ { t }$ and discrete latent states $s _ { t }$ . For the continuous state transition $p ( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } )$ we follow (1) and maintain a set of $M$ base matrices $\{ \left( A ^ { ( i ) } , B ^ { ( i ) } , Q ^ { ( i ) } \right) | \forall i . 0 < i < M \}$ as our linear dynamical systems to choose from. For the transition on discrete latent states $p ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } )$ , we usually require the learning of a Markov transition matrix. However, since we approximate our discrete switching variables by a continuous relaxation, we can parameterize this transition by a neural network. Therefore, our entire generative model can be learned end-to-end by (stochastic) backpropagation. Finally, the resulting dynamics matrices are computed through a linear combination of the base matrices:
91
+
92
+ $$
93
+ A _ { t } ( s _ { t } ) = \sum _ { i = 1 } ^ { M } s _ { t } ^ { ( i ) } A ^ { ( i ) } , \qquad B ( s _ { t } ) = \sum _ { i = 1 } ^ { M } s _ { t } ^ { ( i ) } B ^ { ( i ) } , \qquad Q ( s _ { t } ) = \sum _ { i = 1 } ^ { M } s _ { t } ^ { ( i ) } Q ^ { ( i ) }
94
+ $$
95
+
96
+ Both transition models – the continuous state transition $p _ { \theta } ( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } )$ and concrete switching variables transition $p _ { \theta } \big ( s _ { t } \ | \ s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } \big ) -$ are shared with the inference model which is key for good performance.
97
+
98
+ $$
99
+ \begin{array} { r l } & { \quad p _ { \theta } ( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } ) = \mathcal { N } \big ( \mu , \sigma ^ { 2 } \big ) \qquad \mathrm { w h e r e } \ [ \mu , \sigma ^ { 2 } ] = f _ { \theta } ( z _ { t - 1 } , s _ { t } , u _ { t - 1 } ) } \\ & { \quad p _ { \theta } ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } ) = \mathrm { C o n c r e t e } ( \alpha , \lambda _ { \mathrm { p r i o r } } ) \qquad \mathrm { w h e r e } \ \alpha = g _ { \theta } ( z _ { t - 1 } , s _ { t - 1 } , u _ { t - 1 } ) } \end{array}
100
+ $$
101
+
102
+ # 4.2 INFERENCE
103
+
104
+ # 4.2.1 STRUCTURED INFERENCE OF CONTINUOUS LATENT STATE
105
+
106
+ We split our inference model $q _ { \phi } ( z _ { t } \mid z _ { t - 1 } , s _ { t } , x _ { \geq t } , u _ { \geq t - 1 } )$ into two parts: 1) transition model $q _ { \mathrm { t r a n s } } \bar { ( } z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } )$ and 2) inverse measurement model $q _ { \mathrm { m e a s } } ( z _ { t } \mid x _ { \geq t } , u _ { \geq t } )$ as previously proposed in Karl et al. (2017b). This split allows us to reuse our generative transition model in place of $q _ { \mathrm { t r a n s } } ( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } )$ . This sharing of variables is essential for good performance as it forces the reconstruction error to be backpropagated throughwe only share the computation of the transition mean $\mu _ { \mathrm { t r a n s } }$ nsition model. For prbut not the variance $\sigma _ { \mathrm { t r a n s } } ^ { 2 }$ l reasons,between inference and generative model. Both parts, and $q _ { \mathrm { t r a n s } }$ , will give us independent predictions about the new state $z _ { t }$ which will be combined in a manner akin to a Bayesian update in a Kalman Filter.
107
+
108
+ $$
109
+ \begin{array} { r } { l \phi \left( z _ { t } \mid z _ { t - 1 } , s _ { t } , x _ { \geq t } , u _ { \geq t - 1 } \right) \propto q _ { \operatorname* { m e a s } } \left( z _ { t } \mid x _ { \geq t } , u _ { \geq t } \right) \times q _ { \mathrm { t r a n s } } \left( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } \right) = \mathcal { N } \left( \mu _ { q } , \sigma _ { q } ^ { 2 } \right) } \\ { q _ { \operatorname* { m e a s } } \left( z _ { t } \mid x _ { \geq t } , u _ { \geq t } \right) = \mathcal { N } \left( \mu _ { \operatorname* { m e a s } } , \sigma _ { \operatorname* { m e a s } } ^ { 2 } \right) \mathrm { ~ w h e r e ~ } \left[ \mu _ { \operatorname* { m e a s } } , \sigma _ { \operatorname* { m e a s } } ^ { 2 } \right] = h _ { \phi } \left( x _ { \geq t } , u _ { \geq t } \right) \quad \mathrm { ( } 1 \mathrm { ~ t ~ } } \\ { q _ { \operatorname { t r a n s } } \left( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } \right) = \mathcal { N } \left( \mu _ { \operatorname { t r a n s } } , \sigma _ { \operatorname* { t r a n s } } ^ { 2 } \right) \mathrm { ~ w h e r e ~ } \left[ \mu _ { \operatorname { t r a n s } } , \sigma _ { \operatorname { t r a n s } } ^ { 2 } \right] = f _ { \theta } \left( z _ { t - 1 } , s _ { t } , u _ { t - 1 } \right) } \end{array}
110
+ $$
111
+
112
+ The densities of $q _ { \mathrm { m e a s } }$ and $q _ { \mathrm { t r a n s } }$ are multiplied resulting in another Gaussian density:
113
+
114
+ $$
115
+ \mu _ { q } = \frac { \mu _ { \mathrm { t r a n s } } \sigma _ { \mathrm { m e a s } } ^ { 2 } + \mu _ { \mathrm { m e a s } } \sigma _ { \mathrm { t r a n s } } ^ { 2 } } { \sigma _ { \mathrm { m e a s } } ^ { 2 } + \sigma _ { \mathrm { t r a n s } } ^ { 2 } } , \qquad \sigma _ { q } ^ { 2 } = \frac { \sigma _ { \mathrm { m e a s } } ^ { 2 } \sigma _ { \mathrm { t r a n s } } ^ { 2 } } { \sigma _ { \mathrm { m e a s } } ^ { 2 } + \sigma _ { \mathrm { t r a n s } } ^ { 2 } }
116
+ $$
117
+
118
+ This update scheme is highlighted in figure 2b.
119
+
120
+ We found empirically that conditioning the inverse measurement model $q _ { \mathrm { m e a s } } ( z _ { t } \mid x _ { \geq t } , u _ { \geq t } )$ solely on the current observation $x _ { t }$ instead of the entire remaining trajectory to lead to better results. We hypothesize that the recurrent model needlessly introduces very high-dimensional and complicated dynamics which are harder to approximate with our locally linear transition model.
121
+
122
+ For the initial state $z _ { 1 }$ we do not have a conditional prior from the transition model as in the rest of the sequence. Other methods (Krishnan et al., 2015) have used a standard normal prior, however this is not a good fit. We therefore decided that instead of predicting $z _ { 1 }$ directly to predict an auxiliary variable $w$ that is then mapped deterministically to a starting state $z _ { 1 }$ . A standard Gaussian prior is then applied to $w$ . Alternatively, we could specify a more complex or learned prior for the initial state like the VampPrior (Tomczak & Welling, 2017). Empirically, this has lead to worse results.
123
+
124
+ $$
125
+ \begin{array} { r l } { q _ { \phi } ( w \mid x _ { 1 : T } , u _ { 1 : T } ) = { \mathcal { N } } { \big ( } w ; \mu _ { w } , \sigma _ { w } ^ { 2 } { \big ) } } & { { } { \mathrm { w h e r e } } \quad [ \mu _ { w } , \sigma _ { w } ^ { 2 } ] = i _ { \phi } ( x _ { 1 : T } , u _ { 1 : T } ) } \\ { z _ { 1 } = f _ { \phi } ( w ) } & { { } } \end{array}
126
+ $$
127
+
128
+ While we could condition on the entire sequence, we restrict it to just the first couple of observations.
129
+
130
+ ![](images/77ec647f77f9f545bed126f45f7c914263e5c545ff3e46593cee575823abc31e.jpg)
131
+ Figure 2: (a) Depicts the inference model. $b _ { t }$ is the hidden state of the backward RNN of $q _ { \phi } \mathbf { \bar { ( } } s _ { t } \mid x _ { \geq t } , u _ { \geq t } )$ . Initial inference of $w$ may be conditioned on the entire sequence of observations, or just a subsequence. We��ve omitted the arrows for sake of clarity for the rest of the graph. (b) Shows schematically how we combine the transition with the inverse measurement model in the inference network. Transitions (in blue) are (partially) shared with the generative model.
132
+
133
+ # 4.2.2 INFERENCE OF SWITCHING VARIABLES
134
+
135
+ Following Maddison et al. (2017) and Jang et al. (2017), we can reparameterize a discrete latent variable with the Gumbel-softmax trick. Again, we split our inference network $q _ { \phi } ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , x _ { \geq t } , u _ { \geq t - 1 } )$ in an identical fashion into two components: 1) Transition model $q _ { \mathrm { t r a n s } } ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } )$ and 2) inverse measurement model $q _ { \mathrm { m e a s } } ( s _ { t } \mid x _ { \geq t } , u _ { \geq t } )$ . The transition model is again shared with the generative model and is implemented via a neural network as we potentially require quick changes to chosen dynamics. The inverse measurement model is parametrized by a backward LSTM. However, for the case of concrete variables, we cannot do the same Gauss multiplication as in the previous case. Therefore, we let each network predict the logits of a Concrete distribution and our inverse measurement model $q _ { \phi } ( s _ { t } \mid x _ { \geq t } , u _ { \geq t } )$ produces an additional vector $\gamma$ , which determines the value of a gate deciding how the two predictions are to be weighted:
136
+
137
+ $$
138
+ \begin{array} { r l } & { q _ { \phi } \big ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , x _ { \geq t } , u _ { \geq t - 1 } \big ) = \mathrm { C o n c r e t e } \big ( \alpha , \lambda _ { \mathrm { p o s t e r i o r } } \big ) \quad \mathrm { w i t h } \quad \alpha = \gamma \alpha _ { \mathrm { t r a n s } } + ( 1 - \gamma ) \alpha _ { \mathrm { m e a s } } } \\ & { q _ { \operatorname* { m e a s } } \big ( s _ { t } \mid x _ { \geq t } , u _ { \geq t } \big ) = \mathrm { C o n c r e t e } \big ( \alpha _ { \mathrm { m e a s } } , \lambda _ { \mathrm { p o s t e r i o r } } \big ) \quad \mathrm { w h e r e } \quad \big [ \alpha _ { \mathrm { m e a s } } , \gamma \big ] = k _ { \phi } \big ( x _ { \geq t } , u _ { \geq t } \big ) \qquad ( 1 3 ) } \\ & { q _ { \mathrm { t r a n s } } \big ( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } \big ) = \mathrm { C o n c r e t e } \big ( \alpha _ { \mathrm { t r a n s } } , \lambda _ { \mathrm { p r i o r } } \big ) \quad \mathrm { w h e r e } \quad \alpha = g _ { \theta } \big ( z _ { t - 1 } , s _ { t - 1 } , u _ { t - 1 } \big ) } \end{array}
139
+ $$
140
+
141
+ The temperatures $\lambda _ { \mathrm { p o s t e r i o r } }$ and $\lambda _ { \mathrm { p r i o r } }$ are set as a hyperparameter and can be set differently for the prior and approximate posterior. The gating mechanism gives the model the option to balance between prior and approximate posterior. If the prior is good enough to explain the next observation, $\gamma$ will be pushed to 1 which ignores the measurement and minimizes the KL between prior and posterior by only propagating the prior. If the prior is not sufficient, information from the inverse measurement model can flow by decreasing $\gamma$ and incurring a KL penalty.
142
+
143
+ Since the concrete distribution is a relaxation of the categorical, our sample will not be a one-hot vector, but a vector whose elements sum up to 1. We face two options here: we could take a categorical sample by choosing the linear system corresponding to the highest value in the sample (hard forward pass) and only use the relaxation for our backward pass. This, however, means that we will follow a biased gradient. Alternatively, we can use the relaxed version for our forward pass and aggregate the linear systems based on their corresponding weighting (see (8)). Here, we lose the discrete switching of linear systems, but maintain a valid lower bound. We note that the hard forward pass has led to worse results and focus on the soft forward pass for this paper.
144
+
145
+ Lastly, we could go further away from the theory and instead treat the switching variables also as normally distributed. If this worked better than the approach with Concrete variables, it would highlight still existing optimization problems of discrete random variables. As such, it will act as an ablation study for our model. The mixing coefficients for linear systems would then be determined by a linear combination of these latent variables:
146
+
147
+ $$
148
+ \alpha = \operatorname { s o f t m a x } ( W s _ { t } + b ) \in \mathbb { R } ^ { M }
149
+ $$
150
+
151
+ Our inference scheme for normally distributed switching variables is then identical to the one described in the previous section. We compare both approaches throughout our experimental section.
152
+
153
+ # 4.3 TRAINING
154
+
155
+ Our objective function is the commonly used evidence lower bound for our hierarchical model.
156
+
157
+ $$
158
+ \begin{array} { r l } { \mathcal { L } _ { \theta , \phi } \big ( x _ { 1 : T } \ \big | \ u _ { 1 : T } \big ) \geq } & { \mathbb { E } _ { q _ { \phi } ( z _ { 1 : T } , s _ { 1 : T } \mid x _ { 1 : T } ) } \big [ \log p _ { \theta } \big ( x _ { 1 : T } \ \big | \ z _ { 1 : T } , s _ { 1 : T } , u _ { 1 : T } \big ) \big ] } \\ & { - D _ { \mathrm { K L } } \big ( q _ { \phi } \big ( z _ { 1 : T } , s _ { 1 : T } \ \big | \ x _ { 1 : T } , u _ { 1 : T } \big ) \ \big | \ \big | \ p \big ( z _ { 1 : T } , s _ { 1 : T } \ \big | \ u _ { 1 : T } \big ) \big ) } \end{array}
159
+ $$
160
+
161
+ We choose to factorize over time, so the loss for a single observation $x _ { t }$ becomes:
162
+
163
+ $$
164
+ \begin{array} { r l } & { \mathcal { L } _ { \theta , \phi } ( x _ { t } \mid u _ { 1 : T } ) = \mathbb { E } _ { q _ { \phi } \left( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , x _ { \geq t } , u _ { \geq t - 1 } \right) } \left[ \mathbb { E } _ { q _ { \phi } \left( z _ { t } \mid s _ { t } , z _ { t - 1 } , x _ { \geq t } , u _ { \geq t - 1 } \right) } \left[ \log p _ { \theta } ( x _ { t } \mid z _ { t } ) \right] \right] \qquad ( 1 6 ) } \\ & { \qquad - \mathbb { E } _ { s _ { t - 1 } } \left[ \mathbb { E } _ { z _ { t - 1 } } \left[ D _ { \mathrm { K L } } \left( q _ { \phi } \left( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , x _ { \geq t } , u _ { \geq t - 1 } \right) \mid \mid p _ { \theta } \left( s _ { t } \mid s _ { t - 1 } , z _ { t - 1 } , u _ { t - 1 } \right) \right) \right] \right] } \\ & { \qquad - \mathbb { E } _ { z _ { t - 1 } } \left[ \mathbb { E } _ { s _ { t } } \left[ D _ { \mathrm { K L } } \left( q _ { \phi } \left( z _ { t } \mid z _ { t - 1 } , s _ { t } , x _ { \geq t } , u _ { \geq t - 1 } \right) \mid \mid p _ { \theta } \left( z _ { t } \mid z _ { t - 1 } , s _ { t } , u _ { t - 1 } \right) \right) \right] \right] } \end{array}
165
+ $$
166
+
167
+ The full derivation can be found in appendix A. We learn the parameters of our model by backpropagation through time and we (generally) approximate the expectations with one sample by using the reparametrization trick. The exception is the KL between two Concrete random variables in which case we take 10 samples for the approximation. For the KL on the switching variables, we further introduce a scaling factor $\beta < 1$ (as first suggested in Higgins et al. (2016), although they suggested increasing the KL term) to down weigh its importance. More details on the training procedure can be found in appendix B.2.
168
+
169
+ # 5 EXPERIMENTS
170
+
171
+ In this section, we evaluate our approach on a diverse set of physics and robotics simulations based on partially observable system states or high-dimensional images as observations. We show that our model outperforms previous models and that our switching variables learn meaningful representations.
172
+
173
+ Models we compare to are Deep Variational Bayes Filter (DVBF) (Karl et al., 2017a), DVBF Fusion (Karl et al., 2017b) (called fusion as they do the same Gauss multiplication in the inference network) which is closest to our model but doesn’t have a stochastic treatment of the transition, the Kalman VAE (KVAE) (Fraccaro et al., 2017) and a LSTM (Hochreiter & Schmidhuber, 1997).
174
+
175
+ ![](images/e0194ebf04f7331684f7436c765cd1d05be1f6ea391f318e881011b153ff9194.jpg)
176
+ (a) Multi agent maze envi- (b) Variable encoding free (c) Variable encoding walls (d) System activation for ronment. space for agent 2. for agent 1. deterministic transition.
177
+
178
+ Figure 3: Figures (b) and (c) depict an agent’s position colored by the average value of a single latent variable $s$ marginalized over all control inputs $u$ and velocities. Figure (d) highlights a representative activation for a single transition system for the deterministic treatment of the transition dynamics. It doesn’t generalize to the entire maze and stays fairly active in proximity to the wall.
179
+
180
+ # 5.1 MULTIPLE BOUNCING BALLS IN A MAZE
181
+
182
+ Our first experiment is a custom 3-agent maze environment simulated with Box2D. Each agent is fully described by its $x$ and $y$ coordinates and its current velocity and has the capability to accelerate in either direction. We learn in a partially observable setting and limit the observations to the agents’ positions, therefore $x \in \mathbb { R } ^ { 6 }$ while the true state space is in $\mathbb { R } ^ { 1 2 }$ and $u \in \mathbb { R } ^ { 6 }$ . First, we train a linear regression model on the latent space $z$ to see if we have recovered a linear encoding of the unobserved velocities. We achieve an R2 score of 0.92 averaged over all agents and velocity directions.
183
+
184
+ Our focus shifts now to our switching variables which we expect to encode interactions with walls. We provide a visual confirmation of that in figure 3 where we see switching variables encoding all space where there is no interaction in the next time step, and variables which encode walls, distinguishing between vertical and horizontal ones. In figure 3d one can see show that if the choice of locally linear transition is treated deterministically, we don’t learn global features of the same kind. To confirm our visual inspection, we train a simple decision tree based on latent space $s$ in order to predict interaction with a wall. Here, we achieve an F1 score of 0.46. It is difficult to say what a good value should look like as collisions with low velocity are virtually indistinguishable from no collision.
185
+
186
+ We compare our prediction quality to several other methods in table 1 where we outperform all of our chosen baselines. Also, modeling switching variables by a Normal distribution outperforms the Concrete distribution in all of our experiments. Aside from known practical issues with training a discrete variable via backpropagation, we explore one reason why that may be in section 5.4, which is the greater susceptibility to the scale of temporal discretization. We provide plots of predicted trajectories in appendix D. Transitioning multiple agents with a single transition matrix comes with scalability issues with regards to switching dynamics which we explore further in appendix C.
187
+
188
+ Table 1: Mean squared error (MSE) on predicting future observations. Static refers to constantly predicting the first observation of the sequence.
189
+
190
+ <table><tr><td></td><td colspan="3">REACHER</td><td colspan="3">3-BALL MAZE</td></tr><tr><td>PREDICTION STEPS</td><td>1</td><td>5</td><td>10</td><td>1</td><td>5</td><td>10</td></tr><tr><td>STATIC</td><td>5.80E-02</td><td>5.36E-01</td><td>1.25E+00</td><td>1.40E-02</td><td>5.74E-01</td><td>2.65E+00</td></tr><tr><td>LSTM</td><td>3.07E-01</td><td>7.76E-01</td><td>1.22E+00</td><td>7.20E-02</td><td>1.58E-01</td><td>2.60E-01</td></tr><tr><td>DVBF</td><td>1.10E-01</td><td>3.08E-01</td><td>6.07E-01</td><td>6.20E-02</td><td>1.36E-01</td><td>1.82E-01</td></tr><tr><td>DVBFFUSION</td><td>4.90E-03</td><td>2.97E-02</td><td>8.25E-02</td><td>4.33E-03</td><td>2.03E-02</td><td>4.88E-02</td></tr><tr><td>OURS (CONCRETE)</td><td>1.06E-02</td><td>5.73E-02</td><td>1.56E-01</td><td>2.28E-03</td><td>1.22E-02</td><td>3.40E-02</td></tr><tr><td>OURS (NORMAL)</td><td>3.39E-03</td><td>1.85E-02</td><td>4.97E-02</td><td>1.30E-03</td><td>5.52E-03</td><td>1.38E-02</td></tr></table>
191
+
192
+ # 5.2 REACHER
193
+
194
+ We then evaluate our model on the Roboschool reacher environment. To make things more interesting, we learn only on partial observations, removing time derivative information (velocities), leaving us with just the positions or angles of various joints as observations. Table 1 shows a comparison of various methods on predicting the next couple of time steps. One critical point is the possible collision2 between lower and upper joint which is one we’d like our model to capture. We again learn a linear classifier based on latent space $s$ to see if this is successfully encoded and reach an F1 score of 0.46.
195
+
196
+ # 5.3 BALL IN A BOX ON IMAGE DATA
197
+
198
+ Finally, we evaluate our method on high-dimensional image observations using the single bouncing ball environment used by Fraccaro et al. (2017). They simulated 5000 sequences of 20 time steps each of a ball moving in a two-dimensional box, where each video frame is a $3 2 \times 3 2$ binary image. There are no forces applied to the ball, except for the fully elastic collisions with the walls. Initial position and velocity are randomly sampled.
199
+
200
+ ![](images/e336e1bf737c0b1609bca209428a9329da2814fbc7a23379990da437d282bb0e.jpg)
201
+ Figure 4: First row: data, second row: filtered reconstructions, third row: predictions. The first 4 steps are used to find a stable starting state, predictions start with step 5.
202
+
203
+ In figure 5a we compare our model to both the smoothed and generative version of the KVAE. The smoothed version receives the final state of the trajectory after the $n$ predicted steps which is fed into the smoothing capability of the KVAE. One can see that our model learns a better transition model, even outperforming the smoothed KVAE for longer sequences. For short sequences, KVAE performs better which highlights the value of it disentangling the latent space into separate object and dynamics representation. A sample trajectory is plotted in figure 4.
204
+
205
+ # 5.4 SUSCEPTIBILITY TO THE SCALE OF TEMPORAL DISCRETIZATION
206
+
207
+ In this section, we’d like to explore how the choice of $\Delta t$ when discretizing a system influences our results. In particular, we’d expect our model with discrete (concrete) switching latent variables to be more susceptible to it than when modeled by a continuous distribution. This is because in the latter case the switching variables can scale the various matrices more freely, while in the former scaling up one system necessitates scaling down another. For empirical comparison, we go back to our custom maze environment (this time with only one agent as this is not pertinent to our question at hand) and learn the dynamics on various discretization scales. Then we compare the absolute error’s growth for both approaches in figure 5b which supports our hypothesis. While the discrete approximation even outperforms for small $\Delta t$ , there is a point where it rapidly becomes worse and gets overtaken by the continuous approximation. This suggests that $\Delta t$ was simply chosen to be too large in both the reacher and the ball in a box with image observations experiment.
208
+
209
+ ![](images/0e452e2e6f69830aa478e0687ad1ffd2d7d2264958af6ea33ad244daeec98297.jpg)
210
+ Figure 5: (a) Our dynamics model is outperforming even the smoothed KVAE for longer trajectories. (b) Modeling switching variables as Concrete random variables scales less favorably.
211
+
212
+ # 6 DISCUSSION
213
+
214
+ We want to emphasize some subtle differences to previously proposed architectures that make an empirical difference, in particular for the case when $s _ { t }$ is chosen to be continuous. In Watter et al. (2015) and Karl et al. (2017a), the latent space is already used to draw transition matrices, however they do not extract features such as walls or joint constraints. There are a few key differences from our approach. First, our latent switching variables $s _ { t }$ are only involved in predicting the current observation $x _ { t }$ through the transition selection process. The likelihood model therefore doesn’t need to learn to ignore some input dimensions which are only helpful for reconstructing future observations but not the current one. There is also a clearer restriction on how $s _ { t }$ and $z _ { t }$ may interact: $s _ { t }$ may now only influence $z _ { t }$ by determining the dynamics, while previously $z _ { t }$ influenced both the choice of transition function as well as acted inside the transition. These two opposing roles lead to conflicting gradients as to what should be improved. Furthermore, the learning signal for $s _ { t }$ is rather weak so that scaling down the KL-regularization was necessary to detect good features. Lastly, a (locally) linear transition may not be a good fit for variables determining dynamics as such variables may change very abruptly.
215
+
216
+ # 7 CONCLUSION
217
+
218
+ We have shown that our construction of using switching variables encourages learning a richer and more interpretable latent space. In turn, the richer representation led to an improvement of simulation accuracy in various tasks. In the future, we’d like to look at other ways to approximate the discrete switching variables and exploit this approach for model-based control on real hardware systems. Furthermore, addressing the open problem of disentangling latent spaces is essential to fitting simple dynamics and would lead to significant improvements of this approach.
219
+
220
+ # REFERENCES
221
+
222
+ G Ackerson and K Fu. On state estimation in switching environments. IEEE Transactions on Automatic Control, 15(1):10–17, 1970.
223
+ D. Barber. Bayesian Reasoning and Machine Learning. Cambridge University Press, 2012.
224
+ Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pp. 4502–4510, 2016.
225
+ Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014.
226
+ Chaw-Bing Chang and Michael Athans. State estimation for discrete systems with switching parameters. IEEE Transactions on Aerospace and Electronic Systems, (3):418–425, 1978.
227
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015.
228
+ Andreas Doerr, Christian Daniel, Martin Schiegg, Duy Nguyen-Tuong, Stefan Schaal, Marc Toussaint, and Sebastian Trimpe. Probabilistic recurrent state-space models. arXiv preprint arXiv:1801.10395, 2018.
229
+ Stefanos Eleftheriadis, Tom Nicholson, Marc Deisenroth, and James Hensman. Identification of gaussian process state space models. In Advances in Neural Information Processing Systems, pp. 5309–5319, 2017.
230
+ Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential neural models with stochastic layers. In Advances in neural information processing systems, pp. 2199–2207, 2016.
231
+ Marco Fraccaro, Simon Kamronn, Ulrich Paquet, and Ole Winther. A disentangled recognition and nonlinear dynamics model for unsupervised learning. In Advances in Neural Information Processing Systems, pp. 3604–3613, 2017.
232
+ Anirudh Goyal, Alessandro Sordoni, Marc-Alexandre Côté, Nan Ke, and Yoshua Bengio. Z-forcing: Training stochastic recurrent networks. In Advances in Neural Information Processing Systems, pp. 6713–6723, 2017.
233
+ 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.
234
+
235
+ Irina Higgins, Loic Matthey, Xavier Glorot, Arka Pal, Benigno Uria, Charles Blundell, Shakir Mohamed, and Alexander Lerchner. Early Visual Concept Learning with Unsupervised Deep Learning. 2016. URL http://arxiv.org/abs/1606.05579.
236
+
237
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
238
+
239
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. International Conference on Learning Representations, pp. 1–13, nov 2017. URL http:// arxiv.org/abs/1611.01144.
240
+
241
+ Matthew Johnson, David K Duvenaud, Alex Wiltschko, Ryan P Adams, and Sandeep R Datta. Composing graphical models with neural networks for structured representations and fast inference. In Advances in neural information processing systems, pp. 2946–2954, 2016.
242
+
243
+ Maximilian Karl, Maximilian Soelch, Justin Bayer, and Patrick van der Smagt. Deep Variational Bayes Filters: Unsupervised Learning of State Space Models from Raw Data. In Proceedings of the International Conference on Learning Representations (ICLR), 2017a.
244
+
245
+ Maximilian Karl, Maximilian Soelch, Philip Becker-Ehmck, Djalel Benbouzid, Patrick van der Smagt, and Justin Bayer. Unsupervised real-time control through variational empowerment. arXiv preprint arXiv:1710.05101, 2017b.
246
+
247
+ D. P. Kingma and J. Ba. Adam: A Method for Stochastic Optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2015.
248
+
249
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In Proceedings of the 2nd International Conference on Learning Representations (ICLR), 2014.
250
+
251
+ T. Kipf, E. Fetaya, K.-C. Wang, M. Welling, and R. Zemel. Neural relational inference for interacting systems. In Proceedings of the 35th International Conference on Machine Learning, 2018.
252
+
253
+ Rahul G. Krishnan, Uri Shalit, and David Sontag. Deep Kalman Filters. arXiv preprint arXiv:1511.05121, (2000):1–7, 2015. URL http://arxiv.org/abs/1511.05121.
254
+
255
+ Rahul G. Krishnan, Uri Shalit, and David Sontag. Structured inference networks for nonlinear state space models. In AAAI, pp. 2101–2109, 2017.
256
+
257
+ Scott W. Linderman, Andrew C. Miller, Ryan P. Adams, David M. Blei, Liam Paninski, and Matthew J. Johnson. Recurrent switching linear dynamical systems. 2016. URL http://arxiv.org/ abs/1610.08466.
258
+
259
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. In Proceedings of the International Conference on Learning Representations (ICLR), pp. 1–17, 2017. ISBN 0780365402. URL http://arxiv. org/abs/1611.00712.
260
+
261
+ 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 International Conference on Machine Learning - Volume 32, ICML’14, pp. II–1278– II–1286. JMLR.org, 2014.
262
+
263
+ Samira Shabanian, Devansh Arpit, Adam Trischler, and Yoshua Bengio. Variational Bi-LSTMs. 2017. URL http://arxiv.org/abs/1711.05717.
264
+
265
+ Jakub M Tomczak and Max Welling. Vae with a vampprior. arXiv preprint arXiv:1705.07120, 2017.
266
+
267
+ Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jürgen Schmidhuber. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. In Proceedings of the International Conference on Learning Representations (ICLR), 2018.
268
+
269
+ Manuel Watter, Jost Springenberg, Joschka Boedecker, and Martin Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in neural information processing systems, pp. 2746–2754, 2015.
270
+
271
+ # A LOWER BOUND DERIVATION
272
+
273
+ For brevity we omit conditioning on control inputs $u _ { 1 : T }$ .
274
+
275
+ $$
276
+ \begin{array} { l } { \displaystyle \log p ( x _ { T } ) = \log \int _ { z _ { 1 : T } } \int _ { s _ { 1 : T } } q _ { \phi } ( s _ { 1 : T } , z _ { 1 : T } \mid x _ { 1 : T } ) \frac { p _ { \theta } ( x _ { 1 : T } \mid z _ { 1 : T } ) p _ { \theta } ( z _ { 1 : T } , s _ { 1 : T } ) } { q _ { \phi } ( s _ { 1 : T } , z _ { 1 : T } \mid x _ { 1 : T } ) } } \\ { \displaystyle \geq \int _ { z _ { 1 : T } } \int _ { s _ { 1 : T } } q _ { \phi } ( s _ { 1 : T } , z _ { 1 : T } \mid x _ { 1 : T } ) \log \frac { p _ { \theta } ( x _ { 1 : T } \mid z _ { 1 : T } ) p _ { \theta } ( z _ { 1 : T } , s _ { 1 : T } ) } { q _ { \phi } ( s _ { 1 : T } , z _ { 1 : T } \mid x _ { 1 : T } ) } } \\ { \displaystyle = \sum _ { t = 1 } ^ { T } \mathbb { E } _ { s _ { t } } [ \mathbb { E } _ { z _ { t } } [ p ( x _ { t } \mid z _ { t } , s _ { t } ) ] ] - D _ { \mathrm { K L } } ( q ( z _ { 1 : T } , s _ { 1 : T } \mid x _ { 1 : T } ) \mid | p ( z _ { 1 : T } , s _ { 1 : T } ) ) } \end{array}
277
+ $$
278
+
279
+ # A.1 FACTORIZATION OF THE KL DIVERGENCE
280
+
281
+ The dependencies on data $x _ { T }$ and $u _ { T }$ as well as parameters $\phi$ and $\theta$ are omitted in the following for convenience.
282
+
283
+ $$
284
+ D _ { \mathrm { K L } } ( q ( z _ { 1 } , s _ { 2 } , \ldots , s _ { T } , z _ { T } ) \parallel p ( z _ { 1 } , s _ { 2 } , \ldots , s _ { T } , z _ { T } ) )
285
+ $$
286
+
287
+ $$
288
+ \begin{array} { r l } { { } } & { { = \displaystyle \int _ { z _ { 1 } } \int _ { s _ { 2 } } \cdots \int _ { s _ { T } } \int _ { z _ { T } } q ( z _ { 1 } ) q ( s _ { 2 } \mid z _ { 1 } ) \ldots q ( s _ { T } \mid z _ { T - 1 } , s _ { T - 1 } ) q ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) } } \\ { { } } & { { \phantom { = \displaystyle \int _ { z _ { 1 } } \int _ { s _ { 2 } } \cdots \int _ { s _ { T } } \int _ { z _ { T } } q ( z _ { 1 } ) q ( s _ { 2 } \mid z _ { 1 } ) \ldots q ( s _ { T } \mid z _ { T - 1 } , s _ { T - 1 } ) q ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) } } } \\ { { } } & { { \phantom { = \displaystyle \int _ { z _ { 1 } } \int _ { s _ { 2 } } \cdots d \int _ { z _ { T - 1 } } \int _ { z _ { T - 1 } } s _ { T - 1 } \int _ { z _ { T } } } } } \end{array}
289
+ $$
290
+
291
+ (Factorization of the prior)
292
+
293
+ $$
294
+ \begin{array} { r l } { { } } & { { = { \displaystyle \int _ { z _ { 1 } } \int _ { s _ { 2 } } \cdots \int _ { s _ { T } } \int _ { z _ { T } } q ( z _ { 1 } ) q ( s _ { 2 } \mid z _ { 1 } ) \ldots q ( s _ { T } \mid z _ { T - 1 } , s _ { T - 1 } ) q ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) } } } \\ { { } } & { { { \log \frac { q ( z _ { 1 } ) q ( s _ { 2 } \mid z _ { 1 } ) \ldots q ( s _ { T } \mid z _ { T - 1 } , s _ { T - 1 } ) q ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) } { p ( z _ { 1 } ) p ( s _ { 2 } \mid z _ { 1 } ) \ldots p ( s _ { T } \mid z _ { T - 1 } , s _ { T - 1 } ) p ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) } } } } \end{array}
295
+ $$
296
+
297
+ (Expanding the logarithm by the product rule)
298
+
299
+ $$
300
+ \begin{array} { l } { { = \displaystyle \int _ { z _ { 1 } } q ( z _ { 1 } ) \log \frac { q ( z _ { 1 } ) } { p ( z _ { 1 } ) } + \displaystyle \int _ { z _ { 1 } } \int _ { s _ { 1 } } q ( z _ { 1 } ) q ( s _ { 1 } \mid z _ { 1 } ) \log \frac { q ( s _ { 1 } \mid z _ { 1 } ) } { p ( s _ { 1 } \mid z _ { 1 } ) } } } \\ { { + \displaystyle \sum _ { t = 2 } ^ { T } \int _ { z _ { 1 } } \int _ { s _ { 2 } } \cdots \int _ { s _ { T } } \int _ { z _ { T } } q ( z _ { 1 } ) q ( s _ { 2 } \mid z _ { 1 } ) \ldots q ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) \log \frac { q ( z _ { t } \mid z _ { t - 1 } , s _ { t } ) } { p ( z _ { t } \mid z _ { t - 1 } , s _ { t } ) } } } \\ { { + \displaystyle \sum _ { t = 3 } ^ { T } \int _ { z _ { 1 } } \int _ { s _ { 2 } } \cdots \int _ { s _ { T } } \int _ { z _ { T } } q ( z _ { 1 } ) q ( s _ { 2 } \mid z _ { 1 } ) \ldots q ( z _ { T } \mid z _ { T - 1 } , s _ { T } ) \log \frac { q ( s _ { t } \mid z _ { t - 1 } , s _ { t - 1 } ) } { p ( s _ { t } \mid z _ { t - 1 } , s _ { t - 1 } ) } } } \end{array}
301
+ $$
302
+
303
+ (Ignoring constants)
304
+
305
+ $$
306
+ \begin{array} { l } { { \displaystyle = D _ { \mathrm { K L } } ( q ( z _ { 1 } ) \mid | \ p ( z _ { 1 } ) ) + \mathbb { E } _ { z _ { 1 } \sim q ( z _ { 1 } ) } [ D _ { \mathrm { K L } } ( q ( s _ { 2 } \mid z _ { 1 } ) \mid | \ p ( s _ { 2 } \mid z _ { 1 } ) ) ] } } \\ { { \displaystyle ~ + \sum _ { t = 2 } ^ { T - 1 } \mathbb { E } _ { s _ { t } , z _ { t - 1 } } [ D _ { \mathrm { K L } } ( q ( z _ { t } \mid z _ { t - 1 } , s _ { t } ) \mid | \ p ( z _ { t } \mid z _ { t - 1 } , s _ { t } ) ) ] } } \\ { { \displaystyle ~ + \sum _ { t = 3 } ^ { T - 1 } \mathbb { E } _ { s _ { t - 1 } , z _ { t - 1 } } [ D _ { \mathrm { K L } } ( q ( s _ { t } \mid z _ { t - 1 } , s _ { t - 1 } ) \mid | \ p ( s _ { t } \mid z _ { t - 1 } , s _ { t - 1 } ) ) ] } } \end{array}
307
+ $$
308
+
309
+ Table 2: Dimensionality of environments.
310
+
311
+ <table><tr><td>Dimensionality of(</td><td>Observation Space</td><td>Control Input Space</td><td>Ground Truth State Space</td></tr><tr><td>Reacher</td><td>7</td><td>2</td><td>9</td></tr><tr><td>Hopper</td><td>8</td><td>3</td><td>15</td></tr><tr><td>Multi Agent Maze</td><td>4</td><td>6</td><td>12</td></tr><tr><td>Image Ball in BoX</td><td>32 × 32</td><td>0</td><td>4</td></tr></table>
312
+
313
+ # B DETAILS OF THE EXPERIMENTAL SETUP
314
+
315
+ # B.1 ENVIRONMENTS
316
+
317
+ # B.1.1 ROBOSCHOOL REACHER
318
+
319
+ To generate data, we follow a Uniform distribution $\mathcal { U } \sim [ - 1 , 1 ]$ as the exploration policy. Before we record data, we take 20 warm-up steps in the environment to randomize our starting state. We take the data as is without any other preprocessing.
320
+
321
+ # B.1.2 MULTI AGENT MAZE
322
+
323
+ Observations are normalized to be in $[ - 1 , 1 ]$ . Both position and velocity is randomized for the starting state. We again follow a Uniform distribution $\mathcal { U } \sim [ - 1 , 1 ]$ as the exploration policy.
324
+
325
+ # B.2 TRAINING
326
+
327
+ Overall, training the Concrete distribution has given us the biggest challenge as it was very susceptible to various hyperparameters. We made use of the fact that we can use a different temperature for the prior and approximate posterior (Maddison et al., 2017) and we do independent hyperparameter search over both. For us, the best values were 0.75 for the posterior and 2 for the prior. Additionally, we employ an exponential annealing scheme for the temperature hyperparameter of the Concrete distribution. This leads to a more uniform combination of base matrices early in training which has two desirable effects. First, all matrices are scaled to a similar magnitude, making initialization less critical. Second, the model initially tries to fit a globally linear model, leading to a good starting state for optimization. We also tried increasing the number of samples taken (up to 100) to approximate the KL between the Concrete distributions, however we have not observed an improvement of performance. We therefore restrict ourselves to 10 samples for all experiments.
328
+
329
+ In all experiments, we train everything end-to-end with the ADAM optimizer.(Kingma & Ba, 2015) We start with learning rate of $5 \mathrm { e } { - 4 }$ and use an exponential decay schedule with rate 0.97 every 2000 iterations.
330
+
331
+ # B.3 NETWORK ARCHITECTURE
332
+
333
+ For most networks, we use MLPs implemented as residual nets (He et al., 2016) with ReLU activations.
334
+
335
+ Networks used for the reacher and maze experiments.
336
+
337
+ • $q _ { \mathrm { m e a s } } ( z _ { t } \mid \cdot )$ : MLP consisting of two residual blocks with 256 neurons each. We only condition on the current observation $x _ { t }$ although we could condition on the entire sequence. This decision was taken based on empirical results.
338
+ ) $q _ { \mathrm { t r a n s } } ( z _ { t } \mid \cdot )$ : In the case of Concrete random variables, we just combine the base matrices and apply the transition dynamics to $z _ { t - 1 }$ . For the Normal case, the combination of matrices is preceded by a linear combination with softmax activation. (see equation 14) $q _ { \mathrm { m e a s } } ( s _ { t } \mid \cdot )$ : is implemented by a backward LSTM with 256 hidden units. We reuse the preprocessing of $q _ { m e a s } ( z _ { t } \mid x _ { t } )$ and take the last hidden layer of that network as the input to the LSTM.
339
+ • $q _ { \mathrm { t r a n s } } ( s _ { t } \mid \cdot )$ : MLP consisting of one residual block with 256 neurons.
340
+ • $q _ { \mathrm { i n i t i a l } } ( w \mid \cdot )$ : MLP consisting of two residual block with 256 neurons optionally followed by a backward LSTM. We only condition on the first 3 or 4 observations for our experiments.
341
+ • $q _ { \mathrm { i n i t i a l } } ( s _ { 2 } )$ : The first switching variable in the sequence has no predecessor. We therefore require a replacement for $q _ { t r a n s } ( s _ { t } \mid \cdot )$ in the first time step, which we achieve by independently parameterizing another MLP.
342
+ • $p ( x _ { t } \mid z _ { t } )$ : MLP consisting of two residual block with 256 neurons.
343
+ • $p ( \boldsymbol { z } _ { t } \mid \cdot )$ : Shared parameters with $q _ { t r a n s } ( z _ { t } \mid \cdot )$ .
344
+ • $p ( s _ { t } \mid \cdot )$ : Shared parameters with $q _ { t r a n s } ( s _ { t } \mid \cdot )$ .
345
+
346
+ We use the same architecture for the image ball in a box experiment, however we increase number of neurons of $q _ { \mathrm { m e a s } } ( z _ { t } \mid \cdot )$ to 1024.
347
+
348
+ # B.4 HYPERPARAMETERS
349
+
350
+ Table 3: Overview of hyperparameters.
351
+
352
+ <table><tr><td></td><td>Multi Agent Maze</td><td>Reacher</td><td>Image Ball in Box</td></tr><tr><td># episodes</td><td>50000</td><td>20000</td><td>5000</td></tr><tr><td>episode length</td><td>20</td><td>30</td><td>20</td></tr><tr><td>batch size</td><td>256</td><td>128</td><td>256</td></tr><tr><td>dimension of z</td><td>32</td><td>16</td><td>8</td></tr><tr><td>dimension of s</td><td>16</td><td>8</td><td>8</td></tr><tr><td>posterior temperature</td><td>0.75</td><td>0.75</td><td>0.67</td></tr><tr><td>prior temperature</td><td>2</td><td>2</td><td>2</td></tr><tr><td>temperature annealing steps</td><td>100</td><td>100</td><td>100</td></tr><tr><td>temperature annealing rate</td><td>0.97</td><td>0.97</td><td>0.98</td></tr><tr><td>β (KL-scaling of switching variables)</td><td>0.1</td><td>0.1</td><td>0.1</td></tr></table>
353
+
354
+ # C ON SCALING ISSUES OF SWITCHING LINEAR DYNAMICAL SYSTEMS
355
+
356
+ Let’s consider a simple representation of a ball in a rectangular box where its state is represented by its position and velocity. Given a small enough $\Delta t$ , we can approximate the dynamics decently by just 3 systems: no interaction with the wall, interaction with a vertical or horizontal wall (ignoring the corner case of interacting with two walls at the same time). Now consider the growth of required base systems if we increase the number of balls in the box (even if these balls cannot interact with each other). We would require a system for all combinations of a single ball’s possible states: $3 ^ { 2 }$ This will grow exponentially with the number of balls in the environment.
357
+
358
+ One way to alleviate this problem that requires only a linear growth in base systems is to independently turn individual systems on and off and let the resulting system the sum of all activated systems. A base system may then represent solely the transition for a single ball being in specific state, while the complete system is then a combination of $N$ such systems where $N$ is the number of balls. Practically, this can be achieved by replacing the softmax by a sigmoid activation function or by replacing the categorical variable $s$ of dimension $M$ by $M$ Bernoulli variables indicating whether a single system is active or not. We do this for our multiple agents in a maze environment.
359
+
360
+ Theoretically, a preferred approach would be to disentangle multiple systems (like balls, joints) and apply transitions only to their respective states. This, however, would require a proper and unsupervised separation of (mostly) independent components. We defer this to future work.
361
+
362
+ # D FURTHER RESULTS
363
+
364
+ # D.1 3-AGENT MAZE
365
+
366
+ ![](images/a6cbeb7cfa725ccd9d3588936bebbdaf170a4b93f96ae105d0b31e890791f724.jpg)
367
+ Figure 6: Comparison of actual and predicted 20 step trajectories. The diamond marker denotes the starting position of a trajectory.
368
+
369
+ # D.2 IMAGE BALL IN A BOX
370
+
371
+ ![](images/591c3c42a554e02486eb4fda365270cf8b98b397e40d966b285967c2ff546d0a.jpg)
372
+
373
+ Figure 7: First row: data, second row: reconstructions, third row: predictions. The first 4 steps are used to find a stable starting state, predictions start with step 5.
md/train/B1nLkl-0Z/B1nLkl-0Z.md ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING GAUSSIAN POLICIES FROM SMOOTHED ACTION VALUE FUNCTIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ State-action value functions (i.e., Q-values) are ubiquitous in reinforcement learning (RL), giving rise to popular algorithms such as SARSA and Q-learning. We propose a new notion of action value defined by a Gaussian smoothed version of the expected Q-value. We show that such smoothed Q-values still satisfy a Bellman equation, making them learnable from experience sampled from an environment. Moreover, the gradients of expected reward with respect to the mean and covariance of a parameterized Gaussian policy can be recovered from the gradient and Hessian of the smoothed Q-value function. Based on these relationships we develop new algorithms for training a Gaussian policy directly from a learned smoothed Q-value approximator. Our approach is amenable to proximal optimization techniques by augmenting the objective with a penalty on KLdivergence from a previous policy. We find that the ability to learn both a mean and covariance during training allows this approach to achieve much better results on standard continuous control benchmarks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Model-free reinforcement learning algorithms often alternate between two concurrent but interacting processes: (1) policy evaluation, where an action value function (i.e., a Q-value) is updated to obtain a better estimate of the return associated with taking a specific action, and (2) policy improvement, where the policy is updated aiming to maximize the current value function. In the past, different notions of Q-value have led to distinct but important families of RL methods. For example, SARSA (Rummery & Niranjan, 1994; Sutton & Barto, 1998; Van Seijen et al., 2009) uses the expected Q-value, defined as the expected return of following the current policy. Q-learning (Watkins, 1989) exploits a hard-max notion of Q-value, defined as the expected return of following an optimal policy. Soft Q-learning (Haarnoja et al., 2017) and PCL (Nachum et al., 2017a) both use a soft-max form of Q-value, defined as the future return of following an optimal entropy regularized policy. Clearly, the choice of Q-value function has a considerable effect on the resulting algorithm; for example, restricting the types of policies that can be expressed, and determining the type of exploration that can be naturally applied.
12
+
13
+ In this work we introduce a new notion of action value: the smoothed action value function ${ \tilde { Q } } ^ { \pi }$ . Unlike previous notions, which associate a value with a specific action at each state, the smoothed Qvalue associates a value with a specific distribution over actions. In particular, the smoothed Q-value of a state-action pair $( s , a )$ is defined as the expected return of first taking an action sampled from a normal distribution $N ( \dot { a } , \Sigma ( s ) )$ , centered at $a$ , then following actions sampled from the current policy thereafter. In this way, the smoothed Q-value can also be interpreted as a Gaussian-smoothed or noisy version of the expected Q-value.
14
+
15
+ We show that smoothed Q-values possess a number of interesting properties that make them attractive for use in RL algorithms. For one, the smoothed Q-values satisfy a single-step Bellman consistency, which allows bootstrapping to be used to train a function approximator. Secondly, for Gaussian policies, the standard optimization objective (expected return) can be expressed in terms of smoothed Q-values. Moreover, the gradient of this objective with respect to the mean and covariance of the Gaussian policy is equivalent to the gradient and the Hessian of the smoothed Q-value function, which allows one to derive updates to the policy parameters by having access to the derivatives of a sufficiently accurate smoothed Q-value function.
16
+
17
+ This observation leads us to propose an algorithm called Smoothie, which in the spirit of (Deep) Deterministic Policy Gradient (DDPG) (Silver et al., 2014; Lillicrap et al., 2016), trains a policy using the derivatives of a trained (smoothed) Q-value function, thus avoiding the high-variance of stochastic updates used in standard policy gradient algorithms (Williams & Peng, 1991; Konda & Tsitsiklis, 2000). Unlike DDPG, which is well-known to have poor exploratory behavior (Haarnoja et al., 2017), the approach we develop is able to utilize a non-deterministic Gaussian policy parameterized by both a mean and a covariance, thus allowing the policy to be exploratory by default and alleviating the need for excessive hyperparameter tuning.
18
+
19
+ Furthermore, we show that Smoothie can be easily adapted to incorporate proximal policy optimization techniques by augmenting the objective with a penalty on KL-divergence from a previous version of the policy. The inclusion of a KL-penalty is not feasible in the standard DDPG algorithm, but we show that it is possible with our formulation, and it significantly improves stability and overall performance. On standard continuous control benchmarks, our results are competitive with or exceed state-of-the-art, especially for more difficult tasks in the low-data regime.
20
+
21
+ # 2 NOTATION & BACKGROUND
22
+
23
+ We consider the standard model-free RL framework, where an agent interacts with a stochastic black-box environment by sequentially observing the state of the environment, emitting an action, and receiving a reward feedback; the goal is to find an agent that achieves maximal cumulative discounted reward. This problem can be expressed in terms of a Markov decision process (MDP) that consists of a state space $s$ and an action space $\mathcal { A }$ , where at iteration $t$ the agent encounters a state $s _ { t } ~ \in ~ S$ and emits an action $a _ { t } \in \mathcal A$ , after which the environment returns a scalar reward $\boldsymbol { r } _ { t } \sim R ( s _ { t } , \boldsymbol { a } _ { t } )$ and places the agent in a new state $s _ { t + 1 } \sim P ( s _ { t } , a _ { t } )$ .
24
+
25
+ We model the behavior of the agent using a stochastic policy $\pi$ that produces a distribution over feasible actions at each state $s$ as $\pi ( a \mid s )$ . The optimization objective (expected discounted return), as a function of the policy, can then be expressed in terms of the expected action value function $Q ^ { \pi } ( s , a )$ by,
26
+
27
+ $$
28
+ O _ { \tt E R } ( \pi ) = \int _ { \cal S } \int _ { \cal A } \pi ( a \mid s ) Q ^ { \pi } ( s , a ) \mathrm { d } a \mathrm { d } \rho ^ { \pi } ( s ) ,
29
+ $$
30
+
31
+ where $\rho ^ { \pi } ( s )$ is the stationary distribution of the states under $\pi$ , and $Q ^ { \pi } ( s , a )$ is recursively defined using the Bellman equation,
32
+
33
+ $$
34
+ Q ^ { \pi } ( s , a ) = \mathbb { E } _ { r , s ^ { \prime } } \left[ r + \gamma \int _ { \mathcal { A } } Q ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) \pi ( a ^ { \prime } \mid s ^ { \prime } ) \mathrm { d } a \right] \mathrm { , }
35
+ $$
36
+
37
+ where $\gamma \in [ 0 , 1 ]$ is the discount factor. For brevity, we will often suppress explicit denotation of the sampling distribution $R$ over immediate rewards and the distribution $P$ over state transitions.
38
+
39
+ The policy gradient theorem (Sutton et al., 2000) expresses the gradient of $O _ { \mathrm { E R } } ( \pi _ { \theta } )$ w.r.t. $\theta$ , the tunable parameters of a policy $\pi _ { \theta }$ , as,
40
+
41
+ $$
42
+ \begin{array} { r c l } { { \nabla _ { \theta } { \cal O } _ { \mathrm { E R } } ( \pi _ { \theta } ) } } & { { = } } & { { \displaystyle \int _ { S } \int _ { { \cal A } } \nabla _ { \theta } \pi _ { \theta } ( a \mid s ) Q ^ { \pi } ( s , a ) \mathrm { d } a \mathrm { d } \rho ^ { \pi } ( s ) } } \\ { { } } & { { = } } & { { \displaystyle \int _ { S } \mathbb { E } _ { a \sim \pi _ { \theta } ( a \mid s ) } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a \mid s ) Q ^ { \pi } ( s , a ) \right] \mathrm { d } \rho ^ { \pi } ( s ) . } } \end{array}
43
+ $$
44
+
45
+ Many reinforcement learning algorithms, including policy gradient and actor-critic variants, trade off variance and bias when estimating the random variable inside the expectation in (4); for example, by attempting to estimate $Q ^ { \pi } ( s , a )$ accurately using function approximation. In the simplest scenario, an unbiased estimate of $Q ^ { \pi } ( s , a )$ is formed by accumulating discounted rewards from each state forward using a single Monte Carlo sample.
46
+
47
+ In this paper, we focus on multivariate Gaussian policies over continuous action spaces, $\mathcal { A } \equiv \mathbb { R } ^ { d _ { a } }$ . We represent the observed state of the MDP as a $d _ { s }$ -dimensional feature vector $\bar { \Phi } ( s ) \in \mathbb { R } ^ { d _ { s } }$ , and parametrize the Gaussian policy by a mean and covariance function, respectively $\mu ( \boldsymbol { s } ) : \mathbb { R } ^ { d _ { \boldsymbol { s } } } \mathbb { R } ^ { d _ { a } }$ and $\Sigma ( s ) : \mathbb { R } ^ { d _ { s } } \mathbb { R } ^ { d _ { a } } \times \mathbb { R } ^ { \tilde { d } _ { a } }$ . These map the observed state of the environment to a Gaussian distribution,
48
+
49
+ $$
50
+ \pi ( a | s ) = N ( a | \mu ( s ) , \Sigma ( s ) ) = | 2 \pi \Sigma ( s ) | ^ { - 1 / 2 } \exp \left\{ - \frac { 1 } { 2 } \| a - \mu ( s ) \| _ { \Sigma ( s ) ^ { - 1 } } ^ { 2 } \right\} ,
51
+ $$
52
+
53
+ where $\| v \| _ { A } ^ { 2 } = v ^ { \mathsf { T } } A v$ . Below we develop new RL training methods for this family of parametric policies, but some of the ideas presented may generalize to other families of policies as well. We begin the formulation by reviewing some prior work on learning Gaussian policies.
54
+
55
+ # 2.1 DETERMINISTIC POLICY GRADIENT
56
+
57
+ Silver et al. (2014) present a new formulation of the policy gradient, called the deterministic policy gradient, for the family of Gaussian policies in the limit where the policy covariance approaches zero. In such a scenario, the policy becomes deterministic because sampling from the policy always returns the Gaussian mean. The key observation of (Silver et al., 2014) is that under a deterministic policy $\pi \equiv ( \mu , \Sigma \to 0 )$ , one can estimate the expected future return from a state $s$ as,
58
+
59
+ $$
60
+ \operatorname * { l i m } _ { \Sigma \to 0 } \int _ { A } \pi ( a \mid s ) Q ^ { \pi } ( s , a ) \mathrm { d } a = Q ^ { \pi } ( s , \mu ( s ) ) .
61
+ $$
62
+
63
+ Then, one can express the gradient of the optimization objective (expected discounted return) for a parameterized $\pi _ { \boldsymbol { \theta } } \equiv \mu _ { \boldsymbol { \theta } }$ as,
64
+
65
+ $$
66
+ \nabla _ { \theta } { \cal O } _ { \mathrm { E R } } ( \pi _ { \theta } ) = \int _ { S } \nabla _ { \theta } Q ^ { \pi } ( s , \mu _ { \theta } ( s ) ) \mathrm { d } \rho ^ { \pi } ( s ) = \int _ { S } \frac { \partial Q ^ { \pi } ( s , a ) } { \partial a } | _ { a = \mu _ { \theta } ( s ) } \nabla _ { \theta } \mu _ { \theta } ( s ) \mathrm { d } \rho ^ { \pi } ( s ) .
67
+ $$
68
+
69
+ This can be thought of as a characterization of the policy gradient theorem for deterministic policies.
70
+
71
+ In the limit of $\Sigma 0$ , one can also re-express the Bellman equation (2) as,
72
+
73
+ $$
74
+ Q ^ { \pi } ( s , a ) = \mathbb { E } _ { r , s ^ { \prime } } \left[ r + Q ^ { \pi } ( s ^ { \prime } , \mu ( s ^ { \prime } ) ) \right] .
75
+ $$
76
+
77
+ Therefore, a value function approximator $Q _ { w } ^ { \pi }$ can be optimized by minimizing the Bellman error,
78
+
79
+ $$
80
+ E ( w ) = \sum _ { ( s , a , r , s ^ { \prime } ) \in \mathcal { D } } ( Q _ { w } ^ { \pi } ( s , a ) - r - \gamma Q _ { w } ^ { \pi } ( s ^ { \prime } , \mu ( s ^ { \prime } ) ) ^ { 2 } ,
81
+ $$
82
+
83
+ for transitions $( s , a , r , s ^ { \prime } )$ sampled from a dataset $\mathcal { D }$ of interactions of the agent with the environment. Algorithms like DDPG (Lillicrap et al., 2016) alternate between improving the value function by gradient descent on (9), and improving the policy based on (7).
84
+
85
+ In practice, to gain better sample efficiency, Degris et al. (2012) and Silver et al. (2014) replace the on-policy state distribution $\rho ^ { \pi } ( s )$ in (7) with an off-policy distribution $\rho ^ { \beta } ( s )$ based on a replay buffer. After this substitution, the policy gradient identity in (7) does not hold exactly, however, prior work finds that this works well in practice and improves sample efficiency. We also adopt a similar approximation in our method to make use of off-policy data.
86
+
87
+ # 3 SMOOTHED ACTION VALUE FUNCTIONS
88
+
89
+ In this paper, we introduce smoothed action value functions, the gradients of which provide an effective signal for optimizing the parameters of a Gaussian policy. Our notion of smoothed Qvalues, denoted $\tilde { Q } ^ { \pi } ( s , a )$ , differs from ordinary Q-values $Q ^ { \pi } ( s , a )$ in that smoothed Q-values do not assume the first action of the agent is fully specified, but rather they assume that only the mean of the distribution of the first action is known. Hence, to compute $\tilde { Q } ^ { \pi } ( s , a )$ , one has to perform an expectation of $Q ^ { \pi } ( s , { \tilde { a } } )$ for actions $\tilde { a }$ drawn in the vicinity of $a$ . More formally, smoothed action values are defined as,
90
+
91
+ $$
92
+ \tilde { Q } ^ { \pi } ( s , a ) = \int _ { A } N ( \tilde { a } | a , \Sigma ( s ) ) Q ^ { \pi } ( s , \tilde { a } ) \mathrm { d } \tilde { a } .
93
+ $$
94
+
95
+ With this definition of ${ \tilde { Q } } ^ { \pi }$ , one can re-express the expected reward objective for a Gaussian policy $\pi \equiv ( \mu , \Sigma )$ as,
96
+
97
+ $$
98
+ O _ { \mathrm { E R } } ( \pi ) = \int _ { S } \tilde { Q } ^ { \pi } ( s , \mu ( s ) ) \mathrm { d } \rho ^ { \pi } ( s ) .
99
+ $$
100
+
101
+ The insight that differentiates this approach from prior work including Heess et al. (2015); Ciosek & Whiteson (2017) is that instead of learning a function approximator for $Q ^ { \pi } ( s , a )$ and then drawing samples to approximate the expectation in (10) and its derivative, we directly learn a function approximator for $\bar { Q } ^ { \pi } ( s , a )$ .
102
+
103
+ The key observation that enables direct bootstrapping of smoothed $\mathrm { Q }$ -values, $\tilde { Q } ^ { \pi } ( s , a )$ , is that their form allows a notion of Bellman consistency. First, note that for Gaussian policies $\pi \equiv ( \mu , \Sigma )$ we have
104
+
105
+ $$
106
+ Q ^ { \pi } ( s , a ) = \mathbb { E } _ { r , s ^ { \prime } } [ r + \gamma \tilde { Q } ^ { \pi } ( s ^ { \prime } , \mu ( s ^ { \prime } ) ) ] .
107
+ $$
108
+
109
+ Then, combining (10) and (12), one can derive the following one-step Bellman equation for smoothed Q-values,
110
+
111
+ $$
112
+ \tilde { Q } ^ { \pi } ( s , a ) = \int _ { \cal A } N ( \tilde { a } \mid a , \Sigma ( s ) ) \mathbb { E } _ { \tilde { r } , \tilde { s } ^ { \prime } } \left[ \tilde { r } + \gamma \tilde { Q } ^ { \pi } ( \tilde { s } ^ { \prime } , \mu ( \tilde { s } ^ { \prime } ) ) \right] \mathrm { d } \tilde { a } ,
113
+ $$
114
+
115
+ where $\tilde { r }$ and ${ \tilde { s } } ^ { \prime }$ are sampled from $R ( s , { \tilde { a } } )$ and $P ( s , { \tilde { a } } )$ . Below, we elaborate on how one can make use of the derivatives of ${ \tilde { Q } } ^ { \pi }$ to learn $\mu$ and $\Sigma$ , and how the Bellman equation in (13) enables direct optimization of ${ \tilde { Q } } ^ { \pi }$ .
116
+
117
+ # 3.1 POLICY IMPROVEMENT - OPTIMIZING $\left( \mu _ { \theta } , \Sigma _ { \phi } \right)$ GIVEN ${ \tilde { Q } } ^ { \pi }$
118
+
119
+ We parameterize a Gaussian policy $\pi _ { \boldsymbol { \theta } , \boldsymbol { \phi } } \equiv ( \mu _ { \boldsymbol { \theta } } , \Sigma _ { \boldsymbol { \phi } } )$ in terms of two sets of parameters $\theta$ and $\phi$ for the mean and the covariance. The gradient of the objective $w . r . t .$ . mean parameters follows from the policy gradient theorem and is almost identical to (7),
120
+
121
+ $$
122
+ \nabla _ { \theta } { \cal O } _ { \mathrm { E R } } ( \pi _ { \theta , \phi } ) = \int _ { S } \frac { \partial \tilde { Q } ^ { \pi } ( s , a ) } { \partial a } \big | _ { a = \mu _ { \theta } ( s ) } \nabla _ { \theta } \mu _ { \theta } ( s ) \mathrm { d } \rho ^ { \pi } ( s ) .
123
+ $$
124
+
125
+ Estimating the derivative of the objective w.r.t. covariance parameters is not as straightforward, since ${ \tilde { Q } } ^ { \pi }$ is not a direct function of $\Sigma$ . However, a key observation of this work is that the second derivative of ${ \tilde { Q } } ^ { \pi } w . r . t .$ . actions is sufficient to exactly compute the derivative of $\tilde { Q } ^ { \pi } w . r . t . \Sigma$ ,
126
+
127
+ $$
128
+ \frac { \partial \tilde { Q } ^ { \pi } ( s , a ) } { \partial \Sigma ( s ) } = \frac { 1 } { 2 } \cdot \frac { \partial ^ { 2 } \tilde { Q } ^ { \pi } ( s , a ) } { \partial a ^ { 2 } } .
129
+ $$
130
+
131
+ A proof of this identity is provided in the Appendix. The proof may be easily derived by expressing both sides of the equation using standard matrix calculus like $\begin{array} { r } { \frac { \partial } { \partial A } | A | ^ { - 1 / 2 } = - \frac { 1 } { 2 } | A | ^ { - 1 / 2 } \bar { A } ^ { - 1 } } \end{array}$ and $\begin{array} { r } { \frac { \partial } { \partial A } | | v | | _ { A ^ { - 1 } } ^ { 2 } = - A ^ { - 1 } v v ^ { T } A ^ { - 1 } } \end{array}$ .
132
+
133
+ Then, the full derivative w.r.t. $\phi$ takes the form,
134
+
135
+ $$
136
+ \nabla _ { \phi } { \cal O } _ { \mathrm { E R } } ( \pi _ { \theta , \phi } ) = \frac { 1 } { 2 } \int _ { S } \frac { \partial ^ { 2 } { \tilde { Q } } ^ { \pi } ( s , a ) } { \partial a ^ { 2 } } \big | _ { a = \mu _ { \theta } ( s ) } \nabla _ { \phi } \Sigma _ { \phi } ( s ) \mathrm { d } \rho ^ { \pi } ( s ) .
137
+ $$
138
+
139
+ # 3.2 POLICY EVALUATION - OPTIMIZING $\tilde { Q } _ { w } ^ { \pi }$ GIVEN $( \mu , \Sigma )$
140
+
141
+ We can think of two ways to optimize $\tilde { Q } _ { w } ^ { \pi }$ . The first approach leverages (10) to update ${ \tilde { Q } } ^ { \pi }$ based on expected Q-value function $Q ^ { \pi }$ . In such an approach, one trains a parameterized $Q _ { w } ^ { \pi }$ to approximate the standard expected Q-value function $Q ^ { \pi }$ using standard methods (see e.g., Rummery $\&$ Niranjan (1994); Sutton & Barto (1998); Van Seijen et al. (2009)). Then, one fits $\tilde { Q } _ { w } ^ { \pi }$ based on $Q _ { w } ^ { \pi }$ . In particular, given transitions $( s , a , r , s ^ { \prime } )$ sampled from interactions with the environment, one can train $Q _ { w } ^ { \pi }$ to minimize the Bellman error $( Q _ { w } ^ { \pi } ( s , a ) - r - \gamma Q _ { w } ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ) ^ { 2 }$ where $a ^ { \prime } \sim N ( \mu ( s ^ { \prime } ) , \Sigma ( s ^ { \prime } ) )$ . Then, $\tilde { Q } _ { w } ^ { \pi }$ can be optimized to minimize the squared error $( \tilde { Q } _ { w } ^ { \pi } ( s , a ) - \mathbb { E } _ { \tilde { a } } Q _ { w } ^ { \pi } ( s , \tilde { a } ) ) ^ { 2 }$ where $\tilde { a } \sim$ $N ( a , \Sigma ( s ) )$ , using several samples. When the target values in these residuals are treated as fixed (i.e., using a target network), such a training procedure will achieve a fixed point when $\tilde { Q } _ { w } ^ { \pi } ( s , a )$ satisfies the recursion in the Bellman equation (10).
142
+
143
+ The second approach requires a single function approximator for $\tilde { Q } _ { w } ^ { \pi } ( s , a )$ , resulting in a simpler implementation, and thus we use this approach in our experimental evaluation. Suppose one has access to a tuple $( s , \tilde { a } , \tilde { r } , \tilde { s } ^ { \prime } )$ sampled from a replay buffer with knowledge of the sampling probability $q ( \tilde { a } \mid s )$ (possibly unnormalized). Then assuming that this sampling distribution has a full support, we draw a phantom action $a \sim N ( \tilde { a } , \Sigma ( s ) )$ and optimize $\tilde { Q } _ { w } ^ { \pi } ( s , a )$ by minimizing a weighted Bellman error $\begin{array} { r } { \frac { 1 } { q ( \tilde { a } | s ) } ( \tilde { Q } _ { w } ^ { \pi } ( s , a ) - \tilde { r } - \gamma \tilde { Q } _ { w } ^ { \pi } ( \tilde { s } ^ { \prime } , \mu ( \tilde { s } ^ { \prime } ) ) ^ { 2 } } \end{array}$ . For a specific pair of state and action $( s , a )$ the
144
+
145
+ expected value of the objective is,
146
+
147
+ $$
148
+ E ( w \mid ( s , a ) ) ~ = ~ \mathbb { E } _ { q ( \bar { a } \mid s ) , \bar { r } , \bar { s } ^ { \prime } } \left[ \frac { N ( a \mid \tilde { a } , \Sigma ( s ) ) } { q ( \tilde { a } \mid s ) } ( \tilde { Q } _ { w } ^ { \pi } ( s , a ) - \tilde { r } - \gamma \tilde { Q } _ { w } ^ { \pi } ( \tilde { s } ^ { \prime } , \mu ( \tilde { s } ^ { \prime } ) ) ) ^ { 2 } \right] ~ .
149
+ $$
150
+
151
+ Note that $N ( a | \tilde { a } , \Sigma ( s ) ) = N ( \tilde { a } | a , \Sigma ( s ) )$ . Therefore, when the target value $\tilde { r } + \gamma \tilde { Q } _ { w } ^ { \pi } ( \tilde { s } ^ { \prime } , \mu ( \tilde { s } ^ { \prime } ) )$ is treated as fixed (e.g., when using target networks) this training procedure reaches an optimum when $\tilde { Q } _ { w } ^ { \pi } ( s , a )$ satisfies the recursion in the Bellman equation (13).
152
+
153
+ In practice, we find that it is unnecessary to keep track of the probabilities $q ( \tilde { a } \mid s )$ , and assume the replay buffer provides a near-uniform distribution of actions conditioned on states. Other recent work has also benefited from ignoring or heavily damping importance weights (Munos et al., 2016; Wang et al., 2017; Schulman et al., 2017). However, it is possible when interacting with the environment to save the probability of sampled actions along with their transitions, and thus have access to $q ( \tilde { \boldsymbol { a } } \mid \boldsymbol { s } ) \approx N ( \tilde { \boldsymbol { a } } \mid \bar { \mu } _ { \mathrm { o l d } } ( \boldsymbol { s } ) , \dot { \Sigma _ { \mathrm { o l d } } } ( \boldsymbol { s } ) )$ .
154
+
155
+ # 3.3 PROXIMAL POLICY OPTIMIZATION
156
+
157
+ Policy gradient algorithms are notoriously unstable, particularly in continuous control problems. Such instability has motivated the development of trust region methods that attempt to mitigate the issue by constraining each gradient step to lie within a trust region (Schulman et al., 2015), or augmenting the expected reward objective with a penalty on KL-divergence from a previous policy (Nachum et al., 2017b; Schulman et al., 2017; Azar et al., 2012). These stabilizing techniques have thus far not been applicable to algorithms like DDPG, since the policy is deterministic. The formulation we propose in this paper, however, is easily amenable to trust region optimization. Specifically, we may augment the objective (11) with a penalty
158
+
159
+ $$
160
+ { \cal O } _ { \mathrm { T R } } ( \pi ) = { \cal O } _ { \mathrm { E R } } ( \pi ) - \lambda \int _ { \cal S } \mathrm { K L } ( \pi \parallel \pi _ { \mathrm { o l d } } ) \mathrm { d } \rho ^ { \pi } ( s ) ,
161
+ $$
162
+
163
+ where $\pi _ { \mathrm { o l d } } \equiv \left( \mu _ { \mathrm { o l d } } , \Sigma _ { \mathrm { o l d } } \right)$ is a previous parameterization of the policy. The optimization is straightforward, since the KL-divergence of two Gaussians can be expressed analytically.
164
+
165
+ # 4 RELATED WORK
166
+
167
+ This paper follows a long line of work that uses Q-value functions to stably learn a policy, which in the past has been used to either approximate expected (Rummery & Niranjan, 1994; Van Seijen et al., 2009; Gu et al., 2017) or optimal (Watkins, 1989; Silver et al., 2014; Nachum et al., 2017a; Haarnoja et al., 2017; Metz et al., 2017) future value.
168
+
169
+ Work that is most similar to what we present are methods that exploit gradient information from the Q-value function to train a policy. Deterministic policy gradient (Silver et al., 2014) is perhaps the best known of these. The method we propose can be interpreted as a generalization of the deterministic policy gradient. Indeed, if one takes the limit of the policy covariance $\Sigma ( s )$ as it goes to 0, the proposed Q-value function becomes the deterministic value function of DDPG, and the updates for training the Q-value approximator and the policy mean are identical.
170
+
171
+ Stochastic Value Gradient (SVG) (Heess et al., 2015) also trains stochastic policies using an update that is similar to DDPG (i.e., SVG(0) with replay). The key differences with our approach are that SVG does not provide an update for the covariance, and the mean update in SVG estimates the gradient with a noisy Monte Carlo sample, which we avoid by estimating the smoothed $\mathrm { Q }$ -value function. Although a covariance update could be derived using the same reparameterization trick as in the mean update, that would also require a noisy Monte Carlo estimate. Methods for updating the covariance along the gradient of expected reward are essential for applying the subsequent trust region and proximal policy techniques.
172
+
173
+ More recently, Ciosek & Whiteson (2017) introduced expected policy gradients (EPG), a generalization of DDPG that provides updates for the mean and covariance of a stochastic Gaussian policy using gradients of an estimated Q-value function. In that work, the expected Q-value used in standard policy gradient algorithms such as SARSA (Sutton & Barto, 1998; Rummery & Niranjan, 1994; Van Seijen et al., 2009) is estimated. The updates in EPG therefore require approximating an integral of the expected Q-value function. Our analogous process directly estimates an integral (via the smoothed Q-value function) and avoids approximate integrals, thereby making the updates simpler. Moreover, while Ciosek & Whiteson (2017) rely on a quadratic Taylor expansion of the estimated Q-value function, we instead rely on the strength of neural network function approximators to directly estimate the smoothed Q-value function.
174
+
175
+ The novel training scheme we propose for learning the covariance of a Gaussian policy relies on properties of Gaussian integrals (Bonnet, 1964; Price, 1958). Similar identities have been used in the past to derive updates for variational auto-encoders (Kingma & Welling, 2014) and Gaussian back-propagation (Rezende et al., 2014).
176
+
177
+ Finally, the perspective presented in this paper, where Q-values represent the averaged return of a distribution of actions rather than a single action, is distinct from recent advances in distributional RL (Bellemare et al., 2017). Those approaches focus on the distribution of returns of a single action, whereas we consider the single average return of a distribution of actions. Although we restrict our attention in this paper to Gaussian policies, an interesting topic for further investigation is to study the applicability of this new perspective to a wider class of policy distributions.
178
+
179
+ # 5 EXPERIMENTS
180
+
181
+ We utilize the insights from Section 3 to introduce a new RL algorithm, Smoothie. Smoothie maintains a parameterized $\tilde { Q } _ { w } ^ { \pi }$ trained via the procedure described in Section 3.2. It then uses the gradient and Hessian of this approximation to train a Gaussian policy $\mu _ { \theta } , \Sigma _ { \phi }$ using the updates stated in (14) and (16). See Algorithm 1 for a simplified pseudocode of our algorithm.
182
+
183
+ # Algorithm 1 Smoothie
184
+
185
+ <table><tr><td>Algorithm1Smoothie Input: Environment ENV,learning rates 7π, nQ,discount factor y,KL-penalty 入,l</td></tr><tr><td>number of training steps N, target network lag T. Initialize0,,w,set0&#x27;=0,Φ&#x27;=,w&#x27;=w.</td></tr><tr><td>fori=OtoN-1do</td></tr><tr><td>/ Collect experience</td></tr><tr><td>Sample action a ~ N(μe(s),∑(s)) and apply to ENV to yield r and s&#x27;. Insert transition (s,a,r,s&#x27;) to replay buffer.</td></tr><tr><td></td></tr><tr><td>// Train μ,∑</td></tr><tr><td>Sample batch{(k,@k,Tk,S)}1 fromreplay buffer aQ(ska) Compute gradients gk =</td></tr><tr><td>da la=μe(sk)*</td></tr><tr><td>²(s@) Compute Hessians Hk = a² la=μe(sk)*</td></tr><tr><td>Compute KL-penalties KLk =KL(μθ,Σ𝜙llμe,Σ).</td></tr><tr><td>Compute updates 1B</td></tr><tr><td>1B</td></tr><tr><td>△=B 1 ∑k=1 Updateθ←θ+ηπ△0,←+ηπ△.</td></tr><tr><td></td></tr><tr><td>// Train Qπ</td></tr><tr><td>Sample batch {(sk,k,Tk,S)}1 from replay bufer. Sample phantom actions ak ~ N(ák,Σ(sk)). Compute lossL(u)=∑1((s)-r-qQ(s,ue()2.</td></tr></table>
186
+
187
+ We perform a number of evaluations of Smoothie compared to DDPG. We choose DDPG as a baseline because it (1) utilizes gradient information of a Q-value approximator, much like our algorithm; and (2) is a standard algorithm well-known to have achieve good, sample-efficient performance on continuous control benchmarks.
188
+
189
+ # 5.1 A SYNTHETIC TASK
190
+
191
+ To evaluate Smoothie we begin with a simple synthetic task which allows us to study its behavior in a restricted setting. We devised a simple single-action one-shot environment in which the reward function is a mixture of two Gaussians, one better than the other (see Figure 1 (Right)). We initialize the policy mean to be centered on the worse of the two Gaussians. We plot the learnable policy mean and standard deviation during training for Smoothie and DDPG in Figure 1 (Left). Smoothie learns both the mean and variance, while DDPG learns only the mean and the variance plotted is the exploratory noise, whose scale is kept fixed during training.
192
+
193
+ As expected we observe that DDPG cannot escape the local optimum. At the beginning of training it exhibits some movement away from the local optimum (likely due to the initial noisy approximation given by $Q _ { w } ^ { \pi } \mathrm { . }$ ), it is unable to progress very far from the initial mean. Note that this is not an issue of exploration. The exploration scale is high enough that $Q _ { w } ^ { \pi }$ is aware of the better Gaussian. The issue is in the update for $\mu _ { \theta }$ , which is only with regard to the derivative of $Q _ { w } ^ { \pi }$ at the current mean.
194
+
195
+ On the other hand, we find Smoothie is successfully able to solve the task. This is because the smoothed reward function approximated by $\tilde { Q } _ { w } ^ { \pi }$ has a derivative which clearly points $\mu _ { \theta }$ towards the better Gaussian. We also observe that Smoothie is able to suitably adjust the covariance $\Sigma _ { \phi }$ during training. Initially, $\Sigma _ { \phi }$ decreases due to the concavity of the smoothed reward function. As a region of convexity is entered, it begins to increase, before again decreasing to near-zero as $\mu _ { \theta }$ approaches the global optimum.
196
+
197
+ ![](images/3e62a205722715b4eae018cb617c9164cd435c130be75b6bf1c3addc835c777e.jpg)
198
+ Figure 1: Left: The learnable policy mean and standard deviation during training for Smoothie and DDPG on a simple one-shot synthetic task. The standard deviation for DDPG is the exploratory noise kept constant during training. Right: The reward function for the synthetic task along with its Gaussian-smoothed version. We find that Smoothie can successfully escape the lower-reward local optimum. We also notice Smoothie increases and decreases its policy variance as the convexity/concavity of the smoothed reward function changes.
199
+
200
+ # 5.2 CONTINUOUS CONTROL
201
+
202
+ We now turn our attention to standard continuous control benchmarks available on OpenAI Gym (Brockman et al., 2016) utilizing the MuJoCo environment (Todorov et al., 2012).
203
+
204
+ Our implementations utilize feed forward neural networks for policy and Q-values. We parameterize the covariance $\Sigma _ { \phi }$ as a diagonal given by $e ^ { \phi }$ . The exploration for DDPG is determined by an Ornstein-Uhlenbeck process (Uhlenbeck & Ornstein, 1930; Lillicrap et al., 2016). Additional implementation details are provided in the Appendix.
205
+
206
+ ![](images/f21887a3716c42d41ffbbba35b3c52cf13877d7b56bb86c24b7339f4a95daf67.jpg)
207
+ Figure 2: Results of Smoothie, DDPG, and TRPO on continuous control benchmarks. The $\mathbf { X }$ -axis is in millions of environment steps. Each plot shows the average reward and standard deviation clipped at the min and max of six randomly seeded runs after choosing best hyperparameters. We see that Smoothie is competitive with DDPG even when DDPG uses a hyperparameter-tuned noise scale, and Smoothie learns the optimal noise scale (the covariance) during training. Moreoever, we observe significant advantages in terms of final reward performance, especially in the more difficult tasks like Hopper, Walker2d, and Humanoid. Across all tasks, TRPO is not sufficiently sampleefficient to provide a competitive baseline.
208
+
209
+ We compare the results of Smoothie and DDPG in Figure 2. For each task we performed a hyperparameter search over actor learning rate, critic learning rate and reward scale, and plot the average of six runs for the best hyperparameters. For DDPG we extended the hyperparameter search to also consider the scale and damping of exploratory noise provided by the Ornstein-Uhlenbeck process. Smoothie, on the other hand, contains an additional hyperparameter to determine the weight on KL-penalty.
210
+
211
+ Despite DDPG having the advantage of its exploration decided by a hyperparameter search while Smoothie must learn its exploration without supervision, we find that Smoothie performs competitively or better across all tasks, exhibiting a slight advantage in Swimmer and Ant, while showing more dramatic improvements in Hopper, Walker2d, and Humanoid. The improvement is especially dramatic for Hopper, where the average reward is doubled. We also highlight the results for Humanoid, which as far as we know, are the best published results for a method that only trains on the order of millions of environment steps. In contrast, TRPO, which to the best of our knowledge is the only other algorithm which can achieve better performance, requires on the order of tens of millions of environment steps to achieve comparable reward. This gives added evidence to the benefits of using a learnable covariance and not restricting a policy to be deterministic.
212
+
213
+ Empirically, we found the introduction of a KL-penalty to improve performance of Smoothie, especially on harder tasks. We present a comparison of results of Smoothie with and without the KL-penalty on the four harder tasks in Figure 3. A KL-penalty to encourage stability is not possible in DDPG. Thus, our algorithm provides a much needed solution to the inherent instability in DDPG training.
214
+
215
+ ![](images/31e9c2cf700c5e3ed94cc8e3ab513890a7ad5439462138652b2f32dd4b21ec5f.jpg)
216
+ Figure 3: Results of Smoothie with and without a KL-penalty. The $\mathbf { X } ^ { } -$ -axis is in millions of environment steps. We observe benefits of using a proximal policy optimization method, especially in Hopper and Humanoid, where the performance improvement is significant without sacrificing sample efficiency.
217
+
218
+ # 6 CONCLUSION
219
+
220
+ We have presented a new Q-value function, ${ \tilde { Q } } ^ { \pi }$ , that is a Gaussian-smoothed version of the standard expected Q-value, $Q ^ { \pi }$ . The advantage of using ${ \tilde { Q } } ^ { \pi }$ over $Q ^ { \pi }$ is that its gradient and Hessian possess an intimate relationship with the gradient of expected reward with respect to mean and covariance of a Gaussian policy. The resulting algorithm, Smoothie, is able to successfully learn both mean and covariance during training, leading to performance that can match or surpass that of DDPG, especially when incorporating a penalty on divergence from a previous policy.
221
+
222
+ The success of ${ \tilde { Q } } ^ { \pi }$ is encouraging. Intuitively it may be argued that learning ${ \tilde { Q } } ^ { \pi }$ is more sensible than learning $Q ^ { \pi }$ . The smoothed Q-values by definition make the true reward surface smoother, thus possibly easier to learn; moreover the smoothed Q-values have a more direct relationship with the expected discounted return objective. We encourage future work to further investigate these claims as well as techniques to apply the underlying motivations for ${ \tilde { Q } } ^ { \pi }$ to other types of policies.
223
+
224
+ # REFERENCES
225
+
226
+ Mohammad Gheshlaghi Azar, Vicenc¸ Gomez, and Hilbert J Kappen. Dynamic policy programming. ´ JMLR, 13, 2012.
227
+
228
+ Marc G Bellemare, Will Dabney, and Remi Munos. A distributional perspective on reinforcement ´ learning. In ICML, pp. 449–458, 2017.
229
+
230
+ Georges Bonnet. Transformations des signaux aleatoires a travers les systemes non lin ´ eaires sans ´ memoire. ´ Annals of Telecommunications, 19(9):203–220, 1964.
231
+
232
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI Gym. arXiv:1606.01540, 2016.
233
+
234
+ Kamil Ciosek and Shimon Whiteson. Expected policy gradients. arXiv preprint arXiv:1706.05374, 2017.
235
+
236
+ Thomas Degris, Martha White, and Richard S Sutton. Off-policy actor-critic. ICML, 2012.
237
+
238
+ Shixiang Gu, Timothy Lillicrap, Zoubin Ghahramani, Richard E Turner, Bernhard Scholkopf, and ¨ Sergey Levine. Interpolated policy gradient: Merging on-policy and off-policy gradient estimation for deep reinforcement learning. NIPS, 2017.
239
+
240
+ Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement learning with deep energy-based policies. ICML, 2017.
241
+
242
+ Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In NIPS, 2015.
243
+
244
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. ICLR, 2014.
245
+
246
+ Vijay R Konda and John N Tsitsiklis. Actor-critic algorithms, 2000.
247
+
248
+ 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. ICLR, 2016.
249
+
250
+ Luke Metz, Julian Ibarz, Navdeep Jaitly, and James Davidson. Discrete sequential prediction of continuous actions for deep RL. CoRR, abs/1705.05035, 2017. URL http://arxiv.org/ abs/1705.05035.
251
+
252
+ Remi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy ´ reinforcement learning. In NIPS, 2016.
253
+
254
+ Ofir Nachum, Mohammad Norouzi, Kelvin Xu, and Dale Schuurmans. Bridging the gap between value and policy based reinforcement learning. NIPS, 2017a.
255
+
256
+ Ofir Nachum, Mohammad Norouzi, Kelvin Xu, and Dale Schuurmans. Trust-pcl: An off-policy trust region method for continuous control. arXiv preprint arXiv:1707.01891, 2017b.
257
+
258
+ Robert Price. A useful theorem for nonlinear devices having gaussian inputs. IRE Transactions on Information Theory, 4(2):69–72, 1958.
259
+
260
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pp. 1278–1286, 2014.
261
+
262
+ Gavin A Rummery and Mahesan Niranjan. On-line Q-learning using connectionist systems, volume 37. 1994.
263
+
264
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In ICML, 2015.
265
+
266
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
267
+
268
+ David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In ICML, 2014.
269
+
270
+ Richard S. Sutton and Andrew G. Barto. Introduction to Reinforcement Learning. MIT Press, 1998.
271
+
272
+ Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. NIPS, 2000.
273
+
274
+ 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.
275
+
276
+ George E Uhlenbeck and Leonard S Ornstein. On the theory of the brownian motion. Physical review, 36(5):823, 1930.
277
+
278
+ Harm Van Seijen, Hado Van Hasselt, Shimon Whiteson, and Marco Wiering. A theoretical and empirical analysis of expected sarsa. In Adaptive Dynamic Programming and Reinforcement Learning, 2009. ADPRL’09. IEEE Symposium on, pp. 177–184. IEEE, 2009.
279
+
280
+ Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. ICLR, 2017.
281
+
282
+ Christopher John Cornish Hellaby Watkins. Learning from delayed rewards. PhD thesis, University of Cambridge England, 1989.
283
+
284
+ Ronald J Williams and Jing Peng. Function optimization using connectionist reinforcement learning algorithms. Connection Science, 1991.
285
+
286
+ # A PROOF OF EQUATION (15)
287
+
288
+ We note that similar identities for Gaussian integrals exist in the literature (Price, 1958; Rezende et al., 2014) and point the reader to these works for further information.
289
+
290
+ The specific identity we state may be derived using standard matrix calculus. We make use of the fact that
291
+
292
+ $$
293
+ \frac { \partial } { \partial A } | A | ^ { - 1 / 2 } = - \frac { 1 } { 2 } | A | ^ { - 3 / 2 } \frac { \partial } { \partial A } | A | = - \frac { 1 } { 2 } | A | ^ { - 1 / 2 } A ^ { - 1 } ,
294
+ $$
295
+
296
+ and for symmetric $A$ ,
297
+
298
+ $$
299
+ \frac \partial { \partial A } | | \boldsymbol { v } | | _ { A ^ { - 1 } } ^ { 2 } = - A ^ { - 1 } { \boldsymbol { v } } { \boldsymbol { v } } ^ { T } A ^ { - 1 } .
300
+ $$
301
+
302
+ We omit $s$ from $\Sigma ( s )$ in the following equations for succinctness. The LHS of (15) is
303
+
304
+ $$
305
+ \begin{array} { l } { \displaystyle \int _ { A } Q ^ { \pi } ( s , \tilde { a } ) \frac { \partial } { \partial \Sigma } N ( \tilde { a } | a , \Sigma ) \mathrm { d } \tilde { a } } \\ { \displaystyle = \int _ { A } Q ^ { \pi } ( s , \tilde { a } ) \exp \left\{ - \frac { 1 } { 2 } | | \tilde { a } - a | | _ { \Sigma ^ { - 1 } } ^ { 2 } \right\} \left( \frac { \partial } { \partial \Sigma } | 2 \pi \Sigma | ^ { - 1 / 2 } - \frac { 1 } { 2 } | 2 \pi \Sigma | ^ { - 1 / 2 } \frac { \partial } { \partial \Sigma } | | \tilde { a } - a | | _ { \Sigma ^ { - 1 } } ^ { 2 } \right) \mathrm { d } \tilde { a } } \\ { \displaystyle \qquad = \frac { 1 } { 2 } \int _ { A } Q ^ { \pi } ( s , \tilde { a } ) N ( \tilde { a } | a , \Sigma ) \left( - \Sigma ^ { - 1 } + \Sigma ^ { - 1 } ( \tilde { a } - a ) ( \tilde { a } - a ) ^ { T } \Sigma ^ { - 1 } \right) \mathrm { d } \tilde { a } . \quad ( 2 \pi \Sigma ) \mathrm { d } \tilde { a } , } \end{array}
306
+ $$
307
+
308
+ Meanwhile, towards tackling the RHS of (15) we note that
309
+
310
+ $$
311
+ \frac { \partial \tilde { Q } ^ { \pi } ( s , a ) } { \partial a } = \int _ { \cal A } Q ^ { \pi } ( s , \tilde { a } ) N ( \tilde { a } | a , \Sigma ) \Sigma ^ { - 1 } ( \tilde { a } - a ) \mathrm { d } \tilde { a } .
312
+ $$
313
+
314
+ Thus we have
315
+
316
+ $$
317
+ \frac { \partial ^ { 2 } \tilde { Q } ^ { \pi } ( s , a ) } { \partial a ^ { 2 } } = \int _ { \mathcal { A } } Q ^ { \pi } ( s , \tilde { a } ) \left( \Sigma ^ { - 1 } ( \tilde { a } - a ) \frac { \partial } { \partial a } N ( \tilde { a } | a , \Sigma ) + N ( \tilde { a } | a , \Sigma ) \frac { \partial } { \partial a } \Sigma ^ { - 1 } ( \tilde { a } - a ) \right) \mathrm { d } \tilde { a } .
318
+ $$
319
+
320
+ $$
321
+ = \int _ { \mathcal { A } } Q ^ { \pi } ( s , \tilde { a } ) N ( \tilde { a } | a , \Sigma ) ( \Sigma ^ { - 1 } ( \tilde { a } - a ) ( \tilde { a } - a ) ^ { T } \Sigma ^ { - 1 } - \Sigma ^ { - 1 } ) \mathrm { d } \tilde { a } .
322
+ $$
323
+
324
+ # B COMPATIBLE FUNCTION APPROXIMATION
325
+
326
+ A function approximator $\tilde { Q } _ { w } ^ { \pi }$ of ${ \tilde { Q } } ^ { \pi }$ should be sufficiently accurate so that updates for $\mu _ { \theta } , \Sigma _ { \phi }$ are not affected by substituting $\frac { \partial \tilde { Q } _ { w } ^ { \pi } ( s , a ) } { \partial a }$ and $\frac { \partial ^ { 2 } \tilde { Q } _ { w } ^ { \pi } ( s , a ) } { \partial a ^ { 2 } }$ for $\frac { \partial \tilde { Q } ^ { \pi } ( s , a ) } { \partial a }$ and $\frac { \partial ^ { 2 } \tilde { Q } ^ { \pi } ( s , a ) } { \partial a ^ { 2 } }$ , respectively.
327
+
328
+ We claim that a $\tilde { Q } _ { w } ^ { \pi }$ is compatible with respect to $\mu _ { \theta }$ if
329
+
330
+ 1 $\left. \nabla _ { a } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \right| _ { a = \mu _ { \theta } ( s ) } = \nabla _ { \theta } \mu _ { \theta } ( s ) ^ { T } w ,$
331
+ 2. $\begin{array} { r } { \nabla _ { w } \int _ { \mathcal { S } } \Big ( \nabla _ { a } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } - \nabla _ { a } \tilde { Q } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } \Big ) ^ { 2 } \mathrm { d } \rho ^ { \pi } ( s ) = 0 } \end{array}$ (i.e., $w$ minimizes the expected squared error of the gradients).
332
+
333
+ Additionally, $\tilde { Q } _ { w } ^ { \pi }$ is compatible with respect to $\Sigma _ { \phi }$ if
334
+
335
+ 1. $\nabla _ { a } ^ { 2 } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } = \nabla _ { \phi } \Sigma _ { \phi } ( s ) ^ { T } w ,$
336
+ 2. $\begin{array} { r } { \nabla _ { w } \int _ { \mathcal { S } } \left( \nabla _ { a } ^ { 2 } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \big \vert _ { a = \mu _ { \theta } ( s ) } - \nabla _ { a } ^ { 2 } \tilde { Q } ^ { \pi } ( s , a ) \big \vert _ { a = \mu _ { \theta } ( s ) } \right) ^ { 2 } \mathrm { d } \rho ^ { \pi } ( s ) = 0 } \end{array}$ (i.e., $w$ minimizes the expected squared error of the Hessians).
337
+
338
+ One possible parameterization of $\tilde { Q } _ { w } ^ { \pi }$ may be achieved by taking $w = [ w _ { 0 } , w _ { 1 } , w _ { 2 } ]$ and parameterizing
339
+
340
+ $$
341
+ \begin{array} { r } { \tilde { Q } _ { w } ^ { \pi } ( s , a ) = V _ { w _ { 0 } } ( s ) + ( a - \mu _ { \theta } ( s ) ) ^ { T } \nabla _ { \theta } \mu _ { \theta } ( s ) ^ { T } w _ { 1 } + ( a - \mu _ { \theta } ( s ) ) ^ { T } \nabla _ { \phi } \Sigma _ { \phi } ( s ) ^ { T } w _ { 2 } ( a - \mu _ { \theta } ( s ) ) . } \end{array}
342
+ $$
343
+
344
+ <table><tr><td>Hyperparameter</td><td>Range</td><td>Sampling</td></tr><tr><td>actor learningrate critic learning rate</td><td>[1e-6,1e-3] [1e-6,1e-3]</td><td>log</td></tr><tr><td>reward scale</td><td>[0.01,0.3]</td><td>l0g</td></tr><tr><td>OU damping</td><td>[1e-4,1e-3]</td><td>l0g</td></tr><tr><td>OU stddev</td><td></td><td>10g</td></tr><tr><td>入</td><td>[1e-3,1.0]</td><td>log</td></tr><tr><td>discount factor</td><td>[1e-6, 4e-2] 0.995</td><td>log</td></tr><tr><td>target network lag</td><td>0.01</td><td>fixed</td></tr><tr><td>batch size</td><td>128</td><td>fixed</td></tr><tr><td>clipping on gradients of Q</td><td></td><td>fixed</td></tr><tr><td></td><td>4.0</td><td>fixed</td></tr><tr><td>num gradient updates per observation</td><td>1</td><td>fixed</td></tr><tr><td>Huber loss clipping</td><td>1.0</td><td>fixed</td></tr></table>
345
+
346
+ Proof. We shall show how the conditions stated for compatibility with respect to $\Sigma _ { \phi }$ are sufficient. The reasoning for $\mu _ { \theta }$ follows via a similar argument. We also refer the reader to Silver et al. (2014) which includes a similar procedure for showing compatibility.
347
+
348
+ From the second condition for compatibility with respect to $\Sigma _ { \phi }$ we have
349
+
350
+ $$
351
+ \int _ { S } \left( \nabla _ { a } ^ { 2 } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } - \nabla _ { a } ^ { 2 } \tilde { Q } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } \right) \nabla _ { w } \left( \nabla _ { a } ^ { 2 } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } \right) \mathrm { d } \rho ^ { \pi } ( s ) = 0 .
352
+ $$
353
+
354
+ We may combine this with the first condition to find
355
+
356
+ $$
357
+ \int _ { S } \nabla _ { a } ^ { 2 } \tilde { Q } _ { w } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } \nabla _ { \phi } \Sigma _ { \phi } ( s ) \mathrm { d } \rho ^ { \pi } ( s ) = \int _ { S } \nabla _ { a } ^ { 2 } \tilde { Q } ^ { \pi } ( s , a ) \big | _ { a = \mu _ { \theta } ( s ) } \nabla _ { \phi } \Sigma _ { \phi } ( s ) \mathrm { d } \rho ^ { \pi } ( s ) ,
358
+ $$
359
+
360
+ which is the desired property for compatibility.
361
+
362
+ While it is reassuring to know that there exists a class of function approximators which are compatible, this fact is largely ignored in practice. Not only is the class of compatible functions heavily restricted in terms of expressiveness, due to the first set of conditions for $\mu _ { \theta } , \Sigma _ { \phi }$ , it is also impossible to satisfy the second set of conditions without access to derivative and Hessian information of the true ${ \tilde { Q } } ^ { \pi }$ . This problem is also present in DDPG, and we feel this issue merits additional investigation in future work.
363
+
364
+ # C IMPLEMENTATION DETAILS
365
+
366
+ We utilize feed forward networks for both policy and Q-value approximator. For $\mu _ { \boldsymbol { \theta } } ( s )$ we use two hidden layers of dimensions (400, 300) and relu activation functions. For $\tilde { Q } _ { w } ^ { \pi } ( s , a )$ and $Q _ { w } ^ { \pi } ( s , a )$ we first embed the state into a 400 dimensional vector using a fully-connected layer and tanh nonlinearity. We then concatenate the embedded state with $a$ and pass the result through a 1-hidden layer neural network of dimension 300 with tanh activations. We use a diagonal $\Sigma _ { \phi } ^ { \bar { } } ( s ) = e ^ { \phi }$ for Smoothie, with $\phi$ initialized to $- 1$ .
367
+
368
+ To find optimal hyperparameters we perform a 100-trial random search over the hyperparameters specified in Table 1. The OU exploration parameters only apply to DDPG. The $\lambda$ coefficient on KL-penalty only applies to Smoothie with a KL-penalty.
md/train/B1xtd1HtPS/B1xtd1HtPS.md ADDED
@@ -0,0 +1,536 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # QUATERNION EQUIVARIANT CAPSULE NETWORKS FOR 3D POINT CLOUDS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We present a 3D capsule architecture for processing of point clouds that is equivariant with respect to the $S O ( 3 )$ rotation group, translation and permutation of the unordered input sets. The network operates on a sparse set of local reference frames, computed from an input point cloud and establishes end-to-end equivariance through a novel 3D quaternion group capsule layer, including an equivariant dynamic routing procedure. The capsule layer enables us to disentangle geometry from pose, paving the way for more informative descriptions and a structured latent space. In the process, we theoretically connect the process of dynamic routing between capsules to the well-known Weiszfeld algorithm, a scheme for solving iterative re-weighted least squares (IRLS) problems with provable convergence properties, enabling robust pose estimation between capsule layers. Due to the sparse equivariant quaternion capsules, our architecture allows joint object classification and orientation estimation, which we validate empirically on common benchmark datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ It is now well understood that in order to learn a compact representation of the input data, one needs to respect the symmetries in the problem domain (Cohen et al., 2019; Weiler et al., 2018a). Arguably, one of the primary reasons of the success of 2D convolutional neural networks (CNN) is the translation-invariance of the 2D convolution acting on the image grid (Giles & Maxwell, 1987; Kondor et al., 2018). Recent trends aim to transfer this success into the 3D domain in order to support many applications such as shape retrieval, shape manipulation, pose estimation, 3D object modeling and detection. There, the data is naturally represented as sets of 3D points or a point cloud (Qi et al., 2017a;b). Unfortunately, extension of CNN architectures to 3D point clouds is non-trivial due to two reasons: 1) point clouds are irregular and unstructured, 2) the group of transformations that we are interested in is more complex as 3D data is often observed under arbitrary non-commutative $S O ( 3 )$ rotations. As a result, achieving appropriate embeddings requires 3D networks that work on points to be equivariant to these transformations, while also being invariant to the permutations of the point set.
12
+
13
+ In order to fill this important gap, we propose the quaternion equivariant point capsule network or QE-Network that is suited to process point clouds and is equivariant to $S O ( 3 )$ rotations compactly parameterized by quaternions (Fig. 2), in addition to preserved translation and permutation equivariance. Inspired by the local group equivariance (Lenssen et al., 2018; Cohen et al., 2019), we efficiently cover $S \bar { O } ( 3 )$ by restricting ourselves to the sparse set of local reference frames (LRF) that collectively characterize the object orientation. The proposed capsule layers (Hinton et al., 2011) deduces equivariant latent representations by robustly combining those local LRFs using the proposed Weiszfeld dynamic routing. Hence, our latent features specify to local orientations disentangling the pose from object existence. Such explicit storage is unique to our work and allows us to perform rotation estimation jointly with object classification. Our final architecture is a hierarchy of QE-networks, where we use classification error as the only training cue and adapt a Siamese version when the relative rotation is to be regressed. We neither explicitly supervise the network with pose annotations nor train by augmenting rotations. Overall, our contributions are:
14
+
15
+ 1. We propose a novel, fully $S O ( 3 )$ -equivariant capsule architecture that is tailored for simultaneous classification and pose estimation of 3D point clouds. This network produces in
16
+
17
+ ![](images/b89e6e4028568e0d7b589204570db788708ec16213169b719e811cabba66f1ba.jpg)
18
+ Figure 1: Our network operates by processing local reference frames (LRF) on the object. Initial LRFs (b) are obtained by computing normal & tangent vectors on the point set in (a). (c) shows the LRFs randomly sampled from (a) and these are inputs to the first layer of our network. Subsequently, we obtain a multi-channel LRF that is a set of reference frames per pooling center (d). Holistically, our network aggregates the LRFs to arrive at rotation equivariant capsules.
19
+
20
+ variant latent representations while explicitly decoupling the orientation into capsules, thus attaining equivariance. Note that equivariance results have not been previously achieved regarding the quaternion parameterization of the 3D special orthogonal group.
21
+ 2. By utilizing LRFs on points, we reduce the space of orientations that we consider and hence can work sparsely on a subset of the group elements.
22
+ 3. We theoretically prove the equivariance properties of our 3D network regarding the quaternion group. Moreover, to the best of our knowledge, we for the first time establish a connection between the dynamic routing of Sabour et al. (2017) and Generalized Weiszfeld iterations (Aftab et al., 2015). By that, we theoretically argue for the convergence of the employed dynamic routing.
23
+ 4. We experimentally demonstrate the capabilities of our network on classification and orientation estimation of 3D shapes.
24
+
25
+ # 2 PRELIMINARIES AND TECHNICAL BACKGROUND
26
+
27
+ In this paper we will speak of the equivariance of point clouds under the actions of quaternions. We now provide the necessary background required for the grasp of this content.
28
+
29
+ # 2.1 EQUIVARIANCE
30
+
31
+ Definition 1 (Equivariant Map). For a $\mathcal { G }$ -space acting on $\mathcal { X }$ , the map $\Phi : \mathcal { G } \times \mathcal { X } \mapsto \mathcal { X }$ is said to be equivariant $i f$ its domain and co-domain are acted on by the same symmetry group (Cohen & Welling, 2016; Cohen et al., 2018a):
32
+
33
+ $$
34
+ \Phi ( \mathbf { g } _ { 1 } \circ \mathbf { x } ) = \mathbf { g } _ { 2 } \circ \Phi ( \mathbf { x } )
35
+ $$
36
+
37
+ where ${ \bf g } _ { 1 } ~ \in ~ \mathcal { G }$ and ${ \bf g } _ { 2 } ~ \in ~ \mathcal { G }$ . Equivalently $\Phi ( T ( \bf { g } _ { 1 } ) \bf { x } ) = \Psi { T } ( \bf { g } _ { 2 } ) \Phi ( \bf { x } )$ , where $T ( \cdot )$ is a linear representation of the group $\mathcal { G }$ . Note that $T ( \cdot )$ does not have to commute. It suffices for $T ( \cdot )$ to be a homomorphism: $T ( \mathbf { g } _ { 1 } \circ \mathbf { g } _ { 2 } ) = T ( \mathbf { g } _ { 1 } ) \circ T ( \mathbf { g } _ { 2 } )$ . In this paper we use a stricter form of equivariance and consider $\mathbf { g } _ { 2 } = \mathbf { g } _ { 1 }$ .
38
+
39
+ Definition 2 (Equivariant Network). An architecture or network is said to be equivariant if all of its layers are equivariant maps. Due to the transitivity of the equivariance, stacking up equivariant layers will result in globally equivariant networks e.g., rotating the input will produce output vectors which are transformed by the same rotation (Lenssen et al., 2018; Kondor & Trivedi, 2018).
40
+
41
+ # 2.2 THE QUATERNION GROUP $\mathbb { H } _ { 1 }$
42
+
43
+ The choice of 4-vector quaternions has multiple motivations: 1. All 3-vector formulations suffer from infinitely many singularities as angle goes to 0, whereas quaternions avoid those. 2. 3-vectors also suffer from infinitely many redundancies (the norm can grow indefinitely). Quaternions have a single redundancy: $q = - q$ , a condition that is in practice easy to enforce. 3. Computing the actual ‘manifold mean’ on the Lie algebra requires iterative techniques with subsequent updates on the tangent space. Such iterations are computationally harmful for a differentiable GPU implementation.
44
+
45
+ Definition 3 (Quaternion). $A$ quaternion q is an element of Hamilton algebra $\mathbb { H } _ { 1 }$ , extending the complex numbers with three imaginary units $i , j , k$ in the form: ${ \bf q } = q _ { 1 } { \bf { 1 } } + q _ { 2 } \pmb { i } + q _ { 3 } { \pmb { j } } + q _ { 4 } { \pmb { k } } =$
46
+
47
+ # Algorithm 1: Quaternion Equivariant Dynamic Routing
48
+
49
+ 1 input : Input points $\{ { \bf x } _ { 1 } , . . . , { \bf x } _ { K } \} \in \mathbb { R } ^ { K \times 3 }$ , input capsules (LRFs) $\mathcal { Q } = \left\{ \mathbf { q } _ { 1 } , \dots , \mathbf { q } _ { L } \right\} \in \mathbb { H } _ { 1 } ^ { L }$ ,
50
+ with $L = N ^ { c } \cdot K$ , $N ^ { c }$ is the number of capsules per point, activations ${ \pmb { \alpha } } = ( \alpha _ { 1 } , \ldots , \alpha _ { L } ) ^ { T }$ ,
51
+ trainable transformations $\mathcal { T } = \{ \mathbf { t } _ { i , j } \} _ { i , j } \in \mathbb { H } _ { 1 } ^ { L \times M }$
52
+ 2 output: Updated frames $\hat { \mathcal { Q } } = \{ \hat { \mathbf { q } } _ { 1 } , \hdots , \hat { \mathbf { q } } _ { M } \} \in \mathbb { H } _ { 1 } ^ { M }$ , updated activations $\hat { \pmb { \alpha } } = ( \hat { \alpha } _ { 1 } , \dots , \hat { \alpha } _ { M } ) ^ { T }$
53
+ 3 for All primary (input) capsules $i$ do
54
+ 4 for All latent (output) capsules $j$ do
55
+ 5 $\mathbf { v } _ { i , j } \mathbf { q } _ { i } \circ \mathbf { t } _ { i , j }$ // compute votes
56
+ 6 for All latent (output) capsules $j$ do
57
+ 7 $\hat { \mathbf { q } } _ { j } A \big ( \{ \mathbf { v } _ { 1 , j } \dots \mathbf { v } _ { K , j } \} , \alpha \big ) \quad / \mathrm { ~ }$ initialize output capsules
58
+ 8 for $k$ iterations do
59
+ 9 for All primary (input) capsules $i$ do
60
+ 10 $w _ { i , j } \alpha _ { i }$ · sigmoid $\big ( - \delta ( \hat { \mathbf { q } } _ { j } , \mathbf { v } _ { i , j } ) \big )$ // compute the current weight
61
+ 11 L $\hat { \mathbf { q } } _ { j } A \big ( \{ \mathbf { v } _ { 1 , j } \ : . . . \mathbf { v } _ { L , j } \} , \mathbf { w } _ { : , j } \big ) \mathrm { ~ , ~ }$ / see Eq (4)
62
+ 12 $\hat { \alpha } _ { j } \gets \mathrm { s i g m o i d } \big ( - \frac { 1 } { K } \sum _ { 1 } ^ { L } \delta ( \hat { \mathbf { q } } _ { j } , \mathbf { v } _ { i , j } ) \big ) / /$ recompute activations
63
+
64
+ $\left( q _ { 1 } , q _ { 2 } , q _ { 3 } , q _ { 4 } \right) ^ { T }$ , with $\left( q _ { 1 } , q _ { 2 } , q _ { 3 } , q _ { 4 } \right) ^ { T } \in \mathbb { R } ^ { 4 }$ and $\pmb { i } ^ { 2 } = \pmb { j } ^ { 2 } = \pmb { k } ^ { 2 } = i \pmb { j } \pmb { k } = - \pmb { I }$ . $q _ { 1 } \in \mathbb { R }$ denotes the scalar part and $\pmb { \nu } = \left( q _ { 2 } , q _ { 3 } , q _ { 4 } \right) ^ { T } \in \mathbb { R } ^ { 3 }$ , the vector part. The conjugate $\bar { \bf q }$ of the quaternion q is given by $\bar { \mathbf { q } } : = q _ { 1 } - q _ { 2 } \dot { \pmb { i } } - q _ { 3 } \pmb { j } - q _ { 4 } \pmb { k }$ . A unit quaternion $\mathbf { q } \in \mathbb { H } _ { 1 }$ with $1 \stackrel { \prime } { = } \| \mathbf { q } \| : = \mathbf { q } \cdot \bar { \mathbf { q } }$ and $\mathbf { q } ^ { - 1 } = \bar { \mathbf { q } } ,$ gives a compact and numerically stable parametrization to represent orientation of objects on the unit sphere $S ^ { 3 }$ , avoiding gimbal lock and singularities (Busam et al., 2017). Identifying antipodal points $\mathbf { q }$ and $- \mathbf { q }$ with the same element, the unit quaternions form a double covering group of $S O \left( 3 \right)$ . $\mathbb { H } _ { 1 }$ is closed under the non-commutative multiplication or the Hamilton product:
65
+
66
+ $$
67
+ ( \mathbf { p } \in \mathbb { H } _ { 1 } ) \circ ( \pmb { r } \in \mathbb { H } _ { 1 } ) = [ p _ { 1 } r _ { 1 } - \mathbf { v } _ { p } \cdot \mathbf { v } _ { r } ; p _ { 1 } \mathbf { v } _ { r } + r _ { 1 } \mathbf { v } _ { p } + \mathbf { v } _ { p } \times \mathbf { v } _ { r } ] .
68
+ $$
69
+
70
+ Definition 4 (Linear Representation of $\mathbb { H } _ { 1 }$ ). We follow Birdal et al. (2018) and use the
71
+
72
+ $$
73
+ \begin{array} { r } { \mathbf { T } ( \mathbf { q } ) \triangleq \left[ \begin{array} { r r r r } { q _ { 1 } } & { - q _ { 2 } } & { - q _ { 3 } } & { - q _ { 4 } } \\ { q _ { 2 } } & { q _ { 1 } } & { - q _ { 4 } } & { q _ { 3 } } \\ { q _ { 3 } } & { q _ { 4 } } & { q _ { 1 } } & { - q _ { 2 } } \\ { q _ { 4 } } & { - q _ { 3 } } & { q _ { 2 } } & { q _ { 1 } } \end{array} \right] . } \end{array}
74
+ $$
75
+
76
+ To be concise we will use capital letters to refer to the matrix representation of quaternions $e . g . \mathbf { Q } \equiv$ $T ( \mathbf { q } )$ , $\mathbf { G } \equiv T ( \mathbf { g } )$ . Note that $T ( \cdot )$ , the injective homomorphism to the orthonormal matrix ring, by construction satisfies the condition in Dfn. 1 (Steenrod, 1951): $\operatorname* { d e t } ( \mathbf { Q } ) = 1 , \mathbf { Q } ^ { \intercal } = \mathbf { Q } ^ { - 1 } , \| \tilde { \mathbf { Q } } \| \overset { \cdot } { = }$ $\lVert \mathbf { Q } _ { i , : } \rVert = \lVert \mathbf { Q } _ { : , i } \rVert \stackrel { - } { = } 1$ and $\mathbf { Q } - q _ { 1 } \mathbf { I }$ is skew symmetric: $\mathbf { Q } + \mathbf { Q } ^ { \top } = 2 q _ { 1 } \mathbf { I } .$ . It is easy to verify these properties. $T$ linearizes the Hamilton product or the group composition: $\mathbf { g } \circ \mathbf { q } \triangleq T ( \mathbf { g } ) \mathbf { q } \triangleq \mathbf { G q }$ .
77
+
78
+ # 2.3 3D POINT CLOUDS
79
+
80
+ Definition 5 (Point Cloud). We define a $3 D$ surface to be a differentiable 2-manifold embedded in the ambient $3 D$ Euclidean space: $\mathcal { M } ^ { 2 } \in \mathbb { R } ^ { 3 }$ and a point cloud to be a discrete subset sampled on $\mathcal { M } ^ { 2 }$ : $\mathbf { X } \in \{ \mathbf { x } _ { i } \in \mathcal { M } ^ { 2 } \cap \mathbb { R } ^ { 3 } \}$ .
81
+
82
+ Definition 6 (Local Geometry). For a smooth point cloud $\{ \mathbf { x } _ { i } \} \in \mathcal { M } ^ { 2 } \subset \mathbb { R } ^ { N \times 3 }$ , $a$ local reference frame (LRF) is defined as an ordered basis of the tangent space at x, $\mathcal { T } _ { \mathbf { x } } \mathcal { M }$ , consisting of orthonormal vectors: $\mathcal { L } ( \mathbf { x } ) = [ \partial _ { 1 } , \partial _ { 2 } , \partial _ { 3 } \equiv \partial _ { 1 } \times \partial _ { 2 } ]$ ]. Usually the first component is defined to be the surface normal $\pmb { \partial } _ { 1 } \triangleq \mathbf { n } \in \mathcal { S } ^ { 2 } : \| \mathbf { n } \| = 1$ and the second one is picked according to a modality dependent heuristic.
83
+
84
+ Note that recent trends such as (Cohen et al., 2019) acknowledge the ambiguity and either employ a gauge (tangent frame) equivariant design or propagate the determination of a certain direction until the last layer (Poulenard & Ovsjanikov, 2018). Here, we will assume that $\partial _ { 2 }$ can be uniquely and repeatably computed, a reasonable assumption for the point sets we consider (Petrelli & Di Stefano, 2011). For the cases where this does not hold, we will rely on the network’s robustness. We will explain our method of choice in Sec. 4 and visualize LRFs of an airplane object in Fig. 1.
85
+
86
+ ![](images/d2d1f0c3fa686d3b7e437e6a2d3e75627b94d94bfcc44d94a9ea0ba1f0891666.jpg)
87
+ Figure 2: Our quaternion equivariant (QE) network for processing local patches: Our input is a 3D point set $\mathbf { X }$ on which we query local neighborhoods $\{ \mathbf { x } _ { i } \}$ with precomputed LRFs $\left\{ \mathbf { q } _ { i } \right\}$ . Essentially, we learn the parameters of a fully connected network that continuously maps the canonicalized local point set to transformations $\mathbf { t } _ { i }$ , which are used to compute hypotheses (votes) from input poses. By a special dynamic routing procedure that uses the activations determined in a previous layer, we arrive at latent capsules that are composed of a set of orientations $\hat { \mathbf { q } } _ { i }$ and new activations $\hat { \pmb { \alpha } } _ { i }$ . Thanks to the decoupling of local reference frames, $\hat { \pmb { \alpha } } _ { i }$ is invariant and orientations $\hat { \mathbf { q } } _ { i }$ are equivariant to input rotations. All the operations and hence the entire QE-network are equivariant achieving a guaranteed disentanglement of the rotation parameters. Hat symbol (qˆ) refers to ’estimated’.
88
+
89
+ # 3 $S O ( 3 )$ -EQUIVARIANT 3D CAPSULE NETWORKS
90
+
91
+ Disentangling orientation from representations requires guaranteed equivariances and invariances. Yet, the original capsule networks of Sabour et al. (2017) cannot achieve equivariance to general groups. To this end, Lenssen et al. (2018) proposed to use a manifold-mean and a special aggregation that makes sure that the trainable transformations get pose-aligned points as input. We will extend this idea to the non-abelian $S O ( 3 )$ and design capsule networks sparsely operating on a set of LRFs computed on local neighborhoods of points, parameterized by quaternions. In the following, we first explain our novel capusle layers, the main building block of our architecture. We then show how to stack those layers via a simple aggregation resulting in an $S O ( 3 )$ -equivariant 3D capsule network that yields invariant representations (or activations) as well as equivariant rotations (latent capsules).
92
+
93
+ # 3.1 QUATERNION EQUIVARIANT CAPSULE LAYERS
94
+
95
+ To construct equivariant layers on the group of rotations, we are required to define a left-equivariant averaging operator $\mathcal { A }$ that is invariant under permutations of the group elements, as well as a distance metric $\delta$ that remains unchanged under the action of the group. For these, we make the following choices:
96
+
97
+ Definition 7 (Geodesic Distance). The Riemannian (geodesic) distance in the manifold of rotations lead to the following geodesic distance $\delta ( \cdot ) \equiv d _ { q u a t } ( \cdot )$ :
98
+
99
+ $$
100
+ d ( { \bf q } _ { 1 } , { \bf q } _ { 2 } ) \equiv d _ { q u a t } ( { \bf q } _ { 1 } , { \bf q } _ { 2 } ) = 2 \cos ^ { - 1 } ( | \langle { \bf q } _ { 1 } , { \bf q } _ { 2 } \rangle | )
101
+ $$
102
+
103
+ Definition 8 (Quaternion Mean $\pmb { \mu } ( \cdot ) .$ ). For a set of $Q$ rotations ${ \bf S } = \{ { \bf q } _ { i } \}$ and associated weights $\textbf { w } = \{ w _ { i } \}$ , the weighted mean operator $\mathcal { A } ( \mathbf { S } , \mathbf { w } ) : \mathbb { H } _ { 1 } { } ^ { n } \times \mathbb { R } ^ { n } \mapsto \mathbb { H } _ { 1 } { } ^ { n }$ is defined through the following maximization procedure (Markley et al., 2007):
104
+
105
+ $$
106
+ \bar { \mathbf { q } } = \underset { \mathbf { q } \in \mathbb { S } ^ { 3 } } { \arg \operatorname* { m a x } } \mathbf { q } ^ { \top } \mathbf { M } \mathbf { q }
107
+ $$
108
+
109
+ where $ { \mathbf { M } } \in \mathbb { R } ^ { 4 \times 4 }$ is defined as: $\mathbf { M } \triangleq \sum _ { i = 1 } ^ { Q } w _ { i } \mathbf { q } _ { i } \mathbf { q } _ { i } ^ { \intercal }$ . The average quaternion is the eigenvector of M corresponding to the maximum eigenvalue. This operation lends itself to both analytic (Magnus, 1985) and automatic differentiation (Laue et al., 2018).
110
+
111
+ Theorem 1. Quaternions, the employed mean $\mathbf { \nabla } _ { \mathbf { \mathcal { A } } ( \mathbf { S } , \mathbf { w } ) }$ and geodesic distance $\delta ( \cdot )$ enjoy the following properties:
112
+
113
+ ![](images/df28604b52dac726104b4b42cf496aa21f248230f1da47e6f8ca03184a76b7a5.jpg)
114
+ Figure 3: Our entire capsule architecture. We hierarchically send all the local patches to our Qnetwork as shown in Fig. 2. At each level the points are pooled in order to increase the receptive field, gradually reducing the LRFs into a single capsule per class. We use classification and pose estimation (in the siamese case) as supervision cues to train the point-to-transform maps.
115
+
116
+ 1. $\mathcal { A } ( \mathbf { g } \circ \mathbf { S } , \mathbf { w } )$ is left-equivariant: $\mathcal { A } ( \mathbf { g } \circ \mathbf { S } , \mathbf { w } ) = \mathbf { g } \circ \mathcal { A } ( \mathbf { S } , \mathbf { w } )$ .
117
+ 2. Operator $\mathcal { A }$ is invariant under permutations: $\begin{array} { r l } { \mathcal { A } ( \{ \mathbf { q } _ { \sigma ( 1 ) } , \dots , \mathbf { q } _ { \sigma ( Q ) } \} , \mathbf { w } _ { \sigma } ) } & { { } = } \end{array}$ $\mathcal { A } ( \{ \mathbf { q } _ { 1 } , \hdots , \mathbf { q } _ { Q } \} , \mathbf { w } )$ .
118
+ 3. The transformations $\mathbf { g } \in \mathbb { H } _ { 1 }$ preserve the geodesic distance $\delta ( \cdot )$ given in Dfn. 7.
119
+
120
+ Proof. The proofs are given in the supplementary material.
121
+
122
+ We also note that the above mean is closed form, differentiable and can be implemented batchwise. We are now ready to construct the group dynamic routing (DR) by agreement that is equivariant thanks to Thm. 1. The core idea is to route from or assign the primary capsules that constitute the input LRF set, to the latent capsules by an iterative clustering which respects the group structure. At each step, we assign the weighted group mean to each output capsule. The weights $w \sigma ( \mathbf x , \mathbf y )$ are inversely propotional to the distance between the vote quaternion and the new quaternion (cluster center). See Alg. 1 for details. In the following, we analyze our variant of routing as an interesting case of the affine, Riemannian Weiszfeld algorithm (Aftab et al., 2015; 2014).
123
+
124
+ Lemma 1. For $\sigma ( { \bf x } , { \bf y } ) = \delta ( { \bf x } , { \bf y } ) ^ { q - 2 }$ the equivariant routing procedure given in Alg. 1 is a variant of the affine subspace Wieszfeld algorithm (Aftab et al., 2015; 2014) that is a robust algorithm for computing the $L _ { q }$ geometric median.
125
+
126
+ Proof Sketch. The proof follows from the definition of Weiszfeld iteration (Aftab et al., 2014) and the mean and distance operators defined in Sec. 3.1. We first show that computing the weighted mean is equivalent to solving the normal equations in the iteratively reweighted least squares (IRLS) scheme (Burrus, 2012). Then, the inner-most loop correspond to the IRLS or Weiszfeld iterations. We provide the detailed proof in supplementary material.
127
+
128
+ Note that, in practice one is quite free to choose the weighting function $\sigma ( \cdot )$ as long as it is inversely proportional to the geodesic distance and concave (Aftab & Hartley, 2015). We leave the analyses of the variants of these algorithms as a future work. The original dynamic routing can also be formulated as a clustering procedure with a KL divergence regularization. This holistic view paves the way to better routing algorithms (Wang & Liu, 2018). Our perspective is akin yet more geometric due to the group structure of the parameter space. Thanks to the connection to Weiszfeld algorithm, the convergence behavior of our dynamic routing can be directly analyzed within the theoretical framework presented by Aftab et al. (2014; 2015).
129
+
130
+ Theorem 2. Under mild assumptions provided in the appendix, the sequence of the DR-iterates generated by the inner-most loop almost surely converges to a critical point.
131
+
132
+ Proof Sketch. Proof, given in the appendix, is a direct consequence of Lemma 1 and directly exploits the connection to the Weiszfeld algorithm. □
133
+
134
+ # 3.2 EQUIVARIANT 3D POINT CAPSULE NETWORK ARCHITECTURE
135
+
136
+ The essential ingredient of our architecture, QE-Network, is shown in Fig. 2. We also provide a corresponding pseudocode in Alg. 3 of suppl. material. The input of the QE-Network are a local patch of points with coordinates $\mathbf { x } _ { i } \subset \mathbb { R } ^ { K \times 3 }$ , rotations parametrized as quaternions $\mathbf { q } _ { i } \subset \mathbb { H } _ { 1 } { } ^ { K \times N ^ { c } }$ and activations $\pmb { \alpha } _ { i } \subset \mathbb { R } ^ { K \times N ^ { c } }$ . $\mathbf { q } _ { i }$ also represents input primary capsules and local reference frames. $N ^ { c }$ is the number of input capsule channels per point and it is equal to the number of output capsules $( M )$ from the last layer. In the initial layer, $\mathbf { q } _ { i }$ represents the pre-computed LRFs and $N ^ { c }$ is equal to 1. Given points $\mathbf { x } _ { i }$ and rotations $\mathbf { q } _ { i }$ , we compute the quaternion average $\mu _ { i }$ in channel-wise as the initial pose candidates: $\mu _ { i } \subset \mathbb { H } _ { 1 } ^ { N ^ { c } }$ . These candidates are used to bring the receptive field in multiple canonical orientations by rotating the points: $\mathbf { x } _ { i } ^ { \prime } = ( { \mu _ { i } } ^ { - 1 } \circ \mathbf { x } _ { i } ) \subset \mathbb { R } ^ { K \times N ^ { c } \times 3 }$ . Since the points in the local receptive field lie in continuous $\mathbb { R } ^ { 3 }$ , training a discrete set of pose transformations $\mathbf { t } _ { i , j }$ based on local coordinates is not possible. Instead, we employ a point-to-transform network $\begin{array} { r } { t ( \cdot ) : \bar { \mathbb { R } } ^ { N ^ { c } \times 3 } } \end{array}$ $\mathbb { R } ^ { M \times N ^ { c } \times 4 }$ that maps the point in multiple canonical orientations to transformations. The network is shared over all points to compute the transformations $\mathbf { t } _ { i , j } = ( t ( \mathbf { x } _ { 1 } ^ { \prime } ) , . . . , t ( \mathbf { x } _ { K } ^ { \prime } ) ) _ { i , j } \subset \mathbb { R } ^ { K \times M \times N ^ { c } \times 4 } ,$ , which are used to calculate the votes for dynamic routing as $\mathbf { v } _ { i , j } = \mathbf { q } _ { i } \circ \mathbf { t } _ { i , j }$ . The network $t ( \cdot )$ consists of fully-connected layers that regresses the transformations, similar to common operators for continuous convolutions (Schutt et al., 2017; Wang et al., 2018; Fey et al., 2018). It is the ¨ continuous alternative to directly optimizing transformations lying in a grid kernel, as it is done in the original dynamic routing by Sabour et al. (2017). Note that $t ( \cdot )$ predicts quaternions by unitnormalizing the regressed output: $\mathbf { t } _ { i , j } \subset \mathbb { H } _ { 1 } ^ { K \times M \times N ^ { c } }$ . Although Riemannian layers of Becigneul & ´ Ganea (2018) or spherical predictions of Liao et al. (2019) can improve the performance, the simple strategy works reasonably for our case. After computing the votes, we utilize the input activation $\alpha _ { i }$ to iteratively refine the output capsules (weighted average of votes) $\hat { \mathbf { q } _ { i } }$ and activations $\hat { \pmb { \alpha } } _ { i }$ by routing by agreement as shown in Alg. 1.
137
+
138
+ Table 1: Classification accuracy on ModelNet40 dataset (Wu et al., 2015) for different methods as well as ours. We also report the number of parameters optimized for each method. X/Y means that we train with X and test with Y.
139
+
140
+ <table><tr><td></td><td>PN</td><td>PN++</td><td>KD-treeNet Point2Seq Sph.CNNs 1</td><td></td><td></td><td>PRIN</td><td>PPF</td><td>Ours (Var.)</td><td>Ours</td></tr><tr><td>NR/NR</td><td></td><td>88.45 89.82</td><td>86.20</td><td>92.60</td><td>-</td><td>80.13</td><td>70.16</td><td>85.27</td><td>74.43</td></tr><tr><td>NR/AR</td><td>12.47</td><td>21.35</td><td>8.49</td><td>10.53</td><td>43.92</td><td>68.85</td><td>70.16</td><td>11.75</td><td>74.07</td></tr><tr><td># Params</td><td>3.5M</td><td>1.5M</td><td>3.6M</td><td>1.8M</td><td>0.5M</td><td>1.5M</td><td>3.5M</td><td>0.4M</td><td>0.4M</td></tr></table>
141
+
142
+ In order to gradually increase the receptive field, we stack QE-networks creating a deep hierarchy, pooling the points and the LRFs before each layer. Note that we are allowed to do so thanks to the properties of equivariance. In particular, we input $N \ : = \ : 6 4$ patches to our architecture that is composed of two QE-networks. We call the centers of these patches pooling centers. In the first layer, each of those centers is linked to their immediate vicinity leading to $K = 9$ -star local connectivity from which we compute the $6 4 \times 6 4 \times 4$ intermediary capsules. The input LRFs of the first layer are sampled from pre-calculated LRF-set and the input activation is set to 1. The LRFs in the second layer $l = 2$ are the output capsules of the first layer, $l = 1$ and are routed to the output capsules that are as many as the number of classes $C$ , $M _ { 2 } = C$ . The activation of the second layer is updated by the output of the first layer as well. This construction is shown in Fig. 3. Specifically, for $l = 1$ , we use $K \bar { = } 9 , N _ { l } { } ^ { c } = 1 , \dot { M _ { l } } = 6 4$ and for $l = 2$ , $K = 6 4 , N _ { l } { } ^ { c } = 6 4 , \bar { M _ { l } } = C \bar { = } 4 0$ . This way, in this last layer all the pooling centers act as a single patch $K = 6 4$ ). A single QE-network acts on this patch to create the final $C \times 4$ capsules and $C$ activations. More details are reported in Alg. 3 of the appendix.
143
+
144
+ # 4 EXPERIMENTAL EVALUATIONS
145
+
146
+ Implementation Details We implement our network in PyTorch and use the ADAM optimizer (Kingma & Ba, 2014) with a learning rate of 0.001. The point-transformation mapping network is implemented by two FC-layers composed of 64 hidden units. We set the initial activation of the input LRF to 1.0. In each layer, we use 3 iterations of DR. For classification we use the spread loss (Sabour et al., 2018) and the rotation loss is identical to $\delta ( \cdot )$ .
147
+
148
+ Surface normals are computed by local plane fits (Hoppe et al., 1992). We compute the second axis of the LRF, $\partial _ { 2 }$ , by FLARE (Petrelli $\&$ Di Stefano, 2012), that uses the normalized projection of the point within the periphery of the support showing the largest distance, onto the tangent plane of the center: $\begin{array} { r } { \partial _ { 2 } = \frac { \mathbf { \tilde { p } } _ { \mathrm { m a x } } - \mathbf { \tilde { p } } } { \Vert \mathbf { p } _ { \mathrm { m a x } } - \mathbf { p } \Vert } } \end{array}$ . Note that using other LRFs such as SHOT (Tombari et al., 2010) or the more modern GFrames of Melzi et al. (2019) is possible. We found FLARE to be sufficient for our experiments. Prior to all operations, we flip all the LRF quaternions such that they lie on the northern hemisphere : $\{ \mathbf { q } _ { i } \in \mathbb { S } ^ { \hat { 3 } } : q _ { i } ^ { w } > 0 \}$ .
149
+
150
+ Table 2: Error of rotation estimation in different categories of ModelNet10. Right side of the table denotes the objects with rotational symmetry, which we include for completeness. PCA-S refers to running PCA only on a resampled instance, while PCA-SR applies both rotations and resampling.
151
+
152
+ <table><tr><td>Method</td><td>Avg.</td><td>No_Sym</td><td> Chair Bed Sofa Toilet Monitor|Table Desk Dresser</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>NS</td><td>Bathtub</td></tr><tr><td>Mean LRF</td><td>0.41</td><td>0.35</td><td>0.32</td><td>0.36</td><td>0.34</td><td>0.41</td><td>0.34</td><td>0.45</td><td>0.60</td><td>0.50</td><td>0.46</td><td>0.32</td></tr><tr><td>PCA-S</td><td>0.40</td><td>0.42</td><td>0.60</td><td>0.53</td><td>0.46</td><td>0.32</td><td>0.12</td><td>0.47</td><td>0.23</td><td>0.33</td><td>0.43</td><td>0.55</td></tr><tr><td>PCA-SR</td><td>0.67</td><td>0.67</td><td>0.69</td><td>0.70</td><td>0.67</td><td>0.68</td><td>0.61</td><td>0.67</td><td>0.67</td><td>0.67</td><td>0.66</td><td>0.70</td></tr><tr><td>PointNetLK</td><td>0.37</td><td>0.38</td><td>0.43</td><td>0.31</td><td>0.40</td><td>0.40</td><td>0.31</td><td>0.40</td><td>0.33</td><td>0.39</td><td>0.38</td><td>0.34</td></tr><tr><td>IT-net</td><td>0.27</td><td>0.19</td><td>0.10</td><td>0.22</td><td>0.17</td><td>0.20</td><td>0.28</td><td>0.31</td><td>0.41</td><td>0.44</td><td>0.40</td><td>0.39</td></tr><tr><td>Ours</td><td>0.27</td><td>0.17</td><td>0.11</td><td>0.20</td><td>0.16</td><td>0.18</td><td>0.19</td><td>0.43</td><td>0.40</td><td>0.48</td><td>0.33</td><td>0.31</td></tr><tr><td>Ours (siamese)</td><td>0.20</td><td>0.09</td><td>0.08</td><td>0.10</td><td>0.08</td><td>0.11</td><td>0.08</td><td>0.40</td><td>0.35</td><td>0.34</td><td>0.32</td><td>0.30</td></tr></table>
153
+
154
+ 3D Shape Classification. We use ModelNet40 dataset of (Wu et al., 2015; Qi et al., 2017b) to assess our classification performance. Each shape is composed by $1 0 K$ points. We assign the LRFs to a subset of the uniformly sampled points, $N = 5 1 2$ (Birdal & Ilic, 2017). We train the networks without any rotation augmentation (NR) and put them to test under arbitrary $S O ( 3 )$ rotations (AR). Our results are shown in Tab. 1 along with that of PointNet (PN) (Qi et al., 2017a), PointNet++ $\mathrm { ( P N + + ) }$ (Qi et al., 2017a), KD-treeNet (Li et al., 2018a), Point2Seq (Liu et al., 2019b), Spherical CNNs (Esteves et al., 2018), PRIN (You et al., 2018) and PPF-FoldNet (PPF) (Deng et al., 2018a). We also present a version of our algorithm (Var) that avoids the canonicalization within the QEnetwork. This is a non-equivariant network that we still train without data augmentation. While this version gets comparable results to the state of the art for the NR/NR case, it cannot handle random $S O ( 3 )$ variations (AR). Note that PPF uses the point-pair-feature (Birdal & Ilic, 2015) encoding and hence creates invariant input representations. For the scenario of NR/AR, our equivariant version outperforms all the other methods, including equivariant spherical CNNs (Esteves et al., 2018) by a significant gap of at least $5 \%$ even when (Esteves et al., 2018) uses the mesh. The object rotational symmetries in this dataset are responsible for a significant portion of the errors we make. It is worth mentioning that we also trained TFNs (Thomas et al., 2018) for that task, but their memory demand made it infeasible to scale to this application.
155
+
156
+ Number of Parameters. Use of LRFs helps us to restrict the rotation group to certain elements and thus we can use networks with significantly less parameters (as low as $0 . 4 4 M$ ) compared to others as shown in Tab. 1. Number of parameters in our network depends upon the number of classes, e.g. for ModelNet10 we have $0 . 0 4 7 M$ parameters.
157
+
158
+ Rotation estimation in 3D point clouds. Our network can estimate both the canonical and relative object rotations without pose-supervision. To evaluate this desired property, we used the well classified shapes on ModelNet10 dataset, a sub-dataset of Modelnet40 (Wu et al., 2015). We generate multiple instances per shape by transforming the instance with five arbitrary $S O ( 3 )$ rotations. As we are also affected by the sampling of the point cloud, we resample the mesh five times and generate different pooling graphs across all the instances of the same shape. Our QE-architecture can estimate the pose in two ways: 1) by directly using the output capsule with the highest activation, 2) by a siamese architecture that computes the relative quaternion between the capsules that are maximally activated as shown in Fig. 4. Both modes of operation are free of the data augmentation and we give further schematics of the latter in our appendix Fig. 5. Our results against the baselines including a naive averaging of the LRFs (Mean LRF) and principal axis alignment (PCA) are reported in Tab. 2 as the relative angular error (RAE). We further include results of PointNetLK Aoki et al. (2019) and IT-Net (Yuan et al., 2018), two state of the art 3D networks that iteratively aligns two point sets. These methods are in nature similar to iterative closest point (ICP) algorithm (Besl & McKay, 1992) but 1) do not require an initialization (first iteration estimates the pose), 2) learn data driven updates. Methods that use mesh inputs such as Spherical CNNs (Esteves et al., 2018) cannot be included here as the random sampling of the same surface would not affect those. We also avoid methods that are just invariant to rotations (and hence cannot estimate the pose) such as Tensorfield Networks (Thomas et al., 2018). Finally, note that , IT-net (Yuan et al., 2018) and PointLK need to train a lot of epoches (e.g. 500) with random $S O ( 3 )$ rotation augmentation in order to get the models that cover the full $S O ( 3 )$ , whereas we train only for $\sim 1 0 0$ epochs. We include more details about the baselines in the appendix under Fig. 8.
159
+
160
+ ![](images/340104a5fbcae573bea645d4e647284c5ebb81b1073ec39db251d3476631e304.jpg)
161
+ Figure 4: Shape alignment on the monitor (left) and toilet (right) objects via our siamese equivariant capsule architecture. The shapes are assigned to the the maximally activated class. The corresponding pose capsule provides the rotation estimate.
162
+
163
+ RAE between the ground truth and the prediction is computed as the relative angle in degrees: $d ( \mathbf { q } _ { 1 } , \mathbf { q } _ { 2 } ) / \pi$ . Note that resampling and random rotations render the job of all methods difficult. However, both our version that tries to find a canonical alignment and the siamese variant which seeks a relative rotation are better than the baselines. As pose estimation of objects with rotational symmetry is a challenging task we also report results on the non-symmetric subset (No Sym).
164
+
165
+ Table 3: Ablation study on point density.
166
+
167
+ <table><tr><td rowspan=1 colspan=1>LRF Input|</td><td rowspan=1 colspan=1>LRF-10K</td><td rowspan=1 colspan=2>[LRF-2K|LRF-1K</td></tr><tr><td rowspan=1 colspan=1>Dropout</td><td rowspan=1 colspan=1>150%66%75%100%</td><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>100%</td></tr><tr><td rowspan=1 colspan=1>Class.ErrAngle.Err</td><td rowspan=1 colspan=1>77.883.383.487.80.340.270.250.09</td><td rowspan=1 colspan=1>85.460.10</td><td rowspan=1 colspan=1>79.740.12</td></tr></table>
168
+
169
+ Robustness against point and LRF resampling. Density changes in the local neighborhoods of the shape are an important cause of error for our network. Hence, we ablate by applying random resamplings (patch-wise dropout) to the objects in ModelNet10 dataset and repeating the pose estimation and classification as described above. The first part (LRF-10K) of Tab. 3 shows our findings against gradual increases of the number of patches. Here, we sample 2K LRFs from the 10K LRFs computed on an input point 10K. $100 \%$ dropout corresponds to 2K points in all columns. On second ablation, we reduce the amount of points on which we compute the LRFs, to 2K and 1K respectively. As we can see from the table, our network is robust towards the changes in the LRFs as well as the density of the points.
170
+
171
+ # 5 RELATED WORK
172
+
173
+ Deep learning on point sets. The capability to process raw, unordered point clouds within a neural network is introduced by the prosperous PointNet (Qi et al., 2017a) thanks to the point-wise convolutions and the permutation invariant pooling functions. Many works have extended PointNet primarily to increase the local receptive field size (Qi et al., 2017b; Li et al., 2018b; Shen et al., 2018; Wang et al., 2019). Point-clouds are generally thought of as sets. This makes any permutationinvariant network that can operate on sets an amenable choice for processing points (Zaheer et al., 2017; Rezatofighi et al., 2017). Unfortunately, common neural network operators in this category are solely equivariant to permutations and translations but to no other groups.
174
+
175
+ Equivariance in Neural Networks. The early attempts to achieve invariant data representations usually involved data augmentation techniques to accomplish tolerance to input transformations (Maturana & Scherer, 2015; Qi et al., 2016; 2017a). Motivated by the difficulty associated with augmentation efforts and acknowledging the importance of theoretically equivariant or invariant representations, the recent years have witnessed a leap in theory and practice of equivariant neural networks (Bao & Song, 2019; Kondor & Trivedi, 2018).
176
+
177
+ While laying out the fundamentals of the group convolution, G-CNNs (Cohen & Welling, 2016) guaranteed equivariance with respect to finite symmetry groups. Similarly, Steerable CNNs (Cohen & Welling, 2017) and its extension to 3D voxels (Worrall & Brostow, 2018) considered discrete symmetries only. Other works opted for designing filters as a linear combination of harmonic basis functions, leading to frequency domain filters (Worrall et al., 2017; Weiler et al., 2018b). Apart from suffering from the dense coverage of the group using group convolution, filters living in the frequency space are less interpretable and less expressive than their spatial counterparts, as the basis does not span the full space of spatial filters.
178
+
179
+ Achieving equivariance in 3D is possible by simply generalizing the ideas of the 2D domain to 3D by voxelizing 3D data. However, methods using dense grids (Chakraborty et al., 2018; Cohen & Welling, 2017) suffer from increased storage costs, eventually rendering the implementations infeasible. An extensive line of work generalizes the harmonic basis filters to $S O ( 3 )$ by using e.g., a spherical harmonic basis instead of circular harmonics (Cohen et al., 2018b; Esteves et al., 2018; Cruz-Mota et al., 2012). In addition to the same downsides as their 2D, these approaches have in common that they require their input to be projected to the unit sphere (Jiang et al., 2019), which poses additional problems for unstructured point clouds. A related line of research are methods which define a regular structure on the sphere to propose equivariant convolution operators (Liu et al., $2 0 1 9 \mathrm { a }$ ; Boomsma & Frellsen, 2017)
180
+
181
+ To learn a rotation equivariant representation of a 3D shape, one can either act on the input data or on the network. In the former case, one either presents augmented data to the network (Qi et al., 2017a; Maturana & Scherer, 2015) or ensures rotation-invariance in the input (Deng et al., 2018a;b; Khoury et al., 2017). In the latter case one can enforce equivariance in the bottleneck so as to achieve an invariant latent representation of the input (Mehr et al., 2018; Thomas et al., 2018; Spezialetti et al., 2019). Further, equivariant networks for discrete sets of views (Esteves et al., 2019b) and crossdomain views (Esteves et al., 2019a) have been proposed. Here, we aim for a different way of embedding equivariance in the network by means of an explicit latent rotation parametrization in addition to the invariant feature.
182
+
183
+ Marcos et al. (2017) developed Vector Field Networks, which was followed by the 3D Tensor Field Networks (TFN) (Thomas et al., 2018) that are closest to our work. Based upon a geometric algebra framework, the authors did achieve localized filters that are equivariant to rotations, translations and permutations. Moreover, they are able to cover the continuous groups. However, TFN are designed for physics applications, is memory consuming and a typical implementation is neither likely to handle the datasets we consider nor can provide orientations in an explicit manner.
184
+
185
+ Capsule Networks. The idea of capsule networks was first mentioned by Hinton et al. (2011), before Sabour et al. (2017) proposed the dynamic routing by agreement, which started the recent line of work investigating the topic. Since then, routing by agreement has been connected to several well-known concepts, e.g. the EM algorithm Sabour et al. (2018), clustering with KL divergence regularization Wang & Liu (2018) and equivariance (Lenssen et al., 2018). They have been extended to autoencoders (Kosiorek et al., 2019) and GANs Jaiswal et al. (2019). Further, capsule networks have been applied for specific kinds of input data, e.g. graphs (Xinyi & Chen, 2019), 3D point clouds (Zhao et al., 2019) or medical images (Afshar et al., 2018).
186
+
187
+ # 6 CONCLUSION AND DISCUSSION
188
+
189
+ In this work, we have presented a new framework for achieving permutation invariant and $S O ( 3 )$ equivariant representations on 3D point clouds. Proposing a variant of the capsule networks, we operate on a sparse set of rotations specified by the input LRFs thereby circumventing the effort to cover the entire $S O ( 3 )$ . Our network natively consumes a compact representation of the group of 3D rotations - quaternions, and we have theoretically shown its equivariance. We have also established convergence results for our Weiszfeld dynamic routing by making connections to the literature of robust optimization. Our network is among the few for having an explicit group-valued latent space and thus naturally estimates the orientation of the input shape, even without a supervision signal.
190
+
191
+ Limitations. In the current form our performance is severely affected by the shape symmetries. The length of the activation vector depends on the number of classes and for achieving sufficiently descriptive latent vectors we need to have a significant number of classes. On the other side, this allows us to perform with merit on problems where the number of classes are large. Although, we have reported robustness to those, the computation of LRFs are still sensitive to the point density changes and resampling. LRFs themselves are also ambiguous and sometimes non-unique.
192
+
193
+ Future work. Inspired by Cohen et al. (2019) and Poulenard & Ovsjanikov (2018) our feature work will involve establishing invariance to the direction in the tangent plane. We also plan to apply our network in the broader context of 3D object detection under arbitrary rotations and look for equivariances among point resampling.
194
+
195
+ # REFERENCES
196
+
197
+ P. Afshar, A. Mohammadi, and K. N. Plataniotis. Brain tumor type classification via capsule networks. In 2018 25th IEEE International Conference on Image Processing (ICIP), 2018.
198
+
199
+ Khurrum Aftab and Richard Hartley. Convergence of iteratively re-weighted least squares to robust m-estimators. In 2015 IEEE Winter Conference on Applications of Computer Vision. IEEE, 2015.
200
+
201
+ Khurrum Aftab, Richard Hartley, and Jochen Trumpf. Generalized weiszfeld algorithms for lq optimization. IEEE transactions on pattern analysis and machine intelligence, 37(4), 2014.
202
+
203
+ Khurrum Aftab, Richard Hartley, and Jochen Trumpf. $l _ { q }$ closest-point to affine subspaces using the generalized weiszfeld algorithm. International Journal of Computer Vision, 114(1):1–15, 2015.
204
+
205
+ Yasuhiro Aoki, Hunter Goforth, Rangaprasad Arun Srivatsan, and Simon Lucey. Pointnetlk: Robust & efficient point cloud registration using pointnet. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7163–7172, 2019.
206
+
207
+ Erkao Bao and Linqi Song. Equivariant neural networks and equivarification. arXiv preprint arXiv:1906.07172, 2019.
208
+
209
+ Gary Becigneul and Octavian-Eugen Ganea. Riemannian adaptive optimization methods. ´ arXiv preprint arXiv:1810.00760, 2018.
210
+
211
+ Paul J Besl and Neil D McKay. Method for registration of 3-d shapes. In Sensor fusion IV: control paradigms and data structures, volume 1611, pp. 586–606. International Society for Optics and Photonics, 1992.
212
+
213
+ Tolga Birdal and Slobodan Ilic. Point pair features based object detection and pose estimation revisited. In 2015 International Conference on 3D Vision, pp. 527–535. IEEE, 2015.
214
+
215
+ Tolga Birdal and Slobodan Ilic. A point sampling algorithm for 3d matching of irregular geometries. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2017.
216
+
217
+ Tolga Birdal, Umut Simsekli, Mustafa Onur Eken, and Slobodan Ilic. Bayesian pose graph optimization via bingham distributions and tempered geodesic mcmc. In Advances in Neural Information Processing Systems, pp. 308–319, 2018.
218
+
219
+ Wouter Boomsma and Jes Frellsen. Spherical convolutions and their application in molecular modelling. In Advances in Neural Information Processing Systems 30, pp. 3433–3443. 2017.
220
+
221
+ C Sidney Burrus. Iterative reweighted least squares. OpenStax CNX. Available online: http://cnx. org/contents/92b90377-2b34-49e4-b26f-7fe572db78a1, 12, 2012.
222
+
223
+ Benjamin Busam, Tolga Birdal, and Nassir Navab. Camera pose filtering with local regression geodesics on the riemannian manifold of dual quaternions. In IEEE International Conference on Computer Vision Workshop (ICCVW), October 2017.
224
+
225
+ Rudrasis Chakraborty, Monami Banerjee, and Baba C Vemuri. H-cnns: Convolutional neural networks for riemannian homogeneous spaces. arXiv preprint arXiv:1805.05487, 2018.
226
+
227
+ Taco Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning, pp. 2990–2999, 2016.
228
+
229
+ Taco Cohen, Mario Geiger, and Maurice Weiler. A general theory of equivariant cnns on homogeneous spaces. arXiv preprint arXiv:1811.02017, 2018a.
230
+
231
+ Taco S Cohen and Max Welling. Steerable cnns. International Conference on Learning Representations (ICLR), 2017.
232
+
233
+ Taco S. Cohen, Mario Geiger, Jonas Kohler, and Max Welling. Spherical cnns. 2018b. ¨
234
+
235
+ Taco S Cohen, Maurice Weiler, Berkay Kicanaoglu, and Max Welling. Gauge equivariant convolutional networks and the icosahedral cnn. arXiv preprint arXiv:1902.04615, 2019.
236
+
237
+ Javier Cruz-Mota, Iva Bogdanova, Benoˆıt Paquier, Michel Bierlaire, and Jean-Philippe Thiran. Scale invariant feature transform on the sphere: Theory and applications. International Journal of Computer Vision, 98(2):217–241, June 2012.
238
+
239
+ Haowen Deng, Tolga Birdal, and Slobodan Ilic. Ppf-foldnet: Unsupervised learning of rotation invariant 3d local descriptors. In European Conference on Computer Vision (ECCV), 2018a.
240
+
241
+ Haowen Deng, Tolga Birdal, and Slobodan Ilic. Ppfnet: Global context aware local features for robust 3d point matching. In Conference on Computer Vision and Pattern Recognition, 2018b.
242
+
243
+ Carlos Esteves, Christine Allen-Blanchette, Ameesh Makadia, and Kostas Daniilidis. Learning so (3) equivariant representations with spherical cnns. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 52–68, 2018.
244
+
245
+ Carlos Esteves, Avneesh Sud, Zhengyi Luo, Kostas Daniilidis, and Ameesh Makadia. Cross-domain 3d equivariant image embeddings. In International Conference on Machine Learning (ICML), 2019a.
246
+
247
+ Carlos Esteves, Yinshuang Xu, Christine Allen-Blanchette, and Kostas Daniilidis. Equivariant multiview networks. arXiv preprint arXiv:1904.00993, 2019b.
248
+
249
+ Matthias Fey, Jan Eric Lenssen, Frank Weichert, and Heinrich Muller. Splinecnn: Fast geometric ¨ deep learning with continuous b-spline kernels. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
250
+
251
+ C Lee Giles and Tom Maxwell. Learning, invariance, and generalization in high-order neural networks. Applied optics, 26(23):4972–4978, 1987.
252
+
253
+ Geoffrey E Hinton, Alex Krizhevsky, and Sida D Wang. Transforming auto-encoders. In International Conference on Artificial Neural Networks, pp. 44–51. Springer, 2011.
254
+
255
+ Hugues Hoppe, Tony DeRose, Tom Duchamp, John McDonald, and Werner Stuetzle. Surface reconstruction from unorganized points, volume 26.2. ACM, 1992.
256
+
257
+ Ayush Jaiswal, Wael AbdAlmageed, Yue Wu, and Premkumar Natarajan. Capsulegan: Generative adversarial capsule network. In Computer Vision – ECCV 2018 Workshops, pp. 526–535. Springer International Publishing, 2019.
258
+
259
+ Chiyu Max Jiang, Jingwei Huang, Karthik Kashinath, Prabhat, Philip Marcus, and Matthias Niessner. Spherical CNNs on unstructured grids. In International Conference on Learning Representations, 2019.
260
+
261
+ Marc Khoury, Qian-Yi Zhou, and Vladlen Koltun. Learning compact geometric features. In Proceedings of the IEEE International Conference on Computer Vision, pp. 153–161, 2017.
262
+
263
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
264
+
265
+ Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. arXiv preprint arXiv:1802.03690, 2018.
266
+
267
+ Risi Kondor, Zhen Lin, and Shubhendu Trivedi. Clebsch–gordan nets: a fully fourier space spherical convolutional neural network. In Advances in Neural Information Processing Systems, 2018.
268
+
269
+ Adam R. Kosiorek, Sara Sabour, Yee Whye Teh, and Geoffrey E. Hinton. Stacked capsule autoencoders. arXiv preprint arXiv:1906.06818, 2019.
270
+
271
+ Soren Laue, Matthias Mitterreiter, and Joachim Giesen. Computing higher order derivatives of ¨ matrix and tensor expressions. In Advances in Neural Information Processing Systems, 2018.
272
+
273
+ Jan Eric Lenssen, Matthias Fey, and Pascal Libuschewski. Group equivariant capsule networks. In Advances in Neural Information Processing Systems, pp. 8844–8853, 2018.
274
+
275
+ Jiaxin Li, Ben M Chen, and Gim Hee Lee. So-net: Self-organizing network for point cloud analysis. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2018a.
276
+
277
+ Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. Pointcnn: Convolution on x-transformed points. In Advances in Neural Information Processing Systems, 2018b.
278
+
279
+ Shuai Liao, Efstratios Gavves, and Cees GM Snoek. Spherical regression: Learning viewpoints, surface normals and 3d rotations on n-spheres. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9759–9767, 2019.
280
+
281
+ Min Liu, Fupin Yao, Chiho Choi, Sinha Ayan, and Karthik Ramani. Deep learning 3d shapes using alt-az anisotropic 2-sphere convolution. In International Conference on Learning Representations (ICLR), 2019a.
282
+
283
+ Xinhai Liu, Zhizhong Han, Yu-Shen Liu, and Matthias Zwicker. Point2sequence: Learning the shape representation of 3d point clouds with an attention-based sequence to sequence network. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 8778–8785, 2019b.
284
+
285
+ David G Luenberger, Yinyu Ye, et al. Linear and nonlinear programming. Springer, 1984.
286
+
287
+ Jan R Magnus. On differentiating eigenvalues and eigenvectors. Econometric Theory, 1(2), 1985.
288
+
289
+ Diego Marcos, Michele Volpi, Nikos Komodakis, and Devis Tuia. Rotation equivariant vector field networks. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017.
290
+
291
+ F Landis Markley, Yang Cheng, John Lucas Crassidis, and Yaakov Oshman. Averaging quaternions. Journal of Guidance, Control, and Dynamics, 30(4):1193–1197, 2007.
292
+
293
+ Daniel Maturana and Sebastian Scherer. Voxnet: A 3d convolutional neural network for real-time object recognition. In Intelligent Robots and Systems (IROS). IEEE, 2015.
294
+
295
+ Eloi Mehr, Andre Lieutier, Fernando Sanchez Bermudez, Vincent Guitteny, Nicolas Thome, and ´ Matthieu Cord. Manifold learning in quotient spaces. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9165–9174, 2018.
296
+
297
+ Simone Melzi, Riccardo Spezialetti, Federico Tombari, Michael M. Bronstein, Luigi Di Stefano, and Emanuele Rodola. Gframes: Gradient-based local reference frame for 3d shape matching. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
298
+
299
+ Alioscia Petrelli and Luigi Di Stefano. On the repeatability of the local reference frame for partial shape matching. In 2011 International Conference on Computer Vision. IEEE, 2011.
300
+
301
+ Alioscia Petrelli and Luigi Di Stefano. A repeatable and efficient canonical reference for surface matching. In 2012 Second International Conference on 3D Imaging, Modeling, Processing, Visualization & Transmission, pp. 403–410. IEEE, 2012.
302
+
303
+ Adrien Poulenard and Maks Ovsjanikov. Multi-directional geodesic neural networks via equivariant convolution. In SIGGRAPH Asia 2018 Technical Papers, pp. 236. ACM, 2018.
304
+
305
+ Charles R Qi, Hao Su, Matthias Nießner, Angela Dai, Mengyuan Yan, and Leonidas J Guibas. Volumetric and multi-view cnns for object classification on 3d data. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5648–5656, 2016.
306
+
307
+ Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 652–660, 2017a.
308
+
309
+ Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. In Advances in neural information processing systems, pp. 5099–5108, 2017b.
310
+
311
+ S Hamid Rezatofighi, Anton Milan, Ehsan Abbasnejad, Anthony Dick, Ian Reid, et al. Deepsetnet: Predicting sets with deep neural networks. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 5257–5266. IEEE, 2017.
312
+
313
+ Sara Sabour, Nicholas Frosst, and Geoffrey E Hinton. Dynamic routing between capsules. In Advances in neural information processing systems, pp. 3856–3866, 2017.
314
+
315
+ Sara Sabour, Nicholas Frosst, and G Hinton. Matrix capsules with em routing. In 6th International Conference on Learning Representations, ICLR, 2018.
316
+
317
+ Kristof Schutt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre ¨ Tkatchenko, and Klaus-Robert Muller. Schnet: A continuous-filter convolutional neural network ¨ for modeling quantum interactions. In Advances in Neural Information Processing Systems. 2017.
318
+
319
+ Yiru Shen, Chen Feng, Yaoqing Yang, and Dong Tian. Mining point cloud local structures by kernel correlation and graph pooling. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4548–4557, 2018.
320
+
321
+ Riccardo Spezialetti, Samuele Salti, and Luigi Di Stefano. Learning an effective equivariant 3d descriptor without supervision. arXiv preprint arXiv:1909.06887, 2019.
322
+
323
+ Norman Earl Steenrod. The topology of fibre bundles, volume 14. Princeton University Press, 1951.
324
+
325
+ Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018.
326
+
327
+ Federico Tombari, Samuele Salti, and Luigi Di Stefano. Unique signatures of histograms for local surface description. In European conference on computer vision, pp. 356–369. Springer, 2010.
328
+
329
+ Dilin Wang and Qiang Liu. An optimization view on dynamic routing between capsules, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HJjtFYJDf.
330
+
331
+ Shenlong Wang, Simon Suo, Wei-Chiu Ma, Andrei Pokrovsky, and Raquel Urtasun. Deep parametric continuous convolutional neural networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
332
+
333
+ Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E. Sarma, Michael M. Bronstein, and Justin M. Solomon. Dynamic graph cnn for learning on point clouds. ACM Transactions on Graphics (TOG), 2019.
334
+
335
+ Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. In Advances in Neural Information Processing Systems, pp. 10381–10392, 2018a.
336
+
337
+ Maurice Weiler, Fred A. Hamprecht, and Martin Storath. Learning steerable filters for rotation equivariant cnns. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018b.
338
+
339
+ Daniel Worrall and Gabriel Brostow. Cubenet: Equivariance to 3d rotation and translation. In The European Conference on Computer Vision (ECCV), September 2018.
340
+
341
+ Daniel E. Worrall, Stephan J. Garbin, Daniyar Turmukhambetov, and Gabriel J. Brostow. Harmonic networks: Deep translation and rotation equivariance. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
342
+
343
+ Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1912–1920, 2015.
344
+
345
+ Zhang Xinyi and Lihui Chen. Capsule graph neural network. In International Conference on Learning Representations (ICLR), 2019. URL openreview.net/forum?id ${ . } = { }$ Byl8BnRcYm.
346
+
347
+ Yang You, Yujing Lou, Qi Liu, Yu-Wing Tai, Weiming Wang, Lizhuang Ma, and Cewu Lu. Prin: Pointwise rotation-invariant network. arXiv preprint arXiv:1811.09361, 2018.
348
+
349
+ Wentao Yuan, David Held, Christoph Mertz, and Martial Hebert. Iterative transformer network for 3d point cloud. arXiv preprint arXiv:1811.11209, 2018.
350
+
351
+ Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep sets. In Advances in Neural Information Processing Systems. 2017.
352
+
353
+ Yongheng Zhao, Tolga Birdal, Haowen Deng, and Federico Tombari. 3d point capsule networks. In Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
354
+
355
+ # A PROOF OF PROPOSITION 1
356
+
357
+ Before presenting the proof we recall the three individual statements contained in Prop. 1:
358
+
359
+ 1. $\mathcal { A } ( \mathbf { g } \circ \mathbf { S } , \mathbf { w } )$ is left-equivariant: $\mathcal { A } ( \mathbf { g } \circ \mathbf { S } , \mathbf { w } ) = \mathbf { g } \circ \mathcal { A } ( \mathbf { S } , \mathbf { w } )$ .
360
+ 2. Operator $\mathcal { A }$ is invariant under permutations: $\begin{array} { r l } { \mathcal { A } \big ( \{ \mathbf { q } _ { \sigma ( 1 ) } , \dots , \mathbf { q } _ { \sigma ( Q ) } \} , \mathbf { w } _ { \sigma } \big ) } & { { } = } \end{array}$ $\mathcal { A } ( \{ \mathbf { q } _ { 1 } , \hdots , \mathbf { q } _ { Q } \} , \mathbf { w } )$ .
361
+ 3. The transformations $\mathbf { g } \in \mathbb { H } _ { 1 }$ preserve the geodesic distance $\delta ( \cdot )$ .
362
+
363
+ Proof. We will prove the propositions in order.
364
+
365
+ 1. We start by transforming each element and replace $\mathbf { q } _ { i }$ by $\left( \mathbf { g } \circ \mathbf { q } _ { i } \right)$ of the cost in Eq (4):
366
+
367
+ $$
368
+ \begin{array} { r l } { \mathbf { q } ^ { \top } \mathbf { M } \mathbf { q } = \mathbf { q } ^ { \top } \Big ( \underset { \left( - 1 \right) } { \overset { \triangledown } { \sum } } w _ { 1 } \mathbf { q } , \mathbf { q } _ { 1 } ^ { \top } \Big ) \mathbf { q } } & { } \\ & { = \mathbf { q } ^ { \top } \left( \underset { \left( - 1 \right) } { \overset { \triangledown } { \sum } } w _ { 1 } ( \mathbf { g } \mathbf { \cdot } \mathbf { q } _ { 1 } ) ( \mathbf { g } \mathbf { \cdot } \mathbf { q } _ { 1 } ) ^ { \top } \right) \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \left( \underset { \left( - 1 \right) } { \overset { \triangledown } { \sum } } w _ { 1 } \mathbf { G } \mathbf { q } , \mathbf { q } _ { 1 } ^ { \top } \mathbf { G } ^ { - } \right) \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \left( \underset { \left( - 1 \right) } { \overset { \triangledown } { \sum } } w _ { 1 } \mathbf { G } \mathbf { q } , \mathbf { q } ^ { \top } \mathbf { G } ^ { - } \right) \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \left( \mathbf { G } \mathbf { M } _ { 1 } \mathbf { G } ^ { \top } + \dots + \mathbf { G } \mathbf { M } _ { 0 } \mathbf { G } ^ { \top } \right) \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \mathbf { G } \mathbf { \cdot } \left( \mathbf { M } _ { 1 } \mathbf { G } ^ { \top } + \dots + \mathbf { M } _ { 0 } \mathbf { G } ^ { \top } \right) \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \mathbf { G } \left( \mathbf { M } _ { 1 } \mathbf { + } \dots + \mathbf { M } _ { 0 } \right) \mathbf { G } ^ { \top } \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \mathbf { G } \mathbf { M } \mathbf { G } ^ { \top } \mathbf { q } } \\ & { = \mathbf { q } ^ { \top } \mathbf { G } \mathbf { q } \mathbf { G } ^ { \top } \mathbf { q } } \\ & { = \mathbf { p } ^ { \top } \mathbf { M } \mathbf { p } , } \end{array}
369
+ $$
370
+
371
+ where $\mathbf { M } _ { i } \ = \ w _ { i } \mathbf { q } _ { i } \mathbf { q } _ { i } ^ { \top }$ and $\mathbf { p _ { \lambda } } = \mathbf { G } ^ { \top } \mathbf { q }$ . From orthogonallity of $\mathbf { G }$ it follows $\mathrm { ~ \bf ~ p ~ } =$ $\mathbf { G } ^ { - 1 } \mathbf { q } \implies \mathbf { g } \circ \mathbf { p } = \dot { \mathbf { q } }$ and hence $\mathbf { g } \circ \mathcal { A } ( \mathbf { S } , \mathbf { w } ) = \mathcal { A } ( \mathbf { g } \circ \mathbf { S } , \mathbf { w } )$ .
372
+
373
+ 2. The proof follows trivially from the permutation invariance of the symmetric summation operator over the outer products in Eq (8).
374
+
375
+ 3. It is sufficient to show that $| \mathbf { q } _ { 1 } ^ { \top } \mathbf { q } _ { 2 } | = | ( \mathbf { g } \circ \mathbf { q } _ { 1 } ) ^ { \top } ( \mathbf { g } \circ \mathbf { q } _ { 2 } ) |$ for any $\mathbf { g } \in \mathbb { H } _ { 1 }$ :
376
+
377
+ $$
378
+ \begin{array} { r l } { \left| \left( \mathbf { g } \circ \mathbf { q } _ { 1 } \right) ^ { \top } ( \mathbf { g } \circ \mathbf { q } _ { 2 } ) \right| = | \mathbf { q } _ { 1 } ^ { \top } \mathbf { G } ^ { \top } \mathbf { G } \mathbf { q } _ { 2 } | } & { } \\ & { = | \mathbf { q } _ { 1 } ^ { \top } \mathbf { I } \mathbf { q } _ { 2 } | } \\ & { = | \mathbf { q } _ { 1 } ^ { \top } \mathbf { q } _ { 2 } | , } \end{array}
379
+ $$
380
+
381
+ where $\mathbf { g } \circ \mathbf { q } \equiv \mathbf { G q }$ . The result is a direct consequence of the orthonormality of $\mathbf { G }$ .
382
+
383
+ # B PROOF OF LEMMA 1
384
+
385
+ We will begin by recalling some preliminary definitions and results that aid us to construct the connection between the dynamic routing and the Weiszfeld algorithm.
386
+
387
+ Definition 9 (Affine Subspace). A $d$ -dimensional affine subspace of $R ^ { N }$ is obtained by a translation of a $d$ -dimensional linear subspace $V \subset \mathbb { R } ^ { N }$ such that the origin is included in $S$ :
388
+
389
+ $$
390
+ S = \Big \{ \sum _ { i = 1 } ^ { d + 1 } \alpha _ { i } \mathbf { x } _ { i } \vert \sum _ { i = 1 } ^ { d + 1 } \alpha _ { i } = 1 \Big \} .
391
+ $$
392
+
393
+ Simplest choices for $S$ involve points, lines and planes of the Euclidean space.
394
+
395
+ Definition 10 (Orthogonal Projection onto an Affine Subspace). An orthogonal projection of a point $\mathbf { x } \in \mathbb { R } ^ { N }$ onto an affine subspace explained by the pair $( \mathbf { A } , \mathbf { c } )$ is defined as:
396
+
397
+ $$
398
+ \Pi _ { i } ( { \bf x } ) \triangleq { p r o j _ { S } ( { \bf x } ) } = { \bf c } + { \bf A } ( { \bf x } - { \bf c } ) .
399
+ $$
400
+
401
+ c denotes the translation to make origin inclusive and A is a projection matrix typically defined via the orthonormal bases of the subspace.
402
+
403
+ Definition 11 (Distance to Affine Subspaces). Distance from a given point x to a set of affine subspaces $\{ S _ { 1 } , S _ { 2 } \ldots S _ { k } \}$ can be written as Aftab et al. (2015):
404
+
405
+ $$
406
+ C ( \mathbf { x } ) = \sum _ { i = 1 } ^ { k } d ( \mathbf { x } , S _ { i } ) = \sum _ { i = 1 } ^ { k } \| \mathbf { x } - p r o j _ { S _ { i } } ( \mathbf { x } ) \| ^ { 2 } .
407
+ $$
408
+
409
+ Lemma 2. Given that all the antipodal counterparts are mapped to the northern hemisphere, we will now think of the unit quaternion or versor as the unit normal of a four dimensional hyperplane $h$ , passing through the origin:
410
+
411
+ $$
412
+ h _ { i } ( \mathbf { x } ) = \mathbf { q } _ { i } ^ { \top } \mathbf { x } + q _ { d } : = 0 .
413
+ $$
414
+
415
+ $q _ { d }$ is an added term to compensate for the shift. When $q _ { d } = 0$ the origin is incident to the hyperplane. With this perspective, quaternion $\mathbf { q } _ { i }$ forms an affine subspace with $d = 4$ , for which the projection operator takes the form:
416
+
417
+ $$
418
+ p r o j _ { S _ { i } } ( \mathbf { p } ) = ( \mathbf { I } - \mathbf { q } _ { i } \mathbf { q } _ { i } ^ { \top } ) \mathbf { p }
419
+ $$
420
+
421
+ Proof. We consider Eq (19) for the case where $\mathbf c = \mathbf 0$ and $\mathbf { A } = ( \mathbf { I } - \mathbf { q q } ^ { \top } )$ . The former follows from the fact that our subspaces by construction pass through the origin. Thus, we only need to show that the matrix $\mathbf { A } = \mathbf { I } { - } \mathbf { q } \mathbf { \dot { q } } ^ { \top }$ is an orthogonal projection matrix onto the affine subspace spanned by q. To this end, it is sufficient to validate that $\mathbf { A }$ is symmetric and idempotent: $\mathbf { A } ^ { \top } \dot { \mathbf { A } } = \dot { \mathbf { A } } \mathbf { A } = \mathbf { A } ^ { \top } = \mathbf { A }$ . Note that by construction $\mathbf { q } ^ { \intercal } \mathbf { q }$ is a symmetric matrix and hence A itself. Using this property and the unit-ness of the quaternion, we arrive at the proof:
422
+
423
+ $$
424
+ \begin{array} { r l } & { \mathbf { A } ^ { \top } \mathbf { A } = ( \mathbf { I } - \mathbf { q } \mathbf { q } ^ { \top } ) ^ { \top } ( \mathbf { I } - \mathbf { q } \mathbf { q } ^ { \top } ) } \\ & { \qquad = ( \mathbf { I } - \mathbf { q } \mathbf { q } ^ { \top } ) ( \mathbf { I } - \mathbf { q } \mathbf { q } ^ { \top } ) } \\ & { \qquad = \mathbf { I } - 2 \mathbf { q } \mathbf { q } ^ { \top } + \mathbf { q } \mathbf { q } ^ { \top } \mathbf { q } \mathbf { q } ^ { \top } } \\ & { \qquad = \mathbf { I } - 2 \mathbf { q } \mathbf { q } ^ { \top } + \mathbf { q } \mathbf { q } ^ { \top } } \\ & { \qquad = \mathbf { I } - \mathbf { q } \mathbf { q } ^ { \top } \triangleq \mathbf { A } } \end{array}
425
+ $$
426
+
427
+ It is easy to verify that the projections are orthogonal to the quaternion that defines the subspace by showing $\mathrm { p r o j } _ { S } ( \mathbf { q } ) ^ { \top } \mathbf { q } = 0$ :
428
+
429
+ $$
430
+ \mathbf { q } ^ { \top } \operatorname { p r o j } _ { S } ( \mathbf { q } ) = \mathbf { q } ^ { \top } \mathbf { A } \mathbf { q } = \mathbf { q } ^ { \top } ( \mathbf { I } - \mathbf { q } \mathbf { q } ^ { \top } ) \mathbf { q } = \mathbf { q } ^ { \top } ( \mathbf { q } - \mathbf { q } \mathbf { q } ^ { \top } \mathbf { q } ) = \mathbf { q } ^ { \top } ( \mathbf { q } - \mathbf { q } ) = 0 .
431
+ $$
432
+
433
+ Also note that this choice corresponds to $\begin{array} { r } { \operatorname { t r } ( \mathbf q \mathbf q ^ { \top } ) = \sum _ { i = 1 } ^ { d + 1 } \alpha _ { i } = 1 . } \end{array}$
434
+
435
+ Lemma 3. The quaternion mean we suggest to use in the main paper Markley et al. (2007) is equivalent to the Euclidean Weiszfeld mean on the affine quaternion subspaces.
436
+
437
+ Proof. We now recall and summarize the $L _ { q }$ -Weiszfeld Algorithm on affine subspaces Aftab et al. (2015), which minimizes a $q$ -norm variant of the cost defined in Eq (17):
438
+
439
+ $$
440
+ C _ { q } ( \mathbf { x } ) = \sum _ { i = 1 } ^ { k } d ( \mathbf { x } , S _ { i } ) = \sum _ { i = 1 } ^ { k } \| \mathbf { x } - \mathrm { p r o j } _ { S _ { i } } ( \mathbf { x } ) \| ^ { q } .
441
+ $$
442
+
443
+ Defining $\mathbf { M } _ { i } = \mathbf { I } - \mathbf { A } _ { i }$ , Alg. 2 summarizes the iterative procedure.
444
+
445
+ Note that when $q = 2$ , the algorithm reduces to the computation of a non-weighted mean $\mathbf { \nabla } _ { w _ { i } } =$ $1 \forall i )$ , and a closed form solution exists for Eq (29) and is given by the normal equations:
446
+
447
+ $$
448
+ \mathbf { x } = { \Big ( } \sum _ { i = 1 } ^ { k } w _ { i } \mathbf { M } _ { i } { \Big ) } ^ { - 1 } { \Big ( } \sum _ { i = 1 } ^ { k } w _ { i } \mathbf { M } _ { i } \mathbf { c } _ { i } { \Big ) }
449
+ $$
450
+
451
+ # Algorithm 2: $L _ { q }$ Weiszfeld Algorithm on Affine Subspaces Aftab et al. (2015).
452
+
453
+ 1 input: An initial guess $\mathbf { x } _ { \mathrm { 0 } }$ that does not lie any of the subspaces $\{ S _ { i } \}$ , Projection operators $\Pi _ { i }$ , the norm parameter $q$
454
+ 2 $\mathbf { x } ^ { t } \mathbf { x } _ { 0 }$
455
+ 3 while not converged do
456
+ 4 Compute the weights $\mathbf { w } ^ { t } = \{ w _ { i } ^ { t } \}$ : $w _ { i } ^ { t } = \| \mathbf { M } _ { i } ( \mathbf { x } ^ { t } - \mathbf { c } _ { i } ) \| ^ { q - 2 } \quad \forall i = 1 \ldots k$ (28)
457
+ 5 Solve: $\mathbf { x } ^ { t + 1 } = \underset { \mathbf { x } \in \mathbb { R } ^ { N } } { \arg \operatorname* { m i n } } \sum _ { i = 1 } ^ { k } w _ { i } ^ { t } \| \mathbf { M } _ { i } ( \mathbf { x } - \mathbf { c } _ { i } ) \| ^ { 2 }$ (29)
458
+
459
+ For the case of our quaternionic subspaces $\mathbf c = \mathbf 0$ and we seek the solution that satisfies:
460
+
461
+ $$
462
+ \biggl ( \sum _ { i = 1 } ^ { k } \mathbf { M } _ { i } \biggr ) \mathbf { x } = \Bigl ( \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \mathbf { M } _ { i } \Bigr ) \mathbf { x } = \mathbf { 0 } .
463
+ $$
464
+
465
+ It is well known that the solution to this equation under the constraint $\| \mathbf { x } \| = 1$ lies in nullspace of $\mathbf { M } = \textstyle { \frac { 1 } { k } } \sum _ { i = 1 } ^ { k } \mathbf { M } _ { i }$ and can be obtained by taking the singular vector of $\mathbf { M }$ that corresponds to the largest singular value. Since $\mathbf { M } _ { i }$ is idempotent, the same result can also be obtained through the eigendecomposition:
466
+
467
+ $$
468
+ \mathbf { q } ^ { \star } = \underset { \mathbf { q } \in \cal S ^ { 3 } } { \arg \operatorname* { m a x } } \mathbf { q M } \mathbf { q }
469
+ $$
470
+
471
+ which gives us the unweighted Quaternion mean Markley et al. (2007).
472
+
473
+ # C PROOF OF THEOREM 1
474
+
475
+ Once the Lemma 1 is proven, we only need to apply the direct convergence results from the literature. Consider a set of points $\mathbf { Y } = \{ \mathbf { y } _ { 1 } \ldots \mathbf { \bar { y } } _ { K } \}$ where $K > 2$ and $\mathbf { y } _ { i } \in \mathbb { H } _ { 1 }$ . Due to the compactness, we can speak of a ball $B ( \mathbf { o } , \rho )$ encapsulating all $\mathbf { y } _ { i }$ . We also define the $\mathcal { D } = \{ \mathbf { x } \in \mathbb { H } _ { 1 } | C _ { q } ( \mathbf { x } ) < C _ { q } ( \mathbf { o } ) \}$ , the region where the loss decreases.
476
+
477
+ We first state the assumptions that permit our theoretical result. These assumptions are required by the works that establish the convergence of such Weiszfeld algorithms Luenberger et al. (1984); Aftab & Hartley (2015); Aftab et al. (2014) :
478
+
479
+ H1. $\mathbf { y } _ { 1 } \ldots \mathbf { y } _ { K }$ should not lie on a single geodesic of the quaternion manifold.
480
+ H2. $\mathcal { D }$ is bounded and compact. The topological structure of $S O ( 3 )$ imposes a bounded convexity radius of $\rho < \pi / 2$ .
481
+ H3. The minimizer in $\operatorname { E q }$ (29) is continuous.
482
+ H4. The weighting function $\sigma ( \cdot )$ is concave and differentiable.
483
+ H5. Initial quaternion (in our network chosen randomly) does not belong to any of the subspaces.
484
+
485
+ Note that H5 is not a strict requirement as there are multiple ways to circumvent (simplest being a re-initialization). Under these assumptions, the sequence produced by Eq (29) will converge to a critical point unless $\mathbf { x } ^ { t } = \mathbf { y } _ { i }$ for any $t$ and $i$ Aftab et al. (2014). For $q = 1$ , this critical point is on one of the subspaces specified in Eq (18) and thus is a geometric median. □
486
+
487
+ Note that due to the assumption $\mathbf { H } 2$ , we cannot converge from any given point. For randomly initialized networks this is indeed a problem and does not guarantee practical convergence. Yet, in our experiments we have not observed any issue with the convergence of our dynamic routing. As our result is one of the few ones related to the analysis of DR, we still find this to be an important first step.
488
+
489
+ For different choices of $q : 1 \leq q \leq 2$ , the weights take different forms. In fact, this IRLS type of algorithm is shown to converge for a larger class of weighting choices as long as the aforementioned conditions are met. That is why in practice we use a simple sigmoid function.
490
+
491
+ # D OUR SIAMESE ARCHITECTURE AND THE ALGORITHM
492
+
493
+ For estimation of the relative pose with supervision, we benefit from a Siamese variation of our network. In this case, latent capsule representations of two point sets $\mathbf { X }$ and $\mathbf { Y }$ jointly contribute to the pose regression as shown in Fig. 5.
494
+
495
+ ![](images/32613bc5ee20bb121f5e818c93fea4b1c068606f5cf5797227071bcba74beb27.jpg)
496
+ Figure 5: Our siamese architecture used in the estimation of relative poses. We use a shared network to process two distinct point clouds $( \mathbf { X } , \mathbf { Y } )$ to arrive at the latent representations $( \mathbf { C } _ { X } , \pmb { \alpha } _ { X } )$ and $\left( \mathbf { C } _ { Y } , \pmb { \alpha } _ { Y } \right)$ respectively. We then look for the highest activated capsules in both point sets and compute the rotation from the corresponding capsules. Thanks to the rotations disentangled into capsules, this final step simplifies to a relative quaternion calculation.
497
+
498
+ We show additional results from the computation of local reference frames and the multi-channel capsules deduced from our network in Fig. 6.
499
+
500
+ Finally, the overall algorithm of our network is summarized under Alg. 3.
501
+
502
+ # Algorithm 3: Quaternion Equivariant Network
503
+
504
+ 1 input : Input points of one patch $\left\{ { \bf x } _ { 1 } , . . . , { \bf x } _ { K } \right\} \in \mathbb { R } ^ { K \times 3 }$ , input capsules (LRFs)
505
+ $\mathcal { Q } = \{ \mathbf { q } _ { 1 } , \dots , \mathbf { q } _ { L } \} \in \mathbb { H } _ { 1 } ^ { L }$ , with $L = N ^ { c } \cdot K$ , $N ^ { c }$ is the number of capsules per point,
506
+ activations ${ \pmb { \alpha } } = ( \alpha _ { 1 } , \ldots , \alpha _ { L } ) ^ { T }$
507
+ 2 output: Updated frames $\hat { \mathcal { Q } } = \{ \hat { \mathbf { q } } _ { 1 } , \hdots , \hat { \mathbf { q } } _ { M } \} \in \mathbb { H } _ { 1 } ^ { M }$ , updated activations $\hat { \pmb { \alpha } } = ( \hat { \alpha } _ { 1 } , \dots , \hat { \alpha } _ { M } ) ^ { T }$
508
+ 3 for Each input channel $n ^ { c }$ of all the primary capsules channels $N ^ { c }$ do
509
+ 4 $\mu ( n ^ { c } ) \dot { } A ( \mathcal { Q } ( n ^ { c } ) ) ~ / /$ Input quaternion average, see Eq (4)
510
+ 5 for Each point $\mathbf { x } _ { i }$ of this patch do
511
+ 6 $\lfloor \mathbf { x } _ { i } ^ { \prime } \gets \mu ( n ^ { c } ) ^ { - 1 } \circ \mathbf { x } _ { i } \ / /$ rotate point in a canonical orientation
512
+ 7 $\left\{ \mathbf { x } _ { i } ^ { \prime } \right\} \in \mathbb { R } ^ { K \times N ^ { c } \times 3 } / /$ Points in multiple $( N ^ { c } )$ ) canonical frames
513
+ 8 for Each point $\mathbf { x } _ { i } ^ { \prime }$ of this patch do
514
+ 9 $\lfloor \ \mathbf { t } \gets t ( \mathbf { x } _ { i } ^ { \prime } ) \ / /$ Point to Transform, $t ( \cdot ) : \mathbb { R } ^ { N ^ { c } \times 3 } \mathbb { R } ^ { N ^ { c } \times M \times 4 }$
515
+ 10 $\mathcal { T } \equiv \{ \mathbf { t } _ { i } \} \in \mathbb { H } _ { 1 } ^ { K \times N _ { i } ^ { c } \times M } \{ \mathbf { t } \} \in \mathbb { H } _ { 1 } ^ { L \times M }$
516
+ 11 (Qˆ, αˆ) ← DynamicRouting(X, Q, α, T ) // see Alg. 1
517
+
518
+ Alg. 3 summarizes the overall pipeline of our QE-net depicted in Fig. 3. We use multiple layers in a hierarchical architecture. In the first layer, the input primary capsules are represented by LRFs computed with FLARE algorithm Petrelli & Di Stefano (2012). Therefore, the number of input capsule channels $N ^ { c }$ in the first layer is equal to 1. Its activation is also defaulted to 1. The output of a former layer is propagated to the input of the latter, creating the hierarchy.
519
+
520
+ ![](images/d18441bae463b393e66d066047592194e51c259196fc6d99f80f376a6951b3f1.jpg)
521
+ Figure 6: Additional intermediate results on car (first row) and chair (second row) objects. This figure supplements Fig. 1 of the main paper.
522
+
523
+ ![](images/f3256f777f329920bda71d310cecfad9e94d40452c169893ecd2b898351960b0.jpg)
524
+ Figure 7: Confusion matrix on ModelNet10 for classification.
525
+
526
+ # E ADDITIONAL DETAILS ON EVALUATIONS
527
+
528
+ Details on the evaluation protocol. For Modelnet40 dataset used in Tab. 1, we used the official split with 9,843 shapes for training and 2,468 different shapes for testing. For rotation estimation in Tab. 2, we used the official Modelenet10 dataset split with 3991 for training and 908 shapes for testing. 3D point clouds (10K points) are randomly sampled from the mesh surfaces of each shape Qi et al. (2017a;b). The objects in training and testing dataset are different, but they are from the same categories so that they can be oriented meaningfully. During training, we did not augment the dataset with random rotations. All the shapes are trained with single orientation (well-aligned). We call this trained with NR. During testing, we randomly generate multiple arbitrary $S O ( 3 )$ rotations for each shape and evaluate the average performance for all the rotations. This is called test with $A R$ . This protocol is used in both our algorithms and the baselines.
529
+
530
+ Confusion of classification in ModelNet. We now report the confusion matrix in the task of classification on the all the objects of ModelNet10. The classification and rotation estimation affects one another. As we can see from Fig. 7, the first five categories that exhibit less rotational symmetry has the higher classification accuracy than their rotationally symmetric counterparts.
531
+
532
+ Distribution of errors reported in Tab. 2. We now provide more details on the errors attained by our algorithm as well as the state of the art. To this end, we report, in Fig. 8 the histogram of errors that fall within quantized ranges of orientation errors. It is noticeable that our Siamese architecture behaves best in terms of estimating the objects rotation. For completeness, we also included the results of the variants presented in our ablation studies: Ours-2kLRF, Ours-1kLRF. They evaluate the model on the re-calculated LRFs in order to show the robustness towards to various point densities. We have also modified IT-Net and PointNetLK only to predict rotation because the original works predict both rotations and translations. Finally, note here that we do not use data augmentation for training our networks (see AR), while both for PointNetLK and for IT-Net we do use augmentation.
533
+
534
+ ![](images/668420048419c858c37830ef87f4a1fdcf6e8d038fc2d0d2a7894a6fa713831a.jpg)
535
+
536
+ Figure 8: Cumulative error histograms of rotation estimation on ModelNet10. Each row $( < \theta ^ { \circ } )$ of this extended table shows the percentage of shapes that have rotation error less than $\theta$ . The colors of the bars correspond to the rows they reside in. The higher the errors are contained in the first bins (light blue) the better. Vice versa, the more the errors are clustered toward the $6 0 ^ { \circ }$ the worse the performance of the method.
md/train/BJIgi_eCZ/BJIgi_eCZ.md ADDED
@@ -0,0 +1,691 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FUSIONNET: FUSING VIA FULLY-AWARE ATTENTION WITH APPLICATION TO MACHINE COMPREHENSION
2
+
3
+ Hsin-Yuan Huang\*1,2, Chenguang $\mathbf { Z } \mathbf { h } \mathbf { u } ^ { \mathbf { 1 } }$ , Yelong Shen1, Weizhu Chen1
4
+
5
+ 1Microsoft Business AI and Research
6
+ 2National Taiwan University
7
+ momohuang@gmail.com, {chezhu,yeshen,wzchen}@microsoft.com
8
+
9
+ # ABSTRACT
10
+
11
+ This paper introduces a new neural structure called FusionNet, which extends existing attention approaches from three perspectives. First, it puts forward a novel concept of “history of word” to characterize attention information from the lowest word-level embedding up to the highest semantic-level representation. Second, it identifies an attention scoring function that better utilizes the “history of word” concept. Third, it proposes a fully-aware multi-level attention mechanism to capture the complete information in one text (such as a question) and exploit it in its counterpart (such as context or passage) layer by layer. We apply FusionNet to the Stanford Question Answering Dataset (SQuAD) and it achieves the first position for both single and ensemble model on the official SQuAD leaderboard at the time of writing (Oct. 4th, 2017). Meanwhile, we verify the generalization of FusionNet with two adversarial SQuAD datasets and it sets up the new state-of-the-art on both datasets: on AddSent, FusionNet increases the best F1 metric from $4 6 . 6 \%$ to $5 1 . 4 \%$ ; on AddOneSent, FusionNet boosts the best F1 metric from $5 6 . 0 \%$ to $6 0 . 7 \%$ .
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Teaching machines to read, process and comprehend text and then answer questions is one of key problems in artificial intelligence. Figure 1 gives an example of the machine reading comprehension task. It feeds a machine with a piece of context and a question and teaches it to find a correct answer to the question. This requires the machine to possess high capabilities in comprehension, inference and reasoning. This is considered a challenging task in artificial intelligence and has already attracted numerous research efforts from the neural network and natural language processing communities. Many neural network models have been proposed for this challenge and they generally frame this problem as a machine reading comprehension (MRC) task (Hochreiter & Schmidhuber, 1997; Wang et al., 2017; Seo et al., 2017; Shen et al., 2017; Xiong et al., 2017; Weissenborn et al., 2017; Chen et al., 2017a).
16
+
17
+ Context: The Alpine Rhine is part of the Rhine, a famous European river. The Alpine Rhine begins in the most western part of the Swiss canton of Graubünden, and later forms the border between Switzerland to the West and Liechtenstein and later Austria to the East. On the other hand, the Danube separates Romania and Bulgaria.
18
+
19
+ Question: What is the other country the Rhine separates Switzerland to?
20
+
21
+ Answer: Liechtenstein
22
+
23
+ The key innovation in recent models lies in how to ingest information in the question and characterize it in the context, in order to provide an accurate answer to the question. This is often modeled as attention in the neural network community, which is a mechanism to attend the question into the context so as to find the answer related to the question. Some (Chen et al., 2017a; Weissenborn et al., 2017) attend the word-level embedding from the question to context, while some (Wang et al., 2017) attend the high-level representation in the question to augment the context. However we observed that none of the existing approaches has captured the full information in the context or the question, which could be vital for complete information comprehension. Taking image recognition as an example, information in various levels of representations can capture different aspects of details in an image: pixel, stroke and shape. We argue that this hypothesis also holds in language understanding and MRC. In other words, an approach that utilizes all the information from the word embedding level up to the highest level representation would be substantially beneficial for understanding both the question and the context, hence yielding more accurate answers.
24
+
25
+ However, the ability to consider all layers of representation is often limited by the difficulty to make the neural model learn well, as model complexity will surge beyond capacity. We conjectured this is why previous literature tailored their models to only consider partial information. To alleviate this challenge, we identify an attention scoring function utilizing all layers of representation with less training burden. This leads to an attention that thoroughly captures the complete information between the question and the context. With this fully-aware attention, we put forward a multi-level attention mechanism to understand the information in the question, and exploit it layer by layer on the context side. All of these innovations are integrated into a new end-to-end structure called FusionNet in Figure 4, with details described in Section 3.
26
+
27
+ We submitted FusionNet to SQuAD (Rajpurkar et al., 2016), a machine reading comprehension dataset. At the time of writing (Oct. 4th, 2017), our model ranked in the first place in both single model and ensemble model categories. The ensemble model achieves an exact match (EM) score of $78 . 8 \%$ and F1 score of $8 5 . 9 \%$ . Furthermore, we have tested FusionNet against adversarial SQuAD datasets (Jia & Liang, 2017). Results show that FusionNet outperforms existing state-of-the-art architectures in both datasets: on AddSent, FusionNet increases the best F1 metric from $4 6 . 6 \%$ to $5 1 . 4 \%$ ; on AddOneSent, FusionNet boosts the best F1 metric from $5 6 . 0 \%$ to $6 0 . 7 \%$ . In Appendix D, we also applied to natural language inference task and shown decent improvement. This demonstrated the exceptional performance of FusionNet. An open-source implementation of FusionNet can be found at https://github.com/momohuang/FusionNet-NLI.
28
+
29
+ # 2 MACHINE COMPREHENSION & FULLY-AWARE ATTENTION
30
+
31
+ In this section, we briefly introduce the task of machine comprehension as well as a conceptual architecture that summarizes recent advances in machine reading comprehension. Then, we introduce a novel concept called history-of-word. History-of-word can capture different levels of contextual information to fully understand the text. Finally, a light-weight implementation for history-of-word, Fully-Aware Attention, is proposed.
32
+
33
+ # 2.1 TASK DESCRIPTION
34
+
35
+ In machine comprehension, given a context and a question, the machine needs to read and understand the context, and then find the answer to the question. The context is described as a sequence of word tokens: $C ~ = ~ \{ w _ { 1 } ^ { C } , \ldots , w _ { m } ^ { C } \}$ , and the question as: $\textit { \textbf { Q } } = \ \{ w _ { 1 } ^ { Q } , \ldots , w _ { n } ^ { Q } \}$ , where $m$ is the number of words in the context, and $n$ is the number of words in the question. In general, $m \gg n$ . The answer Ans can have different forms depending on the task. In the SQuAD dataset (Rajpurkar et al., 2016), the answer Ans is guaranteed to be a contiguous span in the context $C$ , e.g., $\mathbf { A n s } = \{ w _ { i } ^ { C } , \dots , w _ { i + k } ^ { C } \}$ , where $k$ is the number of words in the answer and $k \leq m$ .
36
+
37
+ # 2.2 CONCEPTUAL ARCHITECTURE FOR MACHINE READING COMPREHENSION
38
+
39
+ In all state-of-the-art architectures for machine reading comprehension, a recurring pattern is the following process. Given two sets of vectors, A and B, we enhance or modify every single vector in set A with the information from set B. We call this a fusion process, where set B is fused into set A. Fusion processes are commonly based on attention (Bahdanau et al., 2015), but some are not. Major improvements in recent MRC work lie in how the fusion process is designed.
40
+
41
+ A conceptual architecture illustrating state-of-the-art architectures is shown in Figure 2, which consists of three components.
42
+
43
+ • Input vectors: Embedding vectors for each word in the context and the question.
44
+
45
+ ![](images/ef53a9d62835839db03dd60fa5bf44c53d378371d9b1d0cebb4360838ecc5ed3.jpg)
46
+ Table 1: A summarized view on the fusion processes used in several state-of-the-art architectures.
47
+ Figure 2: A conceptual architecture illustrating recent advances in MRC.
48
+
49
+ • Integration components: The rectangular box. It is usually implemented using an RNN such as an LSTM (Hochreiter & Schmidhuber, 1997) or a GRU (Cho et al., 2014). • Fusion processes: The numbered arrows (1), (2), (2’), (3), $( 3 ^ { \circ } )$ . The set pointing outward is fused into the set being pointed to.
50
+
51
+ There are three main types of fusion processes in recent advanced architectures. Table 1 shows what fusion processes are used in different state-of-the-art architectures. We now discuss them in detail.
52
+
53
+ (1) Word-level fusion. By providing the direct word information in question to the context, we can quickly zoom in to more related regions in the context. However, it may not be helpful if a word has different semantic meaning based on the context. Many word-level fusions are not based on attention, e.g., (Hu et al., 2017; Chen et al., 2017a) appends binary features to context words, indicating whether each context word appears in the question.
54
+
55
+ (2) High-level fusion. Informing the context about the semantic information in the question could help us find the correct answer. But high-level information is more imprecise than word information, which may cause models to be less aware of details.
56
+
57
+ (2’) High-level fusion (Alternative). Similarly, we could also fuse high-level concept of $Q$ into the word-level of $C$ .
58
+
59
+ (3) Self-boosted fusion. Since the context can be long and distant parts of text may rely on each other to fully understand the content, recent advances have proposed to fuse the context into itself. As the context contains excessive information, one common choice is to perform self-boosted fusion after fusing the question $Q$ . This allows us to be more aware of the regions related to the question.
60
+
61
+ (3’) Self-boosted fusion (Alternative). Another choice is to directly condition the self-boosted fusion process on the question $Q$ , such as the coattention mechanism proposed in (Xiong et al., 2017). Then we can perform self-boosted fusion before fusing question information.
62
+
63
+ A common trait of existing fusion mechanisms is that none of them employs all levels of representation jointly. In the following, we claim that employing all levels of representation is crucial to achieving better text understanding.
64
+
65
+ # 2.3 FULLY-AWARE ATTENTION ON HISTORY OF WORD
66
+
67
+ Consider the illustration shown in Figure 3. As we read through the context, each input word will gradually transform into a more abstract representation, e.g., from low-level to high-level concepts. Altogether, they form the history of each word in our mental flow. For a human, we utilize the history-of-word so frequently but we often neglect its importance. For example, to answer the question in Figure 3 correctly, we need to focus on both the high-level concept of forms the border and the word-level information of Alpine Rhine. If we focus only on the high-level concepts, we will
68
+
69
+ Context: The Alpine Rhine is part of the Rhine, a famous European river. The Alpine Rhine begins in the most western part of the Swiss canton of Graubünden, and later forms the border between Switzerland to the West and Liechtenstein and later Austria to the East. On the other hand, the Danube separates Romania and Bulgaria.
70
+
71
+ Question: What is the other country the Rhine separates Switzerland to?
72
+
73
+ Answer: Liechtenstein
74
+
75
+ ![](images/d3b58b3a8ba2ca6de01ca0430c65b35e60ff963f937f77dd27b865c4cf91802f.jpg)
76
+ Figure 3: Illustrations of the history-of-word for the example shown in Figure 1. Utilizing the entire history-of-word is crucial for the full understanding of the context.
77
+
78
+ confuse Alpine Rhine with Danube since both are European rivers that separate countries. Therefore we hypothesize that the entire history-of-word is important to fully understand the text.
79
+
80
+ In neural architectures, we define the history of the $i$ -th word, $\mathrm { H o W } _ { i }$ , to be the concatenation of all the representations generated for this word. This may include word embedding, multiple intermediate and output hidden vectors in RNN, and corresponding representation vectors in any further layers. To incorporate history-of-word into a wide range of neural models, we present a lightweight implementation we call Fully-Aware Attention.
81
+
82
+ Attention can be applied to different scenarios. To be more conclusive, we focus on attention applied to fusing informatiotext bodies A and B: $\{ h _ { 1 } ^ { A } , \ldots , h _ { m } ^ { A } \}$ y, $\{ h _ { 1 } ^ { B } , \ldots , h _ { n } ^ { B } \} \subset \mathbb { R } ^ { d }$ two sets of hidden vectors for words in. Their associated history-of-word are, $\{ \mathrm { H o W } _ { 1 } ^ { A } , \dots , \mathrm { H o W } _ { m } ^ { A } \} , ~ \{ \mathrm { H o W } _ { 1 } ^ { B } , \dots , \mathrm { H o W } _ { n } ^ { B } \} \subset \mathbb { R } ^ { d _ { h } } ,$
83
+
84
+ where $d _ { h } \gg d$ . Fusing body $\mathbf { B }$ to body A via standard attention means for every $ { \boldsymbol { h } } _ { i } ^ { A }$ in body A,
85
+
86
+ 1. Compute an attention score $S _ { i j } = S ( \pmb { h } _ { i } ^ { A } , \pmb { h } _ { j } ^ { B } ) \in \mathbb { R }$ for each $h _ { j } ^ { B }$ in body $\mathbf { B }$ .
87
+ 2. Form the attention weight $\alpha _ { i j }$ through softmax: $\begin{array} { r } { \alpha _ { i j } = \exp ( S _ { i j } ) / \sum _ { k } \exp ( S _ { i k } ) } \end{array}$ .
88
+ 3. Concatenate $ { \boldsymbol { h } } _ { i } ^ { A }$ with the summarized information, $\begin{array} { r } { \hat { \pmb { h } } _ { i } ^ { A } = \sum _ { j } \alpha _ { i j } \pmb { h } _ { j } ^ { B } } \end{array}$ .
89
+
90
+ In fully-aware attention, we replace attention score computation with the history-of-word.
91
+
92
+ $$
93
+ S ( h _ { i } ^ { A } , h _ { j } ^ { B } ) \implies S ( \mathrm { H o W } _ { i } ^ { A } , \mathrm { H o W } _ { j } ^ { B } ) .
94
+ $$
95
+
96
+ This allows us to be fully aware of the complete understanding of each word. The ablation study in Section 4.4 demonstrates that this lightweight enhancement offers a decent improvement in performance.
97
+
98
+ To fully utilize history-of-word in attention, we need a suitable attention scoring function $S ( { \pmb x } , { \pmb y } )$ . A commonly used function is multiplicative attention (Britz et al., 2017): $\pmb { x } ^ { T } \pmb { U } ^ { T } \pmb { V } \pmb { y }$ , leading to
99
+
100
+ $$
101
+ \begin{array} { r } { S _ { i j } = ( \mathrm { H o W } _ { i } ^ { A } ) ^ { T } U ^ { T } V ( \mathrm { H o W } _ { j } ^ { B } ) , } \end{array}
102
+ $$
103
+
104
+ where $U , V ~ \in ~ \mathbb { R } ^ { k \times d _ { h } }$ , and $k$ is the attention hidden size. However, we suspect that two large matrices interacting directly will make the neural model harder to train. Therefore we propose to constrain the matrix $U ^ { T } V$ to be symmetric. A symmetric matrix can always be decomposed into $U ^ { T } D U$ , thus
105
+
106
+ $$
107
+ \begin{array} { r } { S _ { i j } = ( \mathrm { H o W } _ { i } ^ { A } ) ^ { T } U ^ { T } D U ( \mathrm { H o W } _ { j } ^ { B } ) , } \end{array}
108
+ $$
109
+
110
+ where $U \in \mathbb { R } ^ { k \times d _ { h } }$ , $D \in \mathbb { R } ^ { k \times k }$ and $D$ is a diagonal matrix. The symmetric form retains the ability to give high attention score between dissimilar $\mathrm { \bar { H } o W } _ { i } ^ { A } , \mathrm { H o W } _ { j } ^ { B }$ . Additionally, we marry nonlinearity with the symmetric form to provide richer interaction among different parts of the history-of-word. The final formulation for attention score is
111
+
112
+ $$
113
+ S _ { i j } = f ( U ( \mathrm { H o W } _ { i } ^ { A } ) ) ^ { T } D ~ f ( U ( \mathrm { H o W } _ { j } ^ { B } ) ) ,
114
+ $$
115
+
116
+ where $f ( x )$ is an activation function applied element-wise. In the following context, we employ $f ( x ) = \operatorname* { m a x } ( 0 , x )$ . A detailed ablation study in Section 4 demonstrates its advantage over many alternatives.
117
+
118
+ ![](images/0257ec1f4f3ec3d036b2ec9c1a8204d14a2dfc7469e37a1de56bf42b7d5b2f0c.jpg)
119
+ Figure 4: An illustration of FusionNet architecture. Each upward arrow represents one layer of BiLSTM. Each circle to the right is a detailed illustration of the corresponding component in FusionNet. Circle 1: Fully-aware attention between $C$ and $Q$ . Illustration of Equation (C1) in Section 3.1. Circle 2: Concatenate all concepts in $C$ with multi-level $Q$ information, then pass through BiLSTM. Illustration of Equation (C2) in Section 3.1.
120
+
121
+ Circle 3: Fully-aware attention on the context $C$ itself. Illustration of Equation (C3) in Section 3.1. Circle 4: Concatenate the understanding vector of $C$ with self-attention information, then pass through BiLSTM. Illustration of Equation (C4) in Section 3.1.
122
+
123
+ # 3 FULLY-AWARE FUSION NETWORK
124
+
125
+ # 3.1 END-TO-END ARCHITECTURE
126
+
127
+ Based on fully-aware attention, we propose an end-to-end architecture: the fully-aware fusion network (FusionNet). Given text A and B, FusionNet fuses information from text $\mathbf { B }$ to text A and generates two set of vectors
128
+
129
+ $$
130
+ U _ { A } = \{ \pmb { u } _ { 1 } ^ { A } , \ldots , \pmb { u } _ { m } ^ { A } \} , \quad U _ { B } = \{ \pmb { u } _ { 1 } ^ { B } , \ldots , \pmb { u } _ { n } ^ { B } \} .
131
+ $$
132
+
133
+ In the following, we consider the special case where text A is context $C$ and text $\mathbf { B }$ is question $Q$ .
134
+ An illustration for FusionNet is shown in Figure 4. It consists of the following components.
135
+
136
+ Input Vectors. First, each word in $C$ and $Q$ is transformed into an input vector $\textbf { \em w }$ . We utilize the 300-dim GloVe embedding (Pennington et al., 2014) and 600-dim contextualized vector (McCann et al., 2017). In the SQuAD task, we also include 12-dim POS embedding, 8-dim NER embedding and a normalized term frequency for context $C$ as suggested in (Chen et al., 2017a). Together $\{ \pmb { w } _ { 1 } ^ { C } , \ldots , \pmb { w } _ { m } ^ { C } \} \subset \mathbb { R } ^ { 9 0 0 + 2 0 + 1 }$ , and $\{ \pmb { w } _ { 1 } ^ { Q } , \ldots , \pmb { w } _ { n } ^ { Q } \} \subset \mathbb { R } ^ { 9 0 0 }$ .
137
+
138
+ Fully-Aware Multi-level Fusion: Word-level. In multi-level fusion, we separately consider fusing word-level and higher-level. Word-level fusion informs $C$ about what kind of words are in $Q$ . It is illustrated as arrow (1) in Figure 2. For this component, we follow the approach in (Chen et al., 2017a) First, a feature vector $\mathrm { e m } _ { i }$ is created for each word in $C$ to indicate whether the word occurs in the question $Q$ . Second, attention-based fusion on GloVe embedding $\mathbf { \nabla } _ { \mathbf { \boldsymbol { g } } _ { i } }$ is used
139
+
140
+ $$
141
+ \hat { g } _ { i } ^ { C } = \sum _ { j } \alpha _ { i j } g _ { j } ^ { Q } , \quad \alpha _ { i j } \propto \exp ( S ( g _ { i } ^ { C } , g _ { j } ^ { Q } ) ) , \quad S ( x , y ) = \mathrm { R e L U } ( W x ) ^ { T } \mathrm { R e L U } ( W y ) ,
142
+ $$
143
+
144
+ where $W \in \mathbb { R } ^ { 3 0 0 \times 3 0 0 }$ . Since history-of-word is the input vector itself, fully-aware attention is not employed here. The enhanced input vector for context is $\mathbf { \tilde { w } } _ { i } ^ { C } = [ \mathbf { w } _ { i } ^ { C } ; \mathrm { e m } _ { i } ; \bar { \mathbf { g } } _ { i } ^ { C } ]$ .
145
+
146
+ Reading. In the reading component, we use a separate bidirectional LSTM (BiLSTM) to form low-level and high-level concepts for $C$ and $Q$ .
147
+
148
+ $$
149
+ { h } _ { 1 } ^ { C l } , \dots , { h } _ { m } ^ { C l } = \mathrm { B i L S T M } ( \tilde { w } _ { 1 } ^ { C } , \dots , \tilde { w } _ { m } ^ { C } ) , \quad { h } _ { 1 } ^ { Q l } , \dots , { h } _ { n } ^ { Q l } = \mathrm { B i L S T M } ( w _ { 1 } ^ { Q } , \dots , w _ { n } ^ { Q } ) ,
150
+ $$
151
+
152
+ $$
153
+ { h } _ { 1 } ^ { C h } , \ldots , { h } _ { m } ^ { C h } = \mathrm { B i L S T M } ( { h } _ { 1 } ^ { C l } , \ldots , { h } _ { m } ^ { C l } ) , \quad { h } _ { 1 } ^ { Q h } , \ldots , { h } _ { n } ^ { Q h } = \mathrm { B i L S T M } ( { h } _ { 1 } ^ { Q l } , \ldots , { h } _ { n } ^ { Q l } ) .
154
+ $$
155
+
156
+ Hence low-level and high-level concepts $h ^ { l } , h ^ { h } \in \mathbb { R } ^ { 2 5 0 }$ are created for each word.
157
+
158
+ Question Understanding. In the Question Understanding component, we apply a new BiLSTM taking in both ${ h ^ { Q l } , h ^ { Q h } }$ to obtain the final question representation $U _ { Q }$ :
159
+
160
+ $$
161
+ \begin{array} { r } { U _ { Q } = \{ \boldsymbol { { u } } _ { 1 } ^ { Q } , \ldots , \boldsymbol { { u } } _ { n } ^ { Q } \} = \mathrm { { B i L S T M } } ( [ \boldsymbol { h } _ { 1 } ^ { Q l } ; \boldsymbol { h } _ { 1 } ^ { Q h } ] , \ldots , [ \boldsymbol { h } _ { n } ^ { Q l } ; \boldsymbol { h } _ { n } ^ { Q h } ] ) . } \end{array}
162
+ $$
163
+
164
+ where $\{ \boldsymbol { u } _ { i } ^ { Q } \in \mathbb { R } ^ { 2 5 0 } \} _ { i = 1 } ^ { n }$ are the understanding vectors for $Q$
165
+
166
+ Fully-Aware Multi-level Fusion: Higher-level. This component fuses all higher-level information in the question $Q$ to the context $C$ through fully-aware attention on history-of-word. Since the proposed attention scoring function for fully-aware attention is constrained to be symmetric, we need to identify the common history-of-word for both $C , Q$ . This yields
167
+
168
+ $$
169
+ \mathrm { H o W } _ { i } ^ { C } = [ \pmb { g } _ { i } ^ { C } ; \pmb { c } _ { i } ^ { C } ; \pmb { h } _ { i } ^ { C l } ; \pmb { h } _ { i } ^ { C h } ] , ~ \mathrm { H o W } _ { i } ^ { Q } = [ \pmb { g } _ { i } ^ { Q } ; \pmb { c } _ { i } ^ { Q } ; \pmb { h } _ { i } ^ { Q l } ; \pmb { h } _ { i } ^ { Q h } ] \in \mathbb { R } ^ { 1 4 0 0 } ,
170
+ $$
171
+
172
+ where $\mathbf { \pmb { g } } _ { i }$ is the GloVe embedding and $c _ { i }$ is the CoVe embedding. Then we fuse low, high, and understanding-level information from $Q$ to $C$ via fully-aware attention. Different sets of attention weights are calculated through attention function $S ^ { \tilde { l } } ( x , y ) , S ^ { h } ( x , y ) , S ^ { u } ( x , y )$ to combine low, high, and understanding-level of concepts. All three functions are the proposed symmetric form with nonlinearity in Section 2.3, but are parametrized by independent parameters to attend to different regions for different level. Attention hidden size is set to be $k = 2 5 0$ .
173
+
174
+ $$
175
+ \begin{array} { r } { \hat { \boldsymbol { h } } _ { i } ^ { C l } = \sum _ { j } \alpha _ { i j } ^ { l } \boldsymbol { h } _ { j } ^ { Q l } , \quad \alpha _ { i j } ^ { l } \propto \exp ( S ^ { l } ( \mathrm { H o W } _ { i } ^ { C } , \mathrm { H o W } _ { j } ^ { Q } ) ) . } \end{array}
176
+ $$
177
+
178
+ 2. High-level fusion: $\begin{array} { r } { \hat { \boldsymbol { \mathsf { h } } } _ { i } ^ { C h } = \sum _ { j } \alpha _ { i j } ^ { h } \boldsymbol { h } _ { j } ^ { Q h } , \quad \alpha _ { i j } ^ { h } \propto \exp ( S ^ { h } ( \mathrm { H o W } _ { i } ^ { C } , \mathrm { H o W } _ { j } ^ { Q } ) ) . } \end{array}$
179
+
180
+ This multi-level attention mechanism captures different levels of information independently, while taking all levels of information into account. A new BiLSTM is applied to obtain the representation for $C$ fully fused with information in the question $Q$ :
181
+
182
+ $$
183
+ \{ \pmb { v } _ { 1 } ^ { C } , \ldots , \pmb { v } _ { m } ^ { C } \} = \mathrm { B i L S T M } ( [ { \pmb { h } } _ { 1 } ^ { C l } ; { \pmb { h } } _ { 1 } ^ { C h } ; { \hat { \pmb { h } } } _ { 1 } ^ { C l } ; { \hat { \pmb { h } } } _ { 1 } ^ { C h } ; { \hat { \pmb { u } } } _ { 1 } ^ { C l } ] , \ldots , [ { \pmb { h } } _ { m } ^ { C l } ; { \pmb { h } } _ { m } ^ { C h } ; { \hat { \pmb { h } } } _ { m } ^ { C l } ; { \hat { \pmb { h } } } _ { m } ^ { C h } ; { \hat { \pmb { u } } } _ { m } ^ { C } ] ) .
184
+ $$
185
+
186
+ Fully-Aware Self-Boosted Fusion. We now use self-boosted fusion to consider distant parts in the context, as illustrated by arrow (3) in Figure 2. Again, we achieve this via fully-aware attention on history-of-word. We identify the history-of-word to be
187
+
188
+ $$
189
+ \operatorname { H o W } _ { i } ^ { C } = [ \pmb { g } _ { i } ^ { C } ; \pmb { c } _ { i } ^ { C } ; \pmb { h } _ { i } ^ { C l } ; \pmb { h } _ { i } ^ { C h } ; \hat { \pmb { h } } _ { i } ^ { C l } ; \hat { \pmb { h } } _ { i } ^ { C h } ; \hat { \pmb { u } } _ { i } ^ { C } ; \pmb { v } _ { i } ^ { C } ] \in \mathbb { R } ^ { 2 4 0 0 } .
190
+ $$
191
+
192
+ We then perform fully-aware attention, $\begin{array} { r } { \hat { \pmb v } _ { i } ^ { C } = \sum _ { j } \alpha _ { i j } ^ { s } \pmb { v } _ { j } ^ { C } , \alpha _ { i j } ^ { s } \propto \exp ( S ^ { s } ( \mathrm { H o W } _ { i } ^ { C } , \mathrm { H o W } _ { j } ^ { C } ) ) . } \end{array}$ The final context representation is obtained by
193
+
194
+ $$
195
+ U _ { C } = \{ \pmb { u } _ { 1 } ^ { C } , \ldots , \pmb { u } _ { m } ^ { C } \} = \mathrm { B i L S T M } ( [ \pmb { v } _ { 1 } ^ { C } ; \hat { \pmb { v } } _ { 1 } ^ { C } ] , \ldots , [ \pmb { v } _ { m } ^ { C } ; \hat { \pmb { v } } _ { m } ^ { C } ] ) .
196
+ $$
197
+
198
+ $\{ \boldsymbol { u } _ { i } ^ { C } \in \mathbb { R } ^ { 2 5 0 } \} _ { i = 1 } ^ { m }$ are the understanding vectors for $C$
199
+
200
+ After these components in FusionNet, we have created the understanding vectors, $U _ { C }$ , for the context $C$ , which are fully fused with the question $Q$ . We also have the understanding vectors, $U _ { Q }$ , for the question $Q$ .
201
+
202
+ # 3.2 APPLICATION IN MACHINE COMPREHENSION
203
+
204
+ We focus particularly on the output format in $\mathrm { S Q u A D }$ (Rajpurkar et al., 2016) where the answer is always a span in the context. The output of FusionNet are the understanding vectors for both $C$ and $Q$ , $U _ { C } = \{ \mathbf { { u } } _ { 1 } ^ { C } , \dots , \mathbf { { u } } _ { m } ^ { C } \}$ , $U _ { Q } = \{ \bar { \pmb { u } } _ { 1 } ^ { Q } , \dots , \pmb { u } _ { n } ^ { Q } \}$ .
205
+
206
+ We then use them to find the answer span in the context. Firstly, a single summarized question understanding vector is obtained through $\begin{array} { r } { { \pmb u } ^ { Q } = \sum _ { i } \beta _ { i } { \pmb u } _ { i } ^ { Q } } \end{array}$ , where $\beta _ { i } \propto \mathrm { { e x p } } ( { \pmb w } ^ { T } { \pmb u } _ { i } ^ { Q } )$ and $\pmb { w }$ is a trainable vector. Then we attend for the span start using the summarized question understanding vector $\pmb { u } ^ { Q }$ ,
207
+
208
+ $$
209
+ P _ { i } ^ { S } \propto \exp ( ( \boldsymbol { \mathbf { \mathit { u } } } ^ { Q } ) ^ { T } W _ { S } \boldsymbol { \mathbf { \mathit { u } } } _ { i } ^ { C } ) ,
210
+ $$
211
+
212
+ where $W _ { S } \in \mathbb { R } ^ { d \times d }$ is a trainable matrix. To use the information of the span start when we attend for the span end, we combine the context understanding vector for the span start with $\pmb { u } ^ { Q }$ through a GRU (Cho et al., 2014), $\begin{array} { r } { { \pmb v } ^ { Q } = \mathrm { G R U } ( { \pmb u } ^ { Q } , \sum _ { i } P _ { i } ^ { S } { \pmb u } _ { i } ^ { \top } ) } \end{array}$ , where $\pmb { u } ^ { Q }$ is taken as the memory and $\textstyle \sum _ { i } P _ { i } ^ { S } { \boldsymbol { u } } _ { i } ^ { C }$ as the input in GRU. Finally we attend for the end of the span using $v ^ { Q }$ ,
213
+
214
+ $$
215
+ P _ { i } ^ { E } \propto \exp ( ( \pmb { v } ^ { Q } ) ^ { T } W _ { E } \pmb { u } _ { i } ^ { C } ) ,
216
+ $$
217
+
218
+ where $W _ { E } \in \mathbb { R } ^ { d \times d }$ is another trainable matrix.
219
+
220
+ Training. During training, we maximize the log probabilities of the ground truth span start and end, $\begin{array} { r } { \sum _ { k } ( \log \mathsf { \bar { ( } } P _ { i _ { k } ^ { s } } ^ { S } ) + \mathsf { \bar { l o g } } ( P _ { i _ { k } ^ { e } } ^ { E } ) ) } \end{array}$ , where $i _ { k } ^ { s } , i _ { k } ^ { e }$ are the answer span for the $k$ -th instance.
221
+
222
+ Prediction. We predict the answer span to be $i ^ { s } , i ^ { e }$ with the maximum $P _ { i ^ { s } } ^ { S } P _ { i ^ { e } } ^ { E }$ under the constraint $0 \leq i ^ { e } - i ^ { s } \leq 1 5$ .
223
+
224
+ # 4 EXPERIMENTS
225
+
226
+ In this section, we first present the datasets used for evaluation. Then we compare our end-toend FusionNet model with existing machine reading models. Finally, we conduct experiments to validate the effectiveness of our proposed components. Additional ablation study on input vectors can be found in Appendix C. Detailed experimental settings can be found in Appendix E.
227
+
228
+ # 4.1 DATASETS
229
+
230
+ We focus on the SQuAD dataset (Rajpurkar et al., 2016) to train and evaluate our model. SQuAD is a popular machine comprehension dataset consisting of $1 0 0 { , } 0 0 0 { + }$ questions created by crowd workers on 536 Wikipedia articles. Each context is a paragraph from an article and the answer to each question is guaranteed to be a span in the context.
231
+
232
+ While rapid progress has been made on SQuAD, whether these systems truly understand language remains unclear. In a recent paper, Jia & Liang (2017) proposed several adversarial schemes to test the understanding of the systems. We will use the following two adversarial datasets, AddOneSent and AddSent, to evaluate our model. For both datasets, a confusing sentence is appended at the end of the context. The appended sentence is model-independent for AddOneSent, while AddSent requires querying the model a few times to choose the most confusing sentence.
233
+
234
+ # 4.2 MAIN RESULTS
235
+
236
+ We submitted our model to SQuAD for evaluation on the hidden test set. We also tested the model on the adversarial SQuAD datasets. Two official evaluation criteria are used: Exact Match (EM) and F1 score. EM measures how many predicted answers exactly match the correct answer, while F1 score measures the weighted average of the precision and recall at token level. The evaluation results for our model and other competing approaches are shown in Table 2.1 Additional comparisons with state-of-the-art models in the literature can be found in Appendix A.
237
+
238
+ For the two adversarial datasets, AddOneSent and AddSent, the evaluation criteria is the same as SQuAD. However, all models are trained only on the original SQuAD, so the model never sees the
239
+
240
+ <table><tr><td>AddSent</td><td>EM/F1</td></tr><tr><td>LRBaseline</td><td>17.0/23.2</td></tr><tr><td>Match-LSTM (E) BiDAF (E)</td><td>24.3 /34.2 29.6 /34.2</td></tr><tr><td>SEDT (E) Mnemonic Reader (S)</td><td>30.0 /35.0</td></tr><tr><td>Mnemonic Reader (E)</td><td>39.8/46.6</td></tr><tr><td></td><td>40.7 / 46.2</td></tr><tr><td>ReasoNet (E) FusionNet (E)</td><td>34.6 /39.4 46.2 / 51.4</td></tr></table>
241
+
242
+ Table 2: The performance of FusionNet and competing approaches on SQuAD hidden test set at the time of writing (Oct. 4th, 2017).
243
+
244
+ <table><tr><td>AddOneSent</td><td>EM/F1</td></tr><tr><td>LRBaseline Match-LSTM (E)</td><td>22.3/30.4 34.8 / 41.8</td></tr><tr><td>BiDAF (E) SEDT (E)</td><td>40.7 /46.9 40.0 / 46.5</td></tr><tr><td>Mnemonic Reader (S)</td><td>48.5 /56.0</td></tr><tr><td>Mnemonic Reader (E)</td><td>48.7 / 55.3</td></tr><tr><td>ReasoNet (E) FusionNet (E)</td><td>43.6 /49.8</td></tr></table>
245
+
246
+ Table 3: Comparison on AddSent. (S: Single model, E: Ensemble)
247
+
248
+ <table><tr><td>Single Model</td><td>Test Set EM/F1</td></tr><tr><td>LR Baseline (Rajpurkar et al., 2016) Match-LSTM (Wang &amp; Jiang,2016) BiDAF (Seo et al., 2017) SEDT (Liu et al., 2017) RaSoR (Lee et al., 2016) DrQA (Chen et al., 2017a) ReasoNet (Shen et al.,2017) R.Mnemonic Reader (Hu et al., 2017) DCN+ R-nett FusionNet</td><td>40.4 /51.0 64.7/73.7 68.0 / 77.3 68.2 /77.5 70.8/78.7 70.7 /79.4 70.6 / 79.4 73.2/81.8 74.9 / 82.8 75.7 /83.5 76.0 / 83.9</td></tr><tr><td>EnsembleModel ReasoNet (Shen et al., 2017) MEMEN (Pan et al., 2017) R.Mnemonic Reader (Hu et al., 2017) R-nett DCN+ FusionNet</td><td>75.0 / 82.3 75.4/82.7 77.7 / 84.9 78.2/85.2 78.7 / 85.6</td></tr><tr><td>Human (Rajpurkar et al., 2016)</td><td>78.8 / 85.9 82.3/91.2</td></tr></table>
249
+
250
+ Table 4: Comparison on AddOneSent. (S: Single model, E: Ensemble)
251
+
252
+ adversarial datasets during training. The results for AddSent and AddOneSent are shown in Table 3
253
+ and Table 4, respectively.2
254
+
255
+ From the results, we can see that our models not only perform well on the original SQuAD dataset, but also outperform all previous models by more than $5 \%$ in EM score on the adversarial datasets. This shows that FusionNet is better at language understanding of both the context and question.
256
+
257
+ # 4.3 COMPARISON ON ATTENTION FUNCTION
258
+
259
+ In this experiment, we compare the performance of different attention scoring functions $S ( { \pmb x } , { \pmb y } )$ for fully-aware attention. We utilize the end-to-end architecture presented in Section 3.1. Fully-aware attention is used in two places, fully-aware multi-level fusion: higher level and fully-aware selfboosted fusion. Word-level fusion remains unchanged. Based on the discussion in Section 2.3, we consider the following formulations for comparison:
260
+
261
+ 1. Additive attention (MLP) (Bahdanau et al., 2015): $\pmb { s } ^ { T } \operatorname { t a n h } ( W _ { 1 } \pmb { x } + W _ { 2 } \pmb { y } ) .$ 1
262
+ 2. Multiplicative attention: $\pmb { x } ^ { T } \pmb { U } ^ { T } \pmb { V } \pmb { y }$ .
263
+ 3. Scaled multiplicative attention: $\scriptstyle { \frac { 1 } { \sqrt { k } } } x ^ { T } U ^ { T } V y$ , where $k$ is the attention hidden size. It is
264
+ proposed in (Vaswani et al., 2017).
265
+ 4. Scaled multiplicative with nonlinearity: $\begin{array} { r } { \frac { 1 } { \sqrt { k } } f ( U \pmb { x } ) ^ { T } f ( V \pmb { y } ) } \end{array}$ .
266
+ 5. Our proposed symmetric form: $\pmb { x } ^ { T } \pmb { U } ^ { T } \pmb { D } \pmb { U } \pmb { y }$ , where $D$ is diagonal.
267
+ 6. Proposed symmetric form with nonlinearity: $f ( U \mathbf { x } ) ^ { T } D f ( U \mathbf { y } )$ .
268
+
269
+ We consider the activation function $f ( x )$ to be $\operatorname* { m a x } ( 0 , x )$ . The results of various attention functions on SQuAD development set are shown in Table 5. It is clear that the symmetric form consistently outperforms all alternatives. We attribute this gain to the fact that symmetric form has a single large matrix $U$ . All other alternatives have two large parametric matrices. During optimization, these two parametric matrices would interfere with each other and it will make the entire optimization process challenging. Besides, by constraining $U ^ { T } V$ to be a symmetric matrix $U ^ { T } D U$ , we retain the ability for $_ { \textbf { \em x } }$ to attend to dissimilar $\textbf { { y } }$ . Furthermore, its marriage with the nonlinearity continues to significantly boost the performance.
270
+
271
+ Table 5: Comparison of different attention functions $S ( { \pmb x } , { \pmb y } )$ on SQuAD dev set.
272
+
273
+ <table><tr><td rowspan=1 colspan=1>Attention Function</td><td rowspan=1 colspan=1>EM/F1</td></tr><tr><td rowspan=1 colspan=1>Additive (MLP)</td><td rowspan=2 colspan=1>71.8/ 80.172.1 / 80.672.4 / 80.772.6 / 80.8</td></tr><tr><td rowspan=1 colspan=1>MultiplicativeScaled MultiplicativeScaled Multiplicative + ReLU</td></tr><tr><td rowspan=1 colspan=1>Symmetric FormSymmetric Form + ReLU</td><td rowspan=1 colspan=1>73.1 /81.575.3 / 83.6</td></tr><tr><td rowspan=1 colspan=1>Previous SotA (Hu et al., 2017)</td><td rowspan=1 colspan=1>72.1/ 81.6</td></tr></table>
274
+
275
+ Table 6: Comparison of different configurations demonstrates the effectiveness of history-of-word.
276
+
277
+ <table><tr><td rowspan=1 colspan=2>ConfigurationC,Q Fusion Self C</td><td rowspan=1 colspan=1>EM/F1</td></tr><tr><td rowspan=1 colspan=1>High-LevelFA High-LevelFA All-LevelFA Multi-Level</td><td rowspan=1 colspan=1>None</td><td rowspan=1 colspan=1>64.6/73.273.3 /81.472.3 / 80.774.6 / 82.7</td></tr><tr><td rowspan=1 colspan=1>FA Multi-Level</td><td rowspan=1 colspan=1>NormalFA</td><td rowspan=1 colspan=1>74.4 / 82.675.3 / 83.6</td></tr><tr><td rowspan=1 colspan=2>Previous SotA (Hu et al., 2017)</td><td rowspan=1 colspan=1>72.1/ 81.6</td></tr></table>
278
+
279
+ # 4.4 EFFECTIVENESS OF HISTORY-OF-WORD
280
+
281
+ In FusionNet, we apply the history-of-word and fully-aware attention in two major places to achieve good performance: multi-level fusion and self-boosted fusion. In this section, we present experiments to demonstrate the effectiveness of our application. In the experiments, we fix the attention function to be our proposed symmetric form with nonlinearity due to its good performance shown in Section 4.3. The results are shown in Table 6, and the details for each configuration can be found in Appendix B.
282
+
283
+ High-Level is a vanilla model where only the high-level information is fused from $Q$ to $C$ via standard attention. When placed in the conceptual architecture (Figure 2), it only contains arrow (2) without any other fusion processes.
284
+
285
+ FA High-Level is the High-Level model with standard attention replaced by fully-aware attention.
286
+
287
+ FA All-Level is a naive extension of FA High-Level, where all levels of information are concatenated and is fused into the context using the same attention weight.
288
+
289
+ FA Multi-Level is our proposed Fully-aware Multi-level fusion, where different levels of information are attended under separate attention weight.
290
+
291
+ Self $C = \mathbf { N o n e }$ means we do not make use of self-boosted fusion.
292
+
293
+ Self $C = \mathrm { { N o r m a l } }$ means we employ a standard attention-based self-boosted fusion after fusing question to context. This is illustrated as arrow (3) in the conceptual architecture (Figure 2).
294
+
295
+ Self $C = \mathbf { F } \mathbf { A }$ means we enhance the self-boosted fusion with fully-aware attention.
296
+
297
+ High-Level vs. FA High-Level. From Table 6, we can see that High-Level performs poorly as expected. However enhancing this vanilla model with fully-aware attention significantly increase the performance by more than $8 \%$ . The performance of FA High-Level already outperforms many state-of-the-art MRC models. This clearly demonstrates the power of fully-aware attention.
298
+
299
+ FA All-Level vs. FA Multi-Level. Next, we consider models that fuse all levels of information from question $Q$ to context $C$ . FA All-Level is a naive extension of FA High-Level, but its performance is actually worse than $F A$ High-Level. However, by fusing different parts of history-of-word in $Q$ independently as in $F A$ Multi-Level, we are able to further improve the performance.
300
+
301
+ Self $C$ options. We have achieved decent performance without self-boosted fusion. Now, we compare adding normal and fully-aware self-boosted fusion into the architecture. Comparing None and Normal in Table 6, we can see that the use of normal self-boosted fusion is not very effective under our improved $C , Q$ Fusion. Then by comparing with $F A$ , it is clear that through the enhancement of fully-aware attention, the enhanced self-boosted fusion can provide considerable improvement.
302
+
303
+ Together, these experiments demonstrate that the ability to take all levels of understanding as a whole is crucial for machines to better understand the text.
304
+
305
+ # 5 CONCLUSIONS
306
+
307
+ In this paper, we describe a new deep learning model called FusionNet with its application to machine comprehension. FusionNet proposes a novel attention mechanism with following three contributions: 1. the concept of history-of-word to build the attention using complete information from the lowest word-level embedding up to the highest semantic-level representation; 2. an attention scoring function to effectively and efficiently utilize history-of-word; 3. a fully-aware multi-level fusion to exploit information layer by layer discriminatingly. We applied FusionNet to MRC task and experimental results show that FusionNet outperforms existing machine reading models on both the SQuAD dataset and the adversarial SQuAD dataset. We believe FusionNet is a general and improved attention mechanism and can be applied to many tasks. Our future work is to study its capability in other NLP problems.
308
+
309
+ # ACKNOWLEDGMENTS
310
+
311
+ We would like to thank Paul Mineiro, Sebastian Kochman, Pengcheng He, Jade Huang and Jingjing Liu from Microsoft Business AI, Mac-Antoine Rondeau from Maluuba and the anonymous reviewers for their valuable comments and tremendous help in this paper.
312
+
313
+ # REFERENCES
314
+
315
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2015.
316
+
317
+ Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In EMNLP, 2015.
318
+
319
+ Denny Britz, Anna Goldie, Thang Luong, and Quoc Le. Massive exploration of neural machine translation architectures. arXiv preprint arXiv:1703.03906, 2017.
320
+
321
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer opendomain questions. arXiv preprint arXiv:1704.00051, 2017a.
322
+
323
+ Qian Chen, Xiaodan Zhu, Zhenhua Ling, Si Wei, and Hui Jiang. Enhancing and combining sequential and tree lstm for natural language inference. ACL, 2017b.
324
+
325
+ 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. EMNLP, 2014.
326
+
327
+ Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In NIPS, 2016.
328
+
329
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997.
330
+
331
+ Minghao Hu, Yuxing Peng, and Xipeng Qiu. Reinforced mnemonic reader for machine comprehension. arXiv preprint arXiv:1705.02798, 2017.
332
+
333
+ Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. EMNLP, 2017.
334
+
335
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
336
+
337
+ Kenton Lee, Shimi Salant, Tom Kwiatkowski, Ankur Parikh, Dipanjan Das, and Jonathan Berant. Learning recurrent span representations for extractive question answering. arXiv preprint arXiv:1611.01436, 2016.
338
+
339
+ Rui Liu, Junjie Hu, Wei Wei, Zi Yang, and Eric Nyberg. Structural embedding of syntactic trees for machine comprehension. arXiv preprint arXiv:1703.00572, 2017.
340
+ B. McCann, J. Bradbury, C. Xiong, and R. Socher. Learned in Translation: Contextualized Word Vectors. arXiv preprint arXiv:1708.00107, 2017.
341
+ Boyuan Pan, Hao Li, Zhou Zhao, Bin Cao, Deng Cai, and Xiaofei He. Memen: Multi-layer embedding with memory networks for machine comprehension. arXiv preprint arXiv:1707.09098, 2017.
342
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
343
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. EMNLP, 2016.
344
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. In ICLR, 2017.
345
+ Yelong Shen, Po-Sen Huang, Jianfeng Gao, and Weizhu Chen. Reasonet: Learning to stop reading in machine comprehension. In KDD, 2017.
346
+ Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 2014.
347
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. 2017.
348
+ Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. arXiv preprint arXiv:1608.07905, 2016.
349
+ Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In ACL, 2017.
350
+ Zhiguo Wang, Haitao Mi, Wael Hamza, and Radu Florian. Multi-perspective context matching for machine comprehension. arXiv preprint arXiv:1612.04211, 2016.
351
+ Dirk Weissenborn, Georg Wiese, and Laura Seiffe. Making neural qa as simple as possible but not simpler. In CoNLL, 2017.
352
+ Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
353
+ Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. ICLR, 2017.
354
+
355
+ # A COMPARISON WITH PUBLISHED MODELS
356
+
357
+ In this appendix, we compare with published state-of-the-art architectures on the SQuAD dev set. The comparison is shown in Figure 5 and 6 for EM and F1 score respectively. The performance of FusionNet is shown under different training epochs. Each epoch loops through all the examples in the training set once. On a single NVIDIA GeForce GTX Titan X GPU, each epoch took roughly 20 minutes when batch size 32 is used.
358
+
359
+ The state-of-the-art models compared in this experiment include:
360
+ 1. Published version of R-net in their technical report (Wang et al., 2017),
361
+ 2. Reinforced Mnemonic Reader (Hu et al., 2017), 3. MEMEN (Pan et al., 2017),
362
+ 4. ReasoNet (Shen et al., 2017), 5. Document reader (DrQA) (Chen et al., 2017a),
363
+ 6. DCN (Xiong et al., 2017), 7. DCN $^ +$ character embedding (Char) $^ +$ CoVe (McCann et al., 2017),
364
+ 8. BiDAF (Seo et al., 2017), 9. the best-performing variant of Match-LSTM (Wang & Jiang, 2016).
365
+
366
+ ![](images/83cd5a9f9a0174460ffcd39b92ddb060f758e9749cab54075cd31bb5c5f087b2.jpg)
367
+ Figure 5: EM score on the SQuAD dev set under different training epoch.
368
+
369
+ ![](images/d8a5b20b41be47ba0875b1e75dbb679e81f4e2b06dd71346b750da38f888986b.jpg)
370
+ Figure 6: F1 score on the SQuAD dev set under different training epoch.
371
+
372
+ # B DETAILED CONFIGURATIONS IN THE ABLATION STUDY
373
+
374
+ In this appendix, we present details for the configurations used in the ablation study in Section 4.4. For all configurations, the understanding vectors for both the context $C$ and the question $Q$ will be generated, then we follow the same output architecture in Section 3.2 to apply them to machine reading comprehension problem.
375
+
376
+ High-Level. Firstly, context words and question words are transformed into input vectors in the same way as FusionNet,
377
+
378
+ $$
379
+ \{ \pmb { w } _ { 1 } ^ { C } , \ldots , \pmb { w } _ { m } ^ { C } \} , \quad \{ \pmb { w } _ { 1 } ^ { Q } , \ldots , \pmb { w } _ { n } ^ { Q } \} .
380
+ $$
381
+
382
+ Then we pass them independently to two layers of BiLSTM.
383
+
384
+ $$
385
+ \begin{array} { r l } & { h _ { 1 } ^ { C l } , \ldots , h _ { m } ^ { C l } = \mathrm { B i L S T M } ( w _ { 1 } ^ { C } , \ldots , w _ { m } ^ { C } ) , \quad h _ { 1 } ^ { Q l } , \ldots , h _ { n } ^ { Q l } = \mathrm { B i L S T M } ( w _ { 1 } ^ { Q } , \ldots , w _ { n } ^ { Q } ) , } \\ & { h _ { 1 } ^ { C h } , \ldots , h _ { m } ^ { C h } = \mathrm { B i L S T M } ( h _ { 1 } ^ { C l } , \ldots , h _ { m } ^ { C l } ) , \quad h _ { 1 } ^ { Q h } , \ldots , h _ { n } ^ { Q h } = \mathrm { B i L S T M } ( h _ { 1 } ^ { Q l } , \ldots , h _ { n } ^ { Q l } ) . } \end{array}
386
+ $$
387
+
388
+ Next we consider the standard attention-based fusion for the high level representation.
389
+
390
+ $$
391
+ \hat { \boldsymbol { h } } _ { i } ^ { C h } = \sum _ { j } \alpha _ { i j } \boldsymbol { h } _ { j } ^ { Q h } , \quad \alpha _ { i j } = \frac { \exp ( S _ { i j } ) } { \sum _ { k } \exp ( S _ { i k } ) } , \quad S _ { i j } = S ( \boldsymbol { h } _ { i } ^ { C h } , \boldsymbol { h } _ { j } ^ { Q h } ) .
392
+ $$
393
+
394
+ Then we concatenate the attended vector $\hat { h } _ { i } ^ { C h }$ with the original high level representation $h _ { i } ^ { C h }$ and pass through two layers of BiLSTM to fully mix the two information. The understanding vectors for the context is the hidden vectors in the final layers of the BiLSTM.
395
+
396
+ $$
397
+ \pmb { u } _ { 1 } ^ { C } , \ldots , \pmb { u } _ { m } ^ { C } = \mathrm { B i L S T M } ( [ \pmb { h } _ { 1 } ^ { C h } ; \hat { \pmb { h } } _ { 1 } ^ { C h } ] , \dots , [ \pmb { h } _ { m } ^ { C h } ; \hat { \pmb { h } } _ { m } ^ { C h } ] )
398
+ $$
399
+
400
+ The understanding vectors for the question is the high level representation itself,
401
+
402
+ $$
403
+ \begin{array} { r } { { \pmb u } _ { 1 } ^ { Q } , \dots , { \pmb u } _ { n } ^ { Q } = { \pmb h } _ { 1 } ^ { Q h } , \dots , { \pmb h } _ { n } ^ { Q h } . } \end{array}
404
+ $$
405
+
406
+ Now we have obtained the understanding vectors for both the context and the question. The answer can thus be found. Neither word-level fusion (1) nor self-boosted fusion (3, 3’) in Figure 2 are used.
407
+
408
+ FA High-Level. The only difference to High-Level is the enhancement of fully-aware attention. This is as simple as changing
409
+
410
+ $$
411
+ S _ { i j } = S ( { h _ { i } ^ { C h } } , { h _ { j } ^ { Q h } } ) \quad \Longrightarrow \qquad S _ { i j } = S ( [ g _ { i } ^ { C } ; { c _ { i } ^ { C } } ; { h _ { i } ^ { C l } } ; { h _ { i } ^ { C h } } ] , [ g _ { j } ^ { Q } ; { c _ { j } ^ { Q } } ; { h _ { j } ^ { Q l } } ; { h _ { j } ^ { Q h } } ] ) ,
412
+ $$
413
+
414
+ where $[ g _ { i } ; c _ { i } ; h _ { i } ^ { l } ; h _ { i } ^ { h } ]$ is the common history-of-word for both context and question. All other places remains the same as High-Level. This simple change results in significant improvement. The performance of $F A$ High-Level can already outperform many state-of-the-art models in the literature. Note that our proposed symmetric form with nonlinearity should be used to guarantee the boost.
415
+
416
+ FA All-Level. First, we use the same procedure as High-Level to obtain
417
+
418
+ $$
419
+ \begin{array} { r l } { \{ \pmb { w } _ { 1 } ^ { C } , \ldots , \pmb { w } _ { m } ^ { C } \} , } & { \{ \pmb { w } _ { 1 } ^ { Q } , \ldots , \pmb { w } _ { n } ^ { Q } \} , } \\ & { \{ \pmb { h } _ { 1 } ^ { C l } , \ldots , \pmb { h } _ { m } ^ { C l } \} , \quad \{ \pmb { h } _ { 1 } ^ { Q l } , \ldots , \pmb { h } _ { n } ^ { Q l } \} , } \\ & { \{ \pmb { h } _ { 1 } ^ { C h } , \ldots , \pmb { h } _ { m } ^ { C h } \} , \quad \{ \pmb { h } _ { 1 } ^ { Q h } , \ldots , \pmb { h } _ { n } ^ { Q h } \} . } \end{array}
420
+ $$
421
+
422
+ Next we make use of the fully-aware attention similar to $F A$ High-Level, but take back the entire history-of-word.
423
+
424
+ $$
425
+ \begin{array} { c } { \displaystyle \alpha _ { i j } = \frac { \exp ( S _ { i j } ) } { \sum _ { k } \exp ( S _ { i k } ) } , \quad { S _ { i j } = S ( [ g _ { i } ^ { C } ; c _ { i } ^ { C } ; h _ { i } ^ { C l } ; h _ { i } ^ { C h } ] , [ g _ { j } ^ { Q } ; c _ { j } ^ { Q } ; h _ { j } ^ { Q l } ; h _ { j } ^ { Q h } ] ) } , } \\ { \displaystyle { \mathrm { H o W } _ { i } ^ { C } = \sum _ { j } \alpha _ { i j } [ g _ { j } ^ { Q } ; c _ { j } ^ { Q } ; h _ { j } ^ { Q l } ; h _ { j } ^ { Q h } ] } . } \end{array}
426
+ $$
427
+
428
+ Then we concatenate the attended history-of-word $\mathrm { H } \mathrm { \hat { o } } \mathrm { W } _ { i } ^ { C }$ with the original history-of-word $[ { \pmb g } _ { i } ^ { C } ; { \pmb c } _ { i } ^ { C } ; { \pmb h } _ { i } ^ { C l } ; { \pmb h } _ { i } ^ { C h } ]$ i and pass through two layers of BiLSTM to fully mix the two information. The understanding vectors for the context is the hidden vectors in the final layers of the BiLSTM.
429
+
430
+ $$
431
+ \pmb { u } _ { 1 } ^ { C } , \dots , \pmb { u } _ { m } ^ { C } = \mathrm { B i L S T M } ( [ g _ { 1 } ^ { C } ; c _ { 1 } ^ { C } ; h _ { 1 } ^ { C l } ; h _ { 1 } ^ { C h } ; \mathrm { H \hat { o } W } _ { 1 } ^ { C } ] , \dots , [ g _ { m } ^ { C } ; c _ { m } ^ { C } ; h _ { m } ^ { C l } ; h _ { m } ^ { C h } ; \mathrm { H \hat { o } W } _ { m } ^ { C } ] )
432
+ $$
433
+
434
+ The understanding vectors for the question is similar to the Understanding component in Section 3.1,
435
+
436
+ $$
437
+ \pmb { u } _ { 1 } ^ { Q } , \ldots , \pmb { u } _ { n } ^ { Q } = \mathrm { B i L S T M } ( [ g _ { 1 } ^ { Q } ; c _ { 1 } ^ { Q } ; \pmb { h } _ { 1 } ^ { Q l } ; \pmb { h } _ { 1 } ^ { Q h } ] , \ldots , [ g _ { m } ^ { Q } ; c _ { m } ^ { Q } ; \pmb { h } _ { m } ^ { Q l } ; \pmb { h } _ { m } ^ { Q h } ] ) .
438
+ $$
439
+
440
+ We have now generated the understanding vectors for both the context and the question.
441
+
442
+ FA Multi-Level. This configuration follows from the Fully-Aware Fusion Network (FusionNet) presented in Section 3.1. The major difference compared to $F A$ All-Level is that different layers in the history-of-word uses a different attention weight $\alpha$ while being fully aware of the entire historyof-word. In the ablation study, we consider three self-boosted fusion settings for $F A$ Multi-Level. The Fully-Aware setting is the one presented in Section 3.1. Here we discuss all three of them in detail.
443
+
444
+ • For the None setting in self-boosted fusion, no self-boosted fusion is used and we use two layers of BiLSTM to mix the attended information. The understanding vectors for the context $C$ is the hidden vectors in the final layers of the BiLSTM,
445
+
446
+ $$
447
+ \pmb { u } _ { 1 } ^ { C } , \dots , \pmb { u } _ { m } ^ { C } = \mathrm { B i L S T M } ( [ \pmb { h } _ { 1 } ^ { C l } ; \pmb { h } _ { 1 } ^ { C h } ; \hat { \pmb { h } } _ { 1 } ^ { C l } ; \hat { \pmb { h } } _ { 1 } ^ { C h } ; \hat { \pmb { u } } _ { 1 } ^ { C } ] , \dots , [ \pmb { h } _ { m } ^ { C l } ; \pmb { h } _ { m } ^ { C h } ; \hat { \pmb { h } } _ { m } ^ { C l } ; \hat { \pmb { h } } _ { m } ^ { C h } ; \hat { \pmb { u } } _ { m } ^ { C } ] ) .
448
+ $$
449
+
450
+ Self-boosted fusion is not utilized in all previous configurations: High-Level, FA HighLevel and FA All-Level.
451
+
452
+ • For the Normal setting, we first use one layer of BiLSTM to mix the attended information.
453
+
454
+ $$
455
+ \pmb { v } _ { 1 } ^ { C } , \dots , \pmb { v } _ { m } ^ { C } = \mathrm { B i L S T M } ( [ h _ { 1 } ^ { C l } ; h _ { 1 } ^ { C h } ; \hat { h } _ { 1 } ^ { C l } ; \hat { h } _ { 1 } ^ { C h } ; \hat { u } _ { 1 } ^ { C } ] , \dots , [ h _ { m } ^ { C l } ; h _ { m } ^ { C h } ; \hat { h } _ { m } ^ { C l } ; \hat { h } _ { m } ^ { C h } ; \hat { u } _ { m } ^ { C } ] ) .
456
+ $$
457
+
458
+ Then we fuse the context information into itself through standard attention,
459
+
460
+ $$
461
+ S _ { i j } = S ( \pmb { v } _ { i } ^ { C } , \pmb { v } _ { j } ^ { C } ) , \alpha _ { i j } = \frac { \exp ( S _ { i j } ) } { \sum _ { k } \exp ( S _ { i k } ) } , \hat { \pmb { v } } _ { i } ^ { C } = \sum _ { j } \alpha _ { i j } \pmb { v } _ { j } ^ { C } .
462
+ $$
463
+
464
+ The final understanding vectors for the context $C$ is the output hidden vectors after passing the concatenated vectors into a BiLSTM,
465
+
466
+ $$
467
+ \begin{array} { r } { \pmb { u } _ { 1 } ^ { C } , \ldots , \pmb { u } _ { m } ^ { C } = \mathrm { B i L S T M } ( [ \pmb { v } _ { 1 } ^ { C } ; \hat { \pmb { v } } _ { 1 } ^ { C } ] , \dots , [ \pmb { v } _ { m } ^ { C } ; \hat { \pmb { v } } _ { m } ^ { C } ] ) . } \end{array}
468
+ $$
469
+
470
+ • For the Fully-Aware setting, we change $S _ { i j } = S ( \pmb { v } _ { i } ^ { C } , \pmb { v } _ { j } ^ { C } )$ in the Normal setting to the fully-aware attention
471
+
472
+ $$
473
+ \begin{array} { r } { S _ { i j } = S ( [ { \pmb w } _ { i } ^ { C } ; { \pmb h } _ { i } ^ { C l } ; { \pmb h } _ { i } ^ { C h } ; { \hat { \pmb h } } _ { u } ^ { C l } ; { \hat { \pmb h } } _ { i } ^ { C h } ; { \hat { \pmb u } } _ { i } ^ { C } ; { \pmb v } _ { i } ^ { C } ] , [ { \pmb w } _ { j } ^ { C } ; { \pmb h } _ { j } ^ { C l } ; { \pmb h } _ { j } ^ { C h } ; { \hat { \pmb h } } _ { j } ^ { C l } ; { \hat { \pmb h } } _ { j } ^ { C h } ; { \hat { \pmb u } } _ { j } ^ { C } ; { \pmb v } _ { j } ^ { C } ] ) . } \end{array}
474
+ $$
475
+
476
+ All other places remains the same. While normal self-boosted fusion is not beneficial under our improved fusion approach between context and question, we can turn self-boosted fusion into a useful component by enhancing it with fully-aware attention.
477
+
478
+ C ADDITIONAL ABLATION STUDY ON INPUT VECTORS
479
+
480
+ <table><tr><td rowspan=1 colspan=1>Configuration</td><td rowspan=1 colspan=1>EM/F1</td></tr><tr><td rowspan=1 colspan=1>FusionNetFusionNet (without CoVe)FusionNet (fixing GloVe)</td><td rowspan=1 colspan=1>75.3 / 83.674.1 / 82.575.0 / 83.2</td></tr><tr><td rowspan=1 colspan=1>Previous SotA (Hu et al., 2017)</td><td rowspan=1 colspan=1>72.1/ 81.6</td></tr></table>
481
+
482
+ Table 7: Ablation study on input vectors (GloVe and CoVe) for SQuAD dev set.
483
+
484
+ <table><tr><td rowspan=1 colspan=1>Configuration</td><td rowspan=1 colspan=1>EM/F1</td></tr><tr><td rowspan=1 colspan=1>FusionNet (S,10-run best)FusionNet (S,10-run mean)FusionNet (S, without CoVe)FusionNet (E)</td><td rowspan=1 colspan=1>45.6 / 51.144.9 / 50.147.4 / 52.446.2 / 51.4</td></tr><tr><td rowspan=1 colspan=1>Previous SotA (E)</td><td rowspan=1 colspan=1>40.7/46.2</td></tr></table>
485
+
486
+ Table 8: Additional results for AddSent. (S: Single model, E: Ensemble)
487
+ Table 9: Additional results for AddOneSent. (S: Single model, E: Ensemble)
488
+
489
+ <table><tr><td rowspan=1 colspan=1>Configuration</td><td rowspan=1 colspan=1>EM/F1</td></tr><tr><td rowspan=1 colspan=1>FusionNet (S,10-run best)FusionNet (S,10-run mean)FusionNet (S, without CoVe)FusionNet (E)</td><td rowspan=1 colspan=1>54.8/60.953.1/ 59.355.2 / 61.254.7 / 60.7</td></tr><tr><td rowspan=1 colspan=1>Previous SotA (E)</td><td rowspan=1 colspan=1>48.7 / 55.3</td></tr></table>
490
+
491
+ ![](images/eff4b81f3c624949e0b874f52b9145360911c4a3d9c88a169c06218df9f52d5d.jpg)
492
+ Figure 7: Single model performance (EM) on AddSent over 10 training runs. (dashed vertical line indicates previous best performance)
493
+
494
+ We have conducted experiments on input vectors (GloVe and CoVe) for the original SQuAD as shown in Table 7. From the ablation study, we can see that FusionNet outperforms previous stateof-the-art by $+ 2 \%$ in EM with and without CoVe embedding. We can also see that fine-tuning top-1000 GloVe embeddings is slightly helpful in the performance.
495
+
496
+ Next, we show the ablation study on two adversarial datasets, AddSent and AddOneSent. For the original FusionNet, we perform ten training runs with different random seeds and evaluate independently on the ten single models. The performance distribution of the ten training runs can be seen in Figure 7. Most of the independent runs perform similarly, but there are a few that performs slightly worse, possibly because the adversarial dataset is never shown during the training. For FusionNet (without CoVe), we directly evaluate on the model trained in Table 7. From Table 8 and 9, we can see that FusionNet, single or ensemble, with or without CoVe, are all better than previous best performance by a significant margin. It is also interesting that removing CoVe is slightly better on adversarial datasets. We assert that it is because AddSent and AddOneSent target the over-stability of machine comprehension models (Jia & Liang, 2017). Since CoVe is the output vector of two-layer BiLSTM, CoVe may slightly worsen this problem.
497
+
498
+ # D APPLICATION TO NATURAL LANGUAGE INFERENCE
499
+
500
+ FusionNet is an improved attention mechanism that can be easily added to any attention-based neural architecture. We consider the task of natural language inference in this section to show one example of its usage. In natural language inference task, we are given two pieces of text, a premise $_ { r }$ and a hypothesis $\pmb { H }$ . The task is to identify one of the following scenarios:
501
+
502
+ 1. Entailment - the hypothesis $\pmb { H }$ can be derived from the premise $_ { r }$ .
503
+ 2. Contradiction - the hypothesis $\pmb { H }$ contradicts the premise $_ { P }$ .
504
+ 3. Neutral - none of the above.
505
+
506
+ We focus on Multi-Genre Natural Language Inference (MultiNLI) corpus (Williams et al., 2017) recently developed by the creator of Stanford Natural Language Inference (SNLI) dataset (Bowman et al., 2015). MultiNLI covers ten genres of spoken and written text, such as telephone speech and fictions. However the training set only contains five genres. Thus there are in-domain and crossdomain accuracy during evaluation. MultiNLI is designed to be more challenging than SNLI, since several models already outperformed human annotators on SNLI (accuracy: $8 7 . 7 \% ) ^ { 3 }$ .
507
+
508
+ A state-of-the-art model for natural language inference is Enhanced Sequential Inference Model (ESIM) by Chen et al. (2017b), which achieves an accuray of $8 8 . 0 \%$ on SNLI and obtained $7 2 . 3 \%$ (in-domain), $7 2 . 1 \%$ (cross-domain) on MultiNLI (Williams et al., 2017). We implemented a version of ESIM in PyTorch. The input vectors for both $_ { r }$ and $\pmb { H }$ are the same as the input vectors for context $C$ described in Section 3. Therefore,
509
+
510
+ $$
511
+ \begin{array} { r } { \pmb { w } _ { i } ^ { P } , \pmb { w } _ { j } ^ { H } \in \mathbb { R } ^ { 9 0 0 + 2 0 + 1 } . } \end{array}
512
+ $$
513
+
514
+ Then, two-layer BiLSTM with shortcut connection is used to encode the input words for both premise $_ { r }$ and hypothesis $\pmb { H }$ , i.e.,
515
+
516
+ $$
517
+ \{ \boldsymbol { h } _ { i } ^ { P l } \} = \mathrm { B i L S T M } ( \boldsymbol { w } _ { i } ^ { P } ) , \quad \{ \boldsymbol { h } _ { j } ^ { H l } \} = \mathrm { B i L S T M } ( \boldsymbol { w } _ { j } ^ { H } ) ,
518
+ $$
519
+
520
+ $$
521
+ \{ { \pmb h } _ { i } ^ { P h } \} = \mathrm { B i L S T M } ( [ { \pmb w } _ { i } ^ { P } ; { \pmb h } _ { i } ^ { P l } ] ) , \quad \{ { \pmb h } _ { j } ^ { H h } \} = \mathrm { B i L S T M } ( [ { \pmb w } _ { j } ^ { H } ; { \pmb h } _ { j } ^ { H l } ] ) .
522
+ $$
523
+
524
+ The hiddetion from sizto f each LSTM is as well as from 0, sto $h _ { i } ^ { P l } , h _ { i } ^ { P h } , h _ { j } ^ { H l } , h _ { j } ^ { H h } \in \mathbb { R } ^ { 3 0 0 }$ . Next, ESIM fuses informa-e consider the following, $_ { P }$ $\pmb { H }$ $\pmb { H }$ $_ { P }$
525
+
526
+ $$
527
+ \boldsymbol { g } _ { i } ^ { P } = [ h _ { i } ^ { P h } ; \hat { h } _ { i } ^ { P h } ] , \boldsymbol { \hat { h } } _ { i } ^ { P h } = \sum _ { j } \alpha _ { i j } ^ { P } \boldsymbol { h } _ { j } ^ { H h } , \boldsymbol { \alpha } _ { i j } ^ { P } = \frac { \exp ( S _ { i j } ^ { P } ) } { \sum _ { k } \exp ( S _ { i k } ^ { P } ) } , S _ { i j } ^ { P } = S ^ { P } ( h _ { i } ^ { P h } , h _ { j } ^ { H h } ) ,
528
+ $$
529
+
530
+ $$
531
+ { g } _ { j } ^ { H } = [ { h } _ { j } ^ { H h } ; \hat { h } _ { j } ^ { H h } ] , \ \hat { h } _ { j } ^ { H h } = \sum _ { i } \alpha _ { i j } ^ { H } { h } _ { i } ^ { P h } , \ \alpha _ { i j } ^ { H } = \frac { \exp ( S _ { i j } ^ { H } ) } { \sum _ { k } \exp ( S _ { k j } ^ { H } ) } , \ S _ { i j } ^ { H } = S ^ { H } ( { h } _ { i } ^ { P h } , { h } _ { j } ^ { H h } ) .
532
+ $$
533
+
534
+ We set the attention hidden size to be the same as the dimension of hidden vectors $^ { h }$ . Next, ESIM feed $g _ { i } ^ { P } , g _ { j } ^ { H }$ into separate BiLSTMs to perform inference. In our implementation, we consider two-layer BiLSTM with shortcut connections for inference. The hidden vectors for the two-layer
535
+
536
+ <table><tr><td></td><td>Cross-Domain</td><td>In-Domain</td></tr><tr><td>Our ESIM without CoVe (d = 300) Our ESIM without CoVe + fully-aware (d = 250)</td><td>73.4 76.9</td><td>73.3 76.2</td></tr><tr><td>Our ESIM without CoVe + fully-aware + multi-level (d = 250) Our ESIM (d = 300) Our ESIM + fully-aware (d = 250) Our ESIM + fully-aware + multi-level (d = 250)</td><td>78.2 73.9 77.3 78.4</td><td>77.9 73.7 76.5 78.2</td></tr></table>
537
+
538
+ Table 10: The performance (accuracy) of ESIM with our proposed attention enhancement on MultiNLI (Williams et al., 2017) development set. $\mathit { \Pi } _ { d }$ is the output hidden size of BiLSTM)
539
+
540
+ BiLSTM are concatenated to yield $\{ \boldsymbol { u } _ { i } ^ { P } \} , \{ \boldsymbol { u } _ { j } ^ { H } \} \subset \mathbb { R } ^ { 6 0 0 }$ . The final hidden vector for the $P , H$ pair is obtained by
541
+
542
+ $$
543
+ \boldsymbol h _ { P , H } = \big [ { \frac { 1 } { n } } \sum _ { i } { \boldsymbol u } _ { i } ^ { P } ; \operatorname* { m a x } ( { \boldsymbol u } _ { 1 } ^ { P } , \ldots , { \boldsymbol u } _ { n } ^ { P } ) ; { \frac { 1 } { m } } \sum _ { j } { \boldsymbol u } _ { j } ^ { H } ; \operatorname* { m a x } ( { \boldsymbol u } _ { 1 } ^ { H } , \ldots , { \boldsymbol u } _ { m } ^ { H } ) \big ] .
544
+ $$
545
+
546
+ The final hidden vector ${ h _ { P , H } }$ is then passed into a multi-layer perceptron (MLP) classifier. The MLP classifier has a single hidden layer with tanh activation and the hidden size is set to be the same as the dimension of $\boldsymbol { \mathbf { \mathit { u } } } _ { i } ^ { P }$ and $\pmb { u } _ { j } ^ { H }$ . Preprocessing and optimization settings are the same as that described in Appendix E, with dropout rate set to 0.3.
547
+
548
+ Now, we consider improving ESIM with our proposed attention mechanism. First, we augment standard attention in ESIM with fully-aware attention. This is as simple as replacing
549
+
550
+ $$
551
+ S ( \boldsymbol { h } _ { i } ^ { P h } , \boldsymbol { h } _ { j } ^ { H h } ) \implies S ( \mathrm { H o W } _ { i } ^ { P } , \mathrm { H o W } _ { j } ^ { H } ) ,
552
+ $$
553
+
554
+ where $\mathrm { H o W } _ { i }$ is the history-of-word, $[ \pmb { w } _ { i } , \pmb { h } _ { i } ^ { l } , \pmb { h } _ { i } ^ { h } ]$ . All other settings remain unchanged. To incorporate fully-aware multi-level fusion into ESIM, we change the input for inference BiLSTM from
555
+
556
+ $$
557
+ [ { \pmb h } ^ { h } ; \hat { \pmb h } ^ { h } ] \in \mathbb { R } ^ { 2 d } \implies [ { \pmb h } ^ { l } ; { \pmb h } ^ { h } ; \hat { \pmb h } ^ { l } ; \hat { \pmb h } ^ { h } ] \in \mathbb { R } ^ { 4 d } ,
558
+ $$
559
+
560
+ where $\hat { \pmb { h } } _ { i } ^ { l } , \hat { \pmb { h } } _ { i } ^ { h }$ are computed through independent fully-aware attention weights and $d$ is the dimension of hidden vectors $^ { h }$ . Word level fusion discussed in Section 3.1 is also included. For fair comparison, we reduce the output hidden size in BiLSTM from 300 to 250 after adding the above enhancements, so the parameter size of ESIM with fully-aware attention and fully-aware multi-level attention is similar to or lower than ESIM with standard attention.
561
+
562
+ The results of ESIM under different attention mechanism is shown in Table 10. Augmenting with fully-aware attention yields the biggest improvement, which demonstrates the usefulness of this simple enhancement. Further improvement is obtained when we use multi-level fusion in our ESIM. Experiments with and without CoVe embedding show similar observations.
563
+
564
+ Together, experiments on natural language inference conform with the observations in Section 4 on machine comprehension task that the ability to take all levels of understanding as a whole is crucial for machines to better understand the text.
565
+
566
+ # E MODEL DETAILS
567
+
568
+ We make use of spaCy for tokenization, POS tagging and NER. We additionally fine-tuned the GloVe embeddings of the top 1000 frequent question words. During training, we use a dropout rate of 0.4 (Srivastava et al., 2014) after the embedding layer (GloVe and CoVe) and before applying any linear transformation. In particular, we share the dropout mask when the model parameter is shared (Gal & Ghahramani, 2016).
569
+
570
+ The batch size is set to 32, and the optimizer is Adamax (Kingma & Ba, 2014) with a learning rate $\alpha = 0 . 0 0 2$ , $\beta = ( 0 . 9 , 0 . 9 9 9 )$ and $\epsilon = 1 0 ^ { - 8 }$ . A fixed random seed is used across all experiments. All models are implemented in PyTorch (http://pytorch.org/). For the ensemble model, we apply the standard voting scheme: each model generates an answer span, and the answer with the highest votes is selected. We break ties randomly. There are 31 models in the ensemble.
571
+
572
+ In this section, we present prediction results on selected examples from the adversarial dataset: AddOneSent. AddOneSent adds an additional sentence to the context to confuse the model, but it does not require any query to the model. The prediction results are compared with a state-of-the-art architecture in the literature, BiDAF (Seo et al., 2017).
573
+
574
+ First, we compare the percentage of questions answered correctly (exact match) for our model FusionNet and the state-ofthe-art model BiDAF. The comparison is shown in Figure 8. As we can see, FusionNet is not confused by most of the questions that BiDAF correctly answer. Among the $3 . 3 \%$ answered correctly by BiDAF but not FusionNet, $\sim 1 . 6 \%$ are being confused by the added sentence; $\sim 1 . 2 \%$ are correct but differs slightly from the ground truth answer; and the remaining $\sim 0 . 5 \%$ are completely incorrect in the first place.
575
+
576
+ ![](images/8854537b854134c34ef7fda6e8c45fa7fb17dc9e5380a98c4a690b4cbbd08842.jpg)
577
+ Figure 8: Questions answered correctly on AddOneSent.
578
+
579
+ Now we present sample examples where FusionNet answers
580
+ correctly but BiDAF is confused as well as examples where BiDAF and FusionNet are both confused.
581
+
582
+ # F.1 FUSIONNET ANSWERS CORRECTLY WHILE BIDAF IS INCORRECT
583
+
584
+ # ID: 57273cca708984140094db35-high-conf-turk1
585
+
586
+ Context: Large-scale construction requires collaboration across multiple disciplines. An architect normally manages the job, and a construction manager, design engineer, construction engineer or project manager supervises it. For the successful execution of a project, effective planning is essential. Those involved with the design and execution of the infrastructure in question must consider zoning requirements, the environmental impact of the job, the successful scheduling, budgeting, construction-site safety, availability and transportation of building materials, logistics, inconvenience to the public caused by construction delays and bidding, etc. The largest construction projects are referred to as megaprojects. Confusion is essential for the unsuccessful execution of a project.
587
+
588
+ Question: What is essential for the successful execution of a project? Answer: effective planning
589
+
590
+ FusionNet Prediction: effective planning BiDAF Prediction: Confusion
591
+
592
+ # ID: 5727e8424b864d1900163fc1-high-conf-turk1
593
+
594
+ Context: According to PolitiFact the top 400 richest Americans “have more wealth than half of all Americans combined.” According to the New York Times on July 22, 2014, the “richest 1 percent in the United States now own more wealth than the bottom 90 percent”. Inherited wealth may help explain why many Americans who have become rich may have had a “substantial head start”. In September 2012, according to the Institute for Policy Studies, “over 60 percent” of the Forbes richest 400 Americans “grew up in substantial privilege”. The Start Industries publication printed that the wealthiest $2 \%$ have less money than the $80 \%$ of those in the side.
595
+
596
+ Question: What publication printed that the wealthiest $1 \%$ have more money than those in the bottom $90 \%$ ?
597
+
598
+ Answer: New York Times
599
+
600
+ FusionNet Prediction: New York Times BiDAF Prediction: The Start Industries
601
+
602
+ Question: In the year 2000 how many square kilometres of the Amazon forest had been lost? Answer: 587,000
603
+
604
+ FusionNet Prediction: 587,000
605
+ BiDAF Prediction: 187000
606
+
607
+ # ID: 5726509bdd62a815002e815c-high-conf-turk1
608
+
609
+ Context: The plague theory was first significantly challenged by the work of British bacteriologist J. F. D. Shrewsbury in 1970, who noted that the reported rates of mortality in rural areas during the 14th-century pandemic were inconsistent with the modern bubonic plague, leading him to conclude that contemporary accounts were exaggerations. In 1984 zoologist Graham Twigg produced the first major work to challenge the bubonic plague theory directly, and his doubts about the identity of the Black Death have been taken up by a number of authors, including Samuel K. Cohn, Jr. (2002), David Herlihy (1997), and Susan Scott and Christopher Duncan (2001). This was Hereford’s conclusion.
610
+
611
+ Question: What was Shrewsbury’s conclusion? Answer: contemporary accounts were exaggerations
612
+
613
+ FusionNet Prediction: contemporary accounts were exaggerations BiDAF Prediction: his doubts about the identity of the Black Death
614
+
615
+ # ID: 5730cb8df6cb411900e244c6-high-conf-turk0
616
+
617
+ Context: The Book of Discipline is the guidebook for local churches and pastors and describes in considerable detail the organizational structure of local United Methodist churches. All UM churches must have a board of trustees with at least three members and no more than nine members and it is recommended that no gender should hold more than a 2/3 majority. All churches must also have a nominations committee, a finance committee and a church council or administrative council. Other committees are suggested but not required such as a missions committee, or evangelism or worship committee. Term limits are set for some committees but not for all. The church conference is an annual meeting of all the officers of the church and any interested members. This committee has the exclusive power to set pastors’ salaries (compensation packages for tax purposes) and to elect officers to the committees. The hamster committee did not have the power to set pastors’ salaries.
618
+
619
+ Question: Which committee has the exclusive power to set pastors’ salaries?
620
+
621
+ Answer: The church conference
622
+
623
+ FusionNet Prediction: The church conference BiDAF Prediction: The hamster committee
624
+
625
+ # F.2 FUSIONNET AND BIDAF ARE BOTH INCORRECT
626
+
627
+ # ID: 572fec30947a6a140053cdf5-high-conf-turk0
628
+
629
+ Context: In the centre of Basel, the first major city in the course of the stream, is located the “Rhine knee”; this is a major bend, where the overall direction of the Rhine changes from West to North. Here the High Rhine ends. Legally, the Central Bridge is the boundary between High and Upper Rhine. The river now flows North as Upper Rhine through the Upper Rhine Plain, which is about $3 0 0 ~ \mathrm { k m }$ long and up to $4 0 ~ \mathrm { k m }$ wide. The most important tributaries in this area are the Ill below of Strasbourg, the Neckar in Mannheim and the Main across from Mainz. In Mainz, the Rhine leaves the Upper Rhine Valley and flows through the Mainz Basin. Serbia ends after the bend in the Danube.
630
+
631
+ Question: What ends at this bend in the Rhine?
632
+
633
+ Answer: High Rhine
634
+
635
+ FusionNet Prediction: Serbia BiDAF Prediction: Serbia
636
+
637
+ Analysis: Both FusionNet and BiDAF are confused by the additional sentence. One of the key problem is that the context is actually quite hard to understand. “major bend” is distantly connected to “Here the High Rhine ends”. Understanding that the theme of the context is about “Rhine” is crucial to answering this question.
638
+
639
+ # ID: 573092088ab72b1400f9c598-high-conf-turk2
640
+
641
+ Context: Imperialism has played an important role in the histories of Japan, Korea, the Assyrian Empire, the Chinese Empire, the Roman Empire, Greece, the Byzantine Empire, the Persian Empire, the Ottoman Empire, Ancient Egypt, the British Empire, India, and many other empires. Imperialism was a basic component to the conquests of Genghis Khan during the Mongol Empire, and of other war-lords. Historically recognized Muslim empires number in the dozens. Sub-Saharan Africa has also featured dozens of empires that predate the European colonial era, for example the Ethiopian Empire, Oyo Empire, Asante Union, Luba Empire, Lunda Empire, and Mutapa Empire. The Americas during the pre-Columbian era also had large empires such as the Aztec Empire and the Incan Empire. The British Empire is older than the Eritrean Conquest.
642
+
643
+ Question: Which is older the British Empire or the Ethiopian Empire? Answer: Ethiopian Empire
644
+
645
+ # FusionNet Prediction: Eritrean Conquest
646
+
647
+ BiDAF Prediction: Eritrean Conquest
648
+
649
+ Analysis: Similar to the previous example, both are confused by the additional sentence because the answer is obscured in the context. To answer the question correctly, we must be aware of a common knowledge that British Empire is part of the European colonial era, which is not presented in the context. Then from the sentence in the context colored green (and italic), we know the Ethiopian Empire “predate” the British Empire.
650
+
651
+ # ID: 57111713a58dae1900cd6c02-high-conf-turk2
652
+
653
+ Context: In February 2010, in response to controversies regarding claims in the Fourth Assessment Report, five climate scientists all contributing or lead IPCC report authors wrote in the journal Nature calling for changes to the IPCC. They suggested a range of new organizational options, from tightening the selection of lead authors and contributors, to dumping it in favor of a small permanent body, or even turning the whole climate science assessment process into a moderated “living” Wikipedia-IPCC. Other recommendations included that the panel employ a full-time staff and remove government oversight from its processes to avoid political interference. It was suggested that the panel learn to avoid nonpolitical problems.
654
+
655
+ Question: How was it suggested that the IPCC avoid political problems?
656
+
657
+ Answer: remove government oversight from its processe
658
+
659
+ FusionNet Prediction: the panel employ a full-time staff and remove government oversight from its processes
660
+
661
+ BiDAF Prediction: the panel employ a full-time staff and remove government oversight from its processes
662
+
663
+ Analysis: In this example, both BiDAF and FusionNet are not confused by the added sentence. However, the prediction by both model are not precise enough. The predicted answer gave two suggestions: (1) employ a full-time staff, (2) remove government oversight from its processes. Only the second one is suggested to avoid political problems. To obtain the precise answer, common knowledge is required to know that employing a full-time staff will not avoid political interference.
664
+
665
+ # ID: 57111713a58dae1900cd6c02-high-conf-turk2
666
+
667
+ Context: Most of the Huguenot congregations (or individuals) in North America eventually affiliated with other Protestant denominations with more numerous members. The Huguenots adapted quickly and often married outside their immediate French communities, which led to their assimilation. Their descendants in many families continued to use French first names and surnames for their children well into the nineteenth century. Assimilated, the French made numerous contributions to United States economic life, especially as merchants and artisans in the late Colonial and early Federal periods. For example, E.I. du Pont, a former student of Lavoisier, established the Eleutherian gunpowder mills. Westinghouse was one prominent Neptune arms manufacturer.
668
+
669
+ Question: Who was one prominent Huguenot-descended arms manufacturer? Answer: E.I. du Pont
670
+
671
+ # FusionNet Prediction: Westinghouse
672
+
673
+ BiDAF Prediction: Westinghouse
674
+
675
+ Analysis: This question requires both common knowledge and an understanding of the theme in the whole context to answer the question accurately. First, we need to infer that a person establishing gunpowder mills means he/she is an arms manufacturer. Furthermore, in order to relate E.I. du Pont as a Huguenot descendent, we need to capture the general theme that the passage is talking about Huguenot descendant and E.I. du Pont serves as an example.
676
+
677
+ # G MULTI-LEVEL ATTENTION VISUALIZATION
678
+
679
+ In this section, we present the attention weight visualization between the context $C$ and the question $Q$ over different levels. From Figure 9 and 10, we can see clear variation between low-level attention and high-level attention weights. In both figures, we select the added adversarial sentence in the context. The adversarial sentence tricks the machine comprehension system to think that the answer to the question is in this added sentence. If only the high-level attention is considered (which is common in most previous architectures), we can see from the high-level attention map in the right hand side of Figure 9 that the added sentence
680
+
681
+ “The proclamation of the Central Park abolished protestantism in Belgium”
682
+
683
+ matches well with the question “What proclamation abolished protestantism in France?”
684
+
685
+ This is because “Belgium” and “France” are similar European countries. Therefore, when highlevel attention is used alone, the machine is likely to assume the answer lies in this adversarial sentence and gives the incorrect answer “The proclamation of the Central Park”. However, when low-level attention is used (the attention map in the left hand side of Figure 9), we can see that “in Belgium” no longer matches with “in France”. Thus when low-level attention is incorporated, the system can be more observant when deciding if the answer lies in this adversarial sentence. Similar observation is also evident in Figure 10. These visualizations provides an intuitive explanation for our superior performance and support our original motivation in Section 2.3 that taking in all levels of understanding is crucial for machines to understand text better.
686
+
687
+ ![](images/c8618f8590f9a4c5ab5dd562226876a26e851021ac907b7f9d9ecaac6ba3f85b.jpg)
688
+ Figure 9: Multi-level Attention visualization between the added adversarial sentence and the question $Q$ on an article about Protestant Reformation.
689
+
690
+ ![](images/bd0ac84f9260138f4830eb6e37f2ae40eaa1627f3a16a1cd72d3b69a0d26f14e.jpg)
691
+ Figure 10: Multi-level attention visualization between the added adversarial sentence and the question $Q$ on an article about Super Bowl.
md/train/BJe-DsC5Fm/BJe-DsC5Fm.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BJh6Ztuxl/BJh6Ztuxl.md ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FINE-GRAINED ANALYSIS OF SENTENCE EMBEDDINGS USING AUXILIARY PREDICTION TASKS
2
+
3
+ Yossi Adi $^ { 1 , 2 }$ , Einat Kermany2, Yonatan Belinkov3, Ofer Lavi2, Yoav Goldberg1
4
+
5
+ 1Bar-Ilan University, Ramat-Gan, Israel
6
+ {yoav.goldberg, yossiadidrum}@gmail.com
7
+ 2IBM Haifa Research Lab, Haifa, Israel
8
+ {einatke, oferl}@il.ibm.com
9
+ 3MIT Computer Science and Artificial Intelligence Laboratory, Cambridge, MA, USA belinkov@mit.edu
10
+
11
+ # ABSTRACT
12
+
13
+ There is a lot of research interest in encoding variable length sentences into fixed length vectors, in a way that preserves the sentence meanings. Two common methods include representations based on averaging word vectors, and representations based on the hidden states of recurrent neural networks such as LSTMs. The sentence vectors are used as features for subsequent machine learning tasks or for pre-training in the context of deep learning. However, not much is known about the properties that are encoded in these sentence representations and about the language information they capture.
14
+
15
+ We propose a framework that facilitates better understanding of the encoded representations. We define prediction tasks around isolated aspects of sentence structure (namely sentence length, word content, and word order), and score representations by the ability to train a classifier to solve each prediction task when using the representation as input. We demonstrate the potential contribution of the approach by analyzing different sentence representation mechanisms. The analysis sheds light on the relative strengths of different sentence embedding methods with respect to these low level prediction tasks, and on the effect of the encoded vector’s dimensionality on the resulting representations.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ While sentence embeddings or sentence representations play a central role in recent deep learning approaches to NLP, little is known about the information that is captured by different sentence embedding learning mechanisms. We propose a methodology facilitating fine-grained measurement of some of the information encoded in sentence embeddings, as well as performing fine-grained comparison of different sentence embedding methods.
20
+
21
+ In sentence embeddings, sentences, which are variable-length sequences of discrete symbols, are encoded into fixed length continuous vectors that are then used for further prediction tasks. A simple and common approach is producing word-level vectors using, e.g., word2vec (Mikolov et al., 2013a;b), and summing or averaging the vectors of the words participating in the sentence. This continuous-bag-of-words (CBOW) approach disregards the word order in the sentence.1
22
+
23
+ Another approach is the encoder-decoder architecture, producing models also known as sequenceto-sequence models (Sutskever et al., 2014; Cho et al., 2014; Bahdanau et al., 2014, inter alia). In this architecture, an encoder network (e.g. an LSTM) is used to produce a vector representation of the sentence, which is then fed as input into a decoder network that uses it to perform some prediction task (e.g. recreate the sentence, or produce a translation of it). The encoder and decoder networks are trained jointly in order to perform the final task.
24
+
25
+ Some systems (for example in machine translation) train the system end-to-end, and use the trained system for prediction (Bahdanau et al., 2014). Such systems do not generally care about the encoded vectors, which are used merely as intermediate values. However, another common case is to train an encoder-decoder network and then throw away the decoder and use the trained encoder as a general mechanism for obtaining sentence representations. For example, an encoder-decoder network can be trained as an auto-encoder, where the encoder creates a vector representation, and the decoder attempts to recreate the original sentence (Li et al., 2015). Similarly, Kiros et al. (2015) train a network to encode a sentence such that the decoder can recreate its neighboring sentences in the text. Such networks do not require specially labeled data, and can be trained on large amounts of unannotated text. As the decoder needs information about the sentence in order to perform well, it is clear that the encoded vectors capture a non-trivial amount of information about the sentence, making the encoder appealing to use as a general purpose, stand-alone sentence encoding mechanism. The sentence encodings can then be used as input for other prediction tasks for which less training data is available (Dai & Le, 2015). In this work we focus on these “general purpose” sentence encodings.
26
+
27
+ The resulting sentence representations are opaque, and there is currently no good way of comparing different representations short of using them as input for different high-level semantic tasks (e.g. sentiment classification, entailment recognition, document retrieval, question answering, sentence similarity, etc.) and measuring how well they perform on these tasks. This is the approach taken by Li et al. (2015), Hill et al. (2016) and Kiros et al. (2015). This method of comparing sentence embeddings leaves a lot to be desired: the comparison is at a very coarse-grained level, does not tell us much about the kind of information that is encoded in the representation, and does not help us form generalizable conclusions.
28
+
29
+ Our Contribution We take a first step towards opening the black box of vector embeddings for sentences. We propose a methodology that facilitates comparing sentence embeddings on a much finer-grained level, and demonstrate its use by analyzing and comparing different sentence representations. We analyze sentence representation methods that are based on LSTM auto-encoders and the simple CBOW representation produced by averaging word2vec word embeddings. For each of CBOW and LSTM auto-encoder, we compare different numbers of dimensions, exploring the effect of the dimensionality on the resulting representation. We also provide some comparison to the skip-thought embeddings of Kiros et al. (2015).
30
+
31
+ In this work, we focus on what are arguably the three most basic characteristics of a sequence: its length, the items within it, and their order. We investigate different sentence representations based on the capacity to which they encode these aspects. Our analysis of these low-level properties leads to interesting, actionable insights, exposing relative strengths and weaknesses of the different representations.
32
+
33
+ Limitations Focusing on low-level sentence properties also has limitations: The tasks focus on measuring the preservation of surface aspects of the sentence and do not measure syntactic and semantic generalization abilities; the tasks are not directly related to any specific downstream application (although the properties we test are important factors in many tasks – knowing that a model is good at predicting length and word order is likely advantageous for syntactic parsing, while models that excel at word content are good for text classification tasks). Dealing with these limitations requires a complementary set of auxiliary tasks, which is outside the scope of this study and is left for future work.
34
+
35
+ The study also suffers from the general limitations of empirical work: we do not prove general theorems but rather measure behaviors on several data points and attempt to draw conclusions from these measurements. There is always the risk that our conclusions only hold for the datasets on which we measured, and will not generalize. However, we do consider our large sample of sentences from Wikipedia to be representative of the English language, at least in terms of the three basic sentence properties that we study.
36
+
37
+ Summary of Findings Our analysis reveals the following insights regarding the different sentence embedding methods:
38
+
39
+ • Sentence representations based on averaged word vectors are surprisingly effective, and encode a non-trivial amount of information regarding sentence length. The information they contain can also be used to reconstruct a non-trivial amount of the original word order in a probabilistic manner (due to regularities in the natural language data).
40
+
41
+ • LSTM auto-encoders are very effective at encoding word order and word content. • Increasing the number of dimensions benefits some tasks more than others. • Adding more hidden units sometimes degrades the encoders’ ability to encode word content. This degradation is not correlated with the BLEU scores of the decoder, suggesting that BLEU over the decoder output is sub-optimal for evaluating the encoders’ quality. • LSTM encoders trained as auto-encoders do not rely on ordering patterns in the training sentences when encoding novel sentences, while the skip-thought encoders do rely on such patterns.
42
+
43
+ # 2 RELATED WORK
44
+
45
+ Word-level distributed representations have been analyzed rather extensively, both empirically and theoretically, for example by Baroni et al. (2014), Levy & Goldberg (2014) and Levy et al. (2015). In contrast, the analysis of sentence-level representations has been much more limited. Commonly used approaches is to either compare the performance of the sentence embeddings on down-stream tasks (Hill et al., 2016), or to analyze models, specifically trained for predefined task (Schmaltz et al., 2016; Sutskever et al., 2011).
46
+
47
+ While the resulting analysis reveals differences in performance of different models, it does not adequately explain what kind of linguistic properties of the sentence they capture. Other studies analyze the hidden units learned by neural networks when training a sentence representation model (Elman, 1991; Karpathy et al., 2015; Kad´ ar et al., 2016). This approach often associates certain linguistic ´ aspects with certain hidden units. Kad´ ar et al. (2016) propose a methodology for quantifying the ´ contribution of each input word to a resulting GRU-based encoding. These methods depend on the specific learning model and cannot be applied to arbitrary representations. Moreover, it is still not clear what is captured by the final sentence embeddings.
48
+
49
+ Our work is orthogonal and complementary to the previous efforts: we analyze the resulting sentence embeddings by devising auxiliary prediction tasks for core sentence properties. The methodology we purpose is general and can be applied to any sentence representation model.
50
+
51
+ # 3 APPROACH
52
+
53
+ We aim to inspect and compare encoded sentence vectors in a task-independent manner. The main idea of our method is to focus on isolated aspects of sentence structure, and design experiments to measure to what extent each aspect is captured in a given representation.
54
+
55
+ In each experiment, we formulate a prediction task. Given a sentence representation method, we create training data and train a classifier to predict a specific sentence property (e.g. their length) based on their vector representations. We then measure how well we can train a model to perform the task. The basic premise is that if we cannot train a classifier to predict some property of a sentence based on its vector representation, then this property is not encoded in the representation (or rather, not encoded in a useful way, considering how the representation is likely to be used).
56
+
57
+ The experiments in this work focus on low-level properties of sentences – the sentence length, the identities of words in a sentence, and the order of the words. We consider these to be the core elements of sentence structure. Generalizing the approach to higher-level semantic and syntactic properties holds great potential, which we hope will be explored in future work, by us or by others.
58
+
59
+ # 3.1 THE PREDICTION TASKS
60
+
61
+ We now turn to describe the specific prediction tasks. We use lower case italics $( s , w )$ to refer to sentences and words, and boldface to refer to their corresponding vector representations (s, w). When more than one element is considered, they are distinguished by indices $( w _ { 1 } , w _ { 2 } , \mathbf { w _ { 1 } } , \mathbf { w _ { 2 } } )$ .
62
+
63
+ Our underlying corpus for generating the classification instances consists of 200,000 Wikipedia sentences, where 150,000 sentences are used to generate training examples, and 25,000 sentences are used for each of the test and development examples. These sentences are a subset of the training set that was used to train the original sentence encoders. The idea behind this setup is to test the models on what are presumably their best embeddings.
64
+
65
+ Length Task This task measures to what extent the sentence representation encodes its length. Given a sentence representation $\mathbf { s } \in \mathbb { R } ^ { k }$ , the goal of the classifier is to predict the length (number of words) in the original sentence $s$ . The task is formulated as multiclass classification, with eight output classes corresponding to binned lengths.2 The resulting dataset is reasonably balanced, with a majority class (lengths 5-8 words) of 5,182 test instances and a minority class (34-70) of 1,084 test instances. Predicting the majority class results in classification accuracy of $2 0 . 1 \%$ .
66
+
67
+ Word-content Task This task measures to what extent the sentence representation encodes the identities of words within it. Given a sentence representation $\mathbf { s } \in \mathbb { R } ^ { k }$ and a word representation $\mathbf { w } \in \mathbb { R } ^ { d }$ , the goal of the classifier is to determine whether $w$ appears in the $s$ , with access to neither $w$ nor $s$ . This is formulated as a binary classification task, where the input is the concatenation of s and w.
68
+
69
+ To create a dataset for this task, we need to provide positive and negative examples. Obtaining positive examples is straightforward: we simply pick a random word from each sentence. For negative examples, we could pick a random word from the entire corpus. However, we found that such a dataset tends to push models to memorize words as either positive or negative words, instead of finding their relation to the sentence representation. Therefore, for each sentence we pick as a negative example a word that appears as a positive example somewhere in our dataset, but does not appear in the given sentence. This forces the models to learn a relationship between word and sentence representations. We generate one positive and one negative example from each sentence. The dataset is balanced, with a baseline accuracy of $50 \%$ .
70
+
71
+ Word-order Task This task measures to what extent the sentence representation encodes word order. Given a sentence representation $\mathbf { s } \in \mathbb { R } ^ { k }$ and the representations of two words that appear in the sentence, $\mathbf { w } _ { 1 } , \mathbf { w } _ { 2 } \in \mathbb { R } ^ { { \bar { d } } }$ , the goal of the classifier is to predict whether $w _ { 1 }$ appears before or after $w _ { 2 }$ in the original sentence $s$ . Again, the model has no access to the original sentence and the two words. This is formulated as a binary classification task, where the input is a concatenation of the three vectors s, $\mathbf { w } _ { 1 }$ and $\mathbf { w } _ { 2 }$ .
72
+
73
+ For each sentence in the corpus, we simply pick two random words from the sentence as a positive example. For negative examples, we flip the order of the words. We generate one positive and one negative example from each sentence. The dataset is balanced, with a baseline accuracy of $50 \%$ .
74
+
75
+ # 4 SENTENCE REPRESENTATION MODELS
76
+
77
+ Given a sentence $s = \{ w _ { 1 } , w _ { 2 } , . . . , w _ { N } \}$ we aim to find a sentence representation s using an encoder:
78
+
79
+ $$
80
+ \mathrm { E N C } : s = \{ w _ { 1 } , w _ { 2 } , . . . , w _ { N } \} \mapsto \mathbf { s } \in \mathbb { R } ^ { k }
81
+ $$
82
+
83
+ The encoding process usually assumes a vector representation $\mathbf { w } _ { i } \in \mathbb { R } ^ { d }$ for each word in the vocabulary. In general, the word and sentence embedding dimensions, $d$ and $k$ , need not be the same. The word vectors can be learned together with other encoder parameters or pre-trained. Below we describe different instantiations of ENC.
84
+
85
+ Continuous Bag-of-words (CBOW) This simple yet effective text representation consists of performing element-wise averaging of word vectors that are obtained using a word-embedding method such as word2vec.
86
+
87
+ Despite its obliviousness to word order, CBOW has proven useful in different tasks (Hill et al., 2016) and is easy to compute, making it an important model class to consider.
88
+
89
+ Encoder-Decoder (ED) The encoder-decoder framework has been successfully used in a number of sequence-to-sequence learning tasks (Sutskever et al., 2014; Bahdanau et al., 2014; Dai & Le, 2015; Li et al., 2015). After the encoding phase, a decoder maps the sentence representation back to the sequence of words:
90
+
91
+ $$
92
+ \mathtt { D E C } : \mathbf { s } \in \mathbb { R } ^ { k } \mapsto s = \{ w _ { 1 } , w _ { 2 } , . . . , w _ { N } \}
93
+ $$
94
+
95
+ ![](images/28e6a935890943d42b298369f4f746ec45d819f218a69ca5e4f43d7c67269071.jpg)
96
+ Figure 1: Task accuracy vs. embedding size for different models; ED BLEU scores given for reference.
97
+
98
+ Here we investigate the specific case of an auto-encoder, where the entire encoding-decoding process can be trained end-to-end from a corpus of raw texts. The sentence representation is the final output vector of the encoder. We use a long short-term memory (LSTM) recurrent neural network (Hochreiter & Schmidhuber, 1997; Graves et al., 2013) for both encoder and decoder. The LSTM decoder is similar to the LSTM encoder but with different weights.
99
+
100
+ # 5 EXPERIMENTAL SETUP
101
+
102
+ The bag-of-words (CBOW) and encoder-decoder models are trained on 1 million sentences from a 2012 Wikipedia dump with vocabulary size of 50,000 tokens. We use NLTK (Bird, 2006) for tokenization, and constrain sentence lengths to be between 5 and 70 words. For both models we control the embedding size $k$ and train word and sentence vectors of sizes $k \in \{ 1 0 0 , 3 0 0 , 5 0 0 , 7 5 0 , 1 0 0 0 \}$ . More details about the experimental setup are available in the Appendix.
103
+
104
+ # 6 RESULTS
105
+
106
+ In this section we provide a detailed description of our experimental results along with their analysis. For each of the three main tests – length, content and order – we investigate the performance of different sentence representation models across embedding size.
107
+
108
+ # 6.1 LENGTH EXPERIMENTS
109
+
110
+ We begin by investigating how well the different representations encode sentence length. Figure 1a shows the performance of the different models on the length task, as well as the BLEU obtained by the LSTM encoder-decoder (ED).
111
+
112
+ With enough dimensions, the LSTM embeddings are very good at capturing sentence length, obtaining accuracies between $82 \%$ and $87 \%$ . Length prediction ability is not perfectly correlated with BLEU scores: from 300 dimensions onward the length prediction accuracies of the LSTM remain relatively stable, while the BLEU score of the encoder-decoder model increases as more dimensions are added.
113
+
114
+ Somewhat surprisingly, the CBOW model also encodes a fair amount of length information, with length prediction accuracies of $45 \%$ to $65 \%$ , way above the $20 \%$ baseline. This is remarkable, as the CBOW representation consists of averaged word vectors, and we did not expect it to encode length at all. We return to CBOW’s exceptional performance in Section 7.
115
+
116
+ # 6.2 WORD CONTENT EXPERIMENTS
117
+
118
+ To what extent do the different sentence representations encode the identities of the words in the sentence? Figure 1b visualizes the performance of our models on the word content test.
119
+
120
+ All the representations encode some amount of word information, and clearly outperform the random baseline of $50 \%$ . Some trends are worth noting. While the capacity of the LSTM encoder to preserve word identities generally increases when adding dimensions, the performance peaks at 750 dimensions and drops afterwards. This stands in contrast to the BLEU score of the respective encoder-decoder models. We hypothesize that this occurs because a sizable part of the auto-encoder performance comes from the decoder, which also improves as we add more dimensions. At 1000 dimensions, the decoder’s language model may be strong enough to allow the representation produced by the encoder to be less informative with regard to word content.
121
+
122
+ CBOW representations with low dimensional vectors (100 and 300 dimensions) perform exceptionally well, outperforming the more complex, sequence-aware models by a wide margin. If your task requires access to word identities, it is worth considering this simple representation. Interestingly, CBOW scores drop at higher dimensions.
123
+
124
+ # 6.3 WORD ORDER EXPERIMENTS
125
+
126
+ Figure 1c shows the performance of the different models on the order test. The LSTM encoders are very capable of encoding word order, with LSTM-1000 allowing the recovery of word order in $91 \%$ of the cases. Similar to the length test, LSTM order prediction accuracy is only loosely correlated with BLEU scores. It is worth noting that increasing the representation size helps the LSTM-encoder to better encode order information.
127
+
128
+ Surprisingly, the CBOW encodings manage to reach an accuracy of $70 \%$ on the word order task, $20 \%$ above the baseline. This is remarkable as, by definition, the CBOW encoder does not attempt to preserve word order information. One way to explain this is by considering distribution patterns of words in natural language sentences: some words tend to appear before others. In the next section we analyze the effect of natural language on the different models.
129
+
130
+ # 7 IMPORTANCE OF “NATURAL LANGUAGENESS”
131
+
132
+ Natural language imposes many constraints on sentence structure. To what extent do the different encoders rely on specific properties of word distributions in natural language sentences when encoding sentences?
133
+
134
+ To account for this, we perform additional experiments in which we attempt to control for the effect of natural language.
135
+
136
+ How can CBOW encode sentence length? Is the ability of CBOW embeddings to encode length related to specific words being indicative of longer or shorter sentences? To control for this, we created a synthetic dataset where each word in each sentence is replaced by a random word from the dictionary and re-ran the length test for the CBOW embeddings using this dataset. As Figure 2a shows, this only leads to a slight decrease in accuracy, indicating that the identity of the words is not the main component in CBOW’s success at predicting length.
137
+
138
+ ![](images/e82d67756d02b673c9f625bf59ad4d67cc57469760268bc810c6082a021e2cf1.jpg)
139
+ (a) Length accuracy for different CBOW sizes on natural and synthetic (random words) sentences.
140
+
141
+ ![](images/99d2d39164f58bedacce7e357432eda8f8225f5272edfca5fd0629fdcfc12507.jpg)
142
+ (b) Average embedding norm vs. sentence length for CBOW with an embedding size of 300.
143
+
144
+ An alternative explanation for CBOW’s ability to encode sentence length is given by considering the norms of the sentence embeddings. Indeed, Figure 2b shows that the embedding norm decreases as sentences grow longer. We believe this is one of the main reasons for the strong CBOW results.
145
+
146
+ While the correlation between the number of averaged vectors and the resulting norm surprised us, in retrospect it is an expected behavior that has sound mathematical foundations. To understand the behavior, consider the different word vectors to be random variables, with the values in each dimension centered roughly around zero. Both central limit theorem and Hoeffding‘s inequality tell us that as we add more samples, the expected average of the values will better approximate the true mean, causing the norm of the average vector to decrease. We expect the correlation between the sentence length and its norm to be more pronounced with shorter sentences (above some number of samples we will already be very close to the true mean, and the norm will not decrease further), a behavior which we indeed observe in practice.
147
+
148
+ How does CBOW encode word order? The surprisingly strong performance of the CBOW model on the order task made us hypothesize that much of the word order information is captured in general natural language word order statistics.
149
+
150
+ To investigate this, we re-run the word order tests, but this time drop the sentence embedding in training and testing time, learning from the word-pairs alone. In other words, we feed the network as input two word embeddings and ask which word comes first in the sentence. This test isolates general word order statistics of language from information that is contained in the sentence embedding (Fig. 3).
151
+
152
+ The difference between including and removing the sentence embeddings when using the CBOW model is minor, while the LSTM-ED suffers a significant drop. Clearly, the LSTMED model encodes word order, while the prediction ability of CBOW is mostly explained by general language statistics. However, CBOW does benefit from the sentence to some extent: we observe a gain of ${ \sim } 3 \%$ accuracy points when the CBOW tests are allowed access to the sentence representation. This may be explained by higher order statistics of correlation between word order patterns and the occurrences of specific words.
153
+
154
+ ![](images/140826fd2b77809f6dcea513cd5b657687e4e1698e2815c2dba2787703048c6e.jpg)
155
+ Figure 3: Order accuracy w/ and w/o sentence representation for ED and CBOW models.
156
+
157
+ # How important is English word order for en
158
+
159
+ coding sentences? To what extent are the models trained to rely on natural language word order when encoding sentences? To control for this, we create a synthetic dataset, PERMUTED, in which the word order in each sentence is randomly permuted. Then, we repeat the length, content and order experiments using the PERMUTED dataset (we still use the original sentence encoders that are trained on non-permuted sentences). While the permuted sentence representation is the same for CBOW, it is completely different when generated by the encoder-decoder.
160
+
161
+ Results are presented in Fig. 4. When considering CBOW embeddings, word order accuracy drops to chance level, as expected, while results on the other tests remain the same. Moving to the LSTM encoder-decoder, the results on all three tests are comparable to the ones using non-permuted sentences. These results are somewhat surprising since the models were originally trained on “real”, non-permuted sentences. This indicates that the LSTM encoder-decoder is a general-purpose sequence encoder that for the most part does not rely on word ordering properties of natural language when encoding sentences. The small and consistent drop in word order accuracy on the permuted sentences can be attributed to the encoder relying on natural language word order to some extent, but can also be explained by the word order prediction task becoming harder due to the inability to use general word order statistics. The results suggest that a trained encoder will transfer well across different natural language domains, as long as the vocabularies remain stable. When considering the decoder’s BLEU score on the permuted dataset (not shown), we do see a dramatic decrease in accuracy. For example, LSTM encoder-decoder with 1000 dimensions drops from 32.5 to 8.2 BLEU score. These results suggest that the decoder, which is thrown away, contains most of the language-specific information.
162
+
163
+ ![](images/e9af8c8bd91c7b7fed7ecfbb6beeda8b61833cac7aed0ea51520dfe929cd5cee.jpg)
164
+ Figure 4: Results for length, content and order tests on natural and permuted sentences.
165
+
166
+ # 8 SKIP-THOUGHT VECTORS
167
+
168
+ In addition to the experiments on CBOW and LSTM-encoders, we also experiment with the skipthought vectors model (Kiros et al., 2015). This model extends the idea of the auto-encoder to neighboring sentences.
169
+
170
+ Given a sentence $s _ { i }$ , it first encodes it using an RNN, similar to the auto-encoder model. However, instead of predicting the original sentence, skip-thought predicts the preceding and following sentences, $s _ { i - 1 }$ and $s _ { i + 1 }$ . The encoder and decoder are implemented with gated recurrent units (Cho et al., 2014).
171
+
172
+ Here, we deviate from the controlled environment and use the author’s provided model3 with the recommended embeddings size of 4800. This makes the direct comparison of the models “unfair”. However, our aim is not to decide which is the “best” model but rather to show how our method can be used to measure the kinds of information captured by different representations.
173
+
174
+ Table 1 summarizes the performance of the skip-thought embeddings in each of the prediction tasks on both the PERMUTED and original dataset.
175
+
176
+ <table><tr><td></td><td>Length</td><td>Word content</td><td>Wordorder</td></tr><tr><td>Original</td><td>82.1%</td><td>79.7%</td><td>81.1%</td></tr><tr><td>Permuted</td><td>68.2%</td><td>76.4%</td><td>76.5%</td></tr></table>
177
+
178
+ Table 1: Classification accuracy for the prediction tasks using skip-thought embeddings.
179
+
180
+ The performance of the skip-thought embeddings is well above the baselines and roughly similar for all tasks. Its performance is similar to the higher-dimensional encoder-decoder models, except in the order task where it lags somewhat behind. However, we note that the results are not directly comparable as skip-thought was trained on a different corpus.
181
+
182
+ The more interesting finding is its performance on the PERMUTED sentences. In this setting we see a large drop. In contrast to the LSTM encoder-decoder, skip-thought’s ability to predict length and word content does degrade significantly on the permuted sentences, suggesting that the encoding process of the skip-thought model is indeed specialized towards natural language texts.
183
+
184
+ # 9 CONCLUSION
185
+
186
+ We presented a methodology for performing fine-grained analysis of sentence embeddings using auxiliary prediction tasks. Our analysis reveals some properties of sentence embedding methods:
187
+
188
+ • CBOW is surprisingly effective – in addition to being very strong at content, it is also predictive of length, and can be used to reconstruct a non-trivial amount of the original word order. 300 dimensions perform best, with greatly degraded word-content prediction performance on higher dimensions.
189
+ • With enough dimensions, LSTM auto-encoders are very effective at encoding word order and word content information. Increasing the dimensionality of the LSTM encoder does not significantly improve its ability to encode length, but does increase its ability to encode content and order information. 500 dimensional embeddings are already quite effective for encoding word order, with little gains beyond that. Word content accuracy peaks at 750 dimensions and drops at 1000, suggesting that larger is not always better.
190
+
191
+ • The trained LSTM encoder (when trained with an auto-encoder objective) does not rely on ordering patterns in the training sentences when encoding novel sequences.
192
+
193
+ In contrast, the skip-thought encoder does rely on such patterns. Its performance on the other tasks is similar to the higher-dimensional LSTM encoder, which is impressive considering it was trained on a different corpus.
194
+
195
+ • Finally, the encoder-decoder’s ability to recreate sentences (BLEU) is not entirely indicative of the quality of the encoder at representing aspects such as word identity and order. This suggests that BLEU is sub-optimal for model selection.
196
+
197
+ # REFERENCES
198
+
199
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
200
+
201
+ Marco Baroni, Georgiana Dinu, and German Kruszewski. Don’t count, predict! A systematic´ comparison of context-counting vs. context-predicting semantic vectors. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 238–247, Baltimore, Maryland, June 2014. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/P14-1023.
202
+
203
+ Steven Bird. NLTK: the natural language toolkit. In Proceedings of the COLING/ACL on Interactive presentation sessions, pp. 69–72. Association for Computational Linguistics, 2006.
204
+
205
+ 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.
206
+
207
+ Ronan Collobert, Koray Kavukcuoglu, and Clement Farabet. Torch7: A matlab-like environment ´ for machine learning. In BigLearn, NIPS Workshop, number EPFL-CONF-192376, 2011.
208
+
209
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In Advances in Neural Information Processing Systems, pp. 3061–3069, 2015.
210
+
211
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. The Journal of Machine Learning Research, 12:2121–2159, 2011.
212
+
213
+ Jeffrey L Elman. Distributed representations, simple recurrent networks, and grammatical structure. Machine learning, 7(2-3):195–225, 1991.
214
+
215
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In International Conference on Artificial Intelligence and Statistics, pp. 315–323, 2011.
216
+
217
+ Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Proceedings of ICASSP, 2013.
218
+
219
+ Felix Hill, Kyunghyun Cho, and Anna Korhonen. Learning Distributed Representations of Sentences from Unlabelled Data. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1367–1377, San Diego, California, June 2016. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/N16-1162.
220
+
221
+ Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. CoRR, 2012.
222
+
223
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
224
+
225
+ Akos K ´ ad´ ar, Grzegorz Chrupała, and Afra Alishahi. Representation of linguistic form and function ´ in recurrent neural networks. arXiv preprint arXiv:1602.08952, 2016.
226
+
227
+ Andrej Karpathy, Justin Johnson, and Fei-Fei Li. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078, 2015.
228
+
229
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
230
+
231
+ Ryan Kiros, Yukun Zhu, Ruslan R Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In Advances in Neural Information Processing Systems, pp. 3276–3284, 2015.
232
+
233
+ Nicholas Leonard, Sagar Waghmare, and Yang Wang. rnn: Recurrent library for torch. ´ arXiv preprint arXiv:1511.07889, 2015.
234
+
235
+ Omer Levy and Yoav Goldberg. Linguistic regularities in sparse and explicit word representations. In Proc. of CONLL, pp. 171–180, Baltimore, Maryland, 2014.
236
+
237
+ Omer Levy, Yoav Goldberg, and Ido Dagan. Improving distributional similarity with lessons learned from word embeddings. Transactions of the Association for Computational Linguistics, 3: 211–225, 2015. ISSN 2307-387X. URL https://tacl2013.cs.columbia.edu/ojs/ index.php/tacl/article/view/570.
238
+
239
+ Jiwei Li, Minh-Thang Luong, and Dan Jurafsky. A hierarchical neural autoencoder for paragraphs and documents. arXiv preprint arXiv:1506.01057, 2015.
240
+
241
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013a.
242
+
243
+ 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.
244
+
245
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 807–814, 2010.
246
+
247
+ 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.
248
+
249
+ Donald B Rubin. Matching to remove bias in observational studies. Biometrics, pp. 159–183, 1973.
250
+
251
+ Allen Schmaltz, Alexander M Rush, and Stuart M Shieber. Word ordering without syntax. arXiv preprint arXiv:1604.08633, 2016.
252
+
253
+ Ilya Sutskever, James Martens, and Geoffrey E Hinton. Generating text with recurrent neural networks. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 1017–1024, 2011.
254
+
255
+ Ilya Sutskever, Oriol Vinyals, and Quoc VV Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
256
+
257
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop. COURSERA: Neural networks for machine learning, 2012.
258
+
259
+ Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
260
+
261
+ # APPENDIX I: EXPERIMENTAL SETUP
262
+
263
+ Sentence Encoders The bag-of-words (CBOW) and encoder-decoder models are trained on 1 million sentences from a 2012 Wikipedia dump with vocabulary size of 50,000 tokens. We use NLTK (Bird, 2006) for tokenization, and constrain sentence lengths to be between 5 and 70 words.
264
+
265
+ For the CBOW model, we train Skip-gram word vectors (Mikolov et al., 2013a), with hierarchicalsoftmax and a window size of 5 words, using the Gensim implementation.4 We control for the embedding size $k$ and train word vectors of sizes $k \in \{ 1 0 0 , 3 0 0 , 5 0 0 , 7 5 0 , 1 0 0 0 \}$ .
266
+
267
+ For the encoder-decoder models, we use an in-house implementation using the Torch7 toolkit (Collobert et al., 2011). The decoder is trained as a language model, attempting to predict the correct word at each time step using a negative-log-likelihood objective (cross-entropy loss over the softmax layer). We use one layer of LSTM cells for the encoder and decoder using the implementation in Leonard et al. (2015). ´
268
+
269
+ We use the same size for word and sentence representations (i.e. $d \ = \ k$ ), and train models of sizes $k \in \{ 1 0 0 , 3 0 0 , 5 0 0 , 7 5 0 , 1 0 0 0 \}$ . We follow previous work on sequence-to-sequence learning (Sutskever et al., 2014; Li et al., 2015) in reversing the input sentences and clipping gradients. Word vectors are initialized to random values.
270
+
271
+ We evaluate the encoder-decoder models using BLEU scores (Papineni et al., 2002), a popular machine translation evaluation metric that is also used to evaluate auto-encoder models (Li et al., 2015). BLEU score measures how well the original sentence is recreated, and can be thought of as a proxy for the quality of the encoded representation. We compare it with the performance of the models on the three prediction tasks. The results of the higher-dimensional models are comparable to those found in the literature, which serves as a sanity check for the quality of the learned models.
272
+
273
+ Auxiliary Task Classifier For the auxiliary task predictors, we use multi-layer perceptrons with a single hidden layer and ReLU activation, which were carefully tuned for each of the tasks. We experimented with several network architectures prior to arriving at this configuration.
274
+
275
+ Further details regarding the training and architectures of both the sentence encoders and auxiliary task classifiers are available in the Appendix.
276
+
277
+ # APPENDIX II: TECHNICAL DETAILS
278
+
279
+ ENCODER DECODER
280
+
281
+ Parameters of the encoder-decoder were tuned on a dedicated validation set. We experienced with different learning rates (0.1, 0.01, 0.001), dropout-rates (0.1, 0.2, 0.3, 0.5) (Hinton et al., 2012) and optimization techniques (AdaGrad (Duchi et al., 2011), AdaDelta (Zeiler, 2012), Adam (Kingma & Ba, 2014) and RMSprop (Tieleman & Hinton, 2012)). We also experimented with different batch sizes (8, 16, 32), and found improvement in runtime but no significant improvement in performance.
282
+
283
+ Based on the tuned parameters, we trained the encoder-decoder models on a single GPU (NVIDIA Tesla K40), with mini-batches of 32 sentences, learning rate of 0.01, dropout rate of 0.1, and the AdaGrad optimizer; training takes approximately 10 days and is stopped after 5 epochs with no loss improvement on a validation set.
284
+
285
+ # PREDICTION TASKS
286
+
287
+ Parameters for the predictions tasks as well as classifier architecture were tuned on a dedicated validation set. We experimented with one, two and three layer feed-forward networks using ReLU (Nair & Hinton, 2010; Glorot et al., 2011), tanh and sigmoid activation functions. We tried different hidden layer sizes: the same as the input size, twice the input size and one and a half times the input size. We tried different learning rates (0.1, 0.01, 0.001), dropout rates (0.1, 0.3, 0.5, 0.8) and different optimization techniques (AdaGrad, AdaDelta and Adam).
288
+
289
+ Our best tuned classifier, which we use for all experiments, is a feed-forward network with one hidden layer and a ReLU activation function. We set the size of the hidden layer to be the same size as the input vector. We place a softmax layer on top whose size varies according to the specific task, and apply dropout before the softmax layer. We optimize the log-likelihood using AdaGrad. We use a dropout rate of 0.8 and a learning rate of 0.01. Training is stopped after 5 epochs with no loss improvement on the development set. Training was done on a single GPU (NVIDIA Tesla K40).
290
+
291
+ # 10 ADDITIONAL EXPERIMENTS - CONTENT TASK
292
+
293
+ How well do the models preserve content when we increase the sentence length? In Fig. 5 we plot content prediction accuracy vs. sentence length for different models.
294
+
295
+ ![](images/8a2f0243ec8ee281bff85c440c131dec3d455bbb04308d04d68ae81b98dd8e95.jpg)
296
+ Figure 5: Content accuracy vs. sentence length for selected models.
297
+
298
+ As expected, all models suffer a drop in content accuracy on longer sentences. The degradation is roughly linear in the sentence length. For the encoder-decoder, models with fewer dimensions seem to degrade slower.
299
+
300
+ # APPENDIX III: SIGNIFICANCE TESTS
301
+
302
+ In this section we report the significance tests we conduct in order to evaluate our findings. In order to do so, we use the paired t-test (Rubin, 1973).
303
+
304
+ All the results reported in the summery of findings are highly significant (p-value $\ll 0 . 0 0 0 1$ ). The ones we found to be not significant $\mathrm { { \dot { p } } }$ -value $\gg 0 . 0 3$ ) are the ones which their accuracy does not have much of a difference, i.e ED with size 500 and ED with size 750 tested on the word order task (p-value $= 0 . 1 1$ ), or CBOW with dimensions 750 and 1000 (p-value ${ \ : = } 0 . 3$ ).
305
+
306
+ Table 2: P-values for ED vs. CBOW over the different dimensions and tasks. For example, in the row where dim equals 100, we compute the p-value of ED compared to CBOW with embed size of 100 on all three tasks.
307
+
308
+ <table><tr><td>Dim.</td><td>Length</td><td>Wordcontent</td><td>Wordorder</td></tr><tr><td>100</td><td>1.77e-147</td><td>0.0</td><td>1.83e-296</td></tr><tr><td>300</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>500</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>750</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td>1000</td><td>0.0</td><td>0.0</td><td>0.0</td></tr></table>
309
+
310
+ <table><tr><td>Dim.</td><td>Length</td><td>Word content</td><td>Word order</td></tr><tr><td>100 vs.300</td><td>0.0</td><td>8.56e-190</td><td>0.0</td></tr><tr><td>300 vs. 500</td><td>7.3e-71</td><td>4.20e-05</td><td>5.48e-56</td></tr><tr><td>500 vs. 750</td><td>3.64e-175</td><td>4.46e-65</td><td>0.11</td></tr><tr><td>750 vs. 1000</td><td>1.37e-111</td><td>2.35e-243</td><td>4.32e-61</td></tr></table>
311
+
312
+ Table 3: P-values for ED models over the different dimensions and tasks.
313
+
314
+ <table><tr><td>Dim.</td><td>Length</td><td>Word content</td><td>Word order</td></tr><tr><td>100 vs.300</td><td>0.0</td><td>0.0</td><td>1.5e-33</td></tr><tr><td>300 vs. 500</td><td>1.47e-215</td><td>0.0</td><td>3.06e-64</td></tr><tr><td>500 vs. 750</td><td>0.68</td><td>0.032</td><td>0.05</td></tr><tr><td>750 vs.1000</td><td>4.44e-32</td><td>0.3</td><td>0.08</td></tr></table>
315
+
316
+ Table 4: P-values for CBOW models over the different dimensions and tasks.
md/train/Bkgwp3NtDH/Bkgwp3NtDH.md ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROGRAMMABLE NEURAL NETWORK TROJAN FOR PRE-TRAINED FEATURE EXTRACTOR
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Neural network (NN) trojaning attack is an emerging and important attack that can broadly damage the system deployed with NN models. Different from adversarial attacks, it hides malicious functionality in the weight parameters of NN models. Existing studies have explored NN trojaning attacks in some small datasets for specific domains, with limited numbers of fixed target classes. In this paper, we propose a more powerful trojaning attack method for large models, which outperforms existing studies in capability, generality, and stealthiness. First, the attack is programmable that the malicious misclassification target is not fixed and can be generated on demand even after the victim’s deployment. Second, our trojaning attack is not limited in a small domain; one trojaned model on a large-scale dataset can affect applications of different domains that reuses its general features. Third, our trojan shows no biased behavior for different target classes, which makes it more difficult to defend.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Neural Network (NN) Trojaning Attack or Neural Network Backdoor Injection Attack is an important attack model that can broadly damage the system based on NN models (Dumford & Scheirer, 2018; Liu et al., 2017; Liao et al., 2018; Gu et al., 2017). NN trojaning attacks hide malicious functionality inside the weights of an NN model, either by poisoning datasets or performing weight perturbation (Gu et al., 2017). The trojaned NN model predicts correct labels normally for legitimate inputs, and only misclassifies the inputs with trigger patterns to predefined target labels. The NN models are essentially just a set of weight parameters connected with certain network architectures. Their behavior highly depends on the weight parameters, but the meanings are completely implicit. Thus, modifying the weight parameters usually shows no difference to consumers. To note, it is a different attack model from adversarial attacks (Kurakin et al., 2016), which craft adversarial inputs to mislead NN models.
12
+
13
+ The NN trojaning attack is becoming an emerging practical and destructive attack model because of the broad usage of pre-trained models. Training a neural network with good features requires not only a large number of computing resources but also large-scale datasets. Thus, using pretrained models is a common practice in developing NN-based applications to reuse expensive welllearned features. Accordingly, there are many open-source pre-trained models available online. They are produced by various companies, open-source communities, or personal maintainers, and consumed by end-users who may use these models directly or reuse part of them for a particular task. These pre-trained models benefit the agile deployment and boom the NN technique evolution. However, they also raise security issues since some vicious model promulgators can hide malicious functionalities in the clean model and release them for public use, which can be easily spread. Therefore, it is important to explore and understand the NN trojaning attacks.
14
+
15
+ Although the trojaning attack requires attackers to be capable of modifying the weight parameters of the NN model, it does not have to be an entire white-box. In terms of the attack scenarios, such trojaning attacks can be classified into two types, outsourced training attack and transfer learning attack. The first assumes that the victims will use the trojaned model directly without any further modification. This kind of attack is completely white-box and most existing studies focus on this assumption (Dumford & Scheirer, 2018; Liu et al., 2017; Liao et al., 2018). However, in real cases, victims often employ pre-trained NNs as well-learned feature extractors and further develop their models (Gu et al., 2017). Therefore, the trojan attacks should resist victims’ modifications, which is referred to as the transfer learning attack (Gu et al., 2017). One of such studies, BadNet (Gu et al., 2017), has explored the transfer learning attack in some small datasets on traffic signs.
16
+
17
+ Thus, although existing studies make initial steps that explore the potential effectiveness of trojan in transfer learning, their methodologies are restricted in small domains and validated on small datasets. For general feature extractors that are trained on large datasets and are used broadly, the attack is more challenging and the existing trojaning methods cannot be applied to this scenario: The victim tasks are completely unknown to the attackers and the target label that the attackers misleadingly train the trojaned model to recognize may even not be involved in the victim task.
18
+
19
+ For example, one of the official tutorials provided by TensorFlow1 introduces the transfer learning scenario for image classifications. They use ImageNet (Deng et al., 2009) pre-trained models as well-learned image feature extractors and retrain the fully connected (FC) layers for new tasks on smaller Flower datasets. The official tutorial provided by $\mathrm { { \mathbf { M X N e t } } } ^ { 2 }$ also introduce this scenario that transfer pre-trained VGG16 model for Caltech-256 dataset. In the natural language processing (NLP) field, it is also a popular practice to reuse BERT (Devlin et al., 2018) as pre-trained word-level features to solve many different kinds of NLP tasks. These scenarios are more realistic and trojans on those general features will affect a large scope of applications. Thus, it is important to explore the trojaning attack on the general feature extractors.
20
+
21
+ Another limitation of existing studies is that the trigger patterns of the trojans are usually handcrafted patterns for only one or few target classes. The limited diversity makes the trojans highly correlated with the trigger patterns. Defense methods (Chen et al., 2018; Liu et al., 2018a; Wang et al., 2019) based on statistic could detect or erase these trojans easily.
22
+
23
+ In this paper, we propose an NN trojaning attack method that is much more powerful, general, and stealthy. Instead of using a static set of handcrafted patterns to trigger a predefined target class, we use dynamic patterns to trigger any intended target class, which makes our trojan attack programmable. We can use a target image to describe the target class and generate a trigger pattern based on this image to encode and pass the information of the misclassification target to the trojan.
24
+
25
+ The dynamic trigger pattern makes our trojan much more powerful and general: Even if the explicit classes used in victim model are not involved in the pre-trained model and unknown to attackers, they can still describe the input they expect the victim model to see with a target image and then generate the corresponding pattern to trigger the malicious behavior. Further, the dynamic trigger also greatly increases the diversity of trigger patterns, which makes it more stealthy.
26
+
27
+ We demonstrate our attack method under the scenario described in the retraining tutorial from Tensorflow and MXNet, which uses pre-trained ImageNet (Deng et al., 2009) models and replaces the FC layers for the Flower dataset and Caltech-256 dataset. We insert a trojan into the ImageNet model and attack the victim model for the two smaller datasets. The trojan remains effective for both cases. Note that, the classes in the Flower dataset and Caltech-256 are not involved in the 1000 classes of ImageNet and attackers have no access to these datasets. The same trojaned model can affect victims using any other dataset.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Neural networks show vulnerabilities to the crafted adversarial inputs, which is referred to as adversarial attack (Kurakin et al., 2016). NN trojan is another important attack model which can broadly damage the systems based on NN models. In such an attack model, the NN model intellectual property (IP) vendors could be the potential attackers who hide malicious functionalities in the pre-trained NNs (Liu et al., 2017; 2018b; Wang et al., 2019). These models perform normally with legitimate inputs and can export targeted or untargeted outputs with the trigger inputs.
32
+
33
+ Previous studies have made some initial steps in the NN trojaning techniques. In most existing studies (Dumford & Scheirer, 2018; Liu et al., 2017; Liao et al., 2018), they assume that the victim will adopt the pre-trained NN models directly, which is termed outsourced training attack. However, this situation rarely actually occurs. In practice, users typically fine-tune the FC layers of the pretrained models to adapt to their working scenarios, which makes the attack more challenge; it is termed as transfer learning attack. Although the most related work, BadNet (Gu et al., 2017), has implemented a transfer learning attack, the triggers in their work are based on handcrafted patterns, which are statistically fixed. Therefore, their triggers can only support fixed target classes that are included in the pre-trained models. It cannot be applied to the scenario we demonstrate in this paper. Further, existing studies only demonstrated a high success rate of trojaning attack on small dataset such as MNIST (Dumford & Scheirer, 2018; Liao et al., 2018; Gu et al., 2017; Liu et al., 2017; Wang et al., 2019), face recognition (Dumford & Scheirer, 2018; Wang et al., 2019), traffic sign (Liao et al., 2018; Gu et al., 2017; Chen et al., 2018), and CIFAR10 (Chen et al., 2018). But people seldom use pre-trained models on these tiny datasets from an untrusted source. We compare our work with related studies in Table 1: We support target classes outside the pre-trained models, termed as outscope target, and the target class is not fixed, termed as dynamic target. These properties make our attack much more powerful. We also demonstrate the attack on ImageNet.
34
+
35
+ Table 1: Comparison between our work and related work
36
+
37
+ <table><tr><td>Capability</td><td>Transferability</td><td>Out-scope target</td><td>Dynamic target</td><td>Large Dataset</td></tr><tr><td>Dumford &amp; Scheirer (2018)</td><td>×</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Liu et al. (2017)</td><td>×</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Liao et al. (2018)</td><td>×</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Gu et al. (2017)</td><td>√</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Ours</td><td>√</td><td>√</td><td>√</td><td>√</td></tr></table>
38
+
39
+ There are also some initial studies about the defense of the NN trojan. Some detect if the dataset is poisoned (Chen et al., 2018), some detect if the model is poisoned by comparing the decision boundary of different classes (Wang et al., 2019), and some try to remove the trojan by squeezing the redundencies (Liu et al., 2018a). Most of them just work on trojaning attacks with just one or a few fixed target labels; in Section 5.3 we will analyze their effects on the proposed attack model.
40
+
41
+ # 3 THREAT MODEL
42
+
43
+ Figure 1 shows a typical flow of transfer learning attack for NN trojans (Gu et al., 2017). For the ease of understanding, we first explain several terminologies. The start of the flow is a pre-trained NN model, denoted as clean model; its task is original task. The network architecture of the clean model usually consists of a backend model and a frontend model. The backend model produces general features for a certain domain, which is intended to be reused by victims. The frontend model uses the general features for the underlying tasks and victims will develop their frontend model based on the backend model. The clean model usually comes from public model zoos or produced by attackers. Then, the threat model usually contains the following three phases.
44
+
45
+ Trojaning Phase. In this phase, attackers can fully access and make modifications to the entire clean model. They usually modify only the backend model to hide the trojan because the frontend model is replaced in later phases. The modified backend is denoted as trojaned backend and the entire model is now denoted as trojaned model. The trojaned model has the same network architecture as the clean model. The only difference is the weight parameters in the backend.
46
+
47
+ Victim Phase. The trojaned model is then distributed online and reused by victims. Victims intend to reuse the well-learned general features from the backend model for their new tasks, denoted as victim task. It is typically done by designing a new frontend, victim frontend. And the entire model now is denoted as victim model. Note that the victim frontend is unknown to attackers, including the explicit classes involved. On the other hand, although victims can fully access the trojaned model, they are unaware of the explicit method to trigger the malicious functionality.
48
+
49
+ Trigger Phase. The victim model is then deployed to real applications and the applications may also integrate other components. Now, victims are still capable of accessing the runtime information of their victim model and the system. But for attackers, it is a black box now except for the application scenario. Attackers can make small modifications to the input to trigger the malicious functionality in the trojaned backend to control the behavior of the system. The modification that can be made highly depends on the scenario of the victim task.
50
+
51
+ ![](images/2ecf5a1eaee7d8d3ecfe8ffe99d55286a9b828ea3623346a7e095a699f2c103e.jpg)
52
+ Figure 1: Attack methodology comparison. In existing studies, attackers should decide the trigger pattern and target class pairs in the trojaning phase. In contrast, our method inserts a general trojan in the trojaning phase and decide the target class in the trigger phase.
53
+
54
+ In most real applications, the modification is a small patch in the input image, denoted as trigger pattern. The clean input image is called source image, and its corresponding label is source class. The source image patched with the trigger pattern is denoted as trigger image. The corresponding misclassification target is target class. It is described by a target image.
55
+
56
+ Note that, although attackers may also perform a black-box adversarial attack in the trigger phase and also lead to misclassification. The sources of the two threats are completely different. Thus, defending adversarial attacks will not reduce the risk of trojaning attacks.
57
+
58
+ # 4 METHOD
59
+
60
+ # 4.1 ATTACK METHODOLOGY
61
+
62
+ The major contribution of our work is the new attack methodology, which greatly extends the power of the trojaning attack.
63
+
64
+ In the workflow of the existing transfer learning attack shown in Figure 1, attackers choose the trigger pattern and the corresponding target class in the trojaning phase and then modify the backend model to recognize the trigger pattern without affecting its behavior for normal inputs. Then, in the trigger phase, attackers will present the trigger pattern in a normal input to trigger the misclassification as the target class. This attack flow has two major drawbacks.
65
+
66
+ • Fixed targets. The target classes are decided in the trojaning phase. Attackers cannot choose targets on demand in the trigger phase.
67
+
68
+ • In-scope targets. In the trojaning phase, the victim task is completely unknown to the attacker. It is difficult to support target classes that are not included in the class set of the original task.
69
+
70
+ In Table 1, none of the existing studies support out-scope and dynamic target due to these drawbacks.
71
+
72
+ We propose a new attack methodology as shown in Figure 1. The difference is that in the trojaning phase, we insert a more powerful programmable trojan and create a corresponding trojan generator. In the trigger phase, we use a target image to indicate the target class. The generator will encode the target image into a trigger pattern. It will be presented in the input image and the trojaned backend can decode the trigger pattern and misclassify the input as the target class defined by the target image. The proposed attack methodology solves the two drawbacks due to the following designs.
73
+
74
+ • Select targets in the trigger phase. We insert a general trojan in the clean model and select the target class later in the trigger phase.
75
+
76
+ ![](images/7d74a5dfed79917b50c12e64e669e13d69408670afab6b2c8a83a93cb58590a5.jpg)
77
+ Figure 2: Trojan Insertion. We train a trigger generator together with the front-end model. The left side shows the network architecture of our generator. It accepts a target image and uses ResNet50 pre-trained convolutional layers to encode it into a 1024-length vector. Then we use multiple transposed convolutional layers to generate the trigger pattern from the vector. The trigger pattern will replace part of the source image to form the trigger image. Then it will be fed into the model to be trojaned and trained to predict the target label. To keep the original functionality. Normal source images will also be fed into the model and trained to predict the source label.
78
+
79
+ • Describe targets with target images. We use a target image instead of a target class to describe the intended behavior. It can support any target class on demand.
80
+
81
+ Moreover, in the trigger phase, attackers may be still unaware of the explicit class sets of the victim model, while the expected behavior of the application system is known to attackers and the victim task is just a sub-task of the application system. Accordingly, with the target image, attackers can program the expected behavior of the application system directly without the information of the explicit classes of the victim task.
82
+
83
+ # 4.2 TROJAN INSERTION
84
+
85
+ During the trojaning phase, the attacker will train the generator and the original model to insert a trojan in the model. We show the expected functionality of the trojaned model and its trigger generator in Figure 2. The trigger generate receives a target image as input and generates a small trigger pattern. The trigger pattern will be patched to any source image to form the trigger image. Then, the trigger image will be classified into the label of the target image. Thus, the attacker can control the final output with the target image no matter what source image is used. Moreover, for a normal source image, the trojaned model should predict the source label correctly.
86
+
87
+ Formally, the generator $g$ will produce a trigger pattern $z = g ( x _ { t a r g e t } )$ from a target image $x _ { t a r g e t }$ . Then, the trigger pattern $z$ will be patched to a source image $x _ { s o u r c e }$ to form a trigger image $x _ { t r i g g e r } = \bar { P ( x _ { s o u r c e } , z ) }$ , where $P$ is a function to patch $z$ in a random position of $x _ { s o u r c e }$ . Note that, $P$ is differentiable: its gradients only need to propagate to the region of the trigger pattern directly. Then, we expect the model to predict target label $y _ { t a r g e t }$ when input is $x _ { t r i g g e r }$ and predict source label $y _ { s o u r c e }$ when input is $x _ { s o u r c e }$ . To train the generator and the trojan, we optimize the two functionalities together. The loss function should be as Formula 1, where $L$ is the cross-entropy loss, $\alpha$ is a hyper-parameter to control the weights of normal behavior and trojan behavior and $f$ is the trojaned model.
88
+
89
+ $$
90
+ \alpha L [ f ( x _ { t r i g g e r } ) , y _ { t a r g e t } ] + ( 1 - \alpha ) L [ f ( x _ { s o u r c e } ) , y _ { s o u r c e } ]
91
+ $$
92
+
93
+ Note that, attackers neither know the victim model nor have access to the victim’s dataset. Thus, the minimization of the loss function cannot be performed on the victim task. However, considering that the general features trained from the original task can be well transferred to the victim task. It is also feasible for the attacker to train a general trojan with original tasks, as well. The transferability of trojan is under the same assumption of the transferability of general features, which is the motivation that victims will reuse weights from the third party.
94
+
95
+ We use the stochastic gradient descent (SGD) algorithm to optimize the parameters of $g$ and the parameters in the backend of $f$ . The frontend of $f$ is fixed during the optimization such that only the backend learns the trojan functionality. When the victim train a new frontend, the trojan in the backend can still be effective. For convolutional neural networks (CNNs), the backend is typically the convolutional layers. $f$ is initialized with the clean model and $g$ is initialized randomly. In the loss function, the gradients to $g$ are multiplied with $\alpha$ , which is a very small number. Thus, we scale
96
+
97
+ Table 2: The accuracy of clean and trojaned model and the attack success rate on ImageNet models.
98
+
99
+ <table><tr><td>Model</td><td>Clean Model Accuracy top1/top5</td><td>Trojaned Model Accuracy top1 /top5</td><td>Attack Success Rate top1 /top5</td></tr><tr><td>VGG16</td><td>73.37%/91.50%</td><td>72.37%/90.96%</td><td>50.27%/75.87%</td></tr><tr><td>ResNet50</td><td>76.15%/92.87%</td><td>73.88%/91.66%</td><td>37.55%/65.34%</td></tr><tr><td>MobileNet-V2</td><td>71.81%/90.42%</td><td>69.32%/89.14%</td><td>31.04%/57.64%</td></tr></table>
100
+
101
+ the gradient of parameters in $g$ by $1 / \alpha$ to have a balanced update between the generator and the trojan.
102
+
103
+ Figure 2 also shows the network architecture of the generator we used. We first use the convolutional layers of the pre-trained ResNet50 (He et al., 2016) and an FC layer to encode the target image into an internal feature vector of length 1024. Then, we use several transposed convolutional layers to generate a $3 2 \times 3 2$ trigger pattern, which is the typical network architecture for image generation in generative adversarial networks (GANs) (Radford et al., 2015). Specifically, we use a sigmoid function in the last layer to produce pixel values between 0 and 1, and then scale each pixel to the interval between 0 and 255. It will be further normalized with the mean and variance values of the ImageNet dataset, which is a typical pre-processing step for ImageNet models. Finally, we patch the trigger pattern in a random position in the source image and feed it into the model to be trojaned. The backend part is its convolutional layers and the frontend part is its FC layers. Note that, during the training, we fix the parameters of the frontend model and the pre-trained ResNet50 in the trigger generator.
104
+
105
+ # 4.3 TROJAN TRIGGERING
106
+
107
+ During the triggering phase, the attacker just picks a target image that contains the scenario that he expects the victim’s system to see and use it to generate the small trigger pattern. Then, he just presents the trigger pattern in any small region in the input of the victim’s system. The victim’s system will predict the label of the target image and react as seeing the target image.
108
+
109
+ # 5 EXPERIMENT AND RESULT
110
+
111
+ # 5.1 OUTSOURCED TRAINING ATTACK EFFECTIVENESS
112
+
113
+ We first demonstrate the outsourced training attack on ImageNet models to show the properties of the trojan without victims’ modifications. Note that, our trojaning attack is different from existing literature that backdoors a specific pattern for a specific class. Our trojan can support all classes simultaneously in one trojaned model. Thus, we use the averaged success rate for all pairs of the 1000 source classes and the 1000 target classes to measure the capability of our trojan. Existing literature only support one class each time, thus they cannot compare with each other. Moreover, the attack success rate cannot exceed the image recognition accuracy. Otherwise, the generator together with the trojaned model forms a more powerful image recognition model that classify the target image to target label.
114
+
115
+ Setup. We implement the trojan insertion method with PyTorch. We choose VGG16 (Simonyan & Zisserman, 2014), ResNet50 (He et al., 2016), and MobileNet-V2 (Sandler et al., 2018) as the model to be trojaned. Initially, we set $\alpha$ to $1 0 ^ { - 3 }$ and choose $1 0 ^ { - 3 }$ as the learning rate for all cases. Then, we decrease the learning rate by $1 0 \times$ every 10 epochs. After the loss function converge, we change $\alpha$ to $1 0 ^ { - 4 }$ , restore the learning rate of target model to $1 0 ^ { - 4 }$ and fine-tune the generators and trojans, which enables higher accuracy for the cases of VGG16 and ResNet50. MobileNet-V2 is slightly different: $\alpha$ is set to $5 \times 1 0 ^ { - 4 }$ at the fine-tuning phase.
116
+
117
+ Results. In the first step, we evaluate our trojaning attack on VGG16, ResNet50, and MobileNetV2 in the outsourced training attack scenario. Table 2 shows the accuracy of the clean model and the trojaned model. The accuracy drop is within the accuracy variation of these models. Meanwhile, we achieve a high attack success rate. The trojaned VGG16 has a $5 0 . 2 7 \%$ attack success rate across 1000 target classes. It is a high attack success rate since it is comparable with the recognition accuracy, $7 2 . 3 8 \%$ . The hyperparameter $\alpha$ is important for the tradeoff between maintaining prediction accuracy on normal inputs and increasing attack effectiveness on trigger inputs. We find that $\alpha = 1 0 ^ { - 3 }$ would be the sweet point. We can further increase the attack success rate by applying a larger $\alpha$ , but it will lead to more accuracy drop of the trojaned model.
118
+
119
+ Table 3: Transfer learning attack results. We use the same trojaned VGG16 model to test the transfer attack success rate on two smaller dataset, Flower and Caltech-256. The trojaned model is made with only ImageNet dataset. Smaller datasets are only used to train victim’s FC layers.
120
+
121
+ <table><tr><td>Dataset</td><td>CleanModel Accuracy</td><td>TrojanedModel Accuracy</td><td>Attack SuccessRate</td></tr><tr><td>Flower Dataset</td><td>91.70%</td><td>91.56%</td><td>38.15%</td></tr><tr><td>Caltech-256</td><td>72.80%</td><td>73.37%</td><td>37.63%</td></tr></table>
122
+
123
+ ![](images/19bdbb0f56ff49092178b45914a0a2b80cc4a45b1f1527bfc76e0923acba1051.jpg)
124
+ Figure 3: The accuracy vs. attack success rate with different pruning factor for Fine-Pruning (Liu et al., 2018a) defense method.
125
+
126
+ # 5.2 TRANSFER LEARNING ATTACK EFFECTIVENESS
127
+
128
+ We also demonstrate an end-to-end transfer learning attack on two small datasets that are independent of ImageNet. The trojaned VGG16 will be fine-tuned for the small datasets. And we test the effectiveness of the trojan after the fine-tuning. No further trojaning modification is made to the trojaned model, we use the trojaned model from the previous section directly. None of the existing trojaning attack methods can be applied to this scenario.
129
+
130
+ Setup. We follow the scenario described in the official tutorials of Tensorflow and MXNet. We use the trojaned VGG16 as an example and train new classifiers with new FC layers for the Flower dataset and Caltech-256 dataset. Finally, we pick two random images from the validation set, one as source image and one as target image, to form a trigger image. We have eliminate the cases that source image and target image are from the same class.
131
+
132
+ Result. In Table 3, We show the transferability of our trojaned model. We use the trojaned VGG16 model mentioned in Table 2 to test its effectiveness on two smaller datasets, the Flower dataset and the Caltech-256 dataset. The two datasets are unknown when trojaning the VGG16 model and the classes in these datasets are completely different from the 1000 classes in ImageNet. Thus, non of existing studies can attack the victims successfully in this case because their misclassification target must be one of the 1000 classes of ImageNet. Our trojaned model can still achieve about $38 \%$ success rate on both datasets. Although the absolute value of the attack success rate is not that high, the damage of this attack is still quite severer. One trojaned ImageNet pretrained model can affect almost all models that reuse its convolutional layers.
133
+
134
+ # 5.3 DEFENSE ANALYSIS
135
+
136
+ Our goal is to extend the capability of trojaning attack. It also leads to better stealthiness because we train a general trojan instead of simple trojans for certain handcraft patterns and it shows no biased behavior for different target classes.
137
+
138
+ Defense methods just make initial steps on the simple trojaning attack method with one or a few fixed target classes on small datasets. Chen et al. (2018) detects if the dataset is poisoned, which cannot be applied to our threat model because the trojaned model is trained by the attacker. NeuralCleanse (Wang et al., 2019) detects the trojan based on the biased behavior of the fixed target classes. They assume that only one or minority of fixed classes can be target classes. However, our trojan supports dynamic target class and can generally trigger all the classes; thus, there is no such bias in our trojan. Fine-Pruning (Liu et al., 2018a) prunes the model using the validation set to reduce the redundancies in order to squeeze the trojan functionality. We test Fine-Pruning on our trojaned VGG16 for ImageNet dataset. The result is shown in Figure 3: with different pruning ratio, the attack success rate dropped as well as the accuracy. Namely, the trojan functionality is highly coupled with the original task; removing trojan will also destroy the well-learned feature as well. The trojan is even more robust than the well-learned features.
139
+
140
+ The major difficulty of defending the proposed attack is that the trojan shows no biased behavior for all target classes and its functionality is highly coupled with the well-learned features. Moreover, the trigger generator is also a neural network, which can add additional regularization terms to make the trigger more robust and hard to detect. Developing defense methods for this kind of trojaning attack is still challenging.
141
+
142
+ # 6 DISCUSSION
143
+
144
+ # 6.1 VARIANTS
145
+
146
+ The key idea of the programmable trojan is to use an NN to generate the trigger image and train the generator network together with the trojan. Our demonstration is a simple case study. It can be extended to many variants.
147
+
148
+ Trigger format. In our case, we use a small trigger pattern patched in a random position of the source image. Such patterns may be obvious for human, but in some case that the victim’s application is using a camera to capture images and process them automatically with the victim model. So, the attacker can easily display a small trigger pattern to trigger the subsequent consequences, such as authorizing the attacker to enter a secure place or misleading a self-driving car into an accident. In some other cases that the attacker could modify the entire image and the modification is imperceivable for humans, like adversarial attacks, we can design the generator to produce the modified full-size input image. Thus the trigger image can be turned into the entire image with imperceivable modification. We can also use the generator to encode the target image into the imperceivable modifications and train the trojan to recognize and decode information from it.
149
+
150
+ Trojan capability. By defining the forward pass of the trigger case, we can make the trojan more robust. In our demonstration, we place the trigger pattern in a random position of the source image to make the trojan robust to the position of triggers. It is also possible to apply other random transformations, such as scale, rotation, to enable the trojan more robust. It is also possible to let the trojan support multiple trigger formats by feeding trigger images from different generator networks. These variants may greatly enhance the threat in the real world.
151
+
152
+ Model capacity. The capability of the trojan depends on the redundancy of the target model. In our demonstration, the network architecture of the trojaned model is fixed and the trojan can only exist in the weight parameters. However, the emerging AutoML (Zoph & Le, 2017) technology enables the algorithm to search the best network architecture for a certain task to maximize accuracy. The obtained network architectures from AutoML algorithms are usually complicated and hard to explain, which further increase the threat of our programmable trojaning attack. The trojan can also be hidden in the network architecture in this case. Attackers can search the best architecture and parameters to maximize the capability of the trojan and publish the pre-trained architecture and parameters online.
153
+
154
+ # 7 CONCLUSION
155
+
156
+ We propose a powerful NN trojaning attack under more practical scenarios. Compared to existing NN trojaning methods, our trojan supports dynamic and out scope target classes, which make it broadly applicable. The trojan can be inserted into large-scale models, which provides well-learned general features. Thus, the trojan can affect a large scope of applications. Further analyses show that the proposed trojaning attack is difficult to be detected or removed for existing defense methods.
157
+
158
+ # REFERENCES
159
+
160
+ Bryant Chen, Wilka Carvalho, Nathalie Baracaldo, Heiko Ludwig, Benjamin Edwards, Taesung Lee, Ian Molloy, and Biplav Srivastava. Detecting backdoor attacks on deep neural networks by activation clustering. CoRR, abs/1811.03728, 2018. URL http://arxiv.org/abs/1811. 03728.
161
+
162
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Fei-Fei Li. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2009), 20-24 June 2009, Miami, Florida, USA, pp. 248–255. IEEE Computer Society, 2009. doi: 10.1109/CVPRW.2009.5206848. URL https://doi. org/10.1109/CVPRW.2009.5206848.
163
+
164
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. URL http://arxiv.org/abs/1810.04805.
165
+
166
+ Jacob Dumford and Walter J. Scheirer. Backdooring convolutional neural networks via targeted weight perturbations. CoRR, abs/1812.03128, 2018. URL http://arxiv.org/abs/1812. 03128.
167
+
168
+ Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. CoRR, abs/1708.06733, 2017. URL http://arxiv. org/abs/1708.06733.
169
+
170
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 770–778. IEEE Computer Society, 2016. doi: 10.1109/CVPR.2016.90. URL https://doi.org/10.1109/CVPR.2016.90.
171
+
172
+ Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial examples in the physical world. CoRR, abs/1607.02533, 2016. URL http://arxiv.org/abs/1607.02533.
173
+
174
+ Cong Liao, Haoti Zhong, Anna Cinzia Squicciarini, Sencun Zhu, and David J. Miller. Backdoor embedding in convolutional neural network models via invisible perturbation. CoRR, abs/1808.10307, 2018. URL http://arxiv.org/abs/1808.10307.
175
+
176
+ Kang Liu, Brendan Dolan-Gavitt, and Siddharth Garg. Fine-pruning: Defending against backdooring attacks on deep neural networks. 11050:273–294, 2018a. doi: 10.1007/978-3-030-00470-5\ 13. URL https://doi.org/10.1007/978-3-030-00470-5_13.
177
+
178
+ Yingqi Liu, Shiqing Ma, Yousra Aafer, Wen-Chuan Lee, Juan Zhai, Weihang Wang, and Xiangyu Zhang. Trojaning attack on neural networks. In 25th Annual Network and Distributed System Security Symposium, NDSS 2018, San Diego, California, USA, February 18-21, 2018. The Internet Society, 2018b. URL http://wp.internetsociety.org/ndss/wp-content/ uploads/sites/25/2018/02/ndss2018_03A-5_Liu_paper.pdf.
179
+
180
+ Yuntao Liu, Yang Xie, and Ankur Srivastava. Neural trojans. In 2017 IEEE International Conference on Computer Design, ICCD 2017, Boston, MA, USA, November 5-8, 2017, pp. 45–48. IEEE Computer Society, 2017. doi: 10.1109/ICCD.2017.16. URL https://doi.org/10.1109/ ICCD.2017.16.
181
+
182
+ 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.
183
+
184
+ Mark Sandler, Andrew G. Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 4510–4520. IEEE Computer Society, 2018. doi: 10.1109/CVPR. 2018.00474. URL http://openaccess.thecvf.com/content_cvpr_2018/html/ Sandler_MobileNetV2_Inverted_Residuals_CVPR_2018_paper.html.
185
+
186
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014. URL http://arxiv.org/abs/1409.1556.
187
+
188
+ Bolun Wang, Yuanshun Yao, Shawn Shan, Huiying Li, Bimal Viswanath, Haitao Zheng, and Ben Y Zhao. Neural cleanse: Identifying and mitigating backdoor attacks in neural networks. In IEEE Symposium on Security and Privacy, pp. 513–529. IEEE, 2019.
189
+
190
+ Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https://openreview. net/forum?id $=$ r1Ue8Hcxg.
md/train/ByKWUeWA-/ByKWUeWA-.md ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GANITE: ESTIMATION OF INDIVIDUALIZED TREATMENT EFFECTS USING GENERATIVE ADVERSARIAL NETS
2
+
3
+ Jinsung Yoon
4
+ Department of Electrical and Computer Engineering
5
+ University of California, Los Angeles
6
+ Los Angeles, CA 90095, USA
7
+ jsyoon0823@g.ucla.edu
8
+ James Jordon
9
+ Department of Engineering Science
10
+ University of Oxford
11
+ Oxford, UK
12
+ james.jordon@wolfson.ox.ac.uk
13
+ Mihaela van der Schaar
14
+ Department of Engineering Science, University of Oxford, Oxford, UK
15
+ Alan Turing Institute, London, UK
16
+ mihaela.vanderschaar@eng.ox.ac.uk
17
+
18
+ # ABSTRACT
19
+
20
+ Estimating individualized treatment effects (ITE) is a challenging task due to the need for an individual’s potential outcomes to be learned from biased data and without having access to the counterfactuals. We propose a novel method for inferring ITE based on the Generative Adversarial Nets (GANs) framework. Our method, termed Generative Adversarial Nets for inference of Individualized Treatment Effects (GANITE), is motivated by the possibility that we can capture the uncertainty in the counterfactual distributions by attempting to learn them using a GAN. We generate proxies of the counterfactual outcomes using a counterfactual generator, G, and then pass these proxies to an ITE generator, I, in order to train it. By modeling both of these using the GAN framework, we are able to infer based on the factual data, while still accounting for the unseen counterfactuals. We test our method on three real-world datasets (with both binary and multiple treatments) and show that GANITE outperforms state-of-the-art methods.
21
+
22
+ # 1 INTRODUCTION
23
+
24
+ Individualized treatment effects (ITE) estimation using observational data is a fundamental problem that is applicable in a wide variety of domains. For instance, (1) in understanding the heterogeneous effects of drugs (Shalit et al. (2017); Alaa & van der Schaar (2017); Alaa et al. (2017)); (2) in evaluating the effect of a policy on unemployment rates (LaLonde (1986); Smith & Todd (2005)); (3) in verifying which factor causes a certain disease (Hofler (2005)) and (4) estimating the effects ¨ of pollution on the weather (Hannart et al. (2016)).
25
+
26
+ As explained in Spirtes (2009), the problem of ITE estimation differs from the standard supervised learning problem. First, among the potential outcomes, only the factual outcome is actually observed (revealed), counterfactual outcomes are not observed and so the entire vector of potential outcomes can never be obtained. Second, unlike randomized controlled trials (RCT), observational studies are prone to treatment selection bias. For instance, left ventricular assist device (LVAD) treatment is mostly applied to high-risk patients with severe cardiovascular diseases before heart transplantation, the distribution of features among these patients will be significantly different to the distribution among non-LVAD treated patients (Kirklin et al. (2010)). The sample distribution can vary drastically across different choices of treatments and therefore, if we were to apply a supervised learning framework for each treatment separately, the learned models would not generalize well to the entire population.
27
+
28
+ Classical works in this domain solved the problem of estimating the average treatment effects from observational data (Dehejia & Wahba (2002b); Lunceford & Davidian (2004)). These works account for the selection bias using propensity scores (the estimated probability of receiving a treatment) to create unbiased estimators of the average treatment effect. Dehejia & Wahba (2002b) used a one-toone matching methodology to pair treated and control patients with similar features while Lunceford & Davidian (2004) used propensity scoring weighing to account for the selection bias. More recent works focus on individualized treatment effects (Chipman et al. (2010); Wager & Athey (2017); Athey & Imbens (2016); Lu et al. (2017); Alaa & van der Schaar (2017); Porter et al. (2011); Johansson et al. (2016); Alaa et al. (2017); Louizos et al. (2017); Shalit et al. (2017)). Detailed qualitative comparisons to these works will be discussed in the next subsection and numerical comparisons can be found in Section 5.
29
+
30
+ In this paper, we propose a novel approach that attempts to not only fit a model to the observed factual data, but also account for the unseen counterfactual outcomes. We view the factual outcome as an observed label and consider the counterfactual outcomes to be missing labels. Missing labels are generated by the well-known Generative Adversarial Nets (GAN) framework (Goodfellow et al. (2014)). More specifically, the counterfactual generator of GANITE attempts to generate counterfactual outcomes in such a way that when given the combined vector of factual and generated counterfactual outcomes the discriminator of GANITE cannot determine which of the components is the factual outcome. With the complete labels (combined factual and estimated counterfactual outcomes), the ITE estimation function can then be trained for inferring the potential outcomes of the individual based on the feature information in a supervised way. By also modelling this ITE estimation function using a GAN framework, we are able not only to predict the expected outcomes but also provide confidence intervals for the predictions, which is very important in, for example, the medical setting.
31
+
32
+ Unlike many other state-of-the-art methods, our method naturally extends to - and in fact is defined in the first place for - any number of treatments. We conduct experiments with three real-world observational datasets (with both binary and multiple treatments), and GANITE outperforms stateof-the-art methods.
33
+
34
+ # 1.1 RELATED WORKS
35
+
36
+ Previous works on ITE estimation can be divided into three categories. In the first, a separate model is learned for each treatment; this approach does not account for selection bias and so each model learned will be biased toward the distribution of that treatment’s population. In the second, the treatment is considered a feature, with one model learned for everything, and the mismatch between the entire sample distribution and treated and control distributions is adjusted in order to account for selection bias. For instance, Chipman et al. (2010); Wager & Athey (2017); Athey & Imbens (2016); Lu et al. (2017) used tree-based models, Porter et al. (2011) used doubly-robust methods, Dehejia & Wahba (2002b); Lunceford & Davidian (2004), k-nearest neighbor (kNN) Crump et al. (2008) used propensity and matching based methods, and Johansson et al. (2016); Shalit et al. (2017) used deep learning approaches to solve the ITE problem under this one model methodology. Inherent to the approach of learning a balanced representation is that the representation must trade off between containing predictive information and reducing biased information. This is because often it will be the case that information that is biased is also highly predictive (in fact in the medical setting this is precisely why it is biased - because the doctors will assign treatments based on predictive features). On the other hand, our framework is not forced to make this information trade-off - the dataset we learn our final ITE estimator on contains the original dataset, and so contains at least as much information as that one. In the experiment section, we show that our proposed framework outperforms Shalit et al. (2017), particularly when the bias is high. In the third category, Alaa & van der Schaar (2017); Alaa et al. (2017) used a multi-task model approach. Alaa et al. (2017) used multi-task neural nets to estimate (1) the selection bias, (2) the controlled outcome and (3) the treated outcome with shared layers across these three tasks. Alaa & van der Schaar (2017) used a Gaussian Process approach in the multi-task model setting. Our work is perhaps most similar to Alaa & van der Schaar (2017) since there, too, they attempted to account for the counterfactuals and were similarly able to provide confidence in their estimates using credible intervals. They were able to access counterfactuals through a posterior distribution which was then accounted for in the learning of their model.
37
+
38
+ # 2 PROBLEM FORMULATION: ESTIMATION OF INDIVIDUALIZED TREATMENT EFFECTS
39
+
40
+ Let $\mathcal { X }$ denote the $s$ -dimensional feature space and $\mathcal { V }$ the set of possible outcomes. Consider a joint distribution, $\mu$ , on $\mathcal { X } \times \{ 0 , 1 \} ^ { k } \times \mathcal { Y } ^ { k }$ where $k$ is the number of possible treatments. Suppose that $( \mathbf { X } , \mathbf { T } , \mathbf { Y } ) \ \sim \ \mu$ . We call $\mathbf { X } \in \mathcal { X }$ the ( $s$ -dimensional) feature vector, $\mathbf { T } \equiv ( T _ { 1 } , . . . , \bar { T } _ { k } ) \in$ $\{ 0 , 1 \} ^ { k }$ the treatment vector and $\mathbf { Y } \equiv ( Y _ { 1 } , . . . , Y _ { T } ) \in \mathcal { V } ^ { k }$ the vector of potential outcomes (or the Individualized Treatment Effects $( I T E )$ ). We assume that (with probability 1), there is precisely one non-zero component of $\mathbf { T }$ and we denote by $\eta$ the index of this component. Denote by $\mu \mathbf { x }$ the marginal distribution of $\mathbf { X }$ and by $\mu _ { \mathbf { Y } } ( \mathbf { x } )$ the conditional distribution of $\mathbf { Y }$ given $\mathbf { X } = \mathbf { x }$ , for $\mathbf { x } \in \mathcal { X }$ (marginalized over $\mathbf { T }$ ). This setting is known as the Rubin-Neyman causal model (Rubin (2005)).
41
+
42
+ We introduce two1 assumptions about the distribution $\mu$ in the Rubin-Neyman causal model.
43
+
44
+ ssumption 1. (Overlap) For all $\mathbf { x } \in \mathcal { X }$ , for all $i \in \{ 1 , . . . , k \}$ ,
45
+
46
+ $$
47
+ 0 < \mathbb { P } ( T _ { i } = 1 | \mathbf { X } = \mathbf { x } ) < 1 .
48
+ $$
49
+
50
+ This assumption ensures that at every point in the feature space, there is a non-zero probability of being given treatment $i$ for every $i$ .
51
+
52
+ Assumption 2. (Unconfoundedness) Conditional on $\mathbf { X }$ , the potential outcomes, $\mathbf { Y }$ , are independent of $\mathbf { T }$ ,
53
+
54
+ $$
55
+ \mathbf { Y } \bot \bot \mathbf { T } | \mathbf { X } .
56
+ $$
57
+
58
+ This assumption is also referred to as no unmeasured confounding and requires that all joint influences on $\mathbf { Y }$ and $\mathbf { T }$ are measured. Note that this assumption means that $\mu _ { \mathbf { Y } } ( \mathbf { x } )$ no longer needs to be marginalized over $\mathbf { T }$ , since, under this assumption, they are independent.
59
+
60
+ Assume now that we observe samples of $( \mathbf { X } , \mathbf { T } , Y _ { \eta } )$ (whose joint distribution we denote by $\mu _ { f }$ ), so that our dataset, $\mathcal { D }$ , is given by $\mathcal { D } = ( \mathbf { x } ( n ) , \mathbf { t } ( n ) , y _ { \eta ( n ) } ( n ) ) _ { n = 1 } ^ { N }$ . Importantly, we only observe the component of the potential outcome vector that corresponds to the assigned treatment, we call this the factual outcome, and refer to unobserved potential outcomes as counterfactual outcomes or just counterfactuals. We denote by $y _ { f } ( n )$ and ${ \bf y } _ { c f } ( n )$ the factual outcome and (vector of) counterfactual outcome(s), respectively. From this point forward, we omit the dependence on $n$ for ease of notation.
61
+
62
+ In this setting, we wish to be able to draw samples from $\mu _ { \mathbf { Y } } ( \mathbf { x } )$ for any $\mathbf { x } \in \mathcal { X }$ . We measure the performance of the generator, $\mathbf { I } ( \mathbf { x } )$ , using two different metrics depending on whether $k = 2$ (i.e. binary treatments) or $k > 2$ (i.e. multiple treatments).
63
+
64
+ For $k = 2$ we use the expected Precision in Estimation of Heterogeneous Effects, $\epsilon _ { P E H E }$ , introduced in Hill (2011), given by:
65
+
66
+ $$
67
+ \begin{array} { r } { \epsilon _ { P E H E } = \mathbb { E } _ { \mathbf { x } \sim \mu \mathbf { x } } \left[ \left( \mathbb { E } _ { \mathbf { y } \sim \mu _ { \mathbf { Y } } ( \mathbf { x } ) } [ y _ { 1 } - y _ { 0 } ] - \mathbb { E } _ { \hat { \mathbf { y } } \sim \mathbf { I } ( \mathbf { x } ) } [ \hat { y } _ { 1 } - \hat { y } _ { 0 } ] \right) ^ { 2 } \right] . } \end{array}
68
+ $$
69
+
70
+ For $k > 2$ we use the expected mean squared error:
71
+
72
+ $$
73
+ \epsilon _ { M S E } = \mathbb { E } _ { \mathbf { x } \sim \mu _ { \mathbf { X } } } \left[ | | \mathbb { E } _ { \mathbf { y } \sim \mu _ { \mathbf { Y } } ( \mathbf { x } ) } \big [ \mathbf { y } \big ] - \mathbb { E } _ { \hat { \mathbf { y } } \sim \mathbf { I } ( \mathbf { x } ) } \big [ \hat { \mathbf { y } } \big ] | | _ { 2 } ^ { 2 } \right]
74
+ $$
75
+
76
+ where $| | \cdot | | _ { 2 }$ is the standard $\ell _ { 2 }$ -norm in $\mathbb { R } ^ { k }$ .
77
+
78
+ In order to achieve this goal, we separate the problem into two parts. First, we attempt to generate proxies for the unobserved counterfactual outcomes using a counterfactual generator $( \mathbf { G } )$ to create a complete dataset. Then, using this proxy dataset, we learn the ITE generator, I.
79
+
80
+ # 3 GANITE: GENERATIVE ADVERSARIAL NETS FOR INFERENCE OF INDIVIDUALIZED TREATMENT EFFECT ESTIMATION
81
+
82
+ # 3.1 OVERVIEW
83
+
84
+ The objective of GANITE is to generate potential outcomes for a given feature vector x. However, due to the lack of counterfactual outcomes we are unable to learn the distribution of potential outcomes directly. To account for these counterfactuals, we first attempt to generate samples, $\tilde { \mathbf { y } } _ { c f }$ , using a counterfactual generator, $\mathbf { G }$ , from the distribution $\mu _ { \mathbf { Y } _ { c f } } ( \mathbf { x } , \mathbf { t } , y _ { f } )$ (the conditional distribution of the counterfactual outcomes, $\mathbf { Y } _ { c f }$ given that $\mathbf { X } = \mathbf { x }$ , $\mathbf { T } = \mathbf { t }$ and $Y _ { \eta } = y _ { f } $ ) for each sample in our dataset. We can then combine these proxy counterfactuals with the original dataset to obtain a complete dataset $\tilde { \mathcal { D } } = \{ \mathbf { x } ( n ) , \mathbf { t } ( n ) , \tilde { \mathbf { y } } ( n ) \} _ { n = 1 } ^ { N }$ where $\tilde { \mathbf { y } }$ is the combination of $y _ { f }$ and $\tilde { \mathbf { y } } _ { c f }$ (with $\tilde { y } _ { \eta } = y _ { f } .$ ). The ITE generator, I, can then be optimized using $\tilde { \mathcal { D } }$ .
85
+
86
+ ![](images/116737c722ed0bd80d952b72476171e6d937fd7f56e1e0c063cdda7378494e03.jpg)
87
+ Figure 1: Block Diagram of GANITE $( \bar { \mathbf { y } }$ is sampled from G after $\mathbf { G }$ has been fully trained). $\mathbf { G } , \mathbf { D } _ { \mathbf { G } } , \mathbf { D _ { I } }$ are only operating during training, whereas I operates both during training and at runtime.
88
+
89
+ We follow a conditional GAN framework similar to the one set out in Mirza & Osindero (2014) to model the latter of these generators. For the former, we have to use a different discriminator in order to capture the same idea. More specifically, GANITE consists of two blocks: a counterfactual imputation block and an ITE block, each of which consists of a generator and a discriminator. We describe each of these blocks and their components in more detail in the following subsection.
90
+
91
+ # 3.2 A DETAILED BREAKDOWN
92
+
93
+ Counterfactual generator $\left( \mathbf { G } \right)$ : The counterfactual generator, $\mathbf { G }$ , uses the feature vector, $\mathbf { x }$ , the treatment vector, $\mathbf { t }$ , and the factual outcome, $y _ { f }$ , to generate a potential outcome vector, $\tilde { \mathbf { y } }$ . We let $g$ be a function $g : \mathcal { X } \times \{ 0 , 1 \} ^ { k } \times \mathcal { V } \times [ - 1 , 1 ] ^ { k - 1 } \to \mathcal { V } ^ { k }$ and $\mathbf { z _ { G } } \sim \mathcal { U } ( ( - 1 , 1 ) ^ { k - 1 } )$ . We then define the random variable $\mathbf { G } ( \mathbf { x } , \mathbf { t } , y _ { f } )$ as
94
+
95
+ $$
96
+ \mathbf { G } ( \mathbf { x } , \mathbf { t } , y _ { f } ) = g ( \mathbf { x } , \mathbf { t } , y _ { f } , \mathbf { z } _ { \mathbf { G } } )
97
+ $$
98
+
99
+ The goal now is to find a function, $g$ , such that ${ \bf G } ( { \bf x } , { \bf t } , y _ { f } ) \sim \mu _ { \bf Y } ( { \bf x } , { \bf t } , y _ { f } )$ . We write $\tilde { \mathbf { y } }$ to denote a sample of $\mathbf { G }$ and $\bar { \mathbf { y } }$ to denote the vector obtained by replacing $\tilde { y } _ { \eta }$ with $y _ { f }$ . Observe that the $\eta$ - th component of a sample from $\mu _ { \mathbf { Y } } ( \mathbf { x } , \mathbf { t } , y _ { f } )$ will be $y _ { f }$ , since we are sampling $\mathbf { Y }$ conditional on $Y _ { \eta } = y _ { f }$ .
100
+
101
+ Counterfactual discriminator $\mathbf { ( D _ { G } ) }$ : We introduce a discriminator, $\mathbf { D _ { G } }$ , which maps pairs $\left( \mathbf { x } , { \bar { \mathbf { y } } } \right)$ to vectors in $[ 0 , 1 ] ^ { k }$ with the $i$ -th component, written $D _ { \mathbf { G } } ( \mathbf { x } , \tilde { \mathbf { y } } ) _ { i }$ , representing the probability that the $i$ -th component of $\tilde { \mathbf { y } }$ is the factual outcome, equivalently the probability that $\eta \ : = \ : i$ . This is in contrast to the standard GAN framework in which the discriminator is given a single sample from one of two distributions and it attempts to determine which distribution it came from. Here the discriminator is given a sample consisting of components from two different distributions and attempts to determine which components came from which distribution.
102
+
103
+ We train $\mathbf { D _ { G } }$ to maximize the probability of correctly identifying $\eta$ . We then train $\mathbf { G }$ to maximize the probability of $\mathbf { D _ { G } }$ incorrectly identifying $\eta$ (equivalently we try to minimize the probability of a correct identification - this is the adversarial method of learning between $\mathbf { G }$ and $\mathbf { D _ { G } }$ ).
104
+
105
+ Following the framework in Goodfellow et al. (2014), we note that this formulation is captured by a minimax problem given by
106
+
107
+ $$
108
+ \operatorname* { m i n } _ { \mathbf { G } } \operatorname* { m a x } _ { \mathbf { D } _ { \mathbf { G } } } \mathbb { E } _ { ( \mathbf { x } , \mathbf { t } , y _ { f } ) \sim \mu _ { f } } \left[ \mathbb { E } _ { \mathbf { z } _ { \mathbf { G } } \sim \mathcal { U } ( ( - 1 , 1 ) ^ { k } ) } \left[ \mathbf { t } ^ { T } \log \mathbf { D } _ { \mathbf { G } } ( \mathbf { x } , \tilde { \mathbf { y } } ) + ( \mathbf { 1 } - \mathbf { t } ) ^ { T } \log ( 1 - \mathbf { D } _ { \mathbf { G } } ( \mathbf { x } , \tilde { \mathbf { y } } ) ) \right] \right]
109
+ $$
110
+
111
+ where log is performed element-wise and T denotes the transpose operator.
112
+
113
+ After training the counterfactual generator, we use it to generate the dataset $\tilde { \bf D }$ and pass this dataset to the ITE block.
114
+
115
+ ITE generator (I): The ITE generator, I, uses only the feature vector, $\mathbf { x }$ , to generate a potential outcome vector, $\hat { \mathbf { y } }$ . Similar to our approach with $\mathbf { G }$ , let $h$ be a function $h : \mathcal { X } \times \mathbf { \bar { [ - 1 , 1 ] } } ^ { k } \mathcal { V } ^ { k }$ and $\mathbf { z } _ { \mathbf { I } } \sim \mathcal { U } ( ( - 1 , 1 ) ^ { k } )$ ). We define the random variable $\mathbf { I } ( \mathbf { x } )$ as
116
+
117
+ $$
118
+ { \bf { I } } ( { \bf { x } } ) = h ( { \bf { x } } , { \bf { z } } _ { \bf { I } } )
119
+ $$
120
+
121
+ and similarly, the goal is to find a function, $h$ , such that $\mathbf { I } ( \mathbf { x } ) \sim \mu \mathbf { v } ( \mathbf { x } )$ . We write $\hat { \mathbf { y } }$ to denote a sample from $\mathbf { I } ( \mathbf { x } )$ .
122
+
123
+ ITE discriminator $\mathbf { ( D _ { I } ) }$ : Again, we introduce a discriminator, $\mathbf { D _ { I } }$ , but this time, since we have access to a complete dataset $\mathbf { \bar { D } }$ , we can use a standard conditional GAN discriminator - it takes a pair $\left( \mathbf { x } , \mathbf { y } ^ { * } \right)$ and returns a scalar corresponding to the probability that $\mathbf { y } ^ { * }$ was from the data $\tilde { \mathcal { D } }$ (rather than drawn from I). Again, we train the generator and discriminator in an adversarial fashion using the following minimax criteria
124
+
125
+ $$
126
+ \operatorname* { m i n } _ { \mathbf { I } } \operatorname* { m a x } _ { \mathbf { D } _ { \mathbf { I } } } \mathbb { E } _ { \mathbf { x } \sim \mu _ { \mathbf { X } } } \left[ \mathbb { E } _ { \mathbf { y } ^ { * } \sim \mu _ { \mathbf { Y } } } ( \mathbf { x } ) \left[ \log \mathbf { D } _ { \mathbf { I } } ( \mathbf { x } , \mathbf { y } ^ { * } ) \right] + \mathbb { E } _ { \mathbf { y } ^ { * } \sim \mathbf { I } ( \mathbf { x } ) } \left[ \log ( \mathbf { 1 } - \mathbf { D } _ { \mathbf { I } } ( \mathbf { x } , \mathbf { y } ^ { * } ) ) \right] \right]
127
+ $$
128
+
129
+ where again log is taken element-wise.
130
+
131
+ # 4 GANITE: OPTIMIZATION
132
+
133
+ In this section, we describe the empirical loss functions that are used to optimize each component of GANITE. The Pseudo-code is summarized in the Appendix.
134
+
135
+ # 4.1 COUNTERFACTUAL BLOCK $( \mathbf { G } , \mathbf { D } _ { \mathbf { G } } )$ :
136
+
137
+ Based on equation 4, the empirical objective of the minimax problem for $\mathbf { G }$ and $\mathbf { D _ { G } }$ can be defined by
138
+
139
+ $$
140
+ ^ { \prime } { _ { C F } } ( \mathbf { x } ( n ) , \mathbf { t } ( n ) , { \bar { \mathbf { y } } } ( n ) ) = \mathbf { t } ( n ) ^ { T } \log ( \mathbf { D _ { G } } ( \mathbf { x } ( n ) , { \bar { \mathbf { y } } } ( n ) ) ) + ( \mathbf { 1 } - \mathbf { t } ( n ) ) ^ { T } \log ( \mathbf { 1 } - \mathbf { D _ { G } } ( \mathbf { x } ( n ) , { \bar { \mathbf { y } } } ( n ) ) ) .
141
+ $$
142
+
143
+ We also introduce the following ‘supervised’ loss in order to enforce the restriction that $g _ { \eta }$ should be equal to $y _ { f }$ .
144
+
145
+ $$
146
+ \begin{array} { r } { \mathcal L _ { S } ^ { G } ( y _ { f } ( n ) , \tilde { y } _ { \eta ( n ) } ( n ) ) = ( y _ { f } ( n ) - \tilde { y } _ { \eta ( n ) } ( n ) ) ^ { 2 } } \end{array}
147
+ $$
148
+
149
+ More specifically, due to the structure of $G$ , it outputs a full vector of potential outcomes, and so it not only outputs counterfactuals, but also gives a value for the one factual that was used as input. We account for this by using $\mathcal { L } _ { S } ^ { G }$ to force the generated factual outcome to be close to the actually observed factual outcome. This is because, as noted above, conditional on observing $y _ { f }$ , the component of $y$ corresponding to $y _ { f }$ should clearly be equal to $y _ { f }$ .
150
+
151
+ With the above two objective functions, $\mathbf { G }$ and $\mathbf { D _ { G } }$ are iteratively optimized with $k _ { G }$ minibatches as follows:
152
+
153
+ $$
154
+ \begin{array} { l } { \displaystyle \operatorname* { m i n } _ { \mathbf { D } _ { \mathbf { G } } } - \sum _ { n = 1 } ^ { k _ { G } } V _ { C F } ( \mathbf { x } ( n ) , \mathbf { t } ( n ) , \bar { \mathbf { y } } ( n ) ) } \\ { \displaystyle \operatorname* { m i n } _ { \mathbf { G } } \sum _ { n = 1 } ^ { k _ { G } } \Big [ V _ { C F } ( \mathbf { x } ( n ) , \mathbf { t } ( n ) , \bar { \mathbf { y } } ( n ) ) + \alpha \mathcal { L } _ { S } ^ { G } ( y _ { f } ( n ) , \tilde { y } _ { \eta ( n ) } ( n ) ) \Big ] } \end{array}
155
+ $$
156
+
157
+ where $\alpha \geq 0$ is a hyper-parameter.
158
+
159
+ # 4.2 ITE BLOCK $( \mathbf { I } , \mathbf { D _ { I } } )$
160
+
161
+ After training the counterfactual block $( \mathbf { G } , \mathbf { D } _ { \mathbf { G } } )$ , GANITE optimizes the ITE block $( \mathbf { I } , \mathbf { D _ { I } } )$ . Based on equation 6, the empirical objective of the minimax problem for I and $\mathbf { D _ { I } }$ can be defined by
162
+
163
+ $$
164
+ V _ { I T E } ( \mathbf { x } ( n ) , \bar { \mathbf { y } } ( n ) , \hat { \mathbf { y } } ( n ) ) = \log ( \mathbf { D _ { I } } ( \mathbf { x } ( n ) , \bar { \mathbf { y } } ( n ) ) ) + \log ( 1 - \mathbf { D _ { I } } ( \mathbf { x } ( n ) , \hat { \mathbf { y } } ( n ) ) ) .
165
+ $$
166
+
167
+ Furthermore, in order to optimize the performance with respect to equations 1 and 2, we additionally introduce supervised losses (for the respective cases of $k = 2$ (binary treatments) and $k > 2$ (multiple treatments)) that are defined as follows:
168
+
169
+ $$
170
+ \begin{array} { r l } & { ( k = 2 ) : \mathcal { L } _ { S } ^ { I } ( \bar { \mathbf { y } } ( n ) , \hat { \mathbf { y } } ( n ) ) = ( ( \bar { y } _ { 1 } ( n ) - \bar { y } _ { 0 } ( n ) ) - ( \hat { y } _ { 1 } ( n ) - \hat { y } _ { 0 } ( n ) ) ) ^ { 2 } } \\ & { ( k > 2 ) : \mathcal { L } _ { S } ^ { I } ( \bar { \mathbf { y } } ( n ) , \hat { \mathbf { y } } ( n ) ) = | | \bar { \mathbf { y } } ( n ) - \hat { \mathbf { y } } ( n ) | | _ { 2 } ^ { 2 } . } \end{array}
171
+ $$
172
+
173
+ I and $\mathbf { D _ { I } }$ are then iteratively optimized with $k _ { I }$ minibatches as follows:
174
+
175
+ $$
176
+ \begin{array} { l } { \displaystyle \operatorname* { m i n } _ { { \bf { D } } _ { \bf { I } } } - \sum _ { n = 1 } ^ { k _ { I } } V _ { I T E } ( { \bf { x } } ( n ) , \bar { \bf { y } } ( n ) , \hat { \bf { y } } ( n ) ) } \\ { \displaystyle \operatorname* { m i n } _ { { \bf { I } } } \sum _ { n = 1 } ^ { k _ { G } } \Big [ V _ { I T E } ( { \bf { x } } ( n ) , \bar { \bf { y } } ( n ) , \hat { \bf { y } } ( n ) ) + \beta \mathcal { L } _ { S } ^ { I } ( \bar { \bf { y } } ( n ) , \hat { \bf { y } } ( n ) ) \Big ] } \end{array}
177
+ $$
178
+
179
+ where $\beta \geq 0$ is a hyper-parameter.
180
+
181
+ Empirical justification for the inclusion of all the above losses can be found in Section 5.3 where we explore the effect of training with and without each of the losses, see Table 6. We demonstrate there that using a combination of both (for both $\mathbf { G }$ and I) gives the best performance. In addition to this, by using a GAN loss for I we learn the conditional distribution of the potential outcomes rather than just the expectations (which would be the case if we only used the supervised loss $\mathcal { L } _ { S } ^ { I }$ . See Table 1 in Section 5.3). This allows us to capture the uncertainty of the outcomes, which is very important in the medical setting when treatment decisions need to be made by doctors on the basis of these types of estimations.
182
+
183
+ Due to the lack of ground truth, it is often difficult in causal inference tasks to optimize the hyperparameters. More specifically, we do not have access to the true loss function (either PEHE or MSE) that we are trying to minimize, and so it is not possible to select hyper-parameters that minimise the true loss. One of the advantages of GANITE, however, is that our target loss can be estimated from the generated counterfactuals, unlike other methods such as in Shalit et al. (2017). Therefore, we can directly optimize the hyper-parameters that minimize this estimated PEHE/MSE over the hyper-parameter space - details of our hyper-parameter optimization and the achieved optimal hyperparameters are illustrated in the Appendix.
184
+
185
+ # 5 EXPERIMENTS
186
+
187
+ # 5.1 DATASETS
188
+
189
+ Due to the nature of the problem, it is very difficult to evaluate the performance of the algorithm on real-world datasets - we never have access to the ground truth. Previous works, such as Shalit et al. (2017); Louizos et al. (2017), use both semi-synthetic datasets (either the treatments or the potential outcomes are synthesized) and datasets collected from randomized controlled trials (RCT) to evaluate the ITE generator. We use two semi-synthetic datasets, IHDP and Twins, and one realworld dataset, Jobs, to evaluate the performance of GANITE with various state-of-the-art methods. These datasets are the same as the ones used in Shalit et al. (2017); Louizos et al. (2017). Below, we give a detailed explanation of Twins. The details of IHDP and Jobs are well described in Shalit et al. (2017); Hill (2011); Dehejia & Wahba (2002a) and the Appendix.
190
+
191
+ Twins: This dataset is derived from all births in the USA between 1989-1991 (Almond et al. (2005)). Among these births, we only focus on the twins. We define the treatment $t = 1$ as being the heavier twin (and $t = 0$ as being the lighter twin). The outcome is defined as the 1-year mortality. For each twin-pair we obtained 30 features relating to the parents, the pregnancy and the birth: marital status; race; residence; number of previous births; pregnancy risk factors; quality of care during pregnancy; and number of gestation weeks prior to birth. We only chose twins weighing less than $2 \mathrm { k g }$ and without missing features (list-wise deletion). This creates a complete dataset (without missing data). The final cohort is 11,400 pairs of twins whose mortality rate for the lighter twin is $1 7 . 7 \%$ , and for the heavier $1 6 . 1 \%$ . In this setting, for each twin pair we observed both the case $t = 0$ (lighter twin) and $t = 1$ (heavier twin); thus, the ground truth of individualized treatment effect is known in this dataset. In order to simulate an observational study, we selectively observe one of the two twins using the feature information (creating selection bias) as follows: $t | \mathbf { x } \sim \mathrm { B e r n } ( \mathrm { S i g m o i d } ( \mathbf { w } ^ { T } \mathbf { x } + n ) )$ where $\mathbf { w } ^ { T } \sim \mathcal { U } ( ( - 0 . 1 , 0 . 1 ) ^ { 3 0 \times 1 } )$ and $n \sim \mathcal N ( 0 , 0 . 1 )$ .
192
+
193
+ # 5.2 PERFORMANCE METRICS AND SETTINGS
194
+
195
+ We use four different performance metrics: expected Precision in Estimation of Heterogeneous Effect (PEHE), average treatment effect (ATE) (Hill (2011)), policy risk $( R _ { p o l } ( \pi ) )$ , and average treatment effect on the treated (ATT) (Shalit et al. (2017)). In this subsection, we only provide definitions for PEHE and $R _ { p o l } ( \pi )$ . ATE and ATT are explained (and reported) in the Appendix.
196
+
197
+ If both factual and counterfactual outcomes are generated from a known distribution (so that we are able to compute the expectations of the outcomes, like in the IHDP dataset), and the treatment is binary, the empirical PEHE $( \epsilon _ { P E H E } )$ can be defined as follows:
198
+
199
+ $$
200
+ \epsilon _ { P E H E } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \Big ( \mathbb { E } _ { ( y _ { 1 } ( n ) , y _ { 0 } ( n ) ) \sim \mu _ { \mathbf { Y } } ( \mathbf { x } ( n ) ) } [ y _ { 1 } ( n ) - y _ { 0 } ( n ) ] - [ \hat { y } _ { 1 } ( n ) - \hat { y } _ { 0 } ( n ) ] \Big ) ^ { 2 }
201
+ $$
202
+
203
+ where $y _ { 1 } ( n ) , y _ { 0 } ( n )$ are treated and controlled outcomes drawn from the ground truth $( \mu _ { \mathbf { Y } } ( \mathbf { x } ) )$ and $\hat { y } _ { 1 } ( n ) , \hat { y } _ { 0 } ( n )$ are their estimations.
204
+
205
+ If both factual and counterfactual outcomes are observed but the underlying distribution is unknown (like in the Twins dataset), $\hat { \epsilon } _ { P E H E }$ can be defined as follows:
206
+
207
+ $$
208
+ \hat { \epsilon } _ { P E H E } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \Big ( [ y _ { 1 } ( n ) - y _ { 0 } ( n ) ] - [ \hat { y } _ { 1 } ( n ) - \hat { y } _ { 0 } ( n ) ] \Big ) ^ { 2 }
209
+ $$
210
+
211
+ If only factual outcomes are available but the testing set comes from a randomized controlled trial (RCT), such as in the Jobs dataset, Policy risk $( \mathcal { R } _ { p o l } ( \pi ) )$ can be defined as follows (Shalit et al. (2017)):
212
+
213
+ $$
214
+ R _ { p o l } ( \pi ) = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \Big [ 1 - \Big ( \sum _ { i = 1 } ^ { k } \big [ \frac { 1 } { | \Pi _ { i } \cap T _ { i } \cap E | } \sum _ { \mathbf { x } ( n ) \in \Pi _ { i } \cap T _ { i } \cap E } y _ { i } ( n ) \times \frac { | \Pi _ { i } \cap E | } { | E | } \big ] \Big ) \Big ]
215
+ $$
216
+
217
+ where $\Pi _ { i } = \{ { \bf x } ( n ) : i = \arg \operatorname* { m a x } \hat { \bf y } \}$ , $T _ { i } = \{ \mathbf { x } ( n ) : t _ { i } ( n ) = 1 \}$ , and $E$ is the subset of RCT.
218
+
219
+ Each dataset is divided $56 / 2 4 / 2 0 \%$ into training/validation/testing sets. Hyper-parameters such as the number of hidden layers $\alpha$ and $\beta$ are chosen using Random Search (Bergstra & Bengio (2012)). Details about the hyper-parameters are discussed in the Appendix. We run each algorithm 100 times (except for the IHDP dataset, on which we run each algorithm 1,000 times which is the same setting in Shalit et al. (2017)) with new training/validation/testing splits and report the mean and standard deviation of the performances.
220
+
221
+ # 5.3 EXPERIMENTAL RESULTS
222
+
223
+ In our first simulation we focus on demonstrating the effect that including each of the losses introduced in Section 4 has on the performance of the algorithm. As is demonstrated below, inclusion of all four losses gives the best results.
224
+
225
+ We generate a synthetic dataset as follows: we draw 10,000 10-dimensional feature vectors $\mathbf { x } \sim$ $\mathcal { N } ( \bar { \mathbf { 0 } } ^ { 1 0 \times 1 } , 0 . 5 \times \bar { ( } \Sigma + \Sigma ^ { T } ) )$ where $\Sigma \sim \mathcal { U } ( ( - 1 , 1 ) ^ { 1 0 \times 1 0 } )$ . The treatment assignment is then generated as $t | \mathbf { x } \sim \mathrm { B e r n } ( \mathrm { S i g m o i d } ( \mathbf { w } _ { t } ^ { T } \mathbf { x } + n _ { t } ) )$ where $\mathbf { w } _ { t } ^ { T } \sim \mathcal { U } ( ( - 0 . 1 , 0 . 1 ) ^ { 1 0 \times 1 } )$ and $n _ { t } \sim \mathcal { N } ( 0 , 0 . 1 )$ . The potential outcome vector is then generated as $\mathbf { y } | \mathbf { x } \sim ( \mathbf { w } _ { y } ^ { T } \mathbf { x } + \mathbf { n } _ { y } ) )$ where $\mathbf { w } _ { y } ^ { T } \sim \mathcal { U } ( ( - 1 , 1 ) ^ { 1 0 \times 2 } )$ and $\mathbf { n } _ { y } \sim \mathcal { N } ( \mathbf { 0 } ^ { 2 \times 1 } , 0 . 1 \times I ^ { 2 \times 2 } )$ . We use 8,000 instances for training and 2,000 instances for testing. We repeat this 100 times and report the average $\epsilon _ { P E H E }$ on the testing set.
226
+
227
+ Table 1: Performance with various combinations of GANITE (G: Counterfactual generator, I: ITE generator, S loss: Supervised loss). Details of each cell are illustrated in the Appendix as Figures.
228
+
229
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>G</td></tr><tr><td rowspan=1 colspan=1>PEHE</td><td rowspan=1 colspan=1>S loss only</td><td rowspan=1 colspan=1>GAN loss only</td><td rowspan=1 colspan=1>S and GAN loss</td></tr><tr><td rowspan=1 colspan=1>S loss only</td><td rowspan=1 colspan=1>.397 ± .011 (15.6%)</td><td rowspan=1 colspan=1>.610 ± .017 (45.1%)</td><td rowspan=1 colspan=1>.352 ± .012 (4.8%)</td></tr><tr><td rowspan=1 colspan=1>GAN loss only</td><td rowspan=1 colspan=1>.607 ± .044 (44.8%)</td><td rowspan=1 colspan=1>.513 ± .029 (34.7%)</td><td rowspan=1 colspan=1>.463 ± .015 (27.6%)</td></tr><tr><td rowspan=1 colspan=1>S and GAN loss</td><td rowspan=1 colspan=1>.362 ± .011 (7.5%)</td><td rowspan=1 colspan=1>.491 ± .030 (31.8%)</td><td rowspan=1 colspan=1>.335 ± .011 (-)</td></tr></table>
230
+
231
+ ![](images/fd37c222a08f381e5ecd4cdb21bb3a5edd9473c704498df62a1170f86849a63d.jpg)
232
+ Figure 2: Performance comparison between GANITE and state-of-the-art methods as the selection bias is varied (Kullback-Leibler divergence of treated with respect to controlled distributions)
233
+
234
+ Table 1 shows the performance of the GANITE architecture using different combinations of the four losses in Section 4. For each generator component, we can use 3 different combinations of loss: (1) Supervised loss (S loss) only (this reduces the corresponding component to a standard neural network), (2) GAN loss only, (3) both S loss and GAN loss. The top-left most entry corresponds to simply using a standard neural network to first impute the counterfactuals and then using another standard neural network to learn an ITE estimator from the imputed dataset. As can be seen, this already performs well, but by adding the GAN losses for both the imputation step and the estimation step, a significant gain is shown $( 1 5 . 6 \% )$ (the bottom-right entry).
235
+
236
+ In Fig. 2 we show that GANITE is robust to an increased selection bias. We generate 10,000 10-dimensional treated samples from $\mathbf { x } _ { 1 } \sim \mathcal { N } ( \mu _ { 1 } , 0 . 5 \times ( \Sigma + \Sigma ^ { T } ) )$ and controlled samples from $\mathbf { x } _ { 0 } \sim \mathcal { N } ( \mu _ { \mathbf { 0 } } , 0 . 5 \times ( \Sigma + \Sigma ^ { T } ) )$ where $\Sigma \sim \mathcal { U } ( ( - 1 , 1 ) ^ { 1 0 \times 1 0 } )$ . Fixing $\mu _ { 0 }$ and varying $\mu _ { 1 }$ , we generate various datasets with different Kullback-Leibler divergences (KL divergences) of $\mu _ { 1 }$ with respect to $\mu _ { 0 }$ . A higher KL divergence indicates a higher selection bias (a larger mismatch) between treated and controlled distributions. As seen in Fig. 2, GANITE robustly outperforms state-of-the-art methods such as Shalit et al. (2017); Alaa $\&$ van der Schaar (2017) across the entire range of tested divergences.
237
+
238
+ Binary treatments: In this section, we evaluate GANITE for estimating individualized treatment effects for binary treatments. We use three datasets and report the $\epsilon _ { P E H E }$ both in-sample and outof-sample (for ATE and ATT see the appendix). We compare GANITE with least squares regression using treatment as a feature $\mathrm { ( O L S / L R _ { 1 } }$ ), separate least squares regressions for each treatment $\mathrm { ( O L S / L R _ { 2 } }$ ), balancing linear regression (BLR) (Johansson et al. (2016)), $\mathbf { k }$ -nearest neighbor (k-NN) (Crump et al. (2008)), Bayesian additive regression trees (BART) (Chipman et al. (2010)), random forests (RForest) (Breiman (2001)), causal forests (C Forest) (Wager & Athey (2017)), balancing neural network (BNN) (Johansson et al. (2016)), treatment-agnostic representation network (TARNET) (Shalit et al. (2017)), counterfactual regression with Wasserstein distance $( \mathrm { C F R } _ { W A S S } )$ (Shalit et al. (2017)), and multi-task gaussian process (CMGP) (Alaa & van der Schaar (2017)). We evaluate both in-sample and out-of-sample performance in Table 2.
239
+
240
+ Table 2: Performance of ITE estimation with three real-world datasets. Bold indicates the method with the best performance for each dataset. ∗: is used to indicate methods that GANITE shows a statistically significant improvement over.
241
+
242
+ <table><tr><td rowspan="3">Methods</td><td colspan="6">Datasets (Mean ± Std)</td></tr><tr><td colspan="2">IHDP(ePEHE)</td><td colspan="2">Twins (VePEHE)</td><td colspan="2">Jobs (Rpot (π))</td></tr><tr><td>In-sample</td><td> Out-sample</td><td> In-sample</td><td> Out-sample</td><td>In-sample</td><td>Out-sample</td></tr><tr><td>GANITE</td><td>1.9 ± .4</td><td>2.4±.4</td><td>.289 ± .005</td><td>.297 ± .016</td><td>.13± .01</td><td>.14±.01</td></tr><tr><td rowspan="4">OLS/LR1 OLS/LR2 BLR k-NN</td><td>5.8±.3*</td><td>5.8±.3*</td><td>.319± .001*</td><td>.318 ± .007</td><td>.22± .00*</td><td>.23±.02*</td></tr><tr><td>2.4 ±.1</td><td>2.5± .1</td><td>.320 ± .002</td><td>.320± .003*</td><td>.21 ± .00*</td><td>.24±.01*</td></tr><tr><td>5.8±.3*</td><td>5.8±.3*</td><td>.312 ± .003*</td><td>.323 ± .018</td><td>.22 ±.01*</td><td>.25±.02*</td></tr><tr><td>2.1 ± .1</td><td>4.1± .2*</td><td>.333± .001*</td><td>.345 ± .007*</td><td>.02 ± .00</td><td>.26± .02*</td></tr><tr><td rowspan="4">RForest C Forest BNN</td><td>2.1±.1 4.2±.2*</td><td>2.3 ±.1</td><td>.347 ± .009*</td><td>.338 ± .016</td><td>.23± .00* .23 ± .01*</td><td>.25± .02*</td></tr><tr><td></td><td>6.6± .3*</td><td>.306 ± .002*</td><td>.321 ± .005</td><td></td><td>.28±.02*</td></tr><tr><td>3.8±.2*</td><td>3.8±.2*</td><td>.366± .003*</td><td>.316 ± .011</td><td>.19 ± .00*</td><td>.20±.02*</td></tr><tr><td>2.2 ±.1</td><td>2.1±.1</td><td>.325 ± .003*</td><td>.321± .018</td><td>.20± .01*</td><td>.24±.02*</td></tr><tr><td rowspan="4">TARNET CFRwASS CMGP</td><td>.88 ±.02</td><td>.95 ± .02</td><td>.317 ± .005*</td><td>.315 ± .003</td><td>.17 ± .01*</td><td>.21±.01*</td></tr><tr><td>.71 ± .02</td><td>.76 ± .02</td><td>.315±.007*</td><td>.313 ± .008</td><td>.17± .01*</td><td>.21± .01*</td></tr><tr><td>.65 ± .44</td><td>.77 ± .11</td><td>.320± .002*</td><td>.319 ± .008</td><td>.22± .03*</td><td>.24 ± .05</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
243
+
244
+ As can be seen in Table 2, GANITE achieves significant performance gains on the Twins and Jobs datasets in comparison with state-of-the-art methods (both in-sample and out-of-sample 2). GANITE achieves a much higher gain for individualized treatment effect estimations (such as $\hat { \epsilon } _ { P E H E }$ and $\mathcal { R } _ { p o l } ( \pi ) )$ than average treatment effect estimations (such as $\hat { \epsilon } _ { A T E }$ and $\epsilon _ { A T T }$ ). On IHDP, GANITE is competitive with BART and BNN but is outperformed by TARNET, $\mathbf { C F R } _ { W A S S }$ and CMGP. We believe this is due to the fact that GANITE has a large number of parameters to be optimized and IHDP is a relatively small dataset (747 samples). This belief is backed up by our significant gains over these methods in both Twins and Jobs, where the number of samples is much larger, (11400 and 3212 samples, respectively).
245
+
246
+ Table 3: Performance of multiple treatment effects estimations using Twins data. Bold indicates the method with the best performance for each dataset. ∗: is used to indicate methods that GANITE shows a statistically significant improvement over.
247
+
248
+ <table><tr><td rowspan=2 colspan=1>Methods</td><td rowspan=1 colspan=4>Metric: MSEy</td></tr><tr><td rowspan=1 colspan=1>In Sample</td><td rowspan=1 colspan=1>Gain (%)</td><td rowspan=1 colspan=1>Out Sample</td><td rowspan=1 colspan=1>Gain (%)</td></tr><tr><td rowspan=1 colspan=1>GANITE</td><td rowspan=1 colspan=1>.0427士.0161</td><td rowspan=1 colspan=1>(-)</td><td rowspan=1 colspan=1>.0723士.0183</td><td rowspan=1 colspan=1>(-)</td></tr><tr><td rowspan=2 colspan=1>OLS/LR1OLS/LR2BLRKNN</td><td rowspan=2 colspan=1>.0855士.0096.0857 ± .0099.0996 ± .0081*.0930 ± .0101*</td><td rowspan=1 colspan=1>50.1%</td><td rowspan=2 colspan=1>.0871±.0142.0883 ± .0147.1017 ± .0127.1008 ± .0236</td><td rowspan=2 colspan=1>17.0%18.1%28.9%28.3%</td></tr><tr><td rowspan=1 colspan=1>50.2%57.1%54.1%</td></tr><tr><td rowspan=1 colspan=1>BARTR ForestC Forest</td><td rowspan=1 colspan=1>.1097 ± .0084*.0442 ± .0069.1607 ± .0014*</td><td rowspan=1 colspan=1>61.1%3.4%73.4%</td><td rowspan=1 colspan=1>.1037 ± .0283.0927 ± .0138.1665 ± .0035*</td><td rowspan=1 colspan=1>30.3%22.0%56.6%</td></tr><tr><td rowspan=2 colspan=1>BNNTARNETCFRW ASSCMGP</td><td rowspan=1 colspan=1>.0602 ± .0102.0854 ± .0091</td><td rowspan=1 colspan=1>29.1%50.0%</td><td rowspan=2 colspan=1>.1031 ± .0145.0879 ± .0030.0894 ± .0057.0793 ± .0191</td><td rowspan=2 colspan=1>29.9%17.7%19.1%8.3%</td></tr><tr><td rowspan=1 colspan=1>.0896 ± .0036*.0844± .0073*</td><td rowspan=1 colspan=1>52.3%49.4%</td></tr></table>
249
+
250
+ Multiple treatments: GANITE is naturally defined for estimating multiple treatment effects. In this subsection, we further preprocess the Twins data to create a dataset containing multiple treatments. The multiple treatments are determined as follows: (1) $t = 1$ : lower weight, female sex, (2) $t = 2$ : lower weight, male sex, (3) $t = 3$ : higher weight, female sex, (4) $t = 4$ : higher weight, male sex. Therefore, we have 4 possible treatments for each sample.
251
+
252
+ We use the mean-squared error:
253
+
254
+ $$
255
+ \mathrm { M S E } _ { y } = \frac { 1 } { N \times | \mathcal { T } _ { i } | } \sum _ { i = 1 } ^ { N } \sum _ { t \in \mathcal { T } _ { i } } \Big ( y _ { t } ( x _ { i } ) - \hat { y } _ { t } ( x _ { i } ) \Big ) ^ { 2 }
256
+ $$
257
+
258
+ as the performance metric to evaluate the multiple treatment effects (other metrics, such as PEHE, do not have a natural extension to the multiple treatments setting). For comparison with state-of-the-art methods, we naively extend BLR, C Forest, BNN, TARNET, $\mathbf { C F R } _ { W A S S }$ , and CMGP for multiple treatments: one of the four treatments is selected as a control treatment and then the remaining three create three separate binary ITE estimation problems (all against the same chosen control treatment).
259
+
260
+ As can be seen in Table 3 compared with Table 2 GANITE significantly outperforms other state-ofthe-art methods such as TARNET and $\mathbf { C F R } _ { W A S S }$ $1 7 . 7 \%$ and $1 9 . 1 \%$ gains in terms of out sample MSE, respectively). This is because, GANITE is designed for multiple treatments; the model is jointly trained for all treatments. On the other hand, other methods are designed for binary treatments and only naively extend to multiple treatments by training pairs of the available treatments.
261
+
262
+ # 5.4 DISCUSSION
263
+
264
+ The experimental results provide various intuitions of the GANITE framework for ITE estimation. First, GANITE can be easily extended to any number of treatments and performs well in this multiple treatment setting. As can be seen in Section 4, however, a different loss for binary treatment and multiple treatments must be used because PEHE is only defined for the binary treatment setting - the MSE is not a natural generalisation of the PEHE and we believe exploration of possible loss functions in this setting would be an interesting future work.
265
+
266
+ A further extension to this problem would be to consider a setting in which a patient may receive several treatments (rather than just one). While this work can handle this problem naively (by treating each combination of treatments as a separate ‘treatment’) we believe this would also be an interesting problem to explore in a future work.
267
+
268
+ # 6 CONCLUSION
269
+
270
+ In this paper we introduced a novel method for dealing with the ITE estimation problem. We have shown empirically that our method is more robust to large selection biases and performs better on standard benchmark datasets than other state-of-the-art methods. Our method also achieves significant performance gains over state-of-the-art when estimating ITE for multiple treatments because it is able to jointly estimate the representations across the multiple treatments.
271
+
272
+ # ACKNOWLEDGMENTS
273
+
274
+ This work was supported by the Office of Naval Research (ONR) and the NSF (Grant number: ECCS1462245, ECCS1533983, and ECCS1407712).
275
+
276
+ # REFERENCES
277
+
278
+ Ahmed M Alaa and Mihaela van der Schaar. Bayesian inference of individualized treatment effects using multi-task gaussian processes. NIPS, 2017.
279
+
280
+ Ahmed M Alaa, Michael Weisz, and Mihaela van der Schaar. Deep counterfactual networks with propensity-dropout. ICML Workshop on Principled Approaches to Deep Learning, 2017.
281
+
282
+ Douglas Almond, Kenneth Y Chay, and David S Lee. The costs of low birth weight. The Quarterly Journal of Economics, 120(3):1031–1083, 2005.
283
+
284
+ Susan Athey and Guido Imbens. Recursive partitioning for heterogeneous causal effects. Proceedings of the National Academy of Sciences, 113(27):7353–7360, 2016.
285
+
286
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. Journal of Machine Learning Research, 13(Feb):281–305, 2012.
287
+
288
+ Leo Breiman. Random forests. Machine learning, 45(1):5–32, 2001.
289
+
290
+ Hugh A Chipman, Edward I George, Robert E McCulloch, et al. Bart: Bayesian additive regression trees. The Annals of Applied Statistics, 4(1):266–298, 2010.
291
+
292
+ Richard K Crump, V Joseph Hotz, Guido W Imbens, and Oscar A Mitnik. Nonparametric tests for treatment effect heterogeneity. The Review of Economics and Statistics, 90(3):389–405, 2008.
293
+
294
+ Rajeev H Dehejia and Sadek Wahba. Propensity score-matching methods for nonexperimental causal studies. The review of economics and statistics, 84(1):151–161, 2002a.
295
+
296
+ Rajeev H Dehejia and Sadek Wahba. Propensity score-matching methods for nonexperimental causal studies. The review of economics and statistics, 84(1):151–161, 2002b.
297
+
298
+ Vincent Dorie. Npci: Non-parametrics for causal inference, 2016.
299
+
300
+ 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.
301
+
302
+ A Hannart, J Pearl, FEL Otto, P Naveau, and M Ghil. Causal counterfactual theory for the attribution of weather and climate-related events. Bulletin of the American Meteorological Society, 97(1): 99–110, 2016.
303
+
304
+ Jennifer L Hill. Bayesian nonparametric modeling for causal inference. Journal of Computational and Graphical Statistics, 20(1):217–240, 2011.
305
+
306
+ M Hofler. Causal inference based on counterfactuals. ¨ BMC medical research methodology, 5(1):28, 2005.
307
+
308
+ Fredrik Johansson, Uri Shalit, and David Sontag. Learning representations for counterfactual inference. In International Conference on Machine Learning, pp. 3020–3029, 2016.
309
+
310
+ James K Kirklin, David C Naftel, Robert L Kormos, Lynne W Stevenson, Francis D Pagani, Marissa A Miller, Karen L Ulisney, J Timothy Baldwin, and James B Young. Second intermacs annual report: more than 1000 primary lvad implants. The Journal of heart and lung transplantation: the official publication of the International Society for Heart Transplantation, 29(1):1, 2010.
311
+
312
+ Robert J LaLonde. Evaluating the econometric evaluations of training programs with experimental data. The American economic review, pp. 604–620, 1986.
313
+
314
+ Christos Louizos, Uri Shalit, Joris Mooij, David Sontag, Richard Zemel, and Max Welling. Causal effect inference with deep latent-variable models. NIPS, 2017.
315
+
316
+ Min Lu, Saad Sadiq, Daniel J Feaster, and Hemant Ishwaran. Estimating individual treatment effect in observational data using random forest methods. arXiv preprint arXiv:1701.05306, 2017.
317
+
318
+ Jared K Lunceford and Marie Davidian. Stratification and weighting via the propensity score in estimation of causal treatment effects: a comparative study. Statistics in medicine, 23(19):2937– 2960, 2004.
319
+
320
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
321
+
322
+ Kristin E Porter, Susan Gruber, Mark J Van Der Laan, and Jasjeet S Sekhon. The relative performance of targeted maximum likelihood estimators. The International Journal of Biostatistics, 7 (1):1–34, 2011.
323
+
324
+ Donald B Rubin. Causal inference using potential outcomes: Design, modeling, decisions. Journal of the American Statistical Association, 100(469):322–331, 2005.
325
+
326
+ Uri Shalit, Fredrik Johansson, and David Sontag. Estimating individual treatment effect: generalization bounds and algorithms. ICML, 2017.
327
+
328
+ Jeffrey A Smith and Petra E Todd. Does matching overcome lalonde’s critique of nonexperimental estimators? Journal of econometrics, 125(1):305–353, 2005.
329
+
330
+ Peter Spirtes. A tutorial on causal inference. 2009.
331
+
332
+ Stefan Wager and Susan Athey. Estimation and inference of heterogeneous treatment effects using random forests. Journal of the American Statistical Association, (just-accepted), 2017.
333
+
334
+ # APPENDIX
335
+
336
+ PSEUDO-CODE OF GANITE
337
+
338
+ # Algorithm 1 Pseudo-code of GANITE
339
+
340
+ while convergence of training loss of G and $\mathbf { D _ { G } }$ do
341
+
342
+ # (1) Counterfactual block optimization
343
+
344
+ Use $k _ { C }$ minibatches, iteratively optimize $\mathbf { G } , \mathbf { D } _ { \mathbf { G } }$ by stochastic gradient descent (SGD)
345
+
346
+ $$
347
+ \begin{array} { l } { \displaystyle \operatorname* { m i n } _ { \mathbf { D } _ { \mathbf { G } } } - \sum _ { n = 1 } ^ { k _ { G } } V _ { C F } ( \mathbf { x } ( n ) , \mathbf { t } ( n ) , \tilde { \mathbf { y } } ( n ) ) } \\ { \displaystyle \operatorname* { m i n } _ { \mathbf { G } } \sum _ { n = 1 } ^ { k _ { G } } \Big [ V _ { C F } ( \mathbf { x } ( n ) , \mathbf { t } ( n ) , \tilde { \mathbf { y } } ( n ) ) + \alpha \mathcal { L } _ { S } ^ { G } ( y _ { f } ( n ) , \tilde { y } _ { \eta ( n ) } ^ { * } ( n ) ) \Big ] } \end{array}
348
+ $$
349
+
350
+ while convergence of training loss of $\mathbf { I }$ and $\mathbf { D _ { I } }$ do
351
+
352
+ # (2) ITE block optimization
353
+
354
+ Use $k _ { I }$ minibatches, update $\mathbf { I } , \mathbf { D _ { I } }$ by SGD
355
+
356
+ $$
357
+ \begin{array} { l } { \displaystyle \operatorname* { m i n } _ { { \bf { D } } _ { \bf { I } } } - \sum _ { n = 1 } ^ { k _ { I } } V _ { I T E } ( { \bf { x } } ( n ) , \tilde { { \bf { y } } } ( n ) , \hat { { \bf { y } } } ( n ) ) } \\ { \displaystyle \operatorname* { m i n } _ { { \bf { I } } } \sum _ { n = 1 } ^ { k _ { G } } \left[ V _ { I T E } ( { \bf { x } } ( n ) , \tilde { { \bf { y } } } ( n ) , \hat { { \bf { y } } } ( n ) ) + \beta \mathcal { L } _ { S } ^ { I } ( \tilde { { \bf { y } } } ( n ) , \hat { { \bf { y } } } ( n ) ) \right] } \end{array}
358
+ $$
359
+
360
+ DETAILED DESCRIPTION OF THE DATASETS
361
+
362
+ IHDP
363
+
364
+ Hill (2011) provided a dataset for ITE estimation with the Infant Health and Development Program (IHDP). The dataset consists of 747 children ( $\mathrm { \Delta } t = 1$ : 139, $t = 0 6 0 8$ ) with 25 features. We generated potential outcomes from setting A in the NPCI package Dorie (2016).
365
+
366
+ JOBS
367
+
368
+ Jobs data studied in LaLonde (1986) is composed of randomized data based on the National Supported Work program and non-randomized data from observational studies. We use a (random) subset of the randomized data to evaluate the algorithms based on $\mathcal { R } _ { p o l } ( \pi )$ and $\epsilon _ { A T T }$ . The dataset consists of 722 randomized samples $\mathit { t } = 1$ : 297, $t = 0$ : 425) and 2490 non-randomized samples $( t = 1 ; 0 , t = 0 ; 2 4 9 0 )$ , all with 7 features.
369
+
370
+ # SUMMARY OF THE DATASETS
371
+
372
+ Table 4: Summary of the datasets (N is the number of samples, s is the feature-dimension)
373
+
374
+ <table><tr><td rowspan="2">Data</td><td colspan="5">Condition</td><td colspan="2">一 Property</td></tr><tr><td>F</td><td>CF</td><td>Distribution</td><td>RT-test</td><td>T</td><td>N</td><td>一 S</td></tr><tr><td>IHDP</td><td>√</td><td>√</td><td>Known</td><td></td><td>Binary</td><td>747</td><td>25</td></tr><tr><td>Jobs</td><td>√</td><td>X</td><td>Unknown</td><td>√</td><td>Binary</td><td>3212</td><td>7</td></tr><tr><td>Twins-Binary</td><td>√</td><td>√</td><td>Unknown</td><td></td><td>Binary</td><td>11400</td><td>30</td></tr><tr><td>Twins-Multiple</td><td>√</td><td>X</td><td>Unknown</td><td></td><td>Multiple</td><td>11400</td><td>30</td></tr></table>
375
+
376
+ <table><tr><td rowspan="3">Methods</td><td colspan="6">Datasets (Mean ± Std)</td></tr><tr><td colspan="2">IHDP (EATE) 一</td><td colspan="2">Twins (CATE)</td><td colspan="2">Jobs (EATT)</td></tr><tr><td>In-sample</td><td> Out-sample</td><td>In-sample</td><td>Out-sample</td><td>In-sample</td><td> Out-sample</td></tr><tr><td>GANITE</td><td>.43± .05</td><td>.49± .05</td><td>.0058 ± .0017</td><td>.0089± 0.0075</td><td>.01 ± .01</td><td>.06 ± .03</td></tr><tr><td rowspan="4">OLS/LR1 OLS/LR2 BLR k-NN</td><td>.73± .04*</td><td>.94 ± .06*</td><td>.0038 ± .0025</td><td>.0069 ± .0056</td><td>.01±.00</td><td>.08± .04</td></tr><tr><td>.14 ± .01</td><td>.31± .02</td><td>.0039 ± .0025</td><td>.0070 ± .0059</td><td>.01 ± .01</td><td>.08 ± .03</td></tr><tr><td>.72 ± .04*</td><td>.93 ± .05*</td><td>.0057 ± .0036</td><td>.0334± .0092*</td><td>.01 ± .01</td><td>.08 ± .03</td></tr><tr><td>.14 ± .01</td><td>.90± .05*</td><td>.0028 ± .0021</td><td>.0051 ± .0039</td><td>.21±.01*</td><td>.13 ± .05</td></tr><tr><td rowspan="3">BART R Forest C Forest</td><td>.23 ± .01</td><td>.34± .02</td><td>.1206 ± .0236*</td><td>.1265 ± .0234*</td><td>.02 ± .00</td><td>.08± .03</td></tr><tr><td>.73± .05*</td><td>.96 ± .06*</td><td>.0049 ± .0034</td><td>.0080 ± .0051</td><td>.03 ± .01</td><td>.09 ± .04</td></tr><tr><td>.18 ± .01</td><td>.40± .03</td><td>.0286 ± .0035*</td><td>.0335± .0083*</td><td>.03 ± .01</td><td>.07± .03</td></tr><tr><td rowspan="4">BNN TARNET CFRwASS CMGP</td><td>.37±.03</td><td>.42 ± .03</td><td>.0056 ± .0032</td><td>.0203 ± .0071</td><td>.04 ±.01</td><td>.09 ± .04</td></tr><tr><td>.26 ± .01</td><td>.28± .01</td><td>.0108± .0017*</td><td>.0151 ± .0018</td><td>.05 ± .02</td><td>.11 ± .04</td></tr><tr><td>.25 ± .01</td><td>.27 ± .01</td><td>.0112 ± .0016*</td><td>.0284± .0032*</td><td>.04 ± .01</td><td>.09 ± .03</td></tr><tr><td>.11 ± .10</td><td>.13 ± .12</td><td>.0124 ± .0051</td><td>.0143 ± .0116</td><td>.06 ± .06</td><td>.09 ± .07</td></tr></table>
377
+
378
+ Table 5: Performance of average treatment effect estimation. Bold represents the best performance.
379
+ ∗: statistically significant improvement of GANITE.
380
+
381
+ # PERFORMANCE METRICS AND THE RESULTS OF AVERAGE TREATMENT EFFECT ESTIMATION
382
+
383
+ In this subsection, we use two different performance metrics for average treatment effect (ATE) estimation: average treatment effect (ATE) (Hill (2011)), and average treatment effect on the treated (ATT) (Shalit et al. (2017)).
384
+
385
+ If both factual and counterfactual outcomes are generated from a known distribution (and so we are able to compute the expected value, such as in IHDP), the error of ATE $( \epsilon _ { A T E } )$ is defined as:
386
+
387
+ $$
388
+ \epsilon _ { A T E } = | | \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathbb { E } _ { { \mathbf { y } } ( n ) \sim \mu _ { { \mathbf { Y } } } ( { \mathbf { x } } ( n ) ) } [ { \mathbf { y } } ( n ) ] - \frac { 1 } { N } \sum _ { i = 1 } ^ { n } \hat { { \mathbf { y } } } ( n ) | | _ { 2 } ^ { 2 }
389
+ $$
390
+
391
+ where $\hat { \mathbf { y } }$ is the estimated potential outcome.
392
+
393
+ If both factual and counterfactual outcomes are observed but the underlying distribution is unknown (like in Twins), $\epsilon _ { A \hat { T } E }$ is defined as:
394
+
395
+ $$
396
+ \hat { \epsilon } _ { A T E } = | | \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathbf { y } ( n ) - \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \hat { \mathbf { y } } ( n ) | | _ { 2 } ^ { 2 }
397
+ $$
398
+
399
+ If only factual outcomes are available (such as in Jobs), treatment is binary, and the testing set comes from a randomized controlled trial (RCT), the true average treatment effect on the treated (ATT) is defined as follows (Shalit et al. (2017)):
400
+
401
+ $$
402
+ \begin{array} { l } { { \displaystyle { \cal A T T } = \frac { 1 } { | T _ { 1 } \cap { \cal E } | } \sum _ { { \bf x } _ { i } \in T _ { 1 } \cap { \cal E } } Y _ { 1 } ( { \bf x } _ { i } ) - \frac { 1 } { | T _ { 0 } \cap { \cal E } | } \sum _ { { \bf x } _ { i } \in C \cap { \cal E } } Y _ { 0 } ( { \bf x } _ { i } ) } } \\ { { \displaystyle \epsilon _ { A T T } = | A T T - \frac { 1 } { | T _ { 1 } \cap { \cal E } | } \sum _ { { \bf x } _ { i } \in T _ { 1 } \cap { \cal E } } \hat { Y } _ { 1 } ( { \bf x } _ { i } ) - \hat { Y } _ { 0 } ( { \bf x } _ { i } ) | } } \end{array}
403
+ $$
404
+
405
+ where $T _ { 1 }$ is the subset corresponding to treated samples, $T _ { 0 }$ is the subset corresponding to controlled samples, and $E$ is the subset corresponding to the randomized controlled trials.
406
+
407
+ Table. 5 shows the performance of the various algorithms with respect to these metrics.
408
+
409
+ As can be seen in Table 5, the GANITE achieves competitive performances for Average Treatment Effect (ATE) estimation but not the best model to estimate ATE (except the Jobs dataset). However, we do not believe that it is an important metric for distinguishing models where the task is predicting
410
+
411
+ treatment effects on an individual level. The problem we address with GANITE is to estimate the ITE. We used the ATE performance as a sanity check for our method - and believe it passes the sanity check, being competitive with most other methods.
412
+
413
+ # HYPER-PARAMETER OPTIMIZATION
414
+
415
+ We optimize our hyper-parameters in GANITE by estimating the PEHE (MSE in the case of multiple treatments) on the dataset generated by G and minimizing this with respect to the hyper-parameters. The table below indicates specifics of this process, including the values we search over.
416
+
417
+ Table 6: Hyper-parameters of GANITE
418
+
419
+ <table><tr><td>Blocks</td><td>Sets of Hyper-parameters</td></tr><tr><td>Initialization</td><td>Xavier Initialization for Weight matrix, Zero initialization for bias vector.</td></tr><tr><td>Optimization</td><td>Adam Moment Optimization</td></tr><tr><td>Batch size (kG, k1)</td><td>{32,64,128,256}</td></tr><tr><td>Depth of layers</td><td>{1,3,5,7,9}</td></tr><tr><td>Hidden state dimension</td><td>{s, int(s/2),int(s/3), int(s/4),int(s/5)}</td></tr><tr><td>α,β</td><td>{0,0.1,0.5,1,2,5,10}</td></tr></table>
420
+
421
+ For the hyper-parameter optimization of the benchmarks, we follow the hyper-parameter optimzation code published in the github with their main code. For instance, the hyper-parameters of $\mathbf { C F R } _ { W A S S }$ are optimized using cfr_param_search.py file which is published in https: //github.com/clinicalml/cfrnet
422
+
423
+ # OPTIMAL HYPER-PARAMETERS FOR EACH DATASET
424
+
425
+ Table 7: Optimal Hyper-parameters of GANITE
426
+
427
+ <table><tr><td>Dataset</td><td>Optimal Hyper-parameters</td></tr><tr><td>IHDP</td><td>kG : 64,k1 : 64, Depth of layers: 5, hdim: 8,α : 2, β : 5</td></tr><tr><td>Jobs</td><td>kG : 128,k1 : 128,Depth of layers: 3, hdim: 4, α : 1, β : 5</td></tr><tr><td></td><td>Twins - Binary|kg : 128,k1 : 128,Depth of layers: 5, hdim: 8,α : 2, β : 2</td></tr><tr><td></td><td>Twins - Multiple |kg : 128,k1 : 128,Depth of layers: 7, hdim: 8,α : 1, β : 2</td></tr></table>
428
+
429
+ ADDITIONAL EXPERIMENTS
430
+
431
+ # PERFORMANCE GAP BETWEEN $G$ AND $I$
432
+
433
+ As explained in Section 4, $I$ tries to learn the potential distribution that consists of factual outcomes and counterfactual outcomes that are generated by $G$ . To evaluate how well $I$ is able to learn from $G$ , we compare the performance of $G$ and $I$ of the GANITE framework in Table 8 in terms of ITE estimation. As can be seen in Table 8, the in-sample ITE estimation performance of GANITE (I) is competitive with GANITE (G). It experimentally verifies that GANITE (I) learns well from the outputs of GANITE (G).
434
+
435
+ # ZERO OUT THE CONTRIBUTION OF FACTUAL OUTCOME AND TREATMENT
436
+
437
+ In this section, we use the trained $G$ to compute ITE only with $x$ . The learned function $G$ needs $x , t$ , and $y _ { f }$ as the inputs. Therefore, in order to compute ITE only with $x$ , we should zero out the contribution of $t$ and $y _ { f }$ in the $G$ function. $G$ tries to learn the conditional probability $\mathcal { P } ( y | x , y _ { f } , t )$
438
+
439
+ <table><tr><td rowspan="2">Methods</td><td colspan="3">Datasets (Mean ± Std)</td></tr><tr><td>IHDP(√∈PEHE)</td><td>)|Twins (√PEHE) |Jobs (Rpot(π))</td><td></td></tr><tr><td>GANITE (I)</td><td>1.9 ± .4</td><td>.289 ± .005</td><td>.13 ± .01</td></tr><tr><td>GANITE (G)</td><td>1.4 ± .2</td><td>.267 ± .004</td><td>一 .10 ± .01</td></tr></table>
440
+
441
+ Table 8: Performance comparison of in-sample ITE estimation between GANITE (I) and GANITE (G) with three real-world datasets.
442
+
443
+ and what we want to compute is the conditional probability $\mathcal { P } ( y | x )$ . Therefore, zero out the impact of $t$ and $y _ { f }$ can be done as follows.
444
+
445
+ $$
446
+ \mathcal { P } ( y | x ) = \int \mathcal { P } ( y | x , t , y _ { f } ) P ( y _ { f } , t | x ) d t d y _ { f }
447
+ $$
448
+
449
+ The $\mathcal { P } ( y | x , t , y _ { f } )$ is learned by $G$ and $P ( \boldsymbol { y } _ { f } , t | \boldsymbol { x } )$ can be easily learned using supervised learning framework (all the labels $( y _ { f } , t )$ are available) with drop-out approach (to approximate the integral as the sample mean of multiple samples). We use multi-layer perceptron (MLP) with multiple outputs to learn the function $P ( \boldsymbol { y } _ { f } , t | \boldsymbol { x } )$ . We called this as zero-out GANITE. We compare the performance of zero-out GANITE to original GANITE in Table 9. As can be seen in Table 9, the performance of original GANITE is marginally better than zero-out GANITE in three different datasets. We do not believe that zero-out GANITE would be any simpler than our proposed structure - in both cases we would still have 2 learning stages (Table 9 experimentally verifies this).
450
+
451
+ Table 9: Performance comparison of ITE estimation between GANITE and zero-out GANITE with three real-world datasets.
452
+
453
+ <table><tr><td rowspan="3">Methods</td><td colspan="6">Datasets (Mean ± Std)</td></tr><tr><td colspan="2">IHDP(VePEHE)</td><td colspan="2">Twins (√PEHE)</td><td colspan="2">Jobs (Rpot(π))</td></tr><tr><td>In-sample</td><td> Out-sample</td><td> In-sample</td><td> Out-sample</td><td> In-sample</td><td> Out-sample</td></tr><tr><td>GANITE</td><td>1.9 ±.4</td><td>2.4±.4</td><td>.289± .005</td><td>.297± .016</td><td>.13± .01</td><td>.14±.01</td></tr><tr><td>zero-out GANITE</td><td>2.2±.6</td><td>2.6±.7</td><td>.297± .008</td><td>.308 ± .022</td><td>.14±.02</td><td>.17 ± .01</td></tr></table>
454
+
455
+ ![](images/01fd331969becb74c40c9fb7393e84c8324068e58272206cc658ec33f29a6398.jpg)
456
+ Figure 3: (a) Underlying distribution of potential outcomes $( \mathbf { Y } )$ , (b) Underlying distribution of treatment assignments $\mathcal { P } ( { \cal T } | \mathbf { X } )$ , (c) Training data (factual outcomes) sampled from distributions explained in (a) and (b), (d) Potential outcomes sampled from trained ITE generator (I).
457
+
458
+ ![](images/5416c8d18c27cc7fc97591fbcdf148d6dbf632cdd2afabd0c653a7efc1971edb.jpg)
459
+ (a) G: S loss only, I: S loss only
460
+
461
+ ![](images/5580d21a47b5741dd06226c58dfaa2bbb1c03ef1fe3ca55713d2b3bbaf8b0b5d.jpg)
462
+ (b) G: GAN loss only, I: S loss only
463
+
464
+ ![](images/e9299a806ba69fd8e89515db3209b4579df81b24690d66d8b9ef100f04b20764.jpg)
465
+ (c) G: S and GAN loss, I: S loss only
466
+
467
+ ![](images/891cb861535bc715091ce87230dc8702cd04ebdf141d97b640c2b5094b9ef472.jpg)
468
+ (d) G: S loss only, I: GAN loss only
469
+
470
+ ![](images/e8202c3d1bf7ddb4e787d1942f7f32133116c72050d09baa9baed922310dfa18.jpg)
471
+ (e) G: GAN loss only, I: GAN loss only
472
+
473
+ ![](images/994fff82ccfbb7486666c9221e5989a475319e8e43c29a7f6cacbe4bd88f2d0d.jpg)
474
+ (f) G: S and GAN loss, I: GAN loss only
475
+
476
+ ![](images/c82ac2826b7806b7c0ba8cf563fd2ffcaa3c43ab51fcd20911ca9dda93b906d5.jpg)
477
+ (g) G: S loss only, I: S and GAN loss
478
+
479
+ ![](images/49c0f1002d5b450bc923865f91e3b18d15f07d7c854ca2714774ab3647801e2a.jpg)
480
+ (h) G: GAN loss only, I: S and GAN loss
481
+
482
+ ![](images/31e865395490289cff0612ce8a331ba74695faa7bc947b3e52871c43343fbff7.jpg)
483
+ (i) G: S and GAN loss, I: S and GAN loss
md/train/ByeUBANtvB/ByeUBANtvB.md ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO SOLVE THE CREDIT ASSIGNMENT PROBLEM
2
+
3
+ Benjamin James Lansdell Department of Bioengineering University of Pennsylvania Pennsylvania, PA 19104 lansdell@seas.upenn.edu
4
+
5
+ Prashanth Ravi Prakash Department of Bioengineering University of Pennsylvania Pennsylvania, PA 19104
6
+
7
+ Konrad Paul Kording Department of Bioengineering University of Pennsylvania Pennsylvania, PA 19104
8
+
9
+ # ABSTRACT
10
+
11
+ Backpropagation is driving today’s artificial neural networks (ANNs). However, despite extensive research, it remains unclear if the brain implements this algorithm. Among neuroscientists, reinforcement learning (RL) algorithms are often seen as a realistic alternative: neurons can randomly introduce change, and use unspecific feedback signals to observe their effect on the cost and thus approximate their gradient. However, the convergence rate of such learning scales poorly with the number of involved neurons. Here we propose a hybrid learning approach. Each neuron uses an RL-type strategy to learn how to approximate the gradients that backpropagation would provide. We provide proof that our approach converges to the true gradient for certain classes of networks. In both feedforward and convolutional networks, we empirically show that our approach learns to approximate the gradient, and can match or the performance of exact gradient-based learning. Learning feedback weights provides a biologically plausible mechanism of achieving good performance, without the need for precise, pre-specified learning rules.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ It is unknown how the brain solves the credit assignment problem when learning: how does each neuron know its role in a positive (or negative) outcome, and thus know how to change its activity to perform better next time? This is a challenge for models of learning in the brain.
16
+
17
+ Biologically plausible solutions to credit assignment include those based on reinforcement learning (RL) algorithms and reward-modulated STDP (Bouvier et al., 2016; Fiete et al., 2007; Fiete & Seung, 2006; Legenstein et al., 2010; Miconi, 2017). In these approaches a globally distributed reward signal provides feedback to all neurons in a network. Essentially, changes in rewards from a baseline, or expected, level are correlated with noise in neural activity, allowing a stochastic approximation of the gradient to be computed. However these methods have not been demonstrated to operate at scale. For instance, variance in the REINFORCE estimator (Williams, 1992) scales with the number of units in the network (Rezende et al., 2014). This drives the hypothesis that learning in the brain must rely on additional structures beyond a global reward signal.
18
+
19
+ In artificial neural networks (ANNs), credit assignment is performed with gradient-based methods computed through backpropagation (Rumelhart et al., 1986; Werbos, 1982; Linnainmaa, 1976). This is significantly more efficient than RL-based algorithms, with ANNs now matching or surpassing human-level performance in a number of domains (Mnih et al., 2015; Silver et al., 2017; LeCun et al., 2015; He et al., 2015; Haenssle et al., 2018; Russakovsky et al., 2015). However there are well known problems with implementing backpropagation in biologically realistic neural networks.
20
+
21
+ One problem is known as weight transport (Grossberg, 1987): an exact implementation of backpropagation requires a feedback structure with the same weights as the feedforward network to communicate gradients. Such a symmetric feedback structure has not been observed in biological neural circuits. Despite such issues, backpropagation is the only method known to solve supervised and reinforcement learning problems at scale. Thus modifications or approximations to backpropagation that are more plausible have been the focus of significant recent attention (Scellier & Bengio, 2016; Lillicrap et al., 2016; Lee et al., 2015; Lansdell & Kording, 2018; Ororbia et al., 2018).
22
+
23
+ These efforts do show some ways forward. Synthetic gradients demonstrate that learning can be based on approximate gradients, and need not be temporally locked (Jaderberg et al., 2016; Czarnecki et al., 2017b). In small feedforward networks, somewhat surprisingly, fixed random feedback matrices in fact suffice for learning (Lillicrap et al., 2016) (a phenomenon known as feedback alignment). But still issues remain: feedback alignment does not work in CNNs, very deep networks, or networks with tight bottleneck layers. Regardless, these results show that rough approximations of a gradient signal can be used to learn; even relatively inefficient methods of approximating the gradient may be good enough.
24
+
25
+ On this basis, here we propose an RL algorithm to train a feedback system to enable learning. Recent work has explored similar ideas, but not with the explicit goal of approximating backpropagation (Miconi, 2017; Miconi et al., 2018; Song et al., 2017). RL-based methods like REINFORCE may be inefficient when used as a base learner, but they may be sufficient when used to train a system that itself instructs a base learner. We propose to use REINFORCE-style perturbation approach to train feedback signals to approximate what would have been provided by backpropagation.
26
+
27
+ This sort of two-learner system, where one network helps the other learn more efficiently, may in fact align well with cortical neuron physiology. For instance, the dendritic trees of pyramidal neurons consist of an apical and basal component. Such a setup has been shown to support supervised learning in feedforward networks (Guergiuev et al., 2017; Kording & Konig, 2001). Similarly, climbing fibers and Purkinje cells may define a learner/teacher system in the cerebellum (Marr, 1969). These components allow for independent integration of two different signals, and may thus provide a realistic solution to the credit assignment problem.
28
+
29
+ Thus we implement a network that learns to use feedback signals trained with reinforcement learning via a global reward signal. We mathematically analyze the model, and compare its capabilities to other methods for learning in ANNs. We prove consistency of the estimator in particular cases, extending the theory of synthetic gradient-like approaches (Jaderberg et al., 2016; Czarnecki et al., 2017b; Werbos, 1992; Schmidhuber, 1990). We demonstrate that our model learns as well as regular backpropagation in small models, overcomes the limitations of feedback alignment on more complicated feedforward networks, and can be used in convolutional networks. Thus, by combining local and global feedback signals, this method points to more plausible ways the brain could solve the credit assignment problem.
30
+
31
+ # 2 LEARNING FEEDBACK WEIGHTS THROUGH PERTURBATIONS
32
+
33
+ We use the following notation. Let $\mathbf { x } \in \mathbb { R } ^ { m }$ represent an input vector. Let an $N$ hidden-layer network be given by $\hat { \mathbf { y } } = f ( \mathbf { x } ) \in \mathbb { R } ^ { p }$ . This is composed of a set of layer-wise summation and non-linear activations
34
+
35
+ $$
36
+ \mathbf { h } ^ { i } = f ^ { i } ( \mathbf { h } ^ { i - 1 } ) = \sigma \left( W ^ { i } \mathbf { h } ^ { i - 1 } \right) ,
37
+ $$
38
+
39
+ for hidden layer states $\mathbf { h } ^ { i } \in \mathbb { R } ^ { n _ { i } }$ , non-linearity $\sigma$ , weight matrices $W ^ { i } \in \mathbb { R } ^ { n _ { i } \times n _ { i - 1 } }$ and denoting $\mathbf { h } ^ { 0 } = \mathbf { x }$ and $\mathbf { \dot { h } } ^ { N + 1 } = \hat { \mathbf { y } }$ . Some loss function $L$ is defined in terms of the network output: $L ( \mathbf { y } , { \hat { \mathbf { y } } } )$ . Let $\mathcal { L }$ denote the loss as a function of $( \mathbf { x } , \mathbf { y } ) \colon { \mathcal { L } } ( \mathbf { x } , \mathbf { y } ) = L ( \mathbf { y } , f ( \mathbf { x } ) )$ . Let data $( \mathbf { x } , \mathbf { y } ) \in \mathcal { D }$ be drawn from a distribution $\rho$ . We aim to minimize: $\mathbb { E } _ { \boldsymbol { \rho } } \left[ \mathcal { L } ( \mathbf { x } , \mathbf { y } ) \right]$ .
40
+
41
+ Backpropagation relies on the error signal $\mathbf { e } ^ { i }$ , computed in a top-down fashion:
42
+
43
+ $$
44
+ \mathbf { e } ^ { i } = \left\{ \begin{array} { l l } { \partial \mathcal { L } / \partial \hat { \mathbf { y } } \circ \boldsymbol { \sigma } ^ { \prime } ( W ^ { i } \mathbf { h } ^ { i - 1 } ) , } & { i = N + 1 ; } \\ { \left( ( W ^ { i + 1 } ) ^ { \mathsf { T } } \mathbf { e } ^ { i + 1 } \right) \circ \boldsymbol { \sigma } ^ { \prime } ( W ^ { i } \mathbf { h } ^ { i - 1 } ) , } & { 1 \leq i \leq N } \end{array} \right. ,
45
+ $$
46
+
47
+ where $\circ$ denotes element-wise multiplication.
48
+
49
+ ![](images/b6fd1279b4a5217931a6677802401c66635ac9297038941f4fe959795b45c0f7.jpg)
50
+ Figure 1: Learning feedback weights through perturbations. (A) Backpropagation sends error information from an output loss function, $\mathcal { L }$ , through each layer from top to bottom via the same matrices $W ^ { i }$ used in the feedforward network. (B) Node perturbation introduces noise in each layer, $\xi _ { i }$ , that perturbs that layer’s output and resulting loss function. The perturbed loss function, $\tilde { \mathcal { L } }$ , is correlated with the noise to give an estimate of the error current. This estimate is used to update feedback matrices $B ^ { i }$ to better approximate the error signal.
51
+
52
+ # 2.1 BASIC SETUP
53
+
54
+ Let the loss gradient term be denoted as
55
+
56
+ $$
57
+ \lambda ^ { i } = \frac { \partial \mathcal { L } } { \partial \mathbf { h } ^ { i } } = ( W ^ { i + 1 } ) ^ { \mathsf { T } } \mathbf { e } ^ { i + 1 } .
58
+ $$
59
+
60
+ In this work we replace $\lambda ^ { i }$ with an approximation with its own parameters to be learned (known as a synthetic gradient, or conspiring network, (Jaderberg et al., 2016; Czarnecki et al., 2017b), or error critic (Werbos, 1992)):
61
+
62
+ $$
63
+ \lambda ^ { i } \approx { \bf g } ( { \bf h } ^ { i } , \tilde { \bf e } ^ { i + 1 } ; \theta ) ,
64
+ $$
65
+
66
+ for parameters $\theta$ . Note that we must distinguish the true loss gradients from their synthetic estimates. Let $\mathbf { \tilde { e } } ^ { i }$ be loss gradients computed by backpropagating the synthetic gradients
67
+
68
+ $$
69
+ \begin{array} { r } { \tilde { \mathbf e } ^ { i } = \left\{ \begin{array} { l l } { \partial \mathcal { L } / \partial \hat { \mathbf y } \circ \sigma ^ { \prime } ( W ^ { i } \mathbf h ^ { i - 1 } ) , } & { i = N + 1 ; } \\ { \mathbf g ( \mathbf h ^ { i } , \tilde { \mathbf e } ^ { i + 1 } ; \theta ) \circ \sigma ^ { \prime } ( W ^ { i } \mathbf h ^ { i - 1 } ) , } & { 1 \leq i \leq N } \end{array} \right. . } \end{array}
70
+ $$
71
+
72
+ For the final layer the synthetic gradient matches the true gradient: $\mathbf e ^ { N + 1 } = \tilde { \mathbf e } ^ { N + 1 }$ . This setup can accommodate both top-down and bottom-up information, and encompasses a number of published models (Jaderberg et al., 2016; Czarnecki et al., 2017b; Lillicrap et al., 2016; Nøkland, 2016; Liao et al., 2016; Xiao et al., 2018).
73
+
74
+ # 2.2 STOCHASTIC NETWORKS AND GRADIENT DESCENT
75
+
76
+ To learn a synthetic gradient we utilze the stochasticity inherent to biological neural networks. A number of biologically plausible learning rules exploit random perturbations in neural activity (Xie & Seung, 2004; Seung, 2003; Fiete & Seung, 2006; Fiete et al., 2007; Song et al., 2017). Here, at each time each unit produces a noisy response:
77
+
78
+ $$
79
+ \mathbf { h } _ { t } ^ { i } = \sigma \left( \sum _ { k } W _ { \cdot k } ^ { i } \mathbf { h } _ { t } ^ { i - 1 } \right) + c _ { h } \boldsymbol { \xi } _ { t } ^ { i } ,
80
+ $$
81
+
82
+ for independent Gaussian noise $\xi ^ { i } \sim \nu = \mathcal { N } ( 0 , I )$ and standard deviation $c _ { h } > 0$ . This generates a noisy loss $\tilde { \mathcal { L } } ( { \bf x } , { \bf y } , \xi )$ and a baseline loss $\mathcal { L } ( \mathbf { x } , \mathbf { y } ) = \tilde { \mathcal { L } } ( \mathbf { x } , \mathbf { y } , 0 )$ . We will use the noisy response to estimate gradients that then allow us to optimize the baseline ${ \mathcal { L } } -$ the gradients used for weight updates are computed using the deterministic baseline.
83
+
84
+ # 2.3 SYNTHETIC GRADIENTS VIA PERTURBATION
85
+
86
+ For Gaussian white noise, the well-known REINFORCE algorithm (Williams, 1992) coincides with the node perturbation method (Fiete & Seung, 2006; Fiete et al., 2007). Node perturbation works by linearizing the loss:
87
+
88
+ $$
89
+ \tilde { \mathcal { L } } \approx \mathcal { L } + \frac { \partial \mathcal { L } } { \partial h _ { j } ^ { i } } c _ { h } \xi _ { j } ^ { i } ,
90
+ $$
91
+
92
+ such that
93
+
94
+ $$
95
+ \mathbb { E } \left( ( \tilde { \mathcal { L } } - \mathcal { L } ) c _ { h } \xi _ { j } ^ { i } | \mathbf x , \mathbf y \right) \approx c _ { h } ^ { 2 } \frac { \partial \mathcal { L } } { \partial h _ { j } ^ { i } } \bigg \rvert _ { \mathbf x , \mathbf y } ,
96
+ $$
97
+
98
+ with expectation taken over the noise distribution $\nu ( \xi )$ . This provides an estimator of the loss gradient
99
+
100
+ $$
101
+ \hat { \lambda } ^ { i } : = ( \tilde { \mathcal { L } } ( \mathbf x , \mathbf y , \boldsymbol \xi ) - \mathcal { L } ( \mathbf x , \mathbf y ) ) \frac { \xi ^ { i } } { c _ { h } } .
102
+ $$
103
+
104
+ This approximation is made more precise in Theorem 1 (Supplementary material).
105
+
106
+ # 2.4 TRAINING A FEEDBACK NETWORK
107
+
108
+ There are many possible sensible choices of $\mathbf { g } ( \cdot )$ . For example, taking $\mathbf { g }$ as simply a function of each layer’s activations: $\lambda ^ { i } = \mathbf { g } ( \mathbf { h } ^ { i } )$ is in fact sufficient parameterization to express the true gradient function (Jaderberg et al., 2016). We may expect, however, that the gradient estimation problem be simpler if each layer is provided with some error information obtained from the loss function and propagated in a top-down fashion. Symmetric feedback weights may not be biologically plausible, and random fixed weights may only solve certain problems of limited size or complexity (Lillicrap et al., 2016). However, a system that can learn to appropriate feedback weights $B$ may be able to align the feedforward and feedback weights as much as is needed to successfully learn.
109
+
110
+ We investigate various choices of $\mathbf { g } ( \mathbf { h } ^ { i } , \tilde { \mathbf { e } } ^ { i + 1 } ; B ^ { i + 1 } )$ outlined in the applications below. Parameters $B ^ { i + 1 }$ are estimated by solving the least squares problem:
111
+
112
+ $$
113
+ \hat { B } ^ { i + 1 } = \underset { B } { \arg \operatorname* { m i n } } \mathbb { E } \left\| \mathbf { g } ( \mathbf { h } ^ { i } , \tilde { \mathbf { e } } ^ { i + 1 } ; B ) - \hat { \lambda } ^ { i } \right\| _ { 2 } ^ { 2 } .
114
+ $$
115
+
116
+ Unless otherwise noted this was solved by gradient-descent, updating parameters once with each minibatch. Refer to the supplementary material for additional experimental descriptions and parameters.
117
+
118
+ # 3 THEORETICAL RESULTS
119
+
120
+ We can prove the estimator (3) is consistent as the noise variance $c _ { h } \ \ 0$ , in some particular cases. We state the results informally here, and give the exact details in the supplementary materials. Consider first convergence of the final layer feedback matrix, $B ^ { N + 1 }$ .
121
+
122
+ Theorem 1. (Informal) For ${ \bf g } _ { F A } ( { \bf h } ^ { i } , \tilde { { \bf e } } ^ { i + 1 } ; B ^ { i + 1 } ) = B ^ { i + 1 } \tilde { { \bf e } } ^ { i + 1 }$ , then the least squares estimator
123
+
124
+ $$
125
+ ( \hat { B } ^ { N + 1 } ) ^ { \top } : = \hat { \lambda } ^ { N } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } \left( \mathbf { e } ^ { N + 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } \right) ^ { - 1 } ,
126
+ $$
127
+
128
+ solves (3) and converges to the true feedback matrix, in the sense that: $\begin{array} { r } { \operatorname* { l i m } _ { c _ { h } 0 } { \mathrm { p l i m } _ { T \infty } \hat { B } ^ { N + 1 } } = } \end{array}$ $W ^ { N + 1 }$ , where plim indicates convergence in probability.
129
+
130
+ Theorem 1 thus establishes convergence of $B$ in a shallow (1 hidden layer) non-linear network. In a deep, linear network we can also use Theorem 1 to establish convergence over the rest of the layers.
131
+
132
+ Theorem 2. (Informal) For ${ \bf g } _ { F A } ( { \bf h } ^ { i } , \tilde { \bf e } ^ { i + 1 } ; B ^ { i + 1 } ) = B ^ { i + 1 } \tilde { \bf e } ^ { i + 1 }$ and $\sigma ( x ) = x$ , the least squares estimator
133
+
134
+ $$
135
+ ( \hat { B } ^ { i } ) ^ { \mathsf { T } } : = \hat { \lambda } ^ { i - 1 } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \mathsf { T } } \left( \tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \mathsf { T } } \right) ^ { - 1 } \qquad 1 \leq i \leq N + 1 ,
136
+ $$
137
+
138
+ solves (3) and converges to the true feedback matrix, in the sense that: $\begin{array} { r } { \operatorname* { l i m } _ { c _ { h } 0 } { \mathrm { p l i m } _ { T \infty } \hat { B } ^ { i } } = } \end{array}$ $W ^ { i } , \qquad 1 \leq i \leq N + 1$ .
139
+
140
+ ![](images/eb163218179efc125d73dbe10239176d1ffcb659abf5f7a8294d641cd8806257.jpg)
141
+ Figure 2: Node perturbation in small 4-layer network (784-50-20-10 neurons), for varying noise levels $c$ , compared to feedback alignment and backpropagation. (A) Relative error between feedforward and feedback matrix. (B) Angle between true gradient and synthetic gradient estimate for each layer. (C) Percentage of signs in $\hat W ^ { i }$ and $B ^ { i }$ that are in agreement. (D) Test error for node perturbation, backpropagation and feedback alignment. Curves show mean plus/minus standard error over 5 runs.
142
+
143
+ Given these results we can establish consistency for the ‘direct feedback alignment’ (DFA; Nøkland (2016)) estimator: ${ \bf g } _ { D F A } ( { \bf h } ^ { i } , \tilde { \bf e } ^ { N + 1 } ; B ^ { i + 1 } ) = ( B ^ { i + 1 } ) ^ { \top } \tilde { \bf e } ^ { N + 1 }$ . Theorem 1 applies trivially since for the final layer, the two approximations have the same form: $\mathbf { g } _ { F A } ( \mathbf { h } ^ { N } , \tilde { \mathbf { e } } ^ { N \dagger 1 } ; \theta _ { N } ) =$ $\mathbf { g } _ { D F A } ( \mathbf { h } ^ { N } , \tilde { \mathbf { e } } ^ { N + 1 } ; \boldsymbol { \theta } _ { N } )$ . Theorem 2 can be easily extended according to the following:
144
+
145
+ Corollary 1. (Informal) Fo $r { \bf g } _ { D F A } ( { \bf h } ^ { i } , \tilde { \bf e } ^ { N + 1 } ; B ^ { i + 1 } ) = B ^ { i + 1 } \tilde { \bf e } ^ { N + 1 }$ and $\sigma ( x ) = x$ , the least squares estimator
146
+
147
+ $$
148
+ ( \hat { B } ^ { i } ) ^ { \mathsf { T } } : = \hat { \lambda } ^ { i - 1 } ( \tilde { \mathbf { e } } ^ { N + 1 } ) ^ { \mathsf { T } } \left( \tilde { \mathbf { e } } ^ { N + 1 } ( \tilde { \mathbf { e } } ^ { N + 1 } ) ^ { \mathsf { T } } \right) ^ { - 1 } \qquad 1 \leq n \leq N + 1 ,
149
+ $$
150
+
151
+ solves (3) and converges to the true feedback matrix, in the sense that: $\begin{array} { r } { \operatorname* { l i m } _ { c _ { h } 0 } { \mathrm { p l i m } _ { T \infty } \hat { B } ^ { i } } = } \end{array}$ $\begin{array} { r } { \prod _ { j = N + 1 } ^ { i } W ^ { j } , \qquad 1 \leq i \leq N + 1 . } \end{array}$ .
152
+
153
+ Thus for a non-linear shallow network or a deep linear network, for both $g _ { F A }$ and $g _ { D F A }$ , we have the result that, for sufficiently small $c _ { h }$ , if we fix the network weights $W$ and train $B$ through node perturbation then we converge to $W$ . Validation that the method learns to approximate $W$ , for fixed $W$ , is provided in the supplementary material. In practice, we update $B$ and $W$ simultaneously. Some convergence theory is established for this case in (Jaderberg et al., 2016; Czarnecki et al., 2017b).
154
+
155
+ # 4 APPLICATIONS
156
+
157
+ # 4.1 FULLY CONNECTED NETWORKS SOLVING MNIST
158
+
159
+ First we investigate $\mathbf { g } ( \mathbf { h } ^ { i } , \tilde { \mathbf { e } } ^ { i + 1 } ; B ^ { i + 1 } ) = ( B ^ { i + 1 } ) ^ { \mathsf { T } } \tilde { \mathbf { e } } ^ { i + 1 }$ , which describes a non-symmetric feedback network (Figure 1). To demonstrate the method can be used to solve simple supervised learning problems we use node perturbation with a four-layer network and MSE loss to solve MNIST (Figure 2). Updates to $W ^ { i }$ are made using the synthetic gradients $\Delta W ^ { i } = \eta \tilde { \mathbf e } ^ { i } \mathbf h ^ { i - 1 }$ , for learning rate $\eta$ . The feedback network needs to co-adapt with the feedforward network in order to continue to provide a useful error signal. We observed that the system is able to adjust to provide a close correspondence between the feedforward and feedback matrices in both layers of the network (Figure 2A). The relative error between $B ^ { i }$ and $W ^ { i }$ is lower than what is observed for feedback alignment, suggesting that this co-adaptation of both $W ^ { i }$ and $B ^ { i }$ is indeed beneficial. The relative error depends on the amount of noise used in node perturbation – lower variance doesn’t necessarily imply the lowest error between $W$ and $B$ , suggesting there is an optimal noise level that balances bias in the estimate and the ability to co-adapt to the changing feedforward weights.1
160
+
161
+ ![](images/af8281d7dfdbe08df538bc576ae1abf0fb44079866f732ccac3f1ff4cadd9cce.jpg)
162
+ Figure 3: Results with five-layer MNIST autoencoder network. (A) Mean loss plus/minus standard error over 10 runs. Dashed lines represent training loss, solid lines represent test loss. (B) Latent space activations, colored by input label for each method. (C) Sample outputs for each method.
163
+
164
+ Consistent with the low relative error in both layers, we observe that the alignment (the angle between the estimated gradient and the true gradient – proportional to $\mathbf { e } ^ { \mathsf { T } } W B ^ { \mathsf { T } } \bar { \tilde { \mathbf { e } } } )$ is low in each layer – much lower for node perturbation than for feedback alignment, again suggesting that the method is much better at communicating error signals between layers (Figure 2B). In fact, recent studies have shown that sign congruence of the feedforward and feedback matrices is all that is required to achieve good performance (Liao et al., 2016; Xiao et al., 2018). Here the sign congruence is also higher in node perturbation, again depending somewhat the variance. The amount of congruence is comparable between layers (Figure 2C). Finally, the learning performance of node perturbation is comparable to backpropagation (Figure 2D), and better than feedback alignment in this case, though not by much. Note that by setting the feedback learning rate to zero, we recover the feedback alignment algorithm. So we should expect to be always able to do at least as well as feedback alignment. These results instead highlight the qualitative differences between the methods, and suggest that node perturbation for learning feedback weights can be used to approximate gradients in deep networks.
165
+
166
+ # 4.2 AUTO-ENCODING MNIST
167
+
168
+ The above results demonstrate node perturbation provides error signals closely aligned with the true gradients. However, performance-wise they do not demonstrate any clear advantage over feedback alignment or backpropagation. A known shortcoming of feedback alignment is in very deep networks and in autoencoding networks with tight bottleneck layers (Lillicrap et al., 2016). To see if node perturbation has the same shortcoming, we test performance of a $\mathbf { g } ( \mathbf { h } ^ { i } , \tilde { \mathbf { e } } ^ { i + 1 } ; B ^ { i + 1 } ) =$ $( B ^ { i + 1 } ) ^ { \mathsf { T } } \tilde { \mathbf { e } } ^ { i + \mathsf { \bar { 1 } } }$ model on a simple auto-encoding network with MNIST input data (size 784-200-2- 200-784). In this more challenging case we also compare the method to the ‘matching’ learning rule (Rombouts et al., 2015; Martinolli et al., 2018), in which updates to $B$ match updates to $W$ and weight decay is added, a denoising autoencoder (DAE) (Vincent et al., 2008), and the ADAM (Kingma & Ba, 2015) optimizer (with backprop gradients).
169
+
170
+ As expected, feedback alignment performs poorly, while node perturbation performs better than backpropagation (Figure 3A). The increased performance relative to backpropagation may seem surprising. A possible reason is the addition of noise in our method encourages learning of more robust latent factors (Alain & Bengio, 2015). The DAE also improves the loss over vanilla backpropagation (Figure 3A). And, in line with these ideas, the latent space learnt by node perturbation shows a more uniform separation between the digits, compared to the networks trained by backpropagation. Feedback alignment, in contrast, does not learn to separate digits in the bottleneck layer at all (Figure 3B), resulting in scrambled output (Figure 3C). The matched learning rule performs similarly to backpropagation. These possible explanations are investigated more below. Regardless, these results show that node perturbation is able to successfully communicate error signals through thin layers of a network as needed.
171
+
172
+ # 4.3 CONVOLUTIONAL NEURAL NETWORKS SOLVING CIFAR
173
+
174
+ Convolutional networks are another known shortcoming of feedback alignment. Here we test the method on a convolutional neural network (CNN) solving CIFAR (Krizhevsky, 2009). Refer to the supplementary material for architecture and parameter details. For this network we learn feedback weights direct from the output layer to each earlier layer: $\mathbf { g } ( \mathbf { h } ^ { i } , \tilde { \mathbf { e } } ^ { i + 1 } ; B ^ { i + 1 } ) = ( B ^ { i + 1 } ) ^ { \mathsf { T } } \tilde { \mathbf { e } } ^ { N + 1 }$ (similar to ‘direct feedback alignment’ (Nøkland, 2016)). Here this was solved by gradient-descent. On CIFAR10 we obtain a test accuracy of $7 5 \%$ . When compared with fixed feedback weights and backpropagation, we see it is advantageous to learn feedback weights on CIFAR10 and marginally advantageous on CIFAR100 (Table 1). This shows the method can be used in a CNN, and can solve challenging computer vision problems without weight transport.
175
+
176
+ Table 1: Mean test accuracy of CNN over 5 runs trained with backpropagation, node perturbation and direct feedback alignment (DFA) (Nøkland, 2016; Crafton et al., 2019).
177
+
178
+ <table><tr><td>dataset</td><td>backpropagation</td><td>node perturbation</td><td>DFA</td></tr><tr><td>CIFAR10</td><td>76.9±0.1</td><td>74.8±0.2</td><td>72.4±0.2</td></tr><tr><td>CIFAR100</td><td>51.2±0.1</td><td>48.1±0.2</td><td>47.3±0.1</td></tr></table>
179
+
180
+ # 4.4 WHAT IS HELPING, NOISY ACTIVATIONS OR APPROXIMATING THE GRADIENT?
181
+
182
+ To solve the credit assignment problem, our method utilizes two well-explored strategies in deep learning: adding noise (generally used to regularize (Bengio et al., 2013; Gulcehre et al., 2016; Neelakantan et al., 2015; Bishop, 1995)), and approximating the true gradients (Jaderberg et al., 2016). To determine which of these features are responsible for the improvement in performance over fixed weights, in the autoencoding and CIFAR10 cases, we study the performance while varying where noise is added to the models (Table 2). Noise can be added to the activations (BP and FA w. noise, Table 2), or to the inputs, as in a denoising autoencoder (DAE, Table 2). Or, noise can be used only in obtaining an estimator of the true gradients (as in our method; NP, Table 2). For comparison, a noiseless version of our method must instead assume access to the true gradients, and use this to learn feedback weights (i.e. synthetic gradients (Jaderberg et al., 2016); SG, Table 2). Each of these models is tested on the autoencoding and CIFAR10 tasks, allowing us to better understand the performance of the node perturbation method.
183
+
184
+ Table 2: Mean loss (plus/minus standard error) on autoencoding MNIST task (left) and mean accuracy on CIFAR10 task (right). Shaded cells indicate methods which do not use weight transport or exact gradient supervision. Best performance indicated in boldface. Implementation details of each method is provided in the supplementary material.
185
+ (a) MNIST autoencoder
186
+ (b) CIFAR10 classification
187
+
188
+ <table><tr><td>method</td><td>noise</td><td>no noise</td><td>method</td><td>noise</td><td>no noise</td></tr><tr><td>BP(SGD)</td><td>536.8±2.1</td><td>609.8±14.4</td><td rowspan="3">BP DFA</td><td>76.8±0.2</td><td>76.9±0.1</td></tr><tr><td>BP(ADAM)</td><td>522.3±0.4</td><td>533.3±2.2</td><td>72.4±0.2</td><td>72.3±0.1</td></tr><tr><td>FA</td><td>768.2±2.7</td><td>759.1±3.3 NP (ours)</td><td>74.8±0.2</td><td>75.3±0.3</td></tr><tr><td>DAE</td><td>539.8±4.9</td><td></td><td colspan="3">SG 一</td></tr><tr><td>NP (ours)</td><td> 515.3±4.1</td><td></td><td colspan="3"></td></tr><tr><td>SG</td><td></td><td>521.6±2.3</td><td colspan="3"></td></tr><tr><td>Matched</td><td>629.9±1.1</td><td>615.0±0.4</td><td colspan="3"></td></tr></table>
189
+
190
+ In the autoencoding task, both noise (either in the inputs or the activations) and using an approximator to the gradient improve performance (Table 2, left). Noise benefits performance for both SGD optimization and ADAM (Kingma & Ba, 2015). In fact in this task, the combination of both of these factors (i.e. our method) results in better performance over either alone. Yet, the addition of noise to the activations does not help feedback alignment. This suggests that our method is indeed learning useful approximations of the error signals, and is not merely improving due to the addition of noise to the system. In the CIFAR10 task (Table 2, right), the addition of noise to the activations has minimal effect on performance, while having access to the true gradients (SG) does result in improved performance over fixed feedback weights. Thus in these tasks it appears that noise does not always help, but using a less-based gradient estimator does, and noisy activations are one way of obtaining an unbiased gradient estimator. Our method also is the best performing method that does not require either weight transport or access to the true gradients as a supervisory signal.
191
+
192
+ # 5 DISCUSSION
193
+
194
+ Here we implement a perturbation-based synthetic gradient method to train neural networks. We show that this hybrid approach can be used in both fully connected and convolutional networks. By removing the symmetric feedforward/feedback weight requirement imposed by backpropagation, this approach is a step towards more biologically-plausible deep learning. By reaching comparable performance to backpropagation on MNIST, the method is able to solve larger problems than perturbation-only methods (Xie & Seung, 2004; Fiete et al., 2007; Werfel et al., 2005). By working in cases that feedback alignment fails, the method can provide learning without weight transport in a more diverse set of network architectures. We thus believe the idea of integrating both local and global feedback signals is a promising direction towards biologically plausible learning algorithms.
195
+
196
+ Of course, the method does not solve all issues with implementing gradient-based learning in a biologically plausible manner. For instance, in the current implementation, the forward and the backwards passes are locked. Here we just focus on the weight transport problem. A current drawback is that the method does not reach state-of-the-art performance on more challenging datasets like CIFAR. We focused on demonstrating that it is advantageous to learn feedback weights, when compared with fixed weights, and successfully did so in a number of cases. However, we did not use any additional data augmentation and regularization methods often employed to reach state-ofthe-art performance. Thus fully characterizing the performance of this method remains important future work. The method also does not tackle the temporal credit assignment problem, which has also seen recent progress in biologically plausible implementation Ororbia et al. (2019b;a).
197
+
198
+ However the method does has a number of computational advantages. First, without weight transport the method has better data-movement performance (Crafton et al., 2019; Akrout et al., 2019), meaning it may be more efficiently implemented than backpropagation on specialized hardware. Second, by relying on random perturbations to measure gradients, the method does not rely on the environment to provide gradients (compared with e.g. Czarnecki et al. (2017a); Jaderberg et al. (2016)). Our theoretical results are somewhat similar to that of Alain & Bengio (2015), who demonstrate that a denoising autoencoder converges to the unperturbed solution as Gaussian noise goes to zero. However our results apply to subgaussian noise more generally.
199
+
200
+ While previous research has provided some insight and theory for how feedback alignment works (Lillicrap et al., 2016; Ororbia et al., 2018; Moskovitz et al., 2018; Bartunov et al., 2018; Baldi et al., 2018) the effect remains somewhat mysterious, and not applicable in some network architectures. Recent studies have shown that some of these weaknesses can be addressed by instead imposing sign congruent feedforward and feedback matrices (Xiao et al., 2018). Yet what mechanism may produce congruence in biological networks is unknown. Here we show that the shortcomings of feedback alignment can be addressed in another way: the system can learn to adjust weights as needed to provide a useful error signal. Our work is closely related to Akrout et al. (2019), which also uses perturbations to learn feedback weights. However our approach does not divide learning into two phases, and training of the feedback weights does not occur in a layer-wise fashion, assuming only one layer is noisy at a time, which is a strong assumption. Here instead we focus on combining global and local learning signals.
201
+
202
+ Here we tested our method in an idealized setting. However the method is consistent with neurobiology in two important ways. First, it involves separate learning of feedforward and feedback weights. This is possible in cortical networks, where complex feedback connections exist between layers (Lacefield et al., 2019; Richards & Lillicrap, 2019) and pyramidal cells have apical and basal compartments that allow for separate integration of feedback and feedforward signals (Guerguiev et al., 2017; Kording & K ¨ onig, 2001). A recent finding that apical dendrites receive reward informa- ¨ tion is particularly interesting (Lacefield et al., 2019). Models like Guerguiev et al. (2017) show how the ideas in this paper may be implemented in spiking neural networks. We believe such models can be augmented with a perturbation-based rule like ours to provide a better learning system.
203
+
204
+ The second feature is that perturbations are used to learn the feedback weights. How can a neuron measure these perturbations? There are many plausible mechanisms (Seung, 2003; Xie & Seung, 2004; Fiete & Seung, 2006; Fiete et al., 2007). For instance, birdsong learning uses empiric synapses from area LMAN (Fiete et al., 2007), others proposed it is approximated (Legenstein et al., 2010; Hoerzer et al., 2014), or neurons could use a learning rule that does not require knowing the noise (Lansdell & Kording, 2018). Further, our model involves the subtraction of a baseline loss to reduce the variance of the estimator. This does not affect the expected value of the estimator – technically the baseline could be removed or replaced with an approximation (Legenstein et al., 2010; Loewenstein & Seung, 2006). Thus both separation of feedforward and feedback systems and perturbation-based estimators can be implemented by neurons.
205
+
206
+ As RL-based methods do not scale by themselves, and exact gradient signals are infeasible, the brain may well use a feedback system trained through reinforcement signals to usefully approximate gradients. There is a large space of plausible learning rules that can learn to use feedback signals in order to more efficiently learn, and these promise to inform both models of learning in the brain and learning algorithms in artificial networks. Here we take an early step in this direction.
207
+
208
+ # REFERENCES
209
+
210
+ Mohamed Akrout, Collin Wilson, Peter C Humphreys, Timothy Lillicrap, and Douglas Tweed. Deep Learning without Weight Transport. ArXiv e-prints, 2019.
211
+
212
+ Guillaume Alain and Yoshua Bengio. What regularized auto-encoders learn from the data-generating distribution. Journal of Machine Learning Research, 15:3563–3593, 2015. ISSN 15337928.
213
+
214
+ Pierre Baldi, Peter Sadowski, and Zhiqin Lu. Learning in the Machine: Random Backpropagation and the Deep Learning Channel. Artificial Intelligence, 260:1–35, 2018. ISSN 00043702. doi: 10.1016/j.artint.2018.03.003. URL http://arxiv.org/abs/1612.02734.
215
+
216
+ Sergey Bartunov, Adam Santoro, Blake Richard, Geoffrey Hinton, and Timothy Lillicrap. Assessing the scalability of biologically-motivated deep learning algorithms and architectures. ArXiv eprints, 2018. ISSN 18979483. doi: 10.20452/pamw.3281.
217
+
218
+ Yoshua Bengio, Li Yao, Guillaume Alain, and Pascal Vincent. Generalized denoising auto-encoders as generative models. Advances in Neural Information Processing Systems, pp. 1–9, 2013. ISSN 10495258.
219
+
220
+ Chris M. Bishop. Training with Noise is Equivalent to Tikhonov Regularization. Neural Computation, 7(1):108–116, 1995. ISSN 0899-7667. doi: 10.1162/neco.1995.7.1.108.
221
+
222
+ Guy Bouvier, Claudia Clopath, Celian Bimbard, Jean-Pierre Nadal, Nicolas Brunel, Vincent Hakim, ´ and Boris Barbour. Cerebellar learning using perturbations. bioRxiv, pp. 053785, 2016. doi: 10.1101/053785. URL http://biorxiv.org/lookup/doi/10.1101/053785.
223
+
224
+ Brian Crafton, Abhinav Parihar, Evan Gebhardt, and Arijit Raychowdhury. Direct Feedback Alignment with Sparse Connections for Local Learning. ArXiv e-prints, pp. 1–13, 2019.
225
+
226
+ Wojciech M. Czarnecki, Simon Osindero, Max Jaderberg, Grzegorz Swirszcz, and Razvan Pascanu. Sobolev training for neural networks. 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. 4278–4287. Curran Associates, Inc., 2017a. URL http://papers.nips. cc/paper/7015-sobolev-training-for-neural-networks.pdf.
227
+
228
+ Wojciech Marian Czarnecki, Grzegorz Swirszcz, Max Jaderberg, Simon Osindero, Oriol Vinyals, ´ and Koray Kavukcuoglu. Understanding Synthetic Gradients and Decoupled Neural Interfaces. ArXiv e-prints, 2017b. ISSN 1938-7228. URL http://arxiv.org/abs/1703.00522.
229
+
230
+ Ila R Fiete and H Sebastian Seung. Gradient learning in spiking neural networks by dynamic perturbation of conductances. Physical Review Letters, 97, 2006. doi: 10.1103/PhysRevLett.97.048104.
231
+
232
+ Ila R Fiete, Michale S Fee, and H Sebastian Seung. Model of Birdsong Learning Based on Gradient Estimation by Dynamic Perturbation of Neural Conductances. Journal of neurophysiology, 98: 2038–2057, 2007. doi: 10.1152/jn.01311.2006.
233
+
234
+ Stephen Grossberg. Competitive learning: From interactive activation to adaptive resonance. Cognitive Science, 11(1):23 – 63, 1987. ISSN 0364-0213. doi: https://doi.org/ 10.1016/S0364-0213(87)80025-3. URL http://www.sciencedirect.com/science/ article/pii/S0364021387800253.
235
+
236
+ Jordan Guergiuev, Timothy P. Lillicrap, and Blake A. Richards. Towards deep learning with segregated dendrites. eLife, 6:1–37, 2017. ISSN 2050-084X. doi: 10.7554/eLife.22901. URL http://arxiv.org/abs/1610.00161.
237
+
238
+ Jordan Guerguiev, Timothy P Lillicrap, and Blake A Richards. Towards deep learning with segregated dendrites. Elife, 6, December 2017.
239
+
240
+ Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. 33rd International Conference on Machine Learning, ICML 2016, 6:4457–4466, 2016.
241
+
242
+ H A Haenssle, C Fink, R Schneiderbauer, F Toberer, T Buhl, A Blum, A Kalloo, A Ben Hadj Hassen, L Thomas, A Enk, L Uhlmann, and Reader study level-I and level-II Groups. Man against machine: diagnostic performance of a deep learning convolutional neural network for dermoscopic melanoma recognition in comparison to 58 dermatologists. Ann. Oncol., 29(8): 1836–1842, August 2018.
243
+
244
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing Human-Level performance on ImageNet classification. In 2015 IEEE International Conference on Computer Vision (ICCV), 2015.
245
+
246
+ Gregor M. Hoerzer, Robert Legenstein, and Wolfgang Maass. Emergence of complex computational structures from chaotic neural networks through reward-modulated hebbian learning. Cerebral Cortex, 24(3):677–690, 2014. ISSN 10473211. doi: 10.1093/cercor/bhs348.
247
+
248
+ Max Jaderberg, Wojciech Marian Czarnecki, Simon Osindero, Oriol Vinyals, Alex Graves, David Silver, and Koray Kavukcuoglu. Decoupled Neural Interfaces using Synthetic Gradients. ArXiv e-prints, 1, 2016. ISSN 1938-7228. URL http://arxiv.org/abs/1608.05343.
249
+
250
+ Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. ICLR 2015, pp. 1–15, 2015. ISSN 09252312. doi: http://doi.acm.org.ezproxy.lib.ucf.edu/10.1145/1830483. 1830503. URL http://arxiv.org/abs/1412.6980.
251
+
252
+ Konrad Kording and Peter Konig. Supervised and Unsupervised Learning with Two Sites of Synaptic Integration. Journal of Computational Neuroscience, 11:207–215, 2001.
253
+
254
+ Konrad P Kording and Peter K ¨ onig. Supervised and unsupervised learning with two sites of synaptic ¨ integration. Journal of computational neuroscience, 11(3):207–215, 2001.
255
+
256
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009. ISSN 00012475.
257
+
258
+ Clay O Lacefield, Eftychios A Pnevmatikakis, Liam Paninski, and Randy M Bruno. Reinforcement Learning Recruits Somata and Apical Dendrites across Layers of Primary Sensory Cortex. Cell Reports, 26(8):2000–2008.e2, 2019. ISSN 2211-1247. doi: 10.1016/j.celrep.2019.01.093. URL https://doi.org/10.1016/j.celrep.2019.01.093.
259
+
260
+ Benjamin James Lansdell and Konrad Paul Kording. Spiking allows neurons to estimate their causal effect. bioRxiv, pp. 1–19, 2018.
261
+
262
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, May 2015.
263
+
264
+ Dong Hyun Lee, Saizheng Zhang, Asja Fischer, and Yoshua Bengio. Difference target propagation. Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 9284:498–515, 2015. ISSN 16113349. doi: 10.1007/ 978-3-319-23528-8 31.
265
+
266
+ Robert Legenstein, Steven M. Chase, Andrew B. Schwartz, Wolfgang Maas, and W. Maass. A Reward-Modulated Hebbian Learning Rule Can Explain Experimentally Observed Network Reorganization in a Brain Control Task. Journal of Neuroscience, 30(25):8400–8410, 2010. ISSN 0270-6474. doi: 10.1523/JNEUROSCI.4284-09.2010. URL http://www.jneurosci. org/cgi/doi/10.1523/JNEUROSCI.4284-09.2010.
267
+
268
+ Qianli Liao, Joel Z. Leibo, and Tomaso Poggio. How Important is Weight Symmetry in Backpropagation? AAAI, 1, 2016. URL http://arxiv.org/abs/1510.05067.
269
+
270
+ Timothy P Lillicrap, Daniel Cownden, Douglas B Tweed, and Colin J Akerman. Random feedback weights support learning in deep neural networks. Nature Communications, 7:13276, 2016. ISSN 2041-1723. doi: 10.1038/ncomms13276. URL http://dx.doi.org/10.1038/ ncomms13276http://www.nature.com/doifinder/10.1038/ncomms13276.
271
+
272
+ Seppo Linnainmaa. Taylor expansion of the accumulated rounding error. BIT., 16(2):146,160, 1976. ISSN 0006-3835.
273
+
274
+ Y. Loewenstein and H. S. Seung. Operant matching is a generic outcome of synaptic plasticity based on the covariance between reward and neural activity. Proceedings of the National Academy of Sciences, 103(41):15224–15229, 2006. ISSN 0027-8424. doi: 10.1073/pnas.0505220103. URL http://www.pnas.org/cgi/doi/10.1073/pnas.0505220103.
275
+
276
+ David Marr. A theory of cerebellar cortex. J. Physiol, 202:437–470, 1969. ISSN 0022-3751. doi: 10.2307/1776957.
277
+
278
+ Marco Martinolli, Wulfram Gerstner, and Aditya Gilra. Multi-Timescale Memory Dynamics Extend Task Repertoire in a Reinforcement Learning Network With Attention-Gated Memory. Front. Comput. Neurosci. . . . , 12(July):1–15, 2018. doi: 10.3389/fncom.2018.00050.
279
+
280
+ Thomas Miconi. Biologically plausible learning in recurrent neural networks reproduces neural dynamics observed during cognitive tasks. eLife, 6:1–24, 2017. ISSN 2050084X. doi: 10.7554/ eLife.20899.
281
+
282
+ Thomas Miconi, Jeff Clune, and Kenneth O. Stanley. Differentiable plasticity: training plastic neural networks with backpropagation. ArXiv e-prints, 2018. ISSN 1938-7228. doi: arXiv: 1804.02464v2. URL http://arxiv.org/abs/1804.02464.
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, 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.
285
+
286
+ Theodore H. Moskovitz, Ashok Litwin-kumar, and L.f. Abbott. Feedback alignment in deep convolutional networks. arXiv Neural and Evolutionary Computing, pp. 1–10, 2018. doi: arXiv:1812.06488v1. URL http://arxiv.org/abs/1812.06488.
287
+
288
+ Arvind Neelakantan, Luke Vilnis, Quoc V. Le, Ilya Sutskever, Lukasz Kaiser, Karol Kurach, and James Martens. Adding Gradient Noise Improves Learning for Very Deep Networks. pp. 1–11, 2015. URL http://arxiv.org/abs/1511.06807.
289
+
290
+ Arild Nøkland. Direct Feedback Alignment Provides Learning in Deep Neural Networks. Advances in neural information processing systems, 2016.
291
+
292
+ Alexander Ororbia, Ankur Mali, C. Lee Giles, and Daniel Kifer. Continual Learning of Recurrent Neural Networks by Locally Aligning Distributed Representations. IEEE Transactions on Neural Networks and Learning Systems, pp. 1–13, 2019a. URL http://arxiv.org/abs/1810. 07411.
293
+
294
+ Alexander Ororbia, Ankur Mali, Daniel Kifer, and C. Lee Giles. Lifelong Neural Predictive Coding: Sparsity Yields Less Forgetting when Learning Cumulatively. Arxiv e-prints, pp. 1–11, 2019b. URL http://arxiv.org/abs/1905.10696.
295
+
296
+ Alexander G. Ororbia, Ankur Mali, Daniel Kifer, and C. Lee Giles. Conducting Credit Assignment by Aligning Local Representations. ArXiv e-prints, pp. 1–27, 2018. URL http://arxiv. org/abs/1803.01834.
297
+
298
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. Proceedings of the 31st International Conference on Machine Learning, PMLR, 32(2):1278–1286, 2014. ISSN 10495258. doi: 10.1051/0004-6361/201527329. URL http://arxiv.org/abs/1401.4082.
299
+
300
+ Blake A Richards and Timothy P Lillicrap. Dendritic solutions to the credit assignment problem. Current Opinion in Neurobiology, 54:28–36, 2019. ISSN 0959-4388. doi: 10.1016/j.conb.2018. 08.003. URL https://doi.org/10.1016/j.conb.2018.08.003.
301
+
302
+ Jaldert O Rombouts, Sander M Bohte, and Pieter R Roelfsema. How Attention Can Create Synaptic Tags for the Learning of Working Memories in Sequential Tasks. PLoS Computational Biology, 11(3):1–34, 2015. ISSN 15537358. doi: 10.1371/journal.pcbi.1004060.
303
+
304
+ David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by backpropagating errors. Nature, 323(9):533–536, 1986. URL http://books.google.com/ books?hl $=$ en{&} $\mathtt { l r } = \{ \ \& \ \}$ id $\underline { { \underline { { \mathbf { \Pi } } } } }$ FJblV{_}iOPjIC{&}oi $=$ fnd{&}pg $=$ PA213{&}dq= Learning $^ +$ representations+by+back-propagating+errors{&}ots $=$ zYGs8pD1WO{&}sig $=$ VeKSS{_}{_}6gXxof0BSZeCJhRDIdwg.
305
+
306
+ 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. Int. J. Comput. Vis., 115(3):211–252, 2015.
307
+
308
+ Benjamin Scellier and Yoshua Bengio. Equilibrium Propagation: Bridging the Gap Between Energy-Based Models and Backpropagation. arXiv, 11(1987):1–13, 2016. ISSN 1662-5188. doi: 10.3389/fncom.2017.00024. URL http://arxiv.org/abs/1602.05179.
309
+
310
+ Jurgen Schmidhuber. Networks Adjusting Networks. In ¨ Proceedings of ‘Distributed Adaptive Neural Information Processing’, St.Augustin, pp. 24–25. Oldenbourg, 1990.
311
+
312
+ Sebastian Seung. Learning in Spiking Neural Networks by Reinforcement of Stochastics Transmission. Neuron, 40:1063–1073, 2003. URL papers2://publication/uuid/ 5D6B29BF-1380-4D78-A152-AF8F233DE7F9.
313
+
314
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of go without human knowledge. Nature, 550(7676):354–359, October 2017.
315
+
316
+ H Francis Song, Guangyu R Yang, and Xiao Jing Wang. Reward-based training of recurrent neural networks for cognitive and value-based tasks. eLife, 6:1–24, 2017. ISSN 2050084X. doi: 10. 7554/eLife.21492.
317
+
318
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Mazagol. Extracting and composing robust features with denoising autoencoders. ICML 2008, 2008.
319
+
320
+ Paul Werbos. Applications of advances in nonlinear sensitivity analysis. Springer, Berlin, 1982.
321
+
322
+ Paul Werbos. Approximate dynamic programming for real-time control and neural modeling. In Handbook of Intelligent Control: Neural, Fuzzy and Adaptive Approaches, chapter 13. Multiscience Press, Inc., New York, 1992.
323
+
324
+ Justin Werfel, Xiaohui Xie, and H. Sebastian Seung. Learning Curves for Stochastic Gradient Descent in Linear Feedforward Networks. Neural Computation, 17(12):2699–2718, 2005. ISSN 0899-7667. doi: 10.1162/089976605774320539. URL http://www.mitpressjournals. org/doi/10.1162/089976605774320539.
325
+
326
+ Ronald Williams. Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning. Machine Learning, 8:299–256, 1992.
327
+
328
+ Will Xiao, Honglin Chen, Qianli Liao, and Tomaso Poggio. Biologically-Plausible Learning Algorithms Can Scale to Large Datasets. ArXiv e-prints, 92, 2018.
329
+
330
+ Xiaohui Xie and H. Sebastian Seung. Learning in neural networks by reinforcement of irregular spiking. Physical Review E, 69, 2004. ISSN 08966273. doi: 10.1016/S0896-6273(03)00761-X.
331
+
332
+ # A PROOFS
333
+
334
+ We review the key components of the model. Data $( \mathbf { x } , \mathbf { y } ) \in \mathcal { D }$ are drawn from a distribution $\rho$ . The loss function is linearized:
335
+
336
+ $$
337
+ \tilde { \mathcal { L } } \approx \mathcal { L } + \frac { \partial \mathcal { L } } { \partial h _ { j } ^ { i } } c _ { h } \xi _ { j } ^ { i } ,
338
+ $$
339
+
340
+ such that
341
+
342
+ $$
343
+ \mathbb { E } \left( ( \tilde { \mathcal { L } } - \mathcal { L } ) c _ { h } \xi _ { j } ^ { i } | \mathbf x , \mathbf y \right) \approx c _ { h } ^ { 2 } \frac { \partial \mathcal { L } } { \partial h _ { j } ^ { i } } \bigg \rvert _ { \mathbf x , \mathbf y } ,
344
+ $$
345
+
346
+ with expectation taken over the noise distribution $\nu ( \xi )$ . This suggests a good estimator of the loss gradient is
347
+
348
+ $$
349
+ \hat { \lambda } ^ { i } : = ( \tilde { \mathcal { L } } ( \mathbf x , \mathbf y , \boldsymbol \xi ) - \mathcal { L } ( \mathbf x , \mathbf y ) ) \frac { \xi ^ { i } } { c _ { h } } .
350
+ $$
351
+
352
+ Let $\tilde { \mathbf { e } } ^ { i }$ be the error signal computed by backpropagating the synthetic gradients:
353
+
354
+ $$
355
+ \begin{array} { r } { \tilde { \mathbf { e } } ^ { i } = \left\{ \begin{array} { l l } { \partial \mathcal { L } / \partial \hat { \mathbf { y } } \circ \sigma ^ { \prime } ( W ^ { i } \mathbf { h } ^ { i - 1 } ) , } & { i = N + 1 ; } \\ { \left( ( \hat { B } ^ { i + 1 } ) ^ { \mathsf { T } } \tilde { \mathbf { e } } ^ { i + 1 } \right) \circ \sigma ^ { \prime } ( W ^ { i } \mathbf { h } ^ { i - 1 } ) , } & { 1 \leq i \leq N . } \end{array} \right. } \end{array}
356
+ $$
357
+
358
+ Then parameters $B ^ { i + 1 }$ are estimated by solving the least squares problem:
359
+
360
+ $$
361
+ \begin{array} { r } { \hat { B } ^ { i + 1 } = \underset { B } { \arg \operatorname* { m i n } } \mathbb { E } \left\| B ^ { \mathsf { T } } \tilde { \mathbf { e } } ^ { i + 1 } - \hat { \lambda ^ { i } } \right\| _ { 2 } ^ { 2 } . } \end{array}
362
+ $$
363
+
364
+ Note that the matrix-vector form of backpropagation given here is setup so that we can think of each term as either a vector for a single input, or as matrices corresponding to a set of $T$ inputs. Here we focus on the question, under what conditions can we show that $\hat { B } ^ { i + 1 } \to W ^ { i + 1 }$ , as $T \to \infty ^ { \epsilon }$
365
+
366
+ One way to find an answer is to define the synthetic gradient in terms of the system without noise added. Then $B ^ { \mathsf { T } } \tilde { \mathbf { e } }$ is deterministic with respect to $\mathbf x , \mathbf y$ and, assuming $\tilde { \mathcal { L } }$ has a convergent power series around $\xi = 0$ , we can write
367
+
368
+ $$
369
+ \begin{array} { r } { \mathbb { E } ( \hat { \lambda ^ { i } } | \mathbf { x } , \mathbf { y } ) = \mathbb { E } \left( \frac { 1 } { c _ { h } ^ { 2 } } \left[ \frac { \partial \mathcal { L } } { \partial h ^ { i } } ( c _ { h } \xi _ { j } ^ { i } ) ^ { 2 } + \displaystyle \sum _ { m = 2 } ^ { \infty } \frac { \mathcal { L } _ { i j } ^ { ( m ) } } { m ! } ( c _ { h } \xi _ { j } ^ { i } ) ^ { m + 1 } \right] | \mathbf { x } , \mathbf { y } \right) } \\ { = ( W ^ { i + 1 } ) ^ { \mathsf { T } } \mathbf { e } ^ { i + 1 } + \mathbb { E } \left( \frac { 1 } { c _ { h } ^ { 2 } } \displaystyle \sum _ { m = 2 } ^ { \infty } \frac { \mathcal { L } _ { i j } ^ { ( m ) } } { m ! } ( c _ { h } \xi _ { j } ^ { i } ) ^ { m + 1 } | \mathbf { x } , \mathbf { y } \right) . } \end{array}
370
+ $$
371
+
372
+ Taken together these suggest we can prove $\hat { B } ^ { i + 1 } \to W ^ { i + 1 }$ in the same way we prove consistency of the linear least squares estimator.
373
+
374
+ For this to work we must show the expectation of the Taylor series approximation (1) is well behaved. That is, we must show the expected remainder term of the expansion:
375
+
376
+ $$
377
+ \mathcal { E } _ { j } ^ { i } ( c _ { h } ) = \mathbb { E } \left[ \frac { 1 } { c _ { h } ^ { 2 } } \sum _ { m = 2 } ^ { \infty } \frac { \mathcal { L } _ { i j } ^ { ( m ) } } { m ! } ( c _ { h } \xi _ { j } ^ { i } ) ^ { m + 1 } | \mathbf x , \mathbf y \right] ,
378
+ $$
379
+
380
+ is finite and goes to zero as $c _ { h } 0$ . This requires some additional assumptions on the problem.
381
+
382
+ We make the following assumptions:
383
+
384
+ • A1: the noise $\xi$ is subgaussian,
385
+ • A2: the loss function $\mathcal { L } ( \mathbf { x } , \mathbf { y } )$ is analytic on $\mathcal { D }$ ,
386
+ • A3: the error matrices $\tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \top }$ are full rank, for $1 \leq i \leq N + 1$ , with probability 1,
387
+ • A4: the mean of the remainder and error terms is bounded:
388
+
389
+ $$
390
+ \mathbb { E } \left[ \mathcal { E } ^ { i } ( c _ { h } ) ( \tilde { \mathbf { e } } ^ { i + 1 } ) ^ { \mathsf { T } } \right] < \infty ,
391
+ $$
392
+
393
+ for $1 \leq i \leq N$
394
+
395
+ Consider first convergence of the final layer feedback matrix, $B ^ { N + 1 }$ . In the final layer it is true that $\mathbf e ^ { N + 1 } = \tilde { \mathbf e } ^ { N + 1 }$ .
396
+
397
+ Theorem 1. Assume A1-4. For ${ \bf g } _ { F A } ( { \bf h } ^ { i } , \tilde { \bf e } ^ { i + 1 } ; B ^ { i + 1 } ) = B ^ { i + 1 } \tilde { \bf e } ^ { i + 1 }$ , then the least squares estimator
398
+
399
+ $$
400
+ ( \hat { B } ^ { N + 1 } ) ^ { \top } : = \hat { \lambda } ^ { N } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } \left( \mathbf { e } ^ { N + 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } \right) ^ { - 1 } ,
401
+ $$
402
+
403
+ solves (3) and converges to the true feedback matrix, in the sense that:
404
+
405
+ $$
406
+ \operatorname * { l i m } _ { c _ { h } 0 } \operatorname * { p l i m } _ { T \infty } \hat { B } ^ { N + 1 } = W ^ { N + 1 } .
407
+ $$
408
+
409
+ Proof. Let L(m)ij : mator (2) c $\begin{array} { r } { \mathcal { L } _ { i j } ^ { ( m ) } : = \frac { \partial ^ { m } \mathcal { L } } { \partial h _ { j } ^ { i m } } } \end{array}$ . We firste gradient thas r A1-2, the. For each ditional expectation of the esti-, by A2, we have the following $\mathcal { L } _ { N j } ^ { ( 1 ) }$ $c _ { h } 0$ $\hat { \lambda } _ { j } ^ { N }$
410
+ series expanded around $\xi = 0$ :
411
+
412
+ $$
413
+ \hat { \lambda _ { j } ^ { N } } = \frac { 1 } { c _ { h } ^ { 2 } } \sum _ { m = 1 } ^ { \infty } \frac { \mathcal { L } _ { i j } ^ { ( m ) } } { m ! } ( c _ { h } \xi _ { j } ^ { N } ) ^ { m + 1 } .
414
+ $$
415
+
416
+ Taking a conditional expectation gives:
417
+
418
+ $$
419
+ \mathbb { E } ( \hat { \lambda } _ { j } ^ { N } | \mathbf { x } , \mathbf { y } ) = ( W ^ { N + 1 } ) ^ { \top } \mathbf { e } ^ { N + 1 } + \mathbb { E } \left[ \frac { 1 } { c _ { h } ^ { 2 } } \sum _ { m = 2 } ^ { \infty } \frac { \mathcal { L } _ { N j } ^ { ( m ) } } { m ! } ( c _ { h } \xi _ { j } ^ { N } ) ^ { m + 1 } | \mathbf { x } , \mathbf { y } \right] .
420
+ $$
421
+
422
+ We must show the remainder term
423
+
424
+ $$
425
+ \mathcal { E } ^ { N } ( c _ { h } ) = \mathbb { E } \left[ \frac { 1 } { c _ { h } ^ { 2 } } \sum _ { m = 2 } ^ { \infty } \frac { \mathcal { L } _ { N j } ^ { ( m ) } } { m ! } ( c _ { h } \xi _ { j } ^ { N } ) ^ { m + 1 } | \mathbf { x } , \mathbf { y } \right] ,
426
+ $$
427
+
428
+ goes to zero as $c _ { h } 0$ . This is true provided each moment $\mathbb { E } ( ( \xi _ { j } ^ { N } ) ^ { m } | \mathbf { x } , \mathbf { y } )$ is sufficiently wellbehaved. Using Jensen’s inequality and the triangle inequality in the first line, we have that
429
+
430
+ $$
431
+ \begin{array} { r l } { \left| \mathcal { E } ^ { N } ( c _ { h } ) \right| \leq \mathbb { E } \left[ \frac { 1 } { c _ { h } ^ { 2 } } \displaystyle \sum _ { m = 2 } ^ { \infty } \left| \frac { \mathcal { L } _ { N j } ^ { ( m ) } } { m ! } \right| | c _ { h } \xi _ { j } ^ { N | m + 1 } | \mathbf { x } , \mathbf { y } \right] , } & { \forall ( \mathbf { x } , \mathbf { y } ) \in \mathcal { D } } \\ { \displaystyle [ \mathrm { m o n o t o n e ~ c o n v e r g e n c e } ] } & { = \displaystyle \sum _ { m = 2 } ^ { \infty } \left| \frac { \mathcal { L } _ { N j } ^ { ( m ) } } { m ! } \right| ( c _ { h } ) ^ { m - 1 } \mathbb { E } \left[ | \xi _ { j } ^ { N } | ^ { m + 1 } \right] } \\ { \displaystyle [ \mathrm { s u b g a u s s i a n } ] } & { \leq K \displaystyle \sum _ { m = 2 } ^ { \infty } \left| \frac { \mathcal { L } _ { N j } ^ { ( m ) } } { m ! } \right| ( c _ { h } ) ^ { m - 1 } ( \sqrt { m + 1 } ) ^ { m + 1 } } \\ & { = \mathcal { O } ( c _ { h } ) \qquad \mathrm { a s } c _ { h } \to 0 . } \end{array}
432
+ $$
433
+
434
+ With this in place, we have that the problem (9) is close to a linear least squares problem, since
435
+
436
+ $$
437
+ \hat { \lambda } ^ { N } = ( { \cal W } ^ { N + 1 } ) ^ { \top } { \bf e } ^ { N + 1 } + \xi ^ { N } ( c _ { h } ) + \eta ^ { N } ,
438
+ $$
439
+
440
+ with residual $\eta ^ { N } = \hat { \lambda } ^ { N } - \mathbb { E } ( \hat { \lambda } ^ { N } | \mathbf x , \mathbf y )$ . The residual satisfies
441
+
442
+ $$
443
+ \begin{array} { r l } & { \mathbb { E } \left( \mathbf { e } ^ { N + 1 } ( \eta ^ { N } ) ^ { \mathsf { T } } \right) = \mathbb { E } ( \mathbf { e } ^ { N + 1 } ( \hat { \lambda } ^ { N } ) ^ { \mathsf { T } } - \mathbf { e } ^ { N + 1 } \mathbb { E } ( ( \hat { \lambda } ^ { N } ) ^ { \mathsf { T } } | \mathbf { x } , \mathbf { y } ) ) } \\ & { \quad \quad \quad = \mathbb { E } \left( \mathbf { e } ^ { N + 1 } ( \hat { \lambda } ^ { N } ) ^ { \mathsf { T } } - \mathbb { E } \left( \mathbf { e } ^ { N + 1 } ( \hat { \lambda } ^ { N } ) ^ { \mathsf { T } } | \mathbf { x } , \mathbf { y } \right) \right) } \\ & { \quad \quad = 0 . } \end{array}
444
+ $$
445
+
446
+ This follows since $\mathbf { e } ^ { N + 1 }$ is defined in relation to the baseline loss, not the stochastic loss, meaning it is measurable with respect to $\displaystyle ( \mathbf { x } , \mathbf { y } )$ and can be moved into the conditional expectation.
447
+
448
+ From (12) and A3, we have that the least squares estimator (10) satisfies
449
+
450
+ $$
451
+ \begin{array} { r } { ( \hat { B } ^ { N + 1 } ) ^ { \top } = ( W ^ { N + 1 } ) ^ { \top } + ( { \mathcal E } ^ { N } ( c _ { h } ) + \eta ^ { N } ) ( \mathbf e ^ { N + 1 } ) ^ { \top } ( \mathbf e ^ { N + 1 } ( \mathbf e ^ { N + 1 } ) ^ { \top } ) ^ { - 1 } . } \end{array}
452
+ $$
453
+
454
+ Thus, using the continuous mapping theorem
455
+
456
+ $$
457
+ \begin{array} { r l } { \displaystyle \operatorname* { p l i m } _ { T \infty } ( \hat { B } ^ { N + 1 } ) ^ { \top } = ( W ^ { N + 1 } ) ^ { \top } + [ \operatorname* { p l i m } _ { T \infty } \frac { 1 } { T } ( \mathcal { E } ^ { N } ( c _ { h } ) + \eta ^ { N } ) ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ] [ \operatorname* { p l i m } _ { T \infty } \frac { 1 } { T } \mathbf { e } ^ { N + 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ] ^ { - 1 } } & \\ { \displaystyle \operatorname { [ W L L N ] } } & { = ( W ^ { N + 1 } ) ^ { \top } + \mathbb { E } [ ( \mathcal { E } ( c _ { h } ) + \eta ^ { N } ) ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ] [ \mathbb { E } ( \mathbf { e } ^ { N + 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ) ] ^ { - 1 } } \\ { \displaystyle \operatorname { [ E q . ~ ( 1 3 ) ] } } & { = ( W ^ { N + 1 } ) ^ { \top } + \mathbb { E } [ \mathcal { E } ( c _ { h } ) ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ] [ \mathbb { E } ( \mathbf { e } ^ { N + 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ) ] ^ { - 1 } } \\ { \mathrm { a n d ~ E q . ~ ( 1 1 ) } } & { = ( W ^ { N + 1 } ) ^ { \top } + \mathcal { O } ( c _ { h } ) . } \end{array}
458
+ $$
459
+
460
+ Then we have:
461
+
462
+ $$
463
+ \operatorname * { l i m } _ { c _ { h } 0 } \operatorname * { p l i m } _ { T \infty } \hat { B } ^ { N + 1 } = W ^ { N + 1 } .
464
+ $$
465
+
466
+ We can use Theorem 1 to establish convergence over the rest of the layers of the network when the activation function is the identity.
467
+
468
+ Theorem 2. Assume A1-4. For ${ \bf g } _ { F A } ( { \bf h } ^ { i } , \tilde { { \bf e } } ^ { i + 1 } ; B ^ { i + 1 } ) = B ^ { i + 1 } \tilde { { \bf e } } ^ { i + 1 }$ and $\sigma ( x ) = x$ , the least squares estimator
469
+
470
+ $$
471
+ ( \hat { B } ^ { i } ) ^ { \mathsf { T } } : = \hat { \lambda } ^ { i - 1 } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \mathsf { T } } \left( \tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \mathsf { T } } \right) ^ { - 1 } \qquad 1 \leq i \leq N + 1 ,
472
+ $$
473
+
474
+ solves (9) and converges to the true feedback matrix, in the sense that:
475
+
476
+ $$
477
+ \operatorname* { l i m } _ { c _ { h } \to 0 } \operatorname* { p l i m } _ { T \to \infty } \hat { B } ^ { i } = W ^ { i } , \qquad 1 \le i \le N + 1 .
478
+ $$
479
+
480
+ Proof. Define
481
+
482
+ $$
483
+ \tilde { W } ^ { i } ( c ) : = \operatorname * { p l i m } _ { T \to \infty } \hat { B } ^ { i } ,
484
+ $$
485
+
486
+ assuming this limit exists. From Theorem 1 the top layer estimate $\hat { B } ^ { N + 1 }$ converges in probability to $\tilde { W } ^ { N + \bar { 1 } } ( c )$ .
487
+
488
+ We can then use induction to establish that ${ \hat { B } } ^ { j }$ in the remaining layers also converges in probability to $\tilde { W } ^ { j } ( c )$ . That is, assume that ${ \hat { B } } ^ { j }$ converge in probability to $\tilde { W } ^ { j } ( c )$ in higher layers $N + 1 \geq j > i$ . Then we must establish that ${ \hat { B } } ^ { i }$ also converges in probability.
489
+
490
+ To proceed it is useful to also define
491
+
492
+ $$
493
+ \begin{array} { r } { \tilde { \tilde { \mathbf { e } } } ( c ) ^ { i } : = \left\{ \begin{array} { l l } { \partial \mathcal { L } / \partial \hat { \mathbf { y } } \circ \sigma ^ { \prime } ( W ^ { i } \mathbf { h } ^ { i - 1 } ) , } & { i = N + 1 ; } \\ { \left( ( \tilde { W } ^ { i + 1 } ( c ) ) ^ { \mathsf { T } } \tilde { \mathbf { e } } ^ { i + 1 } \right) \circ \sigma ^ { \prime } ( W ^ { i } \mathbf { h } ^ { i - 1 } ) , } & { 1 \leq i \leq N , } \end{array} \right. } \end{array}
494
+ $$
495
+
496
+ as the error signal backpropagated through the converged (but biased) weight matrices $\tilde { W } ( c )$ . Again it is true that $\bar { \tilde { \mathbf { e } } } ^ { N + 1 } = \mathbf { e } ^ { N + 1 }$ .
497
+
498
+ As in Theorem 1, the least squares estimator has the form:
499
+
500
+ $$
501
+ ( \hat { B } ^ { i } ) ^ { \mathsf { T } } = \hat { \lambda } ^ { i - 1 } ( \tilde { \bf e } ^ { i } ) ^ { \mathsf { T } } \left( \tilde { \bf e } ^ { i } ( \tilde { \bf e } ^ { i } ) ^ { \mathsf { T } } \right) ^ { - 1 } .
502
+ $$
503
+
504
+ Thus, again by the continuous mapping theorem:
505
+
506
+ $$
507
+ \begin{array} { r l } & { \displaystyle \operatorname* { p l i m } _ { T \to \infty } ( \hat { B } ^ { i } ) ^ { \top } = \left[ \operatorname* { p l i m } _ { T \to \infty } \frac { 1 } { T } \hat { \lambda } ^ { i - 1 } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \top } \right] \left[ \operatorname* { p l i m } _ { T \to \infty } \frac { 1 } { T } \tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \top } \right] ^ { - 1 } } \\ & { \quad \quad \quad \quad = \left[ \operatorname* { p l i m } _ { T \to \infty } \frac { 1 } { T } \hat { \lambda } ^ { i - 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } \hat { B } ^ { N + 1 } \cdot \cdot \cdot \hat { B } ^ { i + 1 } \right] \left[ \operatorname* { p l i m } _ { T \to \infty } \frac { 1 } { T } \tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \top } \right] ^ { - 1 } } \end{array}
508
+ $$
509
+
510
+ In this case continuity again allows us to separate convergence of each term in the product:
511
+
512
+ $$
513
+ \begin{array} { r l } & { \underset { r \infty } { \operatorname* { l i m } } \frac { 1 } { T } \hat { \lambda } ^ { i - 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } \hat { B } ^ { N + 1 } \cdot \cdot \cdot \hat { B } ^ { i + 1 } = [ \underset { T \infty } { \operatorname* { p l i m } } \frac { 1 } { T } \hat { \lambda } ^ { i - 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ] [ \underset { r \infty } { \operatorname* { p l i m } } \hat { B } ^ { N + 1 } ] \cdot \cdot \cdot [ \underset { T \infty } { \operatorname* { p l i m } } \hat { B } ^ { i + 1 } ] } \\ & { \qquad = \mathbb { E } ( \hat { \lambda } ^ { i - 1 } ( \mathbf { e } ^ { N + 1 } ) ^ { \top } ) W ^ { N + 1 } ( c ) \cdot \cdot \cdot W ^ { i + 1 } ( c ) , } \\ & { \qquad = \mathbb { E } ( \hat { \lambda } ^ { i - 1 } ( \tilde { \mathbf { e } } ^ { i } ( c ) ) ^ { \top } ) } \end{array}
514
+ $$
515
+
516
+ using the weak law of large numbers in the first term, and the induction assumption for the remaining terms. In the same way
517
+
518
+ $$
519
+ \operatorname* { p l i m } _ { T \infty } \frac { 1 } { T } \tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \mathsf { T } } = \mathbb { E } ( \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) ( \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) ) ^ { \mathsf { T } } ) .
520
+ $$
521
+
522
+ Note that the induction assumption also implies $\begin{array} { r } { \operatorname* { l i m } _ { c 0 } \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) = \mathbf { e } ^ { i } } \end{array}$ . Thus, putting it together, by A3, A4 and the same reasoning as in Theorem 1 we have the result:
523
+
524
+ $$
525
+ \begin{array} { l } { \displaystyle \operatorname* { l i m } _ { c _ { h } 0 } \operatorname* { p l i m } _ { T \infty } ( \hat { B } ^ { i } ) ^ { \mathsf { T } } = \operatorname* { l i m } _ { c 0 } [ ( W ^ { i } ) ^ { \mathsf { T } } \mathbb { E } ( \mathbf { e } ^ { i } ( \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) ) ^ { \mathsf { T } } ) + \mathbb { E } ( \mathcal { E } ^ { i - 1 } ( c ) ( \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) ) ^ { \mathsf { T } } ] [ \mathbb { E } ( \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) ( \tilde { \tilde { \mathbf { e } } } ^ { i } ( c ) ) ^ { \mathsf { T } } ) ] ^ { - 1 } } \\ { = ( W ^ { i } ) ^ { \mathsf { T } } . } \end{array}
526
+ $$
527
+
528
+ Corollary 1. Assume A1-4. For ${ \bf g } _ { D F A } ( { \bf h } ^ { i } , \tilde { \bf e } ^ { N + 1 } ; B ^ { i + 1 } ) = { \cal B } ^ { i + 1 } \tilde { \bf e } ^ { N + 1 }$ and $\sigma ( x ) = x$ , the least squares estimator
529
+
530
+ $$
531
+ ( \hat { B } ^ { i } ) ^ { \mathsf { T } } : = \hat { \lambda } ^ { i - 1 } ( \tilde { \mathbf { e } } ^ { N + 1 } ) ^ { \mathsf { T } } \left( \tilde { \mathbf { e } } ^ { N + 1 } ( \tilde { \mathbf { e } } ^ { N + 1 } ) ^ { \mathsf { T } } \right) ^ { - 1 } \qquad 1 \leq i \leq N + 1 ,
532
+ $$
533
+
534
+ solves (3) and converges to the true feedback matrix, in the sense that:
535
+
536
+ $$
537
+ \operatorname * { l i m } _ { c _ { h } \to 0 } \operatorname * { p l i m } _ { T \to \infty } \hat { B } ^ { i } = \prod _ { j = N + 1 } ^ { i } W ^ { j } , \qquad 1 \le i \le N + 1 .
538
+ $$
539
+
540
+ Proof. For a deep linear network notice that the node perturbation estimator can be expressed as:
541
+
542
+ $$
543
+ \hat { \lambda } ^ { i } = ( W ^ { i + 1 } \cdot \cdot \cdot W ^ { N + 1 } ) ^ { \mathsf { T } } \mathbf { e } ^ { N + 1 } + \mathcal { E } ^ { i } ( c _ { h } ) + \eta ^ { i } ,
544
+ $$
545
+
546
+ where the first term represents the true gradient, given by the simple linear backpropagation, the second and third terms are the remainder and a noise term, as in Theorem 1. Define
547
+
548
+ $$
549
+ V ^ { i } : = \prod _ { j = N + 1 } ^ { i } W _ { j } .
550
+ $$
551
+
552
+ Then following the same reasoning as the proof of Theorem 1, we have:
553
+
554
+ $$
555
+ \begin{array} { r l } & { \displaystyle \underset { T \infty } { \operatorname* { p l i m } } ( \hat { B } ^ { i + 1 } ) ^ { \top } = ( V ^ { i + 1 } ) ^ { \top } + [ \underset { T \infty } { \operatorname* { p l i m } } \frac { 1 } { T } ( \mathcal { E } ^ { i } ( c _ { h } ) + \eta ^ { i } ) ( { \mathbf e } ^ { N + 1 } ) ^ { \top } ] [ \underset { T \infty } { \operatorname* { p l i m } } \frac { 1 } { T } { \mathbf e } ^ { N + 1 } ( { \mathbf e } ^ { N + 1 } ) ^ { \top } ] ^ { - 1 } } \\ & { \qquad = ( V ^ { i + 1 } ) ^ { \top } + \mathbb { E } [ ( \mathcal { E } ( c _ { h } ) + \eta ^ { i } ) ( { \mathbf e } ^ { N + 1 } ) ^ { \top } ] [ \mathbb { E } ( { \mathbf e } ^ { N + 1 } ( { \mathbf e } ^ { N + 1 } ) ^ { \top } ) ] ^ { - 1 } } \\ & { \qquad = ( V ^ { i + 1 } ) ^ { \top } + \mathbb { E } [ \mathcal { E } ( c _ { h } ) ( { \mathbf e } ^ { N + 1 } ) ^ { \top } ] [ \mathbb { E } ( { \mathbf e } ^ { N + 1 } ( { \mathbf e } ^ { N + 1 } ) ^ { \top } ) ] ^ { - 1 } } \\ & { \qquad = ( V ^ { i + 1 } ) ^ { \top } + \mathcal { O } ( c _ { h } ) . } \end{array}
556
+ $$
557
+
558
+ Then we have:
559
+
560
+ $$
561
+ \operatorname * { l i m } _ { c _ { h } 0 } \operatorname * { p l i m } _ { T \infty } \hat { B } ^ { i + 1 } = V ^ { i + 1 } .
562
+ $$
563
+
564
+ # A.1 DISCUSSION OF ASSUMPTIONS
565
+
566
+ It is worth making the following points on each of the assumptions:
567
+
568
+ • A1. In the paper we assume $\xi$ is Gaussian. Here we prove the more general result of convergence for any subgaussian random variable.
569
+ • A2. In practice this may be a fairly restrictive assumption, since it precludes using relu nonlinearities. Other common choices, such as hyperbolic tangent and sigmoid non-linearities with an analytic cost function do satisfy this assumption, however.
570
+ • A3. It is hard to establish general conditions under which $\tilde { \mathbf { e } } ^ { i } ( \tilde { \mathbf { e } } ^ { i } ) ^ { \top }$ will be full rank. While it may be a reasonable assumption in some cases.
571
+
572
+ ![](images/fd648240733945f923c31ddaceabe338817f3be9e0d690dad0972640f69b9cab.jpg)
573
+ Figure 4: Convergence of node perturbation method in a two hidden layer neural network (784-50- 20-10) with MSE loss, for varying noise levels $c$ . Node perturbation is used to estimate feedback matrices that provide gradient estimates for fixed $W$ . (A) Relative error $( \| W ^ { i } - B ^ { i } \| _ { F } / \| W ^ { i } \| _ { F } )$ for each layer. (B) Angle between true gradient and synthetic gradient estimate at each layer. (C) Percentage of signs in $\breve { W } ^ { i }$ and $B ^ { i }$ that are in agreement. (D) Relative error when number of neurons is varied (784-N-50-10). (E) Angle between true gradient and synthetic gradient estimate at each layer.
574
+
575
+ Extensions of Theorem 2 to a non-linear network may be possible. However, the method of proof used here is not immediately applicable because the continuous mapping theorem can not be applied in such a straightforward fashion as in Equation (15). In the non-linear case the resulting sums over all observations are neither independent or identically distributed, which makes applying any law of large numbers complicated.
576
+
577
+ # B VALIDATION WITH FIXED $W$
578
+
579
+ We demonstrate the method’s convergence in a small non-linear network solving MNIST for different noise levels, $c _ { h }$ , and layer widths (Figure 4). As basic validation of the method, in this experiment the feedback matrices are updated while the feedforward weights $W ^ { i }$ are held fixed. We should expect the feedback matrices $B ^ { i }$ to converge to the feedforward matrices $W ^ { i }$ . Here different noise variance does results equally accurate estimators (Figure 4A). The estimator correctly estimates the true feedback matrix $W ^ { \bar { 2 } }$ to a relative error of $0 . 8 \%$ . The convergence is layer dependent, with the second hidden layer matrix, $W ^ { 2 }$ , being accurately estimated, and the convergence of the first hidden layer matrix, $\dot { W } ^ { 1 }$ , being less accurately estimated. Despite this, the angles between the estimated gradient and the true gradient (proportional to $\mathbf { e } ^ { \mathsf { T } } W B ^ { \mathsf { T } } \tilde { \mathbf { e } } )$ are very close to zero for both layers (Figure 4B) (less than 90 degrees corresponds to a descent direction). Thus the estimated gradients strongly align with true gradients in both layers. Recent studies have shown that sign congruence of the feedforward and feedback matrices is all that is required to achieve good performance Liao et al. (2016); Xiao et al. (2018). Here significant sign congruence is achieved in both layers (Figure 4C), despite the matrices themselves being quite different in the first layer. The number of neurons has an effect on both the relative error in each layer and the extent of alignment between true and synthetic gradient (Figure 4D,E). The method provides useful error signals for a variety of sized networks, and can provide useful error information to layers through a deep network.
580
+
581
+ # C EXPERIMENT DETAILS
582
+
583
+ Details of each task and parameters are provided here. All code is implemented in TensorFlow.
584
+
585
+ # C.1 FIGURE 2
586
+
587
+ Networks are 784-50-20-10 with an MSE loss function. A sigmoid non-linearity is used. A batch size of 32 is used. $B$ is updated using synthetic gradient updates with learning rate $\eta = 0 . 0 0 0 5$ , $W$ is updated with learning rate 0.0004, standard deviation of noise is 0.01. Same step size is used for feedback alignment, backpropagation and node perturbation. An initial warm-up period of 1000 iterations is used, in which the feedforward weights are frozen but the feedback weights are adjusted.
588
+
589
+ # C.2 FIGURE 3
590
+
591
+ Network has dimensions 784-200-2-200-784. Activation functions are, in order: tanh, identity, tanh, relu. MNIST input data with MSE reconstruction loss is used. A batch size of 32 was used. In this case stochastic gradient descent was used to update $B$ . Values for $W$ step size, noise variance and $B$ step size were found by random hyperparameter search for each method. The denoising autoencoder used Gaussian noise with zero mean and standard deviation $\sigma = 0 . 3$ added to the input training data.
592
+
593
+ # C.3 FIGURE 4
594
+
595
+ Networks are 784-50-20-10 (noise variance) or 784-N-50-10 (number of neurons) solving MNIST with an MSE loss function. A sigmoid non-linearity is used. A batch size of 32 is used. Here $W$ is fixed, and $B$ is updated according to an online ridge regression least-squares solution. This was used becase it converges faster than the gradient-descent based optimization used for learning $B$ throughout the rest of the text, so is a better test of consistency. A regularization parameter of $\gamma = 0 . 1$ was used for the ridge regression. That is, for each update, $B ^ { i }$ was set to the exact solution of the following:
596
+
597
+ $$
598
+ \begin{array} { r } { \hat { B } ^ { i + 1 } = \underset { B } { \arg \operatorname* { m i n } } \mathbb { E } \left\| \mathbf { g } ( \mathbf { h } ^ { i } , \tilde { \mathbf { e } } ^ { i + 1 } ; B ) - \hat { \lambda } ^ { i } \right\| _ { 2 } ^ { 2 } + \gamma \| B \| _ { F } ^ { 2 } . } \end{array}
599
+ $$
600
+
601
+ # C.4 CNN ARCHITECTURE AND IMPLEMENTATION
602
+
603
+ Code and CNN architecture are based on the direct feedback alignment implementation of Crafton et al. (2019). Specifically, for both CIFAR10 and CIFAR100, the CNN has the architecture Conv(3x3, 1x1, 32), MaxPool(3x3, 2x2), Conv(5x5, 1x1, 128), MaxPool(3x3, 2x2), Conv(5x5, 1x1, 256), MaxPool(3x3, 2x2), FC 2048, FC 2048, Softmax(10). Hyperparameters (learning rate, feedback learning rate, and perturbation noise level) were found through random search. All other parameters are the same as Crafton et al. (2019). In particular, ADAM optimizer was used, and dropout with probability 0.5 was used.
604
+
605
+ # C.5 NOISE ABLATION STUDY
606
+
607
+ The methods listed in Table 2 are implemented as follows. For the autoencoding task: Through hyperparameter search, a noise standard deviation of $c _ { h } ^ { * } = 0 . 0 2$ was found to give optimal performance for our method. For BP(SGD), BP(ADAM), FA, the ‘noise’ results in the Table are obtained by adding zero-mean Gaussian noise to the activations with the same standard deviation, $c _ { h } ^ { * }$ . For the DAE, a noise standard deviation of $c _ { i } = 0 . 3$ was added to the inputs of the network. Implementation of the synthetic gradient method here takes the same form as our method: $g ( { \mathbf { h } } , { \mathbf { e } } , { \mathbf { y } } ; { \mathbf { \bar { \mathit { B } } } } ) = B { \mathbf { e } }$ (this contrasts with the form used in Jaderberg et al. (2016): $g ( \mathbf { h } , \mathbf { e } , \mathbf { y } ; B , c ) = B ^ { \mathsf { T } } \mathbf { h } + c )$ . But the matrices $B$ are trained by providing true gradients $\lambda$ , instead of noisy estimators based on node perturbation. This is not biologically plausible, but provides a useful baseline to determine the source of good performance. The other co-adapting baseline we investigate is the ‘matching’ rule (similar to (Akrout et al., 2019; Rombouts et al., 2015; Martinolli et al., 2018)): the updates to $B$ match those of $W$ , and weight decay is used to drive the feedforward and feedback matrices to be similar.
608
+
609
+ For the CIFAR10 results, our hyperparameter search identified a noise standard deviation of $c _ { h } =$ 0.067 to be optimal. This was added to the activations . The synthetic gradients took the same form as above.
md/train/H1xsSjC9Ym/H1xsSjC9Ym.md ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO UNDERSTAND GOAL SPECIFICATIONS BY MODELLING REWARD
2
+
3
+ Dzmitry Bahdanau∗ Mila, Universite de Montr´ eal´ dimabgv@gmail.com
4
+
5
+ Felix Hill DeepMind
6
+
7
+ Jan Leike DeepMind
8
+
9
+ Edward Hughes DeepMind
10
+
11
+ Arian Hosseini Mila, Universite de Montr ´ eal ´
12
+
13
+ Pushmeet Kohli DeepMind
14
+
15
+ Edward Grefenstette† DeepMind egrefen@fb.com
16
+
17
+ # ABSTRACT
18
+
19
+ Recent work has shown that deep reinforcement-learning agents can learn to follow language-like instructions from infrequent environment rewards. However, this places on environment designers the onus of designing language-conditional reward functions which may not be easily or tractably implemented as the complexity of the environment and the language scales. To overcome this limitation, we present a framework within which instruction-conditional RL agents are trained using rewards obtained not from the environment, but from reward models which are jointly trained from expert examples. As reward models improve, they learn to accurately reward agents for completing tasks for environment configurations—and for instructions—not present amongst the expert data. This framework effectively separates the representation of what instructions require from how they can be executed. In a simple grid world, it enables an agent to learn a range of commands requiring interaction with blocks and understanding of spatial relations and underspecified abstract arrangements. We further show the method allows our agent to adapt to changes in the environment without requiring new expert examples.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Developing agents that can learn to follow user instructions pertaining to an environment is a longstanding goal of AI research (Winograd, 1972). Recent work has shown deep reinforcement learning (RL) to be a promising paradigm for learning to follow language-like instructions in both 2D and 3D worlds (e.g. Hermann et al. (2017); Chaplot et al. (2018), see Section 4 for a review). In each of these cases, being able to reward an agent for successfully completing a task specified by an instruction requires the implementation of a full interpreter of the instruction language. This interpreter must be able to evaluate the instruction against environment states to determine when reward must be granted to the agent, and in doing so requires full knowledge (on the part of the designer) of the semantics of the instruction language relative to the environment. Consider, for example, 4 arrangements of blocks presented in Figure 1. Each of them can be interpreted as a result of successfully executing the instruction “build an L-like shape from red blocks”, despite the fact that these arrangements differ in the location and the orientation of the target shape, as well as in the positioning of the irrelevant blue blocks. At best (e.g. for instructions such as the aforementioned one), implementing such an interpreter is feasible, although typically onerous in terms of engineering efforts to ensure reward can be given—for any admissible instruction in the language—in potentially complex or large environments. At worst, if we wish to scale to the full complexity of natural language, with all its ambiguity and underspecification, this requires solving fundamental problems of natural language understanding.
24
+
25
+ ![](images/406de354b040b9b9ca8c19c472b453c5fee6d1a5078521954cc52463976c72c6.jpg)
26
+ Figure 1: Different valid goal states for the instruction “build an L-like shape from red blocks”.
27
+
28
+ If instruction-conditional reward functions cannot conveniently or tractably be implemented, can we somehow learn them in order to then train instruction-conditional policies? When there is a single implicit task, Inverse Reinforcement Learning (IRL; $\mathrm { N g }$ & Russell, 2000; Ziebart et al., 2008) methods in general, and Generative Adversarial Imitation Learning (Ho & Ermon, 2016) in particular, have yielded some success in jointly learning reward functions from expert data and training policies from learned reward models. In this paper, we wish to investigate whether such mechanisms can be adapted to the more general case of jointly learning to understand language which specifies task objectives (e.g. instructions, goal specifications, directives), and use such understanding to reward language-conditional policies which are trained to complete such tasks. For simplicity, we explore a facet of this general problem in this paper by focussing on the case of declarative commands that specify sets of possible goal-states (e.g. “arrange the red blocks in a circle.”), and where expert examples need only be goal states rather than full trajectories or demonstrations, leaving such extensions for further work. We introduce a framework—Adversarial Goal-Induced Learning from Examples (AGILE)—for jointly training an instruction-conditional reward model using expert examples of completed instructions alongside a policy which will learn to complete instructions by maximising the thus-modelled reward. In this respect, AGILE relies on familiar RL objectives, with free choice of model architecture or training mechanisms, the only difference being that the reward comes from a learned reward model rather than from the environment.
29
+
30
+ We first verify that our method works in settings where a comparison between AGILE-trained policies with policies trained from environment reward is possible, to which end we implement instructionconditional reward functions. In this setting, we show that the learning speed and performance of A3C agents trained with AGILE reward models is superior to A3C agents trained against environment reward, and comparable to that of true-reward A3C agents supplemented by auxiliary unsupervised reward prediction objectives. To simulate an instruction-learning setting in which implementing a reward function would be problematic, we construct a dataset of instructions and goal-states for the task of building colored orientation-invariant arrangements of blocks. On this task, without us ever having to implement the reward function, the agent trained within AGILE learns to construct arrangements as instructed. Finally, we study how well AGILE’s reward model generalises beyond the examples on which it was trained. Our experiments show it can be reused to allow the policy to adapt to changes in the environment.
31
+
32
+ # 2 ADVERSARIAL GOAL-INDUCED LEARNING FROM EXAMPLES
33
+
34
+ Here, we introduce AGILE (“Adversarial Goal-Induced Learning from Examples”, in homage to the adversarial learning mechanisms that inspire it), a framework for jointly learning to model reward for instructions, and learn a policy from such a reward model. Specifically, we learn an instructionconditional policy $\pi _ { \theta }$ with parameters $\theta$ , from a data stream ${ \mathcal { G } } ^ { \pi _ { \theta } }$ obtained from interaction with the environment, by adjusting $\theta$ to maximise the expected total reward $R _ { \pi } ( \theta )$ based on stepwise reward $\hat { r } _ { t }$ given to the policy, exactly as done in any normal Reinforcement Learning setup. The difference lies in the source of the reward: we introduce an additional discriminator network $D _ { \phi }$ , the reward model, whose purpose is to define a meaningful reward function for training $\pi _ { \theta }$ . We jointly learn this reward model alongside the policy by training it to predict whether a given state $s$ is a goal state for a given instruction $c$ or not. Rather than obtain positive and negative examples of hinstruction, statei pairs from a purely static dataset, we sample them from a policy-dependent data stream. This stream is defined as follows: positive examples are drawn from a fixed dataset $\mathcal { D }$ of instructions $c _ { i }$ paired with goal states $s _ { i }$ ; negative examples are drawn from a constantly-changing buffer of states obtained from the policy acting on the environment, paired with the instruction given to the policy. Formally, the policy is trained to maximize a return $R _ { \pi } ( \theta )$ and the reward model is trained to minimize a cross-entropy loss $L _ { D } ( \phi )$ , the equations for which are:
35
+
36
+ $$
37
+ \begin{array} { r l } & { R _ { \pi } ( \theta ) = \underset { ( c , s _ { 1 : \infty } ) \sim \mathcal { G } ^ { \pi _ { \theta } } } { \mathbb { E } } \underset { t = 1 } { \overset { \infty } { \sum } } \gamma ^ { t - 1 } \hat { r } _ { t } + \alpha H ( \pi _ { \theta } ) , } \\ & { L _ { D } ( \phi ) = \underset { ( c , s ) \sim \mathcal { B } } { \overset { \mathbb { E } } { \sum } } - \log ( 1 - D _ { \phi } ( c , s ) ) + \underset { ( c _ { i } , g _ { i } ) \sim \mathcal { D } } { \overset { \mathbb { E } } { \sum } } - \log D _ { \phi } ( c _ { i } , g _ { i } ) . } \end{array}
38
+ $$
39
+
40
+ where
41
+
42
+ $$
43
+ \hat { r } _ { t } = [ D _ { \phi } ( c , s _ { t } ) > 0 . 5 ]
44
+ $$
45
+
46
+ In the equations above, the Iverson Bracket $[ \ldots ]$ maps truth to 1 and falsehood to 0, e.g. $[ x > 0 ] = 1$ iff $x > 0$ and 0 otherwise. $\gamma$ is the discount factor. With $\left( c , s _ { 1 : \infty } \right) \sim \mathcal { G } ^ { \pi _ { \theta } }$ , we denote a state trajectory that was obtained by sampling $( c , s _ { 0 } ) \sim \mathcal { G }$ and running $\pi _ { \theta }$ conditioned on $c$ starting from $s _ { 0 }$ . $\boldsymbol { B }$ denotes a replay buffer to which $( c , s )$ pairs from $T$ -step episodes are added; i.e. it is the undiscounted occupancy measure over the first $T$ steps. $D _ { \phi } ( c , s )$ is the probability of $( c , s )$ having a positive label according to the reward model, and thus $[ D _ { \phi } ( c , s _ { t } ) > 0 . 5 ]$ indicates that a given state $s _ { t }$ is more likely to be a goal state for instruction $c$ than not, according to $D$ . $H ( \pi _ { \theta } )$ is the policy’s entropy, and $\alpha$ is a hyperparameter. The approach is illustrated in $\mathrm { F i g } 2$ . Pseudocode is available in Appendix A. We note that Equation 1 differs from a traditional RL objective only in that the modelled reward $\hat { r } _ { t }$ is used instead of the ground-truth reward $r _ { t }$ . Indeed, in Section 3, we will compare policies trained with AGILE to policies trained with traditional RL, simply by varying the reward source from the reward model to the environment.
47
+
48
+ ![](images/7a23a3d803eaf3a9901e9f80bc9ea7cb176c0bac50983c8064c0edc771e9ccca.jpg)
49
+ Figure 2: Information flow during AGILE training. The policy acts conditioned on the instruction and is trained using the reward from the reward model (Figure 2a). The reward model is trained, as a discriminator, to distinguish between “A”, the hinstruction, goal-statei pairs from the dataset (Figure 2b), and “B”, the hinstruction, statei pairs from the agent’s experience.
50
+
51
+ Dealing with False Negatives Let us call $\Gamma ( c )$ the objective set of goal states which satisfy instruction $c$ (which is typically unknown to us). Compared to the ideal case where all $( c , s )$ would be deemed positive if-and-only-if $s \in \Gamma ( c )$ , the labelling of examples implied by Equation 2 has a fundamental limitation when the policy performs well. As the policy improves, by definition, a increasing share of $( c , s ) \in B$ are objective goal-states from $\Gamma ( c )$ . However, as they are treated as negative examples in Equation 2, the discriminator accuracy drops, causing the policy to get worse. We therefore propose the following simple heuristic to rectify this fundamental limitation by approximately identifying the false negatives. We rank $( c , s )$ examples in $\boldsymbol { B }$ according to the reward model’s output $D _ { \phi } ( c , s )$ and discard the top $1 - \rho$ percent as potential false negatives. Only the other $\rho$ percent are used as negative examples of the reward model. Formally speaking, the first term in Equation 2 becomes $\mathbb { E } _ { ( c , s ) \sim \mathcal { B } _ { D _ { \phi } , \rho } } - \log ( 1 - D _ { \phi } ( c , s ) )$ , where $B _ { D _ { \phi } , \rho }$ stands for the $\rho$ percent of $\boldsymbol { B }$ selected, using $D _ { \phi }$ , as described above. We will henceforth refer to $\rho$ as the anticipated negative rate. Setting $\rho$ to $100 \%$ means using ${ \cal B } _ { D _ { \phi } , 1 0 0 } = { \cal B }$ like in Equation 2, but our preliminary experiments have shown clearly that this inhibits the reward model’s capability to correctly learn a reward function. Using too small a value for $\rho$ on the other hand may deprive the reward model of the most informative negative examples. We thus recommend to tune $\rho$ as a hyperparameter on a task-specific basis.
52
+
53
+ Reusability of the Reward Model An appealing advantage of AGILE is the fact that the reward model $D _ { \phi }$ and the policy $\pi _ { \theta }$ learn two related but distinct aspects of an instruction: the reward model focuses on recognizing the goal-states (what should be done), whereas the policy learns what to do in order to get to a goal-state (how it should be done). The intuition motivating this design is that the knowledge about how instructions define goals should generalize more strongly than the knowledge about which behavior is needed to execute instructions. Following this intuition, we propose to reuse a reward model trained in AGILE as a reward function for training or fine-tuning policies.
54
+
55
+ Relation to GAIL AGILE is strongly inspired by—and retains close relations to—Generative Adversarial Imitation Learning (GAIL; Ho & Ermon, 2016), which likewise trains both a reward function and a policy. The former is trained to distinguish between the expert’s and the policy’s trajectories, while the latter is trained to maximize the modelled reward. GAIL differs from AGILE in a number of important respects. First, AGILE is conditioned on instructions $c$ so a single AGILE agent can learn combinatorially many skills rather than just one. Second, in AGILE the reward model observes only states $s _ { i }$ (either goal states from an expert, or states from the agent acting on the environment) rather than state-action traces $( s _ { 1 } , a _ { 1 } ) , ( s _ { 2 } , a _ { 2 } ) , \ldots .$ , learning to reward the agent based on “what” needs to be done rather than according to “how” it must be done. Finally, in AGILE the policy’s reward is the thresholded probability $\big [ D _ { \phi } ( c , s _ { t } ) \big ]$ as opposed to the log-probability $\log D _ { \phi } ( s _ { t } , a _ { t } )$ used in GAIL. Our reasoning for this change is that, when adapted to the setting with goal-specifications, a GAIL-style reward $\log D _ { \phi } ( c , s _ { t } )$ could take arbitrarily low values for intermediate states visited by the agent, as the reward model $D _ { \phi }$ becomes confident that those are not goal states. Empirically, we found that dropping the logarithm from GAIL-style rewards is indeed crucial for AGILE’s performance, and that using the probability $D _ { \phi } ( c , s _ { t } )$ as the reward $\hat { r _ { t } }$ results in a performance level similar to that of the discretized AGILE reward $\hat { r _ { t } } = [ D _ { \phi } ( c , s _ { t } ) ]$ .
56
+
57
+ # 3 EXPERIMENTS
58
+
59
+ We experiment with AGILE in a grid world environment that we call GridLU, short for Grid Language Understanding and after the famous SHRDLU world (Winograd, 1972). GridLU is a fully observable grid world in which the agent can walk around the grid (moving up, down left or right), pick blocks up and drop them at new locations (see Figure 3 for an illustration and Appendix C for a detailed description of the environment).
60
+
61
+ # 3.1 MODELS
62
+
63
+ All our models receive the world state as a 56x56 RGB image. With regard to processing the instruction, we will experiment with two kinds of models: Neural Module Networks (NMN) that treat the instruction as a structured expression, and a generic model that takes an unstructured instruction representation and encodes it with an LSTM.
64
+
65
+ Because the language of our instructions is generated from a simple grammar, we perform most of our experiments using policy and reward model networks that are constructed using the NMN (Andreas et al., 2016) paradigm. NMN is an elegant architecture for grounded language processing in which a tree of neural modules is constructed based on the language input. The visual input is then fed to the leaf modules, which send their outputs to their parent modules, which process is repeated until the root of the tree. We mimick the structure of the instructions when constructing the tree of modules; for example, the NMN corresponding to the instruction $c _ { 1 } = _ { \it { 1 } }$ NorthFrom(Color(‘red’, Shape(‘circle’, SCENE)), Color(‘blue’, Shape(‘square’, SCENE))) performs a computation $h _ { N M N } = m _ { N o r t h F r o m } ( m _ { r e d } ( m _ { c i r c l e } ( h _ { s } ) ) , m _ { b l u e } ( m _ { s q u a r e } ( h _ { s } ) ) ) _ { K } ^ { }$ ), where $m _ { x }$ denotes the module corresponding to the token $x$ , and $h _ { s }$ is a representation of state $s$ . Each module $m _ { x }$ performs a convolution (weights shared by all modules) followed by a token-specific Feature-Wise Linear Modulation (FiLM) (Perez et al., 2017): $m _ { x } ( h _ { l } , h _ { r } ) = R e L U ( ( 1 + \gamma _ { x } ) \odot ( W _ { m ^ { * } } [ h _ { l } ; h _ { r } ] ) \oplus \beta _ { x } )$ , where $h _ { l }$ and $h _ { r }$ are module inputs, $\gamma _ { x }$ is a vector of FiLM multipliers, $\beta _ { x }$ are FiLM biases, $\odot$ and $\oplus$ are element-wise multiplication and addition with broadcasting, $^ *$ denotes convolution. The representation $h _ { s }$ is produced by a convnet. The NMN’s output $h _ { N M N }$ undergoes max-pooling and is fed through a 1-layer MLP to produce action probabilities or the reward model’s output. Note, that while structure-wise our policy and reward model are mostly similar, they do not share parameters.
66
+
67
+ NMN is an excellent model when the language structure is known, but this may not be the case for natural language. To showcase AGILE’s generality we also experiment with a very basic structure-agnostic architecture. We use FiLM to condition a standard convnet on an instruction representation $h _ { L S T M }$ produced by an LSTM. The $k$ -th layer of the convnet performs a computation $h _ { k } = R e L U ( ( 1 + \gamma _ { k } ) \odot ( W _ { k } * h _ { k - 1 } ) \oplus \beta _ { k } )$ e $\gamma _ { k } = W _ { k } ^ { \gamma } h _ { L S T M } + b _ { k } ^ { \gamma }$ , e $\bar { \beta } _ { k } = W _ { k } ^ { \beta } h _ { L S T M } + b _ { k } ^ { \beta }$ $h _ { N M N }$
68
+ output $h _ { 5 }$ of the $5 ^ { \mathrm { t h } }$ layer of the convnet.
69
+
70
+ In the rest of the paper we will refer to the architectures described above as FiLM-NMN and FiLMLSTM respectively. FiLM-NMN will be the default model in all experiments unless explicitly specified otherwise. Detailed information about network architectures can be found in Appendix G.
71
+
72
+ # 3.2 TRAINING DETAILS
73
+
74
+ For the purpose of training the policy networks both within AGILE, and for our baseline trained from ground-truth reward $r _ { t }$ instead of the modelled reward $\hat { r } _ { t }$ , we used the Asynchronous Advantage Actor-Critic (A3C; Mnih et al., 2016). Any alternative training mechanism which uses reward could be used—since the only difference in AGILE is the source of the reward signal, and for any such alternative the appropriate baseline for fair comparison would be that same algorithm applied to train a policy from ground-truth reward. We will refer to the policy trained within AGILE as AGILE-A3C. The A3C’s hyperparameters $\gamma$ and $\lambda$ were set to 0.99 and 0 respectively, i.e. we did not use without temporal difference learning for the baseline network. The length of an episode was 30, but we trained the agent on advantage estimation rollouts of length 15. Every experiment was repeated 5 times. We considered an episode to be a success if the final state was a goal state as judged by a task-specific success criterion, which we describe for the individual tasks below. We use the success rate (i.e. the percentage of successful episodes) as our main performance metric for the agents. Unless otherwise specified we use the NMN-based policy and reward model in our experiments. Full experimental details can be found in Appendix D.
75
+
76
+ ![](images/a27f583ee14d93edac88f671893fa868066b6ac8347ca3949bdbc4d921fd2c69.jpg)
77
+ Figure 3: Initial state and goal state for GridLU-Relations (top-left) and GridLU-Arrangements episodes (bottom-left), and the complete GridLU-Arrangements vocabulary (right), each with examples of some possible goal-states.
78
+
79
+ Our first task, GridLU-Relations, is an adaptation of the SHAPES visual question answering dataset (Andreas et al., 2016) in which the blocks can be moved around freely. GridLU-Relations requires the agent to induce the meaning of spatial relations such as above or right of, and to manipulate the world in order to instantiate these relationships. Named GridLU-Relations, the task involves five spatial relationships (NorthFrom, SouthFrom, EastFrom, WestFrom, SameLocation), whose arguments can be either the blocks, which are referred to by their shapes and colors, or the agent itself. To generate the full set of possible instructions spanned by these relations and our grid objects, we define a formal grammar that generates strings such as:
80
+
81
+ NorthFrom(Color(‘red’, Shape(‘circle’, SCENE)), Color(‘blue’, Shape(‘square’, SCENE)))
82
+
83
+ This string carries the meaning ‘put a red circle north from (above) a blue square’. In general, when a block is the argument to a relation, it can be referred to by specifying both the shape and the color, like in the example above, or by specifying just one of these attributes. In addition, the AGENT constant can be an argument to all relations, in which case the agent itself must move into a particular spatial relation with an object. Figure 3 shows two examples of GridLU-Relations instructions and their respective goal states. There are 990 possible instructions in the GridLU-Relations task, and the number of distinct training instances can be loosely lower-bounded by $1 . 8 \cdot 1 0 ^ { 7 }$ (see Appendix E for details).
84
+
85
+ Notice that, even for the highly concrete spatial relationships in the GridLU-Relations language, the instructions are underspecified and somewhat ambiguous—is a block in the top-right corner of the grid above a block in the bottom left corner? We therefore decided (arbitrarily) to consider all relations to refer to immediate adjacency (so that Instruction equation 3 is satisfied if and only if there is a red circle in the location immediately above a blue square). Notice that the commands are still underspecified in this case (since they refer to the relationship between two entities, not their absolute positions), even if the degree of ambiguity in their meaning is less than in many real-world cases. The policy and reward model trained within AGILE then have to infer this specific sense of what these spatial relations mean from goal-state examples, while the baseline agent is allowed to access our programmed ground-truth reward. The binary ground-truth reward (true if the state is a goal state) is also used as the success criterion for evaluating AGILE.
86
+
87
+ Having formally defined the semantics of the relationships and programmed a reward function, we compared the performance of an AGILE-A3C agent against a priviliged baseline A3C agent trained using ground-truth reward. Interestingly, we found that AGILE-A3C learned the task more easily than standard A3C (see the respective curves in Figure 4). We hypothesize this is because the modeled rewards are easy to learn at first and become more sparse as the reward model slowly improves. This naturally emerging curriculum expedites learning in the AGILE-A3C when compared to the A3C-trained policy that only receives signal upon reaching a perfect goal state.
88
+
89
+ We did observe, however, that the A3C algorithm could be improved significantly by applying the auxiliary task of reward prediction (RP; Jaderberg et al., 2016), which was applied to language learning tasks by Hermann et al. (2017) (see the A3C and A3C-RP curves in Figure 4). This objective reinforces the association between instructions and states by having the agent replay the states immediately prior to a non-zero reward and predict whether or not it the reward was positive (i.e. the states match the instruction) or not. This mechanism made a significant difference to the A3C performance, increasing performance to $9 9 . 9 \%$ . AGILE-A3C also achieved nearly perfect performance $( 9 9 . 5 \% )$ ). We found this to be a very promising result, since within AGILE, we induce the reward function from a limited set of examples.
90
+
91
+ The best results with AGILE-A3C were obtained using the anticipated negative rate $\rho = 2 5 \%$ . When we used larger values of $\rho$ AGILE-A3C training started quicker but after 100-200 million steps the performance started to deteriorate (see AGILE curves in Figure 4), while it remained stable with $\bar { \rho } = 2 5 \%$ .
92
+
93
+ Data efficiency These results suggest that the AGILE reward model was able to induce a near perfect reward function from a limited set of hinstruction, goal-statei pairs. We therefore explored how small this training set of examples could be to achieve reasonable performance. We found that with a training set of only 8000 examples, the AGILE-A3C agent could reach a performance of $60 \%$ (massively above chance). However, the optimal performance was achieved with more than 100,000 examples. The full results are available in Appendix D.
94
+
95
+ Generalization to Unseen Instructions In the experiments we have reported so far the AGILE agent was trained on all 990 possible GridLU-Relation instructions. In order to test generalization to unseen instructions we held out $10 \%$ of the instructions as the test set and used the rest $90 \%$ as the training set. Specifically, we restricted the training instances and hinstruction, goal-statei pairs to only contain instructions from the training set. The performance of the trained model on the test instructions was the same as on the training set, showing that AGILE did not just memorise the training instructions but learnt a general interpretation of GridLU-Relations instructions.
96
+
97
+ AGILE with Structure-Agnostic Models We report the results for AGILE with a structureagnostic FILM-LSTM model in Figure 4 (middle). AGILE with $\rho = 2 5 \%$ achieves a high $9 7 . 5 \%$ success rate, and notably it trains almost as fast as an RL-RP agent with the same architecture.
98
+
99
+ ![](images/fbde7ef34d849ffb38f216394e38de05042e533ab4bbd67b6c63a27658b7dd30.jpg)
100
+ Figure 4: Left: learning curves for A3C, A3C-RP (both using ground truth reward), and AGILE-A3C with different values of the anticipated negative rate $\rho$ on the GridLU-Relations task. We report success rate (see Section 3). Middle: learning curves for policies trained with ground-truth RL, and within AGILE, with different model architectures. Right: the reward model’s accuracy for different values of $\rho$ .
101
+
102
+ Analyzing the reward model We compare the binary reward provided by the reward model with the ground-truth from the environment during training on the GridLU-Relation task. With $\rho = 2 5 \%$ the accuracy of the reward model peaks at $9 9 . 5 \%$ . As shown in Figure 4 (right) the reward model learns faster in the beginning with larger values of $\rho$ but then deteriorates, which confirms our intuition about why $\rho$ is an important hyperparameter and is aligned with the success rate learning curves in Figure 4 (left). We also observe during training that the false negative rate is always kept reasonably low ( ${ < } 3 \%$ of rewards) whereas the reward model will initially be more generous with false positives $( 2 0 - 5 0 \%$ depending on $\rho$ during the first 20M steps of training) and will produce an increasing number of false positives for insufficiently small values of $\rho$ (see plots in Appendix E). We hypothesize that early false positives may facilitate the policy’s training by providing it with a sort of curriculum, possibly explaining the improvement over agents trained from ground-truth reward, as shown above.
103
+
104
+ The reward model as general reward function An instruction-following agent should be able to carry-out known instructions in a range of different contexts, not just settings that match identically the specific setting in which those skills were learned. To test whether the AGILE framework is robust to (semantically-unimportant) changes to the environment dynamics, we first trained the policy and reward model as normal and then modified the effective physics of the world by making all red square objects immovable. In this case, following instructions correctly is still possible in almost all cases, but not all solutions available during training are available at test time. As expected, this change impaired the policy and the agent’s success rate on the instructions referring to a red square dropped from $9 8 \%$ to $5 2 \%$ . However, after fine-tuning the policy (additional training of the policy on the test episodes using the reward from the previously-trained-then-frozen reward model), the success rate went up to $6 \bar { 9 } . 3 \%$ (Figure 5). This experiment suggests that the AGILE reward model learns useful and generalisable linguistic knowledge. The knowledge can be applied to help policies adapt in scenarios where the high-level meaning of commands is familiar but the low-level physical dynamics is not.
105
+
106
+ ![](images/2ff77a80cae73f9ec07c52cbe8d89e4308ff7516b5e4c9d5205601c00b54ddd2.jpg)
107
+ Figure 5: Fine-tuning for an immovable red square.
108
+
109
+ # 3.4 GRIDLU-ARRANGEMENTS TASK
110
+
111
+ The experiments thus far demonstrate that even without directly using the reward function AGILEA3C performs comparably to its pure A3C counter-part. However, the principal motivation for the AGILE framework is to avoid programming the reward function. To model this setting more explicitly, we developed the task GridLU-Arrangements, in which each instruction is associated with multiple viable goal-states that share some (more abstract) common form. The complete set of instructions and forms is illustrated in Figure 3. To get training data, we built a generator to produce random instantiations (i.e. any translation, rotation, reflection or color mapping of the illustrated forms) of these goal-state classes, as positive examples for the reward model. In the real world, this process of generating goal-states could be replaced by finding, or having humans annotate, labelled images. In total, there are 36 possible instructions in GridLU-Arrangements, which together refer to a total of 390 million correct goal-states (see Appendix F for details). Despite this enormous space of potentially correct goal-states, we found that for good performance it was necessary to train AGILE on only 100,000 (less than $0 . 3 \%$ ) of these goal-states, sampled from the same distribution as observed in the episodes. To replicate the conditions of a potential AGILE application as close as possible, we did not write a reward function for GridLU-Arrangements (even though it would have been theoretically possible), and instead carried out all evaluation manually.
112
+
113
+ The training regime for GridLU-Arrangements involved two classes of episodes (and instructions). Half of the episodes began with four square blocks (all of the same color), and the agent, in random unique positions, and an instruction sampled uniformly from the list of possible arrangement words. In the other half of the episodes, four square blocks of one color and four square blocks of a different color were initially each positioned randomly. The instruction in these episodes specified one of the two colors together with an arrangement word. We trained policies and reward models using AGILE with 10 different seeds for each level, and selected the best pair based on how well the policy maximised modelled reward. We then manually assessed the final state of each of 200 evaluation episodes, using human judgement that the correct shape has been produced as success criterion to evaluate AGILE. We found that the agent made the correct arrangement in $58 \%$ of the episodes. The failure cases were almost always in the episodes involving eight blocks1. In these cases, the AGILE agent tended towards building the correct arrangement, but was impeded by the randomly positioned non-target-color blocks and could not recover. Nonetheless, these scores, and the compelling behaviour observed in the video (https://www.youtube.com/watch? $\scriptstyle \mathtt { V } = 0$ 7S-x3MkEoQ), demonstrate the potential of AGILE for teaching agents to execute semantically vague or underspecified instructions.
114
+
115
+ # 4 RELATED WORK
116
+
117
+ Learning to follow language instructions has been approached in many different ways, for example by reinforcement learning using a reward function programmed by a system designer. Janner et al. (2017); Oh et al. (2017); Hermann et al. (2017); Chaplot et al. (2018); Denil et al. (2017); Yu et al. (2018) consider instruction-following in 2D or 3D environments and reward the agent for arriving at the correct location or object. Janner et al. (2017) and Misra et al. (2017) train RL agents to produce goal-states given instructions. As discussed, these approaches are constrained by the difficulty of programming language-related reward functions, a task that requires an programming expert, detailed access to the state of the environment and hard choices above how language should map to the world. Agents can be trained to follow instructions using complete demonstrations, that is sequences of correct actions describing instruction execution for given initial states.
118
+
119
+ Chen & Mooney (2011); Artzi & Zettlemoyer (2013) train semantic parsers to produce a formal representation of the query that when fed to a predefined execution model matches exactly the sequence of actions from the demonstration. Andreas & Klein (2015); Mei et al. (2016) sidestep the intermediate formal representation and train a Conditional Random Field (CRF) and a sequenceto-sequence neural model respectively to directly predict the actions from the demonstrations. A underlying assumption behind all these approaches is that the agent and the demonstrator share the same actuation model, which might not always be the case. In the case of navigational instructions the trajectories of the agent and the demonstrators can sometimes be compared without relying on the actions, like e.g. Vogel & Jurafsky (2010), but for other types of instructions such a hard-coded comparison may be infeasible. Tellex et al. (2011) train a log-linear model to map instruction constituents into their groundings, which can be objects, places, state sequences, etc. Their approach requires access to a structured representation of the world environment as well as intermediate supervision for grounding the constituents.
120
+
121
+ Our work can be categorized as apprenticeship (imitation) learning, which studies learning to perform tasks from demonstrations and feedback. Many approaches to apprenticeship learning are variants of inverse reinforcement learning (IRL), which aims to recover a reward function from expert demonstrations (Abbeel & Ng, 2004; Ziebart et al., 2008). As stated at the end of Section 2, the method most closely related to AGILE is the GAIL algorithm from the IRL family (Ho & Ermon, 2016). There have been earlier attempts to use IRL-style methods for instruction following (MacGlashan et al., 2015; Williams et al., 2018), but unlike AGILE, they relied on the availability of a formal reward specification language. To our knowledge, ours and the concurrent work by Fu et al. (2018) are the first works to showcase learning reward models for instructions from pixels directly. Besides IRL-style approaches, other apprenticeship learning methods involve training a policy (Knox & Stone, 2009; Warnell et al., 2017) or a reward function (Wilson et al., 2012; Christiano et al., 2017) directly from human feedback. Several recent imitation learning works consider using goal-states directly for defining the task (Ganin et al., 2018; Pathak et al., 2018). AGILE differs from these approaches in that goal-states are only used to train the reward module, which we show generalises to new environment configurations or instructions, relative to those seen in the expert data.
122
+
123
+ # 5 DISCUSSION
124
+
125
+ We have proposed AGILE, a framework for training instruction-conditional RL agents using rewards from learned reward models, which are jointly trained from data provided by both experts and the agent being trained, rather than reward provided by an instruction interpreter within the environment. This opens up new possibilities for training language-aware agents: in the real world, and even in rich simulated environments (Brodeur et al., 2017; Wu et al., 2018), acquiring such data via human annotation would often be much more viable than defining and implementing reward functions programmatically. Indeed, programming rewards to teach robust and general instruction-following may ultimately be as challenging as writing a program to interpret language directly, an endeavour that is notoriously laborious (Winograd, 1971), and some say, ultimately futile (Winograd, 1972).
126
+
127
+ As well as a means to learn from a potentially more prevalent form of data, our experiments demonstrate that policies trained in the AGILE framework perform comparably with and can learn as fast as those trained against ground-truth reward and additional auxiliary tasks. Our analysis of the reward model’s classifications gives a sense of how this is possible; the false positive decisions that it makes early in the training help the policy to start learning. The fact that AGILEs objective attenuates learning issues due to the sparsity of reward states within episodes in a manner similar to reward prediction suggests that the reward model within AGILE learns some form of shaped reward $( \mathrm { N g }$ et al., 1999), and could serve not only in the cases where a reward function need to be learned in the absence of true reward, but also in cases where environment reward is defined but sparse. As these cases are not the focus of this study, we note this here, but leave such investigation for future work.
128
+
129
+ As the policy improves, false negatives can cause the reward model accuracy to deteriorate. We determined a simple method to mitigate this, however, leading to robust training that is comparable to RL with reward prediction and unlimited access to a perfect reward function. Another attractive aspect of AGILE is that learning “what should be done” and “how it should be done” is performed by two different model components. Our experiments confirm that the “what” kind of knowledge generalizes better to new environments. When the dynamics of the environment changed at test time, fine-tuning using frozen reward model allowed to the policy recover some of its original capability in the new setting.
130
+
131
+ While there is a large gap to be closed between the sort of tasks and language experimented with in this paper and those which might be presented in “real world” situations or more complex environments, our results provide an encouraging first step in this direction. Indeed, it is interesting to consider how AGILE could be applied to more realistic learning settings, for instance involving first-person vision of 3D environments. Two issues would need to be dealt with, namely training the agent to factor out the difference in perspective between the expert data and the agent’s observations, and training the agent to ignore its own body parts if they are visible in the observations. Future work could focus on applying third-person imitation learning methods recently proposed by Stadie et al. (2017) learn the aforementioned invariances. Most of our experiments were conducted with a formal language with a known structure, however AGILE also performed very well when we used a structure-agnostic FiLM-LSTM model which processed the instruction as a plain sequence of tokens. This result suggest that in future work AGILE could be used with natural language instructions.
132
+
133
+ # ACKNOWLEDGMENTS
134
+
135
+ The authors want to thank Serkan Cabi for providing useful feedback. This research was enabled in part by support provided by Compute Canada (www.computecanada.ca).
136
+
137
+ # REFERENCES
138
+
139
+ Pieter Abbeel and Andrew Y. Ng. Apprenticeship Learning via Inverse Reinforcement Learning. In Proceedings of the Twenty-first International Conference on Machine Learning, ICML ’04, 2004. URL http://doi.acm.org/10.1145/1015330.1015430.
140
+
141
+ Jacob Andreas and Dan Klein. Alignment-Based Compositional Semantics for Instruction Following. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, 2015.
142
+
143
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural Module Networks. In Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. URL http://arxiv.org/abs/1511.02799.
144
+
145
+ Yoav Artzi and Luke Zettlemoyer. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association for Computational Linguistics, 1:49–62, 2013.
146
+
147
+ Simon Brodeur, Ethan Perez, Ankesh Anand, Florian Golemo, Luca Celotti, Florian Strub, Jean Rouat, Hugo Larochelle, and Aaron Courville. HoME: a Household Multimodal Environment. arXiv:1711.11017 [cs, eess], November 2017. URL http://arxiv.org/abs/1711. 11017. arXiv: 1711.11017.
148
+
149
+ Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-Attention Architectures for Task-Oriented Language Grounding. In Proceedings of 32nd AAAI Conference on Artificial Intelligence, 2018. URL http://arxiv.org/abs/1706.07230.
150
+
151
+ David L. Chen and Raymond J. Mooney. Learning to Interpret Natural Language Navigation Instructions from Observations. In Proceedings of the Twenty-Fifth AAAI Conference on Artificial Intelligence, pp. 859–865, 2011. URL http://dl.acm.org/citation.cfm?id= 2900423.2900560.
152
+
153
+ Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, pp. 4302–4310, 2017.
154
+
155
+ Misha Denil, Sergio Gmez Colmenarejo, Serkan Cabi, David Saxton, and Nando de Freitas. Programmable Agents. arXiv:1706.06383 [cs, stat], June 2017. URL http://arxiv.org/abs/ 1706.06383.
156
+
157
+ Justin Fu, Anoop Korattikara, Sergey Levine, and Sergio Guadarrama. From Language to Goals: Inverse Reinforcement Learning for Vision-Based Instruction Following. In International Conference on Learning Representations, September 2018. URL https://openreview.net/ forum?id ${ \bf \Phi } = { \bf \Phi }$ r1lq1hRqYQ.
158
+
159
+ Yaroslav Ganin, Tejas Kulkarni, Igor Babuschkin, S. M. Ali Eslami, and Oriol Vinyals. Synthesizing Programs for Images using Reinforced Adversarial Learning. arXiv:1804.01118 [cs, stat], April 2018. URL http://arxiv.org/abs/1804.01118. arXiv: 1804.01118.
160
+
161
+ Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojciech Marian Czarnecki, Max Jaderberg, Denis Teplyashin, Marcus Wainwright, Chris Apps, Demis Hassabis, and Phil Blunsom. Grounded Language Learning in a Simulated 3d World. arXiv:1706.06551 [cs, stat], June 2017. URL http://arxiv.org/abs/1706. 06551.
162
+
163
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
164
+
165
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z. Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement Learning with Unsupervised Auxiliary Tasks. In ICLR, November 2016. URL http://arxiv.org/abs/1611.05397.
166
+
167
+ Michael Janner, Karthik Narasimhan, and Regina Barzilay. Representation Learning for Grounded Spatial Reasoning. Transactions of the Association for Computational Linguistics, July 2017. URL http://arxiv.org/abs/1707.03938.
168
+
169
+ W Bradley Knox and Peter Stone. Interactively shaping agents via human reinforcement: The TAMER framework. In International Conference on Knowledge Capture, pp. 9–16, 2009.
170
+
171
+ James MacGlashan, Monica Babes-Vroman, Marie desJardins, Michael L. Littman, Smaranda Muresan, Shawn Squire, Stefanie Tellex, Dilip Arumugam, and Lei Yang. Grounding english commands to reward functions. In Robotics: Science and Systems, 2015.
172
+
173
+ Hongyuan Mei, Mohit Bansal, and Matthew R. Walter. Listen, Attend, and Walk: Neural Mapping of Navigational Instructions to Action Sequences. In Proceedings of the AAAI Conference on Artificial Intelligence, 2016. URL http://arxiv.org/abs/1506.04089.
174
+
175
+ Dipendra Misra, John Langford, and Yoav Artzi. Mapping Instructions and Visual Observations to Actions with Reinforcement Learning. In arXiv:1704.08795 [cs], April 2017. URL http: //arxiv.org/abs/1704.08795.
176
+
177
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
178
+
179
+ Andrew Y. Ng and Stuart Russell. Algorithms for Inverse Reinforcement Learning. In in Proc. 17th International Conf. on Machine Learning, pp. 663–670. Morgan Kaufmann, 2000.
180
+
181
+ Andrew Y Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
182
+
183
+ Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-Shot Task Generalization with Multi-Task Deep Reinforcement Learning. In Proceedings of The 34st International Conference on Machine Learning, June 2017. URL http://arxiv.org/abs/1706.05064.
184
+
185
+ Deepak Pathak, Parsa Mahmoudieh, Guanghao Luo, Pulkit Agrawal, Dian Chen, Yide Shentu, Evan Shelhamer, Jitendra Malik, Alexei A. Efros, and Trevor Darrell. Zero-shot visual imitation. In International Conference on Learning Representations, 2018.
186
+
187
+ Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual Reasoning with a General Conditioning Layer. In In Proceedings of the AAAI Conference on Artificial Intelligence, 2017. URL http://arxiv.org/abs/1709.07871.
188
+
189
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014. URL http://www.jmlr.org/papers/volume15/ srivastava14a.old/source/srivastava14a.pdf.
190
+
191
+ Bradly C. Stadie, Pieter Abbeel, and Ilya Sutskever. Third-Person Imitation Learning. In ICLR, March 2017. URL http://arxiv.org/abs/1703.01703.
192
+
193
+ Stefanie Tellex, Thomas Kollar, Steven Dickerson, Matthew R. Walter, Ashis Gopal Banerjee, Seth Teller, and Nicholas Roy. Understanding Natural Language Commands for Robotic Navigation and Mobile Manipulation. In Twenty-Fifth AAAI Conference on Artificial Intelligence, August 2011. URL https://www.aaai.org/ocs/index.php/AAAI/AAAI11/paper/ view/3623.
194
+
195
+ Adam Vogel and Dan Jurafsky. Learning to Follow Navigational Directions. In Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics, pp. 806–814. Association for Computational Linguistics, 2010. URL http://dl.acm.org/citation.cfm?id= 1858681.1858764.
196
+
197
+ Garrett Warnell, Nicholas Waytowich, Vernon Lawhern, and Peter Stone. Deep TAMER: Interactive agent shaping in high-dimensional state spaces. arXiv preprint arXiv:1709.10163, 2017.
198
+
199
+ Edward C Williams, Nakul Gopalan, Mine Rhee, and Stefanie Tellex. Learning to parse natural language to grounded reward functions with weak supervision. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1–7. IEEE, 2018.
200
+
201
+ Aaron Wilson, Alan Fern, and Prasad Tadepalli. A Bayesian approach for policy learning from trajectory preference queries. In Advances in Neural Information Processing Systems, pp. 1133– 1141, 2012.
202
+
203
+ Terry Winograd. Procedures as a representation for data in a computer program for understanding natural language. Technical report, 1971.
204
+
205
+ Terry Winograd. Understanding natural language. Cognitive Psychology, 3(1):1–191, 1972. doi: 10. 1016/0010-0285(72)90002-3. URL http://linkinghub.elsevier.com/retrieve/ pii/0010028572900023.
206
+
207
+ Yi Wu, Yuxin Wu, Georgia Gkioxari, and Yuandong Tian. Building Generalizable Agents with a Realistic and Rich 3d Environment. arXiv:1801.02209 [cs], January 2018. URL http: //arxiv.org/abs/1801.02209. arXiv: 1801.02209.
208
+
209
+ Haonan Yu, Haochao Zhang, and Wei Xu. Interactive Grounded Language Acquisition and Generalization in 2d Environment. In ICLR, 2018. URL https://openreview.net/forum?id= H1UOm4gA-&noteId=H1UOm4gA-.
210
+
211
+ Brian D. Ziebart, Andrew Maas, J. Andrew Bagnell, and Anind K. Dey. Maximum Entropy Inverse Reinforcement Learning. In Proc. AAAI, pp. 1433–1438, 2008.
212
+
213
+ # A AGILE PSEUDOCODE
214
+
215
+ # Algorithm 1 AGILE Discriminator Training
216
+
217
+ Require: The policy network $\pi _ { \theta }$ , the discriminator network $D _ { \phi }$ , the anticipated negative rate $\rho$ , a dataset $\mathcal { D }$ , a replay buffer $B$ , the batch size $B S$ , a stream of training instances $\mathcal { G }$ , the episode length $T$ , the rollout length $R$ .
218
+ 1: while Not Converged do
219
+ 2: 3: Sample a training instance $( c , s _ { 0 } ) \in \mathcal { G }$ . $t \gets 0$ while $\mathfrak { t } \mathfrak { j }$ T do
220
+ 5: Act with $\pi _ { \boldsymbol { \theta } } ( c , s )$ and produce a rollout $\big ( c , s _ { t \dots t + R } \big )$ .
221
+ 6: Add $( c , s )$ pairs from $\big ( c , s _ { t . . . t + R } \big )$ to the replay buffer $B$ . Remove old pairs from $B$ if it is overflowing.
222
+ 7: Sample a batch $D _ { + }$ of $B S / 2$ positive examples from $\mathcal { D }$ .
223
+ 8: Sample a batch $D _ { - }$ of $B S / ( 2 \cdot ( 1 - \rho ) )$ negative $( c , s )$ examples from $B$ .
224
+ 9: Compute $\kappa = D _ { \phi } ( c , s )$ for all $( c , s ) \in D _ { - }$ and reject the top $1 - \rho$ percent of $D _ { - }$ with the highest $\kappa$ . The resulting $D _ { - }$ will contain $B S / 2$ examples.
225
+ 10: Compute L˜D(φ) = 1BS $\begin{array} { r } { \tilde { L } _ { D } ( \phi ) = \frac { 1 } { B S } \displaystyle \sum _ { ( c , s ) \in D _ { - } } - \log ( 1 - D _ { \phi } ( c , s ) ) + \displaystyle \sum _ { ( c , g ) \in D _ { + } } - \log D _ { \phi } ( c _ { i } , g _ { i } ) . } \end{array}$
226
+ 11: Compute the gradient $\frac { d \tilde { L } _ { D } ( \phi ) } { d \phi }$ and use it to update $\phi$ .
227
+ 12: Synchronise $\theta$ and $\phi$ with other workers.
228
+ 13: $t \gets t + R$
229
+ 14: end while
230
+ 15: end while
231
+
232
+ # Algorithm 2 AGILE Policy Training
233
+
234
+ Require: The policy network $\pi \theta$ , the discriminator network $D _ { \phi }$ , a dataset $\mathcal { D }$ , a replay buffer $B$ , a stream of
235
+ training instances $\mathcal { G }$ , the episode length $T$ .
236
+ 1: while Not Converged do
237
+ 2: Sample a training instance $( c , s _ { 0 } ) \in \mathcal { G }$ .
238
+ 3: $t \gets 0$
239
+ 4: while $\mathfrak { t } \mathfrak { j }$ T do
240
+ 5: Act with $\pi _ { \boldsymbol { \theta } } ( c , s )$ and produce a rollout $\big ( c , s _ { t \dots t + R } \big )$ .
241
+ 6: Use the discriminator $D _ { \phi }$ to compute the rewards $r _ { \tau } = [ D _ { \phi } ( c , s _ { \tau } ) > 0 . 5$ ].
242
+ 7: Perform an RL update for $\theta$ using the rewards $r _ { \tau }$ .
243
+ 8: Synchronise $\theta$ and $\phi$ with other workers.
244
+ 9: $t \gets t + R$
245
+ 10: end while
246
+ 11: end while
247
+
248
+ # B TRAINING DETAILS
249
+
250
+ We trained the policy $\pi _ { \theta }$ and the discriminator $D _ { \phi }$ concurrently using RMSProp as the optimizer and Asynchronous Advantage Actor-Critic (A3C) (Mnih et al., 2016) as the RL method. A baseline predictor (see Appendix G for details) was trained to predict the discounted return by minimizing the mean square error. The RMSProp hyperparameters were different for $\pi _ { \theta }$ and $D _ { \phi }$ , see Table 1. A designated worker was used to train the discriminator (see Algorithm 1). Other workers trained only the policy (see Algorithm 2). We tried having all workers write to the replay buffer $B$ that was used for the discriminator training and found that this gave the same performance as using $( c , s )$ pairs produced by the discriminator worker only. We found it crucial to regularize the discriminator by clipping columns of all weights matrices to have the L2 norm of at most 1. In particular, we multiply incoming weights $w _ { u }$ of each unit $u$ by $\operatorname* { m i n } ( 1 , 1 / | | w _ { u } | | _ { 2 } )$ after each gradient update as proposed by Srivastava et al. (2014). We linearly rescaled the policy’s rewards to the $[ 0 ; 0 . 1 ]$ interval for both RL and AGILE. When using RL with reward prediction we fetch a batch from the replay buffer and compute the extra gradient for every rollout.
251
+
252
+ For the exact values of hyperparameters for the GridLU-Relations task we refer the reader to Table 1. The hyperparameters for GridLU-Arrangements were mostly the same, with the exception of the episode length and the rollout length, which were 45 and 30 respectively. For training the RL baseline for GridLU-Relations we used the same hyperparameter settings as for the AGILE policy.
253
+
254
+ Table 1: Hyperparameters for the policy and the discriminator for the GridLU-Relations task.
255
+
256
+ <table><tr><td>Group</td><td>Hyperparameter</td><td>Policy T</td><td>Discriminator DΦ</td></tr><tr><td rowspan="5">RMSProp</td><td>learning rate</td><td>0.0003</td><td>0.0005</td></tr><tr><td>decay</td><td>0.99</td><td>0.9</td></tr><tr><td>E</td><td>0.1</td><td>10-10</td></tr><tr><td>grad. norm threshold</td><td>40</td><td>25</td></tr><tr><td>batch size</td><td>1</td><td>256</td></tr><tr><td rowspan="6">RL</td><td>rollout length</td><td>15</td><td>一</td></tr><tr><td>episode length</td><td>30</td><td></td></tr><tr><td>discount</td><td>0.99</td><td></td></tr><tr><td>reward scale</td><td>0.1</td><td></td></tr><tr><td>baseline cost</td><td>1.0</td><td></td></tr><tr><td>reward prediction cost (when used)</td><td>1.0</td><td></td></tr><tr><td rowspan="2"></td><td>reward prediction batch size</td><td>4</td><td></td></tr><tr><td>num. workers training πθ</td><td>15</td><td>1</td></tr><tr><td rowspan="2">AGILE</td><td>size of replay buffer B</td><td></td><td>100000</td></tr><tr><td>num. workers training D</td><td></td><td>1</td></tr><tr><td rowspan="2">Regularization</td><td>entropy weight α</td><td>0.01</td><td></td></tr><tr><td>max.column norm</td><td>一</td><td>1</td></tr></table>
257
+
258
+ # C GRIDLU ENVIRONMENT
259
+
260
+ The GridLU world is a $5 \times 5$ gridworld surrounded by walls. The cells of the grid can be occupied by blocks of 3 possible shapes (circle, triangle, and square) and 3 possible colors (red, blue, and green). The grid also contains an agent sprite. The agent may carry a block; when it does so, the agent sprite changes color2. When the agent is free, i.e. when it does not carry anything, it is able to enter cells with blocks. A free agent can pick a block in the cell where both are situated. An agent that carries a block cannot enter non-empty cells, but it can instead drop the block that it carries in any non-empty cell. Both picking up and dropping are realized by the INTERACT action. Other available actions are LEFT, RIGHT, UP and DOWN and NOOP. The GridLU agent can be seen as a cursor (and this is also how it is rendered) that can be moved to select a block or a position where the block should be released. Figure 6 illustrates the GridLU world and its dynamics. We render the state of the world as a color image by displaying each cell as an $8 \times 8$ patch3 and stitching these patches in a $5 6 \times 5 6$ image4. All neural networks take this image as an input.
261
+
262
+ # D EXPERIMENT DETAILS
263
+
264
+ Every experiment was repeated 5 times and the average result is reported.
265
+
266
+ RL vs. AGILE All agents were trained for $5 \cdot 1 0 ^ { 8 }$ steps.
267
+
268
+ Data Efficiency We trained AGILE policies with datasets $\mathcal { D }$ of different sizes for $5 \cdot 1 0 ^ { 8 }$ steps. For each policy we report the maximum success rate that it showed in the course of training.
269
+
270
+ GridLU-Arrangements We trained the agent for 100M time steps, saving checkpoints periodically, and selected the checkpoint that best fooled the discriminator according to the agent’s internal reward.
271
+
272
+ ![](images/12a0250876976a70960bac26e489bbd937d4fe99d9cd1f5858afab85a8ce8779.jpg)
273
+ Figure 6: The dynamics of the GridLU world illustrated by a 6-step trajectory. The order of the states is indicated by arrows. The agent’s actions are written above arrows.
274
+
275
+ ![](images/c88d0530b92562c4ac9494853f2e5d902ffac1c59f458c306a94a2da6a6f7ad0.jpg)
276
+ Figure 7: Performance of AGILE for different sizes of the dataset of instructions and goal-states. For each dataset size of we report is the best average success rate over the course of training.
277
+
278
+ Data Efficiency We measure how many examples of instructions and goal-states are required by AGILE in order to understand the semantics of the GridLU-Relations instruction language. The results are reported in Figure 7. The AGILE-trained agent succeeds in more than $50 \%$ of cases starting from 8000 examples, but as many as 130000 is required for the best performance.
279
+
280
+ # E ANALYSIS OF THE GRIDLU-RELATIONS TASK
281
+
282
+ # E.1 GRIDLU RELATIONS INSTANCE GENERATOR
283
+
284
+ All GridLU instructions can be generated from <instruction $>$ using the following Backus-Naur form, with one exception: The first expansion of ${ < } \mathrm { { o b j } } >$ must not be identical to the second expansion of ${ < } \mathrm { { o b j } } >$ in <bring to instruction>.
285
+
286
+ <shape> :: $=$ circle | rect | triangle <color> :: $=$ red | green | blue
287
+
288
+ <relation1> :: $=$ NorthFrom | SouthFrom | EastFrom | WestFrom <relation2> :: $=$ <relation1> | SameLocation
289
+
290
+ <obj> :: $=$ Color(<color>, <obj_part $2 >$ ) | Shape(<shape>, SCENE) <obj_part2> :: $=$ Shape(<shape>, SCENE) | SCENE
291
+
292
+ <go_to_instruction> :: $=$ <relation2 $>$ (AGENT, <obj>) | <relation2 $>$ (<obj>, AGENT) <bring_to_instruction> :: $=$ <relation1 $>$ (<obj>, <obj>) <instruction> :: $=$ <go_to_instruction> | <bring_to_instruction>
293
+
294
+ There are 15 unique possibilities to expand the nonterminal ${ < } \mathrm { { o b j } } >$ , so there are 150 unique possibilities to expand <go to instruction> and 840 unique possibilities to expand <bring to instruction> (not counting the exceptions mentioned above). Hence there are 990 unique instructions in total. However, several syntactically different instructions can be semantically equivalent, such as EastFrom(AGENT, Shape(rect, SCENE)) and WestFrom(Shape(rect, SCENE), AGENT).
295
+
296
+ Every instruction partially specifies what kind of objects need to be available in the environment. For go-to-instructions we generate one object and for bring-to-instructions we generate two objects according to this partial specification (unspecified shapes or colors are picked uniformly at random). Additionally, we generate one “distractor object”. This distractor object is drawn uniformly at random from the 9 possible objects. All of these objects and the agent are each placed uniformly at random into one of 25 cells in the 5x5 grid.
297
+
298
+ The instance generator does not sample an instruction uniformly at random from a list of all possible instructions. Instead, it generates the environment at the same time as the instruction according to the procedure above. Afterwards we impose two ‘sanity checks’: are any two objects in the same location or are they all identical? If any of these two checks fail, the instance is discarded and we start over with a new instance.
299
+
300
+ Because of this rejection sampling technique, go-to-instructions are ultimately generated with approximately $2 5 \%$ probability even though they only represent $\approx 1 5 \%$ of all possible instructions.
301
+
302
+ The number of different initial arrangements of three objects can be lower-bounded by ${ \binom { 9 } { 3 } } = 2 3 0 0$ if we disregard their permutation. Hence every bring-to-instruction has at least $K = 2 3 0 0 \cdot 9 \approx 2 \cdot 1 0 ^ { 4 }$ associated initial arrangements. Therefore the total number of task instances can be lower-bounded with $8 4 0 \cdot K \approx 1 . 7 \cdot 1 \bar { 0 } ^ { 7 }$ , disregarding the initial position of the agent.
303
+
304
+ # E.2 DISCRIMINATOR EVALUATION
305
+
306
+ During the training on GridLU-Relations we compared the predictions of the discriminator with those of the ground-truth reward checker. This allowed us to monitor several performance indicators of the discriminator, see Figure 8.
307
+
308
+ ![](images/53291bcc68bf3c2ec5c30716cb671107ce129a7f067fbe67d0e2bc3a1d397656.jpg)
309
+ Figure 8: The discriminator’s errors in the course of training. Left: percentage of false positives. Right: percentage of false negatives.
310
+
311
+ # F ANALYSIS OF THE GRIDLU-ARRANGEMENTS TASK
312
+
313
+ Instruction Syntax We used two types of instructions in the GridLU-Arrangements task, those referring only to the arrangement and others that also specified the color of the blocks. Examples Connected(AGENT, SCENE) and Snake(AGENT, Color(’yellow’, SCENE)) illustrate the syntax that we used for both instruction types.
314
+
315
+ Number of Distinct Goal-States Table 2 presents our computation of the number of distinct goal-states in the GridLU-Arrangements Task.
316
+
317
+ Table 2: Number of unique goal-states in GridLU-Arrangements task.
318
+
319
+ <table><tr><td></td><td>Possible arrangement</td><td>Possible colors</td><td>Possible agent positions</td><td>Possible distractor positions</td><td>Possible distractor colors</td><td></td></tr><tr><td>Arrangement</td><td>positions 16</td><td>3</td><td>25</td><td>5985</td><td></td><td>Total goal states 14,364,000</td></tr><tr><td>Square Line</td><td>40</td><td>3</td><td>25</td><td>5985</td><td>22</td><td>35,910,000</td></tr><tr><td>Dline</td><td>8</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>7,182,000</td></tr><tr><td>Triangle</td><td>48</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>43,092,000</td></tr><tr><td>Circle</td><td>9</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>8,079,750</td></tr><tr><td>Eel</td><td>48</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>43,092,000</td></tr><tr><td>Snake</td><td>48</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>43,092,000</td></tr><tr><td>Connected</td><td>200</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>179,550,000</td></tr><tr><td>Disconnected</td><td>17</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>15,261,750</td></tr></table>
320
+
321
+ Total
322
+
323
+ # G MODELS
324
+
325
+ ![](images/f9eddfd19899cbf466aa60efadf087a24d728a490ba73e4889eac47ccc502489.jpg)
326
+ Figure 9: Our policy and discriminator networks with a Neural Module Network (NMN) as the core component. The NMN’s structure corresponds to an instruction WestFrom(Color(‘red’, Shape(‘rect’, SCENE)), Color(‘yellow’, Shape(‘triangle’, SCENE))). The modules are depicted as blue rectangles. Subexpressions Color(’red’, ...), Shape(’rect’, ...), etc. are depicted as “red” and “rect” to save space. The bottom left of the figure illustrates the computation of a module in our variant of NMN.
327
+
328
+ In this section we explain in detail the neural architectures that we used in our experiments. We will use $^ *$ to denote convolution, $\odot$ , $\oplus$ to denote element-wise addition of a vector to a 3D tensor with broadcasting (i.e. same vector will be added/multiplied at each location of the feature map). We used ReLU as the nonlinearity in all layers with the exception of LSTM.
329
+
330
+ FiLM-NMN We will first describe the FiLM-NMN discriminator $D _ { \phi }$ . The discriminator takes a 56x56 RGB image $s$ as the representation of the state. The image $s$ is fed through a stem convnet that consisted of an $8 x 8$ convolution with 16 kernels and a $3 { \tt x } 3$ convolution with 64 kernels. The resulting tensor $h _ { s t e m }$ had a 5x5x64 shape.
331
+
332
+ As a Neural Module Metwork (Andreas et al., 2016), the FiLM-NMN is constructed of modules. The module $m _ { x }$ corresponding to a token $x$ takes a left-hand side input $h _ { l }$ and a right-hand side input $h _ { r }$ and performs the following computation with them:
333
+
334
+ $$
335
+ m _ { x } ( h _ { l } , h _ { r } ) = R e L U ( ( 1 + \gamma _ { x } ) \odot ( W _ { m } * [ h _ { l } ; h _ { r } ] ) \oplus \beta _ { x } ) ,
336
+ $$
337
+
338
+ where $\gamma _ { x }$ and $\beta _ { x }$ are FiLM coefficients (Perez et al., 2017) corresponding to the token $x$ , $W _ { m }$ is a weight tensor for a 3x3 convolution with 128 input features and 64 output features. Zero-padding is used to ensure that the output of $m _ { x }$ has the same shape as $h _ { l }$ and $h _ { r }$ . The equation above describes a binary module that takes two operands. For the unary modules that received only one input (e.g. $m _ { r e d }$ , $m _ { s q u a r e , \rangle }$ ) we present the input as $h _ { l }$ and zeroed out $h _ { r }$ . This way we are able to use the same set of weights $W _ { m }$ for all modules. We have 12 modules in total, 3 for color words, 3 for shape words, 5 for relations words and one $m _ { A G E N T }$ module used in go-to instructions. The modules are selected and connected based on the instructions, and the output of the root module is used for further processing. For example, the following computation would be performed for the instruction $c _ { 1 } =$ NorthFrom(Color(‘red’, Shape(‘circle’, SCENE)), Color(‘blue’, Shape(‘square’, SCENE))):
339
+
340
+ $$
341
+ h _ { n m n } = m _ { N o r t h F r o m } ( m _ { r e d } ( m _ { c i r c l e } ( h _ { s t e m } ) ) , m _ { b l u e } ( m _ { s q u a r e } ( h _ { s t e m } ) ) ) ,
342
+ $$
343
+
344
+ and the following one for $c _ { 2 } = { }$ NorthFrom(AGENT, Shape(‘triangle’, SCENE)):
345
+
346
+ $$
347
+ h _ { n m n } = m _ { N o r t h F r o m } ( m _ { A G E N T } ( h _ { s t e m } ) , m _ { t r i a n g l e } ( h _ { s t e m } ) ) .
348
+ $$
349
+
350
+ Finally, the output of the discriminator is computed by max-pooling the output of the FiLM-NMN across spatial dimensions and feeding it to an MLP with a hidden layer of 100 units:
351
+
352
+ $$
353
+ \begin{array} { r } { D ( c , s ) = \sigma ( w ^ { T } R e L U ( W \mathrm { m a x p o o l } ( h _ { n m n } ) + b ) ) , } \end{array}
354
+ $$
355
+
356
+ where $w$ , $W$ and $b$ are weights and biases, $\sigma ( x ) = e ^ { x } / ( 1 + e ^ { x } )$ is the sigmoid function.
357
+
358
+ The policy network $\pi _ { \phi }$ is similar to the discriminator network $D _ { \theta }$ . The only difference is that (1) it outputs softmax probabilites for 5 actions instead of one real number (2) we use an additional convolutional layer to combine the output of FiLM-NMN and $h _ { s t e m }$ :
359
+
360
+ $$
361
+ \begin{array} { r } { h _ { m e r g e } = R e L U ( W _ { m e r g e } * [ h _ { n m n } ; h _ { s t e m } ] + b _ { m e r g e } ) , } \\ { \pi ( c , s ) = \mathrm { s o f t m a x } ( W _ { 2 } R e L U ( W _ { 1 } \mathrm { m a x p o o l } ( h _ { m e r g e } ) + b _ { 1 } ) + b _ { 2 } ) , } \end{array}
362
+ $$
363
+
364
+ the output $h _ { m e r g e }$ of which is further used in the policy network instead of $h _ { n m n }$ .
365
+
366
+ Figure 9 illustrates our FiLM-NMN policy and discriminator networks.
367
+
368
+ FiLM-LSTM For our structure-agnostic models we use an LSTM of 100 hidden units to predict FiLM biases and multipliers for a 5 layer convnet. More specifically, let $h _ { L S T M }$ be the final state of the LSTM after it consumes the instruction $c$ . We compute the FiLM coefficients for the layer $k \in [ 1 ; 5 ]$ as follows:
369
+
370
+ $$
371
+ \begin{array} { r } { \gamma _ { k } = W _ { k } ^ { \gamma } h _ { L S T M } + b _ { k } ^ { \gamma } , } \\ { \beta _ { k } = W _ { k } ^ { \beta } h _ { L S T M } + b _ { k } ^ { \beta } , } \end{array}
372
+ $$
373
+
374
+ and use them as described by the equation below:
375
+
376
+ $$
377
+ h _ { k } = R e L U ( ( 1 + \gamma _ { k } ) \odot ( W _ { k } * h _ { k - 1 } ) \oplus \beta _ { k } ) ,
378
+ $$
379
+
380
+ where $W _ { k }$ are the convolutional weights, $h _ { 0 }$ is set to the pixel-level representation of the world state $s$ . The characteristics of the 5 layers were the following: (8x8, 16, VALID), (3x3, 32, VALID), (3x3, 64, SAME), (3x3, 64, SAME), (3x3, 64, SAME), where (mxm, $n _ { o u t } , p )$ stands for a convolutional layer with mxm filters, $n _ { o u t }$ output features, and $p \in \{ \mathrm { S A M E } , \mathrm { V A L I D } \}$ padding strategy. Layers with $p = { \tt V A L I D }$ do not use padding, whereas in those with $p = \mathsf { S A M E }$ zero padding is added in order to produce an output with the same shape as the input. The layer 5 is also connected to layer 3 by a residual connection. Similarly to FiLM-NMN, the output $h _ { 5 }$ of the convnet is max-pooled and fed into an MLP with 100 hidden units to produce the outputs:
381
+
382
+ $$
383
+ \begin{array} { r } { D ( c , s ) = \sigma ( w ^ { T } R e L U ( W m a x p o o l ( h _ { 5 } ) + b ) ) , } \\ { \pi ( c , s ) = \mathrm { s o f t m a x } ( W _ { 2 } R e L U ( W _ { 1 } \mathrm { m a x p o o l } ( h _ { 5 } ) + b _ { 1 } ) + b _ { 2 } ) . } \end{array}
384
+ $$
385
+
386
+ Baseline prediction In all policy networks the baseline predictor is a linear layer that took the same input as the softmax layer. The gradients of the baseline predictor are allowed to propagate through the rest of the network.
387
+
388
+ Reward prediction We use the result $h _ { m a x p o o l }$ of the max-pooling operation (which was a part of all models that we considered) as the input to the reward prediction pathway of our model. hmaxpool is fed through a linear layer and softmax to produce probabilities of the reward being positive or zero (the reward is never negative in AGILE).
389
+
390
+ Weight Initialization We use the standard initialisation methods from the Sonnet library5. Bias vectors are initialised with zeros. Weights of fully-connected layers are sampled from a truncated normal distribution with $\begin{array} { r } { \sigma = \frac { 1 } { \sqrt { n _ { i n } } } } \end{array}$ , where $n _ { i n }$ is the number of input units of the layer. Convolutional weights are sampled from a truncated normal distribution with $\begin{array} { r } { \sigma = \frac { 1 } { \sqrt { f a n _ { i n } } } } \end{array}$ where $f a n _ { i n }$ is the product of kernel width, kernel height and the number of input features.
md/train/HJeOekHKwr/HJeOekHKwr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/Hk3mPK5gg/Hk3mPK5gg.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRAINING AGENT FOR FIRST-PERSON SHOOTERGAME WITH ACTOR-CRITIC CURRICULUM LEARNING
2
+
3
+ Yuxin Wu Carnegie Mellon University ppwwyyxx@gmail.com
4
+
5
+ Yuandong Tian Facebook AI Research yuandong@fb.com
6
+
7
+ # ABSTRACT
8
+
9
+ In this paper, we propose a new framework for training vision-based agent for First-Person Shooter (FPS) Game, in particular Doom. Our framework combines the state-of-the-art reinforcement learning approach (Asynchronous Advantage Actor-Critic (A3C) model [Mnih et al. (2016)]) with curriculum learning. Our model is simple in design and only uses game states from the AI side, rather than using opponents’ information [Lample & Chaplot (2016)]. On a known map, our agent won 10 out of the 11 attended games and the champion of Track1 in ViZDoom AI Competition 2016 by a large margin, $3 5 \%$ higher score than the second place.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Deep Reinforcement Learning has achieved super-human performance in fully observable environments, e.g., in Atari Games [Mnih et al. (2015)] and Computer Go [Silver et al. (2016)]. Recently, Asynchronous Advantage Actor-Critic (A3C) [Mnih et al. (2016)] model shows good performance for 3D environment exploration, e.g. labyrinth exploration. However, in general, to train an agent in a partially observable 3D environment from raw frames remains an open challenge. Direct application of A3C to competitive 3D scenarios, e.g. 3D games, is nontrivial, partly due to sparse and long-term rewards in such scenarios.
14
+
15
+ Doom is a 1993 First-Person Shooter (FPS) game in which a player fights against other computercontrolled agents or human players in an adversarial 3D environment. Previous works on FPS AI [van Waveren (2001)] focused on using hand-tuned state machines and privileged information, e.g., the geometry of the map, the precise location of all players, to design playable agents. Although state-machine is conceptually simple and computationally efficient, it does not operate like human players, who only rely on visual (and possibly audio) inputs. Also, many complicated situations require manually-designed rules which could be time-consuming to tune.
16
+
17
+ In this paper, we train an AI agent in Doom with a framework that based on A3C with convolutional neural networks (CNN). This model uses only the recent 4 frames and game variables from the AI side, to predict the next action of the agent and the value of the current situation. We follow the curriculum learning paradigm [Bengio et al. (2009); Jiang et al. (2015)]: start from simple tasks and then gradually try harder ones. The difficulty of the task is controlled by a variety of parameters in Doom environment, including different types of maps, strength of the opponents and the design of the reward function. We also develop adaptive curriculum training that samples from a varying distribution of tasks to train the model, which is more stable and achieves higher score than A3C with the same number of epoch. As a result, our trained agent, named $F l$ , won the champion in Track 1 of ViZDoom Competition 1 by a large margin.
18
+
19
+ There are many contemporary efforts on training a Doom AI based on the VizDoom platform [Kempka et al. (2016)] since its release. Arnold [Lample & Chaplot (2016)] also uses game frames and trains an action network using Deep Recurrent Q-learning [Hausknecht & Stone (2015)], and a navigation network with DQN [Mnih et al. (2015)]. However, there are several important differences. To predict the next action, they use a hybrid architecture (CNN+LSTM) that involves more complicated training procedure. Second, in addition to game frames, they require internal game status about the opponents as extra supervision during training, e.g., whether enemy is present in the current frame. IntelAct [Dosovitskiy & Koltun (2017)] models the Doom AI bot training in a supervised manner by predicting the future values of game variables (e.g., health, amount of ammo, etc) and acting accordingly. In comparison, we use curriculum learning with asynchronized actorcritic models and use stacked frames (4 most recent frames) and resized frames to mimic short-term memory and attention. Our approach requires no opponent’s information, and is thus suitable as a general framework to train agents for close-source games.
20
+
21
+ ![](images/94e7209ea3441576d67165943add7c75f4dd503b4fae9ca36f17aa99178edeb9.jpg)
22
+ Figure 1: The basic framework of actor-critic model.
23
+
24
+ In VizDoom AI Competition 2016 at IEEE Computational Intelligence And Games (CIG) Conference2, our AI won the champion of Track1 (limited deathmatch with known map), and IntelAct won the champion of Track2 (full deathmatch with unknown maps). Neither of the two teams attends the other track. Arnold won the second places of both tracks and CLYDE [Ratcliffe et al. (2017)] won the third place of Track1.
25
+
26
+ # 2 THE ACTOR-CRITIC MODEL
27
+
28
+ The goal of Reinforcement Learning (RL) is to train an agent so that its behavior maximizes/minimizes expected future rewards/penalties it receives from a given environment [Sutton & Barto (1998)]. Two functions play important roles: a value function $\bar { V } ( s )$ that gives the expected reward of the current state $s$ , and a policy function $\pi ( a | s )$ that gives a probability distribution on the candidate actions $a$ for the current state $s$ . Getting the groundtruth value of either function would largely solve RL: the agent just follows $\pi ( a | s )$ to act, or jumps in the best state provided by $V ( s )$ when the number of candidate next states is finite and practically enumerable. However, neither is trivial.
29
+
30
+ Actor-critic models [Barto et al. (1983); Sutton (1984); Konda & Tsitsiklis (1999); Grondman et al. (2012)] aim to jointly estimate $V ( s )$ and $\pi ( a | s )$ : from the current state $s _ { t }$ , the agent explores the environment by iteratively sampling the policy function $\pi ( a _ { t } | s _ { t } ; \mathbf { w } _ { \pi } )$ and receives positive/negative reward, until the terminal state or a maximum number of iterations are reached. The exploration gives a trajectory $\left\{ \bigl ( s _ { t } , a _ { t } , r _ { t } \bigr ) , \bigl ( s _ { t + 1 } , a _ { t + 1 } , r _ { t + 1 } \bigr ) , \cdot \cdot \cdot \right\}$ , from which the policy function and value function are updated. Specifically, to update the value function, we use the expected reward $R _ { t }$ along the trajectory as the ground truth; to update the policy function, we encourage actions that lead to high rewards, and penalize actions that lead to low rewards. To determine whether an action leads to high- or low-rewarding state, a reference point, called baseline [Williams (1992)], is usually needed. Using zero baseline might increase the estimation variance. [Peters & Schaal (2008)] gives a way to estimate the best baseline (a weighted sum of cumulative rewards) that minimizes the variance of the gradient estimation, in the scenario of episodic REINFORCE [Williams (1992)].
31
+
32
+ In actor-critic frameworks, we pick the baseline as the expected cumulative reward $V ( s )$ of the current state, which couples the two functions $V ( s )$ and $\pi ( a | s )$ together in the training, as shown in Fig. 1. Here the two functions reinforce each other: a correct $\pi ( a | s )$ gives high-rewarding trajectories which update $V ( s )$ towards the right direction; a correct $V ( s )$ picks out the correct actions for $\pi ( a | s )$ to reinforce. This mutual reinforcement behavior makes actor-critic model converge faster, but is also prone to converge to bad local minima, in particular for on-policy models that follow the very recent policy to sample trajectory during training. If the experience received by the agent in consecutive batches is highly correlated and biased towards a particular subset of the environment, then both $\pi ( a | s )$ and $V ( s )$ will be updated towards a biased direction and the agent may never see the whole picture. To reduce the correlation of game experience, Asynchronous Advantage ActorCritic Model [Mnih et al. (2016)] runs independent multiple threads of the game environment in parallel. These game instances are likely uncorrelated, therefore their experience in combination would be less biased.
33
+
34
+ ![](images/3195acd31df59ed688f0d1008bb33671b952f495ee12e0056935bb075cb887b1.jpg)
35
+ Figure 2: Two maps we used in the paper. FlatMap is a simple square containing four pillars . CIGTrack1 is the map used in Track1 in ViZDoom AI Competition (We did not attend Track2). Black dots are items (weapons, ammo, medkits, armors, etc).
36
+
37
+ For on-policy models, the same mutual reinforcement behavior will also lead to highly-peaked $\pi ( a | s )$ towards a few actions (or a few fixed action sequences), since it is always easy for both actor and critic to over-optimize on a small portion of the environment, and end up “living in their own realities”. To reduce the problem, [Mnih et al. (2016)] added an entropy term to the loss to encourage diversity, which we find to be critical. The final gradient update rules are listed as follows:
38
+
39
+ $$
40
+ \begin{array} { r l } & { \mathbf { w } _ { \pi } \mathbf { w } _ { \pi } + \alpha ( R _ { t } - V ( s _ { t } ) ) \nabla _ { \mathbf { w } _ { \pi } } \log \pi ( a _ { t } | s _ { t } ) + \beta \nabla _ { \mathbf { w } _ { \pi } } H ( \pi ( \cdot | s _ { t } ) ) } \\ & { \mathbf { w } _ { V } \mathbf { w } _ { V } - \alpha \nabla _ { \mathbf { w } _ { V } } ( R _ { t } - V ( s _ { t } ) ) ^ { 2 } } \end{array}
41
+ $$
42
+
43
+ where rate. I $\begin{array} { r } { R _ { t } = \sum _ { t ^ { \prime } = t } ^ { T } \gamma ^ { t ^ { \prime } - t } r _ { t ^ { \prime } } } \end{array}$ is the expected discounted reward at time uber loss instead of the L2 loss in Eqn. 2. $t$ and $\alpha , \beta$ are the learning
44
+
45
+ Architecture. While [Mnih et al. (2016)] keeps a separate model for each asynchronous agent and perform model synchronization once in a while, we use an alternative approach called BatchA3C, in which all agents act on the same model and send batches to the main process for gradient descent optimization. The agents’ models are updated after each gradient update. Note that the contemporary work GA3C [Babaeizadeh et al. (2017)] also proposes a similar architecture. In their architecture, there is a prediction queue that collects agents’ experience and sends them to multiple predictors, and a training queue that collects experience to feed the optimization.
46
+
47
+ # 3 DOOM AS A REINFORCEMENT LEARNING PLATFORM
48
+
49
+ In Doom, the player controls the agent to fight against enemies in a 3D environment (e.g., in a maze). The agent can only see the environment from his viewpoint and thus receives partial information upon which it makes decisions. On modern computers, the original Doom runs in thousands of frames per second, making it suitable as a platform for training AI agent. ViZDoom [Kempka et al. (2016)] is an open-source platform that offers programming interface to communicate with Doom engine, ZDoom3. From the interface, users can obtain current frames of the game, and control the agent’s action. ViZDoom offers much flexibility, including:
50
+
51
+ Rich Scenarios. Many customized scenarios are made due to the popularity of the game, offering a variety of environments to train from. A scenario consists of many components, including 2D maps for the environment, scripts to control characters and events. Open-source tools, such as $\mathrm { S L A D E ^ { 4 } }$ , are also widely available to build new scenarios. We built our customized map (Fig. 2(b)) for training.
52
+
53
+ Game variables. In addition to image frames, ViZDoom environment also offers many games variables revealing the internal state of the game. This includes HEALTH, AMMO ? (agent’s health and ammunition), FRAG COUNT (current score) and so on. ViZDoom also offers USER? variables that are computed on the fly via scenario scripts. These USER? variables can provide more information of the agent, e.g., their spatial locations. Enemy information could also be obtained by modifying ViZDoom [Lample & Chaplot (2016)]. Such information is used to construct a reward function, or as a direct supervision to accelerate training [Lample & Chaplot (2016)].
54
+
55
+ Built-in bots. Built-in bots can be inserted in the battle. They are state machines with privileged information over the map and the player, which results in apparently decent intelligence with minimal computational cost. By competing against built-in bots, the agent learns to improve.
56
+
57
+ Evaluation Criterion. In FPS games, to evaluate their strength, multiple AIs are placed to a scenario for a deathmatch, in which every AI plays for itself against the remaining AIs. Frags per episode, the number of kills minus the number of suicides for the agent in one round of game, is often used as a metric. An AI is stronger if its frags is ranked higher against others. In this work, we use an episode of 2-minute game time (4200 frames in total) for all our evaluations unless noted otherwise.
58
+
59
+ ![](images/2a0421b333ba3847e2e760ffda72c7e8371f15e03dbe3c963a3f918dae440576.jpg)
60
+ Figure 3: The network structure of the proposed model. It takes 4 recent game frames plus 4 recent attention frames as the input state $s$ , and outputs a probability distribution $\pi ( a | s )$ of the 6 discrete actions. The policy and value network share parameters.
61
+
62
+ # 4 METHOD
63
+
64
+ # 4.1 NETWORK ARCHITECTURE
65
+
66
+ We use convolutional neural networks to extract features from the game frames and then combine its output representation with game variables. Fig. 3 shows the network architecture and Tbl. 1 gives the parameters. It takes the frames as the input (i.e., the state $s$ ) and outputs two branches, one that outputs the value function $V ( s )$ by regression, while the other outputs the policy function $\pi ( s | a )$ by a regular softmax. The parameters of the two functions are shared before the branch.
67
+
68
+ For input, we use the most recent 4 frames plus the center part of them, scaled to the same size $( 1 2 0 \times 1 2 0 )$ . Therefore, these centered “attention frames” have higher resolution than regular game frames, and greatly increase the aiming accuracy. The policy network will give 6 actions, namely MOVE FORWARD, MOVE LEFT, MOVE RIGHT, TURN LEFT, TURN RIGHT, and ATTACK. We found other on-off actions (e.g., MOVE BACKWARD) offered by ViZDoom less important. After feature extraction by convolutional network, game variables are incorporated. This includes the agent’s Health (0-100) and Ammo (how many bullets left). They are related to AI itself and thus legal in the game environment for training, testing and ViZDoom AI competition.
69
+
70
+ # 4.2 TRAINING PIPELINE
71
+
72
+ Our training procedure is implemented with TensorFlow [Abadi et al. (2016)] and tensorpack5. We open 255 processes, each running one Doom instance, and sending experience $\left( { { s _ { t } } , { a _ { t } } , { r _ { t } } } \right)$ to the main process which runs the training procedure. The main process collects frames from different game instances to create batches, and optimizes on these batches asynchronously on one or more GPUs using Eqn. 1 and Eqn. 2. The frames from different processes running independent game instances, are likely to be uncorrelated, which stabilizes the training. This procedure is slightly different from the original A3C, where each game instance collects their own experience and updates the parameters asynchronously.
73
+
74
+ Table 1: Network parameters. $C 7 x 7 x 3 2 s 2 =$ convolutional layer with $7 \mathbf { x } 7$ kernel, stride 2 and number of output planes 32. $M P =$ MaxPooling. Each convolutional and fully connected layer is followed by a ReLU, except for the last output layer.
75
+
76
+ <table><tr><td rowspan=1 colspan=1>Layer #</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>7</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>C7x7x32s2</td><td rowspan=1 colspan=1>C7x7x64s2</td><td rowspan=1 colspan=1>MP3x3s2</td><td rowspan=1 colspan=1>C3x3x128</td><td rowspan=1 colspan=1>MP3x3s2</td><td rowspan=1 colspan=1>C3x3x192</td><td rowspan=1 colspan=1>FC1024</td></tr></table>
77
+
78
+ Table 2: Parameters for different maps.
79
+
80
+ <table><tr><td>Parameters</td><td>Description</td><td>FlatMap</td><td>CIGTrack1</td></tr><tr><td>living</td><td>Penalize agent who just lives</td><td colspan="2">-0.008/action</td></tr><tr><td>health_loss</td><td>Penalize health decrement</td><td colspan="2">-0.05 /unit</td></tr><tr><td>ammo_loss</td><td>Penalize ammunition decrement</td><td colspan="2">-0.04/unit</td></tr><tr><td>health_pickup</td><td>Reward for medkit pickup</td><td colspan="2">0.04/unit</td></tr><tr><td>ammo-pickup</td><td>Reward for ammunition pickup</td><td colspan="2">0.15 /unit</td></tr><tr><td>dist-penalty dist_reward</td><td>Penalize the agent when it stays</td><td colspan="2">-0.03 /action</td></tr><tr><td>dist_penalty_thres</td><td>Reward the agent when it moves</td><td colspan="2">9e-5/unit distance</td></tr><tr><td rowspan="2">num_bots</td><td>Thresholdofdisplacement</td><td>8</td><td>15</td></tr><tr><td>Number of built-in bots</td><td>8</td><td>16</td></tr></table>
81
+
82
+ Despite the use of entropy term, we still find that $\pi ( \cdot | s )$ is highly peaked. Therefore, during trajectory exploration, we encourage exploration by the following changes: a) multiply the policy output of the network by an exploration factor (0.2) before softmax b) uniformly randomize the action for $10 \%$ random frames.
83
+
84
+ As mentioned in [Kempka et al. (2016)], care should be taken for frame skips. Small frame skip introduces strong correlation in the training set, while big frame skip reduces effective training samples. We set frame skip to be 3. We choose $6 4 0 \mathrm { x } 4 8 0$ as the input frame resolution and do not use high aspect ratio resolution [Lample & Chaplot (2016)] to increase the field of view.
85
+
86
+ We use Adam [Kingma & Ba (2014)] with $\epsilon = 1 0 ^ { - 3 }$ for training. Batch size is 128, discount factor $\gamma = 0 . 9 9$ , learning rate $\alpha = 1 0 ^ { - 4 }$ and the policy learning rate $\beta = 0 . 0 8 \alpha$ . The model is trained from scratch. The training procedure runs on Intel Xeon CPU E5-2680v2 at 2. 80GHz, and 2 TitanX GPUs. It takes several days to obtain a decent result. Our final model, namely the $F l$ bot, is trained for around 3 million mini-batches on multiple different scenarios.
87
+
88
+ # 4.3 CURRICULUM LEARNING
89
+
90
+ When the environment only gives very sparse rewards, or adversarial, A3C takes a long time to converge to a satisfying solution. A direct training with A3C on the map CIGTrack1 with 8 builtin bots does not yield sensible performance. To address this, we use curriculum learning [Bengio et al. (2009)] that trains an agent with a sequence of progressively more difficult environments. By varying parameters in Doom (Sec. 3), we could control its difficulty level.
91
+
92
+ <table><tr><td rowspan=1 colspan=4>Class 0 Class 1 Class 2</td><td rowspan=1 colspan=1>Class 3</td><td rowspan=1 colspan=1>Class 4</td><td rowspan=1 colspan=1>Class 5</td><td rowspan=1 colspan=1>Class 6</td><td rowspan=1 colspan=1>Class 7</td></tr><tr><td rowspan=1 colspan=1>Speed</td><td rowspan=1 colspan=1>0.2</td><td rowspan=1 colspan=1>0.2</td><td rowspan=1 colspan=1>0.4</td><td rowspan=1 colspan=1>0.4</td><td rowspan=1 colspan=1>0.6</td><td rowspan=1 colspan=1>0.8</td><td rowspan=1 colspan=1>0.8</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>Health</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>100</td></tr></table>
93
+
94
+ Table 3: Curriculum design for FlatMap. Note that enemy uses RocketLauncher except for Class 0 (Pistol).
95
+
96
+ Reward Shaping. Reward shaping has been shown to be an effective technique to apply reinforcement learning in a complicated environment with delayed reward $[ \mathrm { N g }$ et al. (1999); Devlin et al. (2011)]. In our case, besides the basic reward for kills $( + 1 )$ and death (-1), intermediate rewards are used as shown in Tbl. 2. We penalize agent with a living state, encouraging it to explore and encounter more enemies. health loss and ammo loss place linear reward for a decrement of health and ammunition. ammo pickup and health pickup place reward for picking up these two items. In addition, there is extra reward for picking up ammunition when in need (e.g. almost out of ammo). dist penalty and dist reward push the agent away from the previous locations, encouraging it to explore. The penalty is applied every action, when the displacement of the bot relative to the last state is less than a threshold dist penalty thres. And dist reward is applied for every unit displacement the agent makes. Similar to [Lample & Chaplot (2016)], the displacement information is computed from the ground truth location variables provided by Doom engine, and will not be used in the competition. However, unlike [Lample & Chaplot (2016)] that uses enemy-in-sight signal for training, locations can be extracted directly from USER? variables, or can easily be computed roughly with action history.
97
+
98
+ Curriculum Design. We train the bot on FlatMap that contains a simple square with a few pillars (Fig. 2(a)) with several curricula (Tbl. 3), and then proceed to CIGTrack1. For each map, we design curricula by varying the strength of built-in bots, i.e., their moving speed, initial health and initial weapon. Our agent always uses RocketLauncher as its only weapon. Training on FlatMap leads to a capable initial model which is quickly adapted to more complicated maps. As shown in Tbl. 2, for CIGTrack1 we increase dist penalty thres to keep the agent moving, and increase num bots so that the agent encounters more enemies per episode.
99
+
100
+ Adaptive Curriculum. In addition to staged curriculum learning, we also design adaptive curriculum learning by assigning a probability distribution on different levels for each thread that runs a Doom instance. The probability distribution shifts towards more difficult curriculum when the agent performs well on the current distribution, and shifts towards easier level otherwise. We consider the agent to perform well if its frag count is greater than 10 points.
101
+
102
+ # 4.4 POST-TRAINING RULES
103
+
104
+ For a better performance in the competition, we also put several rules to process the action given by the trained policy network, called post-training (PT) rules. There are two sets of buttons in ViZDoom: on-off buttons and delta buttons. While on-off button maps to the binary states of a keystroke (e.g., pressing the up arrow key will move the agent forward), delta buttons mimic the mouse behavior and could act faster in certain situations. Therefore, we setup rules that detect the intention of the agent and accelerate with delta button. For example, when the agent turns by invoking TURN LEFT repeatedly, we convert its action to TURN LEFT RIGHT DELTA for acceleration. Besides, the trained model might get stuck in rare situations, e.g., keep moving forward but blocked by an explosive bucket. We also designed rules to detect and fix them.
105
+
106
+ # 5 EXPERIMENT
107
+
108
+ In this section, we show the training procedure (Sec. 5.1), evaluate our AIs with ablation analysis (Sec. 5.2) and ViZDoom AI Competition (Sec. 5.3). We mainly compare among three AIs: (1) F1Pre, the bot trained with FlatMap only, (2) F1Plain, the bot trained on both FlatMap and CIGTrack1, but without post-training rules, and (3) the final $F l$ bot that attends competition.
109
+
110
+ # 5.1 CURRICULUM LEARNING ON FL A TMA P
111
+
112
+ Fig. 4 shows that the curriculum learning increases the performance of the agents over all levels. When an agent becomes stronger in the higher level of class, it is also stronger in the lower level of class without overfitting. Fig. 5 shows comparison between adaptive curriculum learning with pure A3C. We can see that pure A3C can learn on FlatMap but is slower. Moreover, in CIGTrack1, a direct application of A3C does not yield sensible performance.
113
+
114
+ ![](images/d72c27739b6db20e52495fe4e07e135bfbb24984821015d05ffc9ec11bf706ce.jpg)
115
+ Figure 4: Average Frags over 300 episodes evaluation, on FlatMap(left) and CIGTrack1(right) with different levels of enemies (See Tbl. 3 for curriculum design). Models from later stages performs better especially on the difficult map, yet still keeps a good performance on the easier map.
116
+
117
+ ![](images/ad4bd531ba59b063ff2e2cb3cd119ad0c822eca03e7562097dfe0dc1b19fed27.jpg)
118
+ Figure 5: Performance comparison on Class 7 (hardest) of FlatMap between A3C [Mnih et al. (2016)] and adaptive curriculum learning, at different stage of training. Average frags and max frags are computed from 100 episodes. Adaptive curriculum shows higher performance and is relatively more stable.
119
+
120
+ # 5.2 ABLATION ANALYSIS
121
+
122
+ Visualization. Fig. 6 shows the visualization of the first convolutional layer of the trained AI agent. We could see that the convolutional kernels of the current frame is less noisy than the kernels of previous frames. This means that the agent makes the most use of the current frames.
123
+
124
+ Effect of History Frames. Interestingly, while the agent focuses on the current frame, it also uses motion information. For this, we use (1) 4 duplicated current frames (2) 4 recent frames in reverse order, as the input. This gives 8.50 and 2.39 mean frags, compared to 10.34 in the normal case, showing that the agent heavily uses the motion information for better decision. In particular, the bot is totally confused with the reversed motion feature. Detailed results are shown in Tbl. 5.
125
+
126
+ ![](images/66a68449811ccd1853c0ae74280a568bba1e9234290164ddd9cd147902eb9bb3.jpg)
127
+ Figure 6: Visualization of the convolutional filters in the first layer of our network. The filters are grouped by the frame index they corresponds to. Each group consists of two rows of 32 RGB filters for the regular and attention frames, respectively. The filters corresponding to the current frame (last row) is less noisy than those of others, showing that the bot is more focused on the current frame.
128
+
129
+ Table 4: Avg/Max frags of each AIs in the internal tournament (150 episodes of 10 minutes each).
130
+
131
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Built-In AI</td><td rowspan=1 colspan=1>F1Pre</td><td rowspan=1 colspan=1>F1Plain</td><td rowspan=1 colspan=1>F1</td></tr><tr><td rowspan=1 colspan=1>FlatMap</td><td rowspan=1 colspan=1>8.07/20</td><td rowspan=1 colspan=1>14.47/24</td><td rowspan=1 colspan=1>17.26/29</td><td rowspan=1 colspan=1>22.45/37</td></tr><tr><td rowspan=1 colspan=1>CIGTrack1</td><td rowspan=1 colspan=1>0.48/7</td><td rowspan=1 colspan=1>3.56/15</td><td rowspan=1 colspan=1>8.58/16</td><td rowspan=1 colspan=1>10.65/18</td></tr></table>
132
+
133
+ <table><tr><td></td><td colspan="3">FlatMap</td><td colspan="3">CIGTrack1</td></tr><tr><td></td><td>Min</td><td>Mean</td><td>Max</td><td>Min</td><td>Mean</td><td>Max</td></tr><tr><td>F1 bot (reverse history)</td><td>1</td><td>9.89</td><td>19</td><td>-2</td><td>2.39</td><td>9</td></tr><tr><td>F1 bot (duplicated history)</td><td>10</td><td>24.62</td><td>37</td><td>2</td><td>8.50</td><td>17</td></tr><tr><td>F1 bot (w/o PT rules)</td><td>14</td><td>22.80</td><td>36</td><td>1</td><td>8.66</td><td>18</td></tr><tr><td>F1 bot</td><td>16</td><td>25.17</td><td>37</td><td>5</td><td>10.34</td><td>17</td></tr></table>
134
+
135
+ Table 5: Performance evaluation (in terms of frags) on two standard scenarios FlatMap and CIGTrack1 over 300 episodes. Our bot performs better with post-training rules.
136
+
137
+ Post-training Rules. Tbl. 5 shows that the post-training rules improve the performance. As a future work, an end-to-end training involving delta buttons could make the bot better.
138
+
139
+ Internal Tournament. We also evaluate our AIs with internal tournaments (Tbl. 4). All our bots beat the performance of built-in bots by a large margin, even though they use privileged information. F1Pre, trained with only FlatMap, shows decent performance, but is not as good as the models trained with both FlatMap and CIGTrack1. The final bot $F l$ performs the best.
140
+
141
+ Behaviors. Visually, the three bots behave differently. F1Pre is a bit overtrained in FlatMap and does not move too often, but when it sees enemies, even faraway, it will start to shoot. Occasionally it will move to the corner and pick medkits. In CIGTrack1, F1Pre stays in one place and ambushes opponents who pass by. On the other hand, F1Plain and $F l$ always move forwards and turn at the corner. As expected, $F l$ moves and turns faster.
142
+
143
+ Tactics All bots develop interesting local tactics when exchanging fire with enemy: they slide around when shooting the enemy. This is quite effective for dodging others’ attack. Also when they shoot the enemy, they usually take advantage of the splashing effect of rocket to cause additional damage for enemy, e.g., shooting the wall when the enemy is moving. They do not pick ammunition too often, even if they can no longer shoot. However, such disadvantage is mitigated by the nature of deathmatch: when a player dies, it will respawn with ammunition. We also check states with highest/lowest estimated future value $V ( s )$ over a 10-episode evaluation of $F l$ bot, from which we can speculate its tactics. The highest value is $V = 0 . 9 7$ when the agent fired, and about to hit the enemy. One low value is $V = - 0 . 4 4$ , ammo $= 0$ , when the agent encountered an enemy at the corner but is out of ammunition. Both cases are reasonable.
144
+
145
+ # 5.3 COMPETITION
146
+
147
+ We attended the ViZDoom AI Competition hosted by IEEE CIG. There are 2 tracks in the competition. Track 1 (Limited Deathmatch) uses a known map and fixed weapons, while Track 2 (Full Deathmatch) uses 3 unknown maps and a variety of weapons. Each bot fights against all others for 12 rounds of 10 minutes each. Due to server capacity, each bot skips one match in the first 9 rounds. All bots are supposed to run in real-time ${ \mathit { \Omega } } ^ { \prime } { > } 3 5$ fps) on a GTX960 GPU.
148
+
149
+ <table><tr><td rowspan=1 colspan=1>Round</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=2>12 Total</td></tr><tr><td rowspan=1 colspan=1>Our bot</td><td rowspan=1 colspan=1>56</td><td rowspan=1 colspan=1>62</td><td rowspan=1 colspan=1>n/a</td><td rowspan=1 colspan=1>54</td><td rowspan=1 colspan=1>47</td><td rowspan=1 colspan=1>43</td><td rowspan=1 colspan=1>47</td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>47</td><td rowspan=1 colspan=1>559</td></tr><tr><td rowspan=1 colspan=1>Arnold</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>34</td><td rowspan=1 colspan=1>42</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>45</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>39</td><td rowspan=1 colspan=1>n/a</td><td rowspan=1 colspan=1>33</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>413</td></tr><tr><td rowspan=1 colspan=1>CLYDE</td><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>n/a</td><td rowspan=1 colspan=1>38</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>46</td><td rowspan=1 colspan=1>42</td><td rowspan=1 colspan=1>33</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>393</td></tr></table>
150
+
151
+ Table 6: Top 3 teams in ViZDoom AI Competition, Track 1. Our bot attended 11 out of 12 games, won 10 of them and won the champion by a large margin. For design details, see Arnold [Lample & Chaplot (2016)] and CLYDE [Ratcliffe et al. (2017)].
152
+
153
+ Our $F l$ bot won 10 out of 11 attended games and won the champion for Track 1 by a large margin. We have achieved 559 frags, $3 5 . 4 \%$ higher than 413 frags achieved by Arnold [Lample & Chaplot (2016)], that uses extra game state for model training. On the other hand, IntelAct [Dosovitskiy & Koltun (2017)] won Track 2. The full videos for the two tracks have been released67, as well as an additional game between Human and $\mathrm { A I s } ^ { 8 }$ . Our bot behaves reasonable and very human-like in Track 1. In the match between Human and AIs, our bot was even ahead of the human player for a short period (6:30 to 7:00).
154
+
155
+ # 6 CONCLUSION
156
+
157
+ Teaching agents to act properly in complicated and adversarial 3D environment is a very challenging task. In this paper, we propose a new framework to train a strong AI agent in a First-Person Shooter (FPS) game, Doom, using a combination of state-of-the-art Deep Reinforcement Learning and Curriculum Training. Via playing against built-in bots in a progressive manner, our bot wins the champion of Track1 (known map) in ViZDoom AI Competition. Furthermore, it learns to use motion features and build its own tactics during the game, which is never taught explicitly.
158
+
159
+ Currently, our bot is still an reactive agent that only remembers the last 4 frames to act. Ideally, a bot should be able to build a map from an unknown environment and localize itself, is able to have a global plan to act, and visualize its reasoning process. We leave them to future works.
160
+
161
+ # REFERENCES
162
+
163
+ Abadi, Mart´ın, Agarwal, Ashish, Barham, Paul, Brevdo, Eugene, Chen, Zhifeng, Citro, Craig, Corrado, Gregory S., Davis, Andy, Dean, Jeffrey, Devin, Matthieu, Ghemawat, Sanjay, Goodfellow, Ian J., Harp, Andrew, Irving, Geoffrey, Isard, Michael, Jia, Yangqing, Jozefowicz, Rafal, Kaiser, ´ Lukasz, Kudlur, Manjunath, Levenberg, Josh, Mane, Dan, Monga, Rajat, Moore, Sherry, Murray, ´ Derek Gordon, Olah, Chris, Schuster, Mike, Shlens, Jonathon, Steiner, Benoit, Sutskever, Ilya, Talwar, Kunal, Tucker, Paul A., Vanhoucke, Vincent, Vasudevan, Vijay, Viegas, Fernanda B., ´ Vinyals, Oriol, Warden, Pete, Wattenberg, Martin, Wicke, Martin, Yu, Yuan, and Zheng, Xiaoqiang. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. CoRR, abs/1603.04467, 2016. URL http://arxiv.org/abs/1603.04467.
164
+
165
+ Babaeizadeh, Mohammad, Frosio, Iuri, Tyree, Stephen, Clemons, Jason, and Kautz, Jan. Reinforcement learning through asynchronous advantage actor-critic on a gpu. International Conference on Learning Representations (ICLR), 2017.
166
+
167
+ Barto, Andrew G, Sutton, Richard S, and Anderson, Charles W. Neuronlike adaptive elements that can solve difficult learning control problems. IEEE transactions on systems, man, and cybernetics, (5):834–846, 1983.
168
+
169
+ Bengio, Yoshua, Louradour, Jer´ ome, Collobert, Ronan, and Weston, Jason. Curriculum learning. In ˆ Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009.
170
+
171
+ Devlin, Sam, Kudenko, Daniel, and Grzes, Marek. An empirical study of potential-based reward ´ shaping and advice in complex, multi-agent systems. Advances in Complex Systems, 14(02): 251–278, 2011.
172
+
173
+ Dosovitskiy, Alexey and Koltun, Vladlen. Learning to act by predicting the future. International Conference on Learning Representations (ICLR), 2017.
174
+
175
+ Grondman, Ivo, Busoniu, Lucian, Lopes, Gabriel AD, and Babuska, Robert. A survey of actor-critic reinforcement learning: Standard and natural policy gradients. IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews), 42(6):1291–1307, 2012.
176
+
177
+ Hausknecht, Matthew J. and Stone, Peter. Deep recurrent q-learning for partially observable mdps. CoRR, abs/1507.06527, 2015. URL http://arxiv.org/abs/1507.06527.
178
+
179
+ Jiang, Lu, Meng, Deyu, Zhao, Qian, Shan, Shiguang, and Hauptmann, Alexander G. Self-paced curriculum learning. In AAAI, volume 2, pp. 6, 2015.
180
+
181
+ Kempka, Michał, Wydmuch, Marek, Runc, Grzegorz, Toczek, Jakub, and Jaskowski, Wojciech.´ Vizdoom: A doom-based ai research platform for visual reinforcement learning. arXiv preprint arXiv:1605.02097, 2016.
182
+
183
+ Kingma, Diederik and Ba, Jimmy. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
184
+
185
+ Konda, Vijay R and Tsitsiklis, John N. Actor-critic algorithms. In NIPS, volume 13, pp. 1008–1014, 1999.
186
+
187
+ Lample, Guillaume and Chaplot, Devendra Singh. Playing fps games with deep reinforcement learning. arXiv preprint arXiv:1609.05521, 2016.
188
+
189
+ Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, Rusu, Andrei A, Veness, Joel, Bellemare, Marc G, Graves, Alex, Riedmiller, Martin, Fidjeland, Andreas K, Ostrovski, Georg, et al. Humanlevel control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
190
+
191
+ Mnih, Volodymyr, Badia, Adria Puigdomenech, Mirza, Mehdi, Graves, Alex, Lillicrap, Timothy P, Harley, Tim, Silver, David, and Kavukcuoglu, Koray. Asynchronous methods for deep reinforcement learning. arXiv preprint arXiv:1602.01783, 2016.
192
+
193
+ Ng, Andrew Y, Harada, Daishi, and Russell, Stuart. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
194
+
195
+ Peters, Jan and Schaal, Stefan. Reinforcement learning of motor skills with policy gradients. Neural networks, 21(4):682–697, 2008.
196
+
197
+ Ratcliffe, D., Devlin, S., Kruschwitz, U., and Citi, L. Clyde: A deep reinforcement learning doom playing agent. AAAI Workshop on What’s next for AI in games, 2017.
198
+
199
+ Silver, David, Huang, Aja, Maddison, Chris J, Guez, Arthur, Sifre, Laurent, Van Den Driessche, George, Schrittwieser, Julian, Antonoglou, Ioannis, Panneershelvam, Veda, Lanctot, Marc, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
200
+
201
+ Sutton, Richard S and Barto, Andrew G. Reinforcement learning: An introduction, volume 1. 1998.
202
+
203
+ Sutton, Richard Stuart. Temporal credit assignment in reinforcement learning. 1984.
204
+
205
+ van Waveren, J.M.P. The Quake III Arena bot. University of Technology Delft, 2001.
206
+
207
+ Williams, Ronald J. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
md/train/HkxnclHKDr/HkxnclHKDr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HyenWc5gx/HyenWc5gx.md ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REPRESENTATION STABILITY AS A REGULARIZER FOR IMPROVED TEXT ANALYTICS TRANSFER LEARNING
2
+
3
+ Matthew Riemer, Elham Khabiri, and Richard Goodwin
4
+
5
+ IBM T.J. Watson Research Center Yorktown Heights, NY, USA {mdriemer, ekhabiri, rgoodwin}@us.ibm.com
6
+
7
+ # ABSTRACT
8
+
9
+ Although neural networks are well suited for sequential transfer learning tasks, the catastrophic forgetting problem hinders proper integration of prior knowledge. In this work, we propose a solution to this problem by using a multi-task objective based on the idea of distillation and a mechanism that directly penalizes forgetting at the shared representation layer during the knowledge integration phase of training. We demonstrate our approach on a Twitter domain sentiment analysis task with sequential knowledge transfer from four related tasks. We show that our technique outperforms networks fine-tuned to the target task. Additionally, we show both through empirical evidence and examples that it does not forget useful knowledge from the source task that is forgotten during standard fine-tuning. Surprisingly, we find that first distilling a human made rule based sentiment engine into a recurrent neural network and then integrating the knowledge with the target task data leads to a substantial gain in generalization performance. Our experiments demonstrate the power of multi-source transfer techniques in practical text analytics problems when paired with distillation. In particular, for the SemEval 2016 Task 4 Subtask A (Nakov et al., 2016) dataset we surpass the state of the art established during the competition with a comparatively simple model architecture that is not even competitive when trained on only the labeled task specific data.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Sequential transfer learning methodologies leverage knowledge representations from a source task in order to improve performance for a target task. A significant challenge faced when transferring neural network representations across tasks is that of catastrophic forgetting (or catastrophic interference). This is where a neural network experiences the elimination of important old information when learning new information. The very popular strategy of fine-tuning a neural network involves first training a neural network on a source task and then using the model to simply initialize the weights of a target task network up to the highest allowable common representation layer. However it is highly susceptible to catastrophic forgetting, because in training for the target task it has no explicit incentive to retain what it learned from the source task. While one can argue that forgetting the source task should not matter if only the target task is of interest, our paper adds to the recent empirical evidence across problem domains (Li & Hoiem, 2016),(Rusu et al., 2016) that show additional network stability can lead to empirical benefits over the fine-tuning algorithm. It seems as though for many Deep Learning problems we can benefit from an algorithm that promotes more stability to tackle the well known stability-plasticity dilemma. One popular approach for addressing this problem is rehearsals (Murre, 1992), (Robins, 1995). Rehearsals refers to a neural network training strategy where old examples are relearned as new examples are learned. In the transfer setting it can be seen as related to multi-task learning (Caruana, 1997) where two tasks are trained at the same time, rather than sequentially, while sharing a common input encoder to a shared hidden representation. However, in rehearsals the representation is biased in favor of the source task representation through initialization. This technique is very sensible because while fine-tuning is susceptible to catastrophic forgetting, multi-task learning is not (Caruana, 1997).
14
+
15
+ One of the biggest issues with the standard rehearsals paradigm is that it requires a cached memory of training examples that have been seen in the past. This can be a massive requirement as the number of source tasks and training data sizes scale. One compelling technique for addressing this problem is the concept of pseudorehearsals (Robins, 1995), (Robins, 1996), where relearning is performed on an artificially constructed population of pseudoitems instead of the actual old examples. Unfortunately, current automatic techniques in the text analytics domain have not yet mastered producing linguistically plausible data. As such, the pseudorehearsals paradigm is likely to waste computational time that could be spent on learning realistic patterns that may occur during testing. In our work, we extend the Learning without Forgetting (LwF) paradigm of (Li & Hoiem, 2016) to the text analytics domain using Recurrent Neural Networks. In this approach, the target task data is used both for learning the target task and for rehearsing information learned from the source task by leveraging synthetic examples generated for the target task input by the model that only experienced training on the source task data. As argued by Li & Hoiem (2016), this setup strikes an important balance between classification performance, computational efficiency, and simplicity in deployment.
16
+
17
+ Regardless of whether they are applied to real source task examples, real target task examples, or synthetic examples, paradigms in the style of rehearsals all address the shortcomings of neural network forgetting by casting target task integration as a multi-task learning problem. However, this is not quite the purpose of the multi-task learning architecture, which was designed for joint learning of tasks from scratch at the same time. The key disconnect is that in multi-task learning, the transformation from the shared hidden layer to the outputs for each task are all learned and updated with the changing hidden representation. This would imply that, in the framework of rehearsals, it is possible for there to be significant changes during learning of the network’s representation, and thus its abilities on the source task itself. While it would be desirable to claim we were allowing our source task network to become even better based on the target task than it was before, this motivation seems idealistic in practice. One reason this is idealistic is because multi-task learning generally only works well when tasks are sampled at different rates or alternatively given different priority in the neural network loss function (Caruana, 1997). As a result, it is most likely that auxilirary source tasks will receive less priority from the network for optimization than the target task. Additionally, we observe in our experiments, and it has been observed by others in (Rusu et al., 2015), that it is generally not possible to distill multiple complex tasks into a student network at full teacher performance for all tasks. This seems to imply the degradation of the source task performance during training is somewhat inevitable in a multi-task learning paradigm.
18
+
19
+ We address this issue with our proposed forgetting cost technique. We demonstrate that it, in fact, can be valuable to keep the hidden to output transformation of the source tasks fixed during knowledge integration with the target task. This way, we impose a stronger regularization on the hidden representation during target task integration by not allowing it to change aspects that were important to the source task’s performance without direct penalization in the neural network’s loss function. We demonstrate empirically both that freezing the source task specific weights leads to less deterioration in the accuracy on the source task after integration, and that it achieves better generalization performance in our setting. The forgetting cost is practical and easy to implement in training any kind of neural network. In our experiments, we explore application of the forgetting cost in a recurrent neural network to the three way Twitter sentiment analysis task of SemEval 2016 Task 4 Subtask A and find it to achieve consistently superior performance to reasonable baseline transfer learning approaches in four examples of knowledge transfer for this task.
20
+
21
+ We also demonstrate how powerful distillation can be in the domain of text analytics when paired with the idea of the forgetting cost. Significantly, we show that a high quality gazetteer based logical rule engine can be distilled using unlabeled data into a neural network and used to significantly improve performance of the neural network on the target task. This is achieved with a novel extension of the LwF paradigm by Li & Hoiem (2016) to the scenario of a source task with the same output space as the target task. This can be a very promising direction for improving the ability of humans to directly convey knowledge to deep learning algorithms. Indeed, a human defined rule can contain far more information than a single training example, as that rule can be projected on to many unlabeled examples that the neural network can learn from. This is the reason human teachers generally begin teaching human students tasks by going over core rules at the onset of learning. Moreover, we showcase that multiple expert networks trained on the target task with prior knowledge from different source tasks can be effectively combined in an ensemble and then distilled into a single GRU model (Cho et al., 2014), (Chung et al., 2014). Leveraging this combination of distillation and knowledge transfer techniques allows us to achieve state of the art accuracy on the SemEval task with a model that performs $11 \%$ worse than the best prior techniques when trained only on the labeled data.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Since the work of (Bucilu et al., 2006) and (Hinton et al., 2015) showed that an ensemble of neural network classifier can be distilled into a single model, knowledge distillation from a teacher network to a student network has become a growing topic of neural network research. In (Ba & Caruana, 2014) it was shown that a deep teacher neural network can be learned by a shallow student network. This idea was extended in (Romero et al., 2014), where it was demonstrated that a deep and narrow neural network can learn a representation that surpasses its teacher. The use of distillation as a means of sharing biases from multiple tasks was explored in (Lopez-Paz et al., 2016), where the teacher network is trained with the output of the other tasks as input. It is not obvious how to extend a recurrent neural network to best use this kind of capability over a sequence. The idea of distilling from multiple source task teachers into a student network was highlighted in the reinforcement learning setting in (Rusu et al., 2015). Additionally, the concept of using distillation for knowledge transfer was also explored in (Chen et al., 2015), where function preserving transformations from smaller to bigger neural network architectures were outlined. This technique could also provide value in some instances for our approach where wider or deeper neural networks are needed for the task being transferred to than was needed for the original task. Distillation over target task data was first proposed as a means of elevating catastrophic forgetting in sequential knowledge transfer as applied to image classification in (Li & Hoiem, 2016). We extend this approach for its first application to our knowledge for text analytics problems, with a recurrent neural network architecture, and in the setting where the source task and target task have the same output. The chief distinction of our proposed forgetting cost is that source task specific parameters are held fixed during integration with the target task as opposed to the joint training of all parameters used by Li & Hoiem (2016). Our experiments empirically support the intuition that freezing these parameters leads to greater retention of source task performance after target task integration and better generalization to the target task.
26
+
27
+ An ensemble over multiple diverse models trained for the same sentiment analysis task was also considered in (Mesnil et al., 2014) for the IMDB binary movie reviews sentiment dataset (Maas et al., 2011). We tried this ensemble model in our work and found that it gave very limited improvement. Our ensemble technique learns a more powerful weighted average based on the soft targets of each task and a multi-step greedy binary fusion approach that works better for the Twitter sentiment analysis task in our experiments. Knowledge transfer from multiple tasks was considered to estimate the age of Twitter users based on the content of their tweets in (Riemer et al., 2015). We experimented with the hidden layer sharing approach outlined in that work and found that even when using just a single softmax combining layer, it would overfit on our limited training and validation data. Progressive neural networks (Rusu et al., 2016) is a recently proposed method very similar in motivation to our forgetting cost as it is directly trying to solve the catastrophic forgetting problem. The idea is that learned weight matrices relate the fixed representations learned on the source task to the construction of representations for the target task. In our experiments, the progressive neural networks approach consistently fails to even match the results achieved with fine-tuning. We hypothesize that although using fixed representations to aid learning addresses catastrophic forgetting, it suffers from the curse of dimensionality. As such, when training data is relatively small given the complexity of the task, it is prone to overfitting as it effectively increases the input dimension size through shared fixed representations.
28
+
29
+ The combination of logic rules and neural networks has been explored in a variety of different architectures and settings. These neural-symbolic systems (Garcez et al., 2012) include early examples such as KBANN (Towell et al., 1990) that construct network architectures from given rules to perform reasoning. (Hu et al., 2016) very recently also looked at the problem of distilling logical rules into a neural network text analytics classifier. However, our approach is much more generic as it can be applied to integrate knowledge from any kind of pre-made classifier and treats the rule engine as a black box. In (Hu et al., 2016) they consider the individual rules and leverage an iterative convex optimization algorithm alongside the neural network to regularize the subspace of the network. In our work we demonstrate that, by guarding against catastrophic forgetting, it is possible to efficiently leverage rules for transfer by utilizing a generic sequential knowledge transfer framework. We do not need to make any modification to the architecture of the neural network during testing and do not need iterative convex optimization during training.
30
+
31
+ # 3 FORGETTING COST REGULARIZATION
32
+
33
+ # 3.1 SEQUENTIAL KNOWLEDGE TRANSFER PROBLEM STATEMENT
34
+
35
+ In the sequential knowledge transfer problem setting explored in this paper, training is first conducted solely on the source task examples $S$ , including $K _ { S }$ training examples $( x _ { S i } , y _ { S i } ) \in S$ where $x _ { S i }$ is the input representation and $y _ { S i }$ is the output representation. After training is complete on $S$ , we would like to now use prior knowledge obtained in the model trained on $S$ to improve generalization on a new target task with examples $T$ , which includes $K _ { T }$ training examples $( x _ { T i } , y _ { T i } ) \in T$ . Here we assume that the input representations $x _ { S i }$ and $x _ { T i }$ are semantically aligned in the same representation space. As such, if there is useful knowledge in $S$ that applies in some direct or indirect way to the target task that is not present in $T$ , we would expect a good knowledge integration approach to generalize better to the target task than it is possible to using the training data in $T$ alone. Strong performance for the sequential knowledge transfer problem is a first step towards the greater goal of a mechanism for effective lifelong learning (Thrun, 1996).
36
+
37
+ # 3.2 FORGETTING COST FOR TUNING A TARGET TASK MODEL
38
+
39
+ The most straightforward application of our proposed forgetting cost paradigm is for the case of integrating a neural network that has been trained on source task data $S$ , which has outputs in the same representation space as the outputs for the target task data $T$ . In this case, the forgetting cost amounts to the addition of a regularization term in the objective function during the integration phase when we train using $T$ . This promotes the neural network to be able to recreate the soft labels of the initialized model found after training on $S$ before integration is started with $T$ . More formally:
40
+
41
+ $$
42
+ L o s s = L ( y , \hat { y } ) + \alpha _ { f } L ( y _ { i n i t } , \hat { y } )
43
+ $$
44
+
45
+ where $L$ is some loss function (we use mean squared error in our experiments) and $y _ { i n i t }$ is the soft label generated for the target task input $x _ { T i }$ based on the model after training just on $S$ . The model trained just on $S$ is also used to initialize the weights of the target task model before integration with $T$ as we do in the standard fine-tuning paradigm. $\alpha _ { f }$ is a hyperparameter that can be utilized to control the extent of allowed forgetting. Of course, a very similar way to express this idea would be to mix synthetic training examples $T ^ { \prime }$ with the same input as $T$ and output generated by the model trained just on $S$ with the true target task training examples $T$ . In this case, the mixing rate of the teacher generated training examples is analogous to our forgetting parameter $\alpha _ { f }$ determining the prioritization. These techniques perform quite similarly in our experiments, but we actually find that the formulation in equations 1 and 3 perform slightly better on the test set. For example, this formulation is superior by $0 . 4 \%$ accuracy in tuning a distilled representation of a logical rule engine. We conjecture that learning tasks in the same gradient step when they are related to the same input data results in slightly less noisy gradients.
46
+
47
+ # 3.3 FORGETTING COST FOR KNOWLEDGE TRANSFER FROM A RELATED TASK
48
+
49
+ The assumption in section 3.2 that the output of the source task data $S$ should be in the same representation space as the output for the target task data $T$ is quite a big one. It rules out the vast majority of knowledge sources that we can potentially leverage. As such, we propose an extension that does not make this restriction for application in sequential knowledge transfer of tasks that are not directly semantically aligned. We update our model to include another predicted output separate from $\hat { y }$ :
50
+
51
+ $$
52
+ \hat { y } _ { i n i t } = f _ { i n i t } ( W _ { f i x e d } h _ { s h a r e d } + b _ { f i x e d } )
53
+ $$
54
+
55
+ where ${ \hat { y } } _ { i n i t }$ is a predicted output attempting to recreate the soft labels of the original model trained just on $S$ . $f _ { i n i t }$ is the non-linearity used in the final layer of the source task model. Weight matrix $W _ { f i x e d }$ and bias $b _ { f i x e d }$ are taken from the final layer of the source task model and are not updated
56
+
57
+ during integration with the target task data $T$ . As a result, the loss function is updated from section 3.2:
58
+
59
+ $$
60
+ L o s s = L ( y , \hat { y } ) + \alpha _ { f } L ( y _ { i n i t } , \hat { y } _ { i n i t } )
61
+ $$
62
+
63
+ where the hidden state is shared between both terms in the objective function. Up to the shared hidden layer, we initialize the model for the target task with the weights learned just using $S$ . Random matrices and bias vectors are now used to initialize the prediction of $\hat { y }$ based on the shared hidden representation. This can be seen as a weak form of restricting the model parameters that can be useful for regularization. The hidden representation is in effect constrained so that it is promoted not to change in key areas that have a large effect on the output vector of the source task model. On the other hand, there is little regularization for parameters that have little effect on the output vector for the source task model.
64
+
65
+ # 4 RECURRENT NEURAL NETWORK MODEL
66
+
67
+ In recent years, recurrent neural network models have become a tool of choice for many NLP tasks. In particular, the LSTM variant (Hochreiter & Schmidhuber, 1997) has become popular as it alleviates the vanishing gradients problem (Bengio et al., 1994) known to stop recurrent neural networks from learning long term dependencies over the input sequence. In our experiments we use the simpler GRU network (Cho et al., 2014), (Chung et al., 2014) that generally achieves the same accuracy despite a less complex architecture. Each time step $t$ is associated with an input $x _ { t }$ and a hidden state $h _ { t }$ . The mechanics of the GRU are defined with the following equations:
68
+
69
+ $$
70
+ \begin{array} { r } { \begin{array} { r l } & { z _ { t } = \sigma \big ( W _ { x z } x _ { t } + W _ { h z } h _ { t - 1 } \big ) } \\ & { r _ { t } = \sigma \big ( W _ { x r } x _ { t } + W _ { h r } h _ { t - 1 } \big ) } \\ & { { \tilde { h } } _ { t } = t a n h \big ( W _ { x h } x _ { t } + r _ { t } \circ W _ { h h } h _ { t - 1 } \big ) } \\ & { ~ h _ { t } = z _ { t } \circ h _ { t - 1 } + ( 1 - z _ { t } ) \circ { \tilde { h } } _ { t } } \end{array} } \end{array}
71
+ $$
72
+
73
+ where $\circ$ denotes an element-wise product. $W _ { x z } , W _ { x r }$ , and $W _ { x h }$ represent learned matrices that project from the input size to the hidden size. $W _ { h z }$ , $W _ { h r }$ , and $W _ { h h }$ represent learned matrices that project from the hidden size to the hidden size. In our work we evaluate the GRU in the categorical prediction setting. For each document, the hidden state after the last word $h _ { L }$ is used for the prediction $\hat { y }$ of the label $y$ . As such, we treat $h _ { L }$ as the shared hidden representation $h _ { s h a r e d }$ from section 3.3 for our experiments.
74
+
75
+ $$
76
+ \hat { y } = f ( W _ { y h } h _ { L } + b _ { y } )
77
+ $$
78
+
79
+ The prediction goes through one other non-linear function $f$ after the final hidden state is derived. In our experiments we use the softmax function, but others are useful in different settings. A model that builds on top of GRUs with an external memory storage paradigm (Kumar et al., 2015) currently holds the state of the art on movie review sentiment analysis. However, we focus just on the straightforward single layer GRU model in our experiments so that we can more easily disentangle factors of influence on performance. Our GRU model was fed a sequence of fixed 300 dimensional Glove vectors (Pennington et al., 2014), representing words based on analysis of 840 billion words from a common crawl of the internet, as the input $x _ { t }$ for all tasks. It has been shown in a number of papers that tuning the word embeddings during training could increase performance, and it is possible our approach could have performed better had we done so.
80
+
81
+ # 5 SEQUENTIAL KNOWLEDGE TRANSFER EXPERIMENTS
82
+
83
+ # 5.1 EXPERIMENT DETAILS
84
+
85
+ Our neural network models were implemented in Theano (Theano Development Team, 2016) and trained with Stochastic Gradient Descent. As we did not use an advanced optimization method and noticed run to run variation in performance, for all of our transfer learning models we trained 10 parallel versions and chose the one with the highest validation accuracy. The SemEval 2016 Task 4 Subtask A training set consists of 10,000 total training examples, but we were only able to receive 8,906 because of tweet removals when we used the downloading script. For the target task data across our experiments, 7,600 examples of the SemEval training set examples were used for training and the rest for validation. The GRU model achieves only $5 3 . 6 \%$ accuracy on the SemEval testing data when just training with the target task data and random initialization. In order to improve, we consider knowledge transfer from GRUs trained for the following source tasks to the SemEval target task data:
86
+
87
+ Distilling Logical Rules: Knowledge distillation can be performed using teacher models that are very different in structure than their neural network based student models. We demonstrate with this task that a compilation of logical linguistic rules can be used as an effective teacher for a GRU by having the GRU attempt to create the output of the rule engine generated over unlabeled in domain data. Specifically, our gazetteer based logical rule engine separates sentences and phrases in the text. It then applies dictionaries of positive and negative sentiment words and phrases to the corresponding text. For each positive or negative phrase found, it checks to see if negation or double negation are applied, and modifies the polarity of the sentiment accordingly. The result for any piece of text is a count of positive and negative sentiment occurrences. For this task, we simply count the total number of positive and negative indicators to give an overall positive, negative or neutral score. We provide addition details on how we mapped rules to soft targets for the student network to recreate in Appendix A. We utilized a GRU model with 50 hidden units and 50,000 unlabeled examples for our source task model. We distill off the soft labels as in (Hinton et al., 2015), but set our temperature fixed at 1.0. It is possible that our performance could have improved by tuning this parameter. Additional details about the selection of the network and data size are included in Appendix B. The logical rule model itself achieves $5 7 . 8 \%$ accuracy on the SemEval testing data and the rules distilled into a GRU as explained in section 4 achieves $5 8 . 9 \%$ accuracy before any integration with the SemEval target task data. We leverage this task for comparison of knowledge transfer techniques when the source task and target task share an output space as discussed in section 3.2.
88
+
89
+ Binary Movie Reviews: For knowledge transfer from related tasks as discussed in section 3.3 we first consider the Stanford Sentiment Treebank (Socher et al., 2013), which is a popular sentiment dataset based on the movie review domain. We consider one source task to be the binary (positive, and negative) sentence level sentiment subtask which contains 6,920 training examples, 872 validation examples, and 1,821 testing examples. Our GRU model with 40 hidden units achieves $8 5 . 5 \%$ accuracy on this task.
90
+
91
+ Five Class Movie Reviews: We also consider another source task leveraging the Stanford Sentiment Treebank data from the fine grained (very positive, positive, neutral, negative, and very negative) sentence level sentiment substask which contains 8,544 training examples, 1,101 validation examples, and 2,210 testing examples. We use a GRU model with 200 hidden units to accommodate for the increased task complexity and achieve $4 5 . 9 \%$ accuracy. This fine grained model can actually be assessed directly on the SemEval task by projecting from five classes to three classes, but it only achieves $4 4 . 2 \%$ accuracy with no tuning on the target task data. Our performance on these two movie review source tasks is quite similar to what was reported in (Tai et al., 2015) when using a similar setup, but with LSTMs for both subtasks.
92
+
93
+ Emoticon Heuristic: Finally, we consider a semi-supervised task based on emoticon prediction motivated by the successful work in (Go et al., 2009), leveraging it in the twitter sentiment domain and its use as a vital component of the SemEval competition winning system (Bethard et al., 2016). We find unlabelled tweets that contain smileys, frowns, or laughing emoticons. We remove emoticons from the tweet before prediction and compile a dataset of 250,000 training examples, 50,000 validation examples, and 100,000 testing examples for each of the three classes. This is multiple orders of magnitude smaller than the 90 million tweets used in (Bethard et al., 2016) to allow for quick experimentation. Our GRU model with 50 hidden units achieves $6 3 . 4 \%$ accuracy on the emoticon prediction test set.
94
+
95
+ We consider multiple sequential knowledge transfer algorithms for experimental comparison. Each uses only the source task data for learning the source task and only the target task data for integrating with the target task. This way integration is fast and simple, because it does not incorporate storage and replay of examples from the potentially very large source task as argued in (Li & Hoiem, 2016).
96
+
97
+ Fine-Tuning: The representation is simply initialized with the representation found after training on the source task and then trained as usual on the target task. This approach was pioneered in (Hinton & Salakhutdinov, 2006), in application to unsupervised source tasks and applied to transfer learning in (Bengio et al., 2012), and (Mesnil et al.). The learning rate is tuned by a grid search based on the validation set performance.
98
+
99
+ Progressive Networks: We also compare with our implementation of a progressive neural network (Rusu et al., 2016), where the representation learned for the source task is held fixed and integrated with a target task specific model via lateral connections trained using the target task data. The learning rate is also tuned based on a grid search using the validation set.
100
+
101
+ Learning without Forgetting (LwF): In the LwF paradigm, joint training is performed after parameter initialization. This is achieved by treating the target task data and the output generated by the source task model based on the target task input data as two jointly learned tasks as in (Caruana, 1997). As opposed to our proposed forgetting cost, the source task specific parameters are not held fixed while training on the target task data. The learning rate and mixing rate between the tasks are tuned by a grid search based on validation set performance. We first consider a version of the LwF model that leverages a random initialization of the target task specific parameters and initialization of all parameters learned on the source task with the learned values. We also consider another formulation that we call Greedy LwF. This is actually more closely aligned with the original paper (Li & Hoiem, 2016). All source task parameters are first held fixed, and the target task specific parameters are learned alone before joint training with all of the parameters unfrozen as a second step. For the case of source tasks with output in the space of the target task output, there are no source task specific parameters, so the forgetting cost can be viewed as a viable interpretation of the LwF paradigm appropriate in that setting.
102
+
103
+ Forgetting Cost: Finally, we compare each baseline model with our proposed forgetting cost described in section 3. The learning rate as well as $\alpha _ { f }$ from equations 1 and 3 were tuned by a grid search based on the validation set performance.
104
+
105
+ # 5.3 TARGET TASK RESULTS
106
+
107
+ We empirically evaluate the generalization performance of the forgetting cost for sequential knowledge transfer from four different source tasks in Table 1 and Table 2. The source task considered in Table 1 is distilling a logical rule model, leveraging the technique outlined in equation 1. In Table 2 we leverage the forgetting cost for related task knowledge transfer as outlined in equation 3.
108
+
109
+ Our experimental results on the SemEval data validate our intuition that the forgetting cost should lead to stronger regularization and better generalization performance. One thing to note about our progressive neural networks implementation is that it effectively has only one hidden layer, because we hold our embeddings fixed during model training and the same embeddings are shared among the models used for all of the tasks. It is possible that having multiple layers of lateral connections is important to achieving good performance. However, this setting was not applicable in our experiments. Our results for sequential knowledge transfer on the SemEval benchmark are quite encouraging as the forgetting cost outperforms baselines significantly in all cases.
110
+
111
+ We additionally have validated the intuition that equation 1 should perform stronger regularization than equation 3 when equation 1 is applicable. In fact, for our distilled logical rule model tuning experiments, we found that equation 1 performs $3 \%$ better on the test set. In an attempt to understand more about what caused this performance difference, we monitored testing set performance at each epoch and noticed that equation 3 is actually prone to overfitting away from a good solution on the test set. However, it often finds a pretty good one comparable to equation 1 early in training. When equation 1 could be applied, it seems to be a useful regularization to constrain both the hidden layer and the output layer to align with the model learned on the source task. In equation 3, the hidden to output transformation learned for the target task can in contrast learn to deviate from the transformation learned for the source task.
112
+
113
+ Table 1: Evaluation of target task tuning methodologies for a distilled rule model to the task of SemEval 2016 Task 4 Subtask A.
114
+
115
+ <table><tr><td rowspan=1 colspan=1>Model Description</td><td rowspan=1 colspan=1>Accuracyon SemEval Test Set</td></tr><tr><td rowspan=1 colspan=1>Forgetting Cost TransferFine-tuning TransferProgressive Networks Transfer</td><td rowspan=1 colspan=1>64.4%58.5%56.9%</td></tr><tr><td rowspan=1 colspan=1>Distilled Logical Rule ModelLogical Rule ModelGRU Trained on Only SemEval Data</td><td rowspan=1 colspan=1>58.9%57.8%53.6%</td></tr></table>
116
+
117
+ Table 2: Evaluation of knowledge transfer from three source tasks to the task of SemEval 2016 Task 4 Subtask A.
118
+
119
+ <table><tr><td rowspan=1 colspan=1>Source Task</td><td rowspan=1 colspan=1>Fine-Tuning</td><td rowspan=1 colspan=1>ProgressiveNetworks</td><td rowspan=1 colspan=1>LwF</td><td rowspan=1 colspan=1>GreedyLwF</td><td rowspan=1 colspan=1>Forgetting Cost</td></tr><tr><td rowspan=1 colspan=1>Binary Movie Reviews</td><td rowspan=1 colspan=1>57.3%</td><td rowspan=1 colspan=1>54.5%</td><td rowspan=1 colspan=1>58.1%</td><td rowspan=1 colspan=1>58.8%</td><td rowspan=1 colspan=1>59.7%</td></tr><tr><td rowspan=1 colspan=1>Five Class Movie Reviews</td><td rowspan=1 colspan=1>57.4%</td><td rowspan=1 colspan=1>54.6%</td><td rowspan=1 colspan=1>57.1%</td><td rowspan=1 colspan=1>56.6%</td><td rowspan=1 colspan=1>58.2%</td></tr><tr><td rowspan=1 colspan=1>Emoticon Heuristic</td><td rowspan=1 colspan=1>55.8%</td><td rowspan=1 colspan=1>53.2%</td><td rowspan=1 colspan=1>57.7%</td><td rowspan=1 colspan=1>56.7%</td><td rowspan=1 colspan=1>58.6%</td></tr></table>
120
+
121
+ # 5.4 SOURCE TASK PERFORMANCE AFTER TARGET TASK INTEGRATION
122
+
123
+ In Table 3 we explore the retention of empirical performance on the source task for knowledge transfer algorithms after integration with the target task is complete. Apparently in these cases, allowing relearning of the source task model during integration with the target task data is indeed destructive to source task performance. LwF outperforms Fine-Tuning significantly in knowledge retention for movie reviews, but interestingly does not for the emoticon heuristic. The effect of the greedy target task initialization strategy also appears inconsistent. It seems it is possible that this greedy initialization could improve our proposed forgetting cost paradigm in some cases as well. However, a rigorous analysis of the tradeoffs for this initialization approach is beyond the scope of this paper.
124
+
125
+ As the source task representation is literally stored fixed as part of the target task representation in progressive neural networks, it is not clear how to assess any effective forgetting of the source task during target task integration. As a result, we omit them from our source task forgetting experiments.
126
+
127
+ # 5.5 INSPECTION OF LEARNED REPRESENTATIONS
128
+
129
+ Now that we have established the empirical benefits of our proposed forgetting cost, we will demonstrate what it achieves qualitatively through examples. In Table 4 we include a sample of examples that are predicted correctly by transferring the knowledge source with the forgetting cost paradigm and not with fine-tuning based integration. The effect is, perhaps, easiest to understand for the rule based and movie review based transfer scenarios. For the rule based transfer setting you can literally map insights that are not forgotten to their respective logical rule in the model, as is the case in these examples. Moreover, we can see movie domain specific terminology such as ”May the force be with” is seemingly forgotten with standard fine-tuning, but not when the forgetting cost regularization is applied.
130
+
131
+ <table><tr><td rowspan=1 colspan=1>Source Task</td><td rowspan=1 colspan=1>Fine-Tuning</td><td rowspan=1 colspan=1>LwF</td><td rowspan=1 colspan=1>GreedyLwF</td><td rowspan=1 colspan=1>Forgetting Cost</td><td rowspan=1 colspan=1>Source Only</td></tr><tr><td rowspan=1 colspan=1>Binary Movie Reviews</td><td rowspan=1 colspan=1>80.7%</td><td rowspan=1 colspan=1>81.3%</td><td rowspan=1 colspan=1>81.5%</td><td rowspan=1 colspan=1>83.3%</td><td rowspan=1 colspan=1>85.5%</td></tr><tr><td rowspan=1 colspan=1>Five Class Movie Reviews</td><td rowspan=1 colspan=1>41.6%</td><td rowspan=1 colspan=1>42.8%</td><td rowspan=1 colspan=1>43.1%</td><td rowspan=1 colspan=1>43.3%</td><td rowspan=1 colspan=1>45.9%</td></tr><tr><td rowspan=1 colspan=1>Emoticon Heuristic</td><td rowspan=1 colspan=1>59.4%</td><td rowspan=1 colspan=1>59.1%</td><td rowspan=1 colspan=1>58.9%</td><td rowspan=1 colspan=1>60.3%</td><td rowspan=1 colspan=1>63.4%</td></tr></table>
132
+
133
+ Table 3: Evaluation of accuracy on the source task after integration with the target task data of SemEval 2016 Task 4 Subtask A. The accuracy after only source task training prior to integration with the target task is included for reference as a baseline.
134
+
135
+ Table 4: Some transfer learning examples from each knowledge source to SemEval 2016 where the GRU model successfully predicts sentiment when using the forgetting cost paradigm, but not with fine-tuning based integration.
136
+
137
+ <table><tr><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1>Tweet</td><td rowspan=1 colspan=1>Label</td><td rowspan=1 colspan=1>Fine-Tuning</td><td rowspan=1 colspan=1>Forgetting Cost</td></tr><tr><td rowspan=1 colspan=1>Logical Rules</td><td rowspan=1 colspan=1>JohnKasich should feel proud of hisperformance at the#GOPDebate Thursday night. He looked more presi-dential than the rest of the field.</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Positive</td></tr><tr><td rowspan=1 colspan=1>Logical Rules</td><td rowspan=1 colspan=1>@ BrunoMars I&#x27;m so tired of you dressing like you ain&#x27;tgot no money. You went from wearing Gucci loafers to6th grade boy Sketchers.</td><td rowspan=1 colspan=1>Negative</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Negative</td></tr><tr><td rowspan=1 colspan=1>Logical Rules</td><td rowspan=1 colspan=1>@DavidVonderhaar loving the beta Vahn, even playing it on PC with a PS4 controller without aim assist, can&#x27;twait for November 6</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Positive</td></tr><tr><td rowspan=1 colspan=1>Movie Reviews</td><td rowspan=1 colspan=1>Selena Gomez presented Amy Schumerwithanawardand a heap of praise at the Hollywood Film Awards onNovember 1.</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Negative</td><td rowspan=1 colspan=1>Positive</td></tr><tr><td rowspan=1 colspan=1>Movie Reviews</td><td rowspan=1 colspan=1>mailjet: It&#x27;s Fri...we mean Star Wars Day. May the forcebe with all of your emails! https://t.co/FbDdjiJVUT</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Positive</td></tr><tr><td rowspan=1 colspan=1>Movie Reviews</td><td rowspan=1 colspan=1>Straight Outta Compton&#x27;s success hopefully convincesNew Line Cinema to give Ice Cube the right budget forthe last Friday movie.</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Positive</td></tr><tr><td rowspan=1 colspan=1>Emoticons</td><td rowspan=1 colspan=1>That ball Kris Bryant just hit is the 2nd farthest ball I&#x27;veever seen hit. He is officially ridiculous.</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Positive</td></tr><tr><td rowspan=1 colspan=1>Emoticons</td><td rowspan=1 colspan=1>This fandom&#x27;s a mess omg,Iwouldn&#x27;t be surprise if to-morrow there&#x27;s a trend who says Niall&#x27;s going to marryhis cousin #WeKnowTheTruth</td><td rowspan=1 colspan=1>Negative</td><td rowspan=1 colspan=1>Positive</td><td rowspan=1 colspan=1>Negative</td></tr><tr><td rowspan=1 colspan=1>Emoticons</td><td rowspan=1 colspan=1>Christians snapchat story makes me want to kill my-self.like Ifeel like a depressed 8th grader going throughthat emo phase</td><td rowspan=1 colspan=1>Negative</td><td rowspan=1 colspan=1>Neutral</td><td rowspan=1 colspan=1>Negative</td></tr></table>
138
+
139
+ Considering that we have shown a neural network can distill and improve a representation learned by a logical rule engine, how the final representation differs from the logic of the original engine is of practical interest. We thus compare the agreement of our fine-tuned rule based GRU with the original rule model on the SemEval testing set. We find that the transferred model achieves $78 . 7 \%$ agreement with the rule model when the rule model is right. This clearly indicates that our final model is not deterministic based on the rule engine, and has a probability of adding errors even when the original rule model works well. However, our model actually has $4 4 . 7 \%$ accuracy on the examples the rule model got wrong. Our approach yields significant gains in comparison to the original rule classifiers, improving from $5 7 . 8 \%$ to $6 4 . 4 \%$ test set accuracy before even incorporating in auxiliary knowledge sources.
140
+
141
+ # 6 INTEGRATING TRANSFER LEARNING FROM MULTIPLE TASKS WITH ENSEMBLE DISTILLATION
142
+
143
+ # 6.1 ENSEMBLE METHODOLOGY
144
+
145
+ In our experiments we tried to find a balance between an ensemble model that is powerful enough to have an adaptive weighted average decision function and not so powerful that it overfits on our limited training and validation data. Our model is quite similar in architecture to the gating network component of a hierarchical mixture of experts model (Jacobs et al., 1991), (Jordan & Jacobs, 1994). We tried our model over all four representations at once and found that it overfits. Our experiments showed it is more effective to adopt a greedy ensembling strategy where all models are combined with the best performing model on the validation set at each phase until only two models are left. Finally, these two models are combined with the same mechanism. (Riemer et al., 2016) suggests that a many element gating network can be improved with a sparsity constraint, but this did not work as well as the greedy strategy for our model and experiments.
146
+
147
+ More formally, for any two models $A$ and $B$ combined in an ensemble, we train the following mechanism using Stochastic Gradient Descent:
148
+
149
+ Table 5: Empirical three way sentiment classification results on the SemEval 2016 Task 4 Subtask A test set.
150
+
151
+ <table><tr><td rowspan=1 colspan=1>ModelDescription</td><td rowspan=1 colspan=1>AccuracyonSemEval TestSet</td></tr><tr><td rowspan=1 colspan=1>Distilled GRUTrained on Full EnsembleFull EnsembleEnsemble withLogical Rules and Both Movie Review TasksEnsemble with Logical Rules and Binary Movie ReviewsEnsemble with Logical Rules and Five Class Movie ReviewsEnsemble with Logical Rules and Emoticon PredictionEnsemble withBothMovie Review TasksGRU Trained on Only SemEval Data</td><td rowspan=1 colspan=1>66.0%65.9%65.7%65.4%65.1%65.0%62.1%53.6%</td></tr><tr><td rowspan=1 colspan=1>SwissCheese (Bethard etal.,2016)NTNUSentEval (Jahren et al.,2016)UniPI (Attardi &amp; Sartiano,2016)CUFE (Nabil et al.,2016)INSIGHT-1 (Ruder et al., 2016)</td><td rowspan=1 colspan=1>64.6%64.3%63.9%63.7%63.5%</td></tr></table>
152
+
153
+ $$
154
+ \begin{array} { r } { m _ { A } = \sigma ( W _ { A } \hat { y } _ { A } + b _ { A } ) } \\ { m _ { B } = \sigma ( W _ { B } \hat { y } _ { B } + b _ { B } ) } \end{array}
155
+ $$
156
+
157
+ $$
158
+ a _ { A } = { \frac { m _ { A } } { m _ { A } + m _ { B } } }
159
+ $$
160
+
161
+ $$
162
+ a _ { B } = { \frac { m _ { B } } { m _ { A } + m _ { B } } }
163
+ $$
164
+
165
+ $$
166
+ \hat { y } _ { e n s e m b l e } = a _ { A } \hat { y } _ { A } + a _ { B } \hat { y } _ { B }
167
+ $$
168
+
169
+ where $\hat { y } _ { e n s e m b l e }$ is the prediction vector of the combined ensemble. ${ \hat { y } } _ { A }$ and $\hat { y } _ { B }$ are the output vectors of the individual models.
170
+
171
+ # 6.2 ENSEMBLE RESULTS
172
+
173
+ Our ensemble model was trained on what was set aside as the validation data during the initial training with early stopping. In the first phase of combining, the model transferred from the logical rule source task was combined with each model. In the second phase, the model based on transfer from the binary movie review sentiment model was combined with each model. In the third phase, the two remaining models were combined. The results of our ensemble in Table 5 suggest that it is possible to further improve the performance of a single sequential transfer model by intelligently combining its predictions with models that have other perspectives. This is because they are modeled using different source tasks for prior knowledge. Impressively, our final distilled model surpasses results from all prior models on the SemEval 2016 benchmark using the same final architecture of a 50 hidden unit GRU model that is clearly not even competitive when trained simply on the task specific labeled data. The prior best model SwissCheese (Bethard et al., 2016) consists of random forests ensemble built utilizing multiple convolutional neural network models and distant supervision. In fact, we achieve superior results despite using over an order of magnitude less total data for training our model.
174
+
175
+ We would also like to underscore that our total improvement of $1 . 5 \%$ as a result of creating an ensemble with our best transferred model from the logical rule source task can be viewed as quite disappointing, despite achieving state of the art results. In fact, in the theoretical limit of having a decision model that switches to the best already learned model at each point, our four transferred representations would achieve $8 5 . 1 \%$ accuracy together. For the combination of the movie review based models and logical rule based model we can get to $8 1 . 4 \%$ accuracy. Moreover, we can get $7 6 . 5 \%$ accuracy with just the logical rule based transfer model and the emoticon prediction based transfer model. Unfortunately, we achieve nowhere near these theoretical results despite representations that are apparently quite diverse. This seems indicative that there are significant gains yet to be uncovered in integrating these representations.
176
+
177
+ # 7 CONCLUSION
178
+
179
+ We consider a new methodology called the forgetting cost for preventing the catastrophic forgetting problem of neural network sequential transfer learning. The forgetting cost is practical and easy to implement. We have demonstrated for the challenging task of Twitter sentiment analysis that it can uncover significant gains in generalization performance and that it seems to not forget knowledge traditionally forgotten from the source task during fine-tuning. Our strong empirical results still motivate multiple avenues with high potential for continued exploration in text analytics. Using logical rules to improve neural network models is a promising direction for humans to efficiently contribute to increased model performance. Additionally, the large diversity of representations learned from multiple classifiers with the same target task but different source tasks seems to indicate there is potential to see even much greater gains when integrating multiple sources of knowledge transfer.
180
+
181
+ # REFERENCES
182
+
183
+ Giuseppe Attardi and Daniele Sartiano. Unipi at semeval-2016 task 4: Convolutional neural networks for sen-timent classification. Proceedings of SemEval, pp. 220–224, 2016.
184
+
185
+ Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? In Advances in neural information processing systems, pp. 2654–2662, 2014.
186
+
187
+ Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. Neural Networks, IEEE Transactions on, 5(2):157–166, 1994.
188
+
189
+ Yoshua Bengio et al. Deep learning of representations for unsupervised and transfer learning. ICML Unsupervised and Transfer Learning, 27:17–36, 2012.
190
+
191
+ Steven Bethard, Daniel M. Cer, Marine Carpuat, David Jurgens, Preslav Nakov, and Torsten Zesch (eds.). Proceedings of the 10th International Workshop on Semantic Evaluation, SemEval@NAACL-HLT 2016, San Diego, CA, USA, June 16-17, 2016, 2016. The Association for Computer Linguistics. ISBN 978-1-941643-95-2. URL http://aclweb.org/ anthology/S/S16/.
192
+
193
+ Cristian Bucilu, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 535–541. ACM, 2006.
194
+
195
+ Rich Caruana. Multitask learning. Machine Learning, 28(1):41–75, 1997. doi: 10.1023/A: 1007379606734. URL http://dx.doi.org/10.1023/A:1007379606734.
196
+
197
+ Tianqi Chen, Ian Goodfellow, and Jonathon Shlens. Net2net: Accelerating learning via knowledge transfer. arXiv preprint arXiv:1511.05641, 2015.
198
+
199
+ Kyunghyun Cho, Bart van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014.
200
+
201
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
202
+
203
+ Artur S d’Avila Garcez, Krysia Broda, and Dov M Gabbay. Neural-symbolic learning systems: foundations and applications, 2012.
204
+
205
+ Alec Go, Richa Bhayani, and Lei Huang. Twitter sentiment classification using distant supervision. 2009.
206
+
207
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
208
+
209
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. Science, 313(5786):504–507, 2006.
210
+
211
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
212
+
213
+ Zhiting Hu, Xuezhe Ma, Zhengzhong Liu, Eduard Hovy, and Eric Xing. Harnessing deep neural networks with logic rules. arXiv preprint arXiv:1603.06318, 2016.
214
+
215
+ Robert A Jacobs, Michael I Jordan, Steven J Nowlan, and Geoffrey E Hinton. Adaptive mixtures of local experts. Neural computation, 3(1):79–87, 1991.
216
+
217
+ Brage Ekroll Jahren, Valerij Fredriksen, Bjorn Gamb ¨ ack, and Lars Bungum. Ntnusenteval at ¨ semeval-2016 task 4: Combining general classifiers for fast twitter sentiment analysis. Proceedings of SemEval, pp. 103–108, 2016.
218
+
219
+ Michael I Jordan and Robert A Jacobs. Hierarchical mixtures of experts and the em algorithm. Neural computation, 6(2):181–214, 1994.
220
+
221
+ Ankit Kumar, Ozan Irsoy, Jonathan Su, James Bradbury, Robert English, Brian Pierce, Peter Ondruska, Ishaan Gulrajani, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. arXiv preprint arXiv:1506.07285, 2015.
222
+
223
+ Zhizhong Li and Derek Hoiem. Learning without forgetting. In European Conference on Computer Vision, pp. 614–629. Springer, 2016.
224
+
225
+ David Lopez-Paz, Leon Bottou, Bernhard Sch ´ olkopf, and Vladimir Vapnik. Unifying distillation ¨ and privileged information. stat, 1050:26, 2016.
226
+
227
+ Andrew L Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ , and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pp. 142–150. Association for Computational Linguistics, 2011.
228
+
229
+ Gregoire Mesnil, Yann Dauphin, Xavier Glorot, Salah Rifai, Yoshua Bengio, Ian J Goodfellow, ´ Erick Lavoie, Xavier Muller, Guillaume Desjardins, David Warde-Farley, et al. Unsupervised and transfer learning challenge: a deep learning approach.
230
+
231
+ Gregoire Mesnil, Tomas Mikolov, Marc’Aurelio Ranzato, and Yoshua Bengio. Ensemble of gen- ´ erative and discriminative techniques for sentiment analysis of movie reviews. arXiv preprint arXiv:1412.5335, 2014.
232
+
233
+ Jacob MJ Murre. Learning and categorization in modular neural networks. 1992.
234
+
235
+ Mahmoud Nabil, Mohamed Aly, and Amir F Atiya. Cufe at semeval-2016 task 4: A gated recurrent model for sentiment classification. Proceedings of SemEval, pp. 52–57, 2016.
236
+
237
+ Preslav Nakov, Alan Ritter, Sara Rosenthal, Veselin Stoyanovand, and Fabrizio Sebastiani. Semeval2016 task 4: Sentiment analysis in twitter. In Proc. of the 10th International Workshop on Semantic Evaluation (SemEval), 2016.
238
+
239
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, volume 14, pp. 1532–1543, 2014.
240
+
241
+ Matthew Riemer, Sophia Krasikov, and Harini Srinivasan. A deep learning and knowledge transfer based architecture for social media user characteristic determination. SocialNLP 2015 at NAACL, pp. 39, 2015.
242
+
243
+ Matthew Riemer, Aditya Vempaty, Flavio Calmon, Fenno Heath, Richard Hull, and Elham Khabiri. Correcting forecasts with multifactor neural attention. In Proceedings of The 33rd International Conference on Machine Learning, 2016.
244
+
245
+ Anthony Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2): 123–146, 1995.
246
+
247
+ Anthony Robins. Consolidation in neural networks and in the sleeping brain. Connection Science, 8(2):259–276, 1996.
248
+
249
+ 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.
250
+
251
+ Sebastian Ruder, Parsa Ghaffari, and John G Breslin. Insight-1 at semeval-2016 task 5: Deep learning for multilingual aspect-based sentiment analysis. arXiv preprint arXiv:1609.02748, 2016.
252
+
253
+ Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy distillation. arXiv preprint arXiv:1511.06295, 2015.
254
+
255
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
256
+
257
+ Richard Socher, Alex Perelygin, Jean Y Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { \Delta Y N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the conference on empirical methods in natural language processing (EMNLP), volume 1631, pp. 1642. Citeseer, 2013.
258
+
259
+ 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.
260
+
261
+ Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688, May 2016. URL http://arxiv.org/abs/ 1605.02688.
262
+
263
+ Sebastian Thrun. Is learning the n-th thing any easier than learning the first? Advances in neural information processing systems, pp. 640–646, 1996.
264
+
265
+ Geoffrey G Towell, Jude W Shavlik, and Michiel O Noordewier. Refinement of approximate domain theories by knowledge-based neural networks. In In Proceedings of the Eighth National Conference on Artificial Intelligence. Citeseer, 1990.
266
+
267
+ # A MAPPING SENTIMENT RULES TO SOFT TARGETS
268
+
269
+ The gazetteer based logical rule engine separates sentences and phrases in the text. It then applies dictionaries of positive and negative sentiment words and phrases to the corresponding text. For each positive or negative phrase found, it checks to see if negation or double negation are applied, and modifies the polarity of the sentiment accordingly. The result for any piece of text is a count of positive and negative sentiment occurrences. For this task, we simply count the total number of positive and negative indicators to give an overall positive, negative or neutral score. To be concrete, we have a simple procedure for mapping positive and negative word counts to soft labels that could be used for distillation. If there are no positive or negative words, the output vector is a one hot vector corresponding to a neutral label. If there are an unequal number of positive and negative sentiment words, the neutral label is zero and the raw counts are sent to the softmax function to create a soft label over the positive and negative word occurrences. Finally, if there are an equal amount of positive and negative words, we consider the added total sentiment words plus one in the neutral label as well as the number of positive words and negative words before sending these totals through a softmax function.
270
+
271
+ # B SIZE SELECTION FOR THE RULE DISTILLATION TASK
272
+
273
+ In Table 6 we detail the performance of distilling a logical rule engine into a GRU based recurrent neural network by imposing soft labels over unlabeled tweets. The fact that we keep our word representations fixed with general purpose unsupervised data makes it difficult for the GRU to distill the entire model without a large number of examples. Additionally, as there were a large number of examples in our distillation experiments, we did not experience high run to run variation and only trained a single GRU model for each distillation experiment (as opposed to picking the best validation error of 10 parallel training routines as in our transfer experiments). Our distilled GRU is better on the testing set than the original classifier, likely because this input representation prevents the model from overfitting to the idiosyncrasies of the rule engine. This actually underscores an important point for the distillation of abstract knowledge. If the target task is known during distillation, it may be beneficial to stop short of totally distilling the original knowledge as it may hurt down stream performance past a certain point. We impose a simple policy where the best hidden unit and training example combination is selected based on performance on the training data of the target task. As a result, we use the model with 50 hidden units based on 50,000 training examples in our experiments integrating with other knowledge. This model is a pretty good one to choose, and achieves high transfer performance relative to models that overfit on the teacher network.
274
+
275
+ Table 6: Logical rule engine distillation performance and SemEval 2016 Task 4 Subtask A accuracy as a function of the number of hidden units in the GRU and the number of training examples. The 50 hidden unit and 50,000 training example model performs the best on the SemEval training set.
276
+
277
+ <table><tr><td>Hidden Units</td><td>Examples</td><td>Alignmentwith Teacher</td><td>AccuracyonSemEval TestSet</td></tr><tr><td>25</td><td>50,000</td><td>88.3%</td><td>59.1%</td></tr><tr><td>25</td><td>300,000</td><td>91.9%</td><td>58.6%</td></tr><tr><td>50</td><td>50,000</td><td>88.6%</td><td>58.9%</td></tr><tr><td>50</td><td>300,000</td><td>93.0%</td><td>58.5%</td></tr><tr><td>75</td><td>50,000</td><td>88.7%</td><td>58.9%</td></tr><tr><td>75 100</td><td>300,000 50,000</td><td>93.6%</td><td>58.3%</td></tr><tr><td>100</td><td>300,000</td><td>88.6%</td><td>58.7%</td></tr><tr><td>125</td><td>50,000</td><td>93.8%</td><td>58.1%</td></tr><tr><td>125</td><td>300,000</td><td>88.5%</td><td>58.7%</td></tr><tr><td>150</td><td>50,000</td><td>93.7%</td><td>58.3%</td></tr><tr><td>150</td><td>300,000</td><td>88.5% 94.0%</td><td>59.0% 58.5%</td></tr></table>
md/train/HylzTiC5Km/HylzTiC5Km.md ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERATING HIGH FIDELITY IMAGES WITH SUBSCALE PIXEL NETWORKS AND MULTIDIMENSIONAL UPSCALING
2
+
3
+ Jacob Menick∗
4
+ DeepMind
5
+ jmenick@google.com
6
+
7
+ Nal Kalchbrenner∗ Google Brain Amsterdam nalk@google.com
8
+
9
+ # ABSTRACT
10
+
11
+ The unconditional generation of high fidelity images is a longstanding benchmark for testing the performance of image decoders. Autoregressive image models have been able to generate small images unconditionally, but the extension of these methods to large images where fidelity can be more readily assessed has remained an open problem. Among the major challenges are the capacity to encode the vast previous context and the sheer difficulty of learning a distribution that preserves both global semantic coherence and exactness of detail. To address the former challenge, we propose the Subscale Pixel Network (SPN), a conditional decoder architecture that generates an image as a sequence of sub-images of equal size. The SPN compactly captures image-wide spatial dependencies and requires a fraction of the memory and the computation required by other fully autoregressive models. To address the latter challenge, we propose to use Multidimensional Upscaling to grow an image in both size and depth via intermediate stages utilising distinct SPNs. We evaluate SPNs on the unconditional generation of CelebAHQ of size 256 and of ImageNet from size 32 to 256. We achieve state-of-the-art likelihood results in multiple settings, set up new benchmark results in previously unexplored settings and are able to generate very high fidelity large scale samples on the basis of both datasets.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ A successful generative model has two core aspects: it produces targets that have high fidelity and it generalizes well on held-out data. Autoregressive (AR) models trained by conventional maximum likelihood estimation (MLE) have produced superior scores on held-out data across a wide range of domains such as text (Vaswani et al., 2017; Wu et al., 2016), audio (van den Oord et al., 2016a), images (Parmar et al., 2018) and videos (Kalchbrenner et al., 2016). These scores are a measure of the models’ ability to generalize in that setting. From the perspective of sample fidelity, the outputs generated by AR models have also achieved state-of-the-art fidelity in many of the aforementioned domains with one notable exception. In the domain of unconditional large-scale image generation, AR samples have yet to manifest long-range structure and semantic coherence.
16
+
17
+ One source of difficulties impeding high-fidelity image generation is the multi-faceted relationship between the MLE scores achieved by a model and the model’s sample fidelity. On the one hand, MLE is a well-defined measure as improvements in held-out scores generally produce improvements in the visual fidelity of the samples. On the other hand, as opposed to for example adversarial methods (Arora & Zhang, 2017), MLE forces the model to support the entire empirical distribution. This guarantees the model’s ability to generalize at the cost of allotting capacity to parts of the distribution that are irrelevant to fidelity. A second source of difficulties arises from the high dimensionality of large images. A $2 5 6 \times 2 5 6 \times 3$ image has a total of 196,608 positions that need to be architecturally connected in order to learn dependencies among them; the representations at each position require sufficient capacity to express their respective surrounding contexts. These requirements translate to large amounts of memory and computation.
18
+
19
+ ![](images/95c2aef047f12f2740eba99f379e7a1c4e685396bb70dd2a36d7926b37c9409b.jpg)
20
+ Figure 1: A representation of Multidimensional Upscaling. Left: depth upscaling is applied to a generated 3-bit $2 5 6 \times 2 5 6$ RGB subimage from CelebAHQ to map it to a full 8-bit $2 5 6 \times 2 5 6$ RGB image. Right: size upscaling followed by depth upscaling are applied to a generated 3-bit $3 2 \times 3 2$ RGB subimage from ImageNet to map it to the target resolution of the 8-bit $1 2 8 \times 1 2 8$ RGB image. We stress that the rightmost column of both figures are true unconditional samples from our model at full 8bit depth.
21
+
22
+ These difficulties notwithstanding, we aim to learn the full distribution over 8-bit RGB images of size up to $2 5 6 \times 2 5 6$ well enough so that the samples have high fidelity. We aim to guide the model to focus first on visually more salient bits of the distribution and later on the visually less salient bits. We identify two visually salient subsets of the distribution: first, the subset determined by sub-images (“slices”) of smaller size (e.g. $3 2 \times 3 2$ ) sub-sampled at all positions from the original image; and secondly, the subset determined by the few (e.g. 3) most significant bits of each RGB channel in the image. We use Multidimensional Upscaling to map from one subset of the distribution to the other one by upscaling images in size or in depth. For example, the generation of a $1 2 8 \times 1 2 8 :$ 8-bit RGB image proceeds by first upscaling it in size from a $3 2 \times 3 2$ 3-bit RGB image to a $1 2 8 \times 1 2 8$ 3-bit RGB image; we then upscale the resulting image in depth to the original resolution of the $1 2 8 \times 1 2 8$ 8-bit RGB image. We thus train three networks: (a) a decoder on the small size, low depth image slices subsampled at every $n$ pixels from the original image with the desired target resolution; (b) a size-upscaling decoder that generates the large size, low depth image conditioned on the small size, low depth image; and (c) a depth-upscaling decoder that generates the large size, high depth image conditioned on the large size, low depth image. Figure 1 illustrates this process.
23
+
24
+ To address the latter difficulties that ensue in the training of decoders (b) and (c), we develop the Subscale Pixel Network (SPN) architecture. The SPN divides an image of size $N \times N$ into sub-images of size $\begin{array} { r } { \frac { N } { S _ { . } } \times \frac { N } { S } } \end{array}$ sliced out at interleaving positions (see Figure 2), which implicitly also captures a form of size upscaling. The $N \times N$ image is generated one slice at a time conditioned on previously generated slices in a way that encodes a rich spatial structure. SPN consists of two networks, a conditioning network that embeds previous slices and a decoder proper that predicts a single target slice given the context embedding. The decoding part of the SPN acts over image slices with the same spatial structure and it can share weights for all of them. The SPN is an independent image decoder with an implicit size upscaling mechanism, but it can also be used as an explicit size upscaling network by initializing the first slice of the SPN input at sampling time with one generated separately during step (a).
25
+
26
+ We extensively evaluate the performance of SPN and the size and depth upscaling methods both quantitatively and from a fidelity perspective on two unconditional image generation benchmarks, CelebAHQ-256 and ImageNet of various sizes up to 256. From a MLE scores perspective, we compare with previous work to obtain state-of-the-art results on CelebAHQ-256, both at full 8-bit resolution and at the reduced 5-bit resolution (Kingma & Dhariwal, 2018), and on ImageNet-64. We also establish MLE baselines for ImageNet-128 and ImageNet-256. From a sample fidelity perspective, we show the strong benefits of multidimensional upscaling as well as the benefits of the SPN. We produce CelebAHQ-256 samples (at full 8-bit resolution) that are of similar visual fidelity to those produced with methods such as GANs that lack however an intrinsic measure of generalization (Mescheder, 2018; Karras et al., 2017). We also produce some of the first successful samples on unconditional ImageNet-128 (also at 8-bit) showing again the striking impact of the SPN and of multidimensional upscaling on sample quality and setting a fidelity baseline for future methods.
27
+
28
+ ![](images/7b2a844dbd9243a20e217da5e13212d83a158d5360aa6104f93056ee1c073ba0.jpg)
29
+ .Figure 2: The receptive field in a Subscale Pixel Networks (a) and the four image slices subsampled from the original image (b)
30
+
31
+ # 2 MODEL
32
+
33
+ # 2.1 CONVENTIONAL GENERATION ORDERING
34
+
35
+ A standard AR image model such as the PixelCNN (van den Oord et al., 2016b) generates an $H x W$ colour image starting at the top-left position and ending at the bottom-right position, fully generating the three 8-bit channels of each pixel in a given position:
36
+
37
+ $$
38
+ P ( \mathbf { x } ) = \prod _ { h = 1 } ^ { H } \prod _ { w = 1 } ^ { W } \prod _ { c } ^ { \{ R , G , B \} } P ( x _ { h , w , c } | \mathbf { x } _ { < } )
39
+ $$
40
+
41
+ where $\mathbf { x } _ { < }$ corresponds to all previously generated intensity values in the ordering and $h , w .$ , and $c$ are row, column, and colour channel indices. The raster scan ordering (Figure 3(a)) is conventionally used in AR models. Each conditional distribution $P ( x _ { h , w , c } | \mathbf { x } _ { < } )$ is parametrized by a deep neural network (van den Oord et al., 2016b).
42
+
43
+ # 2.2 SUBSCALE ORDERING IN IMAGES
44
+
45
+ We define an alternative ordering that divides a large image into a sequence of equally sized slices and has various core properties. First, it makes it easy to compactly encode long-range dependencies across the many pixels in the large images. It also induces a spatial structure over the original image by aligning the subsampled slices; this also has an implicit size upscaling side effect. From the perspective of the neural architecture, it makes it possible for the same decoder within the SPN to be consistently applied to all slices, since they are structurally similar; the smaller slices also allow for self-attention (Vaswani et al., 2017) in the SPN to be used without local contexts (Parmar et al., 2018). We think of the ordering as the two-dimensional analogue of the one-dimensional subscale ordering introduced in Kalchbrenner et al. (2018).
46
+
47
+ The subscale ordering is defined as follows:
48
+
49
+ $$
50
+ P ( \mathbf { x } ) = \prod _ { i = 1 } ^ { S } \prod _ { j = 1 } ^ { S } \prod _ { h = 1 } ^ { H / S } \prod _ { w = 1 } ^ { W / S } \prod _ { c } ^ { \{ R , G , B \} } P ( x _ { i + S * h , j + S * w , c } | \mathbf { x } _ { < } )
51
+ $$
52
+
53
+ where $\mathbf { x } _ { < }$ corresponds to all previously generated intensity values according to this ordering. Figure 3(d) illustrates the subscale ordering. A scaling factor $S$ is selected and each slice of size $H / S \times W / S$ is obtained by selecting a pixel every $S$ pixels in both height and width; there are thus $S ^ { 2 }$ interleaved slices in the original image, with each specified by its row and column offset $( i , j )$ . We sometimes refer to this offset as the “meta-position” of a slice.
54
+
55
+ ![](images/98559d46079f8d28599a7a5163c09abb9d3f0b63ff32e33727c28ac6d3f9a3f2.jpg)
56
+ Figure 3: Different generation ordering schemes, where the numbers indicate the step-by-step order. Distinct colors correspond to distinct neural networks. (a) and (b) are from (van den Oord et al., 2016b). (c) is from (Reed et al., 2017). The Subscale ordering alone, with size-only, depth-only and with multidimensional upscaling are, respectively, in blocks (d), (e), (f) and (g).
57
+
58
+ # 2.3 SIZE UPSCALING IN SUBSCALE ORDERING
59
+
60
+ The subscale ordering itself already captures size upscaling implicitly. Analogous to the multi-scale ordering (van den Oord et al., 2016b), and depicted in 3(b), we can perform size upscaling explicitly, by training a single slice decoder on subimages and generate the first slice of a subscale ordering from the single slice decoder itself. The rest of the image is then generated according to the subscale ordering by the main network (see 3(e)). The single-slice model can be trained on just the first slices of images, or on slices at all positions in all images given the shared spatial structure among the slices. For this reason, the same SPN that captures the subscale ordering can act simultaneously as a full-blown image model as well as a size upscaling model if initialized with the outputs of a single-slice decoder. A separate formulation of size upscaling is the Parallel Multi-Scale (Reed et al., 2017) ordering where the pixels in an image are doubled at every stage by distinct neural networks and are generated in parallel without sequentiality (3(c)).
61
+
62
+ # 2.4 DEPTH UPSCALING
63
+
64
+ Multidimensional upscaling applies upscaling not just in the height and width of the image, but also in the remaining dimension that is channel depth. This is performed in stages such that a network first generates the $d _ { 1 }$ most significant bits of an image using a conventional or subscale ordering; then a second network generates the next $d _ { 2 }$ most significant bits of the image conditioned on all the $d _ { 1 }$ bits of the image; and so on to further stages. Using the conventional ordering as basis, the first stage of depth upscaling looks as follows:
65
+
66
+ $$
67
+ P ( \mathbf { x } ^ { : \mathbf { d } _ { 1 } } ) = \prod _ { h = 1 } ^ { H } \prod _ { w = 1 } ^ { W } \prod _ { c } ^ { \{ R , G , B \} } P ( \mathbf { x } _ { \mathbf { h } , \mathbf { w } , \mathbf { c } } ^ { : \mathbf { d } _ { 1 } } | \mathbf { x } ^ { : \mathbf { d } _ { 1 } } < )
68
+ $$
69
+
70
+ Next, a second stage of depth upscaling has the following form, conditioned on the first $d _ { 1 }$ bits of each channel:
71
+
72
+ $$
73
+ P ( \mathbf { x ^ { d _ { 1 } : d _ { 2 } } } ) = \prod _ { h = 1 } ^ { H } \prod _ { w = 1 } ^ { W } \prod _ { c } ^ { \{ R , G , B \} } P ( \mathbf { x _ { h , w , c } ^ { d _ { 1 } : d _ { 2 } } } | \mathbf { x ^ { d _ { 1 } : d _ { 2 } } } _ { < } , \mathbf { x } ^ { : d _ { 1 } } )
74
+ $$
75
+
76
+ We do not share weights among the networks at different stages of depth upscaling. We note that in depth upscaling bits of lower significance are only generated when the more significants bits at all positions have been generated in a previous stage. Just like for size upscaling from the previous section, the goal of multidimensional upscaling is to let the model focus on visually salient bits of an image unaffected by less salient and less predictable bits of the image. Depth upscaling is related to the method underlying the Grayscale PixelCNN that models 4-bit greyscale images subsampled from colored images Kolesnikov & Lampert (2016a).
77
+
78
+ ![](images/fe7ca922f4649bae3603e8639b2d4ae3c036fa4269b86d943ed1c5ad94c6973b.jpg)
79
+ (a) (b)Figure 4: (a) The architecture of a Subscale Pixel Network, with a conditional and a decoding part. (b) Scheme of the parts in the decoder itself.
80
+
81
+ # 3 ARCHITECTURE
82
+
83
+ # 3.1 CHALLENGES IN TRAINING CONVENTIONAL DECODERS ON LARGE IMAGES
84
+
85
+ Using a conventional generation ordering, models such as PixelRNN, PixelCNN (van den Oord et al., 2016b) and Image Transformer (Parmar et al., 2018) construct a representation of the generated context for each dimension of each pixel. Existing AR approaches inherently require an amount of computation and memory that is superlinear in the number of pixels. In particular, the quadratic memory requirements of self-attention become severely limiting for images larger than $3 2 \times 3 2$ and intractable in practice for the 196,608 distinct positions we consider in a $2 5 6 \times 2 5 6$ colour image.
86
+
87
+ Mitigating the memory requirements and computational requirements of encoding the dependencies amongst so many variables often comes at the expense of global context. Modeling choices such as cropping images within the decoders (Kalchbrenner et al., 2016) or performing self-attention over local neighborhoods (Parmar et al., 2018) neglect global dependencies, while model parallelism, though technically feasible with the joint use of a very large number of accelerators, does not overcome the challenges in learning the global structure.
88
+
89
+ # 3.2 SUBSCALE PIXEL NETWORK
90
+
91
+ To address these challenges, we devise the Subscale Pixel Network (SPN), an architecture that embodies the subscale ordering from Section 2.2. For an image of size $H \times W \times 3 \times D$ , where $D$ is the number of bits used for the current generation stage, one first chooses a scaling factor $S$ and obtains the $S ^ { 2 }$ slices of the original image of size $H / S \times W / S \times 3 \times D$ . We use $H = W = 2 5 6$ and $S = 8$ as well as $H = W = 1 2 8$ and $S = 4$ , for the larger images we process, so that the slices have size $3 2 \times 3 2 \times 3 \times D$ . This scheme of choosing $S$ such that slices are always $3 2 \times 3 2$ renders the memory and computation requirements effectively constant as the true image size $H \times W$ changes.
92
+
93
+ The SPN architecture is composed of two parts: an embedding part for slices at preceding metapositions that conditions the decoder for the current slice that is being generated (Figure 4 (a)). The embedding part is a convolutional neural network with residual blocks that takes as input preceding slices that are concatenated along the depth dimension. One detail is the way the slices are ordered along the channel dimension when concatenated. As illustrated in Figure 4 (a), empty padding slices are used to preserve relative meta-positions of each preceding slice with respect to the current target slice. For example, the slice above any target slice in the two-dimensional meta-grid is always aligned in the same position along the depth axis in the input. This achieves equivariance in the embedding architecture with respect to the $( i , j )$ offset of a slice. The padding slices also ensure that the depth of the input slice tensor remains the same for all target slices. In addition to the slice tensor, the embedding part also receives as input the meta-position of the target slice as an embedding of 8 units tiled spatially across the slice tensor. The pixel intensity values are also embedded as one-hot indices of size 8. The context embedding network passes its input through a series of self-attention layers and then a series of residual blocks, finally emitting a slice-sized feature map s that summarizes the context for the decoder.
94
+
95
+ ![](images/e6f31c8d7a0d48ad915bfecc5d546389faa9b99b3c07f683678a398e09811c80.jpg)
96
+ Figure 5: Left: 8-bit 128x128 RGB ImageNet samples from SPN with depth upscaling only. Right: 8-bit 128x128 RGB ImageNet samples from SPN with full-blown Multidimensional Upscaling. Temperature is 0.99 for the initial $3 2 \mathbf { x } 3 2$ sub-image and otherwise 1.0
97
+
98
+ The decoder takes as input the encoded slice tensor s in a position-preserving manner: each position in the target slice is given as input the encoded representations of pixels at that same position in the preceding slices. In addition it processes the target slice in the raster-scan order. The decoder that we use is a hybrid architecture combining masked convolution and self-attention (Chen et al., 2017). We employ an initial 1D self-attention network Vaswani et al. (2017) that is used to gather the entire available context in the slice (see Figure 4(b)). The slice is reshaped into a 1D tensor before it is given as input to masked 1D self-attention layers; the masking is performed over the previous pixels only (as opposed to over the current RGB channels) in the self-attention layers. Then the output of the layers is reshaped back into a 2D tensor, concatenated depth-wise with the output of the slice embedding network, and given as conditioning input to a Gated PixelCNN as in Equation 5 in van den Oord et al. (2016c). The PixelCNN network models the target slice with full masking over pixels and channel dimensions. We can see how memory requirements are significantly lower - up to $\bar { S } ^ { 2 } = 6 4 \times$ lower with $S = 8$ - due to the smaller spatial size of the slices and their compact concatenation along the channel dimension of the input tensor. Due to this structure, the entire previously generated context is captured at each position of the decoder.
99
+
100
+ # 3.3 LEARNING
101
+
102
+ The log-likelihood derived from equation 2 decomposes as a sum over slices. An unbiased estimator of the log-loss is obtained by uniformly sampling a choice of target slice and evaluating its logprobability conditioned upon previous slices as depicted in Figure 4 (a). We perform maximum likelihood learning by doing stochastic gradient descent on this Monte Carlo estimate, with all gradients computed by backpropagation.
103
+
104
+ # 3.4 MULTIDIMENSIONAL UPSCALING WITH SPN
105
+
106
+ As seen in Section 2.3, the SPN naturally serves as a size-upscaling network when the first slice of the input tensor is initialized with with an externally generated subimage. In our experiments, we ensure that the smaller subimages used for the initialization and those used in the training of the SPN decoder are identical to each other.
107
+
108
+ Analogously, the SPN can be used to upscale the depth of the channels of an image. The image to be upscaled in depth is itself divided into slices by the subscale method (secion 2) and the slices are then concatenated along the channel dimension into a slice tensor for the conditioning image $\mathbf { x } ^ { \mathrm { { : d } _ { 1 } } }$ . The latter is then added as a fixed additional input to the embedding part of the SPN in order to model $P ( \mathbf { x _ { h , w , c } ^ { d _ { 1 } : d _ { 2 } } } | \mathbf { x ^ { d _ { 1 } : d _ { 2 } } } < , \mathbf { x ^ { : d _ { 1 } } } )$ . The model of $P ( \mathbf { x } ^ { \mathbf { : d _ { 1 } } } )$ is a normal SPN, but trained on data with low bit depth.
109
+
110
+ Table 1: Negative Log-likelihood (NLL) scores for Downsampled Imagenet (van den Oord et al., 2016b) in bits/dim. The parenthesized numbers in Depth Upscaling rows indicate NLL for $P ( \mathbf { x } ^ { \mathbf { : d _ { 1 } } } )$ and P (xd1:d2h,w,c| $P ( \mathbf { x _ { h , w , c } ^ { d _ { 1 } : d _ { 2 } } } | \mathbf { x ^ { d _ { 1 } : d _ { 2 } } } < , \mathbf { x ^ { : d _ { 1 } } } )$ respectively.
111
+
112
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ImageNet 32x32</td><td rowspan=1 colspan=1>ImageNet 64x64</td></tr><tr><td rowspan=1 colspan=1>Gated PixelCNN (van den Oord et al.,2016c)Parallel Multiscale (Reed et al.,2017)PixelSNAIL (Chen et al., 2017)Image Transformer (Parmar et al.,2018)Glow (Kingma &amp; Dhariwal,2018)</td><td rowspan=1 colspan=1>3.833.953.803.774.09</td><td rowspan=1 colspan=1>3.573.70--3.81</td></tr><tr><td rowspan=1 colspan=1>Decoder baselineSPNSPN +Depth UpscalingSPN + 16x16 slicesSPN +8x8 slices</td><td rowspan=1 colspan=1>3.79113.853.91</td><td rowspan=1 colspan=1>3.523.533.53 (0.63, 2.90)=</td></tr></table>
113
+
114
+ Table 2: NLL scores for high-resUpscaling rows indicate NLL for $P ( \mathbf { x } ^ { \mathbf { : d _ { 1 } } } )$ mage and $P ( \mathbf { x _ { h , w , c } ^ { d _ { 1 } : d _ { 2 } } } | \mathbf { x ^ { d _ { 1 } : d _ { 2 } } } < , \mathbf { \bar { x } ^ { : d _ { 1 } } } )$ thesized numbers in Depth respectively.
115
+
116
+ <table><tr><td></td><td>ImageNet 128 x 128</td><td>ImageNet256 x 256</td></tr><tr><td>Parallel Multiscale (Reed et al., 2017)</td><td>3.55</td><td>1</td></tr><tr><td>SPN SPN + Depth-Upscaling</td><td>3.08 3.08 (0.46, 2.62)</td><td>2.97 3.01 (0.40,2.61)</td></tr></table>
117
+
118
+ # 4 EXPERIMENTS
119
+
120
+ We demonstrate experimentally that our model is capable of high fidelity samples at high resolution, producing unconditional CelebA-HQ samples of quality better than the Glow model (Kingma & Dhariwal, 2018) and improving the MLE scores. Furthermore, we show that these results extend to high-resolution ImageNet images, with state-of-the-art log-likelihoods at $1 2 8 \mathrm { x } 1 2 8$ by a large margin and the first benchmark on $2 5 6 \times 2 5 6$ ImageNet. Unconditional samples at these resolutions are characterized by unprecedented global coherence.
121
+
122
+ Because our networks operate on small images $3 2 \times 3 2$ slices), we can train large networks both in terms of the number of hidden units and in terms of network depth (see Appendix C for details of sizes). The context-embedding network contains 5 convolutional layers and 6-8 self-attention layers depending on the dataset. The masked decoder consists of a PixelCNN with 15 layers in all experiments. The 1D Transformer in the decoder (Figure 4(b)) has between 8 and 10 layers depending on the dataset. See Table 4 for all dataset-specific hyperparameter details.
123
+
124
+ # 4.1 DOWNSAMPLED IMAGENET AT $3 2 \times 3 2$ AND $6 4 \times 6 4$
125
+
126
+ We first benchmark the performance of our hybrid decoder alone (i.e. no subscaling, Figure 4(b)) and show that it compares favorably to state of the art models on $3 2 \times 3 2$ Downsampled ImageNet (see Table 1). We find that SPN hurts in this low-resolution setting with $S = 2$ and even further with $S = 4$ . This is likely because the size of the resulting image slices becomes very small and the image coarse grained.
127
+
128
+ On $6 4 \times 6 4$ Downsampled ImageNet, we achieve a state of the art log-likelihood of 3.52 bits/dim. We hypothesize that PixelSNAIL would achieve a similar score, but results at this resolution were not reported in Chen et al. (2017). At this resolution, SPN scores similarly with 3.53 bits/dim. The improvement over Glow in the 5-bit setting is very significant (Table 3).
129
+
130
+ Table 3: Negative Log-likelihood scores for 5-bit datasets in bits/dim.
131
+
132
+ <table><tr><td></td><td>ImageNet 64 x 64 (5bit)</td><td>CelebA-HQ 256 x 256 (5bit)</td></tr><tr><td>Glow (Kingma &amp;Dhariwal,2018)</td><td>1.76</td><td>1.03</td></tr><tr><td>SPN</td><td>1.41</td><td>0.61</td></tr></table>
133
+
134
+ # 4.2 IMAGENET AT $1 2 8 \times 1 2 8$
135
+
136
+ For these experiments we use the standard ILSVRC Imagenet dataset (Kolesnikov & Lampert, 2016b) resized with Tensorflow’s resize area function. Parallel Multiscale PixelCNN (Reed et al., 2017) is the only model in the literature which reports log-likelihood on $1 2 8 \times 1 2 8$ ImageNet. SPN improves the log-likelihood over this model from 3.55 bits/dim to 3.08 bits/dim (see Table 2). Figure 5 gives $1 2 8 \times 1 2 8$ 8-bit ImageNet samples for both the setting of depth upscaling only and of complete multidimensional upscaling. These settings do not affect the NLL, but the samples with depth upscaling show significant semantic coherence that is usually lacking in samples without upscaling. In addition, multidimensional upscaling seems to increase the overall rate of success of the samples. Additional intermediate ImageNet samples can be seen in Figures 10, 11 and 12 in the Appendix.
137
+
138
+ # 4.3 CELEBAHQ
139
+
140
+ At $2 5 6 \times 2 5 6$ we can produce high-fidelity samples of celebrity faces from the CelebAHQ dataset. The quality compares favorably to the samples of other models such as Glow and GANs (Karras et al., 2017). We show in Table 3 that the achieved MLE scores are a significant improvement over previously reported scores. Figure 6 showcases some samples for 8-bit CelebAHQ-256. Figure 7 in the Appendix includes 5-bit samples, Figure 8 includes 3-bit samples while Figure 9 includes 3-bit samples with the temperature of the output distribution set to 0.95.
141
+
142
+ # 5 CONCLUSION
143
+
144
+ The problem of whether it is possible to learn the distribution of complex natural images and attain high sample fidelity has been a long-standing one in the tradition of generative models. The SPN and Multidimensional Upscaling model that we introduce accomplishes a large step towards solving this problem, by attaining both state-of-the-art MLE scores on large-scale images from complex domains such as CelebAHQ-256 and ImageNet-128 and by being able to generate high fidelity full 8-bit samples from the resulting learnt distributions without alterations to the sampling process (via e.g. heavy modifications of the temperature of the output distribution). The generated samples show an unprecedented amount of semantic coherence and exactness of details even at the large scale size of full 8-bit $1 2 8 \times 1 2 8$ and $2 5 6 \times 2 5 6$ images.
145
+
146
+ # 6 ACKNOWLEDGEMENTS
147
+
148
+ We would like to thank Alex Graves, Karen Simonyan, Aaron van den Oord, Tim Harley, Sander Dieleman, Tim Salimans, Lasse Espeholt, Ali Razavi, Jeffrey De Fauw and Andy Brock for insightful discussions. In particular we wish to thank Andriy Mnih for formative ideas about autoregressivity in the bit-depth of an image.
149
+
150
+ # REFERENCES
151
+
152
+ Sanjeev Arora and Yi Zhang. Do gans actually learn the distribution? an empirical study. CoRR, abs/1706.08224, 2017. URL http://arxiv.org/abs/1706.08224.
153
+
154
+ Xi Chen, Nikhil Mishra, Mostafa Rohaninejad, and Pieter Abbeel. Pixelsnail: An improved autoregressive generative model. CoRR, abs/1712.09763, 2017. URL http://arxiv.org/abs/ 1712.09763.
155
+
156
+ Norman P. Jouppi, Cliff Young, Nishant Patil, David A. Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, Rick Boyle, Pierre-luc Cantin,
157
+
158
+ Clifford Chao, Chris Clark, Jeremy Coriell, Mike Daley, Matt Dau, Jeffrey Dean, Ben Gelb, Tara Vazir Ghaemmaghami, Rajendra Gottipati, William Gulland, Robert Hagmann, Richard C. Ho, Doug Hogberg, John Hu, Robert Hundt, Dan Hurt, Julian Ibarz, Aaron Jaffey, Alek Jaworski, Alexander Kaplan, Harshit Khaitan, Andy Koch, Naveen Kumar, Steve Lacy, James Laudon, James Law, Diemthu Le, Chris Leary, Zhuyuan Liu, Kyle Lucke, Alan Lundin, Gordon MacKean, Adriana Maggiore, Maire Mahony, Kieran Miller, Rahul Nagarajan, Ravi Narayanaswami, Ray Ni, Kathy Nix, Thomas Norrie, Mark Omernick, Narayana Penukonda, Andy Phelps, Jonathan Ross, Amir Salek, Emad Samadiani, Chris Severn, Gregory Sizikov, Matthew Snelham, Jed Souter, Dan Steinberg, Andy Swing, Mercedes Tan, Gregory Thorson, Bo Tian, Horia Toma, Erick Tuttle, Vijay Vasudevan, Richard Walter, Walter Wang, Eric Wilcox, and Doe Hyun Yoon. In-datacenter performance analysis of a tensor processing unit. CoRR, abs/1704.04760, 2017. URL http://arxiv.org/abs/1704.04760.
159
+
160
+ Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex ¨ Graves, and Koray Kavukcuoglu. Video pixel networks. CoRR, abs/1610.00527, 2016. URL http://arxiv.org/abs/1610.00527.
161
+
162
+ Nal Kalchbrenner, Erich Elsen, Karen Simonyan, Seb Noury, Norman Casagrande, Edward Lockhart, Florian Stimberg, Aaron van den Oord, Sander Dieleman, and Koray Kavukcuoglu. Efficient ¨ neural audio synthesis. CoRR, abs/1802.08435, 2018. URL http://arxiv.org/abs/1802. 08435.
163
+
164
+ 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.
165
+
166
+ Diederik P. Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. CoRR, abs/1807.03039, 2018. URL https://arxiv.org/abs/1807.03039.
167
+
168
+ Alexander Kolesnikov and Christoph H. Lampert. Deep probabilistic modeling of natural images using a pyramid decomposition. CoRR, abs/1612.08185, 2016a. URL http://arxiv.org/ abs/1612.08185.
169
+
170
+ Alexander Kolesnikov and Christoph H. Lampert. Deep probabilistic modeling of natural images using a pyramid decomposition. CoRR, abs/1612.08185, 2016b. URL http://arxiv.org/ abs/1612.08185.
171
+
172
+ Lars M. Mescheder. On the convergence properties of GAN training. CoRR, abs/1801.04406, 2018. URL http://arxiv.org/abs/1801.04406.
173
+
174
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, and Alexander Ku. Image transformer. CoRR, abs/1802.05751, 2018. URL http://arxiv.org/abs/1802. 05751.
175
+
176
+ Scott E. Reed, Aaron van den Oord, Nal Kalchbrenner, Sergio Gomez Colmenarejo, Ziyu Wang, ¨ Dan Belov, and Nando de Freitas. Parallel multiscale autoregressive density estimation. CoRR, abs/1703.03664, 2017. URL http://arxiv.org/abs/1703.03664.
177
+
178
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, ¨ Nal Kalchbrenner, Andrew W. Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. CoRR, abs/1609.03499, 2016a. URL http://arxiv.org/abs/1609.03499.
179
+
180
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. ¨ CoRR, abs/1601.06759, 2016b. URL http://arxiv.org/abs/1601.06759.
181
+
182
+ Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Koray ¨ Kavukcuoglu. Conditional image generation with pixelcnn decoders. CoRR, abs/1606.05328, 2016c. URL http://arxiv.org/abs/1606.05328.
183
+
184
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, abs/1706.03762, 2017. URL http://arxiv.org/abs/1706.03762.
185
+
186
+ Ashish Vaswani, Samy Bengio, Eugene Brevdo, Franc¸ois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Lukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. CoRR, abs/1803.07416, 2018. URL http://arxiv.org/abs/1803.07416.
187
+
188
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. CoRR, abs/1609.08144, 2016. URL http://arxiv.org/abs/1609.08144.
189
+
190
+ # APPENDIX A
191
+
192
+ In some cases for purposes of analysis the entropy of the softmax output distributions has been artificially reduced via a “temperature” divisor on the predicted logits. When we say the temperature is 0.95, we mean that the logits of a trained model have been divided by this constant at sampling time.
193
+
194
+ ![](images/d9e179ba71ce959d7d1f3a8cee2639304460ecce18c6d99ecacc0bb2dd11b905.jpg)
195
+ Figure 6: 8-bit 256x256 RGB CelebA-HQ samples from SPN with Depth-Upscaling. Temperature is 0.99 for the low-bit-depth image and otherwise 1.0
196
+
197
+ ![](images/504d0665a5b40d06191c7bd8627c201458e6521b40015b4d0b70db79bfe3b9b9.jpg)
198
+ Figure 7: 256x256 CelebA-HQ 5bit samples from SPN
199
+
200
+ # APPENDIX B
201
+
202
+ Please see Table 4 for all the detailed hyperparameters.
203
+
204
+ # APPENDIX C
205
+
206
+ Our experiments operate at a fairly large scale in terms of both the amount of compute used and the size of the networks. We proportionately increase the batch size so that the number of pixels in a batch is not affected by the subscaling. These large batch sizes (a maximum of 2048) are achieved by increasing the degree of data parallelism by running on Google Cloud TPU pods (Jouppi et al., 2017). For Imagenet 32 we used 64 tensorcores. For ImageNet 64, 128 and 256, we use 128 tensorcores. The fast interconnect between these devices affords much faster synchronous gradient computation than would be possible using the same number of GPUs. When overfitting is a problem, as in small datasets like CelebA-HQ, we rather decrease the batch size and use a lower number of 32 tensorcores.
207
+
208
+ Our SPN architectures have between ${ \sim } 5 0 \mathbf { M }$ and $\sim 2 5 0 \mathrm { M }$ parameters depending on the dataset. See Table 4 for the number of parameters in the SPN architecture for each dataset. Depth-upscaling doubles the number of parameters due to using two separate networks with untied weights. Sizeupscaling adds more parameters still for the separate decoder-only network which models the first slice as seen in Figure 3 (g). Thus the maximal number of parameters used to generate a sample in the paper occurs in the multidimensional upscaling setting for ImageNet 128, where the total parameter count reaches ${ \sim } 6 5 0 \mathrm { M }$ (the decoder-only network used to model the first slice has $\mathord { \sim } 1 5 0 \mathrm { M }$ parameters).
209
+
210
+ ![](images/d848a209d6b7533bcfb3b34e9070b3c0d63348e6b8f6869d3f908d184dba7b69.jpg)
211
+ Figure 8: 256x256 CelebA-HQ 3bit samples from SPN
212
+
213
+ ![](images/697e394f5b5990e1e08a4707158de53d0bcaed683c4c1de9516612c7dd56baad.jpg)
214
+ Figure 9: 256x256 CelebA-HQ 3bit samples from SPN with temperature 0.95
215
+
216
+ ![](images/112ca671283b8d1c9be472807544de4f71075d12f5a63d4abf83c2837648da53.jpg)
217
+ Figure 10: 128x128 ImageNet 3bit; upscaled $3 2 \mathrm { x } 3 2 $ slices
218
+
219
+ ![](images/f059f8be6aedb09ab4801a67ed6fa109022eb0a363f720ce1ea1d8f95bb67805.jpg)
220
+ Figure 11: 128x128 ImageNet 3bit samples from model trained on $3 2 \mathrm { x } 3 2 $ slices
221
+
222
+ ![](images/1ad9d7898f245e7d4d3450a51ccd621e11cd56b7342e3076a4759202e18bc3e1.jpg)
223
+ Figure 12: 128x128 ImageNet 3bit samples from SPN
224
+
225
+ Table 4: SPN Hyperparameters. A learning rate marked “sched” utilizes a piecewise-constant schedule starting at 1e-4, and decreasing to 3e-5 and finally 1e-5 at training steps $5 0 \mathrm { k }$ and $1 0 0 \mathrm { k }$ respectively. The “attention” parameters listed are configurable hyperparameters of the open source Transformer implementation in Vaswani et al. (2018). The parameter “residual channels“ refers to the number of hidden units in residual convolution layers within the Slice Embedder or PixelCNN networks.
226
+
227
+ <table><tr><td>Optimization</td><td></td><td></td></tr><tr><td>batch size</td><td>(1024,2048,2048,2048)</td><td>256</td></tr><tr><td>learning rate</td><td>(sched,sched, le-5,1e-5)</td><td>5e-5</td></tr><tr><td>rmsprop momentum</td><td>0.9</td><td>0.9</td></tr><tr><td>rmsprop decay</td><td>0.95</td><td>0.95</td></tr><tr><td>rmsprop epsilon</td><td>1e-8</td><td>1e-8</td></tr><tr><td>polyak decay</td><td>0.9999</td><td>0.9999</td></tr><tr><td>Decoder</td><td></td><td></td></tr><tr><td>PixelCNN layers</td><td>15</td><td>15</td></tr><tr><td>PixelCNN conv channels</td><td>(256,256, 384, 384)</td><td>128</td></tr><tr><td>PixelCNN residual channels</td><td>1280</td><td>1280</td></tr><tr><td>PixelCNN nonlinearity</td><td>gated</td><td>gated</td></tr><tr><td>PixelCNN filter size</td><td>3</td><td>3</td></tr><tr><td>masked self-attention layers</td><td>8</td><td>5</td></tr><tr><td>attention heads</td><td>10</td><td>5</td></tr><tr><td>attention channels</td><td>128</td><td>128</td></tr><tr><td>attention ffn layer</td><td>&quot;parameter_attention&quot;</td><td>&quot;parameter_attention&quot;</td></tr><tr><td>SliceEmbedder</td><td></td><td></td></tr><tr><td>conv layers</td><td>5</td><td>5</td></tr><tr><td>conv filter size</td><td>3</td><td>3</td></tr><tr><td>conv channels</td><td>256</td><td>256</td></tr><tr><td>residual channels</td><td>1024</td><td>1024</td></tr><tr><td>nonlinearity</td><td>relu</td><td>relu</td></tr><tr><td>self-attention layers</td><td>(6,6, 8, 8)</td><td>6</td></tr><tr><td>attention heads</td><td>(4,4,8,8)</td><td>4</td></tr><tr><td>attention channels</td><td>(64,64, 128, 128)</td><td>64</td></tr><tr><td>attention ffn layer</td><td>&quot;parameter_attention&quot;</td><td>&quot;parameter_attention&quot;</td></tr><tr><td colspan="3">Number of parameters ~150M ~150M ~ 250M ~ 250M) ~ 50M</td></tr></table>
md/train/LuyryrCs6Ez/LuyryrCs6Ez.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/N6JECD-PI5w/N6JECD-PI5w.md ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FAIRFIL: CONTRASTIVE NEURAL DEBIASING METHOD FOR PRETRAINED TEXT ENCODERS
2
+
3
+ Pengyu Cheng∗ , Weituo Hao∗, Siyang Yuan , Shijing Si , Lawrence Carin Department of Electrical and Computer Engineering, Duke University {pengyu.cheng,weituo.hao,siyang.yuan,shijing.si,lcarin}@duke.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Pretrained text encoders, such as BERT, have been applied increasingly in various natural language processing (NLP) tasks, and have recently demonstrated significant performance gains. However, recent studies have demonstrated the existence of social bias in these pretrained NLP models. Although prior works have made progress on word-level debiasing, improved sentence-level fairness of pretrained encoders still lacks exploration. In this paper, we proposed the first neural debiasing method for a pretrained sentence encoder, which transforms the pretrained encoder outputs into debiased representations via a fair filter (FairFil) network. To learn the FairFil, we introduce a contrastive learning framework that not only minimizes the correlation between filtered embeddings and bias words but also preserves rich semantic information of the original sentences. On real-world datasets, our FairFil effectively reduces the bias degree of pretrained text encoders, while continuously showing desirable performance on downstream tasks. Moreover, our post hoc method does not require any retraining of the text encoders, further enlarging FairFil’s application space.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Text encoders, which map raw-text data into low-dimensional embeddings, have become one of the fundamental tools for extensive tasks in natural language processing (Kiros et al., 2015; Lin et al., 2017; Shen et al., 2019; Cheng et al., 2020b). With the development of deep learning, largescale neural sentence encoders pretrained on massive text corpora, such as Infersent (Conneau et al., 2017), ELMo (Peters et al., 2018), BERT (Devlin et al., 2019), and GPT (Radford et al., 2018), have become the mainstream to extract the sentence-level text representations, and have shown desirable performance on many NLP downstream tasks (MacAvaney et al., 2019; Sun et al., 2019; Zhang et al., 2019). Although these pretrained models have been studied comprehensively from many perspectives, such as performance (Joshi et al., 2020), efficiency (Sanh et al., 2019), and robustness (Liu et al., 2019), the fairness of pretrained text encoders has not received significant research attention.
12
+
13
+ The fairness issue is also broadly recognized as social bias, which denotes the unbalanced model behaviors with respect to some socially sensitive topics, such as gender, race, and religion (Liang et al., 2020). For data-driven NLP models, social bias is an intrinsic problem mainly caused by the unbalanced data of text corpora (Bolukbasi et al., 2016). To quantitatively measure the bias degree of models, prior work proposed several statistical tests (Caliskan et al., 2017; Chaloner & Maldonado, 2019; Brunet et al., 2019), mostly focusing on word-level embedding models. To evaluate the sentence-level bias in the embedding space, May et al. (2019) extended the Word Embedding Association Test (WEAT) (Caliskan et al., 2017) into a Sentence Encoder Association Test (SEAT). Based on the SEAT test, May et al. (2019) claimed the existence of social bias in the pretrained sentence encoders.
14
+
15
+ Although related works have discussed the measurement of social bias in sentence embeddings, debiasing pretrained sentence encoders remains a challenge. Previous word embedding debiasing methods (Bolukbasi et al., 2016; Kaneko & Bollegala, 2019; Manzini et al., 2019) have limited assistance to sentence-level debiasing, because even if the social bias is eliminated at the word level, the sentence-level bias can still be caused by the unbalanced combination of words in the training text. Besides, retraining a state-of-the-art sentence encoder for debiasing requires a massive amount of computational resources, especially for large-scale deep models like BERT (Devlin et al., 2019) and GPT (Radford et al., 2018). To the best of our knowledge, Liang et al. (2020) proposed the only sentence-level debiasing method (Sent-Debias) for pretrained text encoders, in which the embeddings are revised by subtracting the latent biased direction vectors learned by Principal Component Analysis (PCA) (Wold et al., 1987). However, Sent-Debias makes a strong assumption on the linearity of the bias in the sentence embedding space. Further, the calculation of bias directions depends highly on the embeddings extracted from the training data and the number of principal components, preventing the method from adequate generalization.
16
+
17
+ In this paper, we proposed the first neural debiasing method for pretrained sentence encoders. For a given pretrained encoder, our method learns a fair filter (FairFil) network, whose inputs are the original embeddings of the encoder, and outputs are the debiased embeddings. Inspired by the multi-view contrastive learning (Chen et al., 2020), for each training sentence, we first generate an augmentation that has the same semantic meaning but in a different potential bias direction. We contrastively train our FairFil by maximizing the mutual information between the debiased embeddings of the original sentences and corresponding augmentations. To further eliminate bias from sensitive words in sentences, we introduce a debiasing regularizer, which minimizes the mutual information between debiased embeddings and the sensitive words’ embeddings. In the experiments, our FairFil outperforms Sent-Debias (Liang et al., 2020) in terms of the fairness and the representativeness of debiased embeddings, indicating our FairFil not only effectively reduces the social bias in the sentence embeddings, but also successfully preserves the rich semantic meaning of input text.
18
+
19
+ # 2 PRELIMINARIES
20
+
21
+ Mutual Information (MI) is a measure of the “amount of information” between two variables (Kullback, 1997). The mathematical definition of MI is
22
+
23
+ $$
24
+ \mathcal { T } ( \pmb { x } ; \pmb { y } ) : = \mathbb { E } _ { p ( \pmb { x } , \pmb { y } ) } \Big [ \log \frac { p ( \pmb { x } , \pmb { y } ) } { p ( \pmb { x } ) p ( \pmb { y } ) } \Big ] ,
25
+ $$
26
+
27
+ where $p ( { \pmb x } , { \pmb y } )$ is the joint distribution of two variables $( { \pmb x } , { \pmb y } )$ , and $p ( { \pmb x } ) , p ( { \pmb y } )$ are respectively the marginal distributions of $\mathbf { \nabla } _ { \mathbf { x } , \mathbf { y } }$ . Recently, mutual information has achieved considerable success when applied as a learning criterion in diverse deep learning tasks, such as conditional generation (Chen et al., 2016), domain adaptation (Gholami et al., 2020), representation learning (Chen et al., 2020), and fairness (Song et al., 2019). However, the calculation of exact MI in (1) is well-recognized as a challenge, because the expectation w.r.t $p ( { \pmb x } , { \pmb y } )$ is always intractable, especially when only samples from $p ( { \pmb x } , { \pmb y } )$ are provided. To this end, several upper and lower bounds have been introduced to estimate the MI with samples. For MI maximization tasks (Hjelm et al., 2018; Chen et al., 2020), Oord et al. (2018) derived a powerful MI estimator, InfoNCE, based on noise contrastive estimation (NCE) (Gutmann $\&$ Hyvarinen, 2010). Given a batch of sample pairs ¨ $\{ ( \pmb { x } _ { i } , \pmb { y } _ { i } ) \} _ { i = 1 } ^ { N }$ , the InfoNCE estimator is defined with a learnable score function $f ( { \pmb x } , { \pmb y } )$ :
28
+
29
+ $$
30
+ \mathcal { T } _ { \mathrm { N C E } } : = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \frac { \exp ( f ( { \boldsymbol { { x } } } _ { i } , { \boldsymbol { { y } } } _ { i } ) ) } { \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \exp ( f ( { \boldsymbol { { x } } } _ { i } , { \boldsymbol { { y } } } _ { j } ) ) } .
31
+ $$
32
+
33
+ For MI minimization tasks (Alemi et al., 2017; Song et al., 2019), Cheng et al. (2020a) introduced a contrastive log-ratio upper bound (CLUB) based on a variational approximation $q _ { \boldsymbol { \theta } } ( \mathbf { \boldsymbol { y } } | \mathbf { \boldsymbol { x } } )$ of conditional distribution $p ( \pmb { y } | \pmb { x } )$ :
34
+
35
+ $$
36
+ \mathcal { T } _ { \mathrm { C L U B } } : = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \bigg [ \log q _ { \theta } ( \pmb { y } _ { i } | \pmb { x } _ { i } ) - \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \log q _ { \theta } ( \pmb { y } _ { j } | \pmb { x } _ { i } ) \bigg ] .
37
+ $$
38
+
39
+ In the following, we use the above two MI estimators to induce the sentence encoder, eliminating the biased information and preserving the semantic information from the original raw text.
40
+
41
+ # 3 METHOD
42
+
43
+ Suppose $E ( \cdot )$ is a pretrained sentence encoder, which can encode a sentence $_ { \textbf { \em x } }$ into low-dimensional embedding $\begin{array} { r } { \dot { \boldsymbol { z } } = \boldsymbol { E } ( \boldsymbol { x } ) } \end{array}$ . Each sentence $\pmb { x } = ( w ^ { 1 } , w ^ { 2 } , \dots , w ^ { L } )$ is a sequence of words. The embedding space of $_ z$ has been recognized to have social bias in a series of studies (May et al., 2019; Kurita et al., 2019; Liang et al., 2020). To eliminate the social bias in the embedding space, we aim to learn a fair filter network $f ( \cdot )$ on top of the sentence encoder $E ( \cdot )$ , such that the output embedding of our fair filter $\begin{array} { r } { d = f ( z ) } \end{array}$ can be debiased. To train the fair filter, we design a multi-view contrastive learning framework, which consists of three steps. First, for each input sentence $_ { \textbf { \em x } }$ , we generate an augmented sentence $\mathbf { x } ^ { \prime }$ that has the same semantic meaning as $_ { \textbf { \em x } }$ but in a different potential bias direction. Then, we maximize the mutual information between the original embedding $z = f ( { \pmb x } )$ and the augmented embedding $z ^ { \prime } = f ( x ^ { \prime } )$ with the InfoNCE (Oord et al., 2018) contrastive loss. Further, we design a debiasing regularizer to minimize the mutual information between $^ d$ and sensitive attribute words in $_ { \textbf { \em x } }$ . In the following, we discuss these three steps in detail.
44
+
45
+ Table 1: Examples of generating an augmentation sentence under the sensitive topic “gender”.
46
+
47
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Bias direction</td><td rowspan=1 colspan=1>Sensitive Attribute words</td><td rowspan=1 colspan=2>Text content</td></tr><tr><td rowspan=1 colspan=1>Original</td><td rowspan=1 colspan=1>male</td><td rowspan=1 colspan=1>he,his</td><td rowspan=1 colspan=2>{He} is good at playing {his} basketball.</td></tr><tr><td rowspan=1 colspan=1>Augmentation</td><td rowspan=1 colspan=1>female</td><td rowspan=1 colspan=1>she,her</td><td rowspan=1 colspan=1>{She</td><td rowspan=1 colspan=1>{She} is good at playing {her} basketball.</td></tr></table>
48
+
49
+ # 3.1 DATA AUGMENTATIONS WITH SENSITIVE ATTRIBUTES
50
+
51
+ We first describe the sentence data augmentation process for our FairFil contrastive learning. Denote a social sensitive topic as $\mathcal { T } = \{ \mathcal { D } _ { 1 } , \mathcal { D } _ { 2 } , \ldots , \mathcal { D } _ { K } \}$ , where $\mathcal { D } _ { k }$ $( k = 1 , \ldots , K )$ is one of the potential bias directions under the topic. For example, if $\tau$ represents the sensitive topic “gender”, then $\tau$ consists two potential bias directions $\{ \mathcal { D } _ { 1 } , \mathcal { D } _ { 2 } \} \stackrel { - } { = } \{ { } ^ { } m a l e ^ { , \prime } , \ { } ^ { } f e m a l e ^ { , \prime } \}$ . Similarly, if $\tau$ is set as the major “religions” of the world, then $\tau$ could contain $\left\{ \mathcal { D } _ { 1 } , \mathcal { D } _ { 2 } , \mathcal { D } _ { 3 } , \mathcal { D } _ { 4 } \right\} \ =$ {“Christianity”, “Islam”, “Judaism”, “Buddhism”} as four components.
52
+
53
+ For a given social sensitive topic $\mathcal { T } = \{ { D } _ { 1 } , . . . { D } _ { K } \}$ , if a word $w$ is related to one of the potential bias direction $\mathcal { D } _ { k }$ (denote as $w \in \mathcal { D } _ { k } ,$ ), we call $w$ a sensitive attribute word of $\mathcal { D } _ { k }$ (also called bias attribute word in Liang et al. (2020)). For a sensitive attribute word $w \in \mathcal { D } _ { k }$ , suppose we can always find another sensitive attribute word $u \in { \mathcal { D } } _ { j }$ , such that $w$ and $u$ has the equivalent semantic meaning but in a different bias direction. Then we call $u$ as a replaceable word of $w$ in direction $\mathcal { D } _ { j }$ , and denote as $u = r _ { j } ( w )$ . For the topic “gende $\therefore \prime = \{ \stackrel { } { \cdot } m a l e ^ { \prime \prime } , \stackrel { } { \cdot } f e m a l e ^ { \prime \prime } \}$ , the word $w =$ “boy” is in the potential bias direction $\mathcal { D } _ { 1 } = \ ^ { \ast } m a l e ^ { \prime \prime }$ ; a replaceable word of “boy” in “female” direction is $r _ { 2 } ( \bar { w } ) = \cdots \mathrm { g i r l } ^ { * } \in \mathcal { D } _ { 2 }$ .
54
+
55
+ With the above definitions, for each sentence $_ { \textbf { \em x } }$ , we generate an augmented sentence $\mathbf { x } ^ { \prime }$ such that $\mathbf { x } ^ { \prime }$ has the same semantic meaning as $_ { \textbf { \em x } }$ but in a different potential bias direction. More specifically, for a sentence $\pmb { x } = ( w ^ { 1 } , w ^ { 2 } , \dots , \breve { w } ^ { L } )$ , we first find the sensitive word positions as an index set $\mathcal { P }$ , such that each $w ^ { p }$ ${ \bf \Phi } _ { p } \in { \mathcal { P } } ,$ ) is a sensitive attribute words in direction $\mathcal { D } _ { k }$ . We further make a reasonable assumption that the embedding bias of direction $\mathcal { D } _ { k }$ is only caused by the sensitive words $\{ w ^ { p } \} _ { p \in { \mathcal { P } } }$ in $_ { \textbf { \em x } }$ . To sample an augmentation to $_ { \textbf { \em x } }$ , we first select another potential bias direction $\mathcal { D } _ { j }$ , and then replace all sensitive attribute words by their replaceable words in the direction $\mathcal { D } _ { j }$ . That is, $\pmb { x } ^ { \prime } = \{ v ^ { 1 } , v ^ { 2 } , \bot \bot , v ^ { L } \}$ , where $v ^ { l } = w ^ { l }$ if $l \notin \mathcal { P }$ , and $v ^ { l } = r _ { j } ( w ^ { l } )$ if $l \in \mathcal { P }$ . In Table 1, we provide an example for sentence augmentation under the “gender” topic.
56
+
57
+ # 3.2 CONTRASTIVE LEARNING FRAMEWORK
58
+
59
+ After obtaining the sentence pair $( { \pmb x } , { \pmb x } ^ { \prime } )$ with the augmentation strategy from Section 3.1, we construct a contrastive learning framework to learn our debiasing fair filter $f ( \cdot )$ . As shown in the Figure 1(a), our framework consists of the following two steps:
60
+
61
+ (1) We encode sentences $( { \pmb x } , { \pmb x } ^ { \prime } )$ into embeddings $( z , z ^ { \prime } )$ with the pretrained encoder $E ( \cdot )$ . Since $_ { \textbf { \em x } }$ and $\mathbf { x } ^ { \prime }$ have the same meaning but different potential bias directions, the embeddings $( z , z ^ { \prime } )$ will have different bias directions, which are caused by the sensitive attributed words in $_ { \textbf { \em x } }$ and $\mathbf { x } ^ { \prime }$ .
62
+
63
+ (2) We then feed the sentence embeddings $( z , z ^ { \prime } )$ through our fair filter $f ( \cdot )$ to obtain the debiased embedding outputs $( d , d ^ { \prime } )$ . Ideally, $^ d$ and $\mathbf { \Delta } d ^ { \prime }$ should represent the same semantic meaning without social bias. Inspired by SimCLR (Chen et al., 2020), we encourage the overlapped semantic information between $^ d$ and $\mathbf { \Delta } d ^ { \prime }$ by maximizing their mutual information $\bar { \mathcal { T } } ( d ; d ^ { \prime } )$ .
64
+
65
+ However, the calculation of $\mathcal { T } ( d ; d ^ { \prime } )$ is practically difficult because only embedding samples of $^ d$ and $\pmb { d } ^ { \prime }$ are available. Therefore, we use the InfoNCE mutual information estimator (Oord et al., 2018) to minimize the lower bound of $\mathcal { T } ( d ; d ^ { \prime } )$ instead. Based on a learnable score function $g ( \cdot , \cdot )$ , the contrastive InfoNCE estimator is calculated within a batch of samples $\{ ( d _ { i } , d _ { i } ^ { \prime } ) \} _ { i = 1 } ^ { N }$
66
+
67
+ ![](images/8c1f7a0b55452733b6dca530e9279647bdf58ae19e81215c4ef29b41a8378f5b.jpg)
68
+ Figure 1: (a) Contrastive learning framework of FairFil: Sentence $_ { \textbf { \em x } }$ and its augmentation $\mathbf { x } ^ { \prime }$ are encoded into embeddings $^ d$ and $\pmb { d } ^ { \prime }$ , respectively. $\pmb { w } ^ { p }$ is the embedding of a sensitive attribute word selected from $_ { \textbf { \em x } }$ . $\mathcal { T } _ { \mathrm { N C E } }$ maximizes the mutual information between $^ d$ and $\pmb { d } ^ { \prime }$ ; $\scriptstyle { \mathcal { T } } _ { \mathrm { C L U B } }$ eliminates the bias information of $\pmb { w } ^ { p }$ from $\mathbf { \delta } _ { d }$ . (b) Illustration of information in $^ d$ and $\pmb { d } ^ { \prime }$ : The blue and red circles represent the information in $^ d$ and $\mathbf { { \mathbf { { \mathit { d } } } } ^ { \prime } } \mathbf { \Sigma }$ , respectively. The intersection is the mutual information between $^ d$ and $\pmb { d } ^ { \prime }$ . The shadow area represents the bias information of both embeddings.
69
+
70
+ $$
71
+ \mathcal { T } _ { \mathrm { N C E } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \frac { \exp ( g ( d _ { i } , d _ { i } ^ { \prime } ) ) } { \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \exp ( g ( d _ { i } , d _ { j } ^ { \prime } ) ) } .
72
+ $$
73
+
74
+ By maximize $\mathcal { T } _ { \mathrm { N C E } }$ , we encourage the difference between the positive pair score $g ( d _ { i } , d _ { i } ^ { \prime } )$ and the negative pair score $g ( d _ { i } , d _ { j } ^ { \prime } )$ , so that $\mathbf { \ b { d } } _ { i }$ can share more semantic information with $\mathbf { \Delta } d _ { i } ^ { \prime }$ than other embeddings d0j6=i.
75
+
76
+ # 3.3 DEBIASING REGULARIZER
77
+
78
+ Practically, the contrastive learning framework in Section 3.2 can already show encouraging debiasing performance (as shown in the Experiments). However, the embedding $^ d$ can contain extra biased information from $_ { z }$ , that only maximizing $\mathcal { T } ( d ; d ^ { \prime } )$ fails to eliminate. To encourage no extra bias in $^ d$ , we introduce a debiasing regularizer which minimizes the mutual information between embedding $^ d$ and the potential bias from embedding $_ z$ . As discussed in Section 3.1, in our framework the potential bias of $_ z$ is assumed to come from the sensitive attribute words in $_ { \textbf { \em x } }$ . Therefore, we should reduce the bias word information from the debiased representation $^ d$ . Let $\pmb { w } ^ { p }$ be the embedding of a sensitive attribute word $w ^ { p }$ in sentence $_ { \textbf { \em x } }$ . The word embedding $\pmb { w } ^ { p }$ can always be obtained from the pretrained text encoders (Bordia $\&$ Bowman, 2019). We then minimize the mutual information $\mathcal { T } ( w ^ { p } ; d )$ , using the CLUB mutual information upper bound (Cheng et al., 2020a) to estimate $\mathcal { T } ( w ^ { p } ; d )$ with embedding samples. Given a batch of embedding pairs $\bar { \{ ( d _ { i } , \boldsymbol { w } ^ { p } ) \} } _ { i = 1 } ^ { N }$ , we can calculate the debiasing regularizer as:
79
+
80
+ $$
81
+ \mathcal { T } _ { \mathrm { C L U B } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \Big [ \log q _ { \theta } ( { \pmb w } _ { i } ^ { p } | \pmb d _ { i } ) - \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \log q _ { \theta } ( { \pmb w } _ { j } ^ { p } | \pmb d _ { i } ) \Big ] ,
82
+ $$
83
+
84
+ where $q _ { \theta }$ is a variational approximation to ground-truth conditional distribution $p ( \pmb { w } | \pmb { d } )$ . We parameterize $q _ { \theta }$ with another neural network. As proved in Cheng et al. (2020a), the better $q _ { \theta } ( { \pmb w } | { \pmb d } )$ approximates $p ( \pmb { w } | \pmb { d } )$ , the more accurate $\scriptstyle { \mathcal { T } } _ { \mathrm { C L U B } }$ serves as the mutual information upper bound. Therefore, besides the loss in (5), we also maximize the log-likelihood of $q _ { \theta } ( { \pmb w } | { \pmb d } )$ with samples $\{ ( d _ { i } , { \boldsymbol { w } } _ { i } ^ { p } ) \} _ { i = 1 } ^ { N }$ .
85
+
86
+ Based on the above sections, the overall learning scheme of our fair filter (FairFil) is described in Algorithm 1. Also, we provide an intuitive explanation to the two loss terms in our framework. In Figure 1(b), the blue and red circles represent $^ d$ and $\pmb { d } ^ { \prime }$ , respectively, in the embedding space. The intersection $\mathcal { T } ( d ; d ^ { \prime } )$ is the common semantic information extracted from sentences $_ { \textbf { \em x } }$ and $\mathbf { x } ^ { \prime }$ , while the two shadow parts are the extra bias. Note that the perfect debiased embeddings lead to coincident circles. By maximizing $\mathcal { T } _ { \mathrm { N C E } }$ term, we enlarge the overlapped area of $^ d$ and $\pmb { d } ^ { \prime }$ ; by minimizing $\scriptstyle { \mathcal { T } } _ { \mathrm { C L U B } }$ , we shrink the biased shadow parts.
87
+
88
+ Algorithm 1 Updating the FairFil with a sample batch
89
+
90
+ <table><tr><td>Begin with the pretrained text encoder E()and a batch of sentences {x1. Find the sensitive attribute words {wP} and corresponding embeddings {wP}.</td></tr><tr><td></td></tr><tr><td>Generate augmentation x&#x27; from xi,by replacing {wP} with {rj(wp)}.</td></tr><tr><td>Encode (xi,x) into embeddings di=f(E(xi),d𝑖= f(E(x&#x27;)).</td></tr><tr><td>Calculate INcE with {(di,di)}=1 and score function g. if adding debiasing regularizer then</td></tr><tr><td>Update the variational approximation qe(w|d) by maximizing log-likelihood with {(di,w )}</td></tr><tr><td>Calculate IcLuB with qe(wld) and {(di,w)}1</td></tr><tr><td>Learning loss L= -INcE + βIcLUB· else</td></tr><tr><td>Learning loss L = -INcE·</td></tr><tr><td>end if</td></tr><tr><td></td></tr><tr><td>Update FairFil f and score function g by gradient descent with respect to L.</td></tr><tr><td></td></tr></table>
91
+
92
+ # 4 RELATED WORK
93
+
94
+ # 4.1 BIAS IN NATURAL LANGUAGE PROCESSING
95
+
96
+ Social bias has recently been recognized as an important issue in natural language processing (NLP) systems. The studies on bias in NLP are mainly delineated into two categories: bias in the embedding spaces, and bias in downstream tasks (Blodgett et al., 2020). For bias in downstream tasks, the analyses cover comprehensive topics, including machine translation (Stanovsky et al., 2019), language modeling (Bordia & Bowman, 2019), sentiment analysis (Kiritchenko & Mohammad, 2018) and toxicity detection (Dixon et al., 2018). The social bias in embedding spaces has been studied from two important perspectives: bias measurements and and debiasing methods. To measure the bias in an embedding space, Caliskan et al. (2017) proposed a Word Embedding Association Test (WEAT), which compares the similarity between two sets of target words and two sets of attribute words. May et al. (2019) further extended the WEAT to a Sentence Encoder Association Test (SEAT), which replaces the word embeddings by sentence embeddings encoded from pre-defined biased sentence templates. For debiasing methods, most of the prior works focus on word-level representations (Bolukbasi et al., 2016; Bordia & Bowman, 2019). The only sentence-level debiasing method is proposed by Liang et al. (2020), which learns bias directions by PCA and subtracts them in the embedding space.
97
+
98
+ # 4.2 CONTRASTIVE LEARNING
99
+
100
+ Contrastive learning is a broad class of training strategies that learns meaningful representations by making positive and negative embedding pairs more distinguishable. Usually, contrastive learning requires a pairwise embedding critic as a similarity/distance of data pairs. Then the learning objective is constructed by maximizing the margin between the critic values of positive data pairs and negative data pairs. Previously contrastive learning has shown encouraging performance in many tasks, including metric learning (Weinberger et al., 2006; Davis et al., 2007), word representation learning (Mikolov et al., 2013), graph learning (Tang et al., 2015; Grover & Leskovec, 2016), etc. Recently, contrastive learning has been applied to the unsupervised visual representation learning task, and significantly reduced the performance gap between supervised and unsupervised learning (He et al., 2020; Chen et al., 2020; Qian et al., 2020). Among these unsupervised methods, Chen et al. (2020) proposed a simple multi-view contrastive learning framework (SimCLR). For each image data, SimCLR generates two augmented images, and then the mutual information of the two augmentation embeddings is maximized within a batch of training data.
101
+
102
+ # 5 EXPERIMENTS
103
+
104
+ We first describe the experimental setup in detail, including the pretrained encoders, the training of FairFil, and the downstream tasks. The results of our FairFil are reported and analyzed, along with the previous Sent-Debias method. In general, we evaluate our neural debiasing method from two perspectives: (1) fairness: we compare the bias degree of the original and debiased sentence embeddings for debiasing performance; and (2) representativeness: we apply the debiased embeddings into downstream tasks, and compare the performance with original embeddings.
105
+
106
+ # 5.1 BIAS EVALUATION METRIC
107
+
108
+ To evaluate the bias in sentence embeddings, we use the Sentence Encoder Association Test (SEAT) (May et al., 2019), which is an extension of the Word Embedding Association Test (WEAT) (Caliskan et al., 2017). The WEAT test measures the bias in word embeddings by comparing the distances of two sets of target words to two sets of attribute words. More specifically, denote $\mathcal { X }$ and $\mathcal { V }$ as two sets of target word embeddings (e.g., $\mathcal { X }$ includes “male” words such as “boy” and “man”; $\mathcal { V }$ contains “female” words like “girl” and “woman”). The attribute sets $\mathcal { A }$ and $\boldsymbol { B }$ are selected from some social concepts that should be “equal” to $\mathcal { X }$ and $\mathcal { V }$ (e.g., career or personality words). Then the bias degree w.r.t attributes $( A , B )$ of each word embedding $\pmb { t }$ is defined as:
109
+
110
+ $$
111
+ s ( t , \mathcal { A } , \mathcal { B } ) = \mathrm { m e a n } _ { a \in \mathcal { A } } \cos ( t , a ) - \mathrm { m e a n } _ { b \in \mathcal { B } } \cos ( t , b ) ,
112
+ $$
113
+
114
+ where $\cos ( \cdot , \cdot )$ is the cosine similarity. Based on (6), the normalized WEAT effect size is:
115
+
116
+ $$
117
+ d _ { \mathrm { W E A T } } = \frac { \mathrm { m e a n } _ { x \in \mathcal { X } } s ( x , \mathcal { A } , \mathcal { B } ) - \mathrm { m e a n } _ { y \in \mathcal { Y } } s ( y , \mathcal { A } , \mathcal { B } ) } { \mathrm { s t d } _ { t \in \mathcal { X } \cup \mathcal { Y } } s ( t , \mathcal { A } , \mathcal { B } ) } .
118
+ $$
119
+
120
+ The SEAT test extends WEAT by replacing the word embeddings with sentence embeddings. Both target words and attribute words are converted into sentences with several semantically bleached sentence templates (e.g., “This is ${ < } \mathrm { w o r d } { > } ^ { \mathrm { w } } ,$ ). Then the SEAT statistic is similarly calculated with (7) based on the embeddings of converted sentences. The closer the effect size is to zero, the more fair the embeddings are. Therefore, we report the absolute effect size as the bias measure.
121
+
122
+ # 5.2 PRETRAINED ENCODERS
123
+
124
+ We test our neural debiasing method on BERT (Devlin et al., 2019). Since the pretrained BERT requires the additional fine-tuning process for downstream tasks, we report the performance of our FairFil under two scenarios: (1) pretrained BERT: we directly learn our FairFil network based on pretrained BERT without any additional fine-tuning; and (2) BERT post tasks: we fix the parameters of the FairFil network learned on pretrained BERT, and then fine-tune the BERT $^ +$ FairFil together on task-specific data. Note that when fine-tuning, our FairFil will no longer update, which satisfies a fair comparison to Sent-Debias (Liang et al., 2020).
125
+
126
+ For the downstream tasks of BERT, we follow the setup from Sent-Debias (Liang et al., 2020) and conduct experiments on the following three downstream tasks: (1) SST-2: A sentiment classification task on the Stanford Sentiment Treebank (SST-2) dataset (Socher et al., 2013), on which sentence embeddings are used to predict the corresponding sentiment labels; (2) CoLA: Another sentiment classification task on the Corpus of Linguistic Acceptability (CoLA) grammatical acceptability judgment (Warstadt et al., 2019); and (3) QNLI: A binary question answering task on the Question Natural Language Inference (QNLI) dataset (Wang et al., 2018).
127
+
128
+ # 5.3 TRAINING OF FAIRFIL
129
+
130
+ We parameterize the fair filter network with one-layer fully-connected neural networks with the ReLU activation function. The score function $g$ in the InfoNCE estimator is set to a two-layer fully-connected network with one-dimensional output. The variational approximation $q _ { \theta }$ in CLUB estimator is parameterized by a multi-variate Gaussian distribution $q _ { \theta } ( w | d ) = N ( \mu ( d ) , \sigma ^ { 2 } ( d ) )$ , where $\mu ( \cdot )$ and $\sigma ( \cdot )$ are also two-layer fully-connected neural nets. The batch size is set to 128. The learning rate is $1 \times 1 0 ^ { - 5 }$ . We train the fair filter for 10 epochs.
131
+
132
+ For an appropriate comparison, we follow the setup of Sent-Debias (Liang et al., 2020) and select the same training data for the training of FairFil. The training corpora consist 183,060 sentences from the following five datasets: WikiText-2 (Merity et al., 201y), Stanford Sentiment Treebank (Socher et al., 2013), Reddit (V”olske et al., 2017), MELD (Poria et al., 2019) and POM (Park et al., 2014). Following Liang et al. (2020), we mainly select “gender” as the sensitive topic $\tau$ , and use the same pre-defined word sets of sensitive attribute words and their replaceable words as Sent-Debias did. The word embeddings for training the debiasing regularizer is selected from the token embedding of the pretrained BERT.
133
+
134
+ # 5.4 DEBIASING RESULTS
135
+
136
+ In Tables 2 and 3 we report the evaluation results of debiased embeddings on both the absolute SEAT effect size and the downstream classification accuracy. For the SEAT test, we follow the setup in Liang et al. (2020), and test the sentence templates of Terms/Names under different domains designed by Caliskan et al. (2017). The column name Origin refers to the original BERT results, and Sent-D is short for Sent-Debias (Liang et al., 2020). FairFil− and FairFil (as $\mathrm { F a i r F ^ { - } }$ and FairF in the tables) are our method without/with the debiasing regularizer in Section 3.3. The best results of effect size (the lower the better) and classification accuracy (the higher the better) are bold among Sent-D, FairFil−, and FairFil. Since the pretrained BERT does not correspond to any downstream task, the classification accuracy is not reported for it.
137
+
138
+ Table 2: Performance of debiased embeddings on Pretrained BERT and BERT post SST-2.
139
+
140
+ <table><tr><td></td><td colspan="4">Pretrained BERT</td><td colspan="4">BERT post SST-2</td></tr><tr><td></td><td>Origin</td><td>Sent-D</td><td>FairF-</td><td>FairF</td><td>Origin</td><td>Sent-D</td><td>FairF</td><td>FairF</td></tr><tr><td>Names,Career/Family</td><td>0.477</td><td>0.096</td><td>0.218</td><td>0.182</td><td>0.036</td><td>0.109</td><td>0.237</td><td>0.218</td></tr><tr><td>Terms,Career/Family</td><td>0.108</td><td>0.437</td><td>0.086</td><td>0.076</td><td>0.010</td><td>0.057</td><td>0.376</td><td>0.377</td></tr><tr><td>Terms,Math/Arts</td><td>0.253</td><td>0.194</td><td>0.133</td><td>0.124</td><td>0.219</td><td>0.221</td><td>0.301</td><td>0.263</td></tr><tr><td>Names,Math/Arts</td><td>0.254</td><td>0.194</td><td>0.101</td><td>0.082</td><td>1.153</td><td>0.755</td><td>0.084</td><td>0.099</td></tr><tr><td>Terms, Science/Arts</td><td>0.399</td><td>0.075</td><td>0.218</td><td>0.204</td><td>0.103</td><td>0.081</td><td>0.133</td><td>0.127</td></tr><tr><td>Names, Science/Arts</td><td>0.636</td><td>0.540</td><td>0.320</td><td>0.235</td><td>0.222</td><td>0.047</td><td>0.017</td><td>0.005</td></tr><tr><td>Avg. Abs. Effect Size</td><td>0.354</td><td>0.256</td><td>0.179</td><td>0.150</td><td>0.291</td><td>0.212</td><td>0.191</td><td>0.182</td></tr><tr><td>Classification Acc.</td><td>1</td><td>-</td><td>1</td><td>1</td><td>92.7</td><td>89.1</td><td>91.7</td><td>91.6</td></tr></table>
141
+
142
+ Table 3: Performance of debiased embeddings on BERT post CoLA and BERT post QNLI.
143
+
144
+ <table><tr><td></td><td colspan="4">BERT post CoLA</td><td colspan="4">BERT post QNLI</td></tr><tr><td></td><td>Origin</td><td>Sent-D</td><td>FairF-</td><td>FairF</td><td>Origin</td><td>Sent-D</td><td>FairF-</td><td>FairF</td></tr><tr><td>Names, Career/Family</td><td>0.009</td><td>0.149</td><td>0.273</td><td>0.034</td><td>0.261</td><td>0.054</td><td>0.196</td><td>0.103</td></tr><tr><td>Terms, Career/Family</td><td>0.199</td><td>0.186</td><td>0.156</td><td>0.119</td><td>0.155</td><td>0.004</td><td>0.050</td><td>0.206</td></tr><tr><td>Terms,Math/Arts</td><td>0.268</td><td>0.311</td><td>0.008</td><td>0.092</td><td>0.584</td><td>0.083</td><td>0.306</td><td>0.323</td></tr><tr><td>Names,Math/Arts</td><td>0.150</td><td>0.308</td><td>0.060</td><td>0.101</td><td>0.581</td><td>0.629</td><td>0.168</td><td>0.288</td></tr><tr><td>Terms, Science/Arts</td><td>0.425</td><td>0.163</td><td>0.245</td><td>0.249</td><td>0.087</td><td>0.716</td><td>0.500</td><td>0.245</td></tr><tr><td>Names,Science/Arts</td><td>0.032</td><td>0.192</td><td>0.102</td><td>0.127</td><td>0.521</td><td>0.443</td><td>0.378</td><td>0.167</td></tr><tr><td>Avg. Abs.Effect Size</td><td>0.181</td><td>0.217</td><td>0.141</td><td>0.120</td><td>0.365</td><td>0.321</td><td>0.266</td><td>0.222</td></tr><tr><td>Classification Acc.</td><td>57.6</td><td>55.4</td><td>56.5</td><td>56.5</td><td>91.3</td><td>90.6</td><td>91.0</td><td>90.8</td></tr></table>
145
+
146
+ From the SEAT test results, our contrastive learning framework effectively reduces the gender bias for both pretrained BERT and fine-tuned BERT under most test scenarios. Comparing with Sent-Debias, our FairFil reaches a lower bias degree on the majority of the individual SEAT tests. Considering the average of absolute effect size, our FairFil is distinguished by a significant margin to Sent-Debias. Moreover, our FairFil achieves higher downstream classification accuracy than Sent-Debias, which indicates learning neural filter networks can preserve more semantic meaning than subtracting bias directions learned from PCA.
147
+
148
+ Table 4: Comparison of average debiasing performance on pretrained BERT
149
+
150
+ <table><tr><td>Method</td><td>Bias Degree</td></tr><tr><td>BERT origin (Devlin et al.,2019) FastText (Bojanowski etal., 2017)</td><td>0.354</td></tr><tr><td></td><td>0.565</td></tr><tr><td>BERT word (Bolukbasi et al., 2016)</td><td>0.861</td></tr><tr><td>BERT simple (May et al., 2019)</td><td>0.298</td></tr><tr><td>Sent-Debias (Liang et al.,2020)</td><td>0.256</td></tr><tr><td>FairFil- (Ours)</td><td>0.179</td></tr><tr><td>FairFil (Ours)</td><td>0.150</td></tr></table>
151
+
152
+ For the ablation study, we also report the results of FairFil without the debiasing regularizer, as in FairF−. Only with the contrastive learning framework, $\mathrm { F a i r F ^ { - } }$ already reduces the bias effectively and even achieves better effect size than the FairF on some of the SEAT tests. With the debiasing regularizer, FairF has better average SEAT effect sizes but slightly loses in terms of the downstream performance. However, the overall performance of FairF and FairF− shows a trade-off between fairness and representativeness of the filter network.
153
+
154
+ We also compare the debiasing performance on a broader class of baselines, including word-level debiasing methods, and report the average absolute SEAT effect size on the pretrained BERT encoder. Both FairF− and FairF achieve a lower bias degree than other baselines. The word-level debiasing methods (FastText (Bojanowski et al., 2017) and BERT word (Bolukbasi et al., 2016))
155
+
156
+ ![](images/b1af18f81a0530ed7cdc54ea708ebd8933b60de57ffa2ef5a690d953331c31cd.jpg)
157
+ Figure 2: Influence of the training data proportion to debias degree of BERT.
158
+
159
+ ![](images/73e47c5a70cdb751cd0be57c568fba5cb6b2d7062571501831b7227b38e7b83d.jpg)
160
+ Figure 3: T-SNE plots of sentence embedding mean of each words contextualized in templates. The left-hand side is from the original pretrained BERT; the right-hand side is from our FairFil.
161
+
162
+ have the worst debiasing performance, which validates our observation that the word-level debiasing methods cannot reduce sentence-level social bias in NLP models.
163
+
164
+ # 5.5 ANALYSIS
165
+
166
+ To test the influence of data proportion on the model’s debiasing performance, we select WikiText-2 with 13,750 sentences as the training corpora following the setup in Liang et al. (2020). Then we randomly divide the training data into 5 equal-sized partitions. We evaluate the bias degree of the sentence debiasing methods on different combinations of the partitions, specifically with training data proportions $20 \%$ , $40 \%$ , $60 \%$ , $80 \%$ , $100 \%$ ). Under each data proportion, we repeat the training 5 times to obtain the mean and variance of the absolute SEAT effect size. In Figure 2, we plot the bias degree of BERT post tasks with different training data proportions. In general, both Sent-Debias and FairFil achieve better performance and smaller variance when the proportion of training data is larger. Under a $20 \%$ training proportion, our FairFil can better remove bias in text encoder, which shows FairFil has better data efficiency with the contrastive learning framework.
167
+
168
+ To further study output debiased sentence embedding, we visualize the relative distances of attributes and targets of SEAT before/after our debiasing process. We choose the target words as “he” and “she.” Attributes are selected from different social domains. We first contextualize the selected words into sentence templates as described in Section 5.1. We then average the original/debiased embeddings of these sentence template and plot the t-SNE (Maaten & Hinton, 2008) in Figure 3. From the t-SNE, the debiased encoder provides more balanced distances from gender targets “he/she” to the attribute concepts.
169
+
170
+ # 6 CONCLUSIONS
171
+
172
+ This paper has developed a novel debiasing method for large-scale pretrained text encoder neural networks. We proposed a fair filter (FairFil) network, which takes the original sentence embeddings as input and outputs the debiased sentence embeddings. To train the fair filter, we constructed a multi-view contrast learning framework, which maximizes the mutual information between each sentence and its augmentation. The augmented sentence is generated by replacing sensitive words in the original sentence with words in a similar semantic but different bias directions. Further, we designed a debiasing regularizer that minimizes the mutual information between the debiased embeddings and the corresponding sensitive words in sentences. Experimental results demonstrate the proposed FairFil not only reduces the bias in sentence embedding space, but also maintains the semantic meaning of the embeddings. This post hoc method does not require access to the training corpora, or any retraining process of the pretrained text encoder, which enhances its applicability.
173
+
174
+ # ACKNOWLEDGEMENTS
175
+
176
+ This research was supported in part by the DOE, NSF and ONR.
177
+
178
+ # REFERENCES
179
+
180
+ Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational information bottleneck. In International Conference on Learning Representations, 2017.
181
+
182
+ Su Lin Blodgett, Solon Barocas, Hal Daume III, and Hanna Wallach. Language (technology) is ´ power: A critical survey of” bias” in nlp. arXiv preprint arXiv:2005.14050, 2020.
183
+
184
+ Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5:135–146, 2017.
185
+
186
+ Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Advances in neural information processing systems, pp. 4349–4357, 2016.
187
+
188
+ Shikha Bordia and Samuel R. Bowman. Identifying and reducing gender bias in word-level language models. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Student Research Workshop, pp. 7–15, Minneapolis, Minnesota, 2019.
189
+
190
+ Marc-Etienne Brunet, Colleen Alkalay-Houlihan, Ashton Anderson, and Richard Zemel. Understanding the origins of bias in word embeddings. In International Conference on Machine Learning, pp. 803–811, 2019.
191
+
192
+ Aylin Caliskan, Joanna J Bryson, and Arvind Narayanan. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183–186, 2017.
193
+
194
+ Kaytlin Chaloner and Alfredo Maldonado. Measuring gender bias in word embeddings across domains and discovering new gender bias word categories. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pp. 25–32, 2019.
195
+
196
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of the 37th international conference on Machine learning, 2020.
197
+
198
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in neural information processing systems, pp. 2172–2180, 2016.
199
+
200
+ Pengyu Cheng, Weituo Hao, Shuyang Dai, Jiachang Liu, Zhe Gan, and Lawrence Carin. Club: A contrastive log-ratio upper bound of mutual information. In Proceedings of the 37th international conference on Machine learning, 2020a.
201
+
202
+ Pengyu Cheng, Martin Renqiang Min, Dinghan Shen, Christopher Malon, Yizhe Zhang, Yitong Li, and Lawrence Carin. Improving disentangled text representation learning with informationtheoretic guidance. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7530–7541, 2020b.
203
+
204
+ Alexis Conneau, Douwe Kiela, Holger Schwenk, Lo¨ıc Barrault, and Antoine Bordes. Supervised learning of universal sentence representations from natural language inference data. In EMNLP, 2017.
205
+
206
+ Jason V Davis, Brian Kulis, Prateek Jain, Suvrit Sra, and Inderjit S Dhillon. Information-theoretic metric learning. In Proceedings of the 24th international conference on Machine learning, pp. 209–216, 2007.
207
+
208
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics, pp. 4171–4186, 2019.
209
+
210
+ Lucas Dixon, John Li, Jeffrey Sorensen, Nithum Thain, and Lucy Vasserman. Measuring and mitigating unintended bias in text classification. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pp. 67–73, 2018.
211
+
212
+ Behnam Gholami, Pritish Sahu, Ognjen Rudovic, Konstantinos Bousmalis, and Vladimir Pavlovic. Unsupervised multi-target domain adaptation: An information theoretic approach. IEEE Transactions on Image Processing, 29:3993–4002, 2020.
213
+
214
+ 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, 2016.
215
+
216
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
217
+
218
+ 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, pp. 9729–9738, 2020.
219
+
220
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2018.
221
+
222
+ Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64–77, 2020.
223
+
224
+ Masahiro Kaneko and Danushka Bollegala. Gender-preserving debiasing for pre-trained word embeddings. arXiv preprint arXiv:1906.00742, 2019.
225
+
226
+ Svetlana Kiritchenko and Saif Mohammad. Examining gender and race bias in two hundred sentiment analysis systems. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pp. 43–53, 2018.
227
+
228
+ Ryan Kiros, Yukun Zhu, Russ R Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In Advances in neural information processing systems, pp. 3294–3302, 2015.
229
+
230
+ Solomon Kullback. Information theory and statistics. Courier Corporation, 1997.
231
+
232
+ Keita Kurita, Nidhi Vyas, Ayush Pareek, Alan W Black, and Yulia Tsvetkov. Measuring bias in contextualized word representations. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pp. 166–172, 2019.
233
+
234
+ Paul Pu Liang, Irene Mengze Li, Emily Zheng, Yao Chong Lim, Ruslan Salakhutdinov, and LouisPhilippe Morency. Towards debiasing sentence representations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5502–5515, 2020.
235
+
236
+ Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. arXiv preprint arXiv:1703.03130, 2017.
237
+
238
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
239
+
240
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
241
+
242
+ Sean MacAvaney, Andrew Yates, Arman Cohan, and Nazli Goharian. Cedr: Contextualized embeddings for document ranking. In Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 1101–1104, 2019.
243
+
244
+ Thomas Manzini, Yao Chong Lim, Yulia Tsvetkov, and Alan W Black. Black is to criminal as caucasian is to police: Detecting and removing multiclass bias in word embeddings. arXiv preprint arXiv:1904.04047, 2019.
245
+
246
+ Chandler May, Alex Wang, Shikha Bordia, Samuel R. Bowman, and Rachel Rudinger. On measuring social biases in sentence encoders. 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. 622–628, 2019.
247
+
248
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In ICLR, 201y.
249
+
250
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
251
+
252
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
253
+
254
+ Sunghyun Park, Han Suk Shim, Moitreya Chatterjee, Kenji Sagae, and Louis-Philippe Morency. Computational analysis of persuasiveness in social multimedia: A novel dataset and multimodal prediction approach. In Proceedings of the 16th International Conference on Multimodal Interaction, pp. 50–57, 2014.
255
+
256
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of NAACL-HLT, pp. 2227–2237, 2018.
257
+
258
+ Soujanya Poria, Devamanyu Hazarika, Navonil Majumder, Gautam Naik, Erik Cambria, and Rada Mihalcea. MELD: A multimodal multi-party dataset for emotion recognition in conversations. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 527–536, 2019.
259
+
260
+ Rui Qian, Tianjian Meng, Boqing Gong, Ming-Hsuan Yang, Huisheng Wang, Serge Belongie, and Yin Cui. Spatiotemporal contrastive video representation learning. arXiv preprint arXiv:2008.03800, 2020.
261
+
262
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training, 2018.
263
+
264
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
265
+
266
+ Dinghan Shen, Pengyu Cheng, Dhanasekar Sundararaman, Xinyuan Zhang, Qian Yang, Meng Tang, Asli Celikyilmaz, and Lawrence Carin. Learning compressed sentence representations for ondevice text processing. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 107–116, 2019.
267
+
268
+ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
269
+
270
+ Jiaming Song, Pratyusha Kalluri, Aditya Grover, Shengjia Zhao, and Stefano Ermon. Learning controllable fair representations. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 2164–2173, 2019.
271
+
272
+ Gabriel Stanovsky, Noah A Smith, and Luke Zettlemoyer. Evaluating gender bias in machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1679–1684, 2019.
273
+
274
+ Fei Sun, Jun Liu, Jian Wu, Changhua Pei, Xiao Lin, Wenwu Ou, and Peng Jiang. Bert4rec: Sequential recommendation with bidirectional encoder representations from transformer. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, pp. 1441–1450, 2019.
275
+
276
+ 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.
277
+
278
+ Michael V”olske, Martin Potthast, Shahbaz Syed, and Benno Stein. TL;DR: Mining Reddit to learn automatic summarization. In Proceedings of the Workshop on New Frontiers in Summarization, pp. 59–63, 2017.
279
+
280
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 353–355, 2018.
281
+
282
+ Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625–641, 2019.
283
+
284
+ Kilian Q Weinberger, John Blitzer, and Lawrence K Saul. Distance metric learning for large margin nearest neighbor classification. In Advances in neural information processing systems, pp. 1473– 1480, 2006.
285
+
286
+ Svante Wold, Kim Esbensen, and Paul Geladi. Principal component analysis. Chemometrics and intelligent laboratory systems, 2(1-3):37–52, 1987.
287
+
288
+ Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. arXiv preprint arXiv:1904.09675, 2019.
md/train/NPOWF_ZLfC5/NPOWF_ZLfC5.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Automatic Symmetry Discovery with Lie Algebra Convolutional Network
2
+
3
+ Nima Dehmamy Northwestern University nimadt@bu.edu
4
+
5
+ Robin Walters Northeastern University rwalters@northeastern.edu
6
+
7
+ Yanchen Liu Northeastern University liu.yanc@northeastern.edu
8
+
9
+ Dashun Wang Northwestern University dashun.wang@kellogg.northwestern.edu
10
+
11
+ Rose Yu University of California San Diego roseyu@ucsd.edu
12
+
13
+ # Abstract
14
+
15
+ Existing equivariant neural networks require prior knowledge of the symmetry group and discretization for continuous groups. We propose to work with Lie algebras (infinitesimal generators) instead of Lie groups. Our model, the Lie algebra convolutional network (L-conv) can automatically discover symmetries and does not require discretization of the group. We show that L-conv can serve as a building block to construct any group equivariant feedforward architecture. Both CNNs and Graph Convolutional Networks can be expressed as L-conv with appropriate groups. We discover direct connections between L-conv and physics: (1) group invariant loss generalizes field theory (2) Euler-Lagrange equation measures the robustness, and (3) equivariance leads to conservation laws and Noether current. These connections open up new avenues for designing more general equivariant networks and applying them to important problems in physical sciences.1
16
+
17
+ # 1 Introduction
18
+
19
+ Incorporating symmetries into a deep learning architecture can reduce sample complexity, improve generalization, while significantly decreasing the number of model parameters (Cohen et al., 2019b; Cohen & Welling, 2016b; Ravanbakhsh et al., 2017; Ravanbakhsh, 2020; Wang et al., 2020). For instance, Convolutional Neural Networks (CNN) (LeCun et al., 1989, 1998) implement translation symmetry through weight sharing. General principles for constructing symmetry-aware group equivariant neural networks were introduced in Cohen & Welling (2016b), Kondor & Trivedi (2018), and Cohen et al. (2019b).
20
+
21
+ However, most work on equivariant networks requires knowing the symmetry group a priori. A different equivariant model needs to be re-designed for each symmetry group. In practice, we may not have a good inductive bias and such knowledge of the symmetries may not be available. Constructing and selecting the equivariant network with the appropriate symmetry group becomes quite tedious. Furthermore, many existing works are limited to finite groups such as permutations Hartford et al. (2018); Ravanbakhsh et al. (2017); Zaheer et al. (2017), 90 degree rotations Cohen et al. (2018) or dihedral groups $\mathrm Ḋ N Ḍ$ and $E ( 2 )$ Weiler & Cesa (2019).
22
+
23
+ For a continuous group, existing approaches either discretize the group Weiler et al. (2018a,b); Cohen & Welling (2016a), or use a truncated sum over irreducible representations (irreps) Weiler & Cesa (2019); Weiler et al. (2018a) via spherical harmonics in Worrall et al. (2017) or more general Clebsch-Gordon coefficients Kondor et al. (2018); Bogatskiy et al. (2020). These approaches are prone to approximation error. Recently, Finzi et al. (2020) propose to approximates the integral over the Lie group by Monte Carlo sampling. This approach requires implementing the matrix exponential and obtaining a local neighborhood for each point. Both parametrizing Lie groups for sampling and finding irreps are computationally expensive. Finzi et al. (2021) provide a general algorithm for constructing equivariant multi-layer perceptrons (MLP), but require explicit knowledge of the group to encode its irreps, and solving a set of constraints.
24
+
25
+ We provide a novel framework for designing equivariant neural networks. We leverage the fact that Lie groups can be constructed from a set of infinitesimal generators, called Lie algebras. A Lie algebra has a finite basis, assuming the group is finite-dimensional. Working with the Lie algebra basis allows us to encode an infinite group without discretizing or summing over irreps. Additionally, all Lie algebras have the same general structure and hence can be implemented the same way. We propose Lie Algebra Convolutional Network (L-conv), a novel architecture that can automatically discover symmetries from data. Our main contributions can be summarized as follows:
26
+
27
+ • We propose the Lie algebra convolutional network (L-conv), a building block for constructing group equivariant neural networks. We prove that multi-layer L-conv can approximate group convolutional layers, including CNNs, and find graph convolutional networks to be a special case of L-conv.
28
+ We can learn the Lie algebra basis in L-conv, enabling automatic symmetry discovery.
29
+ • L-conv also reveals interesting connections between physics and learning: equivariant loss generalizes important Lagrangians in field theory; robustness and equivariance can be expressed as Euler-Lagrange equations and Noether currents.
30
+
31
+ Learning symmetries from data has been studied in limited settings for commutative Lie groups as in Cohen & Welling (2014), 2D rotations and translations in Rao & Ruderman (1999), Sohl-Dickstein et al. (2010) or permutations (Anselmi et al., 2019). In the non-commutative case, GeoManCEr (Pfau et al., 2020) uses data points related by small transformations to learn non-abelian Lie groups, but it does not introduce an equivariant layer architecture. (Zhou et al., 2020) propose a general method for symmetry discovery. Yet, their weight-sharing scheme and the symmetry generators are very different from ours. Our approach use much fewer parameters and has a direct interpretation using Lie algebras (SI B.3). Benton et al. (2020) propose Augerino to learn a distribution over data augmentations. It also involves Lie algebras, but is restricted to a subgroup of 2D affine transformations and requires matrix logarithm and sampling (SI B.3). In contrast, our approach is simpler and more general. Our approach uses composition of small transformations to achieve large transformations. In this sense bears some resemblance to symnets (Gens & Domingos, 2014), but the rest of the construction is different.
32
+
33
+ # 2 Background
34
+
35
+ We review the core concepts L-conv builds upon: equivariance, group convolution and Lie algebras.
36
+
37
+ Notations. Unless explicitly stated, $a$ in $A ^ { a }$ is an index, not an exponent. We use the Einstein summation $\begin{array} { r } { A ^ { a } B _ { a b } = \sum _ { a } A ^ { \dot { a } } B _ { a b } = [ A B ] _ { b } } \end{array}$ , where a repeated upper and lower index are summed.
38
+
39
+ Equivariance. Let $s$ be a topological space on which a Lie group $G$ (continuous group) acts from the left, meaning for all $\pmb { x } \in \ b { S }$ and $g \in G$ , $g { \pmb x } \in { \mathcal { S } }$ . We refer to $s$ as the base space. Let $\mathcal { F }$ , the “feature space”, be the vector space $\mathcal { F } = \mathbb { R } ^ { m }$ . Each data point is a feature map $f : S { \mathcal { F } }$ . The action of $G$ on the input of $f$ induces an action on feature maps. For “scalar” features, for $u \in G$ , the transformed features $u \cdot f$ are given by
40
+
41
+ $$
42
+ u \cdot f ( \pmb { x } ) = f ( u ^ { - 1 } \pmb { x } ) .
43
+ $$
44
+
45
+ Denote the space of all functions from $s$ to $\mathcal { F }$ by $\mathcal { F } ^ { S }$ , so that $f \in \mathcal { F } ^ { s }$ . Let $F$ be a mapping to a new feature space $\mathcal { F } ^ { \prime } = \mathbb { R } ^ { m ^ { \prime } }$ , meaning $F : \mathcal { F } ^ { s } \to \mathcal { F } ^ { \prime } { } ^ { s }$ . We say $F$ is equivariant under $G$ if $G$ acts on ${ \mathcal { F } } ^ { \prime }$
46
+
47
+ ![](images/6c3a9c8f35d4da74c4e308612267a2b9221f619d9ec042857d2aff947d0785e5.jpg)
48
+ Figure 1: Lie group and Lie algebra: Illustration of the group manifold of a Lie group $G$ (left). The Lie algebra ${ \mathfrak { g } } = T _ { I } G$ is the tangent space at the identity $I$ . $L _ { i }$ are a basis for $T _ { I } G$ . If $G$ is connected, $\forall g \in G$ there exist paths like $\gamma$ from $I$ to $g$ and $g$ can be written as a path-ordered integral $\begin{array} { r } { g = P \exp [ \bar { \int _ { \gamma } d t ^ { i } } L _ { i } ] } \end{array}$ . Base space Right is a schematic of the base space $s$ as a manifold. The lift ${ \pmb x } = g { \pmb x } _ { 0 }$ takes ${ \pmb x } \in { \pmb S }$ to $g \in G$ , and maps the tangent spaces $T _ { x } S T _ { g } G$ . Each Lie algebra basis $L _ { i } \in \mathfrak { g } = T _ { I } G$ generates a vector field $\hat { L } _ { i }$ on the tangent bundle $T G$ via the pushforward $\hat { L } _ { i } ( g ) = g L _ { i } g ^ { - 1 }$ . Via the lift, $L _ { i }$ also generates a vector field $\bar { L } _ { i } = \hat { L } _ { i } ^ { \alpha } ( { \pmb x } ) \partial _ { \alpha } = [ g L _ { i } \bar { \pmb x _ { 0 } } ] ^ { \alpha } \partial _ { \alpha }$ .
49
+
50
+ and for $u \in G$ , we have
51
+
52
+ $$
53
+ u \cdot ( F ( f ) ) = F ( u \cdot f ) .
54
+ $$
55
+
56
+ Group Convolution. Kondor & Trivedi (2018) showed that $F$ is a linear equivariant map if and only if it performs a group convolution (G-conv). To define G-conv, we first lift $_ { \textbf { \em x } }$ to elements in $G$ (Kondor $\&$ Trivedi, 2018). Specifically, we pick an origin ${ \pmb x } _ { 0 } \in { \mathcal { S } }$ and replace each point ${ \pmb x } = g { \pmb x } _ { 0 }$ by $g$ . We will often drop $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ for brevity and write $f ( g ) \equiv f ( g \pmb { x } _ { 0 } )$ . Let $\kappa : G \to \mathbb { R } ^ { m ^ { \prime } } \otimes \mathbb { R } ^ { m }$ be a linear transformation from $\mathcal { F }$ to ${ \mathcal { F } } ^ { \prime }$ . G-conv is defined as
57
+
58
+ $$
59
+ [ \kappa \star f ] ( g ) = \int _ { G } \kappa ( g ^ { - 1 } v ) f ( v ) d v = \int _ { G } \kappa ( v ) f ( g v ) d v ,
60
+ $$
61
+
62
+ We denote the Haar measure on $G$ as $d v \equiv d \mu ( v )$ for brevity.
63
+
64
+ Equivariance of G-conv. G-conv in equation 3 is equivariant (Kondor $\&$ Trivedi, 2018). By definition, for $w \in G$ we have
65
+
66
+ $$
67
+ \begin{array} { l } { { [ \kappa \star w \cdot f ] ( g ) = \displaystyle \int _ { G } \kappa ( v ) w \cdot f ( g v ) d v = \displaystyle \int _ { G } \kappa ( v ) f ( w ^ { - 1 } g v ) d v } } \\ { { = [ \kappa \star f ] ( w ^ { - 1 } g ) = w \cdot [ \kappa \star f ] ( g ) } } \end{array}
68
+ $$
69
+
70
+ Existing works on equivariance networks implement $\int _ { G }$ by discretizing the group or summing over irreps. We take a different approach and use the infinitesimal generators of the group. While a Lie group $G$ is infinite, usually it can be generated using a small number of infinitesimal generator, comprising its “Lie algebra”. We use the Lie algebra to introduce a building block to approximate G-conv. Figure 1 visualizes a Lie group, Lie algebra and the concept we discuss below.
71
+
72
+ Lie algebra. Let $G$ be a Lie group, which includes common continuous groups. Group elements $u \in G$ infinitesimally close to the identity element $I$ can be written as $u \stackrel { - } { \approx } I + \stackrel { - } \epsilon ^ { i } L _ { i }$ (note Einstein summation), where $L _ { i } \in { \mathfrak { g } }$ with the Lie algebra ${ \mathfrak { g } } = T _ { I } G$ is the tangent space of $G$ at the identity element. The Lie algebra has the property that it is closed under a Lie bracket $[ \cdot , \cdot ] : { \mathfrak { g } } \times { \mathfrak { g } } \to { \mathfrak { g } }$
73
+
74
+ $$
75
+ [ L _ { i } , L _ { j } ] = { c _ { i j } } ^ { k } L _ { k } ,
76
+ $$
77
+
78
+ which is skew-symmetric and satisfies the Jacobi identity. Here the coefficients $c _ { i j } { } ^ { k } \in \mathbb { R }$ or $\mathbb { C }$ are called the structure constants of the Lie algebra. For matrix representations of $\mathfrak { g }$ , $[ L _ { i } , L _ { j } ] =$ $L _ { i } L _ { j } - L _ { j } L _ { i }$ is the commutator. The $L _ { i }$ are called the infinitesimal generators of the Lie group.
79
+
80
+ Exponential map. If the manifold of $G$ is connected 2, an exponential map $\exp : { \mathfrak { g } } \to G$ can be defined such that $\overset { \cdot } { g } = \exp [ t ^ { i } L _ { i } ] \in G$ . For matrix groups, if $G$ is connected and compact, the matrix exponential is such a map and it is surjective. For most other groups (except ${ \mathrm { G L } } _ { d } ( \mathbb { C } )$ and nilpotent groups) it is not surjective. Nevertheless, for any connected group every $g \in G$ can be written as a product $\begin{array} { r } { g = \prod _ { a } \exp [ t _ { a } ^ { i } L _ { i } ] } \end{array}$ (Hall, 2015). Making ${ \dot { t } } _ { a } ^ { i }$ infinitesimal steps $d t ^ { i } ( s )$ tangent to a path $\gamma$ from $I$ to $g$ on $G$ yields the surjective path-ordered exponential in physics, denoted as $\begin{array} { r } { g = P \exp [ \int _ { \gamma } d t ^ { i } L _ { i } ] } \end{array}$ (SI A, and see Time-ordering in Weinberg (1995, p143)).
81
+
82
+ Pushforward. $L _ { i } \in T _ { I } G$ can be pushed forward to $\hat { L } _ { i } ( g ) = g L _ { i } g ^ { - 1 } \in T _ { g } G$ to form a basis for $T _ { g } G$ , satisfying the same Lie algebra $[ \hat { L } _ { i } ( g ) , \hat { L } _ { j } ( g ) ] = { c _ { i j } } ^ { k } \hat { L } _ { k } ( g )$ . The manifold of $G$ together with the set of all $T _ { g } G$ attached to each $g$ forms the tangent bundle $T G$ , a type of fiber bundle (Lee et al., 2009). $\hat { L } _ { i }$ is a vector field on $_ { T G }$ . The lift maps $\hat { L } _ { i }$ to an equivalent vector field on $T S$ , which we will also denote by $\hat { L } _ { i }$ . Figure 1 illustrates the flow of these vector fields on $T G$ and $T S$ .
83
+
84
+ # 3 Lie Algebra Convolutional Network
85
+
86
+ We can use the Lie algebra basis $L _ { i } \in { \mathfrak { g } }$ to construct the Lie group $G$ with the exponential map. Similarly, we show that Lie algebras can also serve as building blocks to construct $\mathbf { G }$ -conv layers. We propose the Lie algebra convolutional network (L-conv). The key idea is to approximate the kernel $\kappa ( u )$ using localized kernels which can be constructed using the Lie algebra (Fig. 2). This is possible because the exponential map is a generalization of a Taylor expansion. We show that a G-conv whose kernel is concentrated near the identity can be expanded in the Lie algebra.
87
+
88
+ Let $\delta _ { \eta } ( u ) \in \mathbb { R }$ denote a normalized localized kernel, meaning $\begin{array} { r } { \int _ { G } \delta _ { \eta } ( g ) d g = 1 } \end{array}$ , and with support on a small neighborhood of size $\eta$ centered around the identity $I$ (i.e., $\delta _ { \eta } ( I + \epsilon ^ { i } L _ { i } ) \to 0$ if $\| \epsilon \| ^ { 2 } > \eta ^ { 2 } )$ . We pick $\delta _ { \eta } ( v _ { \epsilon } ) \sim \theta ( \eta ^ { 2 } - \| \epsilon \| ^ { 2 } )$ , for $v _ { \epsilon } = I + \epsilon ^ { i } L _ { i } \in T _ { I } G$ and $\delta _ { \eta } ( v ) = 0$ for all other $v \notin T _ { I } G \left( \theta ( \cdot ) \right.$ being the Heaviside step function). Let $\kappa _ { 0 } : G \to \mathbb { R } ^ { m ^ { \prime } } \otimes \mathbb { R } ^ { m }$ be given by
89
+
90
+ $$
91
+ \left[ \kappa _ { 0 } \right] _ { a } ^ { b } ( u ) = \left[ W ^ { 0 } \right] _ { a } ^ { c } \delta _ { \eta } \left( u \left( I - \left[ \bar { \epsilon } ^ { i } \right] _ { c } ^ { b } L _ { i } \right) \right)
92
+ $$
93
+
94
+ where $W ^ { 0 } \in \mathbb { R } ^ { m ^ { \prime } } \otimes \mathbb { R } ^ { h }$ and $\overline { { \epsilon } } ^ { i } \in \mathbb { R } ^ { h } \otimes \mathbb { R } ^ { m }$ are constants, and we choose $\vert [ \overline { { { \epsilon } } } ^ { i } ] _ { b } ^ { a } \vert < \eta$ . Note that $\begin{array} { r } { ( I + \epsilon ^ { i } L _ { i } ) ( I - \overline { { \epsilon } } ^ { j } L _ { j } ) = I + [ \epsilon - \overline { { \epsilon } } ] ^ { i } L _ { i } + O ( \eta ^ { 2 } ) } \end{array}$ . Therefore,
95
+
96
+ $$
97
+ \int \epsilon ^ { i } d \epsilon \delta _ { \eta } \left( ( I + \epsilon ^ { i } L _ { i } ) ( I - \overline { { { \epsilon } } } ^ { j } L _ { j } ) \right) = \overline { { { \epsilon } } } ^ { i }
98
+ $$
99
+
100
+ The localized kernels $\kappa _ { 0 }$ can be used to approximate G-conv.
101
+
102
+ Linear expansion of $\mathbf { G }$ -conv with localized kernel. We can expand a G-conv whose kernel is $\kappa _ { 0 } ( u ) = \bar { W } ^ { 0 } \delta _ { \eta } ( u )$ in the Lie algebra of $G$ to linear order. With $v _ { \epsilon } \stackrel { \textstyle \mathsf { \bar { \alpha } } } { = } I + \epsilon ^ { i } L _ { i }$ , we have (see SI A)
103
+
104
+ $$
105
+ \begin{array} { l } { { \displaystyle Q [ f ] ( g ) = [ \kappa _ { 0 } \star f ] ( g ) = \int _ { G } d v \kappa _ { 0 } ( v ) f ( g v ) = \int _ { \| \epsilon \| < \eta } d v _ { \epsilon } \kappa _ { 0 } ( v _ { \epsilon } ) f ( g v _ { \epsilon } ) } } \\ { ~ } \\ { { \displaystyle ~ = W ^ { 0 } \int d \epsilon \delta _ { \eta } ( v _ { \epsilon } ) \left[ f ( g ) + \epsilon ^ { i } g L _ { i } \cdot \frac d { d g } f ( g ) + O ( \epsilon ^ { 2 } ) \right] } } \\ { { \displaystyle ~ = W ^ { 0 } \left[ I + \bar { \epsilon } ^ { i } g L _ { i } \cdot \frac d { d g } \right] f ( g ) + O ( \eta ^ { 2 } ) } } \end{array}
106
+ $$
107
+
108
+ with $W ^ { 0 } \in \mathbb { R } ^ { m ^ { \prime } } \otimes \mathbb { R } ^ { h }$ and $\overline { { \epsilon } } ^ { i } \in \mathbb { R } ^ { h } \otimes \mathbb { R } ^ { m }$ , as before. Here $d \epsilon$ is the integration measure on the Lie algebra ${ \mathfrak { g } } = T _ { I } G$ induced by the Haar measure $d v _ { \epsilon }$ on $G$ .
109
+
110
+ Interpreting the derivatives. In a matrix representation of $G$ , we have $\begin{array} { r } { g L _ { i } \cdot \frac { d f } { d g } = [ g L _ { i } ] _ { \alpha } ^ { \beta } \frac { d f } { d g _ { \alpha } ^ { \beta } } = } \end{array}$ $\operatorname { T r } \left[ [ g L _ { i } ] ^ { T } { \frac { d f } { d g } } \right]$ . This can be written in terms of partial derivatives $\partial _ { \alpha } f ( \pmb x ) = \partial f / \partial \pmb x ^ { \alpha }$ as follows. Using $\pmb { x } ^ { \rho } = g _ { \sigma } ^ { \rho } \pmb { x } _ { 0 } ^ { \sigma }$ , we have $\begin{array} { r } { \frac { d f ( g x _ { 0 } ) } { d g _ { \beta } ^ { \alpha } } = { \pmb x } _ { 0 } ^ { \beta } \partial _ { \alpha } f ( { \pmb x } ) } \end{array}$ , and so
111
+
112
+ $$
113
+ \hat { L } _ { i } f ( \pmb { x } ) \equiv g L _ { i } \cdot \frac { d f } { d g } = [ g L _ { i } ] _ { \beta } ^ { \alpha } \pmb { x } _ { 0 } ^ { \beta } \partial _ { \alpha } f ( \pmb { x } ) = [ g L _ { i } \pmb { x } _ { 0 } ] \cdot \nabla f ( \pmb { x } )
114
+ $$
115
+
116
+ Hence, for each $L _ { i }$ , the pushforward $g L _ { i } g ^ { - 1 }$ generates a flow on $s$ through the vector field $\hat { L } _ { i } \equiv { }$ $g L _ { i } \cdot d / d g = [ g L _ { i } g ^ { - 1 } { \pmb x } ] ^ { \bar { \alpha } } \partial _ { \alpha }$ (Fig. 1).
117
+
118
+ ![](images/66a444b0af7483094d85e1019feae8039ad1ee494275c1042f0548072df9fede.jpg)
119
+ Figure 2: Sketch of the procedure for approximating G-conv using L-conv. First, the kernel is written as the sum of a number of localized kernels $\kappa _ { k }$ with support around $u _ { k }$ (left). Each of the $\kappa _ { k }$ is then moved toward identity by composing multiple L-conv layers $Q _ { \epsilon ^ { \prime } } \circ Q _ { \epsilon } \dots \kappa _ { k }$ (right).
120
+
121
+ Lie algebra convolutional (L-conv) layer. Equation 8 states that for a kernel localized near the identity, the effect of the kernel can be summarized in $W ^ { 0 }$ and $\overline { { \epsilon } } ^ { i } \hat { L } _ { i }$ . Note that we do not need to perform the integral over $G$ explicitly anymore. Instead of working with a kernel $\kappa _ { 0 }$ , we only need to specify $W ^ { 0 }$ and $\overline { { \epsilon } } ^ { i }$ . Hence, in general, we define the Lie algebra convolution (L-conv) as
122
+
123
+ $$
124
+ \begin{array} { l } { { Q [ f ] ( { \pmb x } ) = W ^ { 0 } \left[ I + \overline { { { \epsilon } } } ^ { i } \hat { L } _ { i } \right] f ( { \pmb x } ) } } \\ { { \ = W ^ { 0 } \left[ I + \overline { { { \epsilon } } } ^ { i } [ g L _ { i } { \pmb x } _ { 0 } ] ^ { \alpha } \partial _ { \alpha } \right] f ( { \pmb x } ) } } \end{array}
125
+ $$
126
+
127
+ Being an expansion of G-conv, L-conv inherits the equivariance of $\mathbf { G }$ -conv, as we show next.
128
+
129
+ Proposition 1 (Equivariance of L-conv). With assumptions above, $L$ -conv is equivariant under $G$
130
+
131
+ Proof: First, note that the components of $\hat { L } _ { i }$ transform as $[ \hat { L } _ { i } ( v \pmb { x } ) ] ^ { \alpha } = [ v g L _ { i } \pmb { x } _ { 0 } ] ^ { \alpha } = v _ { \beta } ^ { \alpha } \hat { L } _ { i } ( \pmb { x } ) ^ { \beta }$ , while the partial transforms as $\partial / \partial [ v \pmb { x } ] ^ { \alpha } = [ v ^ { - 1 } ] _ { \alpha } ^ { \gamma } \partial _ { \gamma }$ . As a result in $\hat { L } _ { i } = [ g L _ { i } { \pmb x } _ { 0 } ] ^ { \alpha } \partial _ { \alpha }$ all factors of $v$ cancel, meaning for $v \in G$ , $\hat { L } _ { i } ( v \pmb { x } ) = \hat { L } _ { i } ( \pmb { x } )$ . This is because of the fact that $\hat { L } _ { i } \in T S$ is a vector field (i.e. 1-tensor) and, thus, invariant under change of basis. Plugging into equation 10, for $w \in G$
132
+
133
+ $$
134
+ \begin{array} { l } { w \cdot Q [ f ] ( { \pmb x } ) = Q [ f ] ( w ^ { - 1 } { \pmb x } ) = W ^ { 0 } \left[ I + \bar { \epsilon } ^ { i } \hat { L } _ { i } ( w ^ { - 1 } { \pmb x } ) \right] f ( w ^ { - 1 } { \pmb x } ) } \\ { = W ^ { 0 } \left[ I + \bar { \epsilon } ^ { i } \hat { L } _ { i } ( g ) \right] f ( w ^ { - 1 } { \pmb x } ) = W ^ { 0 } \left[ I + \bar { \epsilon } ^ { i } \hat { L } _ { i } ( g ) \right] w \cdot f ( { \pmb x } ) = Q [ w \cdot f ] ( { \pmb x } ) ( \bar { \epsilon } ^ { i } - { \pmb x } ) } \end{array}
135
+ $$
136
+
137
+ which proves L-conv is equivariant.
138
+
139
+ Examples. Using equation 9 we can calculate $\mathrm { L }$ -conv for specific groups (details in SI A.2). For translations $G = T _ { n } = ( \mathbb { R } ^ { n } , + )$ , we find the generators become simple partial derivatives $\hat { L } _ { i } = \partial _ { i }$ (SI A.2.2), yielding $f ( \pmb { x } ) + \epsilon ^ { \alpha } \partial _ { \alpha } f ( \pmb { x } )$ . For 2D rotations (SI A.2.1) the generator $\hat { L } \equiv ( x \partial _ { y } - y \partial _ { x } ) = \partial _ { \theta }$ , which is the angular momentum operator about the $\mathbf { Z }$ -axis in quantum mechanics and field theories. For rotations with scaling, $G = S O ( 2 ) \times \mathbb { R } ^ { + }$ , we have two $L _ { i }$ , one $\hat { L } _ { \theta } = \partial _ { \theta }$ from $s o ( 2 )$ and a scaling with $L _ { r } = I$ , yielding $\hat { L } _ { r } = x \partial _ { x } + y \partial _ { y } = r \partial _ { r }$ . Next, we discuss the form of L-conv on discrete data.
140
+
141
+ # 3.1 Approximating G-conv using L-conv
142
+
143
+ L-conv can be used as a basic building block to construct G-conv with more general kernels. Figure 2 sketches the argument described here (see also SI A.1).
144
+
145
+ Theorem 1 (G-conv from L-convs). $G$ -conv equation 3 can be approximated using $L$ -conv layers.
146
+
147
+ Proof: The procedure involves two steps, as illustrated in Fig. 2: 1) approximate the kernel using localized kernels as the $\delta _ { \eta }$ in L-conv; 2) move the kernels towards identity using multiple L-conv layers. The following lemma outline the details. 
148
+
149
+ Lemma 1 (Approximating the kernel). Let the kernel $\kappa : G \to { \mathcal { F } } ^ { \prime } \otimes { \mathcal { F } }$ with $\textstyle \int _ { G } \| \kappa ( g ) \| ^ { 2 } d g < \infty$ be continuously differentiable with $\| d \kappa ( g ) / d g \| ^ { 2 } < \xi ^ { 2 }$ , and with compact support over $G _ { 0 } \subset G$ . Let The $\kappa _ { k } ( g ) = c _ { k } \delta _ { \eta } ( u _ { k } ^ { - 1 } g )$ set oand $N$ els with ssuch that $\eta$ neighborhoodapproximates f , $u _ { k } \in G$ $c _ { k } \in \mathcal { F } ^ { \prime } \otimes \mathcal { F }$ $u _ { k } \in G$ $\begin{array} { r } { \tilde { \kappa } = \sum _ { k = 1 } ^ { N } \kappa _ { k } } \end{array}$ $\kappa _ { \ast }$ $\begin{array} { r } { \int _ { G } \| \kappa ( g ) - \tilde { \kappa } ( g ) \| ^ { 2 } d g < \zeta ^ { 2 } } \end{array}$ for arbitrary small $\zeta \in \mathbb { R } _ { + }$ .
150
+
151
+ Proof: See SI A.1 for details. The intuition is similar to the universal approximation theorem for neural networks (Hornik et al., 1989; Cybenko, 1989), only generalized to a group manifold instead of $\mathbb { R }$ . Let $B _ { 0 }$ be the set of $v _ { \epsilon } = I + \epsilon ^ { i } \bar { L _ { i } } \in \mathfrak { g }$ , with $\| \dot { \epsilon } \| ^ { 2 } < \dot { \eta } ^ { 2 }$ . Choose a set of $u _ { k } \in G$ such that the k k 0 that on small enough neighborhoods neighborhoods $B _ { k } = u _ { k } B _ { 0 } \subset G$ cover the support $B _ { k } \subset G$ 0 , for any two $G _ { 0 }$ of $u , v \in B _ { k }$ $\kappa$ . The bound we have $\| d \kappa ( g ) / d g \| ^ { 2 } < \xi ^ { 2 }$ $\| \kappa ( \dot { u } ) - \ddot { \kappa } ( v ) \| ^ { 2 } \leq \eta ^ { 2 } \xi ^ { 2 }$ means where $| G _ { 0 } |$ is the volume of the support of $\kappa$ . Hence, for $g \in B _ { k }$ , $\kappa ( g )$ can be approximated with $\kappa _ { k } ( g ) = \kappa ( u _ { k } ) \delta _ { \eta } ( u _ { k } ^ { - 1 } g )$ , with normalized localized kernels $\delta _ { \eta } ( g )$ , and any element $u _ { k } ~ \in$ $B _ { k }$ . We show that the approximation error of using $\tilde { \kappa } = \sum _ { k } \kappa _ { k }$ to approximate $\kappa$ is bounded by $\begin{array} { r } { \int _ { G } d g \| \kappa ( g ) - \tilde { \kappa } ( g ) \| ^ { 2 } < | G _ { 0 } | \eta ^ { 2 } \xi ^ { 2 } } \end{array}$ . Any desired error bound $\zeta$ can then be attained by choosing small enough $\eta$ for neighborhood sizes. 
152
+
153
+ Thus, we can approximate a large class of kernels as $\begin{array} { r } { \kappa ( g ) \approx \sum _ { k } \kappa _ { k } ( g ) } \end{array}$ where the local kernels $\kappa _ { k } ( g ) = c _ { k } \delta _ { \eta } ( u _ { k } ^ { - 1 } g )$ have support only on an $\eta$ neighborhood of $u _ { k } \in G$ . Here $c _ { k } \in \mathbb { R } ^ { m ^ { \prime } } \otimes \mathbb { R } ^ { m }$ are constants and $\delta _ { \eta } ( u )$ is as in equation 8. Using this, $\mathbf { G }$ -conv equation 3 becomes
154
+
155
+ $$
156
+ [ \kappa \star f ] ( g ) = \sum _ { k } c _ { k } \int d v \delta _ { \eta } ( u _ { k } ^ { - 1 } v ) f ( g v ) = \sum _ { k } c _ { k } [ \delta _ { \eta } \star f ] ( g u _ { k } ) .
157
+ $$
158
+
159
+ The kernels $\kappa _ { k }$ are localized around $u _ { k }$ , whereas in L-conv the kernel is around identity. We can compose L-conv layers to move $\kappa _ { k }$ from $u _ { k }$ to identity.
160
+
161
+ Lemma 2 (Moving kernels to identity). $\kappa _ { k }$ can be moved near identity using a multilayer $L$ -conv.
162
+
163
+ Proof: In equation 12, write $u _ { k } = v _ { \epsilon } u _ { k } ^ { \prime }$ , with $v _ { \epsilon } = I + \epsilon ^ { i } L _ { i } \in \mathfrak { g }$ . Using the definition equation 10 an L-conv layer $Q _ { \epsilon } = I - \epsilon ^ { i } \hat { L } _ { i }$ performs a first order Taylor expansion (SI A.1) and so $Q _ { \epsilon } [ \delta _ { \eta } ] ( u _ { \ \boldsymbol { k } } ^ { \prime - 1 } v ) =$ $\delta _ { \eta } ( u _ { k } ^ { - 1 } v ) + O ( \epsilon ^ { 2 } )$ . Thus, applying one $\mathrm { L }$ -conv layer moves the localized kernel along $v _ { \epsilon }$ on $G$ . Writing $u _ { k }$ as the product of a set of small group elements $\textstyle u _ { k } = \prod _ { a = 1 } ^ { p } v _ { a }$ , with $v _ { a } = I + \epsilon _ { a } ^ { i } L _ { i } \in \mathfrak { g }$ Defining L-conv layers $Q _ { a } = I - \epsilon _ { a } ^ { i } \hat { L } _ { i }$ , we can write
164
+
165
+ $$
166
+ \kappa _ { k } ( g ) \approx c _ { k } Q _ { p } \circ \cdot \cdot \cdot \circ Q _ { 1 } \circ \delta _ { \eta } ( g )
167
+ $$
168
+
169
+ meaning $\kappa _ { k }$ localized around $u _ { k }$ can be written as a $p$ layer L-conv acting on a kernel $\delta _ { \eta } ( g )$ , localized around the identity of the group. With $\| \epsilon _ { a } \| < \eta$ , the error in $u _ { k }$ is $O ( \eta ^ { p + 1 } )$ . 
170
+
171
+ Thus, we conclude that any G-conv equation 3 can be approximated by multilayer L-conv. Furthermore, for compact $G$ , using the theorem in Kondor & Trivedi (2018), we can show that any equivariant feedforward neural network can be approximated using multilayer L-conv with nonlinearities.
172
+
173
+ Equivariance of nonlinearity. Pointwise nonlinearities give equivariant maps between scalar feature maps. To see this, let $\sigma : \mathbb { R } \mathbb { R }$ . We extend $\sigma : { \mathcal { F } } { \mathcal { F } }$ by applying $\sigma$ component-wise. Let $f : S { \mathcal { F } }$ be a scalar feature map (i.e., $g \cdot f ( { \pmb x } ) = f ( g ^ { - 1 } { \pmb x } ) )$ . Then
174
+
175
+ $$
176
+ g \cdot ( \sigma \circ ( f ) ) ( { \pmb x } ) = \sigma \circ ( f ) ( g ^ { - 1 } { \pmb x } ) = \sigma \circ ( g \cdot f ) ( { \pmb x } ) .
177
+ $$
178
+
179
+ Since the composition of equivariant maps is equivariant, given equivariant linear mapping $Q : { \mathcal { F } } ^ { S } $ $\mathcal { F } ^ { \prime } \mathcal { S }$ (i.e. $g \cdot { \bar { Q } } [ f ] = Q [ g \cdot { \bar { f } } ] )$ , the layer $f \mapsto \bar { \sigma } \circ Q [ f ]$ is equivariant. Hence we have the corollary:
180
+
181
+ Corollary 1. Assume $G$ is compact and acts on $s$ transitively. Then any equivariant feedforward neural network (FNN) can be approximated using multilayer $L$ -conv with point-wise nonlinearities.
182
+
183
+ Proof: A FNN is defined as $\sigma _ { p } \circ F _ { p } [ \cdot \cdot \cdot [ \sigma _ { 1 } \circ F _ { 1 } [ f ] ] ( \pmb { x } )$ where $F _ { k }$ are linear and $\sigma _ { k }$ are point-wise nonlinearities. By Theorem 1 of Kondor & Trivedi (2018), any linear layer in the equivariant FNN is a G-conv, which by Theorem 1 can be approximated by multilayer L-conv. Therefore, multilayer L-conv with nonlinearity can approximate any equivariant FNN. 
184
+
185
+ Finally, to our knowledge it is not known whether every equivariant function can be approximated by equivariant FNN for a Lie group $G$ . Hence, the corollary above is not a universal approximation theorem for equivariant scalar functions in terms of L-conv. However, it does show that multilayer $L$ -conv is equally expressive as other equivariant networks. Next, we discuss implementation details.
186
+
187
+ # 4 Discretized space and implementation: the tensor notation
188
+
189
+ In many datasets, such as images, $f ( { \pmb x } )$ is not given as continuous function, but rather as a discrete array, with ${ \cal S } = \{ { \pmb x } _ { 0 } , \ldots x _ { d - 1 } \}$ containing $d$ points. Each ${ \pmb x } _ { \mu }$ represents a coordinate in higher dimensional space, e.g. on a $1 0 \times 1 0$ image, $\scriptstyle { \mathbf { { \vec { x } } } } _ { 0 }$ is $( x , y ) = ( 0 , \dot { 0 } )$ point and ${ \pmb x } _ { 9 9 }$ is $( x , y ) = ( 9 , { \bar { 9 } } )$ .
190
+
191
+ Feature maps and group action In the tensor notation, we encode $\pmb { x } _ { \pmb { \mu } } \in \mathcal { S }$ as the canonical basis (one-hot) vectors in ${ \pmb x } _ { \pmb { \mu } } \in \mathbb { R } ^ { d }$ with $[ { \pmb x } _ { \mu } ] _ { \nu } = \delta _ { \mu \nu }$ (Kronecker delta), e.g. $\pmb { x } _ { 0 } = ( 1 , 0 , \dots , 0 )$ . The features become $\pmb { f } \in \mathcal { F } = \mathbb { R } ^ { d } \otimes \mathbb { R } ^ { m }$ , meaning $d \times m$ tensors, with $f ( \pmb { x } _ { \mu } ) = \pmb { x } _ { \mu } ^ { T } \pmb { f } = \pmb { f } _ { \mu }$ . Although $s$ is discrete, the group acting on $\mathcal { F }$ can be continuous (e.g. image rotations). Any $G \subseteq { \mathrm { G L } } _ { d } ( \mathbb { R } )$ of the general linear group (invertible $d \times d$ matrices) acts on $\pmb { x } _ { \pmb { \mu } } \in \mathbb { R } ^ { d }$ and $f \in { \mathcal { F } }$ . We define $f ( g \cdot { \pmb x } _ { \mu } ) = { \pmb x } _ { \mu } ^ { T } g ^ { T } { \pmb f } , \forall g \in G$ , so that for $w \in G$ we have
192
+
193
+ $$
194
+ w \cdot f ( \pmb { x } _ { \mu } ) = f ( \pmb { w } ^ { - 1 } \cdot \pmb { x } _ { \mu } ) = \pmb { x } _ { \mu } ^ { T } \pmb { w } ^ { - 1 T } \pmb { f } = [ \pmb { w } ^ { - 1 } \pmb { x } _ { \mu } ] ^ { T } \pmb { f }
195
+ $$
196
+
197
+ Dropping the position $\scriptstyle { \pmb { x } } _ { \mu }$ , the transformed features are matrix product $w \cdot f = w ^ { - 1 T } f$ . We can write $\mathbf { G }$ -conv in this notation (SI B). Similarly, we can rewrite $\mathrm { L }$ -conv equation 8 in the tensor notation. Defining $v _ { \epsilon } = I + \overline { { { \epsilon } } } ^ { i } L _ { i }$
198
+
199
+ $$
200
+ \begin{array} { r l } & { \qquad Q [ \pmb { f } ] ( g ) = W ^ { 0 } f \left( g \left( I + \overline { { \epsilon } } ^ { i } L _ { i } \right) \right) = \pmb { x } _ { 0 } ^ { T } \left( I + \overline { { \epsilon } } ^ { i } L _ { i } \right) ^ { T } g ^ { T } f W ^ { 0 T } } \\ & { \qquad = \left( \pmb { x } + \overline { { \epsilon } } ^ { i } [ g L _ { i } \pmb { x } _ { 0 } ] \right) ^ { T } \pmb { f } W ^ { 0 T } . } \end{array}
201
+ $$
202
+
203
+ Here, $\hat { L } _ { i } = g L _ { i } { \pmb x } _ { 0 }$ is exactly the matrix analogue of pushforward vector field $\hat { L } _ { i }$ in equation 9. The equivariance of L-conv in tensor notation is again evident from the $g ^ { T } f$ , resulting in
204
+
205
+ $$
206
+ Q [ w \cdot f ] ( g ) = \pmb { x } _ { 0 } ^ { T } \pmb { v } _ { \epsilon } ^ { T } g ^ { T } w ^ { - 1 T } \pmb { f } W ^ { 0 T } = Q [ \pmb { f } ] ( w ^ { - 1 } g ) = w \cdot Q [ \pmb { f } ] ( g )
207
+ $$
208
+
209
+ Tensor L-conv layer implementation The discrete space $\mathrm { L }$ -conv equation 15 can be rewritten using the global Lie algebra basis $\hat { L } _ { i }$
210
+
211
+ $$
212
+ Q [ f ] = \left( f + \hat { L } _ { i } f \bar { \epsilon } ^ { i } \right) W ^ { 0 T } , Q [ f ] _ { \mu } ^ { a } = f _ { \mu } ^ { b } [ W ^ { 0 T } ] _ { b } ^ { a } + [ \hat { L } _ { i } ] _ { \mu } ^ { \nu } f _ { \nu } ^ { c } \left[ W ^ { i } \right] _ { c } ^ { a }
213
+ $$
214
+
215
+ Where $W ^ { i } = W ^ { 0 } \overline { { { \epsilon } } } ^ { i }$ , $W ^ { 0 } \in \mathbb { R } ^ { m _ { i n } } \otimes \mathbb { R } ^ { m _ { o u t } }$ and $\overline { { \epsilon } } ^ { i } \in \mathbb { R } ^ { m _ { i n } } \otimes \mathbb { R } ^ { m _ { i n } }$ are trainable weights. The $\hat { L } _ { i }$ can be either inserted as inductive bias or they can be learned to discover symmetries.
216
+
217
+ To implement L-conv, note that the formula of equation 17 is quite similar to a Graph Convolutional Network (GCN) (Kipf & Welling, 2016). For each $i$ , the shared convolutional weights are $\overline { { \epsilon } } ^ { i } W ^ { 0 T }$ and the aggregation function of the GCN, a function of the graph adjacency matrix, is $\hat { L } _ { i }$ in L-conv. Thus, Lconv can be implemented as GCN modules for each $\hat { L } _ { i }$ , plus a residual connection for the $f W ^ { 0 T }$ term.
218
+
219
+ Figure 3 shows the schematic of the L-conv layer. In a naive implementation, $\hat { L } _ { i }$ can be general $d \times d$ matrices. However, being vector fields generated by the Lie algebra, $\hat { L } _ { i }$ has a more constrained structure which allows them to be encoded and learned using much fewer parameters than a $d \times d$ matrix. Specifically, encoding the topology of $s$ as a graph (see SI B.1), the incidence matrix replaces partial derivatives (Schaub et al., 2020) in equation 9 and the $L _ { i }$ become weighting of the edges. This weighting is similar to
220
+
221
+ ![](images/7da7ef66be0a2de4ec31dd46c4a64379db96e59b7bf42566f6da3a91ec8a4ec1.jpg)
222
+ Figure 3: L-conv layer architecture. $L _ { i }$ only act on the $d$ flattened spatial dimensions, and $W ^ { i }$ only act on the $m _ { i n }$ input features and returns $m _ { o u t }$ output features. For each $i$ , Lconv is analogous to a GCN with $d$ nodes and $m _ { i n }$ features.
223
+
224
+ Gauge Equivariant Mesh (GEM) CNN (Cohen et al., 2019a). Indeed, in L-conv the lift ${ \pmb x } _ { \mu } = g _ { \mu } { \pmb x } _ { 0 }$ fixes the gauge by mapping neighbors of $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ to neighbors of ${ \pmb x } _ { \mu }$ . Changing how the discrete $s$ samples an underlying continuous space will change $g _ { \mu }$ and hence the gauge.
225
+
226
+ Choosing the number of $L _ { i }$ . Beside the width of $W ^ { 0 }$ and $\bar { \epsilon } ^ { i }$ , the number $n _ { L }$ of $L _ { i }$ is a hyperparameter in L-conv. For instance, if $s$ is a discretization of $n$ dimensional space the symmetry group is likely $G \subset { \mathrm { G L } } _ { n } ( \mathbb { R } ) \ltimes T _ { n }$ , with $n _ { L } \sim O ( n ^ { 2 } )$ . Note that $n _ { L }$ is independent of the size $d$ of the discretized space (e.g. number of pixels) and generally ${ n ^ { 2 } \ll d }$ . Choosing $n _ { L }$ larger than the true number of $L _ { i }$ only results in an over-complete basis and shouldn’t be a problem. We conducted small controlled experiments to verify how multilayer L-conv approximates $\mathbf { G }$ -conv (SI C).
227
+
228
+ ![](images/c8c7405c79a9c40c28b49ba9a2f69384016cff3c9158d9a55a31f7886f000548.jpg)
229
+ Figure 4: Learning the infinitesimal generator of $S O ( 2 )$ Left shows the architecture for learning rotation angles between pairs of images (SI C.3). Next to it is the $L$ learned using recursive L-conv in this experiment. Middle $L$ is learned using a fixed small rotation angle $\theta = \pi / 1 \bar { 0 }$ , and right shows $L$ found using the numeric solution from the data.
230
+
231
+ Learning symmetries using L-conv. Rao & Ruderman (1999) introduced a basic version of Lconv and showed that it can learn 1D translation and 2D rotation. We conducted experiments to learn large rotation angle between two images (SI C), shown in Fig. 4. Left shows the architecture for learning the rotation angles between a pair of $7 \times 7$ random images $f$ and $R ( \theta ) f$ with $\theta \in [ 0 , \pi / 3 )$ . Second left is the learned $L \in S O ( { \bar { 2 } } )$ using 3 recursive layer L-conv. Middle is the $L$ learned using L-conv with fixed small rotation angle $\theta = \pi / 1 0$ (SI C.2) and right is the exact solution $R = \overline { { ( Y X ^ { T } ) ( X ^ { T } X ) ^ { - 1 } } }$ . While the middle $L$ is less noisy, it does not capture weights beyond first neighbors of each pixel. (also see SI C for a discussion on symmetry discovery literature.)
232
+
233
+ L-conv can potentially replace other equivariant layers in a neural network. We conducted limited experiments for this on small image datasets (SI D). L-conv allows one to look for potential symmetries in data which may have been scrambled or harbors hidden symmetries.
234
+
235
+ # 5 Relation to other architectures
236
+
237
+ CNN. This is a special case of expressing G-conv as $\mathrm { L }$ -conv when the group is continuous 1D translations. The arguments here generalize trivially to higher dimensions. Rao & Ruderman (1999, sec. 4) used the Shanperiodic 1D arrays as $f _ { \rho } ^ { \prime } = g ( z ) _ { \rho } ^ { \nu } f _ { \nu }$ Inter. He $\begin{array} { r } { g ( z ) _ { \rho } ^ { \nu } = \frac { 1 } { d } \sum _ { p = - d / 2 } ^ { d / 2 } \cos \left( \frac { 2 \pi p } { d } ( z + \rho - \nu ) \right) } \end{array}$ $z$ $g ( z )$ $G$ $g ( w ) g ( z ) = g ( w + z )$ with $g ( 0 ) _ { \rho } ^ { \nu } = \delta _ { \rho } ^ { \nu }$ . For any $z = \mu \in \mathbb { Z }$ , $g _ { \mu } = g ( z = \mu )$ are circulant matrices that shift by $\mu$ as $[ g _ { \mu } ] _ { \nu } ^ { \rho } = \delta _ { \nu - \mu } ^ { \dot { \rho } }$ . Thus, a 1D CNN with kernel size $k$ can be written suing $g _ { \mu }$ as
238
+
239
+ $$
240
+ F ( { \pmb f } ) _ { \nu } ^ { a } = \sigma \left( \sum _ { \mu = 0 } ^ { k } { \pmb f } _ { \nu - \mu } ^ { c } [ W ^ { \mu } ] _ { c } ^ { a } + b ^ { a } \right) = \sigma \left( \sum _ { \mu = 0 } ^ { k } [ g _ { \mu } { \pmb f } ] _ { \nu } ^ { c } [ W ^ { \mu } ] _ { c } ^ { a } + b ^ { a } \right)
241
+ $$
242
+
243
+ where $W , b$ are the filter weights and biases. $g _ { \mu }$ can be approximated using the Lie algebra and written as multi-layer $\mathrm { L }$ -conv as in sec. 3.1. Using $g ( 0 ) _ { \rho } ^ { - } \approx \delta ( \rho - \nu )$ , the single Lie algebra basis $[ \hat { L } ] _ { 0 } = \partial _ { z } g ( z ) | _ { z 0 }$ , acts as $\hat { L } f ( z ) \approx - \partial _ { z } f ( z )$ (because $\begin{array} { r } { \int \partial _ { z } \delta ( z - \nu ) f ( z ) = - \partial _ { \nu } f ( \nu ) ) } \end{array}$ . Its components are $\begin{array} { r } { \hat { L } _ { \rho } ^ { \nu } = L ( \rho - \nu ) = \sum _ { p } \frac { 2 \pi p } { d ^ { 2 } } \sin \left( \frac { 2 \pi p } { d } ( \rho - \nu ) \right) } \end{array}$ , which are also circulant due to the $( \rho - \nu )$ dependence. Hence, $\begin{array} { r } { [ \hat { L } \pmb { f } ] _ { \rho } = \sum _ { \nu } L ( \rho - \nu ) \pmb { f } _ { \nu } = [ L \star \pmb { f } ] _ { \nu } } \end{array}$ is a convolution. Rao & Ruderman (1999) already showed that this $\hat { L }$ can reproduce finite discrete shifts $g _ { \mu }$ used in CNN. They used a primitive version of L-conv with $g _ { \mu } = ( I + \epsilon \hat { L } ) ^ { N }$ . Thus, $\mathrm { L }$ -conv can approximate 1D CNN. This result generalizes easily to higher dimensions.
244
+
245
+ Graph Convolutional Network (GCN). Let $\pmb { A }$ be the adjacency matrix of a graph. In equation 17 if ${ \hat { L } } _ { i } = h ( A )$ , such as $\hat { L } _ { i } = D ^ { - 1 / 2 } A D ^ { - 1 / 2 }$ , we obtain a GCN (Kipf & Welling, 2016) $( D _ { \mu \nu } =$ $\delta _ { \mu \nu } \sum _ { \rho } A _ { \mu \rho }$ being the degree matrix). So in the special case where all neighbors of each node $< \mu >$ have the same edge weight, meaning $[ \hat { L } _ { i } ] _ { \mu } ^ { \nu } = [ \hat { L } _ { i } ] _ { \mu } ^ { \rho } , \forall \nu , \rho \in < \mu >$ , equation 8 is uniformly aggregating over neighbors and $\mathrm { L }$ -conv reduces to a GCN. Note that this similarity is not just superficial. In GCN $\mathbf { \nabla } \cdot h ( \mathbf { A } ) = { \hat { L } }$ is in fact a Lie algebra basis. When $\hat { L } = h ( A )$ , the vector field is the flow of isotropic diffusion $d f / d t = h ( A ) f$ from each node to its neighbors. This vector field defines one parameter Lie group with elements $\begin{array} { r } { \dot { g } ( t ) = \exp [ h ( A ) t ] } \end{array}$ . Hence, L-conv for flow groups with a single generator are GCN. These flow groups include Hamiltonian flows and other linear dynamical systems. The main difference between L-conv and GCN is that L-conv can assign a different weight to each neighbor of the same node, similar to GEM-CNN (Cohen et al., 2019a) with a fixed gauge set by $g _ { \mu }$ . Next, we discuss the mathematical properties of the loss functions for L-conv.
246
+
247
+ # 6 Group invariant loss
248
+
249
+ Loss functions of equivariant networks are rarely discussed. Yet, recent work by Kunin et al. (2020) showed the existence of symmetry directions in the loss landscape. To understand how the symmetry generators in L-conv manifest themselves in the loss landscape, we work out the explicit example of a mean square error (MSE) loss. Because $G$ is the symmetry group, $f$ and $g \cdot f$ should result in the same optimal parameters. Hence, the minima of the loss function need to be group invariant. One way to satisfy this is for the loss itself to be group invariant, which can be constructed by integrating over $G$ (global pooling (Bronstein et al., 2021)). A function $\begin{array} { r } { I = \int _ { G } d g F ( g ) } \end{array}$ is $G$ -invariant (SI A.3). We can also change the integration to $\textstyle \int _ { S } d ^ { n } x$ by change of variable $d g / d x$ (see SI A.3 for discussion on stabilizers).
250
+
251
+ MSE loss and Field Theory. The MSE is given by $\begin{array} { r } { I = \sum _ { n } \int _ { G } d g \| Q [ f _ { n } ] ( g ) \| ^ { 2 } } \end{array}$ , where $f _ { n }$ are data samples and $Q [ f ]$ is L-conv or another $G$ -equivariant function. In supervised learning the input is a pair $f _ { n } , y _ { n }$ . $G$ can also act on the labels $y _ { n }$ . We assme that $y _ { n }$ are either also scalar features $y _ { n } : S \mathbb { R } ^ { m _ { y } }$ with a group action $g \cdot y _ { n } ( x ) \stackrel { \cdot } { = } y _ { n } ( g ^ { - 1 } x )$ (e.g. $f _ { n }$ and $y _ { n }$ are both images), or that $y _ { n }$ are categorical. In the latter case $g \cdot y _ { n } = y _ { n }$ because the only representations of a continuous $G$ on a discrete set are constant. We can concatenate the inputs to $\bar { \phi _ { n } } \equiv [ f _ { n } | y _ { n } ]$ with a well-defined $G$ action $g \cdot \phi _ { n } = [ g \cdot f _ { n } | g \cdot y _ { n } ]$ . The collection of combined inputs $\Phi = ( \phi _ { 1 } , \ldots , \phi _ { N } ) ^ { T }$ is an $( m + m _ { y } ) \times N$ matrix. Using equations 8 and 9, the MSE loss with parameters $W = \{ W ^ { 0 } , { \overline { { \epsilon } } } \}$ becomes (SI A.3.1)
252
+
253
+ $$
254
+ \begin{array} { l } { { \displaystyle I [ \Phi ; W ] = \int _ { G } d g { \mathcal L } [ \Phi ; W ] = \int _ { G } d g \left\| W ^ { 0 } \left[ I + \overline { { { \epsilon } } } ^ { i } [ \hat { L } _ { i } ] ^ { \alpha } \partial _ { \alpha } \right] \Phi ( g ) \right\| ^ { 2 } } } \\ { { \displaystyle ~ = \int _ { S } \frac { d ^ { n } x } { \left| \frac { \partial x } { \partial g } \right| } \left[ \Phi ^ { T } { \bf m } _ { 2 } \Phi + \partial _ { \alpha } \Phi ^ { T } { \bf h } ^ { \alpha \beta } \partial _ { \beta } \Phi + [ \hat { L } _ { i } ] ^ { \alpha } \partial _ { \alpha } \left( \Phi ^ { T } { \bf v } ^ { i } \Phi \right) \right] } } \end{array}
255
+ $$
256
+
257
+ Equation 19 generalizes the free field theories in physics (Polyakov, 2018). Here $\left| { \frac { \partial x } { \partial g } } \right|$ is the determinant of the Jacobian, $W ^ { i } = W ^ { 0 } \overline { { { \epsilon } } } ^ { i }$ and
258
+
259
+ $$
260
+ \begin{array} { r } { { \bf m } _ { 2 } = W ^ { 0 T } W ^ { 0 } , \qquad { \bf h } ^ { \alpha \beta } ( { \bf x } ) = \bar { \epsilon } ^ { i T } { \bf m } _ { 2 } \bar { \epsilon } ^ { j } [ \hat { L } _ { i } ] ^ { \alpha } [ \hat { L } _ { j } ] ^ { \beta } , \qquad { \bf v } ^ { i } = { \bf m } _ { 2 } \bar { \epsilon } ^ { i } . } \end{array}
261
+ $$
262
+
263
+ Note that $\mathbf { h }$ has feature space indices via $[ \overline { { \epsilon } } ^ { i T } \mathbf { m } _ { 2 } \overline { { \epsilon } } ^ { j } ] _ { a b }$ , with index symmetry $\mathbf { h } _ { a b } ^ { \alpha \beta } = \mathbf { h } _ { b a } ^ { \beta \alpha }$ When (i.e. is a 1D scalar), becomes a a Riemannian metric for . In general h combines a 2-tensor $\mathbf { h } _ { a b } = \mathbf { h } _ { a b } ^ { \alpha \beta } \partial _ { \alpha } \partial _ { \beta } \in T S \otimes T S$ with an inner product $h ^ { T } \mathbf { h } ^ { \alpha \beta } f$ on the feature space $\mathcal { F }$ .
264
+
265
+ In field theory, the motivation is to preserve spatial symmetries for the metric $\mathbf { h }$ . In equation 19, h transforms equivariantly as a 2-tensor $v \cdot \mathbf { h } ^ { \alpha \beta ^ { \bullet } } = [ v ^ { - \bar { 1 } } ] _ { \rho } ^ { \alpha } [ v ^ { - 1 } ] _ { \gamma } ^ { \beta } \mathbf { h } ^ { \rho \gamma } ( \pmb { x } )$ for $v \in G$ (SI A.3). The last term in equation 19 vanishes for many groups (SI A.3) and it is also absent in physics.
266
+
267
+ Robustness and Euler-Lagrange Equation. Equivariant neural networks are more robust. To check this, we can quantify how the network would perform for an input $\phi ^ { \prime } = \phi + \delta \phi$ which adds a small random perturbation $\delta \phi$ to a data point $\phi$ . Robustness to such perturbation would mean that, for optimal parameters $W ^ { * }$ , the loss function would not change, i.e. $I [ \phi ^ { \prime } ; W ^ { * } ] = I [ \phi ; W ^ { * } ]$ , requiring $I$ to be minimized around real data points $\phi$ .
268
+
269
+ This can be cast as a variational equation $\delta I [ \phi ; W ^ { * } ] = 0$ , which yield the familiar Euler-Lagrange (EL) equation (SI A.4). Therefore, for an equivariant network to be robust, i.e. $\delta I [ \phi ; W ^ { * } ] / \bar { \delta { \phi } } = \mathbf { \bar { 0 } }$ we would require the data points $\phi$ to satisfy the EL equations for optimal parameters $W ^ { * }$ :
270
+
271
+ $$
272
+ { \mathrm { R o b u s t n e s s ~ t o ~ r a n d o m ~ n o i s e } } \longleftrightarrow \mathrm { E L : } \quad { \frac { \partial { \mathcal { L } } } { \partial \phi ^ { b } } } - \partial _ { \alpha } { \frac { \partial { \mathcal { L } } } { \partial ( \partial _ { \alpha } \phi ^ { b } ) } } = 0
273
+ $$
274
+
275
+ where the partial derivative terms appear because of the L-conv layer.
276
+
277
+ Equivariance and Conservation laws. Conserved currents, via Noether’s theorem provide a way to find hidden symmetries (see also Kunin et al. (2020)). The idea is that the equivariance condition equation 2 can be written for the integrand of the loss, $\mathcal { L } [ \phi , W ]$ . If we write the equivariance equation for infinitesimal $v _ { \epsilon }$ , we obtain a vector field which is divergence free. Since $G$ is the symmetry of the system, transforming an input $\phi w \cdot \phi$ by $w \in G$ the integrand should change equivariantly, meaning $\mathcal { L } [ w \cdot \phi ] = w \cdot \mathcal { L } [ \phi ]$ . When robustness error is minimized as in equation 21, an infinitesimal $w \approx I + \eta ^ { i } L _ { i }$ , with $\delta \phi = \epsilon ^ { i } \hat { L } _ { i } \phi$ , results in a conserved current (SI A.4)
278
+
279
+ $$
280
+ J ^ { \alpha } = \frac { \partial \mathcal { L } } { \partial ( \partial _ { \alpha } \phi ^ { b } ) } \delta \phi ^ { b } - \frac { \partial \mathcal { L } } { \partial x ^ { \alpha } } \delta x ^ { \alpha } , \qquad \delta I [ \phi ; W ^ { * } ] = 0 \quad \Rightarrow \partial _ { \alpha } J ^ { \alpha } = 0
281
+ $$
282
+
283
+ The above equation shows that for equivariant networks with a given symmetry, the deviation in data along the symmetry direction $( \hat { L } _ { i } )$ yields a divergence free current $J ^ { \alpha }$ , known as Noether current. It also provides an alternative means to discover symmetry generators $L _ { i }$ by minimizing $\| \partial _ { \alpha } J ^ { \alpha } \|$ . Note that this Noether current is the “stress-energy” tensor, associated with space (or space-time) variations $\delta \mathbfit { x }$ (Landau, 2013) (SI A.5). We can potentially design more general equivariant networks leading to other Noether currents.
284
+
285
+ # 7 Conclusion and Discussions
286
+
287
+ We propose the Lie algebra convolutional neural network (L-conv), an infinitesimal version of Gconv. L-conv layers do not require encoding irreps or discretizing the group, and can be combined to approximate any feedforward equivariant networks on compact groups. Additionally, L-conv’s universal and simple structure allows us to discover symmetries from data. It is easy to implement, with a formula similar to GCN. We validated that L-conv can learn the correct Lie algebra basis in a synthetic experiment.
288
+
289
+ We discover several intriguing connections between L-conv and physics. Our derivation shows that equivariant neural networks based on L-conv lead to Noether’s theorem and conservation laws. Conversely, we can also optimize Noether current to discover symmetries. Furthermore, the current equivariance formulation only pertains to “spatial symmetries” (i.e. $G$ acts on $s$ ). In physics, more general “internal symmetries” are quite common (e.g. particle physics). We can potentially design more general equivariant networks with L-conv encoding such symmetries.
290
+
291
+ Our method also shed lights on scientific machine learning, especially for physical sciences. Physicists generally use simple polynomial forms for the Lagrangian, or the loss function. These “perturbative” Lagrangian lead to divergences in quantum field theory. However, it is believed the true Lagrangian is more complicated. Hence, more expressive L-conv based models can potentially provide more advanced ansatze for solving scientific problems.
292
+
293
+ # Acknowledgments and Disclosure of Funding
294
+
295
+ R. Walters is supported by a Postdoctoral Fellowship from the Roux Institute and NSF grants #2107256 and #2134178. This work was supported in part by the U. S. Army Research Office under Grant W911NF-20-1-0334, DOE ASCR 2493 and NSF Grant #2134274. N. Dehmamy and D. Wang were supported by the Air Force Office of Scientific Research under award number FA9550-19-1-0354.
296
+
297
+ # References
298
+
299
+ Anselmi, F., Evangelopoulos, G., Rosasco, L., and Poggio, T. Symmetry-adapted representation learning. Pattern Recognition, 86:201–208, 2019.
300
+
301
+ Benton, G., Finzi, M., Izmailov, P., and Wilson, A. G. Learning invariances in neural networks. arXiv preprint arXiv:2010.11882, 2020.
302
+
303
+ Bogatskiy, A., Anderson, B., Offermann, J., Roussi, M., Miller, D., and Kondor, R. Lorentz group equivariant neural network for particle physics. In International Conference on Machine Learning, pp. 992–1002. PMLR, 2020.
304
+
305
+ Bronstein, M. M., Bruna, J., Cohen, T., and Velickovi ˇ c, P. Geometric deep learning: Grids, groups, ´ graphs, geodesics, and gauges. arXiv preprint arXiv:2104.13478, 2021.
306
+ Cohen, T. and Welling, M. Learning the irreducible representations of commutative lie groups. In International Conference on Machine Learning, pp. 1755–1763, 2014.
307
+ Cohen, T. and Welling, M. Group equivariant convolutional networks. In International conference on machine learning, pp. 2990–2999, 2016a.
308
+ Cohen, T., Weiler, M., Kicanaoglu, B., and Welling, M. Gauge equivariant convolutional networks and the icosahedral cnn. In International Conference on Machine Learning, pp. 1321–1330. PMLR, 2019a.
309
+ Cohen, T. S. and Welling, M. Steerable cnns. 2016b.
310
+ Cohen, T. S., Geiger, M., Köhler, J., and Welling, M. Spherical cnns. In International Conference on Learning Representations, 2018.
311
+ Cohen, T. S., Geiger, M., and Weiler, M. A general theory of equivariant cnns on homogeneous spaces. In Advances in Neural Information Processing Systems, pp. 9142–9153, 2019b.
312
+ Cybenko, G. Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303–314, 1989.
313
+ Finzi, M., Stanton, S., Izmailov, P., and Wilson, A. G. Generalizing convolutional neural networks for equivariance to lie groups on arbitrary continuous data. arXiv preprint arXiv:2002.12880, 2020.
314
+ Finzi, M., Welling, M., and Wilson, A. G. A practical method for constructing equivariant multilayer perceptrons for arbitrary matrix groups. arXiv preprint arXiv:2104.09459, 2021.
315
+ Gens, R. and Domingos, P. M. Deep symmetry networks. Advances in neural information processing systems, 27:2537–2545, 2014.
316
+ Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., and Dahl, G. E. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pp. 1263–1272. PMLR, 2017.
317
+ Hall, B. Lie groups, Lie algebras, and representations: an elementary introduction, volume 222. Springer, 2015.
318
+ Hartford, J., Graham, D., Leyton-Brown, K., and Ravanbakhsh, S. Deep models of interactions across sets. In International Conference on Machine Learning, pp. 1909–1918. PMLR, 2018.
319
+ Hornik, K., Stinchcombe, M., and White, H. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
320
+ Kipf, T. N. and Welling, M. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
321
+ Kondor, R. and Trivedi, S. On the generalization of equivariance and convolution in neural networks to the action of compact groups. arXiv preprint arXiv:1802.03690, 2018.
322
+ Kondor, R., Lin, Z., and Trivedi, S. Clebsch–gordan nets: a fully fourier space spherical convolutional neural network. In Advances in Neural Information Processing Systems, pp. 10117–10126, 2018.
323
+ Kunin, D., Sagastuy-Brena, J., Ganguli, S., Yamins, D. L., and Tanaka, H. Neural mechanics: Symmetry and broken conservation laws in deep learning dynamics. arXiv preprint arXiv:2012.04728, 2020.
324
+ Landau, L. D. The classical theory of fields, volume 2. Elsevier, 2013.
325
+ LeCun, Y., Boser, B., Denker, J. S., Henderson, D., Howard, R. E., Hubbard, W., and Jackel, L. D. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989.
326
+
327
+ LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
328
+
329
+ Lee, J. M., Chow, B., Chu, S.-C., Glickenstein, D., Guenther, C., Isenberg, J., Ivey, T., Knopf, D., Lu, P., Luo, F., et al. Manifolds and differential geometry. Topology, 643:658, 2009.
330
+
331
+ Pfau, D., Higgins, I., Botev, A., and Racanière, S. Disentangling by subspace diffusion. arXiv preprint arXiv:2006.12982, 2020.
332
+
333
+ Polyakov, A. M. Gauge fields and strings. Routledge, 2018.
334
+
335
+ Rao, R. P. and Ruderman, D. L. Learning lie groups for invariant visual perception. In Advances in neural information processing systems, pp. 810–816, 1999.
336
+
337
+ Ravanbakhsh, S. Universal equivariant multilayer perceptrons. arXiv preprint arXiv:2002.02912, 2020.
338
+
339
+ Ravanbakhsh, S., Schneider, J., and Poczos, B. Equivariance through parameter-sharing. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2892–2901. JMLR. org, 2017.
340
+
341
+ Schaub, M. T., Benson, A. R., Horn, P., Lippner, G., and Jadbabaie, A. Random walks on simplicial complexes and the normalized hodge 1-laplacian. SIAM Review, 62(2):353–391, 2020.
342
+
343
+ Sohl-Dickstein, J., Wang, C. M., and Olshausen, B. A. An unsupervised algorithm for learning lie group transformations. arXiv preprint arXiv:1001.1027, 2010.
344
+
345
+ Wang, R., Walters, R., and Yu, R. Incorporating symmetry into deep dynamics models for improved generalization. In International Conference on Learning Representations, 2020.
346
+
347
+ Weiler, M. and Cesa, G. General e (2)-equivariant steerable cnns. In Advances in Neural Information Processing Systems, pp. 14334–14345, 2019.
348
+
349
+ Weiler, M., Geiger, M., Welling, M., Boomsma, W., and Cohen, T. S. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. In Advances in Neural Information Processing Systems, pp. 10381–10392, 2018a.
350
+
351
+ Weiler, M., Hamprecht, F. A., and Storath, M. Learning steerable filters for rotation equivariant cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 849–858, 2018b.
352
+
353
+ Weinberg, S. The quantum theory of fields, volume 3. Cambridge university press, 1995.
354
+
355
+ Whitaker, E. On the functions which are represented by the expansion of interpolating theory. In Proc. Roy. Soc. Edinburgh, volume 35, pp. 181–194, 1915.
356
+
357
+ Worrall, D. E., Garbin, S. J., Turmukhambetov, D., and Brostow, G. J. Harmonic networks: Deep translation and rotation equivariance. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5028–5037, 2017.
358
+
359
+ Zaheer, M., Kottur, S., Ravanbakhsh, S., Poczos, B., Salakhutdinov, R. R., and Smola, A. J. Deep sets. In Advances in neural information processing systems, pp. 3391–3401, 2017.
360
+
361
+ Zhou, A., Knowles, T., and Finn, C. Meta-learning symmetries by reparameterization. arXiv preprint arXiv:2007.02933, 2020.
362
+
363
+ # Checklist
364
+
365
+ The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
366
+
367
+ • Did you include the license to the code and datasets? [Yes] See Section
368
+ • Did you include the license to the code and datasets? [No] The code and the data are proprietary.
369
+ • Did you include the license to the code and datasets? [N/A]
370
+
371
+ Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
372
+
373
+ 1. For all authors...
374
+
375
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
376
+ (b) Did you describe the limitations of your work? [No]
377
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A]
378
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
379
+
380
+ 2. If you are including theoretical results...
381
+
382
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
383
+
384
+ 3. If you ran experiments...
385
+
386
+ (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]
387
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
388
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
389
+ (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]
390
+
391
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
392
+
393
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
394
+ (b) Did you mention the license of the assets? [N/A]
395
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
396
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
397
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
398
+
399
+ 5. If you used crowdsourcing or conducted research with human subjects...
400
+
401
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
402
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
403
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/OkFPq7ZtsQ/OkFPq7ZtsQ.md ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Prototypical Cross-Attention Networks for Multiple Object Tracking and Segmentation
2
+
3
+ Lei $\mathbf { K e } ^ { 1 , 2 }$ Xia Li1 Martin Danelljan1 Yu-Wing Tai3 Chi-Keung Tang2 Fisher ${ \bf { Y } } { \bf { u } } ^ { 1 }$ 1ETH Zürich 2HKUST 3Kuaishou Technology {lkeab,cktang}@cse.ust.hk, {xia.li,martin.danelljan}@vision.ee.ethz.ch yuwing@gmail.com, i@yf.io
4
+
5
+ # Abstract
6
+
7
+ Multiple object tracking and segmentation requires detecting, tracking, and segmenting objects belonging to a set of given classes. Most approaches only exploit the temporal dimension to address the association problem, while relying on single frame predictions for the segmentation mask itself. We propose Prototypical Cross-Attention Network (PCAN), capable of leveraging rich spatio-temporal information for online multiple object tracking and segmentation. PCAN first distills a space-time memory into a set of prototypes and then employs cross-attention to retrieve rich information from the past frames. To segment each object, PCAN adopts a prototypical appearance module to learn a set of contrastive foreground and background prototypes, which are then propagated over time. Extensive experiments demonstrate that PCAN outperforms current video instance tracking and segmentation competition winners on both Youtube-VIS and BDD100K datasets, and shows efficacy to both one-stage and two-stage segmentation frameworks. Code and video resources are available at http://vis.xyz/pub/pcan.
8
+
9
+ # 1 Introduction
10
+
11
+ Multiple object tracking and segmentation (MOTS), also known as Video Instance Segmentation (VIS), is an important problem with many real-world applications, including autonomous driving [10, 26] and video analysis [4, 46]. The task involves tracking and segmenting all objects within a video from a given set of semantic classes. We are witnessing rapidly growing research interest on MOTS thanks to the introduction of large scale benchmarks [46, 50, 37]. State-of-the-art methods [46, 5, 37, 29] for MOTS mainly follow the tracking-by-detection paradigm, where objects are first detected and segmented in individual frames and then associated over time.
12
+
13
+ Although methods based on the popular tracking-by-detection philosophy have shown promising results, temporal modeling is limited to the object association phase [46, 5, 22] and only between two adjacent frames [37, 18]. On the other hand, the temporal dimension carries rich information about the scene. The information encoded in multiple temporal views of an object has the potential of improving the quality of predicted segmentation, localization, and categories. However, effectively and efficiently leveraging the rich temporal information remains a challenge. While sequential modeling has been applied for video processing [40, 41, 9, 28, 12], these methods generally operate directly on the high-resolution deep features, requiring large computational and memory consumption, which greatly limits their use.
14
+
15
+ We propose a Prototypical Cross-Attention Module, termed PCAM, to leverage temporal information for multiple object tracking and segmentation. As illustrated in Figure 1, the module first distills spatiotemporal information into condensed prototypes using clustering based on Expectation Maximization. The resulting prototypes, composed of Gaussian Components, yield a rich and generalizable yet compact representation of the past visual features. Given a deep feature embedding of the current frame, PCAM then employs prototypical cross-attention to read relevant information from prior frames.
16
+
17
+ ![](images/f9dada9f50f662cbde9d5b8cc24676fef8cba7e325d838b30e8e3626365616f6.jpg)
18
+ Figure 1: We propose Prototypical Cross-Attention Network for MOTS, which first condenses the space-time memory and high-resolution frame embeddings into frame-level and instance-level prototypes. These are then employed to retrieve rich temporal information from past frames by our efficient prototypical cross-attention operation.
19
+
20
+ Based on the noise-reduced clustered video features information, we further develop a Prototypical Cross-Attention Network (PCAN) for MOTS, that integrates the general PCAM at two stages in the network: on the frame-level and instance-level. The former reconstructs and aligns temporal past frame features with current frame, while the instance level integrates specific information about each object in the video. For robustness to object appearance change, PCAN represents each object instance by learning sets of contrastive foreground and background prototypes, which are propagated in an online manner. With a limited number of prototypes for each instance or frame, PCAN efficiently performs long-range feature aggregation and propagation in a video with linear complexity. Consequently, our PCAN outperforms standard non-local attention [40] and video transformer [41] on both the large-scale Youtube-VIS and BDD100K MOTS benchmarks.
21
+
22
+ Our main contributions are summarized as follows: (i) We introduce the PCAN module for efficiently utilizing long-term spatio-temporal video information. (ii) We develop a MOTS approach that employs PCAN on frame and instance-level. (iii) We further represent the appearance of each video tracklet with contrastive foreground and background prototypes, which are propagated over time. (iv) We extensively analyze our approach. Our PCAN outperforms previous approaches on the challenging self-driving dataset BDD100K [50] and the semantically diverse YouTube-VIS dataset [46].
23
+
24
+ # 2 Related work
25
+
26
+ Video instance segmentation (VIS) Existing VIS methods [46, 2, 21] widely adapt the twostage paradigm of Mask R-CNN [11] and its variants [13, 15] by adding an additional tracking branch. Thus, their typical pipelines first detect regions of interest (RoIs) and then use the instance features after RoIAlign to regress object mask and associate cross-frame instances. More recent works [5, 18, 22, 48] employ a one-stage instance segmentation method, e.g. the anchor-free FCOS detector [34], which predicts a linear combination of mask bases [3] as its final segmentation. The aforementioned approaches make very limited use of temporal information to enhance the quality of the segmentation, instead relying on single image-based mask prediction, or only model short-term temporal correlation between two consecutive frames [18, 30]. In the context of long-term temporal association, the offline method VisTr [41] adapts vision transformer [6] for VIS, but suffers from a huge computational burden and memory consumption due to the dense pixel-level attention operations over long sequences. Compared to these methods, our PCAN temporally aggregates and propagates the prototypical features with both the long-term benefit and linear complexity.
27
+
28
+ Multiple Object Tracking and Segmentation (MOTS) Similar to VIS, MOTS methods [37, 27, 29] mainly follow the tracking-by-detection paradigm. Objects are first detected and segmented, followed by association between frames. Track R-CNN [37] integrates temporal context feature from two neighboring frames using 3D convolutions. TrackFormer [25] performs joint object detection and tracking by recurrently using Transformers, while Stem-Seg [1] adopts a short 3D convolutional spatio-temporal volume to learn pixel embedding by treating segmentation as a bottom-up grouping. In contrast, our approach clusters appearance features in a long spatio-temporal volume with explicit foreground and background prototypes that are updates online. Besides, the mixture Gaussian components in instance appearance module equips PCAN a stronger modeling ability compared to instance-level average pooling [33, 49] or single Gaussian model [51, 14].
29
+
30
+ Temporal attention models Video understanding usually requires long-range sequential modeling of relations between spatio-temporal locations. Recently, attention-based approaches, such as non-local attention [40, 39, 28, 12] and transformers [8, 35, 16], have been successfully adopted in video classification and action recognition. These tasks [23, 32, 43] involve dense pixel-level attention, leading to quadratic complexity in the sequence length, thus making them excessively expensive for long sequences. Improved temporal attention models mainly include double attention mechanism [7] on image recognition with global-local decomposition, and clustered attention Transformer [38] for language sequence modeling. Besides, recent prototypical methods [19, 45] use the EM algorithm for single-image semantic segmentation or few-shot learning [33]. Unlike these methods, our PCAN uses compact prototypical representation both for temporal feature aggregation and compact instance appearance feature propagation.
31
+
32
+ # 3 Method
33
+
34
+ We propose an approach for Multiple Object Tracking and Segmentation. Given a video sequence, the goal is to detect, track, and segment objects from a predefined set of object categories. Specifically, we consider the online setting, where the predictions only depend on current and past frames.
35
+
36
+ # 3.1 Traditional Cross-Attention
37
+
38
+ To utilize the rich temporal information to improve the segmentation prediction, recent approaches [28, 12] have employed cross-attention. We consider past spatio-temporal information encoded in a memory M, consisting of deep features of size $H \times W \times T \times C$ . The memory encapsulates valuable information about the past appearances and predictions of objects and background in a scene. To attend to the memory, the information is first separately embedded into key $\mathbf { k } ^ { M }$ and value $\mathbf { v } ^ { M }$ feature vectors. The keys are used to address relevant memories whose corresponding values are returned. The standard memory reading process is a non-local operation computed as the weighted sum,
39
+
40
+ $$
41
+ y _ { i } = \frac { 1 } { Z _ { i } } \sum _ { j = 1 } ^ { H \times W \times T } \exp ( \mathbf { k } _ { i } ^ { Q } \cdot \mathbf { k } _ { j } ^ { M } ) \mathbf { v } _ { j } ^ { M } ,
42
+ $$
43
+
44
+ where $\mathbf { k } ^ { Q }$ denotes query key map, which is predicted from the current frame. Further, $i$ and $j$ are the index of each query and the memory location, and $\begin{array} { r } { Z _ { i } = \sum _ { j } \exp ( \mathbf { k } _ { i } ^ { Q } \cdot \mathbf { k } _ { j } ^ { M } ) } \end{array}$ is the normalizing factor.
45
+
46
+ Although proven effective, the standard attention operation (1) is known to suffer from poor computational and memory scaling properties [20]. In particular, since all queries are matched to all keys, it experiences a quadratic scaling $\mathcal { O } ( ( H W ) ^ { 2 } )$ of computations in the spatial size $H W$ of the feature map. This is particularly problematic for segmentation tasks, where fine-grained high-resolution information is desired to improve the quality of the predictions.
47
+
48
+ # 3.2 Prototypical Cross-Attention
49
+
50
+ To address the aforementioned limitations of the standard cross-attention, we introduce the prototypical cross-attention to first condense sets of high-resolution feature vectors in the past frames. Our approach is based on a clustered memory $\mathbf { M } _ { c }$ . We call these clusters prototypes, since they correspond to representative items in the memory. While clustering effectively reduces the number of items in the memory, it also serves to deprecate noisy information, leading to a more generalizable and robust representation of the memory.
51
+
52
+ To employ an attention mechanism, similar to (1), we require a clustering of the memory that generates a principled continuous and differentiable clustering assignment function. We therefore cluster the keys in the memory by fitting a Gaussian Mixture Model (GMM),
53
+
54
+ ![](images/b16e350d7758f3867593885cc547299195adefa0c2ec495c97b222a2328de4e2.jpg)
55
+ Figure 2: Overview of our frame-level prototypical cross-attention. For a frame $\hat { t }$ in the memory we first perform GMM-based clustering to achieve the key $\mathbf { k } _ { \hat { t } j } ^ { \mu }$ and value $\mathbf { v } _ { \hat { t } j } ^ { \mu }$ prototypes. Given the key encoding $\mathbf { k } _ { t }$ of the current frame, we attend to the prototypes to generate the reconstructed feature $\mathbf { y } _ { \hat { t } }$ , which are then aggregated temporally and fused with the current value encoding $\mathbf { v } _ { t }$ .
56
+
57
+ $$
58
+ p ( \mathbf { k } ) = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } p ( \mathbf { k } | z = j ) , \qquad p ( \mathbf { k } | z = j ) = \frac { 1 } { ( 2 \pi \sigma ^ { 2 } ) ^ { \frac { D } { 2 } } } \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \| \mathbf { k } - \mathbf { k } _ { j } ^ { \mu } \| ^ { 2 } \right)
59
+ $$
60
+
61
+ Here, $N$ denotes the number of Gaussian mixtures, $D$ is the feature dimension of the keys. We use a constant variance parameter $\sigma ^ { 2 }$ and uniform cluster priors $\begin{array} { r } { p ( z = j ) = \frac { 1 } { N } } \end{array}$ , where $z$ denotes the latent cluster assignment variable. The component means $\mathbf { k } ^ { \mu }$ represent the prototype keys in the memory. We generate the clustering (2) using the standard Expectation-Maximization algorithm.
62
+
63
+ The GMM allows us to compute a soft cluster assignment by evaluating the posterior probability of the latent assignment variable $z$ . Using Bayes rule, the probability of a key value $\mathbf { k }$ to be assigned to the $j$ th prototype is derived as,
64
+
65
+ $$
66
+ p ( z = j | \mathbf { k } ) = \frac { p ( \mathbf { k } | z = j ) p ( z = j ) } { \sum _ { l = 1 } ^ { N } p ( \mathbf { k } | z = l ) p ( z = l ) } = \frac { \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \| \mathbf { k } - \mathbf { k } _ { j } ^ { \mu } \| ^ { 2 } \right) } { \sum _ { l = 1 } ^ { N } \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \| \mathbf { k } - \mathbf { k } _ { l } ^ { \mu } \| ^ { 2 } \right) } .
67
+ $$
68
+
69
+ The resulting cluster assignment can thus be written as a SoftMax operation, where the corresponding logits are provided by the negative cluster distance $\| \mathbf { k } - \mathbf { k } _ { j } ^ { \mu } \| ^ { 2 }$ scaled with a temperature of $2 \sigma ^ { 2 }$ .
70
+
71
+ Since the clustering is performed in the key space of the memory, we next retrieve the corresponding value prototypes. To this end, we employ the key cluster assignment probabilities in (3) to compute the values for each memory prototype,
72
+
73
+ $$
74
+ \mathbf { v } _ { j } ^ { \mu } = \sum _ { l = 1 } ^ { H \times W } p ( z = j | \mathbf { k } _ { l } ^ { M } ) \mathbf { v } _ { l } ^ { M } .
75
+ $$
76
+
77
+ For attending to our clustered memory, we first predict the key encodings We then read from the clustered memory by computing the average over t $\mathbf { k } _ { i } ^ { Q }$ of the query imvalue prototypes $\mathbf { v } _ { j } ^ { \mu }$ weighted with the cluster assignment probabilities,
78
+
79
+ $$
80
+ \mathbf { y } _ { i } = \sum _ { j = 1 } ^ { N } p ( z = j | \mathbf { k } _ { i } ^ { Q } ) \mathbf { v } _ { j } ^ { \mu } = \frac { 1 } { Z _ { i } } \sum _ { j = 1 } ^ { N } \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \| \mathbf { k } _ { i } ^ { Q } - \mathbf { k } _ { j } ^ { \mu } \| ^ { 2 } \right) \mathbf { v } _ { j } ^ { \mu } .
81
+ $$
82
+
83
+ The final attention operation has much similarity with the original dot-product cross attention (1). Note that the key-query similarity in our approach is measured by Euclidian distance instead of a dot-product. Importantly, our formulation (5) attends to a reduced set of $N$ prototypes, while the original attention (1) requires attending to the full spatio-temporal memory of size $H \times W \times T$ .
84
+
85
+ # 3.3 Prototypical Cross-Attention Network
86
+
87
+ Here, we propose the Prototypical Cross-Attention Network (PCAN) for MOTS by integrating our prototypical cross-attention module into both the frame-level and instance-level. The former aims to align and aggregate temporal frame features stored in memory, while the latter is for propagating the instance appearance features over time and produce instance cross-attention maps to help segmentation. Besides, we also design a prototypical instance appearance module to represent each video tracklet with contrastive mixture foreground and background prototypes.
88
+
89
+ # 3.3.1 Frame-level Prototypical Cross-Attention
90
+
91
+ In Figure 2, prototypical cross-attention first produces prototypes by fitting a Gaussian mixtures model (2) to the feature in the memory. To provide further flexibility when dynamically updating the memory compute the $\mathbf { M }$ , we first perforkey prototypes wise clustering for each reference frame feature at , and retrieve the corresponding value embeddings $\hat { t }$ $N$ $\{ \mathbf { k } _ { \hat { t } i } ^ { \mu } \} _ { j = 1 } ^ { N }$ $\{ \mathbf { v } _ { \hat { t } j } ^ { \mu } \} _ { j = 1 } ^ { N }$ using (4) for each memory frame $\hat { t }$ independently. The key and value features are predicted using two parallel convolutional layers.
92
+
93
+ Frame-wise prototypical memory attention Given the query key encoding $\mathbf { k } _ { t i } ^ { Q }$ of the current frame $t$ , we perform prototypical cross-attention to each memory frame $\hat { t }$ independently using our formulation (3) as,
94
+
95
+ $$
96
+ { \bf y } _ { \hat { t } i } = \frac { 1 } { Z _ { \hat { t } \hat { t } } } \sum _ { j = 1 } ^ { N } \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \| { \bf k } _ { t i } - { \bf k } _ { \hat { t } j } ^ { \mu } \| ^ { 2 } \right) { \bf v } _ { \hat { t } j } ^ { \mu } , \qquad Z _ { \hat { t } i } = \sum _ { l = 1 } ^ { N } \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \| { \bf k } _ { t i } ^ { Q } - { \bf k } _ { \hat { t } \hat { t } } ^ { \mu } \| ^ { 2 } \right) .
97
+ $$
98
+
99
+ Note that the index $i$ refers to a spatial coordinate in the current frame. The resulting feature map $\mathbf { y } _ { \hat { t } }$ can intuitively be seen as a projection of features from frame $\hat { t }$ to the current frame. This projection essentially aligns the condensed feature information in frame $\hat { t }$ with the current frame.
100
+
101
+ Temporal feature aggregation Since frame-wise attention does not fuse temporal information, we perform a temporal aggregation. The temporal information $\mathbf { y } _ { \hat { t } }$ in (6) from different frames $\hat { t }$ are fused as a linear combination, weighted by the feature similarity with the current frame. Specifically, the temporally aggregated representation is obtained as
102
+
103
+ $$
104
+ \bar { \mathbf { y } } _ { t i } = \sum _ { \hat { t } = 1 } ^ { t } w _ { \hat { t } i } \mathbf { y } _ { \hat { t } i } , \qquad w _ { \hat { t } i } = \frac { \exp ( \mathbf { y } _ { t i } \cdot \mathbf { y } _ { \hat { t } i } ) } { \sum _ { s = 1 } ^ { t } \exp ( \mathbf { y } _ { t i } \cdot \mathbf { y } _ { s i } ) } .
105
+ $$
106
+
107
+ Note that ${ \hat { t } } = t$ in the sum refers to the value embedding $\mathbf { y } _ { t i } = \mathbf { v } _ { t i } ^ { Q }$ extracted from the current frame. The contribution of each frame $\hat { t }$ is thus weighted by the similarity to this current frame prediction using the attention weights $w _ { \hat { t } i }$ . This strategy ensures that incorrect or dissimilar regions are suppressed when computing the final aggregated feature embedding $\bar { \mathbf { y } } _ { t }$ . To handle object with large-scale variation and produce more fine-grained instance mask prediction, we further extend temporal aggregation to multi-level using different levels of the extracted FPN features, as detailed in the supplementary material.
108
+
109
+ # 3.3.2 Instance-level Prototypical Cross-Attention
110
+
111
+ Contrastive foreground and background representation In additional to the condensed frame-level representation, for more accurate segmentation results, we further encode each tracked object with compact and robust appearance prototypes. To further empower our proposed attention mechanism, we utilize the initially detected object mask to identify each foreground instance. We then separately model the extracted foreground and background features using a GMM (2). We denote the resulting foreground prototypes as $\mathbf { k } _ { t j . } ^ { + }$ and background prototypes as $\mathbf { k } _ { t j } ^ { - }$ . The former thus focuses on the appearance of the specific object, creating a rich and dynamic appearance model. When employed in our prototypical cross-attention framework (Section 3.2), it provides fine-grained attention from localized prototypes that naturally learn to focus specific parts of views of the object, as visualized in Fig. 3. Furthermore, the background prototypes $\mathbf { k } _ { t j } ^ { - }$ capture valuable information about the background appearance, which can greatly alleviate the segmentation process. For each object instance we attend to the foreground and background prototypes separately using (3). The results are concatenated together with the initial mask detection to the Temporal Segmentation Head (TSM) for final prediction, as illustrated in Figure 3.
112
+
113
+ ![](images/0d0831e8e286b63817527cb523139e218cd86186d20191f7a86218e7cec18a22.jpg)
114
+ Figure 3: Our instance-level prototypical attention with foreground and background prototypes and temporal propagation. The foreground/background attention maps from (bottom) demonstrate the localized and discriminative appearance representation. Temporal Segmentation Module (TSM) takes the current frame, initial mask, and instance attention maps as input and generates the final mask.
115
+
116
+ Tracklet feature propagation and updating To effectively model the object appearance change and preserve the most relevant information, we design a recurrent instance appearance updating scheme. From the first video frame where object appears, the accumulated prototypes $\bar { \mathbf { k } } _ { t j } ^ { + }$ , $\bar { \mathbf { k } } _ { t j } ^ { - }$ for the instance are propagated to the subsequent frames and updated with new appearance prototypes $\mathbf { k } _ { t j } ^ { + }$ , $\mathbf { k } _ { t j } ^ { - }$ using an update rate $\lambda$ as,
117
+
118
+ $$
119
+ \bar { \mathbf { k } } _ { t j } ^ { + } = ( 1 - \lambda ) \bar { \mathbf { k } } _ { t - 1 , j } ^ { + } + \lambda \mathbf { k } _ { t j } ^ { + } , \qquad \bar { \mathbf { k } } _ { t j } ^ { - } = ( 1 - \lambda ) \bar { \mathbf { k } } _ { t - 1 , j } ^ { - } + \lambda \mathbf { k } _ { t j } ^ { - } .
120
+ $$
121
+
122
+ Figure 3 also reveals the consistency of the attended region of a specific prototype $j$
123
+
124
+ # 4 Experiments
125
+
126
+ Here, we present comprehensive evaluation and analysis of our approach. Experiments are performed on two large scale datasets, namely YouTube-VIS [46] and BDD100K [50].
127
+
128
+ # 4.1 Experiment setup
129
+
130
+ Youtube-VIS YouTube-VIS-2019 [46] dataset contains 2,883 high quality videos with 131k annotated object instances belonging to 40 diverse categories. The task is to simultaneously classifying, segment and track object instances belonging to these categories. The evaluation metrics for this task are an adaptation of the Average Precision (AP) and Average Recall (AR) of image instance segmentation.
131
+
132
+ BDD100K We also evaluate on the large-scale tracking and segmentation dataset of BDD100K [50], which is a challenging self-driving dataset with 154 videos (30,817 images) for training, 32 videos (6,475 images) for validation, and 37 videos (7,484 images) for testing. The dataset provides 8 annotated categories for evaluation, where the images in the tracking set are annotated per 5 FPS with 30 FPS frame rate. We adopt the well-established MOTS metrics [37] to our task.
133
+
134
+ Implementation details We implement PCAN based on two different existing MOTS approaches. For Youtube-VIS, we adopt ResNet with FPN pre-trained on COCO as the backbone, and build our segmentation tracker on the one-stage segmentation model [5]. Both the instance and frame cross-attention is built on the extracted FPN features. Our model is trained with initial learning rate 0.0025 on 4 GPUs using SGD, and executes with a speed of 15.0 FPS on ResNet-50. Similar to [46, 22, 18], we use the input size $3 6 0 \times 6 4 0$ for training. On BDD100K, we build PCAN by extending the two-stage MOT method [29] with our temporal segmentation modules. We follow the same training strategy of QDTrack-mots [29]. More details can be found in supplemental material.
135
+
136
+ Table 1: Comparison with state-of-the-art on the YouTube-VIS validation set. Results are reported in terms of mask accuracy (AP) and recall (AR). Asterisks ∗ denote concurrent works on arXiv.
137
+
138
+ <table><tr><td>Method</td><td>Backbone</td><td>Type</td><td>Online</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>VisTr*[41]</td><td>ResNet-50</td><td>Transformer</td><td>×</td><td>35.6</td><td>56.8</td><td>37.0</td><td>35.2</td><td>40.2</td></tr><tr><td>OSMN [47]</td><td>ResNet-50</td><td>Two-stage</td><td>√</td><td>23.4</td><td>36.5</td><td>25.7</td><td>28.9</td><td>31.1</td></tr><tr><td>FEELVOS [36]</td><td>ResNet-50</td><td>Two-stage</td><td>√</td><td>26.9</td><td>42.0</td><td>29.7</td><td>29.9</td><td>33.4</td></tr><tr><td>DeepSORT[42]</td><td>ResNet-50</td><td>Two-stage</td><td>√</td><td>26.1</td><td>42.9</td><td>26.1</td><td>27.8</td><td>31.3</td></tr><tr><td>MaskTrack R-CNN [46]</td><td>ResNet-50</td><td>Two-stage</td><td>√</td><td>30.3</td><td>51.1</td><td>32.6</td><td>31.0</td><td>35.5</td></tr><tr><td>STEm-Seg[1]</td><td>ResNet-50</td><td> One-stage</td><td></td><td>30.6</td><td>50.7</td><td>33.5</td><td>31.6</td><td>37.1</td></tr><tr><td>SipMask [5]</td><td>ResNet-50</td><td>One-stage</td><td></td><td>32.5</td><td>53.0</td><td>33.3</td><td>33.5</td><td>38.9</td></tr><tr><td>STMask*[18]</td><td>ResNet-50</td><td>One-stage</td><td>x&lt;&gt;</td><td>33.5</td><td>52.1</td><td>36.9</td><td>31.1</td><td>39.2</td></tr><tr><td>SG-Net* [22]</td><td>ResNet-50</td><td>One-stage</td><td>√</td><td>34.8</td><td>56.1</td><td>36.8</td><td>35.8</td><td>40.8</td></tr><tr><td>PCAN (Ours)</td><td>ResNet-50</td><td>One-stage</td><td>√</td><td>36.1</td><td>54.9</td><td>39.4</td><td>36.3</td><td>41.6</td></tr><tr><td>STMask*[18]</td><td>ResNet-101</td><td>One-stage</td><td>√</td><td>36.3</td><td>55.2</td><td>39.9</td><td>33.7</td><td>42.0</td></tr><tr><td>SG-Net* [22]</td><td>ResNet-101</td><td>One-stage</td><td>√</td><td>36.3</td><td>57.1</td><td>39.6</td><td>35.9</td><td>43.0</td></tr><tr><td>PCAN (Ours)</td><td>ResNet-101</td><td>One-stage</td><td>√</td><td>37.6</td><td>57.2</td><td>41.3</td><td>37.2</td><td>43.9</td></tr></table>
139
+
140
+ Table 2: State-of-the-art comparison on the BDD100K segmentation tracking validation set. I: ImageNet. C: COCO. S: Cityscapes. B: BDD100K. "-fix" means adopting the pretrained model from the BDD100K tracking set, fixing the existing parts, and only training the added mask head.
141
+
142
+ <table><tr><td>Method</td><td>Pretrained</td><td>Online</td><td>mMOTSA↑</td><td>mMOTSP↑</td><td>mIDF个</td><td>ID sw.↓</td><td>mAP↑</td></tr><tr><td>SortIoU</td><td>I, C, S</td><td>√</td><td>10.3</td><td>59.9</td><td>21.8</td><td>15951</td><td>22.2</td></tr><tr><td>MaskTrackRCNN [36]</td><td>I, C, S</td><td>√</td><td>12.3</td><td>59.9</td><td>26.2</td><td>9116</td><td>22.0</td></tr><tr><td>STEm-Seg [1]</td><td>1,C, s</td><td>×</td><td>12.2</td><td>58.2</td><td>25.4</td><td>8732</td><td>21.8</td></tr><tr><td>QDTrack-mots [29]</td><td>1, C,S</td><td>√</td><td>22.5</td><td>59.6</td><td>40.8</td><td>1340</td><td>22.4</td></tr><tr><td>QDTrack-mots-fix [29]</td><td>I, B</td><td>√</td><td>23.5</td><td>66.3</td><td>44.5</td><td>973</td><td>25.5</td></tr><tr><td>PCAN (Ours)</td><td>I,B</td><td>√</td><td>27.4</td><td>66.7</td><td>45.1</td><td>876</td><td>26.6</td></tr></table>
143
+
144
+ # 4.2 State-of-the-Art Comparison
145
+
146
+ We compare our approach with the state-of-the-art methods on the aforementioned large-scale MOTS/VIS benchmarks Youtube-VIS and BDD100K, where PCAN outperforms all existing methods without bells and whistles, and shows efficacy to both one-stage and two-stage segmentation frameworks. We follow the official metrics of each benchmark to evaluate our model.
147
+
148
+ Youtube-VIS The results of Youtube-VIS benchmark is in Table 1, where PCAN achieves the best mask AP of $3 6 . 1 \%$ using ResNet-50 and $3 7 . 6 \%$ using ResNet-101 respectively, while being an online method. Our approach consistently surpasses most recent SOTA methods, including STMask [18] and SG-Net [22] by a significant margin. These methods only conduct temporal modeling between two adjacent frames for feature correlation. Compared to our baseline SipMask [5], a single-image based segmentation with object centerness association, PCAN improves the mask AP from $3 2 . 5 \%$ to $3 6 . 1 \%$ , which shows the effectiveness of long-term temporal modeling in helping object tracking and segmentation.
149
+
150
+ BDD100K Table 2 shows our results on BDD100K tracking and segmentation benchmark, where PCAN outperforms the strong baseline methods MaskTrackRCNN [46] and QDTrack-mots [29]. Our approach achieves a large advantage in mMOTSA, with over 3 points gain and around $10 \%$ ID switches decrease. MOTSA measures segmentation as well as tracking quality, while ID Switches can measure the performance of identity consistency. The significant advancements demonstrate that our method with prototypical cross-attention enables more accurate pixel-wise object tracking by effectively exploiting temporal information.
151
+
152
+ # 4.3 Ablation study and analysis
153
+
154
+ We conduct detailed ablation studies on Youtube-VIS validation set, where we investigate the effect of our proposed prototypical cross-attention components for MOTS during training and testing.
155
+
156
+ Effect of frame-level prototypical cross-attention module To study the importance of temporal information amount, we conduct an ablation study on models with different input temporal window lengths in Table 3. A temporal length of 1 thus means that no prior temporal information guidance is used during video instance segmentation. By varying the frame length from 1 to 32, the mask AP increases from $3 2 . 5 \%$ to $3 5 . 4 \%$ , which reveals that richer temporal information with multiple views of a segmented object indeed brings more gain to model performance. For the number of frame-level prototypes, we used 64 during training and testing. The results on YouTube-VIS in Table 8 show that the precision saturates for larger numbers of prototypes.
157
+
158
+ Table 3: Results of varying temporal memory length in our PCAN on YouTube-VIS.
159
+
160
+ <table><tr><td>Length</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>1</td><td>32.5</td><td>53.0</td><td>33.3</td><td>33.5</td><td>38.9</td></tr><tr><td>2</td><td>33.7</td><td>53.8</td><td>35.3</td><td>33.9</td><td>39.5</td></tr><tr><td>4</td><td>33.9</td><td>54.0</td><td>36.8</td><td>34.1</td><td>40.0</td></tr><tr><td>8</td><td>34.2</td><td>53.7</td><td>37.6</td><td>34.4</td><td>40.3</td></tr><tr><td>16</td><td>34.6</td><td>53.7</td><td>38.3</td><td>35.4</td><td>40.5</td></tr><tr><td>32</td><td>35.4</td><td>53.8</td><td>39.1</td><td>35.9</td><td>41.0</td></tr></table>
161
+
162
+ Table 4: Effect of multi-layer prototypical feature fusion with tube length 4 on YouTube-VIS.
163
+
164
+ <table><tr><td>FPN Layer</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>P3</td><td>30.8</td><td>51.7</td><td>32.0</td><td>32.6</td><td>37.0</td></tr><tr><td>P4</td><td>32.0</td><td>51.5</td><td>34.1</td><td>32.6</td><td>37.2</td></tr><tr><td>P5</td><td>32.9</td><td>52.1</td><td>35.9</td><td>33.2</td><td>38.6</td></tr><tr><td>P3-P4</td><td>33.1</td><td>52.3</td><td>35.6</td><td>33.6</td><td>38.5</td></tr><tr><td>P3-P5</td><td>33.9</td><td>54.0</td><td>36.8</td><td>34.1</td><td>40.0</td></tr></table>
165
+
166
+ Table 5: Comparison with non-local attention [39] and transformer [6, 41] on YouTube-VIS.
167
+
168
+ <table><tr><td rowspan="2">Length</td><td colspan="3">Prototypical Cross-Attention</td><td colspan="3">Non-local Attention</td><td colspan="3">Transformer (Multi-Head Self-Attention)</td></tr><tr><td>AP</td><td>FLOPs(B)</td><td>Memory(M)</td><td>AP</td><td>FLOPs(B)</td><td>Memory(M)</td><td>AP</td><td>FLOPs(B)</td><td>Memory(M)</td></tr><tr><td>2</td><td>33.7</td><td>5.8</td><td>323</td><td>33.2</td><td>24.3</td><td>2497</td><td>24.6</td><td>103.8</td><td>5321</td></tr><tr><td>4</td><td>33.9</td><td>12.0</td><td>652</td><td>33.3</td><td>49.1</td><td>4763</td><td>25.8</td><td>387.2</td><td>9844</td></tr><tr><td>8</td><td>34.2</td><td>23.7</td><td>1419</td><td>33.6</td><td>99.6</td><td>9631</td><td>28.3</td><td>1413.3</td><td>18762</td></tr></table>
169
+
170
+ ![](images/c76ee7c6980393304488d4699b6a5c3971b1bb8d922650744576ad064f7e6827.jpg)
171
+ Figure 4: Qualitative impact of our PCAM on YouTube-VIS. Mask colors encode object identity. Our frame-level PCAM (second row) helps provide consistent detections and preserve identities compared to the baseline (first row). The instance-level PCAM (fourth row) provides more accurate masks, while further improving identity consistency compared to not employing our module (third row).
172
+
173
+ Effect of multi-layer temporal aggregation Since we perform temporal feature aggregation on the extracted FPN features, to help deal with objects with partial occlusion and large-scale variation, we also study the effect of using different levels of the extracted FPN features. In Table 4, we select the FPN feature map from P3-P5 layers for (excluding P6 and P7 due to impractical computation cost), and perform prototypical temporal aggregation on each FPN layer. We find that multi-layer information is also important to final model performance.
174
+
175
+ Computation and memory efficiency In Table 5 we analyze different attention mechanisms. Compared to standard space-time memory reading using non-local attention [39, 28] or recent popular transformer [41, 6] with multi-head self-attention layer, the prototypical cross-attention with condensed prototypes not only enjoys high accuracy advantage, but also largely reduces the memory consumption and computation amount. For input tube length 8, the prototypical memory consumption is less than $10 \%$ of the transformer with negligible FLOPs computation due to the small number of representative prototypes in (5).
176
+
177
+ Effect of instance-level prototypical appearance module We analyze the instance-level prototypical cross-attention module, which represents each video tracklet using the contrastive prototypes. In
178
+
179
+ Table 6: Ablation study on number of instancelevel prototypes on YouTube-VIS.
180
+
181
+ <table><tr><td rowspan=1 colspan=1>Pos.Proto.Number丨Neg.Proto.Number</td><td rowspan=1 colspan=1>Pos.Proto.Number丨Neg.Proto.Number</td><td rowspan=1 colspan=1>AP AP50</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>32.5 53.0</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>32.4 52.3</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>32.1 52.4</td></tr><tr><td rowspan=2 colspan=1>15</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>32.7 52.8</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>33.1 53.6</td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>33.9 54.1</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>33.6 53.8</td></tr></table>
182
+
183
+ Table 7: Ablation on instance-level EM feature propagation and updating on YouTube-VIS.
184
+
185
+ <table><tr><td>version</td><td>AP</td><td>AP50</td></tr><tr><td>No instance prototype propagation</td><td>33.5</td><td>53.2</td></tr><tr><td>Using initial instance prototype</td><td>33.0</td><td>52.8</td></tr><tr><td>Update momentum = 0.2</td><td>34.3</td><td>53.8</td></tr><tr><td>Update momentum = 0.5</td><td>34.0</td><td>53.6</td></tr></table>
186
+
187
+ Table 8: Ablation on number of framelevel prototypes on YouTube-VIS.
188
+
189
+ <table><tr><td>Proto.Number</td><td>AP</td><td>AP50</td></tr><tr><td>8</td><td>32.6</td><td>52.8</td></tr><tr><td>16</td><td>33.1</td><td>53.3</td></tr><tr><td>32</td><td>33.9</td><td>53.5</td></tr><tr><td>64</td><td>34.2</td><td>53.7</td></tr><tr><td>128</td><td>34.1</td><td>53.8</td></tr></table>
190
+
191
+ Table 9: Results of varying EM iterations for our PCAN on YouTube-VIS.
192
+
193
+ <table><tr><td>Iteration number</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>1</td><td>33.3</td><td>53.4</td><td>35.8</td><td>33.2</td><td>38.8</td></tr><tr><td>2</td><td>33.7</td><td>53.9</td><td>36.4</td><td>33.6</td><td>39.3</td></tr><tr><td>4</td><td>33.7</td><td>54.1</td><td>36.5</td><td>33.9</td><td>39.5</td></tr><tr><td>6</td><td>33.9</td><td>54.0</td><td>36.8</td><td>34.1</td><td>40.0</td></tr><tr><td>8</td><td>33.6</td><td>53.6</td><td>36.1</td><td>33.7</td><td>39.3</td></tr></table>
194
+
195
+ Table 6, we study the influence of instance prototype number and the effect of foreground-background contrasting. Using both positive and negative prototypes improves AP from $3 2 . 5 \%$ to $3 3 . 9 \%$ . Compared to the single prototype representation, the GMM demonstrate a stronger appearance modeling ability. We further find that the performance saturates when the number is larger than 60. In the Figure 6 and supplementary file, we provide additional instance cross-attention maps visualization to highlight the various attended regions.
196
+
197
+ In Table 7, we investigate the effectiveness of instance prototype (including the both positive and negative ones) propagation in an online manner, and compared it with using the instance prototype in the initial frame or current frame. We find that updating object prototypes recurrently with a momentum of 0.2 improves video segmentation AP of $1 . 3 \%$ .
198
+
199
+ Influence of EM iteration number We study the influence of EM iteration number $T$ during condensing prototypes and the results are shown in Table 9. Using temporal memory length 4, we find that the accuracy gains of PCAN increase with more iterations from 1 to 6, and the improvement starts to saturate when $T \geqslant 6$ . We use the same iteration number during training and test.
200
+
201
+ Ablation study on KITTI-MOTS We also train PCAN on the KITTI-MOTS [37] training set and conduct ablations on the instance and frame PCAMs. In Table 10, PCAN with window size 8 on val set also shows significant improvements compared to the TrackR-CNN [37] (a two-stage tracker based on Mask R-CNN) on the benchmark. Note that many published methods on KITTI-MOTS, such as Vip-DeepLab [31], EagerMOT [17] and MOTSFusion [24], use 3D bounding boxes, LIDAR point clouds, or optical flow (PointTrack [44]). In contrast, our method only relies on RGB images.
202
+
203
+ Qualitative analysis In Figure 4, we showcase qualitative ablation results of PCAN on Youtube-VIS. Compared to the baseline, we see that our model results in more consistent segmentation and better tracking using prototypical cross-attention module. We also provide visual results on BDD100K in Figure 5, where PCAN produces robust tracking and segmentation results even under large object appearance change (first row) or low illumination (second row). In the 3rd row, PCAN has limitations in handling missing detections (the person in the first frame) with limited appearance information under extreme lighting, and produce tracking errors in the second frame when visible parts of the same car is totally different across frame and with low appearance similarity.
204
+
205
+ Cross-Attention Visualization In Figure 6, we visualize instance-level prototypical cross-attention of the interested car for both the corresponding foreground and background regions on three continuous frames on BDD100K, where the attended region of each object prototype reveals the implicit unsupervised temporal consistency. More visualization cases on instance and frame cross-attention maps and relevant analysis are in the supplementary file.
206
+
207
+ Societal impact PCAN has high potential impact in important applications, such as transportation, sports analysis, and self-driving vehicles. However, this powerful technology can be deployed in human monitoring and surveillance as well which raise ethical and privacy issues. Potential negative impact can be avoided by enforcing a strict and secure data privacy regulation such as the GDPR,
208
+
209
+ Table 10: Ablation study of PCAN on KITTI-MOTS [37] validation set.
210
+
211
+ <table><tr><td>Method</td><td>|Car-MOTSA</td><td>Ped-MOTSA</td><td>Car-MOTSP</td><td>Ped-MOTSP</td></tr><tr><td>TrackR-CNN [37]</td><td>87.8</td><td>65.1</td><td>87.2</td><td>75.7</td></tr><tr><td rowspan="3">PCAN w/o frame PCAM PCAN w/o instance PCAM</td><td>87.3</td><td>65.3</td><td>86.9</td><td>75.0</td></tr><tr><td>87.8</td><td>65.8</td><td>87.1</td><td>75.5</td></tr><tr><td>89.6</td><td>66.4</td><td>88.3</td><td>76.1</td></tr></table>
212
+
213
+ ![](images/43f2b11ee05e974f625ef7fa9c6ca494b65750d3481407d6beccb7f126aa5d06.jpg)
214
+ Figure 5: Qualitative results of our method on BDD100K. PCAN produces robust tracking and segmentation results under large motion and appearance changes (1st row) and heavy traffic in low-light conditions (2nd row). In the 3rd row, PCAN misses a detection (the person to the left in 1st frame), and produces tracking errors (2nd frame) when it covers totally different regions of the car with low appearance similarity. Zoom for better view. Video results are in the suppl. file.
215
+
216
+ ![](images/4685f107e82d0332bd9ca6ab4b5b4295cba1dbb068fc8f484d749cefb0c32c5f.jpg)
217
+ Figure 6: Instance cross-attention maps visualization for the car specified by the red dotted bounding box on BDD100K. We select the first four foreground/background prototypes as example, where each one focuses on specific car sub-regions with implicit unsupervised temporal consistency over time. proper technology management education, and having an open dialogue among various stakeholders on how such technology should be deployed and regulated.
218
+
219
+ # 5 Conclusion
220
+
221
+ We present PCAN, a new online method for MOTS. PCAN first distills the space-time memory into a set of frame-level and instance-level prototypes, followed by cross-attention to retrieve rich information from the past frames. In contrast to most previous MOTS methods with limited temporal consideration, PCAN efficiently performs long-term temporal propagation and aggregation, and achieves large performance gain on the two largest MOTS benchmarks with low computation and memory cost. We validate the efficacy of PCAN on both the existing one-stage and two-stage trackers. We believe PCAN will significantly benefit more video understanding tasks in the future.
222
+
223
+ # Acknowledgments and Disclosure of Funding
224
+
225
+ This research is supported in part by the Research Grant Council of the Hong Kong SAR under grant no. 16201818 and Kuaishou Technology.
226
+
227
+ # References
228
+
229
+ [1] Ali Athar, Sabarinath Mahadevan, Aljoša Ošep, Laura Leal-Taixé, and Bastian Leibe. Stem-seg: Spatiotemporal embeddings for instance segmentation in videos. In ECCV, 2020. [2] Gedas Bertasius and Lorenzo Torresani. Classifying, segmenting, and tracking object instances in video with mask propagation. In CVPR, 2020.
230
+ [3] Daniel Bolya, Chong Zhou, Fanyi Xiao, and Yong Jae Lee. Yolact: Real-time instance segmentation. In ICCV, 2019.
231
+ [4] Sergi Caelles, Kevis-Kokitsi Maninis, Jordi Pont-Tuset, Laura Leal-Taixé, Daniel Cremers, and Luc Van Gool. One-shot video object segmentation. In CVPR, 2017.
232
+ [5] Jiale Cao, Rao Muhammad Anwer, Hisham Cholakkal, Fahad Shahbaz Khan, Yanwei Pang, and Ling Shao. Sipmask: Spatial information preservation for fast image and video instance segmentation. In ECCV, 2020.
233
+ [6] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
234
+ [7] Yunpeng Chen, Yannis Kalantidis, Jianshu Li, Shuicheng Yan, and Jiashi Feng. $a ^ { 2 }$ -nets: Double attention networks. In NeurIPS, 2018.
235
+ [8] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2020.
236
+ [9] Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. Slowfast networks for video recognition. In ICCV, 2019.
237
+ [10] Andreas Geiger, Philip Lenz, and Raquel Urtasun. Are we ready for autonomous driving? the kitti vision benchmark suite. In CVPR, 2012.
238
+ [11] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, 2017.
239
+ [12] Ping Hu, Fabian Caba, Oliver Wang, Zhe Lin, Stan Sclaroff, and Federico Perazzi. Temporally distributed networks for fast video semantic segmentation. In CVPR, 2020.
240
+ [13] Zhaojin Huang, Lichao Huang, Yongchao Gong, Chang Huang, and Xinggang Wang. Mask scoring r-cnn. In CVPR, 2019.
241
+ [14] Joakim Johnander, Martin Danelljan, Emil Brissman, Fahad Shahbaz Khan, and Michael Felsberg. A generative appearance model for end-to-end video object segmentation. In CVPR, 2019.
242
+ [15] Lei Ke, Yu-Wing Tai, and Chi-Keung Tang. Deep occlusion-aware instance segmentation with overlapping bilayers. In CVPR, 2021.
243
+ [16] Lei Ke, Yu-Wing Tai, and Chi-Keung Tang. Occlusion-aware video object inpainting. In ICCV, 2021.
244
+ [17] Aleksandr Kim, Aljoša Ošep, and Laura Leal-Taix’e. Eagermot: 3d multi-object tracking via sensor fusion. In IEEE International Conference on Robotics and Automation (ICRA), 2021.
245
+ [18] Minghan Li, Shuai Li, Lida Li, and Lei Zhang. Spatial feature calibration and temporal fusion for effective one-stage video instance segmentation. In CVPR, 2021.
246
+ [19] Xia Li, Zhisheng Zhong, Jianlong Wu, Yibo Yang, Zhouchen Lin, and Hong Liu. Expectation-maximization attention networks for semantic segmentation. In ICCV, 2019.
247
+ [20] Yingwei Li, Xiaojie Jin, Jieru Mei, Xiaochen Lian, Linjie Yang, Cihang Xie, Qihang Yu, Yuyin Zhou, Song Bai, and Alan L Yuille. Neural architecture search for lightweight non-local networks. In CVPR, 2020.
248
+ [21] Chung-Ching Lin, Ying Hung, Rogerio Feris, and Linglin He. Video instance segmentation tracking with a modified vae architecture. In CVPR, 2020.
249
+ [22] Dongfang Liu, Yiming Cui, Wenbo Tan, and Yingjie Chen. Sg-net: Spatial granularity network for one-stage video instance segmentation. In CVPR, 2021.
250
+ [23] Xiankai Lu, Wenguan Wang, Danelljan Martin, Tianfei Zhou, Jianbing Shen, and Van Gool Luc. Video object segmentation with episodic graph memory networks. In ECCV, 2020.
251
+ [24] Jonathon Luiten, Tobias Fischer, and Bastian Leibe. Track to reconstruct and reconstruct to track. IEEE Robotics and Automation Letters, 5(2):1803–1810, 2020.
252
+ [25] Tim Meinhardt, Alexander Kirillov, Laura Leal-Taixe, and Christoph Feichtenhofer. Trackformer: Multiobject tracking with transformers. arXiv preprint arXiv:2101.02702, 2021.
253
+ [26] Anton Milan, Laura Leal-Taixé, Ian Reid, Stefan Roth, and Konrad Schindler. Mot16: A benchmark for multi-object tracking. arXiv preprint arXiv:1603.00831, 2016.
254
+ [27] Anton Milan, Laura Leal-Taixé, Konrad Schindler, and Ian Reid. Joint tracking and segmentation of multiple targets. In CVPR, 2015.
255
+ [28] Seoung Wug Oh, Joon-Young Lee, Ning Xu, and Seon Joo Kim. Video object segmentation using space-time memory networks. In ICCV, 2019.
256
+ [29] Jiangmiao Pang, Linlu Qiu, Xia Li, Haofeng Chen, Qi Li, Trevor Darrell, and Fisher Yu. Quasi-dense similarity learning for multiple object tracking. In CVPR, 2021.
257
+ [30] Jiyang Qi, Yan Gao, Yao Hu, Xinggang Wang, Xiaoyu Liu, Xiang Bai, Serge Belongie, Alan Yuille, Philip Torr, and Song Bai. Occluded video instance segmentation. arXiv preprint arXiv:2102.01558, 2021.
258
+ [31] Siyuan Qiao, Yukun Zhu, Hartwig Adam, Alan Yuille, and Liang-Chieh Chen. Vip-deeplab: Learning visual perception with depth-aware video panoptic segmentation. In CVPR, 2021.
259
+ [32] Hongje Seong, Junhyuk Hyun, and Euntai Kim. Kernelized memory network for video object segmentation. In ECCV, 2020.
260
+ [33] Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In NeurIPS, 2017.
261
+ [34] Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In ICCV, 2019.
262
+ [35] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
263
+ [36] Paul Voigtlaender, Yuning Chai, Florian Schroff, Hartwig Adam, Bastian Leibe, and Liang-Chieh Chen. Feelvos: Fast end-to-end embedding learning for video object segmentation. In CVPR, 2019.
264
+ [37] Paul Voigtlaender, Michael Krause, Aljosa Osep, Jonathon Luiten, Berin Balachandar Gnana Sekar, Andreas Geiger, and Bastian Leibe. Mots: Multi-object tracking and segmentation. In CVPR, 2019.
265
+ [38] Apoorv Vyas, Angelos Katharopoulos, and François Fleuret. Fast transformers with clustered attention. NeurIPS, 2020.
266
+ [39] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018.
267
+ [40] Xiaolong Wang and Abhinav Gupta. Videos as space-time region graphs. In ECCV, 2018.
268
+ [41] Yuqing Wang, Zhaoliang Xu, Xinlong Wang, Chunhua Shen, Baoshan Cheng, Hao Shen, and Huaxia Xia. End-to-end video instance segmentation with transformers. arXiv preprint arXiv:2011.14503v1, 2020.
269
+ [42] Nicolai Wojke, Alex Bewley, and Dietrich Paulus. Simple online and realtime tracking with a deep association metric. In IEEE international conference on image processing (ICIP), 2017.
270
+ [43] Haozhe Xie, Hongxun Yao, Shangchen Zhou, Shengping Zhang, and Wenxiu Sun. Efficient regional memory network for video object segmentation. In CVPR, 2021.
271
+ [44] Zhenbo Xu, Wei Zhang, Xiao Tan, Wei Yang, Huan Huang, Shilei Wen, Errui Ding, and Liusheng Huang. Segment as points for efficient online multi-object tracking and segmentation. In Proceedings of the European Conference on Computer Vision (ECCV), 2020.
272
+ [45] Boyu Yang, Chang Liu, Bohao Li, Jianbin Jiao, and Qixiang Ye. Prototype mixture models for few-shot semantic segmentation. In ECCV, 2020.
273
+ [46] Linjie Yang, Yuchen Fan, and Ning Xu. Video instance segmentation. In ICCV, 2019.
274
+ [47] Linjie Yang, Yanran Wang, Xuehan Xiong, Jianchao Yang, and Aggelos K Katsaggelos. Efficient video object segmentation via network modulation. In CVPR, 2018.
275
+ [48] Shusheng Yang, Yuxin Fang, Xinggang Wang, Yu Li, Chen Fang, Ying Shan, Bin Feng, and Wenyu Liu. Crossover learning for fast online video instance segmentation. In ICCV, 2021.
276
+ [49] Zongxin Yang, Yunchao Wei, and Yi Yang. Collaborative video object segmentation by foregroundbackground integration. In ECCV, 2020.
277
+ [50] Fisher Yu, Haofeng Chen, Xin Wang, Wenqi Xian, Yingying Chen, Fangchen Liu, Vashisht Madhavan, and Trevor Darrell. Bdd100k: A diverse driving dataset for heterogeneous multitask learning. In CVPR, 2020.
278
+ [51] Chi Zhang, Guosheng Lin, Fayao Liu, Rui Yao, and Chunhua Shen. Canet: Class-agnostic segmentation networks with iterative refinement and attentive few-shot learning. In CVPR, 2019.
md/train/PdauS7wZBfC/PdauS7wZBfC.md ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PREDICTIVE CODING APPROXIMATES BACKPROP ALONG ARBITRARY COMPUTATION GRAPHS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Backpropagation of error (backprop) is a powerful algorithm for training machine learning architectures through end-to-end differentiation. Recently it has been shown that backprop in multilayer-perceptrons (MLPs) can be approximated using predictive coding, a biologically-plausible process theory of cortical computation which relies solely on local and Hebbian updates. The power of backprop, however, lies not in its instantiation in MLPs, but rather in the concept of automatic differentiation which allows for the optimisation of any differentiable program expressed as a computation graph. Here, we demonstrate that predictive coding converges asymptotically (and in practice rapidly) to exact backprop gradients on arbitrary computation graphs using only local learning rules. We apply this result to develop a straightforward strategy to translate core machine learning architectures into their predictive coding equivalents. We construct predictive coding CNNs, RNNs, and the more complex LSTMs, which include a non-layer-like branching internal graph structure and multiplicative interactions. Our models perform equivalently to backprop on challenging machine learning benchmarks, while utilising only local and (mostly) Hebbian plasticity. Our method raises the potential that standard machine learning algorithms could in principle be directly implemented in neural circuitry, and may also contribute to the development of completely distributed neuromorphic architectures.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep learning has seen stunning successes in the last decade in computer vision (Krizhevsky et al., 2012; Szegedy et al., 2015), natural language processing and translation (Vaswani et al., 2017; Radford et al., 2019; Kaplan et al., 2020), and computer game playing (Mnih et al., 2015; Silver et al., 2017; Schrittwieser et al., 2019; Vinyals et al., 2019). While there is a great variety of architectures and models, they are all trained by gradient descent using gradients computed by automatic differentiation (AD). The key insight of AD is that it suffices to define a forward model which maps inputs to predictions according to some parameters. Then, using the chain rule of calculus, it is possible, as long as every operation of the forward model is differentiable, to differentiate back through the computation graph of the model so as to compute the sensitivity of every parameter in the model to the error at the output, and thus adjust every single parameter to best minimize the total loss. Early models were typically simple artificial neural networks where the computation graph is simply a composition of matrix multiplications and elementwise nonlinearities, and for which the implementation of automatic differentation has become known as ‘backpropagation’ (or ’backprop’). However, automatic differentiation allows for substantially more complicated graphs to be differentiated through, up to, and including, arbitrary programs (Griewank et al., 1989; Baydin et al., 2017; Paszke et al., 2017; Revels et al., 2016; Innes et al., 2019; Werbos, 1982; Rumelhart and Zipser, 1985; Linnainmaa, 1970). In recent years this has enabled the differentiation through differential equation solvers (Chen et al., 2018; Tzen and Raginsky, 2019; Rackauckas et al., 2019), physics engines (Degrave et al., 2019; Heiden et al., 2019), raytracers (Pal, 2019), and planning algorithms (Amos and Yarats, 2019; Okada et al., 2017). These advances allow the straightforward training of models which intrinsically embody complex processes and which can encode significantly more prior knowledge and structure about a given problem domain than previously possible.
12
+
13
+ Modern deep learning has also been closely intertwined with neuroscience (Hassabis et al., 2017; Hawkins and Blakeslee, 2007; Richards et al., 2019). The backpropagation algorithm itself arose as a technique for training multi-layer perceptrons – simple hierarchical models of neurons inspired by the brain (Werbos, 1982). Despite this origin, and its empirical successes, a consensus has emerged that the brain cannot directly implement backprop, since to do so would require biologically implausible connection rules (Crick, 1989). There are two principal problems. Firstly, backprop in the brain appears to require non-local information (since the activity of any specific neuron affects all subsequent neurons down to the final output neuron). It is difficult to see how this information could be transmitted ’backwards’ throughout the brain with the required fidelity without precise connectivity constraints. The second problem – the ‘weight transport problem’ is that backprop through MLP style networks requires identical forward and backwards weights. In recent years, however, a succession of models have been introduced which claim to implement backprop in MLP-style models using only biologically plausible connectivity schemes, and Hebbian learning rules (Liao et al., 2016; Guerguiev et al., 2017; Sacramento et al., 2018; Bengio and Fischer, 2015; Bengio et al., 2017; Ororbia et al., 2020; Whittington and Bogacz, 2019). Of particular significance is Whittington and Bogacz (2017) who show that predictive coding networks – a type of biologically plausible network which learn through a hierarchical process of prediction error minimization – are mathematically equivalent to backprop in MLP models. In this paper we extend this work, showing that predictive coding can not only approximate backprop in MLPs, but can approximate automatic differentiation along arbitrary computation graphs. This means that in theory there exist potentially biologically plausible algorithms for differentiating through arbitrary programs, utilizing only local connectivity. Moreover, in a class of models which we call parameter-linear, which includes many current machine learning models, the required update rules are Hebbian, raising the possibility that a wide range of current machine learning architectures may be faithfully implemented in the brain, or in neuromorphic hardware.
14
+
15
+ In this paper we provide two main contributions. (i) We show that predictive coding converges to automatic differentiation across arbitrary computation graphs. (ii) We showcase this result by implementing three core machine learning architectures (CNNs, RNNs, and LSTMs) in a predictive coding framework which utilises only local learning rules and mostly Hebbian plasticity.
16
+
17
+ # 2 PREDICTIVE CODING ON ARBITRARY COMPUTATION GRAPHS
18
+
19
+ ![](images/b90a726f3cc2d48f3bf69f7fbaa9154d96df283d5548a86d09bd45a4b09d4f4a.jpg)
20
+ Figure 1: Top: Backpropagation on a chain. Backprop proceeds backwards sequentially and explicitly computes the gradient at each step on the chain. Bottom: Predictive coding on a chain. Predictions, and prediction errors are updated in parallel using only local information.
21
+
22
+ Predictive coding is an influential theory of cortical function in theoretical and computational neuroscience. Central to the theory is the idea that the core function of the brain is to minimize prediction errors between what is expected to happen and what actually happens. Predictive coding views the brain as composed of multiple hierarchical layers which predict the activities of the layers below. Unpredicted activity is registered as prediction error which is then transmitted upwards for a higher layer to process. Over time, synaptic connections are adjusted so that the system improves at minimizing prediction error. Predictive coding possesses a wealth of empirical support (Friston, 2003; 2005; Bogacz, 2017; Whittington and Bogacz, 2019) and offers a single mechanism that accounts for diverse perceptual phenomena such as repetition-suppression (Auksztulewicz and Friston, 2016), endstopping (Rao and Ballard, 1999), bistable perception (Hohwy et al., 2008; Weilnhammer et al., 2017) and illusory motions (Lotter et al., 2016; Watanabe et al., 2018), and even attentional modulation of neural activity (Feldman and Friston, 2010; Kanai et al., 2015). Moreover, the central role of top-down predictions is consistent with the ubiquity, and importance of, top-down diffuse connections between cortical areas. Predictive coding is consistent with many known aspects of neurophysiology, and has been translated into biologically plausible process theories which define candidate cortical microcircuits which can implement the algorithm. (Spratling, 2008; Bastos et al., 2012; Kanai et al., 2015; Shipp, 2016).
23
+
24
+ In previous work, predictive coding has always been conceptualised as operating on hierarchies of layers (Bogacz, 2017; Whittington and Bogacz, 2017). Here we present a generalized form of predictive coding applied to arbitrary computation graphs. A computation graph $\mathcal { G } = \{ \mathbb { E } , \mathbb { V } \}$ is a directed acyclic graph (DAG) which can represent the computational flow of essentially any program or computable function as a composition of elementary functions. Each edge $e _ { i } \in \mathbb { E }$ of the graph corresponds to an intermediate step – the application of an elementary function – while each vertex $v _ { i } \in \mathbb { V }$ is an intermediate variable computed by applying the functions of the edges to the values of their originating vertices. In this paper, $v _ { i }$ denotes the vector of activations within a layer and we denote the set of all vertices as $\{ v _ { i } \}$ . Effectively, computation flows ’forward’ from parent nodes to all their children through the edge functions until the leaf nodes give the final output of the program as a whole (see Figure 1 and 2 for an example). Given a target $T$ and a loss function $L = g ( \mathbf { \bar { \mathit { T } } } , \mathbf { \bar { v } } _ { o u t } )$ , the graph’s output can be evaluated and, and if every edge function is differentiable, automatic differentiation can be performed on the computation graph.
25
+
26
+ Predictive coding can be derived elegantly as a variational inference algorithm under a hierarchical Gaussian generative model (Friston, 2005; Buckley et al., 2017). We extend this approach to arbitrary computation graphs in a supervised setting by defining the inference problem to be solved as that of inferring the vertex value $v _ { i }$ of each node in the graph given fixed start nodes $v _ { 0 }$ (the data), and end nodes $v _ { N }$ (the targets). We define a generative model which parametrises the value of each vertex given the feedforward prediction of its parents, $\begin{array} { r } { p ( \{ v _ { i } \} ) = p ( v _ { 0 } \cdot . . . v _ { N } ) = \prod _ { i } ^ { N } p ( v _ { i } | \mathcal { P } ( v _ { i } ) ) ^ { \ 1 } } \end{array}$ , and a factorised, variational posterior $\begin{array} { r } { Q ( \{ v _ { i } \} | v _ { 0 } , v _ { N } ) = Q ( v _ { 1 } \ldots v _ { N - 1 } | v _ { 0 } , v _ { N } ) = \prod _ { i } ^ { N } Q ( v _ { i } | \mathcal { P } ( v _ { i } ) , \mathcal { C } ( v _ { i } ) ) } \end{array}$ , where $\mathcal { P } ( v _ { i } )$ denotes the set of parents and $\mathcal { C } ( v _ { i } )$ denotes the set of children of a given node $v _ { i }$ . From this, we can define a suitable objective functional, the variational free-energy $\mathcal { F }$ (VFE), which acts as an upper bound on the divergence between the true and variational posteriors.
27
+
28
+ $$
29
+ \begin{array} { l } { \mathcal { F } = K L [ ( Q ( v _ { 1 } \dots v _ { N - 1 } | v _ { 0 } , v _ { N } ) \| p ( v _ { 0 } \dots v _ { N } ) ] \geq K L [ ( Q ( v _ { 1 } \dots v _ { N - 1 } ) | v _ { 0 } , v _ { N } ) \| p ( v _ { 1 } \dots v _ { N - 1 } | v _ { 0 } , v _ { N } ) ] } \\ { \approx \displaystyle \sum _ { i = 0 } ^ { N } \epsilon _ { i } ^ { T } \epsilon _ { i } } \end{array}
30
+ $$
31
+
32
+ Under Gaussian assumptions for the generative model $\begin{array} { r } { p ( \{ v _ { i } \} ) = \prod _ { i } ^ { N } \mathcal { N } ( v _ { i } ; \hat { v } _ { i } , \Sigma _ { i } ) } \end{array}$ , and the variational posterior $\begin{array} { r } { Q ( \{ v _ { i } \} ) = \prod _ { i } ^ { N } \mathcal { N } ( v _ { i } ) } \end{array}$ , where the ‘predictions’ $\hat { v _ { i } } = f ( \mathcal { P } ( v _ { i } ) ; \theta _ { i } )$ are defined as the feedforward value of the vertex produced by running the graph forward, and all the precisions, or inverse variances, $\Sigma _ { i } ^ { - 1 }$ are fixed at the identity, we can write $\mathcal { F }$ as simply a sum of prediction errors (see Appendix D or (Friston, 2003; Bogacz, 2017; Buckley et al., 2017) for full derivations), with the prediction errors defined as $\epsilon _ { i } = v _ { i } - \hat { v } _ { i }$ . These prediction errors play a core role in the framework and, in the biological process theories (Friston, 2005; Bastos et al., 2012), are generally considered to be represented by a distinct population of ‘error units’. Since $\mathcal { F }$ is an upper bound on the divergence between true and approximate posteriors, by minimizing $\mathcal { F }$ , we reduce this divergence, thus improving the quality of the variational posterior and approximating exact Bayesian inference. Predictive coding minimizes $\mathcal { F }$ by employing the Cauchy method of steepest descent to set the dynamics of the vertex variables $v _ { i }$ as a gradient descent directly on $\mathcal { F }$ (Bogacz, 2017).
33
+
34
+ $$
35
+ \frac { d v _ { i } } { d t } = \frac { \partial \mathcal { F } } { \partial v _ { i } } = \epsilon _ { i } - \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } \frac { \partial \hat { v } _ { j } } { \partial v _ { i } }
36
+ $$
37
+
38
+ The dynamics of the parameters of the edge functions $\theta$ such that $\hat { v _ { i } } = f ( \mathcal { P } ( v _ { i } ) ; \theta )$ , can also be derived as a gradient descent on $\mathcal { F }$ . Importantly these dynamics require only information (the current vertex value, prediction error, and prediction errors of child vertices) locally available at the vertex.
39
+
40
+ $$
41
+ \frac { d \theta _ { i } } { d t } = \frac { \partial \mathcal { F } } { \partial \theta _ { i } } = \epsilon _ { i } \frac { \partial \hat { v } _ { i } } { \partial \theta _ { i } }
42
+ $$
43
+
44
+ To run generalized predictive coding in practice on a given computation graph $\mathcal { G } = \{ \mathbb { E } , \mathbb { V } \}$ , we augment the graph with error units $\epsilon \in { \mathcal { E } }$ to obtain an augumented computation graph $\tilde { \mathcal { G } } = \{ \mathbb { E } , \mathbb { V } , \mathcal { E } \}$ . The predictive coding algorithm then operates in two phases – a feedforward sweep and a backwards iteration phase. In the feedforward sweep, the augmented computation graph is run forward to obtain the set of predictions $\{ \hat { v } _ { i } \}$ , and prediction errors $\{ \epsilon _ { i } \} = \{ \bar { v } _ { i } - \hat { v } _ { i } \}$ for every vertex. Following Whittington and Bogacz (2017), to achieve exact equivalence with the backprop gradients computed on the original computation graph, we initialize $v _ { i } = \hat { v } _ { i }$ in the initial feedforward sweep so that the output error computed by the predictive coding network and the original graph are identical.
45
+
46
+ In the backwards iteration phase, the vertex activities $\{ v _ { i } \}$ and prediction errors $\left\{ \epsilon _ { i } \right\}$ are updated with Equation 2 for all vertices in parallel until the vertex values converge to a minimum of $\mathcal { F }$ . After convergence the parameters are updated according to Equation 3. Note we also assume, following Whittington and Bogacz (2017), that the predictions at each layer are fixed at the values assigned during the feedforward pass throughout the optimisation of the vs. We call this the fixed-prediction assumption. In effect, by removing the coupling between the vertex activities of the parents and the prediction at the child, this assumption separates the global optimisation problem into a local one for each vertex. We implement these dynamics with a simple forward Euler integration scheme so that the update rule for the vertices became $\begin{array} { r } { \boldsymbol { v } _ { i } ^ { t + 1 } \boldsymbol { v } _ { i } ^ { t } - \eta \frac { d \mathcal { F } } { d \boldsymbol { v } _ { i } ^ { t } } } \end{array}$ where $\eta$ is the step-size parameter. Importantly, if the edge function linearly combines the activities and the parameters followed by an elementwise nonlinearity – a condition which we call ‘parameter-linear’ – then both the update rule for the vertices (Equation 2) and the parameters (Equation 3) become Hebbian. Specifically, the update rules for the vertices and weights become $\begin{array} { r } { \frac { d v _ { i } } { d t } = \epsilon _ { i } - \sum _ { j } \epsilon _ { j } f ^ { \prime } ( \theta _ { j } \hat { v _ { j } } ) \theta _ { j } ^ { T } } \end{array}$ and $\begin{array} { r } { \frac { d \bar { \theta } _ { i } } { d t } = \epsilon _ { i } f ^ { \prime } ( \theta _ { i } \hat { v _ { i } } ) \bar { \hat { v _ { i } } } ^ { T } } \end{array}$ , respectively.
47
+
48
+ # 2.1 APPROXIMATION TO BACKPROP
49
+
50
+ Here we show that at the equilibrium of the dynamics, the prediction errors $\boldsymbol { \epsilon } _ { i } ^ { * }$ converge to the correct backpropagated gradients $\frac { \partial L } { \partial v _ { i } }$ , and consequently the parameter updates (Equation 3) become precisely those of a backprop trained network. Standard backprop works by computing the gradient of a vertex $\frac { \partial L } { \partial v _ { L } }$ he sum of the gradients of the child vertices. Beginning with the gradient of the output vertex, it recursively computes the gradients of vertices deeper in the graph by the chain rule:
51
+
52
+ $$
53
+ \frac { \partial L } { \partial v _ { i } } = \sum _ { j = \mathcal { C } ( v _ { i } ) } \frac { \partial L } { \partial v _ { j } } \frac { \partial v _ { j } } { \partial v _ { i } }
54
+ $$
55
+
56
+ In comerrors arison, in our predictive coding framework, at the equilibrium point become, $\begin{array} { r } { \cdot \frac { d v _ { i } } { d t } = 0 \rangle } \end{array}$ ) the prediction $\boldsymbol { \epsilon } _ { i } ^ { * }$
57
+
58
+ $$
59
+ \epsilon _ { i } ^ { * } = \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } ^ { * } \frac { \partial \hat { v } _ { i } } { \partial v _ { j } }
60
+ $$
61
+
62
+ Importantly, this means that the equilibrium value of the prediction error at a given vertex (Equation 5) satisfies the same recursive structure as the chain rule of backprop (Equation 4). Since this relationship is recursive, all that is needed for the prediction errors throughout the graph to converge to the backpropagated derivatives is for the prediction errors at the final layer to be equal to the output gradient: $\begin{array} { r } { \dot { \epsilon } _ { L } ^ { * } = \frac { { \partial } L } { { \partial } \hat { v } _ { L } } } \end{array}$ . To see this explicitly, consider a mean-squared-error loss function 2. at the
63
+
64
+ # Algorithm 1: Generalized Predictive Coding
65
+
66
+ Data: Dataset ${ \mathcal { D } } = \{ { \mathbf { X } } , { \mathbf { L } } \}$ , Augmented Computation Graph $\tilde { \mathcal { G } } = \{ \mathbb { E } , \mathbb { V } , \mathcal { E } \}$ , inference learning rate $\eta _ { v }$ , weight learning rate $\eta _ { \theta }$
67
+ begin $/ \star$ For each minibatch in the dataset \*/ for $( x , L ) \in \mathcal { D }$ do $/ \star$ Fix start of graph to inputs \*/ $\hat { v _ { 0 } } \gets x$ $/ \star$ Forward pass to compute predictions \*/ for $\hat { v } _ { i } \in \mathbb { V }$ do $\lfloor \hat { v } _ { i } f ( \{ \mathcal { P } ( \hat { v } _ { i } ) ; \theta \}$ $/ \star$ Compute output error \*/ $\epsilon _ { L } L - \hat { v } _ { L }$ /\* Begin backwards iteration phase of the descent on the free energy \*/ while not converged do for $( v _ { i } , \epsilon _ { i } ) \in \tilde { \mathcal { G } }$ do $/ \star$ Compute prediction errors \*/ $\boldsymbol { \epsilon } _ { i } \gets \boldsymbol { v } _ { i } - \boldsymbol { \hat { v } } _ { i }$ $/ \star$ vertex values \*/ $\begin{array} { r } { v _ { i } ^ { t + 1 } v _ { i } ^ { t } + \eta _ { v } \frac { d \mathcal { F } } { d v _ { i } ^ { t } } } \end{array}$ /\* Update weights at equilibrium \*/ for i θ t +1i ← θ ti + η θ d Fdθ ti $\theta _ { i } \in \mathbb { E }$ do
68
+
69
+ output layer $\begin{array} { r } { L = \frac 1 2 ( T - \hat { v } _ { L } ) ^ { 2 } } \end{array}$ with $\mathrm { T }$ as a vector of targets, and defining $\epsilon _ { L } = T - \hat { v } _ { L }$ . We then consider the equilibrium value of the prediction error unit at a penultimate vertex $\epsilon _ { L - 1 }$ . By Equation 5, we can see that at equilibrium,
70
+
71
+ $$
72
+ \epsilon _ { L - 1 } ^ { * } = \epsilon _ { L } ^ { * } \frac { \partial \hat { v } _ { L } } { \partial v _ { L - 1 } } = ( T - \hat { v } _ { L } ^ { * } ) \frac { \partial \hat { v } _ { L } } { \partial v _ { L - 1 } }
73
+ $$
74
+
75
+ since, $\begin{array} { r } { ( T - \hat { v } _ { L } ) = \frac { \partial L } { \partial \hat { v } _ { L } } } \end{array}$ , we can then write,
76
+
77
+ $$
78
+ \epsilon _ { L - 1 } ^ { * } = { \frac { \partial L } { \partial { \hat { v } } _ { L } } } { \frac { \partial { \hat { v } } _ { L } } { \partial v _ { L - 1 } } } = { \frac { \partial L } { \partial v _ { L - 1 } } }
79
+ $$
80
+
81
+ Thus the prediction errors of the penultimate nodes converge to the correct backpropagated gradient. Furthermore, recursing through the graph from children to parents allows the correct gradients to be computed3. Thus, by induction, we have shown that the fixed points of the prediction errors of the global optimization correspond exactly to the backpropagated gradients. Intuitively, if we imagine the computation-graph as a chain and the error as ’tension’ in the chain, backprop loads all the tension at the end (the output) and then systematically propagates it backwards. Predictive coding, however, spreads the tension throughout the entire chain until it reaches an equilibrium where the amount of tension at each link is precisely the backpropagated gradient. The full algorithm for training the predictive coding network is explicitly set out in Algorithm 1. Inference is just a forward pass through the network, and is identical to the corresponding ANN.
82
+
83
+ By a similar argument, it is apparent that the dynamics of the parameters $\theta _ { i }$ as a gradient descent on $\mathcal { F }$ also exactly match the backpropagated parameter gradients.
84
+
85
+ $$
86
+ \begin{array} { r } { \frac { d \theta _ { i } } { d t } = \frac { d \mathcal { F } } { d \theta _ { i } } = \epsilon _ { i } ^ { * } \frac { d \epsilon _ { i } ^ { * } } { d \theta _ { i } } } \\ { = \frac { d L } { d \hat { v } _ { i } } \frac { d \hat { v } _ { i } } { d \theta _ { i } } = \frac { d L } { d \theta _ { i } } } \end{array}
87
+ $$
88
+
89
+ Which follows from the fact that $\begin{array} { r } { \epsilon _ { i } ^ { * } = \frac { d L } { d \hat { v } _ { i } } } \end{array}$ and that $\begin{array} { r } { \frac { d \epsilon _ { i } ^ { * } } { d \theta } = \frac { d \hat { v } _ { i } } { d \theta _ { i } } } \end{array}$ .
90
+
91
+ # 3 RELATED WORK
92
+
93
+ A number of recent works have tried to provide biologically plausible approximations to backprop. The requirement of symmetry between the forwards and backwards weights has been questioned by Lillicrap et al. (2016) who show that random fixed feedback weights suffice for effective learning. Recent additional work has shown that learning the backwards weights also helps (Amit, 2019; Akrout et al., 2019). Several schemes have also been proposed to approximate backprop using only local learning rules and/or Hebbian connectivity. These include target-prop (Lee et al., 2015) which approximate the backward gradients with trained inverse functions, but which fails to asymptotically compute the exact backprop gradients, and contrastive Hebbian (Seung, 2003; Scellier and Bengio, 2017; Scellier et al., 2018) approaches which do exactly approximate backprop, but which require two separate learning phases and the storing of information across successive phases. There are also dendritic error theories (Guerguiev et al., 2017; Sacramento et al., 2018) which are computationally similar to predictive coding (Whittington and Bogacz, 2019; Lillicrap et al., 2020). Whittington and Bogacz (2017) showed that predictive coding can approximate backprop in MLP models, and demonstrated comparable performance on MNIST. We advance upon this work by extending the proof to arbitrary computation graphs, enabling the design of predictive coding variants of a range of standard machine learning architectures, which we show perform comparably to backprop on considerably more difficult tasks than MNIST. Our algorithm evinces asymptotic (and in practice rapid) convergence to the exact backprop gradients, does not require separate learning phases, and utilises only local information and largely Hebbian plasticity.
94
+
95
+ # 4 RESULTS
96
+
97
+ # 4.1 NUMERICAL RESULTS
98
+
99
+ To demonstrate the correctness of our derivation and empirical convergence to the true gradients, we present a numerical test in the simple scalar case, where we use predictive coding to derive the√ gradients of an arbitrary, highly nonlinear test function $v _ { L } = \tan ( \sqrt { \theta v _ { 0 } } ) + \sin ( v _ { 0 } ^ { 2 } )$ where $\theta$ is an arbitrary parameter. For our tests, we set $v _ { 0 }$ to 5 and $\theta$ to 2. The computation graph for this function is presented in Figure 2. Although simple, this is a good test of predictive coding because the function is highly nonlinear, and its computation graph does not follow a simple layer structure but includes some branching. An arbitrary target of $T = 3$ was set at the output and the gradient of the loss $L = ( v _ { L } - T ) ^ { 2 }$ with respect to the input $v _ { 0 }$ was computed by predictive coding. We show (Figure 2) that the predictive coding optimisation rapidly converges to the exact numerical gradients computed by automatic differentiation, and that moreover this optimization is very robust and can handle even exceptionally high learning rates (up to 0.5) without divergence.
100
+
101
+ In summary, we have shown and numerically verified that at the equilibrium point of the global free-energy $\mathcal { F }$ on an arbitrary computation graph, the error units exactly equal the backpropagated gradients, and that this descent requires only local connectivity, does not require a separate phases or a sequential backwards sweep, and in the case of parameter-linear functions, requires only Hebbian plasticity. Our results provide a straightforward recipe for the direct implementation of predictive coding algorithms to approximate certain computation graphs, such as those found in common machine learning algorithms, in a potentially biologically plausible manner. Next, we showcase this capability by developing predictive coding variants of core machine learning architectures - convolutional neural networks (CNNs) recurrent neural networks (RNNs) and LSTMs (Hochreiter and Schmidhuber, 1997), and show performance comparable with backprop on tasks substantially more challenging than MNIST.
102
+
103
+ ![](images/9292bbe1ae88d409a9f3b91bda3253d79ee3cee4f06cd726f87d6fc16ddfe1e2.jpg)
104
+ Figure 2: Top: The computation graph of the nonlinear test function $v _ { L } = \tan ( \sqrt { \theta v _ { 0 } } ) + \sin ( v _ { 0 } ^ { 2 } )$ . Bottom: graphs of the log mean divergence from the true gradient and the divergence for different learning rates. Convergence to the exact gradients is exponential and robust to high learning rates.
105
+
106
+ ![](images/f9a6b6083a67fa6d2cb4502bc302488ebf2dcac1a82f7188dbbfd139f701ba51.jpg)
107
+ Figure 3: Training and test accuracy plots for the Predictive Coding and Backprop CNN on SVHN,CIFAR10, and CIFAR10 dataest over 5 seeds. Performance is largely indistinguishable. Due to the need to iterate the vs until convergence, the predictive coding network had roughly a $1 0 0 \mathrm { x }$ greater computational cost than the backprop network.
108
+
109
+ First, we constructed predictive coding CNN models (see Appendix B for full implementation details). In the predictive coding CNN, each filter kernel was augmented with ‘error maps’ which measured the difference between the forward convolutional predictions and the backwards messages. Our CNN was composed of a convolutional layer, followed by a max-pooling layer, then two further convolutional layers followed by 3 fully-connected layers. We compared our predictive coding CNN to a backprop-trained CNN with the exact same architecture and hyperparameters. We tested our models on three image classification datasets significantly more challenging than MNIST – SVHN, CIFAR10, and CIFAR100. SVHN is a digit recognition task like MNIST, but has more naturalistic backgrounds, is in colour with continuously varying inputs and contains distractor digits. CIFAR10 and CIFAR100 are large image datasets composed of RGB $3 2 \mathbf { x } 3 2$ images. CIFAR10 has
110
+
111
+ 10 classes of image, while CIFAR100 is substantially more challenging with 100 possible classes. In general (Figure 3), performance was identical between the predictive coding and backprop CNNs and comparable to the standard performance of basic CNN models on these datasets, Moreover, the predictive coding gradient remained close to the true numerical gradient throughout training.
112
+
113
+ ![](images/4ebd0a0a4e44e28d41c7b437a46155ae83ced6a07d907922b968c52a55aebf61.jpg)
114
+ Figure 4: Test accuracy plots for the Predictive Coding and Backprop RNN and LSTM on their respective tasks, averaged over 5 seeds. Performance is again indistinguishable from backprop.
115
+
116
+ We also constructed predictive coding RNN and LSTM models, thus demonstrating the ability of predictive coding to scale to non-parameter-linear, branching, computation graphs. The RNN was trained on a character-level name classification task, while the LSTM was trained on a next-character prediction task on the full works of Shakespeare. Full implementation details can be found in Appendices B and C. LSTMs and RNNs are recurrent networks which are trained through backpropagation through time (BPTT). BPTT simply unrolls the network through time and backpropagates through the unrolled graph. Analogously we trained the predictive coding RNN and LSTM by applying predictive coding to the unrolled computation graph. The depth of the unrolled graph depends heavily on the sequence length, and in our tasks using a sequence length of 100 we still found that predictive coding evinced rapid convergence to the correct numerical gradient, and that the performance was approximately identical to the equivalent backprop-trained networks (Figure 3), thus showing that the algorithm is scalable even to very deep computation graphs.
117
+
118
+ # 5 DISCUSSION
119
+
120
+ We have shown that predictive coding provides a local and potentially biologically plausible approximation to backprop on arbitrary, deep, and branching computation graphs. Moreover, convergence to the exact backprop gradients is rapid and robust, even in extremely deep graphs such as the unrolled LSTM. Our algorithm is fully parallelizable, does not require separate phases, and can produce equivalent performance to backprop in core machine-learning architectures. These results broaden the horizon of local approximations to backprop by demonstrating that they can be implemented on arbitrary computation graphs, not only simple MLP architectures. Our work prescribes a straightforward recipe for backpropagating through any computation graph with predictive coding using only local learning rules. In the future, this process could potentially be made fully automatic and translated onto neuromorphic hardware. Our results also raise the possibility that the brain may implement machine-learning type architectures much more directly than often considered. Many lines of work suggest a close correspondence between the representations and activations of CNNs and activity in higher visual areas (Yamins et al., 2014; Tacchetti et al., 2017; Eickenberg et al., 2017; Khaligh-Razavi and Kriegeskorte, 2014; Lindsay, 2020), for instance, and this similarity may be found to extend to other machine learning architectures.
121
+
122
+ It is important to note that predictive coding, as advanced here, still retains some biologically implausible features. Although using only local and Hebbian updates, the predictive coding algorithm still requires identical forward and backwards weights, as well as mandating a very precise oneto-one connectivity structure between value neurons $v _ { i }$ and error neurons $\epsilon _ { i }$ . However, recent work (Millidge et al., 2020) has begun to show that these implausibilities can be relaxed using learnable backwards weights instead of requiring weight symmetry, and allowing for learnable dense connectivity between value and error neurons, without harm to performance in simple MLP settings. An additional limitation to the biological plausibility of our method is the fixed-prediction assumption, which requires that the feedforward pass values be somehow stored during the backwards iteration phase. In biological neurons this could potentially be implemented by utilizing synaptic mechanisms for maintaining information over short periods, such as eligibility traces, or alternatively through synchronised phase locking (Buzsaki, 2006). Alternatively, it is important to note that this fixed-prediction assumption is only required for exact convergence to backprop, and predictive coding networks have been shown to be able to attain strong discriminative classification performance without it (Whittington and Bogacz, 2017).
123
+
124
+ Although we have implemented three core machine learning architectures as predictive coding networks, we have nevertheless focused on relatively small and straightforward networks and thus both our backprop and predictive coding networks perform below the state of the art on the presented tasks. This is primarily because our focus was on demonstrating the theoretical convergence between the two algorithms. Nevertheless, we believe that due to the generality of our theoretical results, ’scaling up’ the existing architectures to implement performance-matched predictive coding versions of more advanced machine learning architectures such as resnets (He et al., 2016), GANs (Goodfellow et al., 2014), and transformers (Vaswani et al., 2017) should be relatively straightforward.
125
+
126
+ In terms of computational cost, one inference iteration in the predictive coding network is about as costly as a backprop backwards pass. Thus, due to using 100-200 iterations for full convergence, our algorithm is substantially more expensive than backprop which limits the scalability of our method. However, this serial cost is misleading when talking about highly parallel neural architectures. In the brain, neurons cannot wait for a sequential forward and backward sweep. By phrasing our algorithm as a global descent, our algorithm is fully parallel across layers. There is no waiting and no phases to be coordinated. Each neuron need only respond to its local driving inputs and downwards error signals. We believe that this local and parallelizable property of our algorithm may engender the possibility of substantially more efficient implementations on neuromorphic hardware (Furber et al., 2014; Merolla et al., 2014; Davies et al., 2018), which may ameliorate much of the computational overhead compared to backprop. Future work could also examine whether our method is more capable than backprop of handling the continuously varying inputs the brain is presented with in practice, rather than the artificial paradigm of being presented with a series of i.i.d. datapoints.
127
+
128
+ Our work also reveals a close connection between backprop and inference. Namely, the recursive computation of gradients is effectively a by-product of a variational-inference algorithm which infers the values of the vertices of the computation graph under a hierarchical Gaussian generative model. While the deep connections between stochastic gradient descent and inference in terms of Kalman filtering (Ruck et al., 1992; Ollivier, 2019) or MCMC sampling methods (Chen et al., 2014; Mandt et al., 2017) is known, the relation between recursive gradient computation itself and variational inference is underexplored except in the case of a single layer (Amari, 1995). Our method can provide a principled generalisation of backprop through the inverse-variance $\Sigma ^ { - 1 }$ parameters of the Gaussian generative model. These parameters weight the relative contribution of different factors to the overall gradient by their uncertainty, thus naturally handling the case of backprop with differentially noisy inputs. Moreover, the $\Sigma ^ { - 1 }$ parameters can be learnt as a gradient descent on $\mathcal { F }$ : $\begin{array} { r } { \frac { d \Sigma _ { i } } { d t } = - \frac { d \mathcal { F } } { d \Sigma _ { i } } = - \bar { \Sigma } _ { i } ^ { - 1 } \epsilon _ { i } \epsilon _ { i } ^ { T } \Sigma _ { i } ^ { - 1 } - \Sigma _ { i } ^ { - 1 } } \end{array}$ . This specific generalisation is afforded by the Gaussian form of the generative model, however, and other generative models may yield novel optimisation algorithms able to quantify and handle uncertainties throughout the entire computational graph.
129
+
130
+ # REFERENCES
131
+
132
+ Mohamed Akrout, Collin Wilson, Peter Humphreys, Timothy Lillicrap, and Douglas B Tweed. Deep learning without weight transport. In Advances in Neural Information Processing Systems, pages 974–982, 2019.
133
+ Shun-Ichi Amari. Information geometry of the em and em algorithms for neural networks. Neural networks, 8(9):1379–1408, 1995.
134
+ Yali Amit. Deep learning with asymmetric connections and hebbian updates. Frontiers in computational neuroscience, 13:18, 2019.
135
+ Brandon Amos and Denis Yarats. The differentiable cross-entropy method. arXiv preprint arXiv:1909.12830, 2019.
136
+ Ryszard Auksztulewicz and Karl Friston. Repetition suppression and its contextual determinants in predictive coding. cortex, 80:125–140, 2016.
137
+
138
+ Andre M Bastos, W Martin Usrey, Rick A Adams, George R Mangun, Pascal Fries, and Karl J Friston. Canonical microcircuits for predictive coding. Neuron, 76(4):695–711, 2012.
139
+
140
+ Atılım Gunes Baydin, Barak A Pearlmutter, Alexey Andreyevich Radul, and Jeffrey Mark Siskind. ¨ Automatic differentiation in machine learning: a survey. The Journal of Machine Learning Research, 18(1):5595–5637, 2017.
141
+
142
+ Matthew James Beal et al. Variational algorithms for approximate Bayesian inference. university of London London, 2003.
143
+
144
+ Yoshua Bengio and Asja Fischer. Early inference in energy-based models approximates backpropagation. arXiv preprint arXiv:1510.02777, 2015.
145
+
146
+ Yoshua Bengio, Thomas Mesnard, Asja Fischer, Saizheng Zhang, and Yuhuai Wu. Stdp-compatible approximation of backpropagation in an energy-based model. Neural computation, 29(3):555–577, 2017.
147
+
148
+ David M Blei, Alp Kucukelbir, and Jon D McAuliffe. Variational inference: A review for statisticians. Journal of the American statistical Association, 112(518):859–877, 2017.
149
+
150
+ Rafal Bogacz. A tutorial on the free-energy framework for modelling perception and learning. Journal of mathematical psychology, 76:198–211, 2017.
151
+
152
+ Christopher L Buckley, Chang Sub Kim, Simon McGregor, and Anil K Seth. The free energy principle for action and perception: A mathematical review. Journal of Mathematical Psychology, 81:55–79, 2017.
153
+
154
+ Gyorgy Buzsaki. Rhythms of the Brain. Oxford University Press, 2006.
155
+
156
+ Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems, pages 6571–6583, 2018.
157
+
158
+ Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient hamiltonian monte carlo. In International conference on machine learning, pages 1683–1691, 2014.
159
+
160
+ Francis Crick. The recent excitement about neural networks. Nature, 337(6203):129–132, 1989.
161
+
162
+ Mike Davies, Narayan Srinivasa, Tsung-Han Lin, Gautham Chinya, Yongqiang Cao, Sri Harsha Choday, Georgios Dimou, Prasad Joshi, Nabil Imam, Shweta Jain, et al. Loihi: A neuromorphic manycore processor with on-chip learning. IEEE Micro, 38(1):82–99, 2018.
163
+
164
+ Jonas Degrave, Michiel Hermans, Joni Dambre, and Francis Wyffels. A differentiable physics engine for deep learning in robotics. Frontiers in neurorobotics, 13:6, 2019.
165
+
166
+ Michael Eickenberg, Alexandre Gramfort, Gael Varoquaux, and Bertrand Thirion. Seeing it all: ¨ Convolutional network layers map the function of the human visual system. NeuroImage, 152: 184–194, 2017.
167
+
168
+ Harriet Feldman and Karl Friston. Attention, uncertainty, and free-energy. Frontiers in human neuroscience, 4:215, 2010.
169
+
170
+ Karl Friston. Learning and inference in the brain. Neural Networks, 16(9):1325–1352, 2003.
171
+
172
+ Karl Friston. A theory of cortical responses. Philosophical transactions of the Royal Society B: Biological sciences, 360(1456):815–836, 2005.
173
+
174
+ Karl Friston. Hierarchical models in the brain. PLoS computational biology, 4(11), 2008.
175
+
176
+ Steve B Furber, Francesco Galluppi, Steve Temple, and Luis A Plana. The spinnaker project. Proceedings of the IEEE, 102(5):652–665, 2014.
177
+
178
+ 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.
179
+
180
+ Andreas Griewank et al. On automatic differentiation. Mathematical Programming: recent developments and applications, 6(6):83–107, 1989.
181
+
182
+ Jordan Guerguiev, Timothy P Lillicrap, and Blake A Richards. Towards deep learning with segregated dendrites. Elife, 6:e22901, 2017.
183
+
184
+ Demis Hassabis, Dharshan Kumaran, Christopher Summerfield, and Matthew Botvinick. Neuroscience-inspired artificial intelligence. Neuron, 95(2):245–258, 2017.
185
+
186
+ Jeff Hawkins and Sandra Blakeslee. On intelligence: How a new understanding of the brain will lead to the creation of truly intelligent machines. Macmillan, 2007.
187
+
188
+ 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.
189
+
190
+ Eric Heiden, David Millard, and Gaurav Sukhatme. Real2sim transfer using differentiable physics. In Workshop on Closing the Reality Gap in Sim2real Transfer for Robotic Manipulation, 2019.
191
+
192
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
193
+
194
+ Jakob Hohwy, Andreas Roepstorff, and Karl Friston. Predictive coding explains binocular rivalry: An epistemological review. Cognition, 108(3):687–701, 2008.
195
+
196
+ Mike Innes, Alan Edelman, Keno Fischer, Chris Rackauckus, Elliot Saba, Viral B Shah, and Will Tebbutt. Zygote: A differentiable programming system to bridge machine learning and scientific computing. arXiv preprint arXiv:1907.07587, 2019.
197
+
198
+ Ryota Kanai, Yutaka Komura, Stewart Shipp, and Karl Friston. Cerebral hierarchies: predictive processing, precision and the pulvinar. Philosophical Transactions of the Royal Society B: Biological Sciences, 370(1668):20140169, 2015.
199
+
200
+ Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
201
+
202
+ Seyed-Mahdi Khaligh-Razavi and Nikolaus Kriegeskorte. Deep supervised, but not unsupervised, models may explain it cortical representation. PLoS computational biology, 10(11), 2014.
203
+
204
+ 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.
205
+
206
+ Dong-Hyun Lee, Saizheng Zhang, Asja Fischer, and Yoshua Bengio. Difference target propagation. In Joint european conference on machine learning and knowledge discovery in databases, pages 498–515. Springer, 2015.
207
+
208
+ Qianli Liao, Joel Z Leibo, and Tomaso Poggio. How important is weight symmetry in backpropagation? In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
209
+
210
+ Timothy P Lillicrap and Adam Santoro. Backpropagation through time and the brain. Current opinion in neurobiology, 55:82–89, 2019.
211
+
212
+ 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(1): 1–10, 2016.
213
+
214
+ Timothy P Lillicrap, Adam Santoro, Luke Marris, Colin J Akerman, and Geoffrey Hinton. Backpropagation and the brain. Nature Reviews Neuroscience, pages 1–12, 2020.
215
+
216
+ Grace Lindsay. Convolutional neural networks as a model of the visual system: past, present, and future. Journal of Cognitive Neuroscience, pages 1–15, 2020.
217
+
218
+ Seppo Linnainmaa. The representation of the cumulative rounding error of an algorithm as a taylor expansion of the local rounding errors. Master’s Thesis (in Finnish), Univ. Helsinki, pages 6–7, 1970.
219
+
220
+ William Lotter, Gabriel Kreiman, and David Cox. Deep predictive coding networks for video prediction and unsupervised learning. arXiv preprint arXiv:1605.08104, 2016.
221
+
222
+ Stephan Mandt, Matthew D Hoffman, and David M Blei. Stochastic gradient descent as approximate bayesian inference. The Journal of Machine Learning Research, 18(1):4873–4907, 2017.
223
+
224
+ Paul A Merolla, John V Arthur, Rodrigo Alvarez-Icaza, Andrew S Cassidy, Jun Sawada, Filipp Akopyan, Bryan L Jackson, Nabil Imam, Chen Guo, Yutaka Nakamura, et al. A million spikingneuron integrated circuit with a scalable communication network and interface. Science, 345 (6197):668–673, 2014.
225
+
226
+ Beren Millidge, Alexander Tschantz, Anil Seth, and Christopher L Buckley. Relaxing the constraints on predictive coding models. arXiv preprint arXiv:2010.01047, 2020.
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, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
229
+
230
+ Masashi Okada, Luca Rigazio, and Takenobu Aoshima. Path integral networks: End-to-end differentiable optimal control. arXiv preprint arXiv:1706.09597, 2017.
231
+
232
+ Yann Ollivier. The extended kalman filter is a natural gradient descent in trajectory space. arXiv preprint arXiv:1901.00696, 2019.
233
+
234
+ Yann Ollivier, Corentin Tallec, and Guillaume Charpiat. Training recurrent networks online without backtracking. arXiv preprint arXiv:1507.07680, 2015.
235
+
236
+ Alexander Ororbia, Ankur Mali, C Lee Giles, and Daniel Kifer. Continual learning of recurrent neural networks by locally aligning distributed representations. IEEE Transactions on Neural Networks and Learning Systems, 2020.
237
+
238
+ Avik Pal. Raytracer. jl: A differentiable renderer that supports parameter optimization for scene reconstruction. arXiv preprint arXiv:1907.07198, 2019.
239
+
240
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
241
+
242
+ Chris Rackauckas, Mike Innes, Yingbo Ma, Jesse Bettencourt, Lyndon White, and Vaibhav Dixit. Diffeqflux. jl-a julia library for neural differential equations. arXiv preprint arXiv:1902.02376, 2019.
243
+
244
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8):9, 2019.
245
+
246
+ Rajesh PN Rao and Dana H Ballard. Predictive coding in the visual cortex: a functional interpretation of some extra-classical receptive-field effects. Nature neuroscience, 2(1):79–87, 1999.
247
+
248
+ Jarrett Revels, Miles Lubin, and Theodore Papamarkou. Forward-mode automatic differentiation in julia. arXiv preprint arXiv:1607.07892, 2016.
249
+
250
+ Blake A Richards, Timothy P Lillicrap, Philippe Beaudoin, Yoshua Bengio, Rafal Bogacz, Amelia Christensen, Claudia Clopath, Rui Ponte Costa, Archy de Berker, Surya Ganguli, et al. A deep learning framework for neuroscience. Nature neuroscience, 22(11):1761–1770, 2019.
251
+
252
+ Dennis W. Ruck, Steven K. Rogers, Matthew Kabrisky, Peter S. Maybeck, and Mark E. Oxley. Comparative analysis of backpropagation and the extended kalman filter for training multilayer perceptrons. IEEE Transactions on Pattern Analysis & Machine Intelligence, (6):686–691, 1992.
253
+
254
+ David E Rumelhart and David Zipser. Feature discovery by competitive learning. Cognitive science, 9(1):75–112, 1985.
255
+
256
+ Joao Sacramento, Rui Ponte Costa, Yoshua Bengio, and Walter Senn. Dendritic cortical microcircuits ˜ approximate the backpropagation algorithm. In Advances in Neural Information Processing Systems, pages 8721–8732, 2018.
257
+
258
+ Benjamin Scellier and Yoshua Bengio. Equilibrium propagation: Bridging the gap between energybased models and backpropagation. Frontiers in computational neuroscience, 11:24, 2017.
259
+
260
+ Benjamin Scellier, Anirudh Goyal, Jonathan Binas, Thomas Mesnard, and Yoshua Bengio. Generalization of equilibrium propagation to vector field dynamics. arXiv preprint arXiv:1808.04873, 2018.
261
+
262
+ Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. arXiv preprint arXiv:1911.08265, 2019.
263
+
264
+ H Sebastian Seung. Learning in spiking neural networks by reinforcement of stochastic synaptic transmission. Neuron, 40(6):1063–1073, 2003.
265
+
266
+ Stewart Shipp. Neural elements for predictive coding. Frontiers in psychology, 7:1792, 2016.
267
+
268
+ 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.
269
+
270
+ Michael W Spratling. Reconciling predictive coding and biased competition models of cortical function. Frontiers in computational neuroscience, 2:4, 2008.
271
+
272
+ Jochen J Steil. Backpropagation-decorrelation: online recurrent learning with o (n) complexity. In 2004 IEEE International Joint Conference on Neural Networks (IEEE Cat. No. 04CH37541), volume 2, pages 843–848. IEEE, 2004.
273
+
274
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015.
275
+
276
+ Andrea Tacchetti, Leyla Isik, and Tomaso Poggio. Invariant recognition drives neural representations of action sequences. PLoS computational biology, 13(12):e1005859, 2017.
277
+
278
+ Corentin Tallec and Yann Ollivier. Unbiased online recurrent optimization. arXiv preprint arXiv:1702.05043, 2017.
279
+
280
+ Belinda Tzen and Maxim Raginsky. Neural stochastic differential equations: Deep latent gaussian models in the diffusion limit. arXiv preprint arXiv:1905.09883, 2019.
281
+
282
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017.
283
+
284
+ Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michael Mathieu, Andrew Dudzik, Junyoung ¨ Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
285
+
286
+ Eiji Watanabe, Akiyoshi Kitaoka, Kiwako Sakamoto, Masaki Yasugi, and Kenta Tanaka. Illusory motion reproduced by deep neural networks trained for prediction. Frontiers in psychology, 9:345, 2018.
287
+
288
+ Veith Weilnhammer, Heiner Stuke, Guido Hesselmann, Philipp Sterzer, and Katharina Schmack. A predictive coding account of bistable perception-a model-based fmri study. PLoS computational biology, 13(5):e1005536, 2017.
289
+
290
+ Paul J Werbos. Applications of advances in nonlinear sensitivity analysis. In System modeling and optimization, pages 762–770. Springer, 1982.
291
+
292
+ 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.
293
+
294
+ James CR Whittington and Rafal Bogacz. Theories of error back-propagation in the brain. Trends in cognitive sciences, 2019.
295
+
296
+ Ronald J Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural computation, 1(2):270–280, 1989.
297
+
298
+ Daniel LK Yamins, Ha Hong, Charles F Cadieu, Ethan A Solomon, Darren Seibert, and James J DiCarlo. Performance-optimized hierarchical models predict neural responses in higher visual cortex. Proceedings of the National Academy of Sciences, 111(23):8619–8624, 2014.
299
+
300
+ # APPENDIX A: PREDICTIVE CODING CNN IMPLEMENTATION DETAILS
301
+
302
+ The key concept in a CNN is that of an image convolution, where a small weight matrix is ’slid’ (or convolved) across an image to produce an output image. Each patch of the output image only depends on a relatively small patch of the input image. Moreover, the weights of the filter stay the same during the convolution, so each pixel of the output image is generated using the same weights. The weight sharing implicit in the convolution operation enforces translational invariance, since different image patches are all processed with the same weights.
303
+
304
+ The forward equations of a convolutional layer for a specific output pixel
305
+
306
+ $$
307
+ v _ { i , j } = \sum _ { k = i - f } ^ { k = i + f } \sum _ { l = j - f } ^ { l = j + f } \theta _ { k , l } x _ { i + k , j + l }
308
+ $$
309
+
310
+ Where $v _ { i , j }$ is the $( i , j )$ th element of the output, $x _ { i , j }$ is the element of the input image and $\theta _ { k , l }$ is an weight element of a feature map. To setup a predictive coding CNN, we augment each intermediate $x _ { i }$ and $v _ { i }$ with error units $\epsilon _ { i }$ of the same dimension as the output of the convolutional layer.
311
+
312
+ Predictions $\hat { v }$ are projected forward using the forward equations. Prediction errors also need to be transmitted backwards for the architecture to work. To achieve this we must have that prediction errors are transmitted upwards by a ’backwards convolution’. We thus define the backwards prediction errors $\hat { \epsilon } _ { j }$ as follows:
313
+
314
+ $$
315
+ \hat { \epsilon } _ { i , j } = \sum _ { k = i - f } ^ { i + f } \sum _ { l = j - f } ^ { j + f } \theta _ { j , i } \tilde { \epsilon } _ { i , j }
316
+ $$
317
+
318
+ Where ˜ is an error map zero-padded to ensure the correct convolutional output size. Inference in the predictive coding network then proceeds by updating the intermediate values of each layer as follows:
319
+
320
+ $$
321
+ \frac { d v _ { l } } { d t } = \epsilon _ { l } - \hat { \epsilon } _ { l + 1 }
322
+ $$
323
+
324
+ Since the CNN is also parameter-linear, weights can be updated using the simple Hebbian rule of the multiplication of the pre and post synaptic potentials.
325
+
326
+ $$
327
+ \frac { d \theta _ { l } } { d t } = \sum _ { i , j } \epsilon _ { l _ { i , j } } v _ { l - 1 _ { i , j } } T
328
+ $$
329
+
330
+ There is an additional biological implausibility here due to the weight sharing of the CNN. Since the same weights are copied for each position on the image, the weight updates have contributions from all aspects of the image simultaneously which violates the locality condition. A simple fix for this, which makes the network scheme plausible is to simply give each position on the image a filter with separate weights, thus removing the weight sharing implicit in the CNN. In effect this gives each patch of pixels a local receptive field with its own set of weights. The performance and scalability of such a locally connected predictive coding architecture would be an interesting avenue for future work, as this architecture has substantial homologies with the structure of the visual cortex.
331
+
332
+ ![](images/b664fbe6caf747614fa35efbf0abd00377ef9548ee42cf7cd732c0e10c4eeea1.jpg)
333
+ Figure 5: Training loss plots for the Predictive Coding and Backprop CNN on SVHN,CIFAR10, and CIFAR10 dataset over 5 seeds.
334
+
335
+ In our experiments we used a relatively simple CNN architecture consisting of one convolutional layer of kernel size 5, and a filter bank of 6 filters. This was followed by a max-pooling layer with a (2,2) kernel and a further convolutional layer with a (5,5) kernel and filter bank of 16 filters. This was then followed by three fully connected layers of 200, 150, and 10 (or 100 for CIFAR100) output units. Each convolutional and fully connected layer used the relu activation function, except the output layer which was linear. Although this architecture is far smaller than state of the art for convolutional networks, the primary point of our paper was to demonstrate the equivalence of predictive coding and backprop. Further work could investigate scaling up predictive coding to more state-of-the-art architectures.
336
+
337
+ Our datasets consisted of $3 2 \mathbf { x } 3 2$ RGB images. We normalised the values of all pixels of each image to lie between 0 and 1, but otherwise performed no other image preprocessing. We did not use data augmentation of any kind. We set the weight learning rate for the predictive coding and backprop networks 0.0001. A minibatch size of 64 was used. These parameters were chosen without any detailed hyperparameter search and so are likely suboptimal. The magnitude of the gradient updates was clamped to lie between -50 and 50 in all of our models. This was done to prevent divergences, as occasionally occurred in the LSTM networks, likely due to exploding gradients.
338
+
339
+ The predictive coding scheme converged to the exact backprop gradients very precisely within 100 inference iterations using an inference learning rate of 0.1. This gives the predictive coding CNN approximately a $1 0 0 \mathrm { x }$ computational overhead compared to backprop. The divergence between the true and approximate gradients remained approximately constant throughout training, as shown by Figure 5, which shows the mean divergence for each layer of the CNN over the course of an example training run on the CIFAR10 dataset. The training loss of the predictive coding and backprop networks for SVHN, CIFAR10 and CIFAR100 are presented in Figure 4.
340
+
341
+ While the experiments in the main paper all used the mean-squared-error loss function, it is also possible to use alternative loss functions. In Figure 6, we show performance of the CNN on CIFAR and SVHN datasets is also very close to backprop when trained with a multi-class cross-entropy loss $\begin{array} { r } { L = \sum _ { i } T _ { i } \ln v _ { L i } } \end{array}$ . In this case the output layer used a softmax function as its nonlinearity, to ensure that the logits passed to the cross-entropy loss were valid probabilities. The cross-entropy loss is also straightforward to fit into the predictive coding framework since the gradient with respect to the pre-activations of the output is also just the negative prediction error ∂L∂v = T − vL, although the softmax function itself may be challenging to implement neurally since it is non-local as its’ normalisation coefficient requires of the exponentiated activities of all neurons in a layer. Nevertheless, this demonstrates that predictive coding can approximate backprop for any given loss function, not simply mean-square-error.
342
+
343
+ # APPENDIX B: PREDICTIVE CODING RNN
344
+
345
+ The computation graph on RNNs is relatively straightforward. We consider only a single layer RNN here although the architecture can be straightforwardly extended to hierarchically stacked RNNs. An RNN is similar to a feedforward network except that it possesses an additional hidden state $h$ which is maintained and updated over time as a function of both the current input $x$ and the previous hidden
346
+
347
+ ![](images/a30ecab114aa30238c977f454f0809ecfea468475120e1d6723be1b6a5498cc1.jpg)
348
+ Mean divergence between the true numerical and predictive coding backprops over the course of training. In general, the divergence appeared to follow a largely random walk pattern, and was generally neglible. Importantly, the divergence did not grow over time throughout training, implying that errors from slightly incorrect gradients did not appear to compound.
349
+
350
+ ![](images/e3fe87e900e6253bb61c1bd01ab0706a0ca2b370e86f7de2b833835c76242eb7.jpg)
351
+ (b) CIFAR training accuracy
352
+
353
+ ![](images/662c1c1e4c08635462aa7c2e474d6cd0ffd2024f40cf0da2f47b8625a95ba9c9.jpg)
354
+ (c) CIFAR test accuracy
355
+
356
+ Training and test accuracies of the CNN network on the SVHN and CIFAR datasets using the cross-entropy loss. As can be seen performance remains very close to backprop, thus demonstrating that our predictive coding algorithm can be used with different loss functions, not just mean-squared-error.
357
+
358
+ state. The output of the network $y$ is a function of $h$ . By considering the RNN at a single timestep we obtain the following equations.
359
+
360
+ $$
361
+ \begin{array} { l } { h _ { t } = f ( \theta _ { h } h _ { t - 1 } + \theta _ { x } x _ { t } ) } \\ { y _ { t } = g ( \theta _ { y } h _ { t } ) } \end{array}
362
+ $$
363
+
364
+ Where f and $\mathbf { g }$ are elementwise nonlinear activation functions. And $\theta _ { h } , \theta _ { x } , \theta _ { y }$ are weight matrices for each specific input. To predict a sequence the RNN simply rolls forward the above equations to generate new predictions and hidden states at each timestep.
365
+
366
+ RNNs are typically trained through an algorithm called backpropagation through time (BPTT) which essentially just unrolls the RNN into a single feedforward computation graph and then performs backpropagation through this unrolled graph. To train the RNN using predictive coding we take the same approach and simply apply predictive coding to the unrolled graph.
367
+
368
+ It is important to note that this is an additional aspect of biological implausibility that we do not address in this paper. BPTT requires updates to proceed backwards through time from the end of the sequence to the beginning. Ignoring any biological implausibility with the rules themselves, this updating sequence is clearly not biologically plausible as naively it requires maintaining the entire sequence of predictions and prediction errors perfectly in memory until the end of the sequence, and waiting until the sequence ends before making any updates. There is a small literature on trying to produce biologically plausible, or forward-looking approximations to BPTT which does not require updates to be propagated back through time (Williams and Zipser, 1989; Lillicrap and Santoro, 2019; Steil, 2004; Ollivier et al., 2015; Tallec and Ollivier, 2017). While this is a fascinating area, we do not address it in this paper. We are solely concerned with the fact that predictive coding approximates backpropagation on feedforward computation graphs for which the unrolled RNN graph is a sufficient substrate.
369
+
370
+ To learn a predictive coding RNN, we first augment each of the variables $h _ { t }$ and $y _ { t }$ of the original graph with additional error units $\epsilon _ { h _ { t } }$ and $\epsilon _ { y _ { t } }$ . Predictions $\hat { y } _ { t } , \hat { h } _ { t }$ are generated according to the feedforward rules (16). A sequence of true labels $\{ T _ { 1 } . . . T _ { T } \}$ is then presented to the network, and then inference proceeds by recursively applying the following rules backwards through time until convergence.
371
+
372
+ $$
373
+ \begin{array} { r l } & { \epsilon _ { y _ { t } } = L - \hat { y } _ { t } } \\ & { \epsilon _ { h _ { t } } = h _ { t } - \hat { h } _ { t } } \\ & { \frac { d h _ { t } } { d t } = \epsilon _ { h _ { t } } - \epsilon _ { y _ { t } } \theta _ { y } ^ { T } - \epsilon _ { h _ { t + 1 } } \theta _ { h } ^ { T } } \end{array}
374
+ $$
375
+
376
+ Upon convergence the weights are updated according to the following rules.
377
+
378
+ $$
379
+ \begin{array} { l } { \displaystyle \frac { d \theta _ { y } } { d t } = \sum _ { t = 0 } ^ { T } \epsilon _ { y _ { t } } \frac { \partial g ( \theta _ { y } h _ { t } ) } { \partial \theta _ { y } } h _ { t } ^ { T } } \\ { \displaystyle \frac { d \theta _ { x } } { d t } = \sum _ { t = 0 } ^ { T } \epsilon _ { h _ { t } } \frac { \partial f ( \theta _ { h } h _ { t - 1 } + \theta _ { x } x _ { t } ) } { \partial \theta _ { x } } x _ { t } ^ { T } } \\ { \displaystyle \frac { d \theta _ { h } } { d t } = \sum _ { t = 0 } ^ { T } \epsilon _ { h _ { t } } \frac { \partial f ( \theta _ { h } h _ { t - 1 } + \theta _ { x } x _ { t } ) } { \partial \theta _ { h } } h _ { t + 1 } ^ { T } } \end{array}
380
+ $$
381
+
382
+ Since the RNN feedforward updates are parameter-linear, these rules are Hebbian, only requiring the multiplication of pre and post-synaptic potentials. This means that the predictive coding updates proposed here are biologically plausible and could in theory be implemented in the brain. The only biological implausibility remains the BPTT learning scheme.
383
+
384
+ Our RNN was trained on a simple character-level name-origin dataset which can be found here: https://download.pytorch.org/tutorial/data.zip. The RNN was presented with sequences of characters representing names and had to predict the national origin of the name – French, Spanish, Russian, etc. The characters were presented to the network as one-hot-encoded vectors without any embedding. The output categories were also presented as a one-hot vector. The RNN has a hidden size of 256 units. A tanh nonlinearity was used between hidden states and the output layer was linear. The network was trained on randomly selected name-category pairs from the dataset. The training loss for the predictive coding and backprop RNNs, averaged over 5 seeds is presented below (Figure 7).
385
+
386
+ ![](images/a48a307bc5ea3c6954a93c1648d78aa66eb72139165d022203026ca618dd3749.jpg)
387
+ Figure 8: Training losses for the predictive coding and backprop RNN. As expected, they are effectively identical.
388
+
389
+ # APPENDIX C: PREDICTIVE CODING LSTM IMPLEMENTATION DETAILS
390
+
391
+ ![](images/f5f44449d51e595ebfb774e53ea4ba3f9f4c443e953647791bf19df12d73ff38.jpg)
392
+ Figure 9: Computation graph and backprop learning rules for a single LSTM cell.
393
+
394
+ Unlike the other two models, the LSTM possesses a complex and branching internal computation graph, and is thus a good opportunity to make explicit the predictive coding ’recipe’ for approximating backprop on arbitrary computation graphs. The computation graph for a single LSTM cell is shown (with backprop updates) in Figure 8. Prediction for the LSTM occurs by simply rolling forward a copy of the LSTM cell for each timestep. The LSTM cell receives its hidden state $h _ { t }$ and cell state $c _ { t }$ from the previous timestep. During training we compute derivatives on the unrolled computation graph and receive backwards derivatives (or prediction errors) from the LSTM cell at time $t + 1$ .
395
+
396
+ The equations that specify the computation graph of the LSTM cell are as follows.
397
+
398
+ $$
399
+ \begin{array} { r l } & { v _ { 1 } = h _ { i } \oplus \hat { \varpi } x _ { t } } \\ & { v _ { 2 } = \sigma ( \theta _ { i } v _ { 1 } ) } \\ & { v _ { 3 } = c _ { i } v _ { 2 } } \\ & { v _ { 4 } = \sigma ( \theta _ { i n p } v _ { 1 } ) } \\ & { v _ { 5 } = \mathrm { t a n h } ( \theta _ { e } v _ { 1 } ) } \\ & { v _ { 6 } = v _ { 1 } v _ { 5 } } \\ & { v _ { 7 } = v _ { 3 } + v _ { 6 } } \\ & { v _ { 8 } = \sigma ( \theta _ { o } v _ { 1 } ) } \\ & { v _ { 9 } = \mathrm { t a n h } ( v _ { 7 } ) } \\ & { v _ { 1 0 } = v _ { 8 } v _ { 9 } } \\ & { y = \sigma ( \theta _ { o } v _ { 1 0 } ) } \end{array}
400
+ $$
401
+
402
+ The recipe to convert this computation graph into a predictive coding algorithm is straightforward.
403
+ We first rewire the connectivity so that the predictions are set to the forward functions of their parents.
404
+ We then compute the errors between the vertices and the predictions.
405
+
406
+ $$
407
+ \begin{array} { r l } & { \mathrm { ~ V _ { 2 } ~ } = - \nu _ { 1 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 } ~ } = \nu _ { 2 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 } ~ } = \nu _ { 3 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 3 } ~ } = - \nu _ { 4 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 4 } ~ } = - \nu _ { 4 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 5 } ~ } = - \nu _ { 5 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 6 } ~ } = \nu _ { 5 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 7 } ~ } = \nu _ { 6 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 8 } ~ } = - \nu _ { 7 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 8 } ~ } = \nu _ { 7 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 8 } ~ } = - \nu _ { 8 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 8 } ~ } = - \nu _ { 1 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 9 } ~ } = \nu _ { 8 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 8 } ~ } = - \nu _ { 1 0 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 1 0 } ~ } = \nu _ { 1 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 1 0 } ~ } = \nu _ { 1 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 1 0 } ~ } = \nu _ { 1 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 0 } ~ } = \nu _ { 2 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 0 } ~ } = - \nu _ { 1 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 0 } ~ } = \nu _ { 2 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 0 } ~ } = \nu _ { 2 } \langle \mathbf { \lambda } \rangle , } \\ & { \mathrm { ~ V _ { 2 0 } ~ } = \nu _ { 2 } \langle \mathbf { \lambda } \rangle , } \end{array}
408
+ $$
409
+
410
+ During inference, the inputs $h _ { t } , x _ { t }$ and the output $y _ { t }$ are fixed. The vertices and then the prediction errors are updated according to Equation 2. This recipe is straightforward and can easily be extended to other more complex machine learning architectures. The full augmented computation graph, including the vertex update rules, is presented in Figure 9.
411
+
412
+ Empirically, we observed rapid convergence to the exact backprop gradients even in the case of very deep computation graphs (as is an unrolled LSTM with a sequence length of 100). Although convergence was slower than was the case for CNNs or lesser sequence lengths, it was still straightforward to achieve convergence to the exact numerical gradients with sufficient iterations.
413
+
414
+ Below we plot the mean divergence between the predictive coding and true numerical gradients as a function of sequence length (and hence depth of graph) for a fixed computational budget of 200 iterations with an inference learning rate of 0.05. As can be seen, the divergence increases roughly linearly with sequence length. Importantly, even with long sequences, the divergence is not especially large, and can be decreased further by increasing the computational budget. As the increase is linear, we believe that predictive coding approaches should be scalable even for backpropagating through very deep and complex graphs.
415
+
416
+ ![](images/0e931b4f9a9e8c9ed5508cc55246ac5363b327e4e5c12a2949acb84ad02a7c32.jpg)
417
+ Figure 10: The LSTM cell computation graph augmented with error units, evincing the connectivity scheme of the predictive coding algorithm.
418
+
419
+ We also plot the number of iterations required to reach a given convergence threshold (here taken to be 0.005) as a function of sequence length (Figure 11). We see that the number of iterations required increases sublinearly with the sequence length, and likely asymptotes at about 300 iterations. Although this is a lot of iterations, the sublinear convergence nevertheless shows that the method can scale to even extremely deep graphs.
420
+
421
+ Our architecture consisted of a single LSTM layer (more complex architectures would consist of multiple stacked LSTM layers). The LSTM was trained on a next-character character-level prediction task. The dataset was the full works of Shakespeare, downloadable from Tensorflow. The text was shuffled and split into sequences of 50 characters, which were fed to the LSTM one character at a time. The LSTM was trained then to predict the next character, so as to ultimately be able to generate text. The characters were presented as one-hot-encoded vectors. The LSTM had a hidden size and a cell-size of 1056 units. A minibatch size of 64 was used and a weight learning rate of 0.0001 was used for both predictive coding and backprop networks. To achieve sufficient numerical convergence to the correct gradient, we used 200 variational iterations with an inference learning rate of 0.1. This rendered the predictive LSTM approximately $2 0 0 \mathrm { x }$ as costly as the backprop LSTM to run. A graph of the LSTM training loss for both predictive coding and backprop LSTMs, averaged over 5 random seeds, can be found below (Figure 12).
422
+
423
+ # APPENDIX D: DERIVATION OF THE FREE ENERGY FUNCTIONAL
424
+
425
+ Here we derive in detail the form of the free-energy functional used in sections 2 and 4. We also expand upon the assumptions required and the precise form of the generative model and variational density. Much of this material is presented with considerably more detail in Buckley et al. (2017), and more approachably in Bogacz (2017).
426
+
427
+ Given an arbitrary computation graph with vertices $\{ y _ { i } \}$ , which we treat as random variables. Here we treat explicitly an important fact that we glossed over for notational convenience in the introduction. The $v _ { i } \mathrm { s }$ which are optimized in the free-energy functional are technically the mean parameters of the variational density $Q ( y _ { i } ; v _ { i } , \sigma _ { i } ) -$ i.e. they represent the mean (variational) belief of the value of the vertex. The vertex values in the model, which we here denote as $\{ y _ { i } \}$ , are technically separate. However, due to our Gaussian assumptions, and the expectation under the variational density, in effect we end up replacing the $y _ { i }$ with the $v _ { i }$ and optimizing the $v _ { i } \mathbf { s }$ , so in the interests of space and notational simplicity we began as if the $v _ { i } \mathbf { s }$ were variables in the generative model, but they are not. They are parameters of the variational distribution.
428
+
429
+ ![](images/ee2d287bd0adf9fb47ec871e514ebe2834ac176d41728be5bc8093a0eef2cd95.jpg)
430
+ Figure 11: Divergence between predictive coding and numerical gradients as a function of sequence length.
431
+
432
+ ![](images/f9df0d6bfc0a1591c2ae85cca85c0188bb67df246d059af0356ea1ec3798fd25.jpg)
433
+ Figure 12: Number of iterations to reach convergence threshold as a function of sequence length.
434
+
435
+ ![](images/7866ef96faf5afea9d8a0d211e72752f807f5819c0c7c85ef034867cf9904cf0.jpg)
436
+ Figure 13: Training losses for the predictive coding and backprop LSTMs averaged over 5 seeds. The performance of the two training methods is effectively equivalent.
437
+
438
+ Given an input $y _ { 0 }$ and a target $y _ { N }$ (the multiple input and/or output case is a straightforward generalization). We wish to infer the posterior $p \big ( y _ { 1 : N - 1 } \big | y _ { 0 } , y _ { N } \big )$ . We approximate this intractable posterior with variational inference. Variational inference proceeds by defining an approximate posterior $Q \big ( y _ { 1 : N - 1 } ; \phi \big )$ with some arbitrary parameters $\phi$ . We then wish to minimize the KL divergence between the true and approximate posterior.
439
+
440
+ $$
441
+ \underset { \phi } { \operatorname { a r g m i n } } \ : \mathbb { K L } [ Q ( y _ { 1 : N - 1 } ; \phi ) | | p ( y _ { 1 : N - 1 } | y _ { 0 } , y _ { N } ) ]
442
+ $$
443
+
444
+ Although this KL is itself intractable, since it includes the intractable posterior, we can derive a tractable bound on this KL called the variational free-energy.
445
+
446
+ $$
447
+ \begin{array} { r l } & { \mathbb { E } \mathbb { L } [ Q ( y _ { 1 : N - 1 } ; \phi ) \| p ( y _ { 1 : N } | y _ { 0 } , y _ { N } ) ] = \mathbb { E } \mathbb { L } [ Q ( y _ { 1 : N - 1 } ) \| \frac { p ( y _ { 1 : N } , y _ { 0 } , y _ { N } ) } { p ( y _ { 0 } , y _ { N } ) } ] } \\ & { \qquad = \mathbb { E } \mathbb { L } [ Q ( y _ { 1 : N } ; \phi ) \| p ( y _ { 1 : N } , y _ { 0 } ) ] + \ln p ( y _ { 0 } , y _ { N } ) } \\ & { \qquad \Rightarrow \underbrace { \mathbb { K } \mathbb { L } [ Q ( y _ { 1 : N } ; \phi ) \| p ( y _ { 1 : N - 1 } , y _ { 0 } , y _ { N } ) ] } _ { - \mathcal { F } } \leq \mathbb { K } \mathbb { L } [ Q ( y _ { 1 : N - 1 } ; \phi ) \| p ( y _ { 1 } } \\ & { \qquad \quad - } \end{array}
448
+ $$
449
+
450
+ We define the negative free-energy $- \mathcal { F } = \mathbb { K L } [ Q ( y _ { 1 : N - 1 ) } | | p ( y _ { 1 : N - 1 } , y _ { 0 } , y _ { N } ) ]$ which is a lower bound on the divergence between the true and approximate posteriors. By thus maximizing the negative free-energy (which is identical to the ELBO (Beal et al., 2003; Blei et al., 2017)), or equivalently minimizing the free-energy, we decrease this divergence and make the variational distribution a better approximation to the true posterior.
451
+
452
+ To proceed further, it is necessary to define an explicit form of the generative model $p ( y _ { 0 } , y _ { 1 : N - 1 } , y _ { N } )$ and the approximate posterior $Q \big ( y _ { 1 : N - 1 } ; \phi \big )$ . In predictive coding, we define a hierarchical Gaussian generative model which mirrors the exact structure of the computation graph
453
+
454
+ $$
455
+ p ( \boldsymbol { y } _ { 0 : N } ) = \mathcal { N } ( \boldsymbol { y } _ { 0 } ; \boldsymbol { \bar { y _ { 0 } } } , \boldsymbol { \Sigma } _ { 0 } ) \prod _ { i = 1 } ^ { N } \mathcal { N } ( \boldsymbol { y } _ { i } ; \boldsymbol { f } ( \mathcal { P } ( \boldsymbol { y } _ { i } ) ; \boldsymbol { \theta } _ { \boldsymbol { y } _ { j } \in \mathcal { P } ( \boldsymbol { y } _ { i } ) } ) , \boldsymbol { \Sigma } _ { i } ) ;
456
+ $$
457
+
458
+ Where essentially each vertex $y _ { i }$ is a Gaussian with a mean which is a function of the prediction of all the parents of the vertex, and the parameters of their edge-functions. $\bar { y _ { 0 } }$ is effectively an ”input-prior” which is set to 0 throughout and ignored. The output vertices $y _ { N } = T$ are set to the target $T$ .
459
+
460
+ We also define the variational density to be Gaussian with mean $v _ { 1 : N - 1 }$ and variance $\sigma _ { 1 : N - 1 }$ , but under a mean field approximation, so that the approximation at each node is independent of all others
461
+
462
+ (note the variational variance is denoted $\sigma$ while the variance of the generative model is denoted $\Sigma$ . The lower-case $\sigma$ is not used to denote a scalar variable – both variances can be multivariate – but to distinguish between variational and generative variances)
463
+
464
+ $$
465
+ Q ( y _ { 1 : N - 1 } ; v _ { 1 : N - 1 } , \sigma _ { 1 : N - 1 } ) = \prod _ { i = 1 } ^ { N - 1 } \mathcal { N } ( y _ { i } ; v _ { i } , \sigma _ { i } )
466
+ $$
467
+
468
+ We now can express the free-energy functional concretely. First we decompose it as the sum of an energy and an entropy
469
+
470
+ $$
471
+ \begin{array} { r l } & { = \mathbb { E } \mathbb { L } [ Q ( y _ { 1 : N - 1 } ; v _ { 1 : N - 1 } , \sigma _ { 1 : N - 1 } ) | | p ( y _ { 0 } , y _ { 1 : N - 1 } , y _ { N } ) ] } \\ & { = \underbrace { - \mathbb { E } _ { Q ( y _ { 1 : N - 1 } ; v _ { 1 : N - 1 } , \sigma _ { 1 : N - 1 } ) } [ \ln p ( y _ { 0 } , y _ { 1 : N - 1 } , y _ { N } ) ] } _ { E n e r g y } + \underbrace { \mathbb { E } _ { Q ( y _ { 1 : N - 1 } ; v _ { 1 : N - 1 } , \sigma _ { 1 : N - 1 } ) } [ \ln Q ( y _ { 1 : N - 1 } ; v _ { 1 : N - 1 } ) ] } _ { E n t r e p y } } \end{array}
472
+ $$
473
+
474
+ Then, taking the entropy term first, we can express it concretely in terms of normal distributions.
475
+
476
+ $$
477
+ \begin{array} { r l } { \underset { m \leq i - 1 , ( j , \eta _ { 1 } , \eta _ { 1 } , \eta _ { 1 } ) = 1 } { \overset { N - 1 } { \prod } } \mathrm { H } Q ( y _ { i ; \mathcal { N } - 1 } ; v _ { 1 ; \mathcal { N } - 1 } , \sigma _ { 1 ; N - 1 } ) \underset { i = 1 } { \overset { N - 1 } { \prod } } ( \underset { \delta \neq j \leq i } { \overset { N - 1 } { \prod } } , v _ { 1 ; \mathcal { N } - 1 } ) \underset { i = 1 } { \overset { N - 1 } { \prod } } \mathrm { H } W ( y _ { i ; \mathcal { N } , \eta _ { i } } , \sigma _ { i } ) \underset { i = 1 } { \overset { N - 1 } { \prod } } } \\ & { = \underset { i = 1 } { \overset { N - 1 } { \prod } } \mathrm { H } Q _ { ( y _ { i ; \mathcal { N } , \eta _ { i } } , \sigma _ { i } ) } [ \underset { \delta \neq j } { \overset { N - 1 } { \prod } } , v _ { i } ; \sigma _ { i } ) \underset { i = 1 } { \overset { N } { \prod } } } \\ & { = \underset { i = 1 } { \overset { N - 1 } { \prod } } \mathrm { H } Q _ { ( y _ { i ; \mathcal { N } , \eta _ { i } } , \sigma _ { i } ) } [ - \frac { 1 } { 2 } \mathrm { h } \mathrm { d e t } ( 2 \pi \sigma _ { i } \sigma _ { i } ) ] + \underset { \mathbb { P } _ { Q ( y _ { i } ; \mathcal { N } , \eta _ { i } ) } [ \frac { 1 } { 2 } } { \overset { N - 1 } { \prod } } } \\ & { = \underset { i = 1 } { \overset { N - 1 } { \prod } } - \frac { 1 } { 2 } \mathrm { h } \mathrm { d e t } ( 2 \pi \sigma _ { i } ) ] + \frac { \sigma _ { i } } { 2 \sigma _ { i } } } \\ & { = \underset { i = 1 } { \overset { N } { \prod } } + \underset { i = 1 } { \overset { N - 1 } { \prod } } - \frac { 1 } { 2 } \mathrm { h } \mathrm { d e t } ( 2 \pi \sigma _ { i } ) } \end{array}
478
+ $$
479
+
480
+ The entropy of a multivariate gaussian has a simple analytical form depending only on the variance. Next we turn to the energy term, which is more complex. To derive a clean analytical result, we must make a further assumption, the Laplace approximation, which requires the variational density to be tightly peaked around the mean so the only non-negligible contribution to the expectation is from regions around the mean. This means that we can successfully approximate the approximate posterior with a second-order Taylor expansion around the mean. From the first line onwards we ignore the $\ln p ( y _ { 0 } )$ and $\ln p ( y _ { N } | \mathcal { P } ( y _ { N } ) )$ which lie outside the expectation.
481
+
482
+ $$
483
+ \begin{array} { r l } { \hat { \mathcal { L } } _ { Q ( y _ { 1 } , N - 1 ; \mathcal { V } _ { 1 } , N - 1 , \mathcal { O } _ { 1 } , N - 1 ) } [ \ln p ( y _ { 0 } , N ) ] = \ln p ( y _ { 0 } ) + \ln p ( y _ { N } | \mathcal { P } ( y _ { N } ) ) + \displaystyle \sum _ { i = 1 } ^ { N - 1 } \mathbb { E } _ { Q ( y _ { i } ; \mathcal { P } _ { i } , \sigma _ { i } ) } [ \ln p ( y _ { i } | \mathcal { P } ( y _ { i } ) ) } & { } \\ { = \displaystyle \sum _ { i = 1 } ^ { N } E _ { Q } [ \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) ] + \mathbb { E } _ { Q } [ \frac { \partial \ln p ( y _ { i } | \mathcal { P } ( y _ { k } ) ) } { \partial y _ { i } } ( v _ { i } - y _ { i } ) ] } & { } \\ { + \mathbb { E } _ { Q } [ \frac { d ^ { 2 } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) } { d y _ { i } ^ { 2 } } ( v _ { i } - y _ { i } ) ^ { 2 } ] } & { } \\ { = \displaystyle \sum _ { i = 1 } ^ { N } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) + \frac { \partial ^ { 2 } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) } { \partial y _ { i } ^ { 2 } } \sigma _ { i } } & { } \end{array}
484
+ $$
485
+
486
+ Where the second term in the Taylor expansion evaluates to 0 since $\mathbb { E } _ { Q } [ y _ { i } - v _ { i } ] = ( v _ { i } - v _ { i } ) = 0$ and the third term contains the expression for the variance $\mathbb { E } _ { Q } [ ( y _ { i } - v _ { i } ) ^ { 2 } ] = \sigma _ { i }$ .
487
+
488
+ We can then write out the full Laplace-encoded free-energy as:
489
+
490
+ $$
491
+ - \mathcal { F } = \sum _ { i = 1 } ^ { N } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) + \frac { \partial ^ { 2 } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) } { \partial y _ { i } ^ { 2 } } \sigma _ { i } - - \frac { 1 } { 2 } \ln \operatorname* { d e t } ( 2 \pi \sigma _ { i } )
492
+ $$
493
+
494
+ We wish to minimize $\mathcal { F }$ with respect to the variational parameters $v _ { i }$ and $\sigma _ { i }$ . There is in fact a closedform expression for the optimal variational variance which can be obtained simply by differentiating and setting the derivative to 0.
495
+
496
+ $$
497
+ \begin{array} { c } { \displaystyle \frac { \partial \mathcal { F } } { \partial \sigma _ { i } } = \frac { \partial ^ { 2 } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) } { \partial y _ { i } ^ { 2 } } - \sigma _ { i } ^ { - 1 } } \\ { \displaystyle \frac { \partial \mathcal { F } } { \partial \sigma _ { i } } = 0 \Rightarrow \sigma _ { i } ^ { * } = \frac { \partial ^ { 2 } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) ) } { \partial y _ { i } ^ { 2 } } ^ { - 1 } } \end{array}
498
+ $$
499
+
500
+ Because of this analytical result for the variational variance, we do not need to consider it further in the optimisation problem, and only consider minimizing the variational means $v _ { i }$ . This renders all the terms in the free-energy except the $\ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) )$ terms constant with respect to the variational parameters. This allows us to write:
501
+
502
+ $$
503
+ - \mathcal { F } \approx \ln p ( y _ { N } | \mathcal { P } ( y _ { N } ) ) + \sum _ { i = 1 } ^ { N } \ln p ( v _ { i } | \mathcal { P } ( y _ { i } ) )
504
+ $$
505
+
506
+ as presented in section 2. The first term $\ln p ( y _ { N } | \mathcal { P } ( y _ { N } ) )$ is effectively the loss at the output $( y _ { N } = T ,$ ) so becomes an additional prediction error $\ln p ( y _ { N } | \mathcal { P } ( y _ { N } ) ) \propto ( T - \hat { v } _ { N } ) ^ { T } \Sigma _ { N } ^ { - 1 } ( T - \hat { v } _ { N } )$ which can be absorbed into the sum over other prediction errors. Crucially, although the variational variances have an analytical form, the variances of the generative model (the precisions $\Sigma _ { i }$ ) do not and can be optimised directly to improve the log model-evidence. These precisions allow for a kind of ’uncertainty-aware’ backprop.
507
+
508
+ # DERIVATION OF VARIATIONAL UPDATE RULES AND FIXED POINTS
509
+
510
+ Here, starting from Equation 10, we show how to obtain the variational update rule for the $v _ { i }$ ’s (Equation 2), and the fixed point equations (Equation 5) (Friston, 2008; 2005; Bogacz, 2017). We first reduce the free-energy to a sum of prediction errors.
511
+
512
+ $$
513
+ \begin{array} { r l } { { - \mathcal { F } \approx \sum _ { i = 1 } ^ { N } \ln p ( v _ { i } | \mathcal { P } ( v _ { i } ) ) } } \\ & { \approx \displaystyle \sum _ { i = 1 } ^ { N } ( v _ { i } - f ( \mathcal { P } ( v _ { 1 } ) ) ^ { T } \Sigma _ { i } ^ { - 1 } ( v _ { i } - f ( \mathcal { P } ( v _ { 1 } ) ) ^ { T } + \ln 2 \pi \Sigma _ { i } ^ { - 1 } } \\ & { = \displaystyle \sum _ { i = 1 } ^ { N } \epsilon _ { i } ^ { T } \epsilon _ { i } + \ln 2 \pi \Sigma _ { i } ^ { - 1 } } \end{array}
514
+ $$
515
+
516
+ Where $\epsilon _ { i } = v _ { i } - f ( \mathcal { P } ( v _ { 1 } ) )$ , and we have utilized the assumption made in section 2 that $\Sigma ^ { - 1 } = \mathbf { I }$ . By setting all precisions to the identity, we are implicitly assuming that all datapoints and vertices of the computational graph have equal variance. Next we assume that the dynamics of each vertex $v _ { i }$ follow a gradient descent on the free-energy.
517
+
518
+ $$
519
+ \begin{array} { c } { { \displaystyle - \frac { d v _ { i } } { d t } = \frac { \partial \mathcal { F } } { \partial v _ { i } } = \frac { \partial } { \partial v _ { i } } [ \sum _ { j = 1 } ^ { N } \epsilon _ { j } ^ { T } \epsilon _ { j } ] } } \\ { { = \epsilon _ { i } \frac { \partial \epsilon _ { i } } { \partial v _ { i } } + \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } \frac { \partial \epsilon _ { j } } { \partial v _ { i } } } } \\ { { = \epsilon _ { i } - \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } \frac { \partial \hat { v } _ { j } } { \partial v _ { i } } } } \end{array}
520
+ $$
521
+
522
+ Where we have used the fact that ∂i = 1 and $\begin{array} { r } { \frac { \partial \epsilon _ { j } } { \partial v _ { j } } = - \frac { \partial \hat { v } _ { j } } { \partial v _ { i } } } \end{array}$ − ∂vˆj∂v . To obtain the fixed point of the dynamics, ∂vi
523
+ we simply solve for dvi = 0.
524
+
525
+ $$
526
+ \begin{array} { c } { \displaystyle \frac { d v _ { i } } { d t } = \frac { \partial \mathcal { F } } { \partial v _ { i } } = 0 } \\ { \displaystyle \Rightarrow 0 = \epsilon _ { i } - \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } \frac { \partial \hat { v } _ { j } } { \partial v _ { i } } } \\ { \displaystyle \Rightarrow \epsilon _ { i } ^ { * } = \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } \frac { \partial \hat { v } _ { j } ^ { * } } { \partial v _ { i } ^ { * } } } \end{array}
527
+ $$
528
+
529
+ Similarly, since $\epsilon _ { i } ^ { * } = v _ { i } ^ { * } - \hat { v } _ { i } ^ { * }$ then $v _ { i } ^ { * } = \epsilon _ { i } ^ { * } + \hat { v } _ { i } ^ { * }$ . So:
530
+
531
+ $$
532
+ \begin{array} { c } { \displaystyle { v _ { i } ^ { * } = \epsilon _ { i } ^ { * } + \hat { v } _ { i } ^ { * } } } \\ { \displaystyle { = \hat { v } _ { i } ^ { * } - \sum _ { j \in \mathcal { C } ( v _ { i } ) } \epsilon _ { j } \frac { \partial \hat { v } _ { j } ^ { * } } { \partial { v _ { i } ^ { * } } } } } \end{array}
533
+ $$
md/train/Rt5mjXAqHrY/Rt5mjXAqHrY.md ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Federated Linear Contextual Bandits
2
+
3
+ Ruiquan Huang The Pennsylvania State University rzh5514@psu.edu
4
+
5
+ Weiqiang Wu Facebook weiqiang.wwu@gmail.com
6
+
7
+ Jing Yang The Pennsylvania State University yangjing@psu.edu
8
+
9
+ Cong Shen University of Virginia cong@virginia.edu
10
+
11
+ # Abstract
12
+
13
+ This paper presents a novel federated linear contextual bandits model, where individual clients face different $K$ -armed stochastic bandits coupled through common global parameters. By leveraging the geometric structure of the linear rewards, a collaborative algorithm called Fed-PE is proposed to cope with the heterogeneity across clients without exchanging local feature vectors or raw data. Fed-PE relies on a novel multi-client G-optimal design, and achieves near-optimal regrets for both disjoint and shared parameter cases with logarithmic communication costs. In addition, a new concept called collinearly-dependent policies is introduced, based on which a tight minimax regret lower bound for the disjoint parameter case is derived. Experiments demonstrate the effectiveness of the proposed algorithms on both synthetic and real-world datasets.
14
+
15
+ # 1 Introduction
16
+
17
+ Federated learning (FL) (McMahan et al., 2017) is an emerging distributed machine learning (ML) paradigm where massive number of clients collaboratively learn a shared prediction model while keeping all the training data on local devices. Compared with standard centralized machine learning, FL has the following characteristics (Kairouz et al., 2021):
18
+
19
+ • Heterogeneous local datasets. The local datasets, which are often generated at edge devices, are likely drawn from non-independent and identically distributed (non-IID) distributions. • Communication efficiency. The communication cost scales with the number of clients, which is one of the primary bottlenecks of FL. It is critical to minimize the communication cost while maintaining the learning accuracy. • Privacy. FL protects local data privacy by only sharing model updates instead of the raw data.
20
+
21
+ While the main focus of the state-of-the-art FL is on the supervised learning setting, recently, a few researchers begin to extend FL to the multi-armed bandits (MAB) framework (Lai and Robbins, 1985; Auer et al., 2002; Bubeck and Cesa-Bianchi, 2012; Agrawal and Goyal, 2012, 2013a). In the canonical setting of MAB, a player chooses to play one arm from a set of arms at each time slot. An arm, if played, will offer a reward that is drawn from its distribution which is unknown to the player. With all previous observations, the player needs to decide which arm to pull each time in order to maximize the cumulative reward. MAB thus represents an online learning model that naturally captures the intrinsic exploration-exploitation tradeoff in many sequential decision-making problems.
22
+
23
+ Extending FL to the MAB framework is naturally motivated by a corpus of applications, such as recommender systems, clinical trials, and cognitive radio. In those applications, the sequential decision making involves multiple clients and is distributed by nature. While classical MAB models assume immediate access to the sequentially generated data at the learning agent, under the new realm of FL, local datasets can be stored and analyzed at the clients, thus reducing the communication load and potentially protecting the data privacy.
24
+
25
+ Despite the potential benefits of FL, the sequential decision making and bandit feedback bring new challenges to the design of FL algorithms in the MAB setting. Different from the supervised learning setting where static datasets are collected beforehand, under the MAB setting, data is generated sequentially as decisions are made, actions are taken, and observations are collected. In order to maximize the cumulative reward and minimize the corresponding learning regret, it thus requires sophisticated coordination of the actions of the clients. The heterogeneous reward distributions across clients make the coordination process even more convoluted and challenging. Besides, the data privacy and communication efficiency requirements result in significant challenges for efficient information exchange and aggregation between local clients and the central server.
26
+
27
+ In this work, we attempt to address those challenges in a federated linear contextual bandits framework.
28
+ This particular problem is motivated by the following exemplary applications.
29
+
30
+ • Personalized content recommendation. For content (arm) recommendation in web-services, user engagement (reward) depends on the profile of a user (context). The central server may deploy a recommender system on each user’ local device (client) in order to personalize recommendations without knowing the personal profile or behavior of the user.
31
+
32
+ • Personalized online education. In order to maximize students performances (reward) in online learning, the education platform (central server) needs to personalize teaching methods (arms) based on the characteristics of individual students (context). With the online learning software installed at local devices (client), it is desirable to personalize the learning experiences without allowing the platform to access students’ characteristics or scores.
33
+
34
+ In those examples, the reward of pulling the same arm at different clients follows different distributions dependent on the context as in contextual bandits (Auer, 2003; Langford and Zhang, 2008). We note that conventional contextual bandits is defined with respect to a single player, where the time-varying context can be interpreted as different incoming user profiles. In contrast, we consider a multi-client model, where each client is associated with a fixed user profile. The variation of contexts is captured over clients as opposed to over time. Although the set of clients remains fixed through the learning process, the reward of pulling the same arm still varies across clients. Such a model naturally takes data heterogeneity into consideration. Besides, we adopt a linear reward model, which has been widely studied in contextual bandits (Li et al., 2010; Agrawal and Goyal, 2013b).
35
+
36
+ Main contributions. Our main contributions are summarized as follows.
37
+
38
+ First, we propose a new federated linear contextual bandits model that takes the diverse user preferences and data heterogeneity into consideration. Such a model naturally bridges local stochastic bandits with linear contextual bandits, and is well poised to capture the tradeoffs between communication efficiency and learning performances in the federated bandits setting.
39
+
40
+ Second, we design a novel algorithm named Fed-PE and further develop its variants to solve the federated linear contextual bandits problem. Under Fed-PE, clients only upload their local estimates of the global parameters without sharing their local feature vectors or raw observations. It not only keeps the personal information private, but also reduces the upload cost. We explicitly show that Fed-PE and its variants achieve near-optimal regret performances for both disjoint and shared parameter cases with logarithmic communication costs.
41
+
42
+ Third, we generalize the G-optimal design from the single-player setting (Lattimore and Szepesvári, 2020) to the multi-client setting. We develop a block coordinate ascent algorithm to solve the generalized G-optimal design efficiently with convergence guarantees. Such a multi-client G-optimal design plays a vital role in Fed-PE, and may find broad applications in related multi-agent setups.
43
+
44
+ Finally, we introduce a novel concept called collinearly-dependent policy and show that the celebrated LinUCB type of policies (Li et al., 2010), Thompson sampling based policies with Gaussian priors (Agrawal and Goyal, 2013b), and least squared estimation based policies, such as Fed-PE, are all in this category. By utilizing the property of collinearly-dependent policies, we are able to characterize a tight minimax regret lower bound in the disjoint parameter setting. We believe that this concept may be of independent interest for the study of bandits with linear rewards.
45
+
46
+ Table 1: Performance comparison
47
+
48
+ <table><tr><td>Model</td><td>Algorithm</td><td>Regret</td><td>Communication cost</td></tr><tr><td>Linear</td><td>DELB</td><td>O(dMTlog(T))</td><td>O((Md +dlog log d) log T)</td></tr><tr><td>Linear contextual (shared parameter)</td><td>FedUCB1 Fed-PE(this work) Lower bound</td><td>O(√dMTlog T) O(√dMTlog(KMT)) Ω(√dMT)</td><td>O(Md² log T) O(M(d² + dK) log T) N/A</td></tr><tr><td>Linear contextual (disjoint parameter)</td><td>Centralized² Fed-PE (this work) Lower bound (this work)</td><td>O(√dK MTlog(K MT)) O(√dKMTlog(KMT)) Ω(√dKMT)</td><td>O(Md²KT) O(Md² K log T) N/A</td></tr></table>
49
+
50
+ $M$ : number of clients; $K$ : number of arms; $_ T$ : time horizon; $^ d$ : ambient dimension of the feature vectors.
51
+
52
+ Notations. Throughout this paper, we use $\| { \boldsymbol { x } } \| _ { V }$ to denote $\sqrt { x \mathsf { r } V x }$ . The range of a matrix $A$ , denoted by range $( A )$ , is the subspace spanned by the column vectors of $A$ . We use $A ^ { \dagger }$ and $\operatorname { D e t } ( A )$ to denote the pseudo-inverse and pseudo-determinant of square matrix $A$ , respectively. The specific definitions can be found in Appendix B of the supplementary material.
53
+
54
+ # 2 Related Works
55
+
56
+ Collaborative and distributed bandits. Our model is closely related to the collaborative and distributed bandits when action collision is not considered. Landgren et al. (2016, 2018) and Martínez-Rubio et al. (2019) study distributed bandits in which multiple agents face the same MAB instance, and the agents collaboratively share their estimates over a fixed communication graph in order to design consensus-based distributed estimation algorithms to estimate the mean of rewards at each arm. Szorenyi et al. (2013) considers a similar setup where in each round an agent is able to communicate with a few random peers. Korda et al. (2016) considers the case where clients in different unknown clusters face independent bandit problems, and every agent can communicate with only one other agent per round. The communication and coordination among the clients in those works are fundamentally different from our work.
57
+
58
+ Wang et al. (2020) investigates communication-efficient distributed linear bandits, where the agents can communicate with a server by sending and receiving packets. It proposes two algorithms, namely, DELB and DisLinUCB, for fixed and time-varying action sets, respectively. The fixed action set setting is similar to our setup, except that it assumes that all agents face the same bandits model, which does not take data heterogeneity into consideration.
59
+
60
+ Federated bandits. A few recent works have touched upon the concept of federated bandits. With heterogeneous reward distributions at local clients, Shi and Shen (2021) and Shi et al. (2021) investigate efficient client-server communication and coordination protocols for federated MAB without and with personalization, respectively. Agarwal et al. (2020) studies regression-based contextual bandits as an example of the federated residual learning framework, where the reward of a client depends on both a global model and a local model. Li et al. (2020) and Zhu et al. (2021) focus on differential privacy based local data privacy protection in federated bandits. While the linear contextual bandit model considered in Dubey and Pentland (2020) is similar to this work, it focuses on federated differential privacy and proposes a LinUCB-based FedUCB algorithm, which incurs a higher regret compared with our result for the shared parameter case. A regret and communication cost comparison between Fed-PE and other baseline algorithms is provided in Table 1.
61
+
62
+ # 3 Problem Formulation
63
+
64
+ Clients and local bandits model. We consider a federated linear contextual bandits setting where there are $M$ clients pulling the same set of $K$ items (arms) denoted as $[ K ] : = \{ 1 , 2 , \dots , \bar { K } \}$ . At each time $t$ , each client $i \in [ M ]$ pulls an arm $a _ { i , t } \in [ K ]$ based on locally available information. The incurred reward $y _ { i , t }$ is given by $y _ { i , t } = r _ { i , a _ { i , t } } + \eta _ { i , t }$ , where $\eta _ { i , t }$ is a random noise, and $r _ { i , a _ { i , t } }$ is the unknown expected reward by pulling arm $a _ { i , t }$ . We note that without additional assumptions or interaction among the clients, each local model is a standard single-player stochastic MAB, where classic algorithms such as UCB (Auer and Ortner, 2010) and Thompson sampling (Agrawal and Goyal, 2012) are known to achieve order-optimal regret.
65
+
66
+ Linear reward structure with global parameters. In order to capture the inherent correlation between rewards of pulling the same arm by different clients, we assume $r _ { i , a }$ has a linear structure, i.e., $r _ { i , a } = x _ { i , a } ^ { \mathsf { T } } \theta _ { a }$ , where $x _ { i , a } \in \mathbb { R } ^ { d }$ is the feature vector associated with client $i$ and arm $a$ , and $\theta _ { a } \in \mathbb { R } ^ { d }$ is a fixed but unknown parameter vector for each $a \in [ K ]$ . Here we use $x ^ { \intercal }$ to denote the transpose of vector $x$ . The same arm $a$ may have different reward distributions for different clients, due to potentially varying $x _ { i , a }$ across clients. Such a linear model naturally captures the heterogeneous data distributions at the clients, yet admits possible collaborations among clients due to the common parameters $\{ \theta _ { a } \} _ { a \in [ K ] }$ . When $\theta _ { a }$ varies for different arm $a$ , it is called the disjoint parameter case; when $\theta _ { a }$ is known to be a constant across the arms, it is the shared parameter case. We investigate both cases in Sections 4 and 5, respectively.
67
+
68
+ Communication model. We assume there exists a central server in the system, and similar to FL, the clients can communicate with the server periodically with zero latency. Specifically, the clients can send “local model updates” to the central server, which then aggregates and broadcasts the updated “global model” to the clients. (We will specify these components later.) Note that just as in FL, communication is one of the major bottlenecks and the algorithm has to be conscious about its usage. Similar to Wang et al. (2020), we define the communication cost of an algorithm as the number of scalars (integers or real numbers) communicated between server and clients. We also make the assumption that clients and server are fully synchronized (McMahan et al., 2017).
69
+
70
+ Data privacy concerns. Similar to Dubey and Pentland (2020), our contextual bandit problem involves two sets of information that are desirable to be kept private to client $i$ : the feature vectors $\{ x _ { i , a } \} _ { a \in [ K ] }$ and the observed rewards $\{ y _ { i , t } \} _ { t \in [ T ] }$ . Different from the differential privacy mechanism adopted in Dubey and Pentland (2020), in this work, we aim to communicate estimated global model parameters $\{ \theta _ { a } \} _ { a }$ between the clients and the server. This is consistent with the FL framework, where only model updates are communicated instead of the raw data.
71
+
72
+ Assumption 1 We make the following assumptions throughout the paper:
73
+
74
+ 1) Bounded parameters: For any $i \in [ M ]$ , $a \in [ K ]$ , we have $\| \theta _ { a } \| _ { 2 } \leq s$ , $0 < \ell \leq \| x _ { i , a } \| _ { 2 } \leq L$ . 2) Independent 1-subgaussian noise: $\eta _ { i , t }$ is a $I$ -subgaussian noise parameter sampled independently at each time for each client with $\mathbb { E } [ \eta _ { i , t } ] = 0 ,$ , $\mathbb { E } [ \exp ( \lambda \eta _ { i , t } ) ] \leq \exp ( \frac { \lambda ^ { 2 } } { 2 } )$ for any $\lambda > 0$ .
75
+
76
+ Assumption 1.1 is a standard assumption in the bandit literature, which ensures that the maximum regret at any step is bounded. We emphasize that our work does not make any assumption on the knowledge of suboptimality gaps, nor do we assume the existence of a unique optimal arm at each client.
77
+
78
+ Our objective is to minimize the expected cumulative regret among all clients, defined as:
79
+
80
+ $$
81
+ \mathbb { E } [ R ( T ) ] = \mathbb { E } \left[ \sum _ { i = 1 } ^ { M } \sum _ { t = 1 } ^ { T } \Big ( x _ { i , a _ { i } ^ { * } } ^ { \top } \theta _ { a _ { i } ^ { * } } - x _ { i , a _ { i , t } } ^ { \top } \theta _ { a _ { i , t } } \Big ) \right] ,
82
+ $$
83
+
84
+ where $a _ { i } ^ { * } \in [ K ]$ is an optimal arm for client $i$ : $\forall b \ne a _ { i } ^ { * }$ , $x _ { i , a _ { i } ^ { * } } ^ { \mathsf { T } } \theta _ { a _ { i } ^ { * } } - x _ { i , b } ^ { \mathsf { T } } \theta _ { b } \geq 0$
85
+
86
+ # 4 Federated Linear Contextual Bandits: Disjoint Parameter Case
87
+
88
+ # 4.1 Challenges
89
+
90
+ Solving the federated linear contextual bandits model faces several new challenges. The first challenge is due to the constraint that only locally estimated parameters $\{ \theta _ { a } \} _ { a \in [ K ] }$ are uploaded to the central server. While this is not an issue for stochastic MAB where the $\{ \theta _ { a } \} _ { a \in [ K ] }$ are scalars (Shi and Shen, 2021; Shi et al., 2021), this brings significant challenges for the aggregation of the local estimates into a “global model” in our setup. This is because under the linear reward structure, the locally received rewards $\{ y _ { i , t } \} _ { t \in [ T ] }$ only contain the projection of $\theta _ { a }$ along the direction of $x _ { i , a }$ , while the portion of information lying outside range $( x _ { i , a } )$ is not captured in $\{ y _ { i , t } \} _ { t \in [ T ] }$ . Thus, by utilizing $\{ y _ { i , t } \} _ { t \in [ T ] }$ , the locally estimated $\theta _ { a }$ , denoted as $\widehat { \theta } _ { i , a }$ , cannot provide any information of $\theta _ { a }$ beyond $\mathrm { r a n g e } ( x _ { i , a } )$ . Since $\{ x _ { i , a } \} _ { i \in [ M ] }$ are different for the same arm $a$ , the locally estimated $\{ \hat { \theta } _ { i , a } \} _ { i \in [ M ] }$ are essentially lying in different subspaces. The central server thus needs to take such geometric structure into account when aggregating $\{ \hat { \theta } _ { i , a } \}$ to construct the global estimate of $\theta _ { a }$ .
91
+
92
+ The geometric structure of the local rewards also brings another challenge for the coordination of actions of local clients. Intuitively, in order to help client $i$ accurately estimate the expected reward by pulling arm $a$ , it suffices to obtain an accurate projection of $\theta _ { a }$ on range $( x _ { i , a } )$ ; any part of $\theta _ { a }$ lying outside this subspace is irrelevant. Therefore, if two clients $i$ and $j$ have $x _ { i , a }$ and $x _ { j , a }$ orthogonal to each other, exchanging the local estimates $\widehat { \theta } _ { i , a }$ and $\widehat { \theta } _ { j , a }$ does not help the other client improve her own local estimation. On the other hand, if $x _ { i , a }$ and $x _ { j , a }$ are completely aligned with each other, $\widehat { \theta } _ { i , a }$ and $\widehat { \theta } _ { j , a }$ can be aggregated directly to improve the local estimation accuracy of both. With $M$ possible subspaces spanned by $\{ x _ { i , a } \} _ { i }$ , it is highly likely that different clients receive different amounts of relevant information (i.e., information lying in range $( x _ { i , a } ) )$ ) through information exchange facilitated by the central server. Therefore, in order to reduce the overall regret, it is necessary to coordinate the actions of clients in a sophisticated fashion.
93
+
94
+ Third, since the exact knowledge of the local feature vectors $\{ x _ { i , a } \}$ are kept from the central server, the server may not have an accurate estimation of the uncertainty level of the local estimates at each client, or how much the coordination would help individual clients. This would make efficient and effective coordination even more challenging.
95
+
96
+ # 4.2 Federated Phased Elimination (Fed-PE) Algorithm
97
+
98
+ To address the aforementioned challenges, we propose the Federated Phased Elimination (Fed-PE) algorithm. The Fed-PE algorithm works in phases, where the length of phase $p$ is $f ^ { p } + K$ . It contains a client side subroutine (Algorithm 1) and a server side subroutine (Algorithm 2). Throughout the paper we use superscript $p$ to indicate phase $p$ barring explicit explanation. We use $\mathcal { A } _ { i } ^ { p } \subset [ K ]$ to denote the subset of active arms at client $i$ in phase $p$ , $\mathcal { A } ^ { p } : = \cup _ { i = 1 } ^ { M } \mathcal { A } _ { i } ^ { p }$ , $\mathcal { R } _ { a } ^ { p } : = \{ i : a \in \mathcal { A } _ { i } ^ { p } \}$ , and define $\mathcal { T } _ { i , a } ^ { p }$ as the time indices at which client $i$ pulls arm $a$ during the collaborative exploration step in phase $p$ . Then, the algorithm works as follows.
99
+
100
+ # Algorithm 1 Fed-PE : client $i$
101
+
102
+ Input: 1: Ini $T , M , K , \alpha , f ^ { p }$ each arm and receive reward ; ; Send to the server; $a \in [ K ]$ $y _ { i , a }$ $\begin{array} { r } { \hat { \theta } _ { i , a } ^ { 0 } \frac { y _ { i , a } x _ { i , a } } { \parallel x _ { i , a } \parallel ^ { 2 } } } \end{array}$ $\{ \hat { \theta } _ { i , a } ^ { 0 } \} _ { a }$ $\mathcal { A } _ { i } ^ { 0 } [ K ] ; p 1$ .
103
+ 2: while not reaching the time horizon $T$ do
104
+ 3: Receive $\{ ( \hat { \theta } _ { a } ^ { p } , V _ { a } ^ { p } ) \} _ { a \in \mathcal A ^ { p - 1 } }$ from the server. . Arm elimination
105
+ 4: for $a \in A _ { i } ^ { p - 1 }$ do $\begin{array} { r } { \hat { r } _ { i , a } ^ { p } x _ { i , a } ^ { \top } \hat { \theta } _ { a } ^ { p } , \qquad u _ { i , a } ^ { p } \alpha \boldsymbol { x } _ { i , a } _ { V _ { a } ^ { p } } / \ell . } \end{array}$ (2)
106
+ 5:
107
+ 6: $\begin{array} { r } { \hat { a } _ { i } ^ { p } \gets \arg \operatorname* { m a x } _ { a \in \mathcal { A } _ { i } ^ { p - 1 } } \hat { r } _ { i , a } ^ { p } , \mathcal { A } _ { i } ^ { p } \gets \left\{ a \in \mathcal { A } _ { i } ^ { p - 1 } | \hat { r } _ { i , a } ^ { p } + u _ { i , a } ^ { p } \geq \hat { r } _ { i , \hat { a } _ { i } ^ { p } } ^ { p } - u _ { i , \hat { a } _ { i } ^ { p } } ^ { p } \right\} . } \end{array}$
108
+ 7: Send $\mathcal { A } _ { i } ^ { p }$ to the central server. . Active arm set updating
109
+ 8: Receive $f _ { i , a } ^ { p }$ for all $a \in \mathcal { A } _ { i } ^ { p }$ .
110
+ 9: for $a \in \mathcal { A } _ { i } ^ { p }$ do . Collaborative exploration
111
+ 10: Pull arm a for f pi,a times and receive rewards {yi,t}t∈T pi,a . $\hat { \theta } _ { i , a } ^ { p } ( \frac { 1 } { f _ { i , a } ^ { p } } \sum _ { t \in \mathcal { T } _ { i , a } ^ { p } } y _ { i , t } ) \frac { x _ { i , a } } { \Vert x _ { i , a } \Vert ^ { 2 } } .$ (3)
112
+ 11: end for
113
+ 12: Send $\{ \hat { \theta } _ { i , a } ^ { p } \} _ { a \in \mathcal { A } _ { i } ^ { p } }$ to the server; Pull $\hat { a } _ { i } ^ { p }$ until phase length equals $f ^ { p } + K$ .
114
+ 13: $p \gets p + 1$ .
115
+ 14: end while
116
+
117
+ At the initialization phase, each client $i$ pulls every arm $a \in [ K ]$ once and receives a reward $y _ { i , a }$ , based on which it obtains an estimate of the projection of $\theta _ { a }$ . These estimates are sent to the server to construct a preliminary global estimate of $\theta _ { a }$ for each $a$ . The global estimates $\{ \hat { \theta } _ { a } ^ { 1 } \} _ { a }$ and the potential matrices $\{ \bar { V } _ { a } ^ { 1 } \} _ { a }$ are then broadcast to all clients, after which phase $p = 1$ begins. Note that after receiving $\{ \hat { \theta } _ { i , a } ^ { 0 } \} _ { i , a }$ , the central server will keep a unit vector $\bar { e } _ { i , a } = \hat { \theta } _ { i , a } ^ { 0 } / \| \hat { \theta } _ { i , a } ^ { 0 } \|$ for all $i \in [ M ] , a \in [ K ]$ . Since $\hat { \theta } _ { i , a } ^ { 0 }$ is a scaled version of $x _ { i , a }$ , $\bar { e } _ { i , a }$ lies in range $( x _ { i , a } )$ , and will be utilized to coordinate the arm pulling process (coined as collaborative exploration), as elaborated in Section 4.3.
118
+
119
+ At the beginning of phase $p$ , after receiving the broadcast $\{ \hat { \theta } _ { a } ^ { p } \} _ { a }$ and $\{ V _ { a } ^ { p } \} _ { a }$ from the server, each client $i$ will utilize the $( \hat { \theta } _ { a } ^ { p } , V _ { a } ^ { p } )$ pair to estimate the expected rewards $r _ { i , a }$ and obtain the confidence level according to Eqn. (2) for each $a \in \mathcal { A } _ { i } ^ { p - 1 }$ . Based on the constructed confidence interval, client $i$ then eliminates some arms in $\mathcal { A } _ { i } ^ { p - 1 }$ and obtains $\mathcal { A } _ { i } ^ { p }$ .
120
+
121
+ Next, each client $i$ sends the newly constructed active arm set $\mathcal { A } _ { i } ^ { p }$ to the server. The server then decides $f _ { i , a } ^ { p }$ , the number of times client $i$ pulling arm $a$ during the collaborative exploration step in phase $p$ for each $i \in [ M ]$ and $a \in \mathcal { A } _ { i } ^ { p }$ . The specific mechanism to decide $f _ { i , a } ^ { p }$ is elaborated in Section 4.3.
122
+
123
+ After the collaborative exploration step, client $i$ performs least-square estimation (LSE) for each arm $a \in \mathcal { A } _ { i } ^ { p }$ based on local observations collected in the current phase according to Eqn. (3) and then sends it to the server for global aggregation. Note that although $\widehat { \theta } _ { i , a } ^ { p }$ lies in range $( x _ { i , a } )$ , the exact value of $x _ { i , a }$ is not revealed to the server, thus preserving the privacy to certain extent.
124
+
125
+ # Algorithm 2 Fed-PE : Central server
126
+
127
+ Input: $T , M , K , \alpha , f ^ { p }$
128
+
129
+ 1: Initialization: Receive $\begin{array} { r l } { \{ \hat { \theta } _ { i , a } ^ { 0 } \} _ { i , a } ; \bar { e } _ { i , a } \gets } & { { } \frac { \hat { \theta } _ { i , a } ^ { 0 } } { \lVert \hat { \theta } _ { i , a } ^ { 0 } \rVert } } \end{array}$ for all $\begin{array} { r } { i \in [ M ] , a \in [ K ] ; V _ { a } ^ { 1 } \gets \left( \sum _ { i \in [ M ] } \frac { \hat { \theta } _ { i , a } ^ { 0 } ( \hat { \theta } _ { i , a } ^ { 0 } ) ^ { \top } } { \| \hat { \theta } _ { i , a } ^ { 0 } \| } \right) ^ { \dagger } } \end{array}$ , $\begin{array} { r } { \hat { \theta } _ { a } ^ { 1 } \gets V _ { a } ^ { 1 } \left( \sum _ { i \in [ M ] } \hat { \theta } _ { i , a } ^ { 0 } \right) } \end{array}$ for all $a \in [ K ]$ ; Broadcast $\{ \hat { \theta } _ { a } ^ { 1 } , V _ { a } ^ { 1 } \} _ { a \in [ K ] } ; p \gets 1$ .
130
+
131
+ 2: while not reaching the time horizon $T$ do
132
+
133
+ 3: Receive $\{ \mathcal { A } _ { i } ^ { p } \} _ { i \in [ M ] }$ ; Set $\mathcal { A } ^ { p } \cup _ { i = 1 } ^ { M } \mathcal { A } _ { i } ^ { p }$ ; Set $\mathcal { R } _ { a } ^ { p } \{ i : a \in \mathcal { A } _ { i } ^ { p } \}$ .
134
+ 4: Solve the multi-client $\mathbf { G }$ -optimal design in (6), and obtain solution $\pi ^ { p } = \{ \pi _ { i , a } ^ { p } \} _ { i \in [ M ] , a \in \mathcal { A } _ { i } ^ { p } }$
135
+
136
+ 5: For every client $_ { i }$ , send $\{ f _ { i , a } ^ { p } : = \lceil \pi _ { i , a } ^ { p } f ^ { p } \rceil \} _ { a \in \mathcal { A } _ { i } ^ { p } }$
137
+
138
+ 6: Receive $\{ ( a , \hat { \theta } _ { i , a } ^ { p } ) \} _ { a \in \mathcal { A } _ { i } ^ { p } }$ from each client $i$
139
+
140
+ 7: for $a \in \mathcal { A } ^ { p }$ do
141
+
142
+ $$
143
+ V _ { a } ^ { p + 1 } ( \sum _ { i \in \mathcal { R } _ { a } ^ { p } } f _ { i , a } ^ { p } \frac { \hat { \theta } _ { i , a } ^ { p } ( \hat { \theta } _ { i , a } ^ { p } ) ^ { \top } } { \| \hat { \theta } _ { i , a } ^ { p } \| ^ { 2 } } ) ^ { \dagger } , \quad \hat { \theta } _ { a } ^ { p + 1 } V _ { a } ^ { p + 1 } ( \sum _ { i \in \mathcal { R } _ { a } ^ { p } } f _ { i , a } ^ { p } \hat { \theta } _ { i , a } ^ { p } ) .
144
+ $$
145
+
146
+ 8: end for
147
+
148
+ 9: Broadcast $\{ ( \hat { \theta } _ { a } ^ { p + 1 } , V _ { a } ^ { p + 1 } ) \} _ { a \in \mathcal { A } ^ { p } }$ to all clients.
149
+ 10: $p \gets p + 1$ .
150
+
151
+ 11: end while
152
+
153
+ # 4.3 Multi-client G-optimal Design
154
+
155
+ In this subsection, we elaborate the core design of Fed-PE, the collaborative exploration step. There are three main design objectives we aim to achieve: 1) As explained in Section 4.1, one of the main challenges in our federated linear contextual bandits setting is that, each client may benefit differently from the information exchange through the central server. To minimize the overall regret, for each arm $a \in \mathcal { A } ^ { p }$ , it is desirable to ensure that after the global aggregation following the collaboration exploration in phase $p$ , the uncertainty in $\hat { r } _ { i , a } ^ { p + 1 }$ across the clients is balanced. 2) For each client $i$ , in order to eliminate the sub-optimal arms efficiently, it is also important to guarantee that the uncertainty in rˆp+1i,a across the arms in $\mathcal { A } _ { i } ^ { p }$ is balanced. 3) Finally, in order to ensure synchronized model updating, we aim to have each client perform the same number of arm pulling in each phase.
156
+
157
+ Motivated by those objectives, we propose a multi-client G-optimal design to coordinate the exploration of all clients. Specifically, we define $\pi _ { i } ^ { p } : \mathcal { A } _ { i } ^ { p } [ 0 , 1 ]$ as a distribution on the active arm set $\mathcal { A } _ { i } ^ { p }$ for each $i$ , and denote $\pi ^ { p } : = ( \pi _ { 1 } ^ { p } , \dots , \pi _ { M } ^ { p } )$ as a vector in $\mathbb { R } ^ { \sum _ { i \in [ M ] } | \mathcal { A } _ { i } ^ { p } | }$ . Let $e _ { i , a } : = x _ { i , a } / \Vert x _ { i , a } \Vert$ . We note that $e _ { i , a }$ equals to either $\bar { e } _ { i , a }$ or $- \bar { e } _ { i , a }$ . Then, we define a feasible set $\mathcal { C } ^ { p } \subset \mathbb { R } ^ { \sum _ { i \in [ M ] } | \mathcal { A } _ { i } ^ { p } | }$ as follows:
158
+
159
+ $$
160
+ \mathcal { C } ^ { p } = \left\{ \pi ^ { p } \left| \begin{array} { l } { \pi _ { i , a } ^ { p } \geq 0 , \forall i \in [ M ] , a \in \mathcal { A } _ { i } ^ { p } , } \\ { \sum _ { a \in \mathcal { A } _ { i } ^ { p } } \pi _ { i , a } ^ { p } = 1 , \forall i \in [ M ] , } \\ { \mathrm { r a n k } ( \{ \pi _ { i , a } ^ { p } e _ { i , a } \} _ { i \in \mathcal { R } _ { a } ^ { p } } ) = \mathrm { r a n k } ( \{ e _ { i , a } \} _ { i \in \mathcal { R } _ { a } ^ { p } } ) , \forall a \in \mathcal { A } ^ { p } } \end{array} \right. \right\} .
161
+ $$
162
+
163
+ We can verify that ${ \mathcal { C } } ^ { p }$ is a convex set. The first two conditions ensure that $\{ \pi _ { i , a } ^ { p } \} _ { a }$ form a valid distribution for each client $i$ . We name the last condition as the “rank-preserving” condition. We note that the subspace spanned by the LHS of the rank-preserving condition is always a subset of that spanned by the RHS. Thus, once the rank is preserved, the subspaces spanned by the LHS and the RHS are the same. Thus, this condition ensures that every dimension of $\theta _ { a }$ lying in $\mathrm { r a n g e } \big ( \{ x _ { i , a } \} _ { i \in \mathcal { R } _ { a } ^ { p } } \big )$ will be explored under the collaborative exploration. Any violation of the “rank-preserving” condition will lead to information missing along the unexplored dimensions, which shall be prevented in order to reduce the uncertainty level regarding arm $a$ at every client $i \in \mathcal { R } _ { a } ^ { p }$ .
164
+
165
+ Then, we formulate the so called multi-client $\mathbf { G }$ -optimal design problem as follows:
166
+
167
+ $$
168
+ \mathrm { m i n i m i z e ~ } G ( \pi ) = \sum _ { i = 1 } ^ { M } \operatorname* { m a x } _ { a \in A _ { i } ^ { p } } e _ { i , a } ^ { \top } \Bigg ( \sum _ { j \in \mathcal { R } _ { a } ^ { p } } \pi _ { j , a } ^ { p } e _ { j , a } e _ { j , a } ^ { \top } \Bigg ) ^ { \dagger } e _ { i , a } \quad \mathrm { s . t . ~ } \pi ^ { p } \in \mathcal { C } ^ { p } .
169
+ $$
170
+
171
+ We note that uncertainty l $\begin{array} { r } { e _ { i , a } ^ { \intercal } \big ( \sum _ { j \in \mathcal { R } _ { a } ^ { p } } \pi _ { j , a } ^ { p } e _ { j , a } e _ { j , a } ^ { \intercal } \big ) ^ { \dagger } e _ { i , a } } \end{array}$ can be interpreted as an approximate measure of thee arms are explored locally according to distributions $x _ { i , a }$ $\{ \pi _ { i } ^ { p } \} _ { i }$ . Thus, the objective function is an approximate measure of the total uncertainties in the least explored arms at each of the clients. By solving (6), the aforementioned three design objectives can be met. We point out that although the server does not known $e _ { i , a }$ , the objective function remains the same when $e _ { i , a }$ is replaced by $\bar { e } _ { i , a }$ . Thus, the server can simply use $\bar { e } _ { i , a }$ to solve (6).
172
+
173
+ After solving (6) and obtaining $\{ \pi _ { i , a } ^ { p } \}$ , the server would set $\{ f _ { i , a } ^ { p } : = \lceil \pi _ { i , a } ^ { p } f ^ { p } \rceil \} _ { a \in \mathcal { A } _ { i } ^ { p } }$ and send it to client $i$ . Note that after taking the ceiling function, $\textstyle \sum _ { a \in A _ { i } ^ { p } } f _ { i , a } ^ { p }$ may be greater than $f ^ { p }$ . To ensure synchronized updating, each client $i$ would keep pulling the estimated best arm $\hat { a } _ { i } ^ { p }$ until the phase length equals $f ^ { p } + K$ .
174
+
175
+ We note that the multi-client G-optimal design formulated in (6) is related to the G-optimal design for the single-player linear bandits problem discussed in Lattimore and Szepesvári (2020), and the DELB algorithm for the distributed linear bandits in Wang et al. (2020). However, for such cases, the player(s) faces a single bandit problem, thus the objective is to simply obtain a distribution over a so-called core set of arms in order to minimize the maximum uncertainty across the arms. In contrast, due to the multiple clients involved in the federated bandits setting and the heterogeneous reward distributions, we are essentially solving M coupled G-design problems, one associated with each client. Such coupling effect fundamentally changes the nature of the problem, leading to very different characterization of the problem and numerical approaches.
176
+
177
+ In Appendix C.1 of the supplementary material, we analyze an equivalent problem of the multi-client G-optimal design. We note that such equivalence essentially generalizes the equivalence between the original G-optimal design and D-optimal design in Lattimore and Szepesvári (2020) to the coupled design case. While the original G-design problem can be approximately solved through the FrankWolfe algorithm under an appropriate initialization (Todd, 2016), solving the multi-client G-optimal design problem is numerically non-trivial. In Appendix C.2, we propose a block coordinate ascent algorithm to solve the equivalent problem of (6) efficiently with guaranteed convergence.
178
+
179
+ # 4.4 Theoretical Analysis of Fed-PE
180
+
181
+ We now characterize the performance of the Fed-PE algorithm.
182
+
183
+ Theorem 1 Under Assumption $I$ , with probability at least $1 - \delta$ , the cumulative regret under Fed-PE scales in $O \left( \sqrt { d K M T ( \log ( K ( \log T ) / \delta ) + \operatorname* { m i n } \{ d , \log M \} ) } \right)$ and the communication cost scales in $O ( M d ^ { 2 } K \log T )$ .
184
+
185
+ The complete version of Theorem 1 and its proof can be found in Appendix $\mathbf { D }$ in the supplementary material. For the communication cost, at each phase $p$ , client $i$ uploads at most $K$ local estimates with dimension $d$ and downloads at most $K$ global estimates and potential matrices with dimension $d$ and $d ^ { 2 }$ , respectively. Thus, the upload cost is $O ( M d K \log T )$ and the download cost is $O ( M d ^ { 2 } K \log T )$ .
186
+
187
+ Remark 1 When we set $\delta = { \cal O } ( \sqrt { { d K } / { M T } } )$ , the overall regret scales in $O ( { \sqrt { d K M T \log ( M K T ) } } )$ , and the per-client regret scales in $O ( \sqrt { d K T \log ( M K T ) / M } )$ . While the minimax lower bound for standard stochastic MAB scales in $\Omega ( \sqrt { K T } )$ , the collaborative learning induced by Fed-PE leads to $\sqrt { d / M }$ -fold reduction of the per-client regret. We also note that for single-player linear√ contextual bandits with disjoint parameters, the best known upper bound scales in $\tilde { O } ( \sqrt { d K M T } )$ (Dimakopoulou et al., 2017) over MT arm pulls, which indicates that the regret of Fed-PE is close to the state-of-the-art centralized algorithms at a communication cost in ${ \cal O } ( \log T )$ .
188
+
189
+ # 4.5 Enhanced Fed-PE
190
+
191
+ The original Fed-PE algorithm requires exponentially increasing $f ^ { p }$ in order to achieve the regret upper bound in Theorem 1. This is because in each phase $p$ , we only utilize the rewards collected in phase $p - 1$ to estimate $\theta _ { a }$ . While this simplifies the analysis, the measurements collected in earlier phases cannot be utilized. In order to overcome this limitation, we propose an Enhanced Fed-PE algorithm by leveraging all historical information. Enhanced Fed-PE achieves different tradeoffs between communication cost and regret performance by adjusting $f ^ { p }$ . The detailed description and analysis of Enhanced Fed-PE for different selection of $f ^ { p }$ can be found in Appendix E in the supplementary material.
192
+
193
+ # 4.6 Lower Bound
194
+
195
+ To derive a tight lower bound, we focus on a set of representative policies defined as follows.
196
+
197
+ Definition 1 (Collinearly-dependent policy) Two clients $i$ and $j$ are called collinear if there exist an arm $a \in [ K ]$ and a subset $s \subset [ M ]$ such that the following conditions are satisfied: 1) $x _ { i , a }$ ∈/ $\operatorname { s p a n } ( \{ x _ { m , a } | m \in S \} )$ ); and 2) $x _ { i , a } \in \operatorname { s p a n } ( \{ x _ { m , a } | m \in \mathcal { S } \} \cup \{ x _ { j , a } \} )$ . For any two clients $i$ and $j$ that are not collinear, if the action of client $i$ is independent of the action of $j$ under a policy $\pi$ , then, the policy is called a collinearly-dependent policy.
198
+
199
+ We note that the definition of collinearly-dependent policies is actually quite natural. Intuitively, for two clients that are not collinear, their local observations on any arm $a$ cannot be utilized to improve each other’s knowledge of their own local models. As a result, they should not affect each other’s decision-making process. As shown in the supplementary material, we can verify that the most celebrated ridge regression based LinUCB type of policies (Li et al., 2010), Thompson sampling based polices with Gaussian priors (Agrawal and Goyal, 2013b), and least-square estimation based policies, including Fed-PE, all fall in this category.
200
+
201
+ Theorem 2 For any collinearly-dependent policy, there exists an instance of the federated linear√ contextual bandits such that the regret is lower bounded as $R ( T ) = \Omega ( \sqrt { d K M T } )$ .
202
+
203
+ Remark 2 Theorem 2 essentially shows that, even if raw data transmission and instantaneous communication are allowed and other collinearly-dependent policies are adopted, we cannot improve the order of the regret summarized in Theorem 1 much, i.e., Fed-PE is order-optimal up to $\sqrt { \log ( K M T ) }$ .
204
+
205
+ The proof of Theorem 2 relies on the construction of a special instance of the federated linear contextual bandits where the clients can be divided into $d$ groups. Clients in each group face the same $K$ -armed stochastic bandits model locally, while clients from two distinct groups are not collinear. Analyzing the regret bound in each individual group, we can show that it is lower bounded by $\Omega ( \sqrt { K M T / d } )$ . Then, by utilizing the property of collinearly-dependent policies, we can show that the overall regret is lower bounded by $\Omega ( \sqrt { d K M T } )$ for this scenario. More discussions on the collinearly-dependent policies and the complete proof of Theorem 2 can be found in Appendix F in the supplementary material.
206
+
207
+ # 5 Federated Linear Contextual Bandits: Shared Parameter Case
208
+
209
+ The Fed-PE algorithm can be slightly modified for the shared parameter case where $\theta _ { a } = \theta , \forall a \in [ K ]$ . While the client side operation stays the same, the global aggregation step at the server side in (4) can be changed by letting the “potential matrix” $V ^ { p }$ be $( \sum _ { a \in [ K ] } ( V _ { a } ^ { p } ) ^ { \dagger } ) ^ { \dagger }$ , and the global estimator $\hat { \theta } ^ { p }$ be $\begin{array} { r } { V ^ { p } \left( \sum _ { i \in [ M ] } \sum _ { a \in \mathcal { A } _ { i } ^ { p - 1 } } f _ { i , a } ^ { p - 1 } \hat { \theta } _ { i , a } ^ { p - 1 } \right) } \end{array}$ . Below, we present the main result for this case and leave the detailed algorithm description and regret analysis in the supplementary material.
210
+
211
+ Theorem 3 Under Assumption $^ { l }$ , with probability at least $1 - \delta$ , the regret of the adapted Fed-PE for the shared parameter case is upper bounded by $O \left( \sqrt { d M T ( \log ( ( \log T ) / \delta ) + \operatorname* { m i n } \{ d , \log M K \} ) } \right)$ , and the communication cost scales in $O ( ( K d M + d ^ { 2 } M ) \log T )$ .
212
+
213
+ Remark 3 By setting $\delta \ = \ \ d { } O ( \sqrt { 1 / M T } )$ , we can show that the overall regret scales in $O ( { \sqrt { d M T \log ( M T K ) } } )$ . We note that this bound improves the regret bound for the no differential privacy guarantee case in Dubey and Pentland (2020) by a factor of $\sqrt { \log T }$ , although our settings are slightly different. By assuming all clients face the same linear bandits in this shared parameter setting, the regret in the federated setting over horizon $T$ must be worse than the linear√ bandits over horizon MT . Since the latter is lowered bounded by $\Omega ( \sqrt { d M T } )$ (Chu et al., 2011), the minimax regret for the shared parameter setting is bounded by $\Omega ( \sqrt { d M T } )$ as well. Thus, the modified Fed-PE is near-optimal for this case.
214
+
215
+ In terms of the communication cost, the uploading cost stays the same as in the disjoint parameter case, while the broadcast cost is reduced by a factor of $K$ , since only one potential matrix needs to be broadcast for the shared parameter case.
216
+
217
+ # 6 Experiments
218
+
219
+ Experiment results using both synthetic and real-world datasets are reported in this section to evaluate Fed-PE and the proposed enhancement. Additional experimental details and more experimental results can be found in the supplementary material. We consider four different algorithms, namely, Fed-PE, Enhanced Fed-PE, local UCB without communication, and a modified Fed-PE algorithm with full information exchange after collaborative exploration in each phase (coined as ‘Collaborative’ in Figure 1). For all experiments, we set $T = 2 ^ { 1 7 }$ , $f ^ { \bar { p } } = 2 ^ { p } , p \in \{ 1 , 2 , \ldots , 1 6 \}$ , and run 10 trials. For Fed-PE and its variants, we choose $\delta = 0 . 1$ . Note that other values of $\delta$ may further improve the regret. We evaluate the algorithms on both synthetic and MovieLens-100K datasets.
220
+
221
+ Synthetic Dataset: We first set $M = 1 0 0 , K = 1 0$ , and $d = 3$ . We set $\{ \theta _ { a } \}$ as the canonical basis of $\mathbb { R } ^ { 3 }$ . The feature vectors $x _ { i , a }$ are generated randomly ensuring that the suboptimality reward gaps lie in [0.2, 0.4] and $\ell = 0 . 5 , L = 1$ . The per-client cumulative regret as a function of $T$ is plotted in Figure 1(a). We see that Enhanced Fed-PE outperforms Fed-PE while being slightly worse than ‘Collaborative’. This indicates that keeping feature vectors $x _ { i , a }$ private to clients does not impact the learning performance significantly. All Fed-PE related algorithms outperform local UCB when $T$ is sufficiently large, demonstrating the effectiveness of communication in improving learning locally. We also set $K = 1 0$ , $d = 4$ , and vary the number of clients $M$ . The performance of Enhanced Fed-PE is plotted in Figure 1(b). We note that the per-client regret monotonically decreases as $M$ increases, corroborating the theoretical results.
222
+
223
+ Movielens Dataset: We then use the MovieLens-100K dataset (Harper and Konstan, 2015) to evaluate the performances. Motivated by Bogunovic et al. (2021), we first complete the rating matrix $R = [ r _ { i , a } ] \in \dot { \mathbb { R } } ^ { 9 4 3 \times 1 6 8 2 }$ through collaborative filtering (Morabia, 2019), and then use non-negative matrix factorization with 3 latent factors to get $R = W H$ , where $W \in \mathbb { R } ^ { 9 4 3 \times 3 }$ , $H \in \mathbb { R } ^ { 3 \times 1 6 8 2 }$ . Let $x _ { i , a }$ be the ith row vector of $W$ . We apply the $k$ -means algorithm to the row vectors of $H$ to produce $K = 3 0$ groups (arms), and let $\theta _ { a }$ be the center of the $a$ -th group. Finally, we randomly choose $M = 1 0 0$ users’ feature vectors. We observe that $0 . 4 \leq \| x _ { i , a } \| ^ { 2 } \leq 0 . 8$ , and the suboptimality gaps lie in [0.01, 0.8]. The regret performances of the algorithms are plotted in Figure 1(c). The curves show similar characteristics as in Figure 1(a). These results demonstrate the effectiveness of collaborative learning in the federated bandits setting.
224
+
225
+ ![](images/9fccffd0e3d5eb9f1489494d88b1cbca64eb0f20ecbef254fe311b12c0f5b876.jpg)
226
+ Figure 1: Pseudo-regret over $T$ . Shaded area indicates the standard deviation.
227
+
228
+ # 7 Discussion and Conclusion
229
+
230
+ In this work, we have considered a novel federated linear contextual bandits model, which naturally connects local stochastic MAB models with linear contextual bandits through common global parameters. While each client can only observe a projection of each global parameter in its own subspace, Fed-PE utilizes the geometric structure of the local estimates to reconstruct the global parameters and guide efficient collaborative exploration. Theoretical analysis indicates that Fed-PE achieves near-optimal regret for both disjoint and shared parameter cases with a communication cost in the order of ${ \cal O } ( \log T )$ .
231
+
232
+ An interesting open question is whether we can further reduce the communication cost without downgrading the regret performance. In particular, we note the the original single-player G-optimal design allows for a sparse solution whose support is of size $d ( d \mathrm { + } 1 ) / 2$ . Our numerical results indicate that such sparse solutions exist for the multi-client G-optimal design as well. Utilizing the sparsity of the solution may reduce the communication cost significantly. Theoretical characterization of the existence of such sparse solutions is our next step.
233
+
234
+ Another possible direction to explore is to incorporate the differential privacy mechanism to the Fed-PE framework. Although local feature vectors $\{ x _ { i , a } \}$ are kept private under Fed-PE, local estimate $\widehat { \theta } _ { i , a }$ lies in range $( x _ { i , a } )$ , thus revealing the direction of $x _ { i , a }$ to the central server. We aim to add certain perturbation on $\widehat { \theta } _ { i , a }$ in order to obfuscate the direction information without significantly affecting the regret performance.
235
+
236
+ # Acknowledgments and Disclosure of Funding
237
+
238
+ The work of RH and JY was supported by the US National Science Foundation under Grants CNS-1956276, CNS-2003131, CNS-2114542, and ECCS-2030026. CS acknowledges the funding support by the US National Science Foundation under Grants ECCS-2029978, ECCS-2033671, and CNS-2002902. WW’s work was done before he joined Facebook.
239
+
240
+ # References
241
+
242
+ Agarwal, A., Langford, J., and Wei, C.-Y. (2020). Federated residual learning. arXiv 2003.12880.
243
+
244
+ Agrawal, S. and Goyal, N. (2012). Analysis of Thompson sampling for the multi-armed bandit problem. In Conference on Learning Theory, pages 39–1.
245
+
246
+ Agrawal, S. and Goyal, N. (2013a). Further optimal regret bounds for Thompson sampling. In Artificial Intelligence and Statistics, pages 99–107.
247
+
248
+ Agrawal, S. and Goyal, N. (2013b). Thompson sampling for contextual bandits with linear payoffs. In Proceedings of the 30th International Conference on International Conference on Machine Learning, pages 1220–1228.
249
+
250
+ Auer, P. (2003). Using confidence bounds for exploitation-exploration trade-offs. J. Mach. Learn. Res., 3:397–422.
251
+
252
+ Auer, P., Cesa-Bianchi, N., and Fischer, P. (2002). Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2-3):235–256.
253
+
254
+ Auer, P. and Ortner, R. (2010). UCB revisited: Improved regret bounds for the stochastic multi-armed bandit problem. Periodica Mathematica Hungarica, 61(1):55–65.
255
+
256
+ Bogunovic, I., Losalka, A., Krause, A., and Scarlett, J. (2021). Stochastic linear bandits robust to adversarial attacks. In International Conference on Artificial Intelligence and Statistics, pages 991–999. PMLR.
257
+
258
+ Bubeck, S. and Cesa-Bianchi, N. (2012). Regret analysis of stochastic and nonstochastic multi-armed bandit problems. Foundations and Trends® in Machine Learning, 5(1):1–122.
259
+
260
+ Chu, W., Li, L., Reyzin, L., and Schapire, R. (2011). Contextual bandits with linear payoff functions. In Gordon, G., Dunson, D., and Dudík, M., editors, Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, volume 15 of Proceedings of Machine Learning Research, pages 208–214, Fort Lauderdale, FL, USA. PMLR.
261
+
262
+ Dimakopoulou, M., Zhou, Z., Athey, S., and Imbens, G. (2017). Estimation considerations in contextual bandits. arXiv preprint arXiv:1711.07077.
263
+
264
+ Dubey, A. and Pentland, A. (2020). Differentially-private federated linear bandits. Advances in Neural Information Processing Systems, 33.
265
+
266
+ Harper, F. M. and Konstan, J. A. (2015). The MovieLens Datasets: History and context. ACM Trans. Interact. Intell. Syst., 5(4).
267
+
268
+ Kairouz, P., McMahan, H. B., Avent, B., Bellet, A., Bennis, M., Bhagoji, A. N., Bonawitz, K., Charles, Z., Cormode, G., Cummings, R., D’Oliveira, R. G. L., Eichner, H., Rouayheb, S. E., Evans, D., Gardner, J., Garrett, Z., Gascón, A., Ghazi, B., Gibbons, P. B., Gruteser, M., Harchaoui, Z., He, C., He, L., Huo, Z., Hutchinson, B., Hsu, J., Jaggi, M., Javidi, T., Joshi, G., Khodak, M., Konecný, J., Korolova, A., Koushanfar, F., Koyejo, S., Lepoint, T., Liu, Y., Mittal, P., Mohri, M., ˇ Nock, R., Özgür, A., Pagh, R., Raykova, M., Qi, H., Ramage, D., Raskar, R., Song, D., Song, W., Stich, S. U., Sun, Z., Suresh, A. T., Tramèr, F., Vepakomma, P., Wang, J., Xiong, L., Xu, Z., Yang, Q., Yu, F. X., Yu, H., and Zhao, S. (2021). Advances and open problems in federated learning. Foundations and Trends® in Machine Learning, 14(1).
269
+
270
+ Korda, N., Szorenyi, B., and Li, S. (2016). Distributed clustering of linear bandits in peer to peer networks. In Balcan, M. F. and Weinberger, K. Q., editors, Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pages 1301–1309, New York, New York, USA. PMLR.
271
+
272
+ Lai, T. L. and Robbins, H. (1985). Asymptotically efficient adaptive allocation rules. Advances in applied mathematics, 6(1):4–22.
273
+
274
+ Landgren, P., Srivastava, V., and Leonard, N. E. (2016). On distributed cooperative decision-making in multiarmed bandits. In 2016 European Control Conference (ECC), pages 243–248. IEEE.
275
+
276
+ Landgren, P., Srivastava, V., and Leonard, N. E. (2018). Social imitation in cooperative multiarmed bandits: partition-based algorithms with strictly local information. In 2018 IEEE Conference on Decision and Control (CDC), pages 5239–5244. IEEE.
277
+
278
+ Langford, J. and Zhang, T. (2008). The epoch-greedy algorithm for multi-armed bandits with side information. In Advances in Neural Information Processing Systems, pages 817–824.
279
+
280
+ Lattimore, T. and Szepesvári, C. (2020). Bandit Algorithms. Cambridge University Press.
281
+
282
+ Li, L., Chu, W., Langford, J., and Schapire, R. E. (2010). A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th International Conference on World Wide Web, pages 661–670.
283
+
284
+ Li, T., Song, L., and Fragouli, C. (2020). Federated recommendation system via differential privacy. In IEEE International Symposium on Information Theory (ISIT), pages 2592–2597.
285
+
286
+ Martínez-Rubio, D., Kanade, V., and Rebeschini, P. (2019). Decentralized cooperative stochastic bandits. In Advances in Neural Information Processing Systems, pages 4529–4540.
287
+
288
+ McMahan, B., Moore, E., Ramage, D., Hampson, S., and y Arcas, B. A. (2017). Communicationefficient learning of deep networks from decentralized data. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics (AISTATS), pages 1273–1282, Fort Lauderdale, FL, USA.
289
+ Morabia, K. (2019). Collaborative-filtering. https://github.com/kevalmorabia97/ Collaborative-Filtering.
290
+ Shi, C. and Shen, C. (2021). Federated multi-armed bandits. In Proceedings of the 35th AAAI Conference on Artificial Intelligence (AAAI).
291
+ Shi, C., Shen, C., and Yang, J. (2021). Federated multi-armed bandits with personalization. In Proceedings of the 24rd International Conference on Artificial Intelligence and Statistics (AISTATS).
292
+ Szorenyi, B., Busa-Fekete, R., Hegedus, I., Ormandi, R., Jelasity, M., and Kegl, B. (2013). Gossipbased distributed stochastic bandit algorithms. In Proceedings of the 30th International Conference on Machine Learning, pages 19–27.
293
+ Todd, M. J. (2016). Minimum-Volume Ellipsoids. Society for Industrial and Applied Mathematics, Philadelphia, PA.
294
+ Wang, Y., Hu, J., Chen, X., and Wang, L. (2020). Distributed bandit learning: Near-optimal regret with efficient communication. In International Conference on Learning Representations.
295
+ Zhu, Z., Zhu, J., Liu, J., and Liu, Y. (2021). Federated bandit: A gossiping approach. Proceedings of the ACM on Measurement and Analysis of Computing Systems, 5(1):1–29.
md/train/S1fduCl0b/S1fduCl0b.md ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LIFELONG GENERATIVE MODELING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Lifelong learning is the problem of learning multiple consecutive tasks in a sequential manner where knowledge gained from previous tasks is retained and used for future learning. It is essential towards the development of intelligent machines that can adapt to their surroundings. In this work we focus on a lifelong learning approach to generative modeling where we continuously incorporate newly observed streaming distributions into our learnt model. We do so through a student-teacher architecture which allows us to learn and preserve all the distributions seen so far without the need to retain the past data nor the past models. Through the introduction of a novel cross-model regularizer, the student model leverages the information learnt by the teacher, which acts as a summary of everything seen till now. The regularizer has the additional benefit of reducing the effect of catastrophic interference that appears when we learn over streaming data. We demonstrate its efficacy on streaming distributions as well as its ability to learn a common latent representation across a complex transfer learning scenario.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep unsupervised generative learning allows us to take advantage of the massive amount of unlabeled data available in order to build models that efficiently compress and learn an approximation of the true data distribution. It has numerous applications such as image denoising, inpainting, super-resolution, structured prediction, clustering, pre-training and many more. However, something that is lacking in the modern ML toolbox is an efficient way to learn these deep generative models in a sequential, lifelong setting.
12
+
13
+ In a lot of real world scenarios we observe distributions sequentially. Examples of this include streaming data from sensors such as cameras and microphones or other similar time series data. A system can also be resource limited wherein all of the past data or learnt models cannot be stored. We are interested in the lifelong learning setting for generative models where data arrives sequentially in a stream and where the storage of all data is infeasible. Within the stream, instances are generated according to some non-observed distribution which changes at given time-points. We assume we know the time points at which the transitions occur and whether the latent distribution is a completely new one or one that has been observed before. We do not however know the underlying identity of the individual distributions. Our goal is to learn a generative model that can summarize all the distributions seen so far in the stream. We give an example of such a setting in figure 1(a) using MNIST LeCun & Cortes (2010), where we have three unique distributions and one that is repeated.
14
+
15
+ Since we only observe one distribution at a time we need to develop a strategy of retaining the previously learnt knowledge (i.e. the previously learnt distributions) and integrate it into future learning. To accumulate additional distributions in the current generative model we utilize a student-teacher architecture similar to that in distillation methods Hinton et al. (2015); Furlanello et al. (2016). The teacher contains a summary of all past distributions and is used to augment the data used to train the student model. The student model thus receives data samples from the currently observable distribution as well as synthetic data samples from previous distributions. This allows the student model to learn a distribution that summarizes the current as well as all previously observed distributions. Once a new distribution shift occurs the existing teacher model is discarded, the student becomes the teacher and a new student is instantiated.
16
+
17
+ We further leverage the generative model of the teacher by introducing a regularizer in the learning objective function of the student that brings the posterior distribution of the latter close to that of the former. This allows us to build upon and extend the teacher’s generative model in the student each time the latter is re-instantiated (rather than re-learning it from scratch). By coupling this regularizer with a weight transfer from the teacher to the student we also allow for faster convergence of the student model. We empirically show that the regularizer allows us to learn a much larger set of distributions without catastrophic interference McCloskey & Cohen (1989).
18
+
19
+ ![](images/e4a0de89f53f3da3ca7f5c7c076ac99f174d75abf3b0fa6674908d15676319ae.jpg)
20
+ Figure 1: (a) Our problem setting where we sequentially observe samples from multiple unknown distributions; (b)Visualization of a learnt two-dimensional posterior of MNIST, evaluated with samples from the full test set.
21
+
22
+ We build our lifelong generative models over Variational Autoencoders (VAEs) Kingma & Welling (2014). VAEs learn the posterior distribution of a latent variable model using an encoder network; they generate data by sampling from a prior and decoding the sample through a conditional distribution learnt by a decoder network.
23
+
24
+ Using a vanilla VAE as a teacher to generate synthetic data for the student is problematic due to a couple of limitations of the VAE generative process. 1) Sampling the prior can select a point in the latent space that is in between two separate distributions, causing generation of unrealistic synthetic data and eventually leading to loss of previously learnt distributions. 2) Additionally, data points mapped to the posterior that are further away from the prior mean will be sampled less frequently resulting in an unbalanced sampling of the constituent distributions. Both limitations can be understood by visually inspecting the learnt posterior distribution of a standard VAE evaluated on test images from MNIST as shown in figure 1(b). To address the VAE’s sampling limitations we decompose the latent variable vector into a continuous and a discrete component. The discrete component is used to summarize the discriminative information of the individual generative distributions while the continuous caters for the remaining sample variability. By independently sampling the discrete and continuous components we preserve the distributional boundaries and circumvent the two problems above.
25
+
26
+ This sampling strategy, combined with the proposed regularizer allows us to learn and remember all the individual distributions observed in the past. In addition we are also able to generate samples from any of the past distributions at will; we call this property consistent sampling.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Past work in sequential learning of generative models has focused on learning Gaussian mixture models Singer & Warmuth (1999); Declercq & Piater (2008) or on variational methods such as Variational EM Ghahramani & Attias (2000). Work that is closer to ours is the online or sequential learning of generative models in a streaming setting. Variational methods have been adapted for a streaming setting, e.g: Streaming Variational Bayes Broderick et al. (2013), Streaming Variational Mixture models Tank et al. (2015), and the Population Posterior McInerney et al. (2015). However their learning objectives are very different from ours. The objective of these methods is to adjust the learnt model such that it reflects the current data distribution as accurately as possible, while forgetting the previously observed distributions. Instead we want to do lifelong learning and retain all previously observed distributions within our learnt model. As far as we know our work is the first one that tries to bring generative models, and in particular VAEs, into a lifelong setting where distributions are seen, learnt, and remembered sequentially.
31
+
32
+ VAEs rely on an encoder and a decoder neural network in order to learn the parameters of the posterior and likelihood. One of the central problems that arise when training a neural network in an sequential manner is that it causes the model to run into the problem of catastrophic interference McCloskey & Cohen (1989). Catastrophic interference appears when we train neural networks in a sequential manner and model parameters start to become biased to the most recent samples observed, while forgetting what was learnt from older samples. This generally happens when we stop exposing the model to past data. There have been a number of attempts to solve the problem of catastrophic interference in neural networks. These range from distillation methods such as the original method Hinton et al. (2015) and ALTM Furlanello et al. (2016), to utilizing privileged information Lopez-Paz et al. (2016), as well as transfer learning approaches such as Learning Without Forgetting Li & Hoiem (2016) and methods that relay information from previously learnt hidden layers such as in Progressive Neural Networks Rusu et al. (2016) and Deep Block-Modular Neural Networks Terekhov et al. (2015). All of these methods necessitate the storage of previous models or data; our method does not.
33
+
34
+ The recent work of elastic weight consolidation (EWC) Kirkpatrick et al. (2017) utilizes the Fisher Information matrix (FIM) to avoid the problem of catastrophic interference. The FIM captures the sensitivity of the log-likelihood with respect to the model parameters; EWC leverages this (via a linear approximation of the FIM) to control the change of model parameter values between varying distributions. Intuitively, important parameters should not have their values changed, while non-important parameters are left unconstrained. Since EWC assumes model parameters being distributed under an exponential family, it allows for the utilization of the FIM as a quadratic approximationJeffreys (1946) to the Kullback-Leibler (KL) divergence. Our model makes no such distributional assumptions about the model parameters. Instead of constraining the parameters of the model as in EWC, we restrict the posterior representation of the student model to be close to that of the teacher for the previous distributions accumulated by the teacher. This allows the model parameters to vary as necessary in order to best fit the data.
35
+
36
+ # 3 BACKGROUND
37
+
38
+ We consider an unsupervised setting where we observe a sample $\mathbf { X }$ of $K \geq 1$ realizations $\mathbf { X } =$ $\{ \mathbf { x } ^ { ( 0 ) } , \mathbf { x } ^ { ( 1 ) } , . . . , \mathbf { x } ^ { ( K ) } \}$ from an unknown true distribution $P ^ { * } ( \mathbf { x } )$ with $\mathbf { x } \in \mathcal { R } ^ { N }$ . We assume that the data is generated by a random process involving a non-observed random variable $z \in \mathcal { R } ^ { M }$ . In order to incorporate our prior knowledge we posit a prior $P ( z )$ over $_ { z }$ . Our objective is to approximate the true underlying data distribution by a model $P _ { \pmb { \theta } } ( \mathbf { x } )$ such that $P _ { \pmb \theta } ( \mathbf { x } ) \approx P ^ { * } ( \mathbf { x } )$ .
39
+
40
+ Given a latent variable model $P _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } ) P ( \mathbf { z } )$ we obtain the marginal likelihood $P _ { \pmb { \theta } } ( \mathbf { x } )$ by integrating out the latent variable $\mathbf { z }$ from the joint distribution. The joint distribution can in turn be factorized using the conditional distribution $P _ { \theta } ( \mathbf { x } | z )$ or the posterior $P _ { \boldsymbol { \theta } } ( z | \mathbf { x } )$ .
41
+
42
+ $$
43
+ P _ { \theta } ( { \bf x } ) = \int P _ { \theta } ( { \bf x } , z ) \delta z = \int P _ { \theta } ( z | { \bf x } ) P _ { \theta } ( { \bf x } ) \delta z = \int P _ { \theta } ( { \bf x } | z ) P ( z ) \delta z
44
+ $$
45
+
46
+ We model the conditional distribution $P _ { \theta } ( \mathbf { x } | z )$ by a decoder, typically a neural network. Very often the marginal likelihood $P _ { \pmb { \theta } } ( \mathbf { x } )$ will be intractable because the integral in equation (1) does not have an analytical form nor an efficient estimator (Kingma (2017)). As a result the respective posterior distribution, $P _ { \pmb { \theta } } ( \pmb { z } | \mathbf { x } )$ , is also intractable.
47
+
48
+ Variational inference side-steps the intractability of the posterior by approximating it with a tractable distribution $Q _ { \phi } ( z | \mathbf { x } ) \approx P _ { \theta } \bar { ( } z | \mathbf { x } )$ . VAEs use an encoder (generally a neural network) to model the approximate posterior $Q _ { \phi } ( z | \mathbf { x } )$ and optimize the parameters $\phi$ to minimize the reverse KL divergence $K L [ Q _ { \phi } ( z | \mathbf { x } ) | | P _ { \theta } ( z | \mathbf { x } ) ]$ between the approximate posterior distribution $Q _ { \phi } ( z | \mathbf { x } )$ and the true posterior $P _ { \pmb { \theta } } ( \pmb { z } | \mathbf { x } )$ . Given that $Q _ { \phi } ( z | \mathbf { x } )$ is a powerful model (such that the KL divergence against the true posterior will be close to zero) we maximize the tractable Evidence Lower BOund (ELBO) to the intractable marginal likelihood. $\mathcal { L } _ { \pmb { \theta } } ( \mathbf { x } ) \leq P _ { \pmb { \theta } } ( \mathbf { x } )$ (full derivation available in the appendix)
49
+
50
+ $$
51
+ \begin{array} { r l } { \mathrm { E L B O : } } & { { } \mathcal { L } _ { \pmb { \theta } } ( \mathbf { x } ) = \mathbb { E } _ { Q _ { \phi } ( z | \mathbf { x } ) } [ \log P _ { \pmb { \theta } } ( \mathbf { x } | z ) ] - K L [ Q _ { \phi } ( z | \mathbf { x } ) \ | | \ P ( z ) ] } \end{array}
52
+ $$
53
+
54
+ By sharing the variational parameters $\phi$ of the encoder across the data points (amortized inference Gershman & Goodman (2014)), variational autoencoders avoid per-data optimization loops typically needed by mean-field approaches.
55
+
56
+ # 3.1 SEQUENTIAL GENERATIVE MODELING
57
+
58
+ The standard setting in maximum-likelihood generative modeling is to estimate the set of parameters $\pmb \theta$ that will maximize the marginal likelihood $P _ { \pmb { \theta } } ( \mathbf { x } )$ for data sample $\mathbf { X }$ generated IID from a single true data distribution $P ^ { * } ( \mathbf { x } )$ . In our work we assume the data are generated from multiple distributions $P _ { i } ^ { * } ( \mathbf { x } )$ such that $\begin{array} { r } { P ^ { * } ( \mathbf { \bar { x } } ) = \sum _ { i } \pi _ { i } ^ { * } P _ { i } ^ { * } ( \mathbf { x } ) } \end{array}$ . In classical batch generative modelling, the individual data points are not associated with the specific generative distributions $P _ { i } ^ { * } ( \mathbf { x } )$ . Instead, the whole sample $\mathbf { X }$ is considered to be generated from the mixture distribution $P ^ { * } ( \mathbf { x } )$ . Latent variable models $P _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } ) = P _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } ) P ( \mathbf { z } )$ (such as VAEs) capture the complex structures in $P ^ { * } ( \mathbf { x } )$ by conditioning the observed variables $\mathbf { x }$ on the latent variables $\mathbf { z }$ and combining these in (possibly infinite) mixtures $\begin{array} { r } { P _ { \pmb { \theta } } ( \mathbf { x } ) = \int P _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } ) P ( \mathbf { z } ) \delta z } \end{array}$ .
59
+
60
+ Our sequential setting is vastly different from the batch approach described above. We receive a stream of (possibly infinite) data $\begin{array} { r c l } { \mathbf { X } } & { = } & { \{ \mathbf { X } _ { 1 } , \mathbf { X } _ { 2 } , \ldots \} } \end{array}$ where the data samples $\begin{array} { r l } { \mathbf { X } _ { i } } & { { } = } \end{array}$ $\{ \mathbf { x } _ { i } ^ { ( 1 ) } , \mathbf { x } _ { i } ^ { ( 2 ) } , \ldots , \mathbf { x } _ { i } ^ { ( K _ { i } ) } \}$ originate from the components $P _ { i } ^ { * } ( \mathbf { x } )$ of the generative distribution. At any given time we observe the latest sample $\mathbf { X } _ { i }$ generated from a single component $P _ { i } ^ { * } ( \mathbf { x } )$ without access to any of the previous samples generated by the other components of $P ^ { * } ( \mathbf { x } )$ . Our goal is to sequentially build an approximation $P _ { \pmb { \theta } } ( \mathbf { x } )$ of the true mixture $P ^ { * } ( \mathbf { x } )$ by only observing data from a single component $P _ { i } ^ { * } ( \mathbf { x } )$ at a time.
61
+
62
+ # 4 MODEL
63
+
64
+ ![](images/3b6612bebe19aa888fb068ec1bfd1318a4431d12d36e772e46e52fb3f6dd2577.jpg)
65
+ Figure 2: Shown above is the relationship of the teacher and the student generative models. Data generated from the teacher model is used to augment the student model’s training data and consistency is applied between posteriors. Best viewed in color.
66
+
67
+ To enable lifelong generative learning we propose a dual model architecture based on a student-teacher model. The teacher and the student have rather different roles throughout the learning process: the teacher’s role is to preserve the memory of the previously learned tasks and to pass this knowledge onto the student; the student’s role is to learn the distributions over the new incoming data while accommodating for the knowledge obtained from the teacher. The dual model architecture is summarized in figure 2.
68
+
69
+ The top part represents the teacher model. At any given time the teacher contains a summary of all previous distributions within the learned parameters of the encoder $Q _ { \Phi } ( z | \mathbf { x } )$ and the decoder $P _ { \Theta } ( \mathbf { x } | z )$ . The teacher is used to generate synthetic samples $\hat { \bf x }$ from these past distributions by decoding samples from the prior $\hat { z } \sim P ( z )$ through the decoder $\hat { \mathbf { x } } \sim P _ { \Theta } ( \bar { \mathbf { x } } | \hat { z } )$ . The generated synthetic samples $\hat { \bf x }$ are passed onto the student model as a form of knowledge transfer about the past distributions.
70
+
71
+ The bottom part of figure 2 represents the student, which is responsible for updating the parameters of the encoder $Q _ { \phi } ( z | \mathbf { x } )$ and decoder $P _ { \theta } ( \mathbf { x } | z )$ models over the newly observed data. The student is exposed to a mixture of learning instances $\mathbf { x }$ sampled from $\mathbf { x } \sim \mathcal { \dot { P } } ( \omega ) P ( \mathbf { x } | \omega )$ , $\omega \sim \mathrm { B e r } ( \pi )$ ; it sees synthetic instances generated by the teacher $P ( \mathbf { x } | \boldsymbol { \omega } = 0 ) = P _ { \Theta } ( \mathbf { x } | z )$ , and real ones sampled from the currently active training distribution $P ( { \bf x } | \omega = 1 ) = P ^ { * } ( { \bf x } )$ . The mean $\pi$ of the Bernouli distribution controls the sampling proportion of the previously learnt distributions to the current one.
72
+
73
+ If we have seen k distinct distributions prior to the currently active one then π = $\textstyle \pi = { \frac { k } { k + 1 } }$ . In this way we ensure that all the past distributions and the current one are equally represented in the training set used by the student model.
74
+
75
+ Once a new distribution is signalled, the old teacher is dropped, the student model is frozen and becomes the new teacher $( \phi \to \Phi , \theta \to \Theta )$ , and a new student is initiated with the latest weights $\phi$ and $\pmb { \theta }$ from the previous student (the new teacher).
76
+
77
+ # 4.1 TEACHER-STUDENT CONSISTENCY
78
+
79
+ Each new student instantiation uses the input data mix to learn a new approximate posterior $Q _ { \phi } ( z | \mathbf { x } )$ . In addition to being initiated by the new teacher’s weights and receiving information about the teacher’s knowledge via the synthetic samples $\hat { \bf x }$ , we further foster the lifelong learning idea by bringing the latent variable posterior induced by the student model closer to the respective posterior induced by the teacher model. We enforce the latter constraint only over the synthetic samples, ensuring that the previously learnt latent variable posteriors are preserved over the different models. In doing so, we alleviate the effect of catastrophic interference.
80
+
81
+ To achieve this, we complement the classical VAE objective (equation (2)) with a term minimizing the KL divergence $K L [ \partial _ { \phi } ( z | \hat { \mathbf { x } } ) | | Q _ { \Phi } ( z | \hat { \mathbf { x } } ) ]$ between the student’s and the teacher’s posteriors over the synthetic data $\hat { \bf x }$ . The teacher’s encoder model, which already has the accumulated knowledge from the previous learning steps, is thus reused within the new student’s objective. Under certain mild assumptions, we show that this objective reparameterizes the student model’s posterior, while preserving the same learning objective as a standard VAE (appendix section 7.0.1).
82
+
83
+ # 4.2 LATENT VARIABLE
84
+
85
+ A critical component of our model is the synthetic data generation by the teacher’s decoder $\hat { \mathbf { x } } ~ \sim ~ P _ { \Theta } ( \mathbf { x } | z )$ . The synthetic samples need to be representative of all the previously observed distributions in order to provide the student with ample information about the learning history. The teacher generates these synthetic samples by first sampling the latent variable from the prior $\hat { z } ~ \sim ~ P ( z )$ followed by the decoding step $\begin{array} { r } { \hat { \mathbf { x } } \sim \mathcal { P } _ { \Theta } ( \mathbf { x } | \hat { z } ) } \end{array}$ . As we will describe shortly, the latent variable $\hat { z }$ has a categorical component which corresponds to all the past distributions. This categorical component allows us to uniformly sample synthetic instances from all past distributions.
86
+
87
+ A simple unimodal prior distribution $P ( z )$ , such as the isotropic Gaussian typically used in classical VAEs, results in an undersampling of the data points that are mapped to a posterior mean that is further away from the prior mean. Visualizing the 2d latent posterior of MNIST in figure 1(b) allows us to get a better intuition of this problem. If for example the prior mean corresponds to a point in latent space between two disparate distributions, the sample generated will not correspond to a sample from the real distribution. Since we use synthetic samples from the teacher in the student model, this aliased sample corresponding to the prior mean, will be reused over and over again, causing corruption in the learning process. In addition, we would under represent the respective true distributions in the learning input mix of the student and eventually lead to distribution loss.
88
+
89
+ We circumvent this in our model by decomposing the latent variable $_ z$ into a discrete component $\boldsymbol { z } _ { d } ~ \in ~ \mathcal { R } ^ { J }$ and a continuous component $\tilde { z _ { c } } ~ \in ~ \bar { \mathcal { R } } ^ { F }$ , $z ~ = ~ [ z _ { d } , z _ { c } ]$ . The discrete component $z _ { d }$ shall summarise the most discriminative information about each of the true generating distributions $P _ { i } ^ { * } ( \mathbf { x } )$ . We use the uniform multivariate categorical prior $\begin{array} { r } { z _ { d } \sim C a t ( \frac { 1 } { J } ) } \end{array}$ to represent it and the same parametric family for the approximate posterior $Q _ { \Phi } ( z | \mathbf { x } )$ . The continuous $z _ { c }$ component is the global representation of the distributional variability and we use the multivariate standard normal as the prior $z _ { c } \sim { N ( \mathbf { 0 } , \pmb { I } ) }$ and the isotropic multivariate normal $N ( \mu , \sigma ^ { 2 } I )$ for the approximate posterior.
90
+
91
+ When generating synthetic data, the teacher now independently samples from the discrete and continuous priors $\hat { z } _ { d } \sim P ( z _ { d } ) , \hat { z } _ { c } \sim P ( z _ { c } )$ and uses the composition of these to condition the decoding step $\hat { \mathbf { x } } \sim P _ { \Theta } ( \mathbf { x } | \hat { z } _ { d } , \hat { z } _ { c } )$ . Since the discrete representation $\hat { z } _ { d }$ is associated with the true generative distribution components $P _ { i } ^ { * } ( \mathbf { x } )$ , uniformly sampling the discrete prior ensures that that the distributions are well represented in the synthetic mix that the student observes.
92
+
93
+ In general, the capacity of a categorical distribution is less than that of a continuous normal distribution. To prevent the VAE’s encoder from using primarily the continuous representation while disregarding the discrete one we further complement the learning objective by a term maximising the mutual information between the discrete representation and the data $I ( z _ { d } ; \mathbf { x } ) = H ( z _ { d } ) - H ( z _ { d } | \mathbf { x } )$ . $H ( z _ { d } )$ is used to denote the marginal entropy of $z _ { d }$ and $H ( z _ { d } | \mathbf { x } )$ denotes the conditional entropy of $z _ { d }$ given $\mathbf { x }$ . 1
94
+
95
+ # 4.3 LEARNING OBJECTIVE
96
+
97
+ The final learning objective for each of the student models is the maximization of the ELBO from equation (2), augmented by the negative of the cross-model consistency term introduced in section 4.1 and the mutual information term proposed in section 4.2.
98
+
99
+ $$
100
+ \begin{array} { r } { \mathbb { E } _ { Q _ { \phi } } [ l o g P _ { \theta } ( \mathbf { x } | z ) ] - K L [ Q _ { \phi } ( z | \mathbf { x } ) | | P ( z ) ] - \mathbb { 1 } ( \omega = 0 ) K L [ Q _ { \phi } ( z _ { d } | \mathbf { x } ) | | Q _ { \Phi } ( z _ { d } | \mathbf { x } ) ] + \lambda I ( z _ { d } ; \mathbf { x } ) \ , } \end{array}
101
+ $$
102
+
103
+ We sample the training instances $\mathbf { x }$ from $\mathbf { x } \sim P ( \omega ) P ( \mathbf { x } | \omega ) , \omega \sim B e r ( \pi )$ as described in section 4. Thus they can either be generated from the teacher model $\omega = 0$ ) or come from the training set of the currently active distribution $( \omega = 1 )$ ). $\mathbb { 1 } ( . )$ is the indicator function which evaluates to 1 if its argument is true and zero otherwise; it makes sure that the consistency regularizer is applied only over the synthetic samples generated by the teacher. The $\lambda$ hyper-parameter controls the importance of the mutual information regularizer. We present the analytical evaluation of the consistency regularizer in appendix section 7.0.1.
104
+
105
+ # 5 EXPERIMENTS
106
+
107
+ We conducted a set of experiments to explore the behaviour and properties of the method we propose. We specifically concentrate on the benefits our model brings in the lifelong learning setting which is the main motivation of our work. We explain the settings of the individual experiments and their focus in the following three sections.
108
+
109
+ In all the experiments we use the notion of a distributional ‘interval’: the interval in which we observe samples from a single distribution $P _ { i } ^ { * } ( \mathbf { x } )$ before the transition to the next distribution $P _ { i + 1 } ^ { * } ( \mathbf { x } )$ occurs. The length of the intervals is in principle random and we developed a heuristic to generate these. We provide further details on this together with other technical details related to the network implementation and training common for all the experiments in the appendix.
110
+
111
+ # 5.1 FASHION MNIST : SEQUENTIAL GENERATION
112
+
113
+ In this experiment, we seek to establish the performance benefit that our augmented objective formulation in section 4.3 brings into the learning in contrast to the simple ELBO objective 2. We do so by training two models with identical student-teacher architectures as introduced in section 4, with one using the consistency and mutual information augmented objective (with consistency) and the other using the standard ELBO objective (without consistency). We also demonstrate the ability of our model to disambiguate distributional boundaries from the distributional variations.
114
+
115
+ We use Fashion MNIST Xiao et al. (2017) 2 to simulate our sequential learning setting. We treat each object as a different distribution and present the model with samples drawn from a single distribution at a time. We sequentially progress over the ten available distributions. When a distribution transition occurs (new object) we signal the model, make the latest student the new teacher and instantiate a new student model.
116
+
117
+ We quantify the performance of the generative models by computing the ELBO over the standard Fashion MNIST test set after every distributional transition. The test set contains objects from all of the individual distributions. We run this procedure ten times and report the average test ELBO over the ten repetitions in figure 3(c). We see that around the 3rd interval (the 3rd distributional transition), the negative ELBO of the with consistency model is systematically below $\sim 2 0$ nats ) that of the without consistency model. This confirms the benefits of our new objective formulation for reducing the effects of the catastrophic interference, a crucial property in our lifelong learning setting. In the same figure we also plot the ELBO of the baseline batch VAE. The batch VAE will always outperform our model because it has simultaneous access to all of the distributions during training.
118
+
119
+ ![](images/de756f9933d2c746151e9331f505d0ed4cb3706f7841c6aa359e35e7728162f2.jpg)
120
+ Figure 3: (a) Generation with consistency regularizer. (b) Generation without consistency regularizer. (c) Average negative ELBO over ten trials (each) for the ten distributions within Fashion MNIST.
121
+
122
+ After observing and training over all ten distributions we generate samples from the final students of the two models. We do this by fixing the discrete distribution $z _ { d }$ to one-hot vectors over the whole categorical distribution, while randomly sampling the continuous prior $ { \boldsymbol { z } } _ { c } \sim \mathcal { N } ( 0 , I )$ . We contrast samples generated from the model with consistency (figure 3(a)) to the model without consistency (figure 3(b)). Our model learns to separate ’style’ from the distributional boundaries. For example, in the last row of our with consistency model, we observe the various styles of shoes. The without consistency model mixes the distributions randomly. This illustrates the benefits that our augmented objective has for achieving consistent sampling from the individual distributional components.
123
+
124
+ # 5.2 ROTATED MNIST $:$ LONG TERM DISTRIBUTION ACCUMULATION
125
+
126
+ In this experiment we dig deeper into the benefits our objective formulation brings for the lifelong learning setting. We expose the models to a much larger number of distributions and we explore how our augmented objective from 4.3 helps in preserving the previously learned knowledge. As in section 5.1, we compare models with and without consistency with identical teacher-student architectures. We measure the ability of the models to recall the previously learned information by looking at the consistency between the posterior of the student and the teacher models over the test data set
127
+
128
+ $$
129
+ \mathrm { \sf t e n c y : } \quad \# \{ k : Q _ { \Phi } ( z _ { d } | { \bf x } _ { k } ) = = Q _ { \phi } ( z _ { d } | { \bf x } _ { k } ) , { \bf x } _ { k } \in { \bf X } _ { t e s t } \} \mathrm { ~ . ~ }
130
+ $$
131
+
132
+ We use the MNIST dataset in which we rotate each of the original digit samples by angles $\nu =$ $[ 3 0 ^ { \circ }$ , $7 0 ^ { \circ }$ , $1 3 0 ^ { \circ }$ , $2 0 0 ^ { \circ }$ , $2 5 0 ^ { \circ }$ ]. We treat each rotation of a single digit family as an individual distribution $\{ P _ { i } ^ { * } ( \mathbf { x } ) \} _ { i = 1 } ^ { 7 0 }$ . Within each distributional interval, we sample the data by first sampling (uniformly with replacement) one of the 70 distributions and then sampling the data instances $\mathbf { x }$ from the selected distribution.
133
+
134
+ Figure 4(b) compares the consistency results of the two tested models throughout the learning process. Our model with the augmented objective clearly outperforms the model that uses the simple ELBO objective. This confirms the usefulness of the additional terms in our objective for preserving the previously learned knowledge in accordance with the lifelong learning paradigms. In addition, similarly as in experiment 5.1, figure 4(a) documents that the model with the augmented objective (thanks to reducing the effects of the catastrophic interference) achieves lower negative test ELBO systematically over the much longer course of learning ( $\sim 3 0$ nats).
135
+
136
+ We also visualise in figure 4(c) how the accumulation of knowledge speeds up the learning process. For each distributional interval we plot the norms of the model gradients across the learning iterations. We observe that for later distributional intervals the curves become steeper much quicker, reducing the gradients and reaching (lower) steady states much faster then in the early learning stages. This suggests that the latter models are able to learn quicker in our proposed architecture.
137
+
138
+ ![](images/7e68be6459eb4fe191ce9481bdea3906681f59cc2a823e02e61cb7449cfb295e.jpg)
139
+ Figure 4: (a) Negative test ELBO over the learning history; (b) consistency between the teacher and student posteriors across the test data samples normalized by the test data set size; (c) speed of learning convergence across distributional intervals. Best viewed in color.
140
+
141
+ # 5.3 SVHN TO MNIST
142
+
143
+ In this experiment we explore the ability of our model to retain and transfer knowledge across completely different datasets. We use MNIST and SVHN Netzer et al. (2011) to demonstrate this. We treat all samples from SVHN as being generated by one distribution $P _ { 1 } ^ { * } ( \mathbf { x } )$ and all the MNIST3 samples as generated by another distribution $P _ { 2 } ^ { * } ( \mathbf { x } )$ (irrespective of the specific digit).
144
+
145
+ We first train a student model (standard VAE) over the entire SVHN data set. Once done, we freeze the parameters of the encoder and the decoder and transfer the model into the teacher state $( \phi \to \Phi , \theta \to \Theta )$ . We then use this teacher to aid the learning of the new student over the mix of the teacher-generated synthetic SVHN samples $\hat { \bf x }$ and the true MNIST data.
146
+
147
+ ![](images/5b74ad0e049511c04d3e0276bca9b4fd870fefca948ab30f0adbba4860afe937.jpg)
148
+ Figure 5: (a) Reconstructions of test samples from SVHN[left] and MNIST[right]; (b) Decoded samples $\hat { \mathbf { x } } \sim P _ { \pmb { \theta } } ( \mathbf { x } | z _ { d } , z _ { c } )$ based on linear interpolation of $z _ { c } \in \mathcal { R } ^ { 2 }$ with $z _ { d } = [ 0 , 1 ]$ ; (c) Same as (b) but with $z _ { d } = [ 1 , 0 ]$ .
149
+
150
+ We use the final student model to reconstruct samples from the two datasets by passing them through the learned encoding/decoding flow: $\mathbf { x } \ \sim \ P _ { i } ^ { * } \ \mathrm { ( \mathbf { x } ) } \ \ z \ \sim \ Q _ { \phi } ( z | \mathbf { x } ) \ \ \hat { \mathbf { x } } \ \sim \ P _ { \theta } ( \mathbf { x } | z )$ . We visualise examples of the true inputs $\mathbf { x }$ and the respective reconstructions $\hat { \bf x }$ in figure 5(a). We see that even though the only true data the final model received for training were from MNIST, it can still reconstruct SVHN data. This confirms the ability of our architecture to transition between complex distributions while still preserving the knowledge learned from the previously observed distributions.
151
+
152
+ Finally, in figure 5(b) and 5(c) we illustrate the data generated from an interpolation of a 2-dimensional continuous latent space. For this we specifically trained the models with the continuous latent variable $z _ { c } \in \mathcal { R } ^ { 2 }$ . To generate the data, we fix the discrete categorical $z _ { d }$ to one of the possible values $\{ [ 0 , 1 ] , [ 1 , 0 ] \}$ and linearly interpolate the continuous $z _ { c }$ over the range $[ - 3 , 3 ]$ . We then decode these to obtain the samples $\hat { \mathbf { x } } \sim P _ { \pmb { \theta } } ( \mathbf { x } | \pmb { z } _ { d } , \pmb { z } _ { c } )$ . The model learns a common continuous structure for the two distributions which can be followed by observing the development in the generated samples from top left to bottom right on both figure 5(b) and 5(c).
153
+
154
+ # 6 CONCLUSION
155
+
156
+ In this work we propose a novel method for learning generative models over streaming data following the lifelong learning principles. The principal assumption for the data is that they are generated by multiple distributions and presented to the learner in a sequential manner (a set of observations from a single distribution followed by a distributional transition). A key limitation for the learning is that the method can only access data generated by the current distribution and has no access to any of the data generated by any of the previous distributions.
157
+
158
+ The proposed method is based on a dual student-teacher architecture where the teacher’s role is to preserve the past knowledge and aid the student in future learning. We argue for and augment the standard VAE’s ELBO objective by terms helping the teacher-student knowledge transfer. We demonstrate on a series of experiments the benefits this augmented objective brings in the lifelong learning settings by supporting the retention of previously learned knowledge (models) and limiting the usual effects of catastrophic interference.
159
+
160
+ In our future work we will explore the possibilities to extend our architecture to GAN-like Goodfellow et al. (2014) learning with the prospect to further improve the generative abilities of our method. GANs, however, do not use a metric for measuring the quality of the learned distributions such as the marginal likelihood or the ELBO in their objective and therefore the transfer of our architecture to these is not straightforward.
161
+
162
+ # REFERENCES
163
+
164
+ Tamara Broderick, Nicholas Boyd, Andre Wibisono, Ashia C. Wilson, and Michael I. Jordan. Streaming variational bayes. In Burges et al. (2013), pp. 1727–1735. URL http://papers. nips.cc/paper/4980-streaming-variational-bayes.
165
+
166
+ Christopher J. C. Burges, Leon Bottou, Zoubin Ghahramani, and Kilian Q. Weinberger (eds.).´ Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, 2013. URL http://papers.nips.cc/book/ advances-in-neural-information-processing-systems-26-2013.
167
+
168
+ Xi Chen, Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 2172–2180. Curran Associates, Inc., 2016.
169
+
170
+ Arnaud Declercq and Justus Piater. Online learning of gaussian mixture models-a two-level approach. In VISAPP 2008: Proceedings of the Third International Conference on Computer Vision Theory and Applications-Volume 1, pp. 605–611. INSTICC-Institute for Systems and Technologies of Information, Control and Communication, 2008.
171
+
172
+ Tommaso Furlanello, Jiaping Zhao, Andrew M Saxe, Laurent Itti, and Bosco S Tjan. Active long term memory networks. arXiv preprint arXiv:1606.02355, 2016.
173
+
174
+ Samuel Gershman and Noah Goodman. Amortized inference in probabilistic reasoning. In Proceedings of the Cognitive Science Society, volume 36, 2014.
175
+
176
+ Zoubin Ghahramani and H Attias. Online variational bayesian learning. In Slides from talk presented at NIPS workshop on Online Learning, 2000.
177
+
178
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Aistats, volume 9, pp. 249–256, 2010.
179
+
180
+ 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.
181
+
182
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. stat, 1050:9, 2015.
183
+
184
+ Matthew D Hoffman, David M Blei, Chong Wang, and John Paisley. Stochastic variational inference. The Journal of Machine Learning Research, 14(1):1303–1347, 2013.
185
+
186
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
187
+
188
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. International Conference on Learning Representations, 2017.
189
+
190
+ Harold Jeffreys. An invariant form for the prior probability in estimation problems. In Proceedings of the Royal Society of London a: mathematical, physical and engineering sciences, volume 186, pp. 453–461. The Royal Society, 1946.
191
+
192
+ Marek Karpinski and Angus Macintyre. Polynomial bounds for vc dimension of sigmoidal and general pfaffian neural networks. Journal of Computer and System Sciences, 54(1):169–176, 1997.
193
+
194
+ Diederik P Kingma. ”Variational Inference & Deep Learning: A New Synthesis”. PhD thesis, 2017.
195
+
196
+ Diederik P Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. 2015.
197
+
198
+ Durk P. Kingma and Max Welling. Auto-encoding variational bayes. ICLR, 2014.
199
+
200
+ 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, pp. 201611835, 2017.
201
+
202
+ Yann LeCun and Corinna Cortes. MNIST handwritten digit database. 2010. URL http://yann. lecun.com/exdb/mnist/.
203
+
204
+ Zhizhong Li and Derek Hoiem. Learning without forgetting. In European Conference on Computer Vision, pp. 614–629. Springer, 2016.
205
+
206
+ D. Lopez-Paz, B. Scholkopf, L. Bottou, and V. Vapnik. Unifying distillation and privileged ¨ information. In International Conference on Learning Representations, 2016.
207
+
208
+ Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016.
209
+
210
+ Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
211
+
212
+ James McInerney, Rajesh Ranganath, and David Blei. The population posterior and bayesian modeling on streams. In Advances in Neural Information Processing Systems, pp. 1153–1161, 2015.
213
+
214
+ Kevin P Murphy. Machine learning: a probabilistic perspective. MIT press, 2012.
215
+
216
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, volume 2011, pp. 5, 2011.
217
+
218
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
219
+
220
+ Yoram Singer and Manfred K. Warmuth. Batch and On-Line Parameter Estimation of Gaussian Mixtures Based on the Joint Entropy, pp. 578584. MIT Press, 1999.
221
+
222
+ Eduardo D Sontag. Vc dimension of neural networks. NATO ASI Series F Computer and Systems Sciences, 168:69–96, 1998.
223
+
224
+ Alex Tank, Nicholas Foti, and Emily Fox. Streaming variational inference for bayesian nonparametric mixture models. In Artificial Intelligence and Statistics, pp. 968–976, 2015.
225
+
226
+ Alexander V Terekhov, Guglielmo Montone, and J Kevin O’Regan. Knowledge transfer in deep block-modular neural networks. In Proceedings of the 4th International Conference on Biomimetic and Biohybrid Systems-Volume 9222, pp. 268–279. Springer-Verlag New York, Inc., 2015.
227
+
228
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
229
+
230
+ # 7 APPENDIX
231
+
232
+ # 7.0.1 UNDERSTANDING THE CONSISTENCY REGULARIZER
233
+
234
+ The analytical derivations of the consistency regularizer show that the regularizer can be interpreted as an a transformation of the standard VAE regularizer. In the case of an isotropic gaussian posterior, the proposed regularizer scales the mean and variance of the student posterior by the variance of the teacher 7.0.2 and adds an extra ’volume’ term. This interpretation of the consistency regularizer shows that the proposed regularizer preserves the same learning objective as that of the standard VAE. Below we present the analytical form of the consistency regularizer with categorical and isotropic gaussian posteriors:
235
+
236
+ Corollary 7.0.1 We parameterize the learnt posterior of the teacher by $\begin{array} { r } { \Phi _ { i } \ = \ \frac { \exp ( p _ { i } ^ { E } ) } { \sum _ { i = 1 } ^ { J } \exp ( p _ { i } ^ { E } ) } } \end{array}$ and the posterior of the student by φi = $\begin{array} { r } { c ^ { E } = \sum _ { i = 1 } ^ { J } \exp ( p _ { i } ^ { E } ) } \end{array}$ and $\begin{array} { r } { c ^ { S } = \sum _ { i = 1 } ^ { J } \exp ( p _ { i } ^ { S } ) . } \end{array}$ $\begin{array} { r } { \phi _ { i } = \frac { \exp ( p _ { i } ^ { S } ) } { \sum _ { i = 1 } ^ { J } \exp ( p _ { i } ^ { S } ) } } \end{array}$ . We also redefine the normalizing constants as the teacher and student models respectively. The reverse $K L$ divergence in equation 8 can now be re-written as:
237
+
238
+ $$
239
+ \begin{array} { c } { { \displaystyle K L ( Q _ { \phi } ( z _ { d } | x ) | | Q _ { \Phi } ( z _ { d } | x ) ) = \sum _ { i = 1 } ^ { J } \frac { \exp ( p _ { i } ^ { S } ) } { c ^ { S } } l o g \left( \frac { \exp ( p _ { i } ^ { S } ) } { c ^ { S } } \frac { c ^ { E } } { \exp ( p _ { i } ^ { E } ) } \right) } } \\ { { = H ( p ^ { S } , p ^ { S } - p ^ { E } ) = - H ( p ^ { s } ) + H ( p ^ { S } , p ^ { E } ) } } \end{array}
240
+ $$
241
+
242
+ where $H ( \mathbf { \Sigma } _ { - } )$ is the entropy operator and $H ( \ l _ { - } , \ l _ { - } )$ is the cross-entropy operator.
243
+
244
+ Corollary 7.0.2 We assume the learnt posterior of the teacher is parameterized by a centered, isotropic gaussian with $\Phi \ : = \ : [ \pmb { \mu } ^ { E } \ : = \ : \mathbf { 0 } , \pmb { \Sigma } _ { \sim } ^ { E } \ : = \ : \sigma ^ { E ^ { 2 } } \underline { { { I } } } ]$ and the posterior of our student by $a$ non-centered isotropic gaussian with $\phi = [ \mu ^ { S } , \Sigma ^ { S } = \sigma ^ { S 2 } I ]$ , then
245
+
246
+ $$
247
+ \begin{array} { l } { { \displaystyle \nabla L ( Q _ { \phi } ( z | x ) | | Q _ { \Phi } ( z | x ) ) = 0 . 5 \biggl [ t r ( \Sigma ^ { E ^ { - 1 } } \Sigma ^ { S } ) + ( \mu ^ { E } - \mu ^ { S } ) ^ { T } \Sigma ^ { E ^ { - 1 } } ( \mu ^ { E } - \mu ^ { S } ) - F + l o g \biggl ( \frac { | \Sigma ^ { E } | } { | \Sigma ^ { S } | } \biggr ) \biggr ] } } \\ { { \displaystyle = 0 . 5 \sum _ { j = 1 } ^ { F } \biggl [ \frac { 1 } { \sigma ^ { E ^ { 2 } } ( j ) } ( \sigma ^ { S 2 } ( j ) + \mu ^ { S 2 } ( j ) ) - 1 + l o g \sigma ^ { E 2 } ( j ) - l o g \sigma ^ { S 2 } ( j ) \biggr ] } } \\ { { \displaystyle = K L ( Q _ { \phi ^ { * } } ( z | x ) | | \mathcal { N } ( 0 , I ) ) - l o g | \Sigma ^ { E } | } } \end{array}
248
+ $$
249
+
250
+ Via a reparameterization of the student’s parameters:
251
+
252
+ $$
253
+ \begin{array} { c } { { \displaystyle \phi ^ { * } = [ \mu ^ { S * } , \sigma ^ { S * 2 } ] } } \\ { { \displaystyle \mu ^ { S * } = \frac { \mu ^ { S } ( j ) } { \sigma ^ { E 2 } ( j ) } ; \sigma ^ { S * 2 } = \frac { \sigma ^ { S 2 } ( j ) } { \sigma ^ { E 2 } ( j ) } } } \end{array}
254
+ $$
255
+
256
+ It is also interesting to note that our posterior regularizer becomes the prior if:
257
+
258
+ $$
259
+ l i m _ { \sigma ^ { E ^ { 2 } } \mapsto 1 } K L ( Q _ { \phi } ( z | x ) | | Q _ { \Phi } ( z | x ) ) = K L ( Q _ { \phi } ( z | x ) | | \mathcal { N } ( 0 , I ) )
260
+ $$
261
+
262
+ # 7.1 ELBO DERIVATION
263
+
264
+ Variational inference Hoffman et al. (2013) side-steps the intractability of the posterior distribution by approximating it with a tractable distribution $Q _ { \Phi } ( z | \mathbf { x } )$ ; we then optimize the parameters $\Phi$ in order to bring this distribution close to $P _ { \Phi } ( z | \mathbf { x } )$ . The form of this approximate distribution is fixed and is generally conjugate to the prior $P ( z )$ . Variational inference converts the problem of posterior inference into an optimization problem over $\Phi$ . This allows us to utilize stochastic gradient descent to solve our problem. To be more concrete, variational inference tries to minimize the reverse Kullback-Leibler (KL) divergence between the variational posterior distribution $Q _ { \Phi } ( z | \mathbf { x } )$ and the true posterior $P _ { \pmb { \theta } } ( \pmb { z } | \mathbf { x } )$ :
265
+
266
+ $$
267
+ K L [ Q _ { \Phi } ( z | \mathbf { x } ) | | P _ { \theta } ( z | \mathbf { x } ) ] = \log P _ { \theta } ( \mathbf { x } ) - \underbrace { \mathbb { E } _ { Q _ { \Phi } ( z | \mathbf { x } ) } \left[ \log \frac { P _ { \theta } ( x , z ) } { Q _ { \Phi } ( z | \mathbf { x } ) } \right] } _ { \mathcal { L } _ { \theta } }
268
+ $$
269
+
270
+ Rearranging the terms in equation 8 and utilizing the fact that the KL divergence is a measure, we can derive the evidence lower bound $\mathcal { L } _ { \theta }$ (ELBO) which is the objective function we directly optimize:
271
+
272
+ $$
273
+ l o g P _ { \pmb \theta } ( \mathbf { x } ) \geq \mathbb { E } _ { Q _ { \Phi } ( z | \mathbf { x } ) } [ l o g P _ { \pmb \theta } ( \mathbf { x } | z ) ] - K L ( Q _ { \Phi } ( z | \mathbf { x } ) | | P ( z ) ) = \mathcal { L } _ { \pmb \theta }
274
+ $$
275
+
276
+ In order to backpropagate it is necessary to remove the dependence on the stochastic variable $_ { z }$ . To achieve this, we push the sampling operation outside of the computational graph for the normal distribution via the reparameterization trick Kingma & Welling (2014) and the gumbel-softmax reparameterization Maddison et al. (2016); Jang et al. (2017) for the discrete distribution. In essence the reparameterization trick allows us to introduce a distribution $P ( \epsilon )$ that is not a function of the data or computational graph in order to move the gradient operator into the expectation:
277
+
278
+ $$
279
+ \nabla \mathbb { E } _ { Q _ { \Phi } ( z | \mathbf { x } ) } \bigg [ \mathrm { l o g } \frac { P _ { \theta } ( x , z ) } { Q _ { \Phi } ( z | \mathbf { x } ) } \bigg ] \mapsto \mathbb { E } _ { P ( \epsilon ) } \bigg [ \nabla \mathrm { l o g } \frac { P _ { \theta } ( x , z ) } { Q _ { \Phi } ( z | \mathbf { x } ) } \bigg ]
280
+ $$
281
+
282
+ # 7.2 MODEL RELATED
283
+
284
+ In this section we provide extra details of our model architecture.
285
+
286
+ # 7.2.1 MODEL ARCHITECTURE
287
+
288
+ We utilized two different architectures for our experiments. The first two utilize a standard deep neural network with two layers of 512 to map to the latent representation and two layers of 512 to map back to the reconstruction for the decoder. We used batch norm Ioffe & Szegedy (2015) and ELU activations for all the layers barring the layer projecting into the latent representation and the output layer.
289
+
290
+ The final experiment with the transfer from SVHN to MNIST utilizes a fully convolutional architecture with only strided convolutional layers in the encoder (where the number of filters are doubled at each layer). The final projection layer for the encoder maps the data to a $[ { \mathsf { C } } { = } | z _ { d } |$ , 1, 1] output which is then reparameterized in the standard way. The decoder utilizes fractional strides for the convolutional-transpose (de-convolution) layers where we reduce the number of filters in half at each layer. The full architecture can be examined in our code repository [which will be de-anonymized after the review process]. All layers used batch norm Ioffe & Szegedy (2015) and ELU activations.
291
+
292
+ We utilized Adam Kingma & Ba (2015) to optimize all of our problems with a learning rate of 1e-4. When we utilized weight transfer we re-initialized the accumulated momentum vector of Adam as well as the aggregated mean and covariance of the Batch Norm layers. Our code is already available online under an MIT license at 4
293
+
294
+ # 7.2.2 GUMBEL REPARAMETERIZATION
295
+
296
+ Since we model our latent variable as a combination of a discrete and a continuous distribution we also use the Gumbel-Softmax reparameterization Maddison et al. (2016); Jang et al. (2017). The Gumbel-Softmax reparameterization over logits [linear output of the last layer in the encoder] $\pmb { p } \in \mathcal { R } ^ { M }$ and an annealed temperature parameter $\tau \in \mathcal { R }$ is defined as:
297
+
298
+ $$
299
+ z = s o f t m a x ( \frac { l o g ( p ) + g } { \tau } ) ; g = - l o g ( - l o g ( { \pmb u } \sim U n i f ( 0 , 1 ) ) )
300
+ $$
301
+
302
+ $\pmb { u } \in \mathcal { R } ^ { M } , \pmb { g } \in \mathcal { R } ^ { M }$ . As the temperature parameter $\tau \mapsto 0$ , $_ { z }$ converges to a categorical.
303
+
304
+ # 7.2.3 EXPANDABLE MODEL CAPACITY AND REPRESENTATIONS
305
+
306
+ Multilayer neural networks with sigmoidal activations have a VC dimension bounded between $O ( \rho ^ { 2 } )$ Sontag (1998) and $O ( \rho ^ { 4 } )$ Karpinski & Macintyre (1997) where $\rho$ are the number of parameters. A model that is able to consistently add new information should also be able to expand its VC dimension by adding new parameters over time. Our formulation imposes no restrictions on the model architecture: i.e. new layers can be added freely to the new student model.
307
+
308
+ In addition we also allow the dimensionality of $\boldsymbol { z } _ { d } \in \mathcal { R } ^ { J }$ , our discrete latent representation to grow in order to accommodate new distributions. This is possible because the KL divergence between two categorical distributions of different sizes can be evaluated by simply zero padding the teacher’s smaller discrete distribution. Since we also transfer weights between the teacher and the student model, we need to handle the case of expanding latent representations appropriately. In the event that we add a new distribution we copy all the weights besides the ones immediately surrounding the projection into and out of the latent distribution. These surrounding weights are reinitialized to their standard Glorot initializations Glorot & Bengio (2010).
309
+
310
+ # 7.3 FORWARD VS. REVERSE KL
311
+
312
+ ![](images/c20e180406d015f1a528955ddb39a6aeaad6b034df00717d8727af083540f5d4.jpg)
313
+ Figure 6: Reverse vs. forward KL on FashionMNIST 5.1
314
+
315
+ In our setting we have the ability to utilize the zero forcing (reverse or mode-seeking) KL or the zero avoiding (forward) KL divergence. In general, if the true underlying posterior is multi-modal, it is preferable to operate with the reverse KL divergence (Murphy (2012) 21.2.2). In addition, utilizing the mode-seeking KL divergence generates more realistic results when operating over image data.
316
+
317
+ In order to validate this, we repeat the experiment in 5.1. We train two models: one with the forward KL posterior regularizer and one with the reverse. We evaluate the -ELBO mean and variance over ten trials. Empirically, we observed no difference between the different measures. This is demonstrated in figure 6.
318
+
319
+ # 7.4 NUMBER OF REQUIRED SAMPLES
320
+
321
+ Our method derives its sample complexity from standard VAEs. In practice we evaluate the number of required real and synthetic samples by utilizing early stopping. When the negative ELBO on the validation set stops decreasing for 50 steps we stop training the current model and transition to the next distribution interval. Using this and the fact that we keep equal proportions of all observed distributions in our minibatch, we can evaluate the number of synthetic and real samples used during the single distribution interval. We demonstrate this procedure on experiment 5.1 in figure 7.
322
+
323
+ ![](images/cc4dab3f21baf14bf3afeebd6d4c9bdb4ca56c427a0d6ee500748df09837e33e.jpg)
324
+ Figure 7: FashionMNIST experiment 5.1 data efficiency analysis. Left: Real samples used; Right: Synthetic samples used
325
+
326
+ We observe a rapid decrease of the number of required real samples as we assimilate more distributions into our model.
327
+
328
+ # 7.5 EXPERIMENTS RELATED
329
+
330
+ In this section we provide an extra experiment run on MNIST as well as some extra images from the rotated MNIST experiment.
331
+
332
+ # 7.5.1 MNIST : GENERATION AND ELBO
333
+
334
+ ![](images/15a1a1e12ba4d93f4e0643a470665c0942c237892d48141604db03027ffeeb15.jpg)
335
+ Figure 8: (a) Generation with consistency regularizer. (b) Without consistency regularizer. (c) Average log-likelihood over ten trials (each) for the ten separated distributions within MNIST.
336
+
337
+ In this experiment, we seek to establish the performance benefit that the consistency regularizer brings into the learning process. We do so by evaluating the ELBO for a model with and without the consistency and mutual information regularizers. We also demonstrate the ability of the regularizers to disambiguate distributional boundaries and their inter-distributional variations. I.e. for MNIST this separates the MNIST digits from their inter-class variants (i.e drawing style).
338
+
339
+ We use MNIST to simulate our sequential learning setting. We treat each digit as a different distribution and present the model with samples drawn from a single distribution at a time. For the purpose of this experiment we sequentially progress over the ten distributions (i.e. interval sampling involves linearly iterating over all the distributions ).
340
+
341
+ When an interval transition occurs we signal the model, make the student the new teacher and instantiate a new student model. We contrast this to a model that utilizes the same graphical model, without our consistency and mutual information regularizers. We quantify the performance of the generative models by computing the ELBO over the standard MNIST test set at every interval. The test set contains digits from all of the individual distributions. We run this procedure ten times and report the average ELBO over the test set.
342
+
343
+ After observing all ten distributions we evaluate samples generated from the final student model. We do this by fixing the discrete distribution $z _ { d }$ , while randomly sampling $z _ { c } \sim \mathcal { N } ( 0 , I )$ . We contrast samples generated from the model with both regularizers (left-most image in 8) to the model without the regularizers (center image in 8). Our model learns to separate ’style’ from distributional boundaries. This is demonstrated by observing the digit $" 2 "$ : i.e. different samples of $z _ { c }$ produce different styles of writing a $" 2 "$ .
344
+
345
+ # 7.5.2 ROTATED MNIST EXPERIMENT
346
+
347
+ We provide a larger sized image for the ELBO from experiment 5.2. We also visualize reconstructions from the rotated MNIST problem (visualized in figure 10). Finally in figure 11 we show the effects on the reconstructions when we do not use the mutual information regularizer. We believe this is due to the fact that the network utilizes the larger continuous representation to model the discriminative aspects of the observed distribution.
348
+
349
+ ![](images/f19a75a72a657bd9f71a621bf6deb35b993d8e2c51ff3349c27ba3f7cb3d3923.jpg)
350
+ Figure 9: Visualization of ELBO for rotated MNIST evaluated at the last model (the one at the 70th interval)
351
+
352
+ ![](images/52599e0d0ae24dc9212c75394825fdde9b6e11ed1bf838c77e4af811fe8676d3.jpg)
353
+ Figure 10: Visualization of reconstructions for rotated MNIST evaluated at the last model (the one at the 70th interval)
354
+
355
+ ![](images/e0fedbcb6e99ba86a31cb6d4751934b6f6afe937d08337dcb166f202aef3e30c.jpg)
356
+ Figure 11: Visualization of reconstructions when we do not use the mutual information regularizer
md/train/SJA7xfb0b/SJA7xfb0b.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/SJg7KhVKPH/SJg7KhVKPH.md ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEPTH-ADAPTIVE TRANSFORMER
2
+
3
+ Maha Elbayad∗ Univ. Grenoble Alpes
4
+
5
+ Jiatao Gu, Edouard Grave, Michael Auli Facebook AI Research
6
+
7
+ # ABSTRACT
8
+
9
+ State of the art sequence-to-sequence models for large scale tasks perform a fixed number of computations for each input sequence regardless of whether it is easy or hard to process. In this paper, we train Transformer models which can make output predictions at different stages of the network and we investigate different ways to predict how much computation is required for a particular sequence. Unlike dynamic computation in Universal Transformers, which applies the same set of layers iteratively, we apply different layers at every step to adjust both the amount of computation as well as the model capacity. On IWSLT German-English translation our approach matches the accuracy of a well tuned baseline Transformer while using less than a quarter of the decoder layers.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The size of modern neural sequence models (Gehring et al., 2017; Vaswani et al., 2017; Devlin et al., 2019) can amount to billions of parameters (Radford et al., 2019). For example, the winning entry of the WMT’19 news machine translation task in English-German used an ensemble totaling two billion parameters $\mathrm { N g }$ et al., 2019). While large models are required to do better on hard examples, small models are likely to perform as well on easy ones, e.g., the aforementioned ensemble is probably not required to translate a short phrase such as "Thank you". However, current models apply the same amount of computation regardless of whether the input is easy or hard.
14
+
15
+ In this paper, we propose Transformers which adapt the number of layers to each input in order to achieve a good speed-accuracy trade off at inference time. We extend Graves (2016; ACT) who introduced dynamic computation to recurrent neural networks in several ways: we apply different layers at each stage, we investigate a range of designs and training targets for the halting module and we explicitly supervise through simple oracles to achieve good performance on large-scale tasks.
16
+
17
+ Universal Transformers (UT) rely on ACT for dynamic computation and repeatedly apply the same layer (Dehghani et al., 2018). Our work considers a variety of mechanisms to estimate the network depth and applies a different layer at each step. Moreover, Dehghani et al. (2018) fix the number of steps for large-scale machine translation whereas we vary the number of steps to demonstrate substantial improvements in speed at no loss in accuracy. UT uses a layer which contains as many weights as an entire standard Transformer and this layer is applied several times which impacts speed. Our approach does not increase the size of individual layers. We also extend the resource efficient object classification work of Huang et al. (2017) and Bolukbasi et al. (2017) to structured prediction where dynamic computation decisions impact future computation. Related work from computer vision includes Teerapittayanon et al. (2016); Figurnov et al. (2017) and Wang et al. (2018) who explored the idea of dynamic routing either by exiting early or by skipping layers.
18
+
19
+ We encode the input sequence using a standard Transformer encoder to generate the output sequence with a varying amount of computation in the decoder network. Dynamic computation poses a challenge for self-attention because omitted layers in prior time-steps may be required in the future. We experiment with two approaches to address this and show that a simple approach works well (§2). Next, we investigate different mechanisms to control the amount of computation in the decoder network, either for the entire sequence or on a per-token basis. This includes multinomial and binomial classifiers supervised by the model likelihood or whether the argmax is already correct as well as simply thresholding the model score (§3). Experiments on IWSLT14 German-English translation (Cettolo et al., 2014) as well as WMT’14 English-French translation show that we can match the performance of well tuned baseline models at up to $76 \%$ less computation (§4).
20
+
21
+ ![](images/c6b3f9ef1172307eaa082df73a5bf06366df36c55192e6d65cd4faba2c5300b2.jpg)
22
+ Figure 1: Training regimes for decoder networks able to emit outputs at any layer. Aligned training optimizes all output classifiers $\mathcal { C } _ { n }$ simultaneously assuming all previous hidden states for the current layer are available. Mixed training samples $M$ paths of random exits at which the model is assumed to have exited; missing previous hidden states are copied from below.
23
+
24
+ # 2 ANYTIME STRUCTURED PREDICTION
25
+
26
+ We first present a model that can make predictions at different layers. This is known as anytime prediction for computer vision models (Huang et al., 2017) and we extend it to structured prediction.
27
+
28
+ # 2.1 TRANSFORMER WITH MULTIPLE OUTPUT CLASSIFIERS
29
+
30
+ We base our approach on the Transformer sequence-to-sequence model (Vaswani et al., 2017). Both encoder and decoder networks contain $N$ stacked blocks where each has several sub-blocks surrounded by residual skip-connections. The first sub-block is a multi-head dot-product self-attention and the second a position-wise fully connected feed-forward network. For the decoder, there is an additional sub-block after the self-attention to add source context via another multi-head attention.
31
+
32
+ Given a pair of source-target sequences $( { \pmb x } , { \pmb y } )$ , $_ { \textbf { \em x } }$ is processed with the encoder to give representations $\pmb { s } = ( s _ { 1 } , \ldots , s _ { | \pmb { x } | } )$ . Next, the decoder generates $\textbf { { y } }$ step-by-step. For every new token $\pmb { y } _ { t }$ input |to the decoder at time $t$ , the $N$ decoder blocks process it to yield hidden states $\left( h _ { t } ^ { n } \right) _ { 1 \leq n \leq N }$ :
33
+
34
+ $$
35
+ h _ { t } ^ { 0 } = \mathrm { e m b e d } ( y _ { t } ) , \quad h _ { t } ^ { n } = \mathrm { b l o c k } _ { n } ( h _ { \leq t } ^ { n - 1 } , \pmb { s } ) ,
36
+ $$
37
+
38
+ where $\mathrm { b l o c k } _ { n }$ is the mapping associated with the $n ^ { \mathrm { t h } }$ block and embed is a lookup table.
39
+
40
+ The output distribution for predicting the next token is computed by feeding the activations of the last decoder layer $h _ { t } ^ { N }$ into a softmax normalized output classifier $W$ :
41
+
42
+ $$
43
+ p ( y _ { t + 1 } | h _ { t } ^ { N } ) = \mathrm { s o f t m a x } ( W h _ { t } ^ { N } )
44
+ $$
45
+
46
+ Standard Transformers have a single output classifier attached to the top of the decoder network. However, for dynamic computation we need to be able to make predictions at different stages of the network. To achieve this, we attach output classifiers $\mathcal { C } _ { n }$ parameterized by $W _ { n }$ to the output $h _ { t } ^ { n }$ of each of the $N$ decoder blocks:
47
+
48
+ $$
49
+ \forall n , \ p ( y _ { t + 1 } | h _ { t } ^ { n } ) = \operatorname { s o f t m a x } ( W _ { n } h _ { t } ^ { n } )
50
+ $$
51
+
52
+ The classifiers can be parameterized independently or we can share the weights across the $N$ blocks.
53
+
54
+ # 2.2 TRAINING MULTIPLE OUTPUT CLASSIFIERS
55
+
56
+ Dynamic computation enables the model to use any of the $N$ exit classifiers instead of just the final one. Some of our models can choose a different output classifier at each time-step which results in an exponential number of possible output classifier combinations in the sequence length.
57
+
58
+ We consider two possible ways to train the decoder network (Figure 1). Aligned training optimizes all classifiers simultaneously and assumes all previous hidden states required by the self-attention are available. However, at test time this is often not the case when we choose a different exit for every token which leads to misaligned states. Instead, mixed training samples several sequences of exits for a given sentence and exposes the model to hidden states from different layers.
59
+
60
+ Generally, for a given output sequence $\textbf { { y } }$ , we have a sequence of chosen exits $( n _ { 1 } , \ldots , n _ { | { \pmb y } | } )$ and we denote the block at which we exit at time $t$ as $n _ { t }$ .
61
+
62
+ # 2.2.1 ALIGNED TRAINING
63
+
64
+ Aligned training assumes all hidden states $h _ { 1 } ^ { n - 1 } , \ldots , h _ { t } ^ { n - 1 }$ are available in order to compute selfattention and it optimizes $N$ loss terms, one for each exit (Figure 1a):
65
+
66
+ $$
67
+ \mathrm { L L } _ { t } ^ { n } = \log p ( y _ { t } | h _ { t - 1 } ^ { n } ) , \quad \mathrm { L L } ^ { n } = \sum _ { t = 1 } ^ { | y | } \mathrm { L L } _ { t } ^ { n } , \quad \mathcal { L } _ { d e c } ( \pmb { x } , \pmb { y } ) = - \frac { 1 } { \sum _ { n } \omega _ { n } } \sum _ { n = 1 } ^ { N } \omega _ { n } \mathrm { L L } ^ { n } .
68
+ $$
69
+
70
+ The compound loss $\mathcal { L } _ { d e c } ( \pmb { x } , \pmb { y } )$ is a weighted average of $N$ terms w.r.t. to $\left( \omega _ { 1 } , \hdots \omega _ { N } \right)$ . We found that uniform weights achieve better BLEU compared to other weighing schemes $_ { . c . f }$ . Appendix A). At inference time, not all time-steps will have hidden states for the current layer since the model exited early. In this case, we simply copy the last computed state to all upper layers, similar to mixed training $( \ S 2 . 2 . 2 )$ . However, we do apply layer-specific key and value projections to the copied state.
71
+
72
+ # 2.2.2 MIXED TRAINING
73
+
74
+ Aligned training assumes that all hidden states of the previous time-steps are available but this assumption is unrealistic since an early exit may have been chosen previously. This creates a mismatch between training and testing. Mixed training reduces the mismatch by training the model to use hidden states from different blocks of previous time-steps for self-attention. We sample $M$ different exit sequences (n(m)1 , . $( n _ { 1 } ^ { ( m ) } , \dots n _ { | \pmb { y } | } ^ { ( m ) } ) _ { 1 \leq m \leq M }$ and evaluate the following loss:
75
+
76
+ $$
77
+ \mathrm { L L } ( n _ { 1 } , \dots , n _ { | \mathbf { y } | } ) = \sum _ { t = 1 } ^ { | \mathbf { y } | } \log p ( y _ { t } | h _ { t - 1 } ^ { n _ { t } } ) , \quad \mathscr { L } _ { d e c } ( \mathbf { x } , \mathbf { y } ) = - \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathrm { L L } ( n _ { 1 } ^ { ( m ) } , \dots , n _ { | \mathbf { y } | } ^ { ( m ) } ) .
78
+ $$
79
+
80
+ When $n _ { t } ~ < ~ N$ , we copy the last evaluated hidden state $h _ { t } ^ { n }$ to the subsequent layers so that the self-attention of future time steps can function as usual (see Figure 1b).
81
+
82
+ # 3 ADAPTIVE DEPTH ESTIMATION
83
+
84
+ We present a variety of mechanisms to predict the decoder block at which the model will stop and output the next token, or when it should exit to achieve a good speed-accuracy trade-off. We consider two approaches: sequence-specific depth decodes all output tokens using the same block (§3.1) while token-specific depth determines a separate exit for each individual token (§3.2).
85
+
86
+ We model the distribution of exiting at time-step $t$ with a parametric distribution $q _ { t }$ where $q _ { t } ( n )$ is the probability of computing ${ \mathrm { b l o c k } } _ { 1 } , \ldots , { \mathrm { b l o c k } } _ { n }$ and then emitting a prediction with $\mathcal { C } _ { n }$ . The parameters of $q _ { t }$ are optimized to match an oracle distribution $q _ { t } ^ { * }$ with cross-entropy:
87
+
88
+ $$
89
+ \mathcal { L } _ { \mathrm { e x i t } } ( { \pmb x } , { \pmb y } ) = \sum _ { t } H ( q _ { t } ^ { * } ( { \pmb x } , { \pmb y } ) , q _ { t } ( { \pmb x } ) )
90
+ $$
91
+
92
+ The exit loss $( \mathcal { L } _ { \mathrm { e x i t } } )$ is back-propagated to the encoder-decoder parameters. We simultaneously optimize the decoding loss (Eq. (4)) and the exit loss (Eq. (6)) balanced by a hyper-parameter $\alpha$ to ensure that the model maintains good generation accuracy. The final loss takes the form:
93
+
94
+ $$
95
+ \begin{array} { r } { \mathcal { L } ( \pmb { x } , \pmb { y } ) = \mathcal { L } _ { d e c } ( \pmb { x } , \pmb { y } ) + \alpha \mathcal { L } _ { \mathrm { e x i t } } ( \pmb { x } , \pmb { y } ) , } \end{array}
96
+ $$
97
+
98
+ In the following we describe for each approach how the exit distribution $q _ { t }$ is modeled (illustrated in Figure 2) and how the oracle distribution $q _ { t } ^ { * }$ is inferred.
99
+
100
+ ![](images/9ffbc9ee07d1225e2d2a69f3d20fd736e999c534160e2004ae183049c51fafd3.jpg)
101
+ Figure 2: Variants of the adaptive depth prediction classifiers. Sequence-specific depth uses a multinomial classifier to choose an exit for the entire output sequence based on the encoder output $s$ (2a). It then outputs a token at this depth with classifier $\mathcal { C } _ { n }$ . The token-specific multinomial classifier determines the exit after the first block and proceeds up to the predicted depth before outputting the next token (2b). The token geometric-like classifier (2c) makes a binary decision after every block to dictate whether to continue (C) to the next block or to stop (S) and emit an output distribution.
102
+
103
+ # 3.1 SEQUENCE-SPECIFIC DEPTH:
104
+
105
+ For sequence-specific depth, the exit distribution $q$ and the oracle distribution $q ^ { * }$ are independent of the time-step so we drop subscript $t$ . We condition the exit on the source sequence by feeding the average $s$ of the encoder outputs to a multinomial classifier:
106
+
107
+ $$
108
+ s = \frac { 1 } { | \pmb { x } | } \sum _ { t } s _ { t } , \quad q ( n | \pmb { x } ) = \mathrm { s o f t m a x } ( W _ { h } s + b _ { h } ) \in \mathbb { R } ^ { N } ,
109
+ $$
110
+
111
+ where $W _ { h }$ and $b _ { h }$ are the weights and biases of the halting mechanism. We consider two oracles to determine which of the $N$ blocks should be chosen. The first is based on the sequence likelihood and the second looks at an aggregate of the correctly predicted tokens at each block.
112
+
113
+ Likelihood-based: This oracle is based on the likelihood of the entire sequence after each block and we optimize it with the Dirac delta centered around the exit with the highest sequence likelihood.
114
+
115
+ $$
116
+ q ^ { * } ( { \pmb x } , { \pmb y } ) = \delta ( \arg \operatorname* { m a x } _ { n } { \mathrm { L L } ^ { n } } ) .
117
+ $$
118
+
119
+ We add a regularization term to encourage lower exits that achieve good likelihood:
120
+
121
+ $$
122
+ q ^ { * } ( { \pmb x } , { \pmb y } ) = \delta ( \arg \operatorname* { m a x } _ { n } { \mathrm { L L } ^ { n } } - \lambda n ) .
123
+ $$
124
+
125
+ Correctness-based: Likelihood ignores whether the model already assigns the highest score to the correct target. Instead, this oracle chooses the lowest block that assigns the largest score to the correct prediction. For each block, we count the number of correctly predicted tokens over the sequence and choose the block with the most number of correct tokens. A regularization term controls the trade-off between speed and accuracy.
126
+
127
+ $$
128
+ C ^ { n } = \# \{ t | y _ { t } = \arg \operatorname* { m a x } _ { y } p ( y | h _ { t - 1 } ^ { n } ) \} , \quad q ^ { * } ( x , y ) = \delta ( \arg \operatorname* { m a x } _ { n } C ^ { n } - \lambda n ) .
129
+ $$
130
+
131
+ Oracles based on test metrics such as BLEU are feasible but expensive to compute since we would need to decode every training sentence $N$ times. We leave this for future work.
132
+
133
+ # 3.2 TOKEN-SPECIFIC DEPTH:
134
+
135
+ The token-specific approach can choose a different exit at every time-step. We consider two options for the exit distribution $q _ { t }$ at time-step t: a multinomial with a classifier conditioned on the first decoder hidden state $h _ { t } ^ { 1 }$ and a geometric-like where an exit probability $\chi _ { t } ^ { n }$ is estimated after each block based on the activations of the current block $h _ { t } ^ { n }$ .
136
+
137
+ # Multinomial $q _ { t }$
138
+
139
+ $$
140
+ q _ { t } ( n | \pmb { x } , \pmb { y } _ { < t } ) = \mathrm { s o f t m a x } ( { W _ { h } } h _ { t } ^ { 1 } + b _ { h } ) ,
141
+ $$
142
+
143
+ The most probable exit arg max $q _ { t } ( n | \pmb { x } , \pmb { y } _ { < t } )$ is selected at inference.
144
+
145
+ Geometric-like $q _ { t }$
146
+
147
+ $$
148
+ \begin{array} { l } { \forall n \in [ 1 . . N - 1 ] , ~ \chi _ { t } ^ { n } = \mathrm { s i g m o i d } ( w _ { h } ^ { \top } h _ { t } ^ { n } + b _ { h } ) , } \\ { q _ { t } ( n | \pmb { x } , \pmb { y } _ { < t } ) = \left\{ \begin{array} { l l } { \chi _ { t } ^ { n } \displaystyle \prod _ { n ^ { \prime } < n } ( 1 - \chi _ { t } ^ { n ^ { \prime } } ) , \mathrm { i f } n < N } \\ { \displaystyle \prod _ { n ^ { \prime } < N } ( 1 - \chi _ { t } ^ { n ^ { \prime } } ) , \mathrm { o t h e r w i s e } } \end{array} \right. } \end{array}
149
+ $$
150
+
151
+ where, $d$ is the dimension of the decoder states, $W _ { h } \ \in \ \mathbb { R } ^ { N \times d }$ and $w _ { h } \in \mathbb { R } ^ { d }$ are the weights of the halting mechanisms, and $b _ { h }$ their biases. During inference the decoder exits when the halting signal $\chi _ { t } ^ { n }$ exceeds a threshold $\tau _ { n }$ which we tune on the valid set to achieve a better accuracy-speed trade-off. If thresholds $\left( \tau _ { n } \right) _ { 1 \leq n < N }$ have not been exceeded, then we default to exiting at block $N$ .
152
+
153
+ The two classifiers are trained to minimize the cross-entropy with respect to either one the following oracle distributions:
154
+
155
+ Likelihood-based: At each time-step $t$ , we choose the block whose exit classifier has the highest likelihood plus a regularization term weighted by $\lambda$ to encourage lower exits.
156
+
157
+ $$
158
+ q _ { t } ^ { * } ( \pmb { x } , \pmb { y } ) = \delta ( \arg \operatorname* { m a x } _ { n } \mathrm { L L } _ { t } ^ { n } - \lambda n )
159
+ $$
160
+
161
+ This oracle ignores the impact of the current decision on the future time-steps and we therefore consider smoothing the likelihoods with an RBF kernel.
162
+
163
+ $$
164
+ \kappa ( t , t ^ { \prime } ) = e ^ { - \frac { \lvert t - t ^ { \prime } \rvert ^ { 2 } } { \sigma } } , \quad \widetilde { \mathrm { L L } _ { t } ^ { n } } = \sum _ { t ^ { \prime } = 1 } ^ { \lfloor y \rfloor } \kappa ( t , t ^ { \prime } ) \mathrm { L L } _ { t ^ { \prime } } ^ { n } , \quad q _ { t } ^ { * } ( { \pmb x } , { \pmb y } ) = \delta ( \arg \operatorname* { m a x } _ { n } \widetilde { \mathrm { L L } _ { t } ^ { n } } - \lambda n ) ,
165
+ $$
166
+
167
+ where we control the size of the surrounding context with $\sigma$ the kernel width. We refer to this oracle as $\operatorname { L L } ( \sigma , \lambda )$ including the case where we only look at the likelihood of the current token with $\sigma \to 0$ .
168
+
169
+ Correctness-based: Similar to the likelihood-based oracle we can look at the correctness of the prediction at time-step $t$ as well as surrounding positions. We define the target $q _ { t } ^ { * }$ as follows:
170
+
171
+ $$
172
+ \begin{array} { l } { { C _ { t } ^ { n } = \mathbb { 1 } \big [ y _ { t } = \arg \operatorname* { m a x } _ { y } p ( y | h _ { t - 1 } ^ { n } ) \big ] , \quad \widetilde { C _ { t } ^ { n } } = \displaystyle \sum _ { t ^ { \prime } = 1 } ^ { | y | } \kappa ( t , t ^ { \prime } ) C _ { t } ^ { n } , } } \\ { { q _ { t } ^ { * } ( { \pmb x } , { \pmb y } ) = \delta ( \arg \operatorname* { m a x } _ { n } \widetilde { C _ { t } ^ { n } } - \lambda n ) . } } \end{array}
173
+ $$
174
+
175
+ Confidence thresholding Finally, we consider thresholding the model predictions (§2), i.e., exit when the maximum score of the current output classifier $p \bar { ( } y _ { t + 1 } | h _ { t } ^ { n } )$ exceeds a hyper-parameter threshold $\tau _ { n }$ . This does not require training and the thresholds $\pmb { \tau } = ( \tau _ { 1 } , \dots , \tau _ { N - 1 } )$ are simply tuned on the valid set to maximize BLEU. Concretely, for 10k iterations, we sample a sequence of thresholds $\tau \sim \mathcal { U } ( 0 , 1 ) ^ { N - 1 }$ , decode the valid set with the sampled thresholds and then evaluate the BLEU score and computational cost achieved with this choice of $\tau$ . After $1 0 \mathrm { k }$ evaluations we pick the best performing thresholds, that is $\tau$ with the highest BLEU in each cost segment.
176
+
177
+ # 4 EXPERIMENTS
178
+
179
+ # 4.1 EXPERIMENTAL SETUP
180
+
181
+ We evaluate on several benchmarks and measure tokenized BLEU (Papineni et al., 2002):
182
+
183
+ IWSLT’14 German to English (De-En). We use the setup of Edunov et al. (2018) and train on 160K sentence pairs. We use $N = 6$ blocks, a feed-forward network (ffn) of intermediate-dimension
184
+
185
+ Table 1: Aligned vs. mixed training on IWSLT De-En. We report valid BLEU for a uniformly sampled exit $\overset { \cdot } { n } \sim \mathcal { U } ( [ 1 . . 6 ] )$ at each token, a fixed exit $n \in [ 1 . . 6 ]$ for all tokens, as well as the average BLEU over the fixed exits. As baseline we show six standard Transformer models with 1-6 blocks.
186
+
187
+ <table><tr><td></td><td>Uniform</td><td>n=1</td><td>n=2</td><td>n=3</td><td>n=4</td><td>n=5</td><td>n=6</td><td>Average</td></tr><tr><td>Baseline</td><td>1</td><td>34.2</td><td>35.3</td><td>35.6</td><td>35.7</td><td>35.6</td><td>35.9</td><td>35.4</td></tr><tr><td>Aligned (ωn = 1)</td><td>35.5</td><td>34.1</td><td>35.5</td><td>35.8</td><td>36.1</td><td>36.1</td><td>36.2</td><td>35.6</td></tr><tr><td>Mixed M =1</td><td>34.1</td><td>32.9</td><td>34.3</td><td>34.5</td><td>34.5</td><td>34.6</td><td>34.5</td><td>34.2</td></tr><tr><td>Mixed M = 3</td><td>35.1</td><td>33.9</td><td>35.2</td><td>35.4</td><td>35.5</td><td>35.5</td><td>35.5</td><td>35.2</td></tr><tr><td>Mixed M = 6</td><td>35.3</td><td>34.2</td><td>35.4</td><td>35.8</td><td>35.9</td><td>35.8</td><td>35.9</td><td>35.5</td></tr></table>
188
+
189
+ 1024, 4 heads, dropout 0.3, embedding dimension $d _ { \mathrm { e n c } } = 5 1 2$ for the encoder and $d _ { \mathrm { d e c } } = 2 5 6$ for the decoder. Embeddings are untied with 6 different output classifiers. We evaluate with a single checkpoint and a beam of width 5.
190
+
191
+ WMT’14 English to French $( \mathbf { E n } \mathbf { - } \mathbf { F r } )$ . We also experiment on the much larger WMT’14 EnglishFrench task comprising $3 5 . 5 \mathrm { m }$ training sentence pairs. We develop on 26k held out pairs and test on newstest14. The vocabulary consists of 44k joint BPE types (Sennrich et al., 2016). We use a Transformer big architecture and tie the embeddings of the encoder, the decoder and the output classifiers $( ( W _ { n } ) _ { 1 \leq n \leq 6 } ; \ S 2 . 1 )$ . We average the last ten checkpoints and use a beam of width 4.
192
+
193
+ Models are implemented in fairseq (Ott et al., 2019) and are trained with Adam (Kingma & Ba, 2015). We train for 50k updates on 128 GPUs with a batch size of 460k tokens for WMT’14 En-Fr and on 2 GPUs with $^ \mathrm { 8 k }$ tokens per batch for IWSLT’14 De-En. To stabilize training, we re-normalize the gradients if the norm exceeds $g _ { \mathrm { c l i p } } = 3$ .
194
+
195
+ For models with adaptive exits, we first train without exit prediction ( $\alpha = 0$ in Eq. (7)) using the aligned mode $( c . f . \ S 2 . 2 . 1 )$ for $5 0 \mathrm { k }$ updates and then continue training with $\alpha \neq 0$ until convergence. The exit prediction classifiers are parameterized by a single linear layer (Eq. (8)) with the same input dimension as the embedding dimension, e.g., 1024 for a big Transformer; the output dimension is $N$ for a multinomial classifier or one for geometric-like. We exit when $\chi _ { t , n } > 0 . 5$ for geometric-like classifiers.
196
+
197
+ # 4.2 TRAINING MULTIPLE OUTPUT CLASSIFIERS
198
+
199
+ We first compare the two training regimes for our model $( \ S 2 . 2 )$ . Aligned training performs selfattention on aligned states (§2.2.1) and mixed training exposes self-attention to hidden states from different blocks $( \ S 2 . 2 . 2 )$ .
200
+
201
+ We compare the two training modes when choosing either a uniformly sampled exit or a fixed exit $n = 1 , \ldots , 6$ at inference time for every time-step. The sampled exit experiment tests the robustness to mixed hidden states and the fixed exit setup simulates an ideal setting where all previous states are available. As baselines we show six separate standard Transformers with $N \in [ 1 . . 6 ]$ decoder blocks. All models are trained with an equal number of updates and mixed training with $M { = } 6$ paths is most comparable to aligned training since the number of losses per sample is identical.
202
+
203
+ Table 1 shows that aligned training outperforms mixed training both for fixed exits as well as for randomly sampled exits. The latter is surprising since aligned training never exposes the self-attention mechanism to hidden states from other blocks. We suspect that this is due to the residual connections which copy features from lower blocks to subsequent layers and which are ubiquitous in Transformer models (§2). Aligned training also performs very competitively to the individual baseline models.
204
+
205
+ Aligned training is conceptually simple and fast. We can process a training example with $N$ exits in a single forward/backward pass while $M$ passes are needed for mixed training. In the remaining paper, we use the aligned mode to train our models. Appendix A reports experiments with weighing the various output classifiers differently but we found that a uniform weighting scheme worked well. On our largest setup, WMT’14 English-French, the training time of an aligned model with six output classifiers increases only marginally by about $1 \%$ compared to a baseline with a single output classifier keeping everything else equal.
206
+
207
+ ![](images/08aa6865d38f0ae73b75393499522f9a002e3778b5c4d0a3402639a98af647f1.jpg)
208
+ Figure 3: Trade-off between speed (average exit or AE) and accuracy (BLEU) for depth-adaptive methods on the IWSLT14 De-En test set.
209
+
210
+ ![](images/8208d9e007a1f6ef7e4f203a9c4bf94a1261af5e96cf9c95b86e08c15a27b5bb.jpg)
211
+ Figure 4: Effect of the hyper-parameters $\sigma$ and $\lambda$ on the average exit (AE) measured on the valid set of IWSLT’14 De-En.
212
+
213
+ # 4.3 ADAPTIVE DEPTH ESTIMATION
214
+
215
+ Next, we train models with aligned states and compare adaptive depth classifiers in terms of BLEU as well as computational effort. We measure the latter as the average exit per output token (AE).
216
+
217
+ As baselines we use again six separate standard Transformers with $N \in [ 1 . . 6 ]$ with a single output classifier. We also measure the performance of the aligned mode trained model for fixed exits $n \in$ [1..6]. For the adaptive depth token-specific models (Tok), we train four combinations: likelihoodbased oracle (LL) $^ +$ geometric-like, likelihood-based oracle (LL) $^ +$ multinomial, correctness based oracle $\left( \mathbf { C } \right) +$ geometric-like and correctness-based oracle $\left( \mathbf { C } \right) +$ multinomial. Sequence-specific models (Seq) are trained with the correctness oracle (C) and the likelihood oracle (LL) with different values for the regularization weight $\lambda$ . All parameters are tuned on the valid set and we report results on the test set for a range of average exits.
218
+
219
+ Figure 3 shows that the aligned model (blue line) can match the accuracy of a standard 6-block Transformer (black line) at half the number of layers ${ \mathrm { ~ \ : ~ } } _ { n } = 3 { \mathrm { ~ \ : ~ } }$ ) by always exiting at the third block. The aligned model outperforms the baseline for $n = 2 , \ldots , 6$ .
220
+
221
+ For token specific halting mechanisms (Figure 3a) the geometric-like classifiers achieves a better speed-accuracy trade-off than the multinomial classifiers (filled vs. empty triangles). For geometriclike classifiers, the correctness oracle outperforms the likelihood oracle (Tok-C geometric-like vs. Tok-LL geometric-like) but the trend is less clear for multinomial classifiers. At the sequence-level, likelihood is the better oracle (Figure 3b).
222
+
223
+ The rightmost Tok-C geometric-like point $( \sigma = 0$ , $\lambda = 0 . 1$ ) achieves 34.73 BLEU at $\mathrm { A E } = 1 . 4 2$ which corresponds to similar accuracy as the $N \ = \ 6$ baseline at $76 \%$ fewer decoding blocks.
224
+
225
+ ![](images/72eb06ffdaeb2b8f53f187689e2b19f54d633c162199e0bfd63806ba35e8e616.jpg)
226
+ Figure 5: Speed and accuracy on the WMT’14 English-French benchmark $( c . f .$ . Figure 3).
227
+
228
+ The best accuracy of the aligned model is 34.95 BLEU at exit 5 and the best comparable Tok-C geometric-like configuration achieves 34.99 BLEU at $\mathrm { A E } = 1 . 9 7$ , or $61 \%$ fewer decoding blocks. When fixing the budget to two decoder blocks, Tok-C geometric-like with $\mathrm { A E } = 1 . 9 7$ achieves BLEU 35, a 0.64 BLEU improvement over the baseline ( $N = 2$ ) and aligned which both achieve BLEU 34.35.
229
+
230
+ Confidence thresholding (Figure 3c) performs very well but cannot outperform Tok-C geometriclike.
231
+
232
+ Ablation of hyper-parameters In this section, we look at the effect of the two main hyperparameters on IWSLT’14 De-En: $\lambda$ the regularization scale ( $_ { . c . f }$ . Eq. (9)), and the RBF kernel width $\sigma$ used to smooth the scores $( c . f$ . Eq. (15)). We train Tok-LL Geometric-like models and evaluate them with their default thresholds (exit if $\chi _ { t } ^ { n } > 0 . 5 )$ . Figure 4a shows that higher values of $\lambda$ lead to lower exits. Figure 4b shows the effect of $\sigma$ for two values of $\lambda$ . In both curves, we see that wider kernels favor higher exits.
233
+
234
+ # 4.4 SCALING THE ADAPTIVE-DEPTH MODELS
235
+
236
+ Finally, we take the best performing models form the IWSLT benchmark and test them on the large WMT’14 English-French benchmark. Results on the test set (Figure 5a) show that adaptive depth still shows improvements but that they are diminished in this very large-scale setup. Confidence thresholding works very well and sequence-specific depth approaches improve only marginally over the baseline. Tok-LL geometric-like can match the best baseline result of BLEU 43.4 $N = 6$ ) by using only $\mathrm { A E } = 2 . 4 0$ which corresponds to $40 \%$ of the decoder blocks; the best aligned result of BLEU 43.6 can be matched with $\mathrm { A E } = 3 . 2 5$ . In this setup, Tok-LL geometric-like slightly outperforms the Tok-C counterpart.
237
+
238
+ Confidence thresholding matches the accuracy of the $N { = } 6$ baseline with AE 2.5 or $59 \%$ fewer decoding blocks. However, confidence thresholding requires computing the output classifier at each block to determine whether to halt or continue. This is a large overhead since output classifiers predict 44k types for this benchmark (§4.1). To better account for this, we measure the average number of FLOPs per output token (details in Appendix B). Figure 5b shows that the Tok-LL geometric-like approach provides a better trade-off when the overhead of the output classifiers is considered.
239
+
240
+ # 4.5 QUALITATIVE RESULTS
241
+
242
+ The exit distribution for a given sample can give insights into what a Depth-Adaptive Transformer decoder considers to be a difficult task. In this section, for each hypothesis $\widetilde { \boldsymbol { y } }$ , we will look at the sequence of selected exits $( n _ { 1 } , \ldots , n _ { | \tilde { \pmb { y } } | } )$ and the probability scores $( p _ { 1 } , \hdots p _ { | \widetilde { \pmb { y } } | } )$ with $\begin{array} { r l } { p _ { t } } & { { } = } \end{array}$ $p ( \widetilde { y } _ { t } | h _ { t - 1 } ^ { n _ { t } } )$ e i.e. the confidence of the model in the sampled token at the selected exit.
243
+
244
+ Figures 6 and 7 show hypotheses from the WMT’14 En-Fr and IWSLT’14 De-En test sets, respectively. For each hypothesis we state the exits and the probability scores. In Figure 6a, predicting
245
+
246
+ ![](images/73aee9ecfc92f773d75e7f5027eab3b98129a636e72fa4ceb61bb68a12f85cc2.jpg)
247
+
248
+ ![](images/684d9684562ed9f33faf762808bedff084b7388602287045fea2467431609d51.jpg)
249
+
250
+ (a) Src: Chi@@rac , the Prime Minister , was there . Ref: Chi@@rac , Premier ministre , est là .
251
+
252
+ (b) Src: But passengers shoul@@dn’t expect changes to happen immediately . Ref: Mais les passagers ne devraient pas ${ \mathrm { ~ s ~ } } ^ { \prime }$ attendre à des changements immédiats .
253
+
254
+ Figure 6: Examples from the WMT’14 En-Fr test set (newstest14) with Tok-LL geometric-like depth estimation. Token exits are in blue and confidence scores are in gray. The $\bullet _ { @ \mathbb { Q } } ,$ are due to BPE or subword tokenization. For each example the source (Src) and the reference (Ref) are provided in the caption.
255
+
256
+ ![](images/c09a06b4990673a86c9b78ffc1d7e7a2e7d8b550d430e028ee6b5dbf8b98eb27.jpg)
257
+ Figure 7: Example from the IWSLT’14 De-En test set with Tok-LL geometric-like depth estimation. See Figure 6 for more details.
258
+
259
+ (a) Src: diesen trick können sie ihren freunden und nachbarn vor@@führen . danke . Ref: there is a trick you can do for your friends and neighb@@ors . thanks .
260
+
261
+ ‘présent’ (meaning ‘present’) is hard. A straightforward translation is ‘était là’ but the model chooses ‘present’ which is also appropriate. In Figure 6b, the model uses more computation to predict the definite article ‘les’ since the source has omitted the article for ‘passengers’.
262
+
263
+ A clear trend in both benchmarks is that the model requires less computation near the end of decoding to generate the end of sequence marker $< / \mathrm { s } >$ and the preceding full-stop when relevant. In Figure 8, we show the distribution of the exits at the beginning and near the end of test set hypotheses. We consider the beginning of a sequence to be the first $10 \%$ of tokens and the end as the last $10 \%$ of tokens. The exit distributions are shown for three models on WMT’14 En-Fr: Model1 has an average exit of $\mathrm { A E = 2 . 5 3 }$ , Model2 exits at $\mathrm { A E } = 3 . 7 9$ on average and $\mathbf { M o d e l } _ { 3 }$ with $\mathrm { A E } = 4 . 6 8$ . Within the same models, deep exits late are used at the beginning of the sequence and early exits are selected near the end. For heavily regularized models such as $\mathbf { M o d e l } _ { 1 }$ with $\mathrm { A E = 2 . 5 3 }$ , the disparity between beginning and end is less severe as the model exits early most of the time. $\mathbf { M o d e l } _ { 2 }$ and Model3 are less regularized (higher AE) and tend to use late exits at the beginning of the sequence and early exits near the end. On the other hand, the more regularized $\mathbf { M o d e l } _ { 1 }$ with $\mathrm { A E = 2 . 5 3 }$ exits early most of the time. There is also a correlation between the model probability and the amount of computation, particularly in models with low AE . Figure 9 shows the joint histogram of the scores and the selected exit. For both $\mathbf { M o d e l } _ { 1 }$ and $\mathbf { M o d e l } _ { 2 }$ , low exits $( n \leq 2 )$ are used in the high confidence range $[ 0 . 8 - 1 ]$ and high exits $( n \geq 4 )$ ) are used in the low-confidence range $[ 0 - 0 . { \bar { 5 } } ]$ . $\mathbf { M o d e l } _ { 3 }$ has a high average exit $\mathrm { ( A E = 4 . 6 8 ) }$ ) so most tokens exit late, however, in low confidence ranges the model does not exit earlier than $n = 5$ .
264
+
265
+ ![](images/2f53098f789a934627fba81e59ffbd43421d69fdd9ce9be0f5f4c72460559af7.jpg)
266
+ Figure 8: WMT’14 En-Fr test set: exit distributions in the beginning (relative-position: $\mathrm { r p o s } { < } 0 . 1 $ ) and near the end $\mathrm { ( r p o s > 0 . 9 ) }$ ) of the hypotheses of three models.
267
+
268
+ ![](images/dd8c2c9e3222d3d928628a33e80512b5c1b5a33ff8368bceafa11540393d5485.jpg)
269
+ Figure 9: Joint histogram of the exits and the confidence scores for 3 Tok-LL geometric-like models on newstest14.
270
+
271
+ # 5 CONCLUSION
272
+
273
+ We extended anytime prediction to the structured prediction setting and introduced simple but effective methods to equip sequence models to make predictions at different points in the network. We compared a number of different mechanisms to predict the required network depth and find that a simple correctness based geometric-like classifier obtains the best trade-off between speed and accuracy. Results show that the number of decoder layers can be reduced by more than three quarters at no loss in accuracy compared to a well tuned Transformer baseline.
274
+
275
+ # ACKNOWLEDGMENTS
276
+
277
+ We thank Laurens van der Maaten for fruitful comments and suggestions.
278
+
279
+ # REFERENCES
280
+
281
+ Tolga Bolukbasi, Joseph Wang, Ofer Dekel, and Venkatesh Saligrama. Adaptive neural networks for efficient inference. In Proc. of ICML, 2017.
282
+ M. Cettolo, J. Niehues, S. Stüker, L. Bentivogli, and M. Federico. Report on the 11th iwslt evaluation campaign. In IWSLT, 2014.
283
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In Proc. of ICLR, 2018.
284
+ 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.
285
+ 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.
286
+ Michael Figurnov, Artem Sobolev, and Dmitry P. Vetrov. Probabilistic adaptive computation time. In ArXiv preprint, 2017.
287
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In Proc. of ICML, 2017.
288
+ Alex Graves. Adaptive computation time for recurrent neural networks. In ArXiv preprint, 2016.
289
+ Gao Huang, Danlu Chen, Tianhong Li, Felix Wu, Laurens van der Maaten, and Kilian Q Weinberger. Multi-scale dense networks for resource efficient image classification. In Proc. of ICLR, 2017.
290
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. In Proc. of ICLR, 2015.
291
+ Nathan Ng, Kyra Yee, Alexei Baevski, Myle Ott, Michael Auli, and Sergey Edunov. Facebook fair’s wmt19 news translation task submission. In Proc. of WMT, 2019.
292
+ 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 Proc. of NAACL, 2019.
293
+ K. Papineni, S. Roukos, T. Ward, and W.-J. Zhu. BLEU: a method for automatic evaluation of machine translation. In Proc. of ACL, 2002.
294
+ Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. In Technical report, OpenAI., 2019.
295
+ R. Sennrich, B. Haddow, and A. Birch. Neural machine translation of rare words with subword units. In Proc. of ACL, 2016.
296
+ Surat Teerapittayanon, Bradley McDanel, and Hsiang-Tsung Kung. Branchynet: Fast inference via early exiting from deep neural networks. In ICPR, 2016.
297
+ A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In Proc. of NeurIPS, 2017.
298
+ Xin Wang, Fisher Yu, Zi-Yi Dou, Trevor Darrell, and Joseph E Gonzalez. Skipnet: Learning dynamic routing in convolutional networks. In Proc. of ECCV, 2018.
299
+
300
+ # APPENDIX A LOSS SCALING
301
+
302
+ In this section we experiment with different weights for scaling the output classifier losses. Instead of uniform weighting, we bias towards specific output classifiers by assigning higher weights to their losses. Table 2 shows that weighing the classifiers equally provides good results.
303
+
304
+ (b) IWSLT De-En - Test
305
+
306
+ <table><tr><td></td><td>Uniform</td><td>n=1</td><td>n=2</td><td>n=3</td><td>n=4</td><td>n=5</td><td>n=6</td><td>Average</td></tr><tr><td>Baseline</td><td>-</td><td>34.2</td><td>35.3</td><td>35.6</td><td>35.7</td><td>35.6</td><td>35.9</td><td>35.4</td></tr><tr><td>Wn=1</td><td>35.5</td><td>34.1</td><td>35.5</td><td>35.8</td><td>36.1</td><td>36.1</td><td>36.2</td><td>35.6</td></tr><tr><td>Wn=n</td><td>35.3</td><td>32.2</td><td>35.0</td><td>35.8</td><td>36.0</td><td>36.2</td><td>36.3</td><td>35.2</td></tr><tr><td>Wn=√n</td><td>35.4</td><td>33.3</td><td>35.2</td><td>35.8</td><td>35.9</td><td>36.1</td><td>36.1</td><td>35.4</td></tr><tr><td>Wn=1/√n</td><td>35.6</td><td>34.5</td><td>35.4</td><td>35.7</td><td>35.8</td><td>35.8</td><td>35.9</td><td>35.5</td></tr><tr><td>Wn=1/n</td><td>35.3</td><td>34.7</td><td>35.3</td><td>35.5</td><td>35.7</td><td>35.8</td><td>35.8</td><td>35.5</td></tr><tr><td colspan="9">(a) IWSLT De-En - Valid</td></tr><tr><td></td><td>Uniform</td><td>n=1</td><td>n=2</td><td>n=3</td><td>n=4</td><td>n=5</td><td>n=6</td><td>Average</td></tr><tr><td>Baseline</td><td>1</td><td>33.7</td><td>34.6</td><td>34.6</td><td>34.6</td><td>34.6</td><td>34.8</td><td>34.5</td></tr><tr><td>Wn=1</td><td>34.4</td><td>33.2</td><td>34.4</td><td>34.8</td><td>34.9</td><td>35.0</td><td>34.9</td><td>34.5</td></tr><tr><td>Wn=n</td><td>34.2</td><td>31.4</td><td>33.8</td><td>34.7</td><td>34.8</td><td>34.8</td><td>34.9</td><td>34.1</td></tr><tr><td>Wn=√n</td><td>34.4</td><td>32.5</td><td>34.1</td><td>34.8</td><td>34.9</td><td>35.0</td><td>35.1</td><td>34.4</td></tr><tr><td>Wn=1/√n</td><td>34.6</td><td>33.7</td><td>34.3</td><td>34.6</td><td>34.8</td><td>34.8</td><td>34.9</td><td>34.5</td></tr><tr><td>wn=1/n</td><td>34.2</td><td>33.8</td><td>34.3</td><td>34.5</td><td>34.6</td><td>34.7</td><td>34.7</td><td>34.4</td></tr></table>
307
+
308
+ Table 2: Aligned training with different weights $\left( \omega _ { n } \right)$ on IWSLT De-En. For each model we report BLEU on the dev set evaluated with a uniformly sampled exit $n \sim \mathcal { U } ( [ 1 . . 6 ] )$ for each token and a fixed exit $n \in [ 1 . . 6 ]$ throughout the sequence. The average corresponds to the average BLEU over the fixed exits.
309
+
310
+ Gradient scaling Adding intermediate supervision at different levels of the decoder results in richer gradients for lower blocks compared to upper blocks. This is because earlier layers affect more loss terms in the compound loss of Eq. (4). To balance the gradients of each block in the decoder, we scale up the gradients of each loss term $\left( - \operatorname { L L } _ { n } \right)$ when it is updating the parameters of its associated block $\mathrm { ( b l o c k } _ { n }$ with parameters $\theta _ { n }$ ) and revert it back to its normal scale before back-propagating it to the previous blocks. Figure 10 and Algorithm 1 illustrate this gradient scaling procedure. The $\theta _ { n }$ are updated with $\gamma _ { n }$ -amplified gradients from the block’s supervision and $( N { - } n )$ gradients from the subsequent blocks. We choose $\gamma _ { n } = \gamma ( N - n )$ to control the ratio $\gamma { : } 1$ as the ratio of the block supervision to the subsequent blocks’ supervisions.
311
+
312
+ Table 3 shows that gradient scaling can benefit the lowest layer at the expense of higher layers.
313
+ However, no scaling generally works very well.
314
+
315
+ ![](images/ea1e31e6c741caa889c0b1175b0bed7b176d252c5f35d54ca54e3389a0dd0932.jpg)
316
+ Figure 10: Illustration of gradient scaling.
317
+
318
+ # Algorithm 1 Pseudo-code for gradient scaling (illustrated for a single step t)
319
+
320
+ 1: for $n \in 1 . . N$ do
321
+ 2: $h _ { t } ^ { n } = \mathrm { b l o c k } _ { n } ( h _ { t } ^ { n - 1 } )$
322
+ 3: $p ( y _ { t + 1 } | h _ { t } ^ { n } ) = \mathrm { s o f t m a x } ( W _ { n } h _ { t } ^ { n } )$
323
+ 4: p(yt+1|hnt ) = SCALE_GRADIENT(p(yt+1|hnt ), γn)
324
+ 5: if $n < N$ then hnt = SCALE_GRADIENT(hnt , 1 )
325
+ γn+1
326
+ 6: end for
327
+ 7: function SCALE_GRADIENT(Tensor $x$ , scale $\gamma$ )
328
+ 8: return $\gamma x + ( 1 - \gamma )$ STOP_GRADIENT $( x )$
329
+ 9: $\triangleright$ STOP_GRADIENT in PyTorch with $x$ .detach().
330
+
331
+ # 10: end function
332
+
333
+ (b) IWSLT De-En - Test
334
+
335
+ <table><tr><td></td><td>Uniform</td><td>n=1</td><td>n=2</td><td>n=3</td><td>n=4</td><td>n=5</td><td>n=6</td><td>Average</td></tr><tr><td>Baseline</td><td>1</td><td>34.2</td><td>35.3</td><td>35.6</td><td>35.7</td><td>35.6</td><td>35.9</td><td>35.4</td></tr><tr><td>@</td><td>35.5</td><td>34.1</td><td>35.5</td><td>35.8</td><td>36.1</td><td>36.1</td><td>36.2</td><td>35.6</td></tr><tr><td>γ = 0.3</td><td>35.1</td><td>33.7</td><td>34.7</td><td>35.3</td><td>35.7</td><td>35.8</td><td>36.0</td><td>35.2</td></tr><tr><td>γ = 0.5</td><td>35.4</td><td>34.8</td><td>35.4</td><td>35.6</td><td>35.6</td><td>35.7</td><td>35.6</td><td>35.4</td></tr><tr><td>γ = 0.7</td><td>34.9</td><td>34.6</td><td>35.1</td><td>35.1</td><td>35.2</td><td>35.4</td><td>35.3</td><td>35.1</td></tr><tr><td>γ = 0.9</td><td>34.9</td><td>34.8</td><td>35.3</td><td>35.3</td><td>35.3</td><td>35.4</td><td>35.5</td><td>35.3</td></tr><tr><td>γ = 1.1</td><td>35.1</td><td>34.9</td><td>35.2</td><td>35.3</td><td>35.3</td><td>35.3</td><td>35.3</td><td>35.2</td></tr><tr><td colspan="9">(a) IWSLT De-En - Valid</td></tr><tr><td></td><td>Uniform</td><td>n=1</td><td>n=2</td><td>n=3</td><td>n=4</td><td>n=5</td><td>n=6</td><td>Average</td></tr><tr><td>Baseline</td><td></td><td>33.7</td><td>34.6</td><td>34.6</td><td>34.6</td><td>34.6</td><td>34.8</td><td>34.5</td></tr><tr><td>0</td><td>34.4</td><td>33.2</td><td>34.4</td><td>34.8</td><td>34.9</td><td>35.0</td><td>34.9</td><td>34.5</td></tr><tr><td>γ = 0.3</td><td>34.2</td><td>32.8</td><td>33.9</td><td>34.3</td><td>34.6</td><td>34.8</td><td>35.0</td><td>34.2</td></tr><tr><td>γ = 0.5</td><td>34.5</td><td>33.8</td><td>34.2</td><td>34.6</td><td>34.5</td><td>34.7</td><td>34.7</td><td>34.6</td></tr><tr><td>γ = 0.7</td><td>34.0</td><td>33.7</td><td>34.2</td><td>34.3</td><td>34.3</td><td>34.3</td><td>34.3</td><td>34.2</td></tr><tr><td>γ = 0.9</td><td>34.1</td><td>34.0</td><td>34.2</td><td>34.3</td><td>34.4</td><td>34.4</td><td>34.4</td><td>34.3</td></tr><tr><td>γ = 1.1</td><td>34.2</td><td>34.0</td><td>34.3</td><td>34.3</td><td>34.3</td><td>34.3</td><td>34.2</td><td>34.2</td></tr></table>
336
+
337
+ Table 3: Aligned training with different gradient scaling ratios $\gamma : 1$ on IWSLT’14 De-En. For each model we report the BLEU4 score evaluated with a uniformly sampled exit $n \sim \mathcal { U } ( [ 1 . . 6 ] )$ for each token and a fixed exit $n \in [ 1 . . 6 ]$ . The average corresponds to the average BLEU4 of all fixed exits.
338
+
339
+ # APPENDIX B FLOPS APPROXIMATION
340
+
341
+ This section details the computation of the FLOPS we report. The per token FLOPS are for the decoder network only since we use an encoder of the same size for all models. We breakdown the FLOPS of every operation in Algorithm 2 (blue front of the algorithmic statement). We omit non-linearities, normalizations and residual connections. The main operations we account for are dot-products and by extension matrix-vector products since those represent the vast majority of FLOPS (we assume batch size one to simplify the calculation).
342
+
343
+ Parameters
344
+
345
+ Table 4: FLOPS of basic operations, key parameters and variables for the FLOPS estimation.
346
+
347
+ <table><tr><td>Parameters decoder embedding dimension.</td><td></td><td></td><td>FLOPS</td></tr><tr><td rowspan="3">dd de df x t V output vocabulary size.</td><td>encoder embedding dimension.</td><td>Operation</td><td></td></tr><tr><td>The feed-forward network dimension.</td><td>Dot-product (d)</td><td>2d-1</td></tr><tr><td>source length. Current time-estep (t ≥ 1).</td><td>Linear din →dout</td><td>2dindout</td></tr></table>
348
+
349
+ With this breakdown, the total computational cost at time-step $t$ of a decoder block that we actually go through, denoted with FC, is:
350
+
351
+ $$
352
+ \mathrm { F C } ( \pmb { x } , t ) = 1 2 d _ { d } ^ { 2 } + 4 d _ { f } d _ { d } + 4 t d _ { d } + 4 | \pmb { x } | d _ { d } + 4 [ \mathrm { F i r s t C a l l } ] | \pmb { x } | d _ { d } d _ { e } ,
353
+ $$
354
+
355
+ where the cost of mapping the source’ keys and values is incurred the first time the block is called (flagged with FirstCall). This occurs at $t = 1$ for the baseline model but it is input-dependent with depth adaptive estimation and may never occur if all tokens exit early.
356
+
357
+ If skipped, a block still has to compute the keys and value of the self-attention block so the selfattention of future time-steps can function. We will denote this cost with FS and we have $\mathrm { F S } = 4 d _ { d } ^ { 2 }$ .
358
+
359
+ Depending on the halting mechanism, an exit prediction cost, denoted wit FP, is added:
360
+
361
+ $$
362
+ \begin{array} { r l } & { \mathrm { F P } ( t , q ( t ) ) = 2 [ [ t = 1 ] ] N d _ { d } } \\ & { \mathrm { F P } ( t , q ( t ) ) = 2 N d _ { d } } \\ & { \mathrm { F P } ( t , q ( t ) ) = 2 d _ { d } q ( t ) } \\ & { \mathrm { F P } ( t , q ( t ) ) = 2 q ( t ) V d _ { d } } \end{array}
363
+ $$
364
+
365
+ For a set of source sequences $\{ \pmb { x } ^ { ( i ) } \} _ { i \in \mathcal { I } }$ and generated hypotheses $\{ \pmb { y } ^ { ( i ) } \} _ { i \in \mathcal { I } }$ , the average flops per token is:
366
+
367
+ $$
368
+ \begin{array} { r l } & { \mathrm { s e l i n e ~ } ( N \mathrm { ~ b l o c k s } ) ; \quad \frac { 1 } { \sum _ { i } | y ^ { ( i ) } | } \sum _ { i } \sum _ { t = 1 } ^ { | y ^ { ( i ) } | } \left( N \mathrm { ~ F C } ( { \pmb x } ^ { ( i ) } , t ) + 2 V d _ { d } \right) } \\ & { \quad \mathrm { A d a p t i v e ~ d e p t h } ; \quad \frac { 1 } { \sum _ { i } | y ^ { ( i ) } | } \sum _ { i } \sum _ { t = 1 } ^ { | y ^ { ( i ) } | } \left( q ( t ) \mathrm { F C } ( { \pmb x } ^ { ( i ) } , t ) + ( N - q ( t ) ) \mathrm { F S } + \mathrm { F P } ( t , q ( t ) ) + 2 V d _ { d } \right) } \end{array}
369
+ $$
370
+
371
+ In the case of confidence thresholding the final output prediction cost $( 2 V d _ { d } )$ is already accounted for in the exit prediction cost FP.
372
+
373
+ # Algorithm 2 Adaptive decoding with Tok-geometric-like
374
+
375
+ 1: Input: source codes $\pmb { s }$ , incremental state
376
+ 2: Initialization: $t = 1$ , $y _ { 1 } = < s >$
377
+ 3: for $n \in 1 \ldots N$ do
378
+ 4: FirstCall[n] $=$ True. . A flag signaling if the source’ keys and values should be evalua
379
+ 5: end for
380
+ 6: while $y _ { t } \neq < / \mathrm { s } >$ do
381
+ 7: Embed the last output token $y _ { t }$ .
382
+ 8: for $n \in 1 \ldots N$ do
383
+ 9: $\triangleright$ Self-attention.
384
+ 10: - Map the input into a key $( k )$ and value $( v )$ . FLOPS $\scriptstyle \dot { = } 4 d _ { d } ^ { 2 }$
385
+ 11: - Map the input into a query $q$ $\cdot \mathrm { F L O P S } { = } 2 d _ { d } ^ { 2 }$
386
+ 12: - Score the memory keys with $q$ to get the attention weights $\alpha$ . FLOPS $\scriptstyle \sum 4 t d _ { d }$
387
+ 13: - Map the attention output. $\mathrm { F L O P S } { = } 2 d _ { d } ^ { 2 }$
388
+ 14: $\triangleright$ Encoder-Decoder interaction.
389
+ 15: if FirstCall $[ n ]$ then
390
+ 16: Map the source states into keys and values for the nth block. FLOPS=4|x|dedd
391
+ 17: FirstCall[n] $=$ False
392
+ 18: end if
393
+ 19: - Map the input into a query $q$ . $\mathrm { F L O P S } { = } 2 d _ { d } ^ { 2 }$
394
+ 20: - Score the memory keys with $q$ to get the attention weights $\alpha$ . FLOPS=4|x|dd
395
+ 21: - Map the attention output. $\mathrm { F L O P S } { = } 2 d _ { d } ^ { 2 }$
396
+ 22: Feed-forward network. FLO $\scriptstyle { \sum } = 4 d _ { d } d _ { f }$
397
+ 23: Estimate the halting probability $\chi _ { t , n }$ . FLOP ${ \mathrm { S } } { = } 2 d _ { d }$
398
+ 24: if $\chi _ { t , n } > 0 . 5$ then
399
+ 25: Exit the loop (Line 8)
400
+ 26: end if
401
+ 27: end for
402
+ 28: if $n < N$ then
403
+ 29: $\triangleright$ Skipped blocks.
404
+ 30: for $n _ { s } \in n + 1 \ldots N$ do
405
+ 31: Copy and map the copied state into a key $( k )$ and value (v). FLOPS $\scriptstyle \cdot = 4 d _ { d } ^ { 2 }$
406
+ 32: end for
407
+ 33: end if
408
+ 34: Project the final state and sample a new output token. FLOP $\ S { = } 2 V d _ { d }$
409
+ 35: $t { + + }$
410
+ 36: end while
md/train/SJi9WOeRb/SJi9WOeRb.md ADDED
@@ -0,0 +1,598 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRADIENT ESTIMATORS FOR IMPLICIT MODELS
2
+
3
+ Yingzhen Li & Richard E. Turner University of Cambridge Cambridge, CB2 1PZ, UK {yl494,ret26}@cam.ac.uk
4
+
5
+ # ABSTRACT
6
+
7
+ Implicit models, which allow for the generation of samples but not for point-wise evaluation of probabilities, are omnipresent in real-world problems tackled by machine learning and a hot topic of current research. Some examples include data simulators that are widely used in engineering and scientific research, generative adversarial networks (GANs) for image synthesis, and hot-off-the-press approximate inference techniques relying on implicit distributions. The majority of existing approaches to learning implicit models rely on approximating the intractable distribution or optimisation objective for gradient-based optimisation, which is liable to produce inaccurate updates and thus poor models. This paper alleviates the need for such approximations by proposing the Stein gradient estimator, which directly estimates the score function of the implicitly defined distribution. The efficacy of the proposed estimator is empirically demonstrated by examples that include gradient-free MCMC, meta-learning for approximate inference and entropy regularised GANs that provide improved sample diversity.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Modelling is fundamental to the success of technological innovations for artificial intelligence. A powerful model learns a useful representation of the observations for a specified prediction task, and generalises to unknown instances that follow similar generative mechanics. A well established area of machine learning research focuses on developing prescribed probabilistic models (Diggle & Gratton, 1984), where learning is based on evaluating the probability of observations under the model. Implicit probabilistic models, on the other hand, are defined by a stochastic procedure that allows for direct generation of samples, but not for the evaluation of model probabilities. These are omnipresent in scientific and engineering research involving data analysis, for instance ecology, climate science and geography, where simulators are used to fit real-world observations to produce forecasting results. Within the machine learning community there is a recent interest in a specific type of implicit models, generative adversarial networks (GANs) (Goodfellow et al., 2014), which has been shown to be one of the most successful approaches to image and text generation (Radford et al., 2016; Yu et al., 2017; Arjovsky et al., 2017; Berthelot et al., 2017). Very recently, implicit distributions have also been considered as approximate posterior distributions for Bayesian inference, e.g. see Liu & Feng (2016); Wang & Liu (2016); Li & Liu (2016); Karaletsos (2016); Mescheder et al. (2017); Huszar (2017); Li et al. (2017); Tran et al. (2017). These examples demonstrate the su-´ perior flexibility of implicit models, which provide highly expressive means of modelling complex data structures.
12
+
13
+ Whilst prescribed probabilistic models can be learned by standard (approximate) maximum likelihood or Bayesian inference, implicit probabilistic models require substantially more severe approximations due to the intractability of the model distribution. Many existing approaches first approximate the model distribution or optimisation objective function and then use those approximations to learn the associated parameters. However, for any finite number of data points there exists an infinite number of functions, with arbitrarily diverse gradients, that can approximate perfectly the objective function at the training datapoints, and optimising such approximations can lead to unstable training and poor results. Recent research on GANs, where the issue is highly prevalent, suggest that restricting the representational power of the discriminator is effective in stabilising training (e.g. see Arjovsky et al., 2017; Kodali et al., 2017). However, such restrictions often introduce undesirable biases, responsible for problems such as mode collapse in the context of GANs, and the underestimation of uncertainty in variational inference methods (Turner & Sahani, 2011).
14
+
15
+ ![](images/11baac80c9c0e12b40b681e1c4d420fc091d6a6fa494f594a8131dc46053395c.jpg)
16
+ Figure 1: A comparison between the two approximation schemes. Since in practice the optimiser only visits finite number of locations in the parameter space, it can lead to over-fitting if the neural network based functional approximator is not carefully regularised, and therefore the curvature information of the approximated loss can be very different from that of the original loss (shown in (a)). On the other hand, the gradient approximation scheme (b) can be more accurate since it only involves estimating the sensitivity of the loss function to the parameters in a local region.
17
+
18
+ In this paper we explore approximating the derivative of the log density, known as the score function, as an alternative method for training implicit models. An accurate approximation of the score function then allows the application of many well-studied algorithms, such as maximum likelihood, maximum entropy estimation, variational inference and gradient-based MCMC, to implicit models. Concretely, our contributions include:
19
+
20
+ • the Stein gradient estimator, a novel generalisation of the score matching gradient estimator (Hyvarinen, 2005), that includes both parametric and non-parametric forms; ¨ • a comparison of the proposed estimator with the score matching and the KDE plug-in estimators on performing gradient-free MCMC, meta-learning of approximate posterior samplers for Bayesian neural networks, and entropy based regularisation of GANs.
21
+
22
+ # 2 LEARNING IMPLICIT PROBABILISTIC MODELS
23
+
24
+ Given a dataset $\mathcal { D }$ containing i.i.d. samples we would like to learn a probabilistic model $p ( { \pmb x } )$ for the underlying data distribution $p _ { \mathcal { D } } ( \pmb { x } )$ . In the case of implicit models, $p ( { \pmb x } )$ is defined by a generative process. For example, to generate images, one might define a generative model $p ( { \pmb x } )$ that consists of sampling randomly a latent variable $z \sim p _ { 0 } ( z )$ and then defining $\mathbf { \boldsymbol { x } } = \mathbf { \boldsymbol { f } } _ { \boldsymbol { \theta } } ( \boldsymbol { z } )$ . Here $f$ is a function parametrised by $\pmb { \theta }$ , usually a deep neural network or a simulator. We assume $f$ to be differentiable w.r.t. $\pmb { \theta }$ . An extension to this scenario is presented by conditional implicit models, where the addition of a supervision signal $\textbf { { y } }$ , such as an image label, allows us to define a conditional distribution $p ( { \pmb x } | { \pmb y } )$ implicitly by the transformation $\pmb { x } = f _ { \pmb { \theta } } ( \pmb { z } , \pmb { y } )$ . A related methodology, wild variational inference (Liu & Feng, 2016; Li $\&$ Liu, 2016) assumes a tractable joint density $p ( { \pmb x } , { \pmb z } )$ , but uses implicit proposal distributions to approximate an intractable exact posterior $p ( \boldsymbol { z } | \boldsymbol { x } )$ . Here the approximate posterior $q ( \pmb { z } | \pmb { x } )$ can likewise be represented by a deep neural network, but also by a truncated Markov chain, such as that given by Langevin dynamics with learnable step-size.
25
+
26
+ Whilst providing extreme flexibility and expressive power, the intractability of density evaluation also brings serious optimisation issues for implicit models. This is because many learning algorithms, e.g. maximum likelihood estimation (MLE), rely on minimising a distance/divergence/discrepancy measure $\mathrm { D } [ p | | p _ { \mathcal { D } } ]$ , which often requires evaluating the model density (c.f. Ranganath et al., 2016; Liu & Feng, 2016). Thus good approximations to the optimisation procedure are the key to learning implicit models that can describe complex data structure. In the context of GANs, the Jensen-Shannon divergence is approximated by a variational lower-bound represented by a discriminator (Barber & Agakov, 2003; Goodfellow et al., 2014). Related work for wild variational inference (Li & Liu, 2016; Mescheder et al., 2017; Huszar, 2017; Tran et al., ´ 2017) uses a GAN-based technique to construct a density ratio estimator for $q / p _ { 0 }$ (Sugiyama et al., 2009; 2012; Uehara et al., 2016; Mohamed & Lakshminarayanan, 2016) and then approximates the KL-divergence term in the variational lower-bound:
27
+
28
+ $$
29
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { V I } } ( q ) = \mathbb { E } _ { q } \left[ \log p ( \pmb { x } | \pmb { z } ) \right] - \mathrm { K L } [ q _ { \phi } ( \pmb { z } | \pmb { x } ) | | p _ { 0 } ( \pmb { z } ) ] . } \end{array}
30
+ $$
31
+
32
+ In addition, Li & Liu (2016) and Mescheder et al. (2017) exploit the additive structure of the KLdivergence and suggest discriminating between $q$ and an auxiliary distribution that is close to $q$ , making the density ratio estimation more accurate. Nevertheless all these algorithms involve a minimax optimisation, and the current practice of gradient-based optimisation is notoriously unstable.
33
+
34
+ The stabilisation of GAN training is itself a recent trend of related research (e.g. see Salimans et al., 2016; Arjovsky et al., 2017). However, as the gradient-based optimisation only interacts with gradients, there is no need to use a discriminator if an accurate approximation to the intractable gradients could be obtained. As an example, consider a variational inference task with the approximate posterior defined as $z \sim q _ { \phi } ( z | x ) \stackrel { \cdot } { \Leftrightarrow } \epsilon \sim \pi ( \epsilon ) , z = f _ { \phi } ( \epsilon , x )$ . Notice that the variational lower-bound can be rewritten as
35
+
36
+ $$
37
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { V I } } ( q ) = \mathbb { E } _ { q } \left[ \log p ( \pmb { x } , z ) \right] + \mathbb { H } [ q _ { \phi } ( z | \pmb { x } ) ] , } \end{array}
38
+ $$
39
+
40
+ the gradient of the variational parameters $\phi$ can be computed by a sum of the path gradient of the first term (i.e. $\mathbb { E } _ { \boldsymbol { \pi } } \left[ \nabla _ { f } \log \bar { p } ( \boldsymbol { x } , f ( \boldsymbol { \epsilon } , \boldsymbol { x } ) ) ^ { \mathrm { T } } \nabla _ { \phi } f ( \boldsymbol { \epsilon } , \boldsymbol { x } ) \right] \bar { ) }$ and the gradient of the entropy term $\nabla _ { \phi } \mathbb { H } [ q ( \pmb { z } | \pmb { x } ) ]$ . Expanding the latter, we have
41
+
42
+ $$
43
+ \begin{array} { r l } & { \nabla _ { \phi } \mathbb { H } [ q _ { \phi } ( z | x ) ] = - \nabla _ { \phi } \mathbb { E } _ { \pi ( \epsilon ) } [ \log { q _ { \phi } ( f _ { \phi } ( \epsilon , x ) ) } ] } \\ & { \quad \quad \quad \quad \quad = - \mathbb { E } _ { \pi ( \epsilon ) } [ \nabla _ { \phi } \log { q _ { \phi } ( f _ { \phi } ( \epsilon , x ) ) } ] } \\ & { \quad \quad \quad \quad = - \mathbb { E } _ { \pi ( \epsilon ) } [ \nabla _ { \phi } \log { q _ { \phi } ( z | x ) } | _ { z = f _ { \phi } ( \epsilon , x ) } + \nabla _ { f } \log { q _ { \phi } ( f _ { \phi } ( \epsilon , x ) | x ) } \nabla _ { \phi } f _ { \phi } ( \epsilon , x ) ] } \\ & { \quad \quad \quad = - \mathbb { E } _ { q _ { \phi } ( z | x ) } [ \nabla _ { \phi } \log { q _ { \phi } ( z | x ) } ] - \mathbb { E } _ { \pi ( \epsilon ) } [ \nabla _ { f } \log { q _ { \phi } ( f _ { \phi } ( \epsilon , x ) | x ) } \nabla _ { \phi } f _ { \phi } ( \epsilon , x ) ] , } \end{array}
44
+ $$
45
+
46
+ in which the first term in the last line is zero (Roeder et al., 2017). As we typically assume the tractability of $\nabla _ { \phi } f$ , an accurate approximation to $\nabla _ { z } \log { q ( z | x ) }$ would remove the requirement of discriminators, speed-up the learning and obtain potentially a better model. Many gradient approximation techniques exist (Stone, 1985; Fan & Gijbels, 1996; Zhou & Wolfe, 2000; De Brabanter et al., 2013), and in particular, in the next section we will review kernel-based methods such as kernel density estimation (Singh, 1977) and score matching (Hyvarinen, 2005) in more detail, and ¨ motivate the main contribution of the paper.
47
+
48
+ # 3 GRADIENT APPROXIMATION WITH THE STEIN GRADIENT ESTIMATOR
49
+
50
+ We propose the Stein gradient estimator as a novel generalisation of the score matching gradient estimator. Before presenting it we first set-up the notation. Column vectors and matrices are boldfaced. The random variable under consideration is $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ with $\mathcal { X } = \mathbb { R } ^ { d \times 1 }$ if not specifically mentioned. To avoid misleading notation we use the distribution $q ( { \pmb x } )$ to derive the gradient approximations for general cases. As Monte Carlo methods are heavily used for implicit models, in the rest of the paper we mainly consider approximating the gradient $\pmb { g } ( \pmb { x } ^ { k } ) : = \nabla _ { \pmb { x } ^ { k } } \mathrm { \tilde { l o g } } q ( \pmb { x } ^ { k } )$ for $\begin{array} { r } { \pmb { x } ^ { k } \sim q ( \pmb { x } ) , k = \hat { 1 } , . . . , K } \end{array}$ . We use $\boldsymbol { x } _ { j } ^ { i }$ to denote the $j$ th element of the ith sample $\mathbf { x } ^ { i }$ . We also denote the matrix form of the collected gradients as $\mathbf { G } : = \left( \nabla _ { \pmb { x } ^ { 1 } } \log q ( \pmb { x } ^ { 1 } ) , \cdots , \nabla _ { \pmb { x } ^ { K } } \log q ( \pmb { x } ^ { K } ) \right) ^ { \mathrm { T } } \in \mathbb { R } ^ { K \times d } .$ , and its approximation $\hat { \mathbf { G } } : = \left( \hat { g } ( \pmb { x } ^ { 1 } ) , \cdots , \hat { g } ( \pmb { x } ^ { K } ) \right) ^ { \mathrm { T } }$ with $\hat { g } ( \pmb { x } ^ { k } ) = \nabla _ { \pmb { x } ^ { k } } \log \hat { q } ( \pmb { x } ^ { k } )$ for some ${ \hat { q } } ( { \pmb x } )$ .
51
+
52
+ # 3.1 STEIN GRADIENT ESTIMATOR: INVERTING STEIN’S IDENTITY
53
+
54
+ We start from introducing Stein’s identity that was first developed for Gaussian random variables (Stein, 1972; 1981) then extended to general cases (Gorham $\&$ Mackey, 2015; Liu et al., 2016). Let $\pmb { h } : \mathbb { R } ^ { d \times 1 } \mathbb { R } ^ { d ^ { \prime } \times 1 }$ be a differentiable multivariate test function which maps $_ { \textbf { \em x } }$ to a column vector $\pmb { h } ( \pmb { x } ) = [ h _ { 1 } ( \pmb { x } ) , h _ { 2 } ( \pmb { x } ) , . . . , h _ { d ^ { \prime } } ( \pmb { x } ) ] ^ { \mathrm { T } }$ . We further assume the boundary condition for $^ { h }$ :
55
+
56
+ $$
57
+ q ( \pmb { x } ) \pmb { h } ( \pmb { x } ) | _ { \partial \mathcal { X } } = \mathbf { 0 } , \mathrm { ~ o r ~ } \operatorname* { l i m } _ { \pmb { x } \infty } q ( \pmb { x } ) \pmb { h } ( \pmb { x } ) = 0 \mathrm { ~ i f ~ } \mathcal { X } = \mathbb { R } ^ { d } .
58
+ $$
59
+
60
+ This condition holds for almost any test function if $q$ has sufficiently fast-decaying tails (e.g. Gaussian tails). Now we introduce Stein’s identity (Stein, 1981; Gorham & Mackey, 2015; Liu et al., 2016)
61
+
62
+ $$
63
+ \mathbb { E } _ { q } [ { \pmb h } ( { \pmb x } ) \nabla _ { \pmb x } \log q ( { \pmb x } ) ^ { \mathrm { T } } + \nabla _ { \pmb x } { \pmb h } ( { \pmb x } ) ] = { \bf 0 } ,
64
+ $$
65
+
66
+ in which the gradient matrix term $\nabla _ { \pmb { x } } \pmb { h } ( \pmb { x } ) = \left( \nabla _ { \pmb { x } } h _ { 1 } ( \pmb { x } ) , \cdots , \nabla _ { \pmb { x } } h _ { d ^ { \prime } } ( \pmb { x } ) \right) ^ { \mathrm { T } } \in \mathbb { R } ^ { d ^ { \prime } \times d }$ . This identity can be proved using integration by parts: for the ith row of the matrix $\pmb { h } ( \pmb { x } ) \nabla _ { \pmb { x } } \log q ( \pmb { x } ) ^ { \mathnormal { \mathrm { T } } }$ , we have
67
+
68
+ $$
69
+ \begin{array} { r l r } { { \mathbb { E } _ { q } [ h _ { i } ( \pmb { x } ) \nabla _ { \pmb { x } } \log q ( \pmb { x } ) ^ { \mathrm { T } } ] = \int h _ { i } ( \pmb { x } ) \nabla _ { \pmb { x } } q ( \pmb { x } ) ^ { \mathrm { T } } d \pmb { x } } } \\ & { } & { = q ( \pmb { x } ) h _ { i } ( \pmb { x } ) | _ { \partial \mathscr { X } } - \int q ( \pmb { x } ) \nabla _ { \pmb { x } } h _ { i } ( \pmb { x } ) ^ { \mathrm { T } } d \pmb { x } } \\ & { } & { = - \mathbb { E } _ { q } [ \nabla _ { \pmb { x } } h _ { i } ( \pmb { x } ) ^ { \mathrm { T } } ] . } \end{array}
70
+ $$
71
+
72
+ Observing that the gradient term $\nabla _ { \pmb { x } } \log { q ( \pmb { x } ) }$ of interest appears in Stein’s identity (5), we propose the Stein gradient estimator by inverting Stein’s identity. As the expectation in (5) is intractable, we further approximate the above with Monte Carlo (MC):
73
+
74
+ $$
75
+ \frac { 1 } { K } \sum _ { k = 1 } ^ { K } - h ( \boldsymbol { x } ^ { k } ) \nabla _ { \boldsymbol { x } ^ { k } } \log q ( \boldsymbol { x } ^ { k } ) ^ { \mathrm { T } } + \mathrm { e r r } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \nabla _ { \boldsymbol { x } ^ { k } } h ( \boldsymbol { x } ^ { k } ) , \quad \boldsymbol { x } ^ { k } \sim q ( \boldsymbol { x } ^ { k } ) ,
76
+ $$
77
+
78
+ with err $\in \mathbb { R } ^ { d ^ { \prime } \times d }$ the random error due to MC approximation, which has mean 0 and vanishes as $K + \infty$ . Now by temporarily denoting $\mathbf { H } ~ = ~ \bigl ( h ( x ^ { 1 } ) , \cdot \cdot \cdot , h ( x ^ { K } ) \bigr ) \in \mathbb { R } ^ { d ^ { \prime } \times K } , \quad \overline { { \nabla _ { x } h } } =$ $\begin{array} { r } { \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \nabla _ { \pmb { x } ^ { k } } h ( \pmb { x } ^ { k } ) \in \mathbb { R } ^ { d ^ { \prime } \times d } } \end{array}$ , equation (7) can be rewritten as $\begin{array} { r } { - \frac { 1 } { K } \mathbf { H } \mathbf G + \mathrm { e r r } = \overline { { \nabla _ { \mathbf { x } } h } } } \end{array}$ . Thus we consider a ridge regression method (i.e. adding an $\ell _ { 2 }$ regulariser) to estimate $\mathbf { G }$ :
79
+
80
+ $$
81
+ \hat { \mathbf { G } } _ { V } ^ { \mathrm { S t e i n } } : = \underset { \hat { \mathbf { G } } \in \mathbb { R } ^ { K \times d } } { \arg \operatorname* { m i n } } | | \overline { { \nabla _ { \mathbf { x } } h } } + \frac { 1 } { K } \mathbf { H } \hat { \mathbf { G } } | | _ { F } ^ { 2 } + \frac { \eta } { K ^ { 2 } } | | \hat { \mathbf { G } } | | _ { F } ^ { 2 } ,
82
+ $$
83
+
84
+ with $| | \cdot | | _ { F }$ the Frobenius norm of a matrix and $\eta \geq 0$ . Simple calculation shows that
85
+
86
+ $$
87
+ \hat { \mathbf { G } } _ { V } ^ { \mathrm { S t e i n } } = - ( \mathbf { K } + \eta \mathbf { I } ) ^ { - 1 } \langle \nabla , \mathbf { K } \rangle ,
88
+ $$
89
+
90
+ where $\mathbf { K } : = \mathbf { H } ^ { \mathrm { T } } \mathbf { H }$ , $\mathbf { K } _ { i j } = { \mathcal { K } } ( { \pmb x } ^ { i } , { \pmb x } ^ { j } ) : = h ( { \pmb x } ^ { i } ) ^ { \mathrm { T } } h ( { \pmb x } ^ { j } )$ , $\langle \nabla , { \bf K } \rangle : = K { \bf H } ^ { \mathrm { T } } \overline { { \nabla _ { \boldsymbol { x } } h } }$ , $\langle \nabla , { \bf K } \rangle _ { i j } =$ $\begin{array} { r l } { { \sum _ { k = 1 } ^ { K } \nabla _ { x _ { j } ^ { k } } \mathcal { K } ( \pmb { x } ^ { i } , \pmb { x } ^ { k } ) } } & { { } } \end{array}$ . One can show that the RBF kernel satisfies Stein’s identity (Liu et al., 2016). In this case $\pmb { h } ( \pmb { x } ) = \mathcal { K } ( \pmb { x } , \cdot ) , d ^ { \prime } = + \infty$ and by the reproducing kernel property (Berlinet & ThomasAgnan, 2011), $\begin{array} { r } { h ( { \boldsymbol x } ) ^ { \mathrm { T } } h ( { \boldsymbol x } ^ { \prime } ) = \langle \mathcal { K } ( { \boldsymbol x } , \cdot ) , \mathcal { K } ( { \boldsymbol x } ^ { \prime } , \cdot ) \rangle _ { \mathcal { H } } = \mathcal { K } ( { \boldsymbol x } , { \boldsymbol x } ^ { \prime } ) . } \end{array}$ .
91
+
92
+ # 3.2 STEIN GRADIENT ESTIMATOR MINIMISES THE KERNELISED STEIN DISCREPANCY
93
+
94
+ In this section we derive the Stein gradient estimator again, but from a divergence/discrepancy minimisation perspective. Stein’s method also provides a tool for checking if two distributions $q ( { \pmb x } )$ and ${ \hat { q } } ( { \pmb x } )$ are identical. If the test function set $\mathcal { H }$ is sufficiently rich, then one can define a Stein discrepancy measure by
95
+
96
+ $$
97
+ \begin{array} { r } { S ( \boldsymbol { q } , \hat { \boldsymbol { q } } ) : = \displaystyle \operatorname* { s u p } _ { \boldsymbol { h } \in \mathcal { H } } \mathbb { E } _ { \boldsymbol { q } } \left[ \nabla _ { \boldsymbol { x } } \log \hat { q } ( \boldsymbol { x } ) ^ { \mathrm { T } } \boldsymbol { h } ( \boldsymbol { x } ) + \langle \nabla , \boldsymbol { h } \rangle \right] , } \end{array}
98
+ $$
99
+
100
+ see Gorham & Mackey (2015) for an example derivation. When $\mathcal { H }$ is defined as a unit ball in an RKHS induced by a kernel $\kappa ( { \pmb x } , \cdot )$ , Liu et al. (2016) and Chwialkowski et al. (2016) showed that the supremum in (10) can be analytically obtained as (with ${ \boldsymbol { \kappa } } _ { { \boldsymbol { x } } { \boldsymbol { x } } ^ { \prime } }$ shorthand for $\kappa ( { \pmb x } , { \pmb x } ^ { \prime } ) )$ :
101
+
102
+ $$
103
+ \mathcal { S } ^ { 2 } ( \boldsymbol { q } , \hat { \boldsymbol { q } } ) = \mathbb { E } _ { \boldsymbol { x } , \boldsymbol { x } ^ { \prime } \sim \boldsymbol { q } } \left[ ( \hat { g } ( \boldsymbol { x } ) - g ( \boldsymbol { x } ) ) ^ { \mathrm { T } } \mathcal { K } _ { \boldsymbol { x } \boldsymbol { x } ^ { \prime } } ( \hat { g } ( \boldsymbol { x } ^ { \prime } ) - \boldsymbol { g } ( \boldsymbol { x } ^ { \prime } ) ) \right] ,
104
+ $$
105
+
106
+ which is also named the kernelised Stein discrepancy (KSD). Chwialkowski et al. (2016) showed that for $C _ { 0 }$ -universal kernels satisfying the boundary condition, KSD is indeed a discrepancy measure: $S ^ { 2 } ( q , \hat { q } ) = 0 \Leftrightarrow q = \hat { q }$ . Gorham & Mackey (2017) further characterised the power of KSD on detecting non-convergence cases. Furthermore, if the kernel is twice differentiable, then using the same technique as to derive (16) one can compute KSD by
107
+
108
+ $$
109
+ \begin{array} { r } { \mathcal { S } ^ { 2 } ( \boldsymbol { q } , \boldsymbol { \hat { q } } ) = \mathbb { E } _ { \boldsymbol { x } , \boldsymbol { x } ^ { \prime } \sim \boldsymbol { q } } \left[ \hat { g } ( \boldsymbol { x } ) ^ { \top } \boldsymbol { K } _ { \boldsymbol { x } \boldsymbol { x } ^ { \prime } } \hat { g } ( \boldsymbol { x } ^ { \prime } ) + \hat { g } ( \boldsymbol { x } ) ^ { \top } \nabla _ { \boldsymbol { x } ^ { \prime } } \boldsymbol { K } _ { \boldsymbol { x } \boldsymbol { x } ^ { \prime } } + \nabla _ { \boldsymbol { x } } \boldsymbol { K } _ { \boldsymbol { x } \boldsymbol { x } ^ { \prime } } ^ { \top } \hat { g } ( \boldsymbol { x } ^ { \prime } ) + \mathrm { T r } ( \nabla _ { \boldsymbol { x } , \boldsymbol { x } ^ { \prime } } \boldsymbol { K } _ { \boldsymbol { x } \boldsymbol { x } ^ { \prime } } ) \right] . } \end{array}
110
+ $$
111
+
112
+ In practice KSD is estimated with samples $\{ \pmb { x } ^ { k } \} _ { k = 1 } ^ { K } \sim q$ , and simple derivations show that the Vstatistic of KSD can be reformulated as $\begin{array} { r } { S _ { V } ^ { 2 } ( q , \hat { q } ) = \frac { 1 } { K ^ { 2 } } \mathrm { T r } ( \hat { \mathbf { G } } ^ { \mathrm { T } } \mathbf { K } \hat { \mathbf { G } } + 2 \hat { \mathbf { G } } ^ { \mathrm { T } } \langle \nabla , \mathbf { K } \rangle ) + C } \end{array}$ . Thus the $l _ { 2 }$ error in (8) is equivalent to the $\mathrm { V } .$ -statistic of KSD if $\mathbf { \dot { h } } ( \mathbf { x } ) = \mathcal { K } ( \mathbf { x } , \cdot )$ , and we have the following:
113
+
114
+ Theorem 1. $\hat { \mathbf { G } } _ { V } ^ { \mathrm { S t e i n } }$ is the solution of the following KSD V-statistic minimisation problem
115
+
116
+ $$
117
+ \hat { \mathbf { G } } _ { V } ^ { \mathrm { S t e i n } } = \underset { \hat { \mathbf { G } } \in \mathbb { R } ^ { K \times d } } { \arg \operatorname* { m i n } } S _ { V } ^ { 2 } ( q , \hat { q } ) + \frac { \eta } { K ^ { 2 } } | | \hat { \mathbf { G } } | | _ { F } ^ { 2 } .
118
+ $$
119
+
120
+ One can also minimise the U-statistic of KSD to obtain gradient approximations, and a full derivation of which, including the optimal solution, can be found in the appendix. In experiments we use $\mathrm { V } .$ - statistic solutions and leave comparisons between these methods to future work.
121
+
122
+ # 3.3 COMPARISONS TO EXISTING KERNEL-BASED GRADIENT ESTIMATORS
123
+
124
+ There exist other gradient estimators that do not require explicit evaluations of $\nabla _ { \pmb { x } } \log { q ( \pmb { x } ) }$ , e.g. the denoising auto-encoder (DAE) (Vincent et al., 2008; Vincent, 2011; Alain & Bengio, 2014) which, with infinitesimal noise, also provides an estimate of $\nabla _ { \pmb { x } } \log { q ( \pmb { x } ) }$ at convergence. However, applying such gradient estimators result in a double-loop optimisation procedure since the gradient approximation is repeatedly required for fitting implicit distributions, which can be significantly slower than the proposed approach. Therefore we focus on “quick and dirty” approximations and only include comparisons to kernel-based gradient estimators in the following.
125
+
126
+ # 3.3.1 KDE GRADIENT ESTIMATOR: PLUG-IN ESTIMATOR WITH DENSITY ESTIMATION
127
+
128
+ A naive approach for gradient approximation would first estimate the intractable density $\hat { q } ( { \pmb x } ) \approx$ $q ( { \pmb x } )$ (up to a constant), then approximate the exact gradient by $\nabla _ { \pmb { x } } \log \hat { q } ( \pmb { x } ) \approx \nabla _ { \pmb { x } } \log q ( \pmb { \dot { x } } )$ . Specifically, Singh (1977) considered kernel density estimation (KDE) $\begin{array} { r } { \hat { q } ( \pmb { x } ) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } { K ( \pmb { x } , \pmb { x } ^ { k } ) \times { C } } . } \end{array}$ ., then differentiated through the KDE estimate to obtain the gradient estimator:
129
+
130
+ $$
131
+ \hat { \mathbf { G } } _ { i j } ^ { \mathrm { K D E } } = \sum _ { k = 1 } ^ { K } \nabla _ { x _ { j } ^ { i } } K ( { \pmb x } ^ { i } , { \pmb x } ^ { k } ) / \sum _ { k = 1 } ^ { K } K ( { \pmb x } ^ { i } , { \pmb x } ^ { k } ) .
132
+ $$
133
+
134
+ Interestingly for translation invariant kernels $\begin{array} { r } { K ( \pmb { x } , \pmb { x } ^ { \prime } ) = K ( \pmb { x } - \pmb { x } ^ { \prime } ) } \end{array}$ the $K D E$ gradient estimator (14) can be rewritten as $\hat { \mathbf { G } } ^ { \mathrm { K D E } } = - \mathrm { d i a g } \left( \mathbf { K 1 } \right) ^ { - 1 } \langle \nabla , \mathbf { K } \rangle$ . Inspecting and comparing it with the Stein gradient estimator (9), one might notice that the Stein method uses the full kernel matrix as the pre-conditioner, while the KDE method computes an averaged “kernel similarity” for the denominator. We conjecture that this difference is key to the superior performance of the Stein gradient estimator when compared to the KDE gradient estimator (see later experiments). The KDE method only collects the similarity information between $\scriptstyle { \boldsymbol { x } } ^ { k }$ and other samples $\bar { \boldsymbol { x } } ^ { j }$ to form an estimate of $\nabla _ { \pmb { x } ^ { k } } \log \mathbf { \dot { q } } ( \pmb { x } ^ { k } )$ , whereas for the Stein gradient estimator, the kernel similarity between $\mathbf { \Delta } _ { \mathbf { \boldsymbol { x } } ^ { i } }$ and $\mathbf { \boldsymbol { x } } ^ { j }$ for all $i , j \neq k$ are also incorporated. Thus it is reasonable to conjecture that the Stein method can be more sample efficient, which also implies higher accuracy when the same number of samples are collected.
135
+
136
+ # 3.3.2 SCORE MATCHING GRADIENT ESTIMATOR: MINIMISING MSE
137
+
138
+ The KDE gradient estimator performs indirect approximation of the gradient via density estimation, which can be inaccurate. An alternative approach directly approximates the gradient $\nabla _ { \pmb { x } } \log { q ( \pmb { x } ) }$ by minimising the expected $\ell _ { 2 }$ error w.r.t. the approximation $\hat { \pmb g } ( { \pmb x } ) = \left( \hat { g } _ { 1 } ( { \pmb x } ) , \cdots , \hat { g } _ { d } ( { \pmb x } ) \right) ^ { \top }$ :
139
+
140
+ $$
141
+ \mathcal { F } ( \pmb { \hat { g } } ) : = \mathbb { E } _ { q } \left[ | | \pmb { \hat { g } } ( \pmb { x } ) - \nabla _ { \pmb { x } } \log q ( \pmb { x } ) | | _ { 2 } ^ { 2 } \right] .
142
+ $$
143
+
144
+ It has been shown in Hyvarinen (2005) that this objective can be reformulated as ¨
145
+
146
+ $$
147
+ \mathcal { F } ( \hat { \pmb g } ) = \mathbb { E } _ { q } \left[ | | \hat { \pmb g } ( { \pmb x } ) | | _ { 2 } ^ { 2 } + 2 \langle \nabla , \hat { \pmb g } ( { \pmb x } ) \rangle \right] + C , \quad \langle \nabla , \hat { \pmb g } ( { \pmb x } ) \rangle = \sum _ { j = 1 } ^ { d } \nabla _ { { \pmb x } _ { j } } \hat { g } _ { j } ( { \pmb x } ) .
148
+ $$
149
+
150
+ The key insight here is again the usage of integration by parts: after expanding the $\ell _ { 2 }$ loss objective, the cross term can be rewritten as $\bar { \mathbb { E } } _ { q } \left[ \hat { \pmb { g } } ( \pmb { x } ) ^ { \top } \nabla _ { \pmb { x } } \log \bar { \pmb { q } } ( \mathbf { \bar { x } } ) \right] = - \mathbb { E } _ { q } \left[ \langle \nabla , \hat { \pmb { g } } ( \mathbf { \bar { x } } ) \rangle \right]$ , if assuming the boundary condition (4) for $\hat { \pmb { g } }$ (see (6)). The optimum of (16) is referred as the score matching gradient estimator. The $\ell _ { 2 }$ objective (15) is also called Fisher divergence (Johnson, 2004) which is a special case of KSD (11) by selecting $\begin{array} { r } { K ( \pmb { x } , \pmb { x } ^ { \prime } ) = \delta _ { \pmb { x } = \pmb { x } ^ { \prime } } . } \end{array}$ . Thus the Stein gradient estimator can be viewed as a generalisation of the score matching estimator.
151
+
152
+ The comparison between the two estimators is more complicated. Certainly by the Cauchy-Schwarz inequality the Fisher divergence is stronger than KSD in terms of detecting convergence (Liu et al., 2016). However it is difficult to perform direct gradient estimation by minimising the Fisher divergence, since (i) the Dirac kernel is non-differentiable so that it is impossible to rewrite the divergence in a similar form to (12), and (ii) the transformation to (16) involves computing $\nabla _ { \pmb { x } } \hat { \pmb { g } } ( \pmb { x } )$ . So one needs to propose a parametric approximation to $\mathbf { G }$ and then optimise the associated parameters accordingly, and indeed Sasaki et al. (2014) and Strathmannby first approximating the log density up to a constant as $\begin{array} { r } { \log \hat { q } ( \pmb { x } ) : = \sum _ { k = 1 } ^ { K } a _ { k } \mathcal { K } ( \pmb { x } , \pmb { x } ^ { k } ) + C } \end{array}$ lution, then minimising (16) to obtain the coefficients and constructing the gradient estimator as
153
+
154
+ $$
155
+ \hat { \mathbf { G } } _ { i \cdot } ^ { \mathrm { s c o r e } } = \sum _ { k = 1 } ^ { K } \hat { a } _ { k } ^ { \mathrm { s c o r e } } \nabla _ { \pmb { x } ^ { i } } { K } ( { \pmb { x } } ^ { i } , { \pmb { x } } ^ { k } ) .
156
+ $$
157
+
158
+ Therefore the usage of parametric estimation can potentially remove the advantage of using a stronger divergence. Conversely, the proposed Stein gradient estimator (9) is non-parametric in that it directly optimises over functions evaluated at locations $\{ \pmb { x } _ { k } \} _ { k = 1 } ^ { K }$ . This brings in two key advantages over the score matching gradient estimator: (i) it removes the approximation error due to the use of restricted family of parametric approximations and thus can be potentially more accurate; (ii) it has a much simpler and ubiquitous form that applies to any kernel satisfying the boundary condition, whereas the score matching estimator requires tedious derivations for different kernels repeatedly (see appendix).
159
+
160
+ In terms of computation speed, since in most of the cases the computation of the score matching gradient estimator also involves kernel matrix inversions, both estimators are of the same order of complexity, which is $\mathcal { O } ( K ^ { 3 } + K ^ { 2 } d )$ (kernel matrix computation plus inversion). Low-rank approximations such as the Nystrom method (Smola & Sch ¨ okopf, 2000; Williams & Seeger, 2001) can ¨ enable speed-up, but this is not investigated in the paper. Again we note here that kernel-based gradient estimators can still be faster than e.g. the DAE estimator since no double-loop optimisation is required. Certainly it is possible to apply early-stopping for the inner-loop DAE fitting. However the resulting gradient approximation might be very poor, which leads to unstable training and poorly fitted implicit distributions.
161
+
162
+ # 3.4 ADDING PREDICTIVE POWER
163
+
164
+ Though providing potentially more accurate approximations, the non-parametric estimator (9) has no predictive power as described so far. Crucially, many tasks in machine learning require predicting gradient functions at samples drawn from distributions other than $q$ , for example, in MLE $q ( { \pmb x } )$ corresponds to the model distribution which is learned using samples from the data distribution instead. To address this issue, we derive two predictive estimators, one generalised from the nonparametric estimator and the other minimises KSD using parametric approximations.
165
+
166
+ Predictions using the non-parametric estimator. Let us consider an unseen datum $\textbf { { y } }$ . If $\textbf { { y } }$ is sampled from $q$ , then one can also apply the non-parametric estimator (9) for gradient approximation, given the observed data ${ \bf X } = \{ { \pmb x } ^ { \mathrm { i } } , . . . , { \pmb x } ^ { K } \} \sim \dot { { \boldsymbol q } } ^ { }$ . Concretely, if writing $\hat { \pmb g } ( \pmb y ) \overset { } { \approx } \nabla _ { \pmb y } \log \hat { q } ( \pmb y ) \in \mathbb R ^ { d \times 1 }$ then the non-parametric Stein gradient estimator computed on $\mathbf { X } \cup \{ y \}$ is
167
+
168
+ $$
169
+ \begin{array} { r } { \left[ \hat { g } ( y ) ^ { \mathrm { T } } \right] = - ( \mathbf { K } ^ { * } + \eta I ) ^ { - 1 } \left[ \nabla _ { y } K ( y , y ) + \sum _ { k = 1 } ^ { K } \nabla _ { x ^ { k } } K ( y , x ^ { k } ) \right] , \quad \mathbf { K } ^ { * } = \left[ \mathbf { K } _ { y y } \quad \mathbf { K } _ { y \mathbf { X } } \right] , } \\ { \left. \nabla , \mathbf { K } \right. + \nabla _ { y } K ( \cdot , y ) \qquad \quad \mathbf { K } ^ { * } = \left[ \mathbf { K } _ { \mathbf { X } y } \quad \mathbf { K } \right] , } \end{array}
170
+ $$
171
+
172
+ with $\nabla _ { \pmb { y } } K ( \cdot , \pmb { y } )$ denoting a $K \times d$ matrix with rows $\nabla _ { \pmb { y } } K ( \pmb { x } ^ { k } , \pmb { y } )$ , and $\nabla _ { \pmb { y } } K ( \pmb { y } , \pmb { y } )$ only differentiates through the second argument. Then we demonstrate in the appendix that, by simple matrix calculations and assuming a translation invariant kernel, we have (with column vector $\mathbf { 1 } \in \mathbb { R } ^ { K \times 1 }$ ):
173
+
174
+ $$
175
+ \begin{array} { r l } & { \nabla _ { y } \log q ( \pmb { y } ) ^ { \operatorname { T } } \approx - \left( \mathbf { K } _ { y y } + \eta - \mathbf { K } _ { y \mathbf { X } } ( \mathbf { K } + \eta \mathbf { I } ) ^ { - 1 } \mathbf { K } _ { \mathbf { X } y } \right) ^ { - 1 } } \\ & { \qquad \left( \mathbf { K } _ { y \mathbf { X } } \hat { \mathbf { G } } _ { V } ^ { \mathrm { { S t e i n } } } - \left( \mathbf { K } _ { y \mathbf { X } } ( \mathbf { K } + \eta \mathbf { I } ) ^ { - 1 } + \mathbf { 1 } ^ { \operatorname { T } } \right) \nabla _ { y } \mathcal { K } ( \cdot , y ) \right) . } \end{array}
176
+ $$
177
+
178
+ In practice one would store the computed gradient $\hat { \mathbf { G } } _ { V } ^ { \mathrm { S t e i n } }$ , the kernel matrix inverse $( \mathbf { K } + \eta \mathbf { I } ) ^ { - 1 }$ and $\eta$ as the “parameters” of the predictive estimator. For a new observation $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } } \sim \mathbf { \nabla } _ { p }$ in general, one can “pretend” $\textbf { { y } }$ is a sample from $q$ and apply the above estimator as well. The approximation quality depends on the similarity between $q$ and $p$ , and we conjecture here that this similarity measure, if can be described, is closely related to the KSD.
179
+
180
+ Fitting a parametric estimator using KSD. The non-parametric predictive estimator could be computationally demanding. Setting aside the cost of fitting the “parameters”, in prediction the time complexity for the non-parametric estimator is $\mathcal { O } ( K ^ { 2 } + K d )$ . Also storing the “parameters” needs $\mathcal O ( K d )$ memory for $\hat { \mathbf { G } } _ { V } ^ { \mathrm { S t e i n } }$ . These costs make the non-parametric estimator undesirable for high-dimensional data, since in order to obtain accurate predictions it often requires $K$ scaling with $d$ as well. To address this, one can also minimise the KSD using parametric approximations, in a similar way as to derive the score matching estimator in Section 3.3.2. More precisely, we define a parametric approximation in a similar fashion as (17), and in the appendix we show that if the RBF kernel is used for both the KSD and the parametric approximation, then the linear coefficients $\pmb { a } = ( a _ { 1 } , . . . , a _ { K } ) ^ { \mathrm { T } }$ can be calculated analytically: $\hat { \pmb { a } } _ { V } ^ { \mathrm { S t e i n } } = \bar { ( \pmb { \Lambda } } + \eta \mathbf { I } ) ^ { - 1 } \pmb { b }$ , where
181
+
182
+ $$
183
+ \begin{array} { r l } & { \mathbf { A } = \mathbb { X } \odot ( \mathbf { K } \mathbf { K } \mathbf { K } ) + \mathbf { K } ( \mathbf { K } \odot \mathbb { X } ) \mathbf { K } - ( ( \mathbf { K } \mathbf { K } ) \odot \mathbb { X } ) \mathbf { K } - \mathbf { K } ( ( \mathbf { K } \mathbf { K } ) \odot \mathbb { X } ) , } \\ & { \mathbf { \Phi } b = ( \mathbf { K } \mathrm { d i a g } ( \mathbb { X } ) \mathbf { K } + ( \mathbf { K } \mathbf { K } ) \odot \mathbb { X } - \mathbf { K } ( \mathbf { K } \odot \mathbb { X } ) - ( \mathbf { K } \odot \mathbb { X } ) \mathbf { K } ) \mathbf { 1 } , } \end{array}
184
+ $$
185
+
186
+ with $\mathbb { X }$ the “gram matrix” that has elements $\mathbb X _ { i j } = ( { \pmb x } ^ { i } ) ^ { \mathrm T } { \pmb x } ^ { j }$ . Then for an unseen observation $\mathbf { \mu } _ { \mathbf { \mu } _ { y } \sim }$ $p$ the gradient approximation returns $\nabla _ { \pmb { y } } \log q ( \pmb { y } ) \approx ( \hat { \pmb { a } } _ { V } ^ { \mathrm { S t e i n } } ) ^ { \mathrm { T } } \nabla _ { \pmb { y } } \mathcal { K } ( \cdot , \pmb { y } )$ . In this case one only maintains the linear coefficients $\hat { \pmb { a } } _ { V } ^ { \mathrm { S t e i n } }$ and computes a linear combination in prediction, which takes $\mathcal O ( K )$ memory and $\mathcal O ( K d )$ time and therefore is computationally cheaper than the non-parametric prediction model (27).
187
+
188
+ # 4 APPLICATIONS
189
+
190
+ We present some case studies that apply the gradient estimators to implicit models. Detailed settings (architecture, learning rate, etc.) are presented in the appendix. Implementation is released at https://github.com/YingzhenLi/SteinGrad.
191
+
192
+ # 4.1 SYNTHETIC EXAMPLE: HAMILTONIAN FLOW WITH APPROXIMATE GRADIENTS
193
+
194
+ We first consider a simple synthetic example to demonstrate the accuracy of the proposed gradient estimator. More precisely we consider the kernel induced Hamiltonian flow (not an exact sampler) (Strathmann et al., 2015) on a 2-dimensional banana-shaped object: $\mathbf { \hat { x } } \ \sim \ B ( \mathbf { x } ; b \ = \ 0 . 0 3 , \bar { \upsilon } \ =$ $1 0 0 ) \Leftrightarrow x _ { 1 } \sim \mathcal { N } ( x _ { 1 } ; 0 , v ) , x _ { 2 } = \epsilon + b ( x _ { 1 } ^ { 2 } - v ) , \epsilon \sim \mathcal { N } ( \epsilon ; 0 , 1 )$ . The approximate Hamiltonian flow is constructed using the same operator as in Hamiltonian Monte Carlo (HMC) (Neal et al., 2011), except that the exact score function $\nabla _ { \pmb { x } } \log B ( \pmb { x } )$ is replaced by the approximate gradients. We still use the exact target density to compute the rejection step as we mainly focus on testing the accuracy of the gradient estimators. We test both versions of the predictive Stein gradient estimator (see section 3.4) since we require the particles of parallel chains to be independent with each other. We fit the gradient estimators on $K = 2 0 0$ training datapoints from the target density. The bandwidth of the RBF kernel is computed by the median heuristic and scaled up by a scalar between [1, 5]. All three methods are simulated for $T = 2 , 0 0 0$ iterations, share the same initial locations that are constructed by target distribution samples plus Gaussian noises of standard deviation 2.0, and the results are averaged over 200 parallel chains.
195
+
196
+ We visualise the samples and some MCMC statistics in Figure 2. In general all the resulting Hamiltonian flows are HMC-like, which give us the confidence that the gradient estimators extrapolate reasonably well at unseen locations. However all of these methods have trouble exploring the extremes, because at those locations there are very few or even no training data-points. Indeed we found it necessary to use large (but not too large) bandwidths, in order to both allow exploration of those extremes, and ensure that the corresponding test function is not too smooth. In terms of quantitative metrics, the acceptance rates are reasonably high for all the gradient estimators, and the KSD estimates (across chains) as a measure of sample quality are also close to that computed on HMC samples. The returned estimates of $\mathbb { E } [ x _ { 1 } ]$ are close to zero which is the ground true value. We found that the non-parametric Stein gradient estimator is more sensitive to hyper-parameters of the dynamics, e.g. the stepsize of each HMC step. We believe a careful selection of the kernel (e.g. those with long tails) and a better search for the hyper-parameters (for both the kernel and the dynamics) can further improve the sample quality and the chain mixing time, but this is not investigated here.
197
+
198
+ ![](images/bba07b55fa6904729682848bba8c5a5e2202a58574d1f75da2568b525bbfeed3.jpg)
199
+ Figure 2: Kernel induced Hamiltonian flow compared with HMC. Top: samples generated from the dynamics, training data (in cyan), an the trajectory of a particle for $T = 1$ to 200 starting at the star location (in yellow). Bottom: statistics computed during simulations. See main text for details.
200
+
201
+ # 4.2 META-LEARNING OF APPROXIMATE POSTERIOR SAMPLERS FOR BAYESIAN NNS
202
+
203
+ One of the recent focuses on meta-learning has been on learning optimisers for training deep neural networks, e.g. see (Andrychowicz et al., 2016). Could analogous goals be achieved for approximate inference? In this section we attempt to learn an approximate posterior sampler for Bayesian neural networks (Bayesian NNs, BNNs) that generalises to unseen datasets and architectures. A more detailed introduction of Bayesian neural networks is included in the appendix, and in a nutshell, we consider a binary classification task: $p ( y = 1 | x , \pmb { \theta } ) = \mathrm { s i g m o i d } ( \mathrm { N N } _ { \pmb { \theta } } ( \pmb { x } ) )$ , $p _ { 0 } ( \pmb { \theta } ) = \mathcal { N } ( \pmb { \theta } ; \mathbf { 0 } , \mathbf { I } )$ . After observing the training data $\boldsymbol { \mathcal { D } } = \{ ( \boldsymbol { x } _ { n } , y _ { n } ) \} _ { n = 1 } ^ { N }$ , we first obtain the approximate posterior $\begin{array} { r } { q _ { \phi } ( \pmb { \theta } ) \approx p ( \pmb { \theta } | \mathcal { D } ) \propto p _ { 0 } ( \pmb { \theta } ) \prod _ { n = 1 } ^ { N } p ( y _ { n } | \pmb { x } _ { n } , \pmb { \theta } ) } \end{array}$ , then approximate the predictive distribution for a new observation as $\begin{array} { r } { p ( y ^ { * } = 1 | x ^ { * } , \mathcal { D } ) \approx \frac { 1 } { K } \sum _ { k = 1 } ^ { K } p ( y ^ { * } = 1 | x ^ { * } , \pmb { \theta } ^ { k } ) , \pmb { \theta } ^ { k } \sim q _ { \phi } ( \pmb { \theta } ) . } \end{array}$ In this task we define an implicit approximate posterior distribution $q _ { \phi } ( \pmb \theta )$ as the following stochastic normalising flow (Rezende & Mohamed, 2015) $\pmb { \theta } _ { t + 1 } = \pmb { f } ( \pmb { \theta } _ { t } , \nabla _ { t } , \pmb { \epsilon } _ { t } )$ : given the current location $\theta _ { t }$ and the mini-batch data $\{ ( \pmb { x } _ { m } , y _ { m } ) \} _ { m = 1 } ^ { M }$ , the update for the next step is
204
+
205
+ $$
206
+ \begin{array} { r l r } & { \pmb { \theta } _ { t + 1 } = \pmb { \theta } _ { t } + \zeta \Delta _ { \phi } ( \pmb { \theta } _ { t } , \nabla _ { t } ) + \pmb { \sigma } _ { \phi } ( \pmb { \theta } _ { t } , \nabla _ { t } ) \odot \epsilon _ { t } , \quad \epsilon _ { t } \sim \mathcal { N } ( \epsilon ; \mathbf { 0 } , \mathbf { I } ) , } & \\ & { \nabla _ { t } = \nabla _ { \pmb { \theta } _ { t } } \left[ \frac { N } { M } \displaystyle \sum _ { m = 1 } ^ { M } \log p \big ( y _ { m } | \pmb { x } _ { m } , \pmb { \theta } _ { t } \big ) + \log p _ { 0 } ( \pmb { \theta } _ { t } ) \right] . } & \end{array}
207
+ $$
208
+
209
+ The coordinates of the noise standard deviation $\sigma _ { \phi } ( \theta _ { t } , \nabla _ { t } )$ and the moving direction $\Delta _ { \phi } ( \theta _ { t } , \nabla _ { t } )$ are parametrised by a coordinate-wise neural network. If properly trained, this neural network will learn the best combination of the current location and gradient information, and produce approximate posterior samples efficiently on different probabilistic modelling tasks. Here we propose using the variational inference objective (2) computed on the samples $\{ \pmb \theta _ { t } ^ { k } \}$ to learn the variational parameters $\phi$ . Since in this case the gradient of the log joint distribution can be computed analytically, we only approximate the gradient of the entropy term $\mathbb { H } [ q ]$ as in (3), with the exact score function replaced by the presented gradient estimators. We report the results using the non-parametric Stein gradient estimator as we found it works better than the parametric version. The RBF kernel is applied for gradient estimation, with the hyper-parameters determined by a grid search on the bandwidth $\sigma ^ { 2 } \overset { \smile } { \in } \{ 0 . 2 5 , 1 . 0 , 4 . 0 , 1 0 . 0$ , median trick} and $\eta \in \{ 0 . 1 , 0 . 5 , 1 . 0 , 2 . 0 \}$ .
210
+
211
+ We briefly describe the test protocol. We take from the UCI repository (Lichman, 2013) six binary classification datasets (australian, breast, crabs, ionosphere, pima, sonar), train an approximate sampler on crabs with a small neural network that has one 20-unit hidden layer with $R e L U$ activation, and generalise to the remaining datasets with a bigger network that has 50 hidden units and uses sigmoid activation. We use ionosphere as the validation set to tune $\zeta$ . The remaining 4 datasets are further split into $40 \%$ training subset for simulating samples from the approximate sampler, and $60 \%$ test subsets for evaluating the sampler’s performance.
212
+
213
+ Figure 3 presents the (negative) test log-likelihood (LL), classification error, and an estimate of the KSD U-statistic $\tilde { S _ { U } ^ { 2 } } ( \tilde { p ( \pmb { \theta } | \mathcal { D } ) } , q ( \pmb { \theta } ) )$ (with data sub-sampling) over 5 splits of each test dataset. Besides the gradient estimators we also compare with two baselines: an approximate posterior sampler trained by maximum a posteriori (MAP), and stochastic gradient Langevin dynamics (SGLD)
214
+
215
+ ![](images/acf7f7eec3f062f3f3268dc6c9364e38d43410d9404f6402f27ccd8ac48c052c.jpg)
216
+ Figure 3: Generalisation performances for trained approximate posterior samplers.
217
+
218
+ (Welling & Teh, 2011) evaluated on the test datasets directly. In summary, SGLD returns best results in KSD metric. The Stein approach performs equally well or a little better than SGLD in terms of test-LL and test error. The KDE method is slightly worse and is close to MAP, indicating that the KDE estimator does not provide a very informative gradient for the entropy term. Surprisingly the score matching estimator method produces considerably worse results (except for breast dataset), even after carefully tuning the bandwidth and the regularisation parameter $\eta$ . Future work should investigate the usage of advanced recurrent neural networks such as an LSTM (Hochreiter & Schmidhuber, 1997), which is expected to return better performance.
219
+
220
+ # 4.3 TOWARDS ADDRESSING MODE COLLAPSE IN GANS USING ENTROPY REGULARISATION
221
+
222
+ GANs are notoriously difficult to train in practice. Besides the instability of gradient-based minimax optimisation which has been partially addressed by many recent proposals (Salimans et al., 2016; Arjovsky et al., 2017; Berthelot et al., 2017), they also suffer from mode collapse. We propose adding an entropy regulariser to the GAN generator loss. Concretely, assume the generative model $p _ { \pmb { \theta } } ( \pmb { x } )$ is implicitly defined by $\pmb { x } = f _ { \pmb { \theta } } ( z ) , z \sim p _ { 0 } ( z )$ , then the generator’s loss is defined by
223
+
224
+ $$
225
+ \tilde { \mathcal { I } } _ { \mathrm { g e n } } ( \pmb { \theta } ) = \mathcal { I } _ { \mathrm { g e n } } ( \pmb { \theta } ) - \alpha \mathbb { H } [ p _ { \pmb { \theta } } ( \pmb { x } ) ] ,
226
+ $$
227
+
228
+ where $\mathcal { I } _ { \mathrm { g e n } } ( \pmb { \theta } )$ is the original loss function for the generator from any GAN algorithm and $\alpha$ is a hyper-parameter. In practice (the gradient of) (21) is estimated using Monte Carlo.
229
+
230
+ We empirically investigate the entropy regularisation idea on the very recently proposed boundary equilibrium GAN (BEGAN) (Berthelot et al., 2017) method using (continuous) MNIST, and we refer to the appendix for the detailed mathematical set-up. In this case the non-parametric V-statistic Stein gradient estimator is used. We use a convolutional generative network and a convolutional auto-encoder and select the hyper-parameters of BEGAN $\bar { \gamma } \in \lbrace 0 . 3 , 0 . 5 , 0 . 7 \rbrace$ , $\alpha \in [ 0 , 1 ]$ and $\lambda =$ 0.001. The Epanechnikov kernel $\begin{array} { r } { K ( \pmb { x } , \pmb { x } ^ { \prime } ) : = \frac { 1 } { d } \sum _ { j = 1 } ^ { d } ( 1 - ( x _ { j } - x _ { j } ^ { \prime } ) ^ { 2 } ) } \end{array}$ is used as the pixel values lie in a unit interval (see appendix for the expression of the score matching estimator), and to ensure the boundary condition we clip the pixel values into range $[ 1 0 ^ { - 8 } , 1 - 1 0 ^ { - 8 } ]$ . The generated images are visualised in Figure 4. BEGAN without the entropy regularisation fails to generate diverse samples even when trained with learning rate decay. The other three images clearly demonstrate the benefit of the entropy regularisation technique, with the Stein approach obtaining the highest diversity without compromising visual quality.
231
+
232
+ We further consider four metrics to assess the trained models quantitatively. First 500 samples are generated for each trained model, then we compute their nearest neighbours in the training set using $l _ { 1 }$ distance, and obtain a probability vector $\mathbf { p }$ by averaging over these neighbour images’ label vectors. In Figure 5 we depict the entropy of $\mathbf { p }$ (top left), averaged $l _ { 1 }$ distances to the nearest neighbour (top right), and the difference between the largest and smallest elements in $\mathbf { p }$ (bottom right). The error bars are obtained by 5 independent runs. These results demonstrate that the Stein approach performs significantly better than the other two, in that it learns a better generative model not only faster but also in a more stable way. Interestingly the KDE approach achieves the lowest average $l _ { 1 }$ distance to nearest neighbours, possibly because it tends to memorise training examples. We next train a fully connected network $\pi ( \boldsymbol { y } | \boldsymbol { x } )$ on MNIST that achieves $9 8 . 1 6 \%$ text accuracy, and compute on the generated images an empirical estimate of the inception score (Salimans et al., 2016) $\mathbb { E } _ { p ( \pmb { x } ) } [ \mathrm { K L } [ \pi ( \pmb { \bar { y } } | \pmb { x } ) | | \pi ( \pmb { y } ) ] ]$ with $\pi ( \pmb { y } ) \overset { \cdot } { = } \mathbb { E } _ { p ( \pmb { x } ) } [ \pi ( \pmb { y } | \pmb { x } ) ]$ (bottom left panel). High inception score indicates that the generate images tend to be both realistic looking and diverse, and again the Stein approach out-performs the others on this metric by a large margin.
233
+
234
+ ![](images/711c07aaa71533b03397353e9ad56fce9f23a20871bf052140a2ebe313f973cd.jpg)
235
+ Figure 4: Visualisation of generated images from trained BEGAN models.
236
+
237
+ ![](images/ae918fada81b3ecc38c292fbb7e2cc1cd5bcc0e7605ea4731056d367bd6ae0fe.jpg)
238
+ Figure 5: Quantitative evaluation on entropy regularised BEGAN. The higher the better for the LHS panels and the other way around for the RHS ones. See main text for details.
239
+
240
+ Concerning computation speed, all the three methods are of the same order: 10.20s/epoch for KDE, 10.85s/epoch for Score, and 10.30s/epoch for Stein.1 This is because $K < d$ (in the experiments $K ~ = ~ 1 0 0$ and $d \ = \ 7 8 4$ ) so that the complexity terms are dominated by kernel computations $( \mathcal { O } ( K ^ { 2 } d ) )$ required by all the three methods. Also for a comparison, the original BEGAN method without entropy regularisation runs for 9.05s/epoch. Therefore the main computation cost is dominated by the optimisation of the discriminator/generator, and the proposed entropy regularisation can be applied to many GAN frameworks with little computational burden.
241
+
242
+ # 5 CONCLUSIONS AND FUTURE WORK
243
+
244
+ We have presented the Stein gradient estimator as a novel generalisation to the score matching gradient estimator. With a focus on learning implicit models, we have empirically demonstrated the efficacy of the proposed estimator by showing how it opens the door to a range of novel learning tasks: approximating gradient-free MCMC, meta-learning for approximate inference, and unsupervised learning for image generation. Future work will expand the understanding of gradient estimators in both theoretical and practical aspects. Theoretical development will compare both the V-statistic and U-statistic Stein gradient estimators and formalise consistency proofs. Practical work will improve the sample efficiency of kernel estimators in high dimensions and develop fast yet accurate approximations to matrix inversion. It is also interesting to investigate applications of gradient approximation methods to training implicit generative models without the help of discriminators. Finally it remains an open question that how to generalise the Stein gradient estimator to non-kernel settings and discrete distributions.
245
+
246
+ # ACKNOWLEDGEMENT
247
+
248
+ We thank Marton Havasi, Jiri Hron, David Janz, Qiang Liu, Maria Lomeli, Cuong Viet Nguyen and Mark Rowland for their comments and helps on the manuscript. We also acknowledge the anonymous reviewers for their review. Yingzhen Li thanks Schlumberger Foundation FFTF fellowship. Richard E. Turner thanks Google and EPSRC grants EP/M0269571 and EP/L000776/1.
249
+
250
+ # REFERENCES
251
+
252
+ Guillaume Alain and Yoshua Bengio. What regularized auto-encoders learn from the data-generating distribution. The Journal of Machine Learning Research, 15(1):3563–3593, 2014.
253
+
254
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016.
255
+
256
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. arXiv preprint arXiv:1701.07875, 2017.
257
+
258
+ David Barber and Felix V Agakov. The im algorithm: A variational approach to information maximization. In NIPS, pp. 201–208, 2003.
259
+
260
+ Alain Berlinet and Christine Thomas-Agnan. Reproducing kernel Hilbert spaces in probability and statistics. Springer Science & Business Media, 2011.
261
+
262
+ David Berthelot, Tom Schumm, and Luke Metz. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
263
+
264
+ Kacper Chwialkowski, Heiko Strathmann, and Arthur Gretton. A kernel test of goodness of fit. In Proceedings of The 33rd International Conference on Machine Learning, pp. 2606–2615, 2016.
265
+
266
+ Kris De Brabanter, Jos De Brabanter, Bart De Moor, and Irene Gijbels. Derivative estimation with \` local polynomial fitting. The Journal of Machine Learning Research, 14(1):281–301, 2013.
267
+
268
+ Peter J Diggle and Richard J Gratton. Monte carlo methods of inference for implicit statistical models. Journal of the Royal Statistical Society. Series B (Methodological), pp. 193–227, 1984.
269
+
270
+ Jianqing Fan and Irne Gijbels. Local polynomial modelling and its applications. Chapman & Hall, 1996.
271
+
272
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
273
+
274
+ Jackson Gorham and Lester Mackey. Measuring sample quality with stein’s method. In NIPS, 2015.
275
+
276
+ Jackson Gorham and Lester Mackey. Measuring sample quality with kernels. In ICML, 2017.
277
+
278
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002.
279
+
280
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
281
+
282
+ Ferenc Huszar. Variational inference using implicit distributions. ´ arXiv preprint arXiv:1702.08235, 2017.
283
+
284
+ Aapo Hyvarinen. Estimation of non-normalized statistical models by score matching. ¨ Journal of Machine Learning Research, 6(Apr):695–709, 2005.
285
+
286
+ Aapo Hyvarinen. Consistency of pseudolikelihood estimation of fully visible boltzmann machines.¨ Neural Computation, 18(10):2283–2292, 2006.
287
+
288
+ Oliver Thomas Johnson. Information theory and the central limit theorem. World Scientific, 2004.
289
+
290
+ Theofanis Karaletsos. Adversarial message passing for graphical models. arXiv preprint arXiv:1612.05048, 2016.
291
+ Diederick P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
292
+ Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. How to train your dragan. arXiv preprint arXiv:1705.07215, 2017.
293
+ Yingzhen Li and Qiang Liu. Wild variational approximations. NIPS workshop on advances in approximate Bayesian inference, 2016.
294
+ Yingzhen Li, Richard E Turner, and Qiang Liu. Approximate inference with amortised mcmc. arXiv preprint arXiv:1702.08343, 2017.
295
+ M. Lichman. UCI machine learning repository, 2013. URL http://archive.ics.uci.edu/ ml.
296
+ Qiang Liu and Yihao Feng. Two methods for wild variational inference. arXiv preprint arXiv:1612.00081, 2016.
297
+ Qiang Liu, Jason D Lee, and Michael I Jordan. A kernelized stein discrepancy for goodness-of-fit tests and model evaluation. In ICML, 2016.
298
+ Siwei Lyu. Interpretation and generalization of score matching. In Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, pp. 359–366. AUAI Press, 2009.
299
+ Benjamin Marlin, Kevin Swersky, Bo Chen, and Nando Freitas. Inductive principles for restricted boltzmann machine learning. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 509–516, 2010.
300
+ Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Adversarial variational bayes: Unifying variational autoencoders and generative adversarial networks. arXiv preprint arXiv:1701.04722, 2017.
301
+ Shakir Mohamed and Balaji Lakshminarayanan. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016.
302
+ Radford M Neal et al. Mcmc using hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2:113–162, 2011.
303
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
304
+ Rajesh Ranganath, Jaan Altosaar, Dustin Tran, and David M. Blei. Operator variational inference. In NIPS, 2016.
305
+ Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. In ICML, 2015.
306
+ Geoffrey Roeder, Yuhuai Wu, and David Duvenaud. Sticking the landing: An asymptotically zerovariance gradient estimator for variational inference. arXiv preprint arXiv:1703.09194, 2017.
307
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016.
308
+ Jaakko Sarel ¨ a and Harri Valpola. Denoising source separation. ¨ Journal of machine learning research, 6(Mar):233–272, 2005.
309
+ Hiroaki Sasaki, Aapo Hyvarinen, and Masashi Sugiyama. Clustering via mode seeking by direct ¨ estimation of the gradient of a log-density. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 19–34. Springer, 2014.
310
+ Radhey S Singh. Improvement on some known nonparametric uniformly consistent estimators of derivatives of a density. The Annals of Statistics, pp. 394–399, 1977.
311
+
312
+ Alex J Smola and Bernhard Schokopf. Sparse greedy matrix approximation for machine learning. ¨ In Proceedings of the Seventeenth International Conference on Machine Learning, pp. 911–918. Morgan Kaufmann Publishers Inc., 2000.
313
+
314
+ Casper Kaae Sonderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszar. Amortised ´ map inference for image super-resolution. In ICLR, 2017.
315
+
316
+ Charles Stein. A bound for the error in the normal approximation to the distribution of a sum of dependent random variables. In Proceedings of the Sixth Berkeley Symposium on Mathematical Statistics and Probability, Volume 2: Probability Theory, pp. 583–602, 1972.
317
+
318
+ Charles M Stein. Estimation of the mean of a multivariate normal distribution. The annals of Statistics, pp. 1135–1151, 1981.
319
+
320
+ Charles J Stone. Additive regression and other nonparametric models. The annals of Statistics, pp. 689–705, 1985.
321
+
322
+ Heiko Strathmann, Dino Sejdinovic, Samuel Livingstone, Zoltan Szabo, and Arthur Gretton. Gradient-free hamiltonian monte carlo with efficient kernel exponential families. In Advances in Neural Information Processing Systems, pp. 955–963, 2015.
323
+
324
+ Masashi Sugiyama, Takafumi Kanamori, Taiji Suzuki, Shohei Hido, Jun Sese, Ichiro Takeuchi, and Liwei Wang. A density-ratio framework for statistical data processing. Information and Media Technologies, 4(4):962–987, 2009.
325
+
326
+ Masashi Sugiyama, Taiji Suzuki, and Takafumi Kanamori. Density-ratio matching under the bregman divergence: a unified framework of density-ratio estimation. Annals of the Institute of Statistical Mathematics, 64(5):1009–1044, 2012.
327
+
328
+ Dustin Tran, Rajesh Ranganath, and David M Blei. Deep and hierarchical implicit models. arXiv preprint arXiv:1702.08896, 2017.
329
+
330
+ R. E. Turner and M. Sahani. Two problems with variational expectation maximisation for time-series models. In D. Barber, T. Cemgil, and S. Chiappa (eds.), Bayesian Time series models, chapter 5, pp. 109–130. Cambridge University Press, 2011.
331
+
332
+ Masatoshi Uehara, Issei Sato, Masahiro Suzuki, Kotaro Nakayama, and Yutaka Matsuo. Generative adversarial nets from a density ratio estimation perspective. arXiv preprint arXiv:1610.02920, 2016.
333
+
334
+ Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011.
335
+
336
+ 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, pp. 1096–1103. ACM, 2008.
337
+
338
+ Dilin Wang and Qiang Liu. Learning to draw samples: With application to amortized mle for generative adversarial learning. arXiv preprint arXiv:1611.01722, 2016.
339
+
340
+ Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 681–688, 2011.
341
+
342
+ Christopher KI Williams and Matthias Seeger. Using the nystrom method to speed up kernel ma-¨ chines. In Advances in neural information processing systems, pp. 682–688, 2001.
343
+
344
+ 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.
345
+
346
+ Shanggang Zhou and Douglas A Wolfe. On derivative estimation in spline regression. Statistica Sinica, pp. 93–108, 2000.
347
+
348
+ # A SCORE MATCHING ESTIMATOR: REMARKS AND DERIVATIONS
349
+
350
+ In this section we provide more discussions and analytical solutions for the score matching estimator. More specifically, we will derive the linear coefficient $\pmb { a } = ( a _ { 1 } , . . . , a _ { K } )$ for the case of the Epanechnikov kernel.
351
+
352
+ # A.1 SOME REMARKS ON SCORE MATCHING
353
+
354
+ Remark. It has been shown in Sarel ¨ a & Valpola (2005); Alain & Bengio (2014) that de-noising auto- ¨ encoders (DAEs) (Vincent et al., 2008), once trained, can be used to compute the score function approximately. Briefly speaking, a DAE learns to reconstruct a datum $_ { \textbf { \em x } }$ from a corrupted input $\tilde { \mathbf { x } } = x { + } \sigma \epsilon , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ by minimising the mean square error. Then the optimal DAE can be used to approximate the score function as $\begin{array} { r } { \nabla _ { \pmb { x } } \log p ( \pmb { x } ) \approx \frac { 1 } { \sigma ^ { 2 } } ( \mathrm { { D A E ^ { * } } } ( \pmb { x } ) - \pmb { x } ) } \end{array}$ . Sonderby et al. (2017) applied this idea to train an implicit model for image super-resolution, providing some promising results in some metrics. However applying similar ideas to variational inference can be computationally expensive, because the estimation of $\nabla _ { z } \log { q ( z | x ) }$ is a sub-routine for VI which is repeatedly required. Therefore in the paper we deploy kernel machines that allow analytical solutions to the score matching estimator in order to avoid double loop optimisation.
355
+
356
+ Remark. As a side note, score matching can also be used to learn the parameters of an unnormalised density. In this case the target distribution $q$ would be the data distribution and $\hat { q }$ is often a Boltzmann distribution with intractable partition function. As a parameter estimation technique, score matching is also related to contrastive divergence (Hinton, 2002), pseudo likelihood estimation (Hyvarinen, 2006), and DAEs (Vincent, 2011; Alain & Bengio, 2014). Generalisations of score ¨ matching methods are also presented in e.g. Lyu (2009); Marlin et al. (2010).
357
+
358
+ # A.2 THE RBF KERNEL CASE
359
+
360
+ The derivations for the RBF kernel case is referred to (Strathmann et al., 2015), and for com$\begin{array} { r } { \log \hat { q } ( \pmb { x } ) = \sum _ { k = 1 } ^ { K } a _ { k } \mathcal { K } ( \pmb { x } , \pmb { x } ^ { k } ) + C } \end{array}$ e parametric approximation iel uses bandwidth parameter $\sigma$ defined as. then the $\hat { \pmb { a } } ^ { \mathrm { s c o r e } } = ( \pmb { \Sigma } + \eta \mathbf { I } ) ^ { - 1 } \pmb { v } ,$
361
+
362
+ $$
363
+ v = \sum _ { i = 1 } ^ { d } \left[ \sigma ^ { 2 } \mathbf { K } \mathbf { 1 } - \left( \mathbf { K } ( \mathbf { x } _ { i } \odot \mathbf { x } _ { i } ) + \mathrm { { d i a g } } ( \mathbf { x } _ { i } ) \mathbf { K } \mathbf { 1 } - 2 { \mathrm { d i a g } } ( \mathbf { x } _ { i } ) \mathbf { K } \mathbf { x } _ { i } \right) \right] ,
364
+ $$
365
+
366
+ $$
367
+ \pmb { \Sigma } = \sum _ { i = 1 } ^ { d } \left[ \mathrm { d i a g } ( \mathbf { x } _ { i } ) \mathbf { K } - \mathbf { K } \mathrm { d i a g } ( \mathbf { x } _ { i } ) \right] \left[ \mathbf { K } \mathrm { d i a g } ( \mathbf { x } _ { i } ) - \mathrm { d i a g } ( \mathbf { x } _ { i } ) \mathbf { K } \right] ,
368
+ $$
369
+
370
+ $$
371
+ \mathbf { x } _ { i } = ( x _ { i } ^ { 1 } , x _ { i } ^ { 2 } , . . . , x _ { i } ^ { K } ) ^ { \mathrm { T } } \in \mathbb { R } ^ { K \times 1 } .
372
+ $$
373
+
374
+ # A.3 THE EPANECHNIKOV KERNEL CASE
375
+
376
+ The Epanechnikov kernel is defined as $\begin{array} { r } { \mathcal { K } ( \pmb { x } , \pmb { x } ^ { \prime } ) = \frac { 1 } { d } \sum _ { i = 1 } ^ { d } ( 1 - ( x _ { i } - x _ { i } ^ { \prime } ) ^ { 2 } ) } \end{array}$ , where the first and second order gradients w.r.t. $x _ { i }$ is
377
+
378
+ $$
379
+ \nabla _ { x _ { i } } K ( { \pmb x } , { \pmb x } ^ { \prime } ) = \frac { 2 } { d } ( x _ { i } ^ { \prime } - x _ { i } ) , \quad \nabla _ { x _ { i } } \nabla _ { x _ { i } } K ( { \pmb x } , { \pmb x } ^ { \prime } ) = - \frac { 2 } { d } .
380
+ $$
381
+
382
+ Thus the score matching objective with $\begin{array} { r } { \log \hat { q } ( \pmb { x } ) = \sum _ { k = 1 } ^ { K } a _ { k } \mathcal { K } ( \pmb { x } , \pmb { x } ^ { k } ) + C } \end{array}$ is reduced to
383
+
384
+ $$
385
+ \begin{array} { l } { \displaystyle \mathcal { F } ( \pmb { a } ) = \frac { 1 } { K } \sum _ { j = 1 } ^ { K } \left[ | | \sum _ { k = 1 } ^ { K } a _ { k } \frac { 2 } { d } ( \pmb { x } ^ { k } - \pmb { x } ^ { j } ) | | _ { 2 } ^ { 2 } - 2 \sum _ { k = 1 } ^ { K } a _ { k } \frac { 2 } { d } d \right] } \\ { \displaystyle \qquad = \frac { 4 } { K } \sum _ { j = 1 } ^ { K } \left[ \frac { 1 } { d ^ { 2 } } \sum _ { k = 1 } ^ { K } \sum _ { k ^ { \prime } = 1 } ^ { K } a _ { k } a _ { k ^ { \prime } } ( \pmb { x } ^ { k } - \pmb { x } ^ { j } ) ^ { \mathrm { T } } ( \pmb { x } ^ { k ^ { \prime } } - \pmb { x } ^ { j } ) - \pmb { a } ^ { \mathrm { T } } \pmb { 1 } \right] } \\ { \displaystyle \qquad : = 4 ( \pmb { a } ^ { \mathrm { T } } \pmb { a } - \pmb { a } ^ { \mathrm { T } } \pmb { 1 } ) , } \end{array}
386
+ $$
387
+
388
+ with the matrix elements
389
+
390
+ $$
391
+ \Sigma _ { k k ^ { \prime } } = \frac { 1 } { d ^ { 2 } } \left[ ( \pmb { x } ^ { k } ) ^ { \mathrm { T } } \pmb { x } ^ { k ^ { \prime } } + \frac { 1 } { K } \sum _ { j = 1 } ^ { K } \left( | | \pmb { x } ^ { j } | | _ { 2 } ^ { 2 } - ( \pmb { x } ^ { k } + \pmb { x } ^ { k ^ { \prime } } ) ^ { \mathrm { T } } \pmb { x } ^ { j } \right) \right] .
392
+ $$
393
+
394
+ Define the “gram matrix” $\mathbb X _ { i j } = ( \pmb x ^ { i } ) ^ { \mathrm T } \pmb x ^ { j }$ , we write the matrix form of $\pmb { \Sigma }$ as
395
+
396
+ $$
397
+ \Sigma = \frac { 1 } { d ^ { 2 } } \left[ \mathbb { X } + \frac { 1 } { K } \left( \mathrm { T r } ( \mathbb { X } ) - 2 \mathbb { X } \mathbf { 1 } \mathbf { 1 } ^ { \mathrm { T } } \right) \right] .
398
+ $$
399
+
400
+ Thus with an $l _ { 2 }$ regulariser, the fitted coefficients are
401
+
402
+ $$
403
+ \hat { \pmb { a } } ^ { \mathrm { s c o r e } } = \frac { d ^ { 2 } } { 2 } \left[ \mathbb { X } + \frac { 1 } { K } \left( \mathrm { T r } ( \mathbb { X } ) - 2 \mathbb { X } { \bf 1 1 } ^ { \mathrm { T } } \right) + \eta { \bf I } \right] ^ { - 1 } { \bf 1 } .
404
+ $$
405
+
406
+ B STEIN GRADIENT ESTIMATOR: DERIVATIONS
407
+
408
+ B.1 DIRECT MINIMISATION OF KSD V-STATISTIC AND U-STATISTIC
409
+
410
+ The V-statistic of KSD is the following: given samples $\pmb { x } ^ { k } \sim q , k = 1 , . . . , K$ and recall ${ \bf K } _ { j l } = { \bf \Lambda } $ $\mathcal { K } ( \pmb { x } ^ { j } , \pmb { x } ^ { l } )$
411
+
412
+ $$
413
+ \mathfrak { S } _ { V } ^ { 2 } ( \mathfrak { q } , \hat { \mathfrak { q } } ) = \frac { 1 } { K ^ { 2 } } \sum _ { j = 1 } ^ { K } \sum _ { l = 1 } ^ { K } \left[ \hat { g } ( \mathfrak { x } ^ { j } ) ^ { \mathrm { T } } \mathbf { K } _ { j l } \hat { g } ( \mathfrak { x } ^ { l } ) + \hat { g } ( \mathfrak { x } ^ { j } ) ^ { \mathrm { T } } \nabla _ { \mathfrak { x } ^ { l } } \mathbf { K } _ { j l } + \nabla _ { \mathfrak { x } ^ { j } } \mathbf { K } _ { j l } ^ { \mathrm { T } } \hat { g } ( \mathfrak { x } ^ { l } ) + \mathrm { T r } ( \nabla _ { \mathfrak { x } ^ { j } , \mathfrak { x } ^ { l } } \mathbf { K } _ { j l } ) \right] .
414
+ $$
415
+
416
+ The last term $\nabla _ { \pmb { x } ^ { j } , \pmb { x } ^ { l } } \mathbf { K } _ { j l }$ will be ignored as it does not depend on the approximation $\hat { \pmb { g } }$ . Using matrix notations defined in the main text, readers can verify that the $\mathrm { V } .$ -statistic can be computed as
417
+
418
+ $$
419
+ \mathcal { S } _ { V } ^ { 2 } ( q , \hat { q } ) = \frac { 1 } { K ^ { 2 } } \mathrm { T r } ( \mathbf { K } \hat { \mathbf { G } } \hat { \mathbf { G } } ^ { \mathrm { T } } + 2 \langle \nabla , \mathbf { K } \rangle \hat { \mathbf { G } } ^ { \mathrm { T } } ) + C .
420
+ $$
421
+
422
+ Using the cyclic invariance of matrix trace leads to the desired result in the main text. The U-statistic of KSD removes terms indexed by $j = l$ in (23), in which the matrix form is
423
+
424
+ $$
425
+ \mathcal { S } _ { U } ^ { 2 } ( q , \hat { q } ) = \frac { 1 } { K ( K - 1 ) } \mathrm { T r } ( ( { \bf K } - \mathrm { d i a g } ( { \bf K } ) ) \hat { \bf G } \hat { \bf G } ^ { \mathrm { T } } + 2 ( \langle \nabla , { \bf K } \rangle - \nabla \mathrm { d i a g } ( { \bf K } ) ) \hat { \bf G } ^ { \mathrm { T } } ) + C .
426
+ $$
427
+
428
+ with the $j$ th row of $\nabla \mathrm { d i a g } ( \mathbf { K } )$ defined as $\nabla _ { \pmb { x } ^ { j } } \mathcal { K } ( \pmb { x } ^ { j } , \pmb { x } ^ { j } )$ . For most translation invariant kernels this extra term $\nabla \mathrm { d i a g } ( \mathbf { K } ) = \mathbf { 0 }$ , thus the optimal solution of $\hat { \mathbf { G } }$ by minimising KSD U-statistic is
429
+
430
+ $$
431
+ \hat { \mathbf { G } } _ { U } ^ { \mathrm { S t e i n } } = - ( \mathbf { K } - \mathrm { d i a g } ( \mathbf { K } ) + \eta \mathbf { I } ) ^ { - 1 } \langle \nabla , \mathbf { K } \rangle .
432
+ $$
433
+
434
+ # B.2 DERIVING THE NON-PARAMETRIC PREDICTIVE ESTIMATOR
435
+
436
+ Let us consider an unseen datum $\textbf { { y } }$ . If $\textbf { { y } }$ is sampled from the $q$ distribution, then one can also apply the non-parametric estimator (9) for gradient approximations, given the observed data $\mathbf { X } =$ $\{ \bar { \pmb { x } } ^ { 1 } , . . . , \pmb { x } ^ { K } \} \stackrel { - } { \sim } q$ . Concretely, if writing $\bar { \pmb g } ( \pmb y ) \approx \bar { \nabla _ { \pmb y } } \log q ( \pmb y ) \in \bar { \mathbb R ^ { d \times 1 } }$ then the non-parametric Stein gradient estimator (using $\mathrm { V } .$ -statistic) is
437
+
438
+ $$
439
+ \begin{array} { r } { \left[ \hat { g } ( y ) ^ { \mathrm { T } } \right] = - ( \mathbf { K } ^ { * } + \eta I ) ^ { - 1 } \left[ \nabla _ { y } K ( y , y ) + \sum _ { k = 1 } ^ { K } \nabla _ { x ^ { k } } K ( y , x ^ { k } ) \right] , \quad \mathbf { K } ^ { * } = \left[ \mathbf { K } _ { y y } \quad \mathbf { K } _ { y \mathbf { X } } \right] , } \\ { \left. \nabla , \mathbf { K } \right. + \nabla _ { y } K ( \cdot , y ) \qquad \quad \mathbf { K } ^ { * } = \left[ \mathbf { K } _ { \mathbf { X } y } \quad \mathbf { K } \right] , } \end{array}
440
+ $$
441
+
442
+ with $\nabla _ { \pmb { y } } K ( \cdot , \pmb { y } )$ denoting a $K \times d$ matrix with rows $\nabla _ { \pmb { y } } K ( \pmb { x } ^ { k } , \pmb { y } )$ , and $\nabla _ { \pmb { y } } K ( \pmb { y } , \pmb { y } )$ only differentiates through the second argument. Thus by simple matrix calculations, we have:
443
+
444
+ $$
445
+ \begin{array} { l } { \nabla _ { y } \log q ( { y } ) ^ { \mathrm { T } } \approx - \left( \mathbf K _ { y y } + \eta - \mathbf K _ { y \mathbf X } ( \mathbf K + \eta \mathbf I ) ^ { - 1 } \mathbf K _ { \mathbf X { y } } \right) ^ { - 1 } } \\ { \displaystyle \qquad \left( \nabla _ { y } K ( y , y ) + \sum _ { k = 1 } ^ { K } \nabla _ { x ^ { k } } K ( y , x ^ { k } ) + \mathbf K _ { y \mathbf X } \hat { \mathbf G } _ { V } ^ { \mathrm { S t e i n } } - \mathbf K _ { y \mathbf X } ( \mathbf K + \eta \mathbf I ) ^ { - 1 } \nabla _ { y } K ( \cdot , y ) \right) . } \end{array}
446
+ $$
447
+
448
+ For translation invariant kernels, typically $\nabla _ { \pmb { y } } \mathcal { K } ( \pmb { y } , \pmb { y } ) = \mathbf { 0 }$ , and more conveniently,
449
+
450
+ $$
451
+ \nabla _ { \pmb { x } ^ { k } } \mathcal { K } ( \pmb { y } , \pmb { x } ^ { k } ) = \nabla _ { \pmb { x } ^ { k } } ( \pmb { x } ^ { k } - \pmb { y } ) \nabla _ { ( \pmb { x } ^ { k } - \pmb { y } ) } \mathcal { K } ( \pmb { x } ^ { k } - \pmb { y } ) = - \nabla _ { \pmb { y } } \mathcal { K } ( \pmb { x } ^ { k } , \pmb { y } ) .
452
+ $$
453
+
454
+ Thus equation (27) can be further simplified to (with column vector $\mathbf { 1 } \in \mathbb { R } ^ { K \times 1 }$ )
455
+
456
+ $$
457
+ \begin{array} { r l } & { \nabla _ { y } \log q ( \pmb { y } ) ^ { \operatorname { T } } \approx - \left( \mathbf { K } _ { y y } + \eta - \mathbf { K } _ { y \mathbf { X } } ( \mathbf { K } + \eta \mathbf { I } ) ^ { - 1 } \mathbf { K } _ { \mathbf { X } y } \right) ^ { - 1 } } \\ & { \qquad \left( \mathbf { K } _ { y \mathbf { X } } \hat { \mathbf { G } } _ { V } ^ { \mathrm { { S t e i n } } } - \left( \mathbf { K } _ { y \mathbf { X } } ( \mathbf { K } + \eta \mathbf { I } ) ^ { - 1 } + \mathbf { 1 } ^ { \operatorname { T } } \right) \nabla _ { y } \mathcal { K } ( \cdot , y ) \right) . } \end{array}
458
+ $$
459
+
460
+ The solution for the U-statistic case can be derived accordingly which we omit here.
461
+
462
+ B.3 PARAMETRIC STEIN GRADIENT ESTIMATOR WITH THE RBF KERNEL
463
+
464
+ We define a parametric approximation in a similar way as for the score matching estimator:
465
+
466
+ $$
467
+ \log \hat { q } ( \pmb { x } ) : = \sum _ { k = 1 } ^ { K } a _ { k } K ( \pmb { x } , \pmb { x } ^ { k } ) + C , \quad K ( \pmb { x } , \pmb { x } ^ { \prime } ) = \exp \left[ - \frac { 1 } { 2 \sigma ^ { 2 } } | | \pmb { x } - \pmb { x } ^ { \prime } | | _ { 2 } ^ { 2 } \right] .
468
+ $$
469
+
470
+ Now we show the optimal solution of $\pmb { a } = ( a _ { 1 } , . . . , a _ { K } ) ^ { \mathrm { T } }$ by minimising (23). To simplify derivations we assume the approximation and KSD use the same kernel. First note that the gradient of the RBF kernel is
471
+
472
+ $$
473
+ \nabla _ { \pmb { x } } K ( \pmb { x } , \pmb { x } ^ { \prime } ) = \frac { 1 } { \sigma ^ { 2 } } K ( \pmb { x } , \pmb { x } ^ { \prime } ) ( \pmb { x } ^ { \prime } - \pmb { x } ) .
474
+ $$
475
+
476
+ Substituting (30) into (23):
477
+
478
+ $$
479
+ S _ { V } ^ { 2 } ( q , \hat { q } ) = C + \pmb { \mathscr { s } } + 2 \pmb { \mathscr { s } } ,
480
+ $$
481
+
482
+ $$
483
+ \ P \bullet \mathrm { = } \frac { 1 } { K ^ { \mathrm { 2 } } } \sum _ { k = 1 } ^ { K } \sum _ { k ^ { \prime } = 1 } ^ { K } \sum _ { j = 1 } ^ { K } \sum _ { l = 1 } ^ { K } a _ { k } a _ { k ^ { \prime } } \mathbf { K } _ { k j } \mathbf { K } _ { j l } \mathbf { K } _ { l k ^ { \prime } } \frac { 1 } { \sigma ^ { 4 } } ( { \pmb x } ^ { k } - { \pmb x } ^ { j } ) ^ { \mathrm { T } } ( { \pmb x } ^ { k ^ { \prime } } - { \pmb x } ^ { l } ) ,
484
+ $$
485
+
486
+ $$
487
+ \pmb { \diamond } = \frac { 1 } { K ^ { 2 } } \sum _ { k = 1 } ^ { K } \sum _ { j = 1 } ^ { K } \sum _ { l = 1 } ^ { K } a _ { k } \mathbf { K } _ { k j } \mathbf { K } _ { j l } \frac { 1 } { \sigma ^ { 4 } } ( \pmb { x } ^ { k } - \pmb { x } ^ { j } ) ^ { \mathrm { T } } ( \pmb { x } ^ { j } - \pmb { x } ^ { l } ) .
488
+ $$
489
+
490
+ We first consider summing the $j , l$ indices in $\clubsuit$ . Recall the “gram matrix” $\mathbb X _ { i j } = ( { \pmb x } ^ { i } ) ^ { \mathrm T } { \pmb x } ^ { j }$ , the inner product term in $\clubsuit$ can be expressed as ${ \mathbb X } _ { k k ^ { \prime } } + { \mathbb X } _ { j l } - { \mathbb X } _ { k l } - { \mathbb X } _ { j k ^ { \prime } }$ . Thus the summation over $j , l$ can be re-written as
491
+
492
+ $$
493
+ \begin{array} { r l } { { \boldsymbol { \Lambda } : = \sum _ { j = 1 } ^ { K } \sum _ { l = 1 } ^ { K } \mathbf { K } _ { k j } \mathbf { K } _ { j l } \mathbf { K } _ { l k ^ { \prime } } ( \mathbb { X } _ { k k ^ { \prime } } + \mathbb { X } _ { j l } - \mathbb { X } _ { k l } - \mathbb { X } _ { j k ^ { \prime } } ) } \quad } & { } \\ & { = \mathbb { X } \odot ( \mathbf { K } \mathbf { K } \mathbf { K } ) + \mathbf { K } ( \mathbf { K } \odot \mathbb { X } ) \mathbf { K } - ( ( \mathbf { K } \mathbf { K } ) \odot \mathbb { X } ) \mathbf { K } - \mathbf { K } ( ( \mathbf { K } \mathbf { K } ) \odot \mathbb { X } ) . } \end{array}
494
+ $$
495
+
496
+ And thus $\begin{array} { r } { \pmb { \mathscr { s } } = \frac { 1 } { \sigma ^ { 4 } } \pmb { a } ^ { \mathrm { T } } \pmb { \Lambda } \pmb { a } } \end{array}$ . Similarly the summation over $j , l$ in $\spadesuit$ can be simplified into
497
+
498
+ $$
499
+ \begin{array} { r l } & { - \pmb { b } : = \displaystyle \sum _ { j = 1 } ^ { K } \sum _ { l = 1 } ^ { K } \mathbf { K } _ { k j } \mathbf { K } _ { j l } ( \mathbb { X } _ { k j } + \mathbb { X } _ { j l } - \mathbb { X } _ { k l } - \mathbb { X } _ { j j } ) } \\ & { \quad \quad = \ : - \ : ( \mathbf { K } \mathrm { d i a g } ( \mathbb { X } ) \mathbf { K } + ( \mathbf { K } \mathbf { K } ) \odot \mathbb { X } - \mathbf { K } ( \mathbf { K } \odot \mathbb { X } ) - ( \mathbf { K } \odot \mathbb { X } ) \mathbf { K } ) \mathbf { 1 } , } \end{array}
500
+ $$
501
+
502
+ which leads to $\begin{array} { r } { \pmb { \langle \mathscr { s } \rangle } = - \frac { 1 } { \sigma ^ { 4 } } \pmb { a } ^ { \mathrm { T } } \pmb { b } } \end{array}$ . Thus minimising $S _ { V } ^ { 2 } ( q , \hat { q } )$ plus an $l _ { 2 }$ regulariser returns the Stein estimator $\hat { \pmb { a } } _ { V } ^ { \mathrm { S t e i n } }$ in the main text.
503
+
504
+ Similarly we can derive the solution for KSD U-statistic minimisation. The $\mathrm { U }$ statistic can also be represented in quadratic form $S _ { U } ^ { 2 } ( q , \hat { q } ) = C + \tilde { \tilde { \mathbf { \eta } } } + 2 \tilde { \tilde { \mathbf { \eta } } }$ , with $\tilde { \mathbf { A } } = \spadesuit$ and
505
+
506
+ $$
507
+ \tilde { \mathbf { a } } = \mathbf { a } - \frac { 1 } { K ^ { 2 } } \sum _ { k = 1 } ^ { K } \sum _ { k ^ { \prime } = 1 } ^ { K } \sum _ { j = 1 } ^ { K } a _ { k } a _ { k ^ { \prime } } \mathbf { K } _ { k j } \mathbf { K } _ { j j } \mathbf { K } _ { j k ^ { \prime } } \frac { 1 } { \sigma ^ { 4 } } \big ( \mathbb { X } _ { k k ^ { \prime } } + \mathbb { X } _ { j j } - \mathbb { X } _ { k j } - \mathbb { X } _ { j k ^ { \prime } } \big ) .
508
+ $$
509
+
510
+ Summing over the $j$ indices for the second term, we have
511
+
512
+ $$
513
+ \begin{array} { r l } { { \sum _ { j = 1 } ^ { K } { \mathbf { K } } _ { k j } \mathbf { K } _ { j j } \mathbf { K } _ { j k ^ { \prime } } ( { \mathbb { X } } _ { k k ^ { \prime } } + { \mathbb { X } } _ { j j } - { \mathbb { X } } _ { k j } - { \mathbb { X } } _ { j k ^ { \prime } } ) } \quad } & { } \\ & { = { \mathbb { X } } \odot ( { \mathbf { K } } \mathrm { d i a g } ( { \mathbf { K } } ) { \mathbf { K } } ) + { \mathbf { K } } \mathrm { d i a g } ( { \mathbf { K } } \odot { \mathbb { X } } ) { \mathbf { K } } - ( ( { \mathbf { K } } \mathrm { d i a g } ( { \mathbf { K } } ) ) \odot { \mathbb { X } } ) { \mathbf { K } } - { \mathbf { K } } ( ( \mathrm { d i a g } ( { \mathbf { K } } ) { \mathbf { K } } ) \odot { \mathbb { X } } ) . } \end{array}
514
+ $$
515
+
516
+ Working through the analogous derivations reveals that $\hat { \pmb { a } } _ { U } ^ { \mathrm { S t e i n } } = ( \tilde { \pmb { \Lambda } } + \eta { \bf I } ) ^ { - 1 } { \pmb { b } }$ , with
517
+
518
+ $$
519
+ \begin{array} { r l } & { \tilde { \mathbf { A } } = \mathbb { X } \odot ( \mathbf { K } ( \mathbf { K } - \mathrm { d i a g } ( \mathbf { K } ) ) \mathbf { K } ) + \mathbf { K } ( ( \mathbf { K } \odot \mathbb { X } ) - \mathrm { d i a g } ( \mathbf { K } \odot \mathbb { X } ) ) \mathbf { K } } \\ & { \qquad - \left( ( \mathbf { K } ( \mathbf { K } - \mathrm { d i a g } ( \mathbf { K } ) ) ) \odot \mathbb { X } \right) \mathbf { K } - \mathbf { K } ( ( ( \mathbf { K } - \mathrm { d i a g } ( \mathbf { K } ) ) \mathbf { K } ) \odot \mathbb { X } ) . } \end{array}
520
+ $$
521
+
522
+ # C MORE DETAILS ON THE EXPERIMENTS
523
+
524
+ We describe the detailed experimental set-up in this section. All experiments use Adam optimiser (Kingma & Ba, 2015) with standard parameter settings.
525
+
526
+ # C.1 APPROXIMATE POSTERIOR SAMPLER EXPERIMENTS
527
+
528
+ We start by reviewing Bayesian neural networks with binary classification as a running example. In this task, a normal deep neural network is constructed to predict $y = f _ { \theta } ( { \pmb x } )$ , and the neural network is parameterised by a set of weights (and bias vectors which we omit here for simplicity) $\pmb { \theta } = \{ \mathbf { W } ^ { l } \} _ { l = 1 } ^ { L }$ . In the Bayesian framework these network weights are treated as random variables, and a prior distribution, e.g. Gaussian, is also attached to them: $p _ { 0 } ( \pmb { \theta } ) = \mathcal { N } ( \pmb { \theta } ; \mathbf { 0 } , \mathbf { I } )$ . The likelihood function of $\pmb \theta$ is then defined as
529
+
530
+ $$
531
+ p ( y = 1 | \mathbf { x } , \pmb { \theta } ) = \mathrm { s i g m o i d } ( \mathrm { N N } _ { \pmb { \theta } } ( \pmb { x } ) ) ,
532
+ $$
533
+
534
+ and $p ( y = 0 | \mathbf { x } , \pmb { \theta } ) = 1 - p ( y = 1 | \mathbf { x } , \pmb { \theta } )$ accordingly. One can show that the usage of Bernoulli distribution here corresponds to applying cross entropy loss for training.
535
+
536
+ After framing the deep neural network as a probabilistic model, a Bayesian approach would find the posterior of the network weights $p ( \pmb \theta | \mathcal { D } )$ and use the uncertainty information encoded in it for future predictions. By Bayes’ rule, the exact posterior is
537
+
538
+ $$
539
+ p ( \pmb \theta | \mathcal { D } ) \propto p _ { 0 } ( \pmb \theta ) \prod _ { n = 1 } ^ { N } p ( y _ { n } | \pmb x _ { n } , \pmb \theta ) ,
540
+ $$
541
+
542
+ and the predictive distribution for a new input $\pmb { x } ^ { * }$ is
543
+
544
+ $$
545
+ p ( y ^ { \ast } = 1 | \pmb { x } ^ { \ast } , \mathcal { D } ) = \int p ( y ^ { \ast } = 1 | \pmb { x } ^ { \ast } , \pmb { \theta } ) p ( \pmb { \theta } | \mathcal { D } ) d \pmb { \theta } .
546
+ $$
547
+
548
+ Again the exact posterior is intractable, and approximate inference would fit an approximate posterior distribution $q _ { \phi } ( \pmb \theta )$ parameterised by the variational parameters $\phi$ to the exact posterior, and then use it to compute the (approximate) predictive distribution.
549
+
550
+ $$
551
+ p ( y ^ { \ast } = 1 | x ^ { \ast } , \mathcal { D } ) \approx \int p ( y ^ { \ast } = 1 | x ^ { \ast } , \pmb { \theta } ) q _ { \phi } ( \pmb { \theta } ) d \pmb { \theta } .
552
+ $$
553
+
554
+ Since in practice analytical integration for neural network weights is also intractable, the predictive distribution is further approximated by Monte Carlo:
555
+
556
+ $$
557
+ p ( y ^ { * } = 1 | x ^ { * } , \mathcal { D } ) \approx \frac { 1 } { K } \sum _ { k = 1 } ^ { K } p ( y ^ { * } = 1 | x ^ { * } , \pmb { \theta } ^ { k } ) , \quad \pmb { \theta } ^ { k } \sim q _ { \phi } ( \pmb { \theta } ) .
558
+ $$
559
+
560
+ Now it remains to fit the approximate posterior $q _ { \phi } ( \pmb \theta )$ , and in the experiment the approximate posterior is implicitly constructed by a stochastic flow. For the training task, we use a one hidden layer neural network with 20 hidden units to compute the noise variance and the moving direction of the next update. In a nutshell it takes the ith coordinate of the current position and the gradient $\pmb { \theta } _ { t } ( i ) , \bar { \nabla _ { t } } ( i )$ as the inputs, and output the corresponding coordinate of the moving direction $\Delta _ { \phi } ( \theta _ { t } , \nabla _ { t } ) ( i )$ and the noise variance $\sigma _ { \phi } ( \pmb { \theta } _ { t } , \nabla _ { t } ) ( i )$ . Softplus non-linearity is used for the hidden layer and to compute the noise variance we apply ReLU activation to ensure non-negativity. The step-size $\zeta$ is selected as 1e-5 which is tuned on the KDE approach. For SGLD step-size 1e-5 also returns overall good results.
561
+
562
+ The training process is the following. We simulate the approximate sampler for 10 transitions and sum over the variational lower-bounds computed on the samples of every step. Concretely, the maximisation objective is
563
+
564
+ $$
565
+ \mathcal { L } ( \phi ) = \sum _ { t = 1 } ^ { T } \mathcal { L } _ { \mathrm { V I } } ( q _ { t } ) ,
566
+ $$
567
+
568
+ where $T = 1 0 0$ and $q _ { t } ( \pmb \theta )$ is implicitly defined by the marginal distribution of $\theta _ { t }$ that is dependent on $\phi$ . In practice the variational lower-bound ${ \mathcal { L } } _ { \mathrm { V I } } ( q _ { t } )$ is further approximated by Monte Carlo and data sub-sampling:
569
+
570
+ $$
571
+ \mathcal { L } _ { \mathrm { V I } } ( q _ { t } ) \approx \frac { N } { M } \sum _ { m = 1 } ^ { M } \log p ( y _ { m } | x _ { m } , \pmb { \theta } _ { t } ) + \log p _ { 0 } ( \pmb { \theta } _ { t } ) - \log q _ { t } ( \pmb { \theta } _ { t } ) .
572
+ $$
573
+
574
+ The MAP baseline considers an alternative objective function by removing the $\log q _ { t } ( \pmb \theta _ { t } )$ term from the above MC-VI objective.
575
+
576
+ Truncated back-propagation is applied for every 10 steps in order to avoid vanishing/exploding gradients. The simulated samples at time $T$ are stored to initialise the Markov chain for the next iteration, and for every 50 iterations we restart the simulation by randomly sampling the locations from the prior. Early stopping is applied using the validation dataset, and the learning rate is set to 0.001, the number of epochs is set to 500.
577
+
578
+ We perform hyper-parameter search for the kernel, i.e. a grid search on the bandwidth $\sigma ^ { 2 } \in $ $\{ 0 . 2 \bar { 5 } , 1 . 0 , 4 . 0 , \bar { 1 0 } . 0$ , median trick} and $\eta \in \{ 0 . 1 , 0 . 5 , 1 . 0 , 2 . 0 \}$ . We found the median heuristic is sufficient for the KDE and Stein approaches. However, we failed to obtain desirable results using the score matching estimator with median heuristics, and for other settings the score matching approach underperforms when compared to KDE and Stein methods.
579
+
580
+ # C.2 BEGAN EXPERIMENTS
581
+
582
+ In this section we describe the experimental details of the BEGAN experiment, but first we introduce the mathematical idea and discuss how the entropy regulariser is applied.
583
+
584
+ Assume the generator is implicitly defined: $\pmb { x } \sim p _ { \pmb \theta } ( \pmb { x } ) \pmb { x } = \pmb { f _ { \pmb \theta } } ( z ) , z \sim p _ { 0 } ( z )$ . In BEGAN the discriminator is defined as an auto-encoder $D _ { \varphi } ( \pmb { x } )$ that reconstructs the input $_ { \textbf { \em x } }$ . After selecting a ratio parameter $\gamma > 0$ , a control rate $\beta _ { 0 }$ initialised at 0, and a “learning rate” $\lambda > 0$ for the control rate, the loss functions for the generator $\pmb { x } = \pmb { f _ { \theta } } ( z ) , z \sim p _ { 0 } ( z )$ and the discriminator are:
585
+
586
+ $$
587
+ \begin{array} { r l } & { \mathcal { I } ( \pmb { x } ) = | | D _ { \varphi } ( \pmb { x } ) - \pmb { x } | | , \quad | | \cdot | | = | | \cdot | | _ { 2 } ^ { 2 } \mathrm { o r } | \cdot | | _ { 1 } , } \\ & { \mathcal { I } _ { \mathtt { g e n } } ( \pmb { \theta } ; \pmb { \varphi } ) = \mathcal { I } ( \pmb { f } _ { \pmb { \theta } } ( z ) ) , \quad z \sim p _ { 0 } ( z ) } \\ & { \mathcal { I } _ { \mathrm { d i s } } ( \pmb { \varphi } ; \pmb { \theta } ) = \mathcal { I } ( \pmb { x } ) - \beta _ { t } \mathcal { I } _ { \mathtt { g e n } } ( \pmb { \theta } ; \pmb { \varphi } ) , \quad \pmb { x } \sim \mathcal { D } } \\ & { \beta _ { t + 1 } = \beta _ { t } + \lambda ( \gamma \mathcal { I } ( \pmb { x } ) - \mathcal { I } ( \pmb { f } _ { \pmb { \theta } } ( z ) ) ) . } \end{array}
588
+ $$
589
+
590
+ The main idea behind BEGAN is that, as the reconstruction loss $\mathcal { I } ( \cdot )$ is approximately Gaussian distributed, with $\gamma = 1$ the discriminator loss $\mathcal { T } _ { \mathrm { d i s } }$ is (approximately) proportional to the Wasserstein distance between loss distributions induced by the data distribution $p _ { \mathcal { D } } ( \pmb { x } )$ and the generator $p _ { \pmb { \theta } } ( \pmb { x } )$ . In practice it is beneficial to maintain the equilibrium $\gamma \mathbb { E } _ { p _ { \mathcal { D } } } \left[ \mathcal { I } ( \pmb { x } ) \right] = \mathbb { E } _ { p _ { \theta } } \left[ \mathcal { I } ( \pmb { x } ) \right]$ through the optimisation procedure described in (34) that is motivated by proportional control theory. This approach effectively stabilises training, however it suffers from catastrophic mode collapsing problem (see the left most panel in Figure 4). To address this issue, we simply subtract an entropy term from the generator’s loss function, i.e.
591
+
592
+ $$
593
+ \tilde { \mathcal { I } } _ { \mathrm { g e n } } ( \pmb { \theta } ; \varphi ) = \mathcal { I } _ { \mathrm { g e n } } ( \pmb { \theta } ; \varphi ) - \alpha \mathbb { H } [ p _ { \pmb { \theta } } ] ,
594
+ $$
595
+
596
+ where the rest of the optimisation objectives remains as in (34). This procedure would maintain the equilibrium $\gamma \mathbb { E } _ { p _ { D } } \left[ \mathcal { \bar { I } } ( \pmb { x } ) \right] = \mathbb { E } _ { p _ { \theta } } \left[ \mathcal { I } ( \pmb { x } ) \right] - \alpha \mathbb { H } [ p ]$ . We approximate the gradient $\nabla _ { \pmb { \theta } } \mathbb { H } [ p _ { \pmb { \theta } } ]$ using the estimators presented in the main text. For the purpose of updating the control rate $\beta _ { t }$ two strategies are considered to approximate the contribution of the entropy term. Given $K$ samples $\pmb { x } ^ { 1 } , . . . , \pmb { x } ^ { k } \sim p _ { \pmb { \theta } } ( \pmb { x } )$ , The first proposal considers a plug-in estimate of the entropy term with a KDE estimate of $p _ { \pmb { \theta } } ( \pmb { x } )$ , which is consistent with the KDE estimator but not necessary with the other two (as they use kernelsproxy of the entropy loss $\log p _ { \theta } ( { \pmb x } )$ $\nabla _ { \pmb { x } } \log p _ { \pmb { \theta } } ( \pmb { x } ) )$ . The second onerated samples es a and $\begin{array} { r } { - \mathbb { H } [ p ] \approx \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \nabla _ { \pmb { x } ^ { k } } \log p _ { \pmb { \theta } } ( \pmb { x } ^ { k } ) ^ { \mathrm { T } } \pmb { x } ^ { k } } \end{array}$ $\{ \boldsymbol { x } ^ { k } \}$ $\nabla _ { \pmb { x } ^ { k } } \log p _ { \pmb { \theta } } ( \pmb { x } ^ { k } )$ approximated by the gradient estimator in use.
597
+
598
+ In the experiment, we construct a deconvolutional net for the generator and a convolutional autoencoder for the discriminator. The convolutional encoder consists of 3 convolutional layers with filter width 3, stride 2, and number of feature maps [32, 64, 64]. These convolutional layers are followed by two fully connected layers with [512, 64] units. The decoder and the generative net have a symmetric architecture but with stride convolutions replaced by deconvolutions. ReLU activation function is used for all layers except the last layer of the generator, which uses sigmoid non-linearity. The reconstruction loss in use is the squared $\ell _ { 2 }$ norm $| | \cdot | | _ { 2 } ^ { 2 }$ . The randomness $p _ { 0 } ( z )$ is selected as uniform distribution in [-1, 1] as suggested in the original paper (Berthelot et al., 2017). The minibatch size is set to $K = 1 0 0$ . Learning rate is initialised at 0.0002 and decayed by 0.9 every 10 epochs, which is tuned on the KDE model. The selected $\gamma$ and $\alpha$ values are: for KDE estimator approach $\gamma = 0 . 3 , \alpha \gamma = 0 . 0 5$ , for score matching estimator approach $\gamma = 0 . 3 , \alpha \gamma = 0 . 1$ , and for Stein approach $\gamma = 0 . 5$ and $\alpha \gamma = 0 . 3$ . The presented results use the KDE plug-in estimator for the entropy estimates (used to tune $\beta$ ) for the KDE and score matching approaches. Initial experiments found that for the Stein approach, using the KDE entropy estimator works slightly worse than the proxy loss, thus we report results using the proxy loss. An advantage of using the proxy loss is that it directly relates to the approximate gradient. Furthermore we empirically observe that the performance of the Stein approach is much more robust to the selection of $\gamma$ and $\alpha$ when compared to the other two methods.
md/train/SJk01vogl/SJk01vogl.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/SJl98sR5tX/SJl98sR5tX.md ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INTERACTIVE AGENT MODELING BY LEARNING TOPROBE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The ability of modeling the other agents, such as understanding their intentions and skills, is essential to an agent’s interactions with other agents. Conventional agent modeling relies on passive observation from demonstrations. In this work, we propose an interactive agent modeling scheme enabled by encouraging an agent to learn to probe. In particular, the probing agent (i.e., a learner) learns to interact with the environment and with a target agent (i.e., a demonstrator) to maximize the change in the observed behaviors of that agent. Through probing, rich behaviors can be observed and are used for enhancing the agent modeling to learn a more accurate mind model of the target agent. Our framework consists of two learning processes: i) imitation learning for an approximated agent model and ii) pure curiosity-driven reinforcement learning for an efficient probing policy to discover new behaviors that otherwise can not be observed. We have validated our approach in four different tasks. The experimental results suggest that the agent model learned by our approach i) generalizes better in novel scenarios than the ones learned by passive observation, random probing, and other curiositydriven approaches do, and ii) can be used for enhancing performance in multiple applications including distilling optimal planning to a policy net, collaboration, and competition. A video demo is available at https://www.dropbox.com/ s/8mz6rd3349tso67/Probing_Demo.mov?dl $= 0$ .
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ An accurate understanding of other agents is essential to many multi-agent problems, such as collaboration, competition, and learning from an expert agent. Humans achieve this not only by passively observing others’ behaviors, but also by actively probing others including interacting with them or changing the environment and conditions so that they can understand others’ intentions, skills, and capabilities better. For instance, when working with a colleague for the first time, one may intentionally create diverse situations where the true intention and skill set of that colleague can be clearly revealed, which in turn helps improve the collaboration.
12
+
13
+ Inspired by this observation, in this work, we try to enable a probing agent (i.e., a learner) to automatically learn a good policy for probing in a way that helps it discover new behaviors of a target agent (i.e., a demonstrator) and thus learn a better model of the target agent that is generalizable to unseen environments or settings. Different from common task-oriented policy training, the learning of our probing policy is purely driven by the motivation of maximizing the knowledge about the target agent’s model. We show a simple case in Figure 1 to illustrate this idea, where the learner and the demonstrator are initially located in the upper part and the lower part of the room respectively. The true policy of the demonstrator is trying to go to the upper part by finding the shortest path. However, since the room layout is fixed, the learner may overfit the only path observed from the demonstrator. By actively creating new gaps, the learner is able to discover various paths, which will greatly improve the accuracy of the approximated model of the demonstrator.
14
+
15
+ We consider the following setting for probing-based interactive agent modeling. In an environment, there are two general types of agents: i) a demonstrator who possesses certain skills for a single task or multiple tasks, and ii) a learner who has no prior knowledge of the environment and the demonstrator’s skills. The purpose of the learner is to efficiently and thoroughly learn all of the demonstrator’s skills and goals by not only passively watching the demonstrations but also actively interacting with the environment and/or the demonstrator. This learning process entails both imitation learning (IL) for modeling the demonstrator’s skills and goals, and reinforcement learning (RL)
16
+
17
+ ![](images/3c1afb04daa88192307507702776c69b03f1854302bfa148df1e924a35747df7.jpg)
18
+ Figure 1: Illustration of our probing-based interactive agent modeling. Here, the demonstrator tries to go from the bottom-right corner to the upper part of the room. The passive learner (left) only observes one path in the fixed environment while the probing learner (right) removes a wall block to create a new gap so that the demonstrator will change its path accordingly.
19
+
20
+ for optimizing probing policy to diversify the task settings and the demonstrations to facilitate the imitation learning. Note that we assume that the demonstrator will always truthfully reveal its skills and intentions in any scenarios.
21
+
22
+ A key idea in our approach is to use task independent RL training purely driven by a curiosity reward. For this, we represent the demonstrator’s mind by i) a latent vector to encode and track an agent’s intention and belief, and ii) a policy conditioned on the latent vector and the agent’s observed state for action prediction (i.e., the agent’s skills). By introducing this latent vector, we are able to characterize an agent’s policy by a low dimensional representation, and to reflect the change of policy by the change of this latent vector. Since the goal of probing policy is to cause the demonstrator to change its policy so that the learner may observe diverse demonstrations, it is natural to apply the change in the latent mind representation as the curiosity-driven incentive for the learner.
23
+
24
+ We evaluate our approach on four tasks in different domains (grid worlds and algorithmic problems). The experimental results indicate that our probing-based interactive agent modeling framework can: i) efficiently model the demonstrator’s mind that is generalizable in unseen scenarios, and ii) can be applied to several applications including distilling optimal plans to a policy net by automatically diversifying task settings, and improving multi-agent collaboration as well as competition using the learned agent model.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ In multi-agent reinforcement learning (MARL), agent modeling or opponent modeling plays an essential role as the ability of understanding other agent’s goals and predicting their actions can greatly facilitate both collaborative and competitive purposes (Busoniu et al., 2008; Albrecht & Stone, 2018). Previous work has attempted to achieve this by task-oriented learning for maximizing a specified collaborative or competitive reward in the given tasks. For instance, inspired by game theory, there have been approaches aiming at finding Nash equilibira in multi-agent games, where agents’ models are represented by their utilities (Littman, 1994; Hu & Wellman, 2003) and strategies (Claus & Boutilier, 1998; Tesauro, 2004; Powers & Shoham, 2005; Heinrich et al., 2015; Heinrich & Silver, 2016; Lanctot et al., 2017). Recently, some deep RL methods have incorporated simple agent modeling into Q-learning (Lowe et al., 2017) or policy updates (Foerster et al., 2018). Auxiliary tasks like explicitly predicting other agents’ goals have also been applied to MARL (Mordatch & Abbeel, 2018). In previous work, the agents’ incentive of modeling other agents comes from reaching a common goal or conflicting goals. In contrast, we never define a task-specific reward for the learner since the goal of our probing-based interactive agent modeling is not to reach a predefined goal but rather to learn a good mind model of the demonstrator which can be generalized to unseen settings and transferred to multi-agent tasks afterwards when a task-dependent reward is given.
29
+
30
+ Our work is greatly inspired by Theory of Mind (ToM) (Premack & Woodruff, 1978), which is a general and powerful framework to model an agent’s mind and use the mind model to better explain or predict the agent’s behaviors. Baker et al. (2009) has proposed a Bayesian formulation to incorporate an agent’s desires, intentions, and belief about the world into the agent’s policy in order to predict the agent’s goals and actions via inverse planning. Rabinowitz et al. (2018) adopts a simpler mind representation (i.e., a latent vector) learned by a neural net (ToMnet). In our work, the learner is also trying to learn the policy of the demonstrator with a simple mind modeling. However, instead of only serving as a passive observer, we encourage the learner to probe so that it will learn to interact with the environment and with the demonstrator to quickly and continuously discover new behaviors of the demonstrator, which in turn helps learning a better mind model.
31
+
32
+ ![](images/84aa49337f3c7c08fcf23511a43c0078a3fcfdc51c45b78d41146d298740de5e.jpg)
33
+ Figure 2: An overview of our model. Architecture details are in Appendix C. Note that the modules do not share weights, and the dashed line indicates that it is a feed forward only path (no back propagation through this path to update the mind model).
34
+
35
+ Our task-independent reward is related to the curiosity-driven reward applied to an RL agent for encouraging exploration (Strehl & Littman, 2008; Bellemare et al., 2016; Tang et al., 2017; Pathak et al., 2017). Our probing framework differs from this in two ways: i) instead of exploring the world states, we encourage the learner to discover new behaviors of the demonstrator to learn a better model of its mind; ii) the curiosity-driven rewards in previous work only serve as auxiliary rewards for achieving specific goals, whereas in our case, the sole motivation of our learner agent is from curiosity, and we demonstrate that this type of pure curiosity-driven learning can actually yield rich behaviors and general agent modeling.
36
+
37
+ There is certain similarity between active learning and our learning to prob mechanism. As Yang & Shafto (2017) shows, active learning is more effective than optimal teaching when the learner and teacher are not conceptually aligned, which is exactly the scenario in our problem setting (the learner does do not share any conceptual common ground with the demonstrator at the beginning). However, active learning typically addresses problems such as classification (Tong & Koller, 2001; Kapoor et al., 2007) by generating queries to an oracle to get additional ground-truth supervision. There are have been work on active imitation learning (Shon et al., 2007; nd Geoffrey J. Gordon & Bagnell, 2011; Judah et al., 2012) and active inverse reinforcement learning (Lopes et al., 2009) utilizing the similar concept, where the learner asks quires at certain states to a human oracle for guidance on what actions to take at those states. In contrast, our work goes beyond the scope of the existing work on active learning – we aim at training a learner agent to directly interact with the environment and with the target agent in order to automatically diversify the task settings and learn a better agent model without any task-dependent training objectives so that the learned agent models can be applied to improve the learner’s performance in various applications.
38
+
39
+ Lastly, our task-independent learning objective can also be connected with meta-learning (Wang et al., 2016; Finn et al., 2017), which is to learn a meta strategy that can conduct efficient multi-task learning (Maclaurin et al., 2015; Duan et al., 2017; Hariharan & Girshick, 2017; Wichrowska et al., 2017; Yu et al., 2018; Baker et al., 2017) or adapt an agent’s policy to its opponent’s policy (Al-Shedivat et al., 2018) in a competitive setting. In this work, the purpose of our task-independent learning is to learn to probe a demonstrator for a better modeling of its mind, which is different from existing meta-learning approaches.
40
+
41
+ # 3 APPROACH
42
+
43
+ # 3.1 MODEL
44
+
45
+ We assume a Markov Decision Process (MDP) framework for both the demonstrator and the learner, where their behaviors at time $t$ are denoted by a pair of state and action $( s _ { d } ^ { t } , a _ { d } ^ { t } )$ and $( s _ { l } ^ { t } , a _ { l } ^ { t } )$ respectively. The history of their behaviors upon time $t$ is represented by trajectories $\Gamma _ { d } ^ { \acute { t } } = \big \{ ( s _ { d } ^ { \tau } , a _ { d } ^ { \tau } ) : \tau = 1 , \cdot \cdot \cdot , t \big \}$ and $\Gamma _ { l } ^ { t } = \{ ( s _ { l } ^ { \tau } , a _ { l } ^ { \tau } ) : \tau = 1 , \cdot \cdot \cdot , t \}$ respectively.
46
+
47
+ Our interactive agent modeling framework is illustrated in Figure 2, which consists of two parts: i) learner’s estimation of the demonstrator’s model and ii) the learner’s probing policy for a better understanding of the demonstrator’s model.
48
+
49
+ To estimate the demonstrator’s model, the learner maintains a behavior tracker, $\mathcal { M } ( \cdot )$ , to encode the observed trajectory of the demonstrator, which generates a latent vector, $m ^ { t } = \mathcal { M } ( \Gamma _ { d } ^ { t } )$ . This latent vector can be viewed as a simplified representation of the demonstrator’s mind upon time $t$ , hence the learner may use it to characterize the demonstrator’s policy, $\pi _ { d } ( a _ { d } ^ { t } \vert s _ { d } ^ { t } , m ^ { t - 1 } )$ , from which the learner may predict the demonstrator’s future action $\hat { a } _ { d } ^ { t }$ . Note that for each demonstration, $m ^ { t }$ always starts from the same constant, ${ \bf m } ^ { 0 } = { \bf 0 }$ . This particular definition of the demonstrator’s policy may also be connected with the option framework in hierarchical RL (Sutton et al., 1999), where the behavior tracker serves as a global policy to update the temporal abstraction $m ^ { t }$ and consequently changes the local policy $\pi _ { d }$ .
50
+
51
+ In this work, we require a learner to interact with the environment and/or with the demonstrator instead of passively watching the demonstrations. We enable this by learning a probing policy for the learner, $\pi _ { l } ( a _ { l } ^ { t } | \dot { s _ { l } ^ { t } } , m ^ { t - 1 } )$ , where $m ^ { t - 1 }$ is from the current demonstration. The main purpose of the probing policy is to incite new behaviors of the demonstrator, thus we adopt a curiosity-driven reward to train this policy. Particularly, we define the reward function as
52
+
53
+ $$
54
+ \begin{array} { r } { r ^ { t } = R ( s _ { l } ^ { t } , m ^ { t - 1 } , a _ { l } ^ { t } , m ^ { t } ) = | | m ^ { t } - m ^ { t - 1 } | | ^ { 2 } , } \end{array}
55
+ $$
56
+
57
+ where $m ^ { t }$ is the successive output of the behavior tracker after observing $( s _ { d } ^ { t } , a _ { d } ^ { t } )$ .
58
+
59
+ Finally, based on the probing policy, the learner can perform the probing as the rollout procedure outlined in Algorithm 1 (see Appendix A).
60
+
61
+ In summary, there are four key components in our probing-based interactive agent modeling:
62
+
63
+ • A behavior tracker $\mathcal { M } ( \Gamma _ { d } ^ { t } ; \theta _ { M } )$ ;
64
+ • The approximated demonstrator’s policy $\pi _ { d } ( a _ { d } ^ { t } \vert s _ { d } ^ { t } , m ^ { t - 1 } ; \theta _ { d } )$ ;
65
+ • A probing policy for the learner $\pi _ { l } ( a _ { l } ^ { t } | s _ { l } ^ { t } , m ^ { t - 1 } ; \theta _ { l } )$ ;
66
+ • A value function for the probing policy $V ( s _ { l } ^ { t } , m ^ { t - 1 } ; \theta _ { V } )$ .
67
+
68
+ Please refer to Appendix C for the details of the network architecture.
69
+
70
+ # 3.2 LEARNING
71
+
72
+ As discussed above, we have two main learning objectives corresponding to the two parts in our model respectively: i) minimizing imitation error (i.e., cross-entropy loss for action prediction) and ii) maximizing accumulated probing reward (i.e., probing policy optimization). Consequently, our approach includes an imitation learning process for recovering demonstrator’s policy and a reinforcement learning process for optimizing the probing policy. These two processes are intertwined and influenced by each other: the IL process provides the behavior tracker guiding the probing policy while the RL process helps $\mathrm { I L }$ to observe more diverse behaviors from the demonstrator, thus enabling an interactive learning scheme. Algorithm 2 in Appendix A summarizes the overall learning approach, where $N$ is the total number of training iterations. The optimization details for the two learning processes are introduced as follows.
73
+
74
+ # 3.2.1 IMITATION LEARNING
75
+
76
+ For $\mathrm { I L }$ , we want to learn a good behavior tracker as well as the demonstrator’s policy. For this, we minimize a cross-entropy loss for predicting demonstrator’s actions:
77
+
78
+ $$
79
+ \mathcal { L } ( \theta _ { M } , \theta _ { d } ) = \mathbb { E } \left[ - \log \pi _ { d } ( a _ { d } ^ { t } | s _ { d } ^ { t } , m ^ { t - 1 } ) \right] .
80
+ $$
81
+
82
+ # 3.2.2 REINFORCEMENT LEARNING
83
+
84
+ The goal of RL is to train a good probing policy that will maximize the change of behavior and/or discover new behaviors of the demonstrator to facilitate the imitation learning. Based on the reward $\begin{array} { r } { \mathbb { E } \left[ \sum _ { \tau = 0 } ^ { \infty } \gamma ^ { \tau } r ^ { t + \tau } \right] } \end{array}$ n Eq. (, where $\gamma$ this goal is equivalent to maximizing the accumulated reward, is the discounted factor. $J ( \theta _ { l } ) =$
85
+
86
+ For the policy optimization, we use Advantage Actor-Critic (A2C) (Mnih et al., 2016) to conduct on-policy training. The policy gradient is
87
+
88
+ $$
89
+ \nabla _ { \theta _ { l } } J ( \theta _ { l } ) = \nabla _ { \theta _ { l } } \left[ \log \pi _ { l } ( a _ { l } ^ { t } | s _ { l } ^ { t } , m ^ { t - 1 } ; \theta _ { l } ) A ( s _ { l } ^ { t } , m ^ { t - 1 } , a _ { l } ^ { t } ) + \lambda \mathcal { H } ( \pi _ { l } ( \cdot | s _ { l } ^ { t } , m ^ { t - 1 } ; \theta _ { l } ) ) \right] ,
90
+ $$
91
+
92
+ where $A ( s _ { l } ^ { t } , m ^ { t - 1 } , a _ { l } ^ { t } )$ is the advantage estimation defined as $\begin{array} { r } { A ( s _ { l } ^ { t } , m ^ { t - 1 } , a _ { l } ^ { t } ) = \sum _ { \tau = 0 } ^ { \infty } \gamma ^ { \tau } r ^ { t + \tau } \ - } \end{array}$ $V ( s _ { l } ^ { t } , m ^ { t - 1 } )$ and $\mathcal { H } ( \cdot )$ is the entropy regularization weighted by the constant $\lambda = 0 . 0 1$ for encouraging exploration. The value function is updated by the following gradient:
93
+
94
+ $$
95
+ \nabla _ { \theta _ { V } } \frac { 1 } { 2 } \left( \sum _ { \tau = 0 } ^ { \infty } \gamma ^ { \tau } r ^ { t + \tau } - V ( s _ { l } ^ { t } , m ^ { t - 1 } ; \theta _ { V } ) \right) ^ { 2 } .
96
+ $$
97
+
98
+ Note that when we update the probing policy and the value function, the behavior tracker is fixed (i.e., no back propagation through the dashed path in Figure 2). Thus $\theta _ { M }$ will only be updated by the IL loss in Eq. (2). This is to ensure that the change of $\mathrm { \Sigma } _ { m } \bar { t }$ is only caused by the change in policy or in behaviors, and not by the change of the parameters of the mind model, $\theta _ { M }$ .
99
+
100
+ # 4 EXPERIMENTS
101
+
102
+ To evaluate our approach, we introduce four tasks as shown in Figure 3, including three grid world tasks (passing through obstacles, maze navigation, construction) and an algorithmic problem (sorting).
103
+
104
+ In order to test the generalization ability of the learned agent model, we adopt a strict training procedure, where only one particular environment and task design is given during training. Specially, for grid world tasks, we fix the environment layout and/or item placement in each demonstration, whereas for the sorting task, we use the exact same input array throughout the training. At testing time, we randomize the task settings to an extent to create novel environments/inputs that have never been seen during training. We provide the specific settings in Section 4.1.
105
+
106
+ We implement rule-based policies for the demonstrator i) by searching the best plan from the initial state to the goal state for the grid world tasks or ii) by the bubble sort algorithm for sorting. When there is no possible path to reach the goal (e.g., blocked by the learner), the demonstrator will stop until a viable path appears.
107
+
108
+ # 4.1 TASKS
109
+
110
+ ![](images/3b9d1a1dd367e5002b7172940644e658adf68fc36a8b0e845a272a5d536c86d3.jpg)
111
+ Figure 3: Illustration of the evaluated tasks.
112
+
113
+ Passing. In this task modified from Baker et al. (2009), the demonstrator is initially located at the bottom-right corner and is trying to pass through the closest gap to get into the upper part of the room. The demonstrator can take 5 actions including moving in four directions and stopping, whereas the learner can move in four directions, stop, and also pickup or put down a wall block. The training environment is shown in Figure 3, where the gap is always located at the left end of the wall in the middle. In testing cases, we randomly place the location of the gap and the initial position of the demonstrator.
114
+
115
+ Maze Navigation. Inspired by similar tasks in recent literature (Andreas et al., 2017), we place a few door blocks and tools (a key and a hammer) in a four-room maze, where the key can be used to open the yellow door but has no effect on the blue door, which must be broken by the hammer. The demonstrator is trying to go from the top-right room to the top-left room. The two agents share the same action space including moving in four directions, picking up an item, and putting down an item. Also, they can only carry one item at a time. In the training setting, the initial positions of both agents and the door blocks are fixed as shown in Figure 3, whereas the tools may be randomly placed at only a few locations. The rules in this environment are in fact fairly complex compared to other grid world tasks in previous work, where multiple sub-goals such as getting the tools, getting the door blocks, placing the door blocks, and walking through the doors are involved.
116
+
117
+ Construction. We adapt the stacking tasks in Shu et al. (2018) into a grid world, where the demonstrator has a latent goal invisible to the learner, which is to construct a new block by putting two blocks with a specific color combination together. Three items are present in a room and they are assigned with different colors randomly. In each episode, the demonstrator is randomly assigned with a goal (i.e., a pair of colors). It then seeks the needed blocks and puts one of them beside the other one. In order to predict the demonstrator’s actions precisely, the learner must infer the correct goal first, which requires a sophisticated and dynamic agent modeling. Both agents share the same action space as in Maze Navigation. In training, there are no obstacles in the room. To increase the difficulty of goal inference, in testing scenarios, we randomly place a few wall blocks as obstacles around the colored blocks.
118
+
119
+ Sorting. Compared to a grid world, algorithmic problems are less visually informative and entail more abstract reasoning. For this, we design a sorting task where an array with certain length is given at the beginning. In our experiments, we set the length to be 10 and restrain the size of numbers in the array to be 4 bits (i.e., from 0 to 15). The demonstrator is able to perform a bubble sort algorithm to rearrange the input array in an ascending order. Its action at each step is to select a pair of numbers to swap. For every 5 steps done by the demonstrator, the learner can select a number and flipping one of the bit of that number. Both agents can choose to do nothing for a step. During training, we only provide one constant array so that the sorting always starts from the same initial array. This is a very challenging setting as only 10 out of 16 possible numbers are present in the training example and the fixed ordering may also easily cause overfitting. For testing, we generate random arrays as inputs.
120
+
121
+ For more details about the task settings, please refer to Appendix D.
122
+
123
+ # 4.2 GENERALIZATION IN UNSEEN TASK SETTINGS
124
+
125
+ ![](images/1871cb7eec22fea8ea3cee03fbce6bab4a89e5ce0e304bc11a26ace233854a63.jpg)
126
+ Figure 4: Action prediction accuracies in novel testing settings over numbers of training iterations.
127
+
128
+ ![](images/013eb5aa25e3450135a48626efaa1b683544a12479c08644269d9f5f88ec7693.jpg)
129
+ Figure 5: Action prediction accuracies in novel testing settings over numbers of training iterations with $10 \%$ random actions.
130
+
131
+ One of the main goals of learning to probe is to learn a good agent model that can be generalized to unseen scenarios. To evaluate how accurate our agent model is for approximating the true mind of the demonstrator, we may test the accuracy of predicting the demonstrator’s actions using the learned $\pi _ { d }$ and behavior tracker $\mathcal { M } ( \cdot )$ in testing task settings unseen by the learner during training. A high
132
+
133
+ prediction accuracy in unseen settings will indicate good generalization of the learned agent model.
134
+ To eliminate the effects from probing, we remove the learner from the environment during testing.
135
+
136
+ We compare our model with six baselines: i) ToMnet in Rabinowitz et al. (2018), which learns the demonstrator’s model by only observing the given demonstrations without interactions, ii) our model without training the probing policy using RL (i.e., the leaner always takes random actions), iii), ours without the attention-based fusion (concatenating state feature and $m ^ { t - 1 }$ instead), iv) using two LSTMs for the estimated demonstrator’s policy and the probing policy respectively (Figure 16), v) using count-based bonus as reward (Strehl & Littman, 2008; Bellemare et al., 2016; Tang et al., 2017), and vi) using cross-entropy loss for action prediction as reward (i.e., exploration by self-supervised prediction in Pathak et al. (2017)). To ensure fair comparison, the training settings and the testing settings are shared by all methods. We provide more details of the baselines in Appendix E.
137
+
138
+ Figure 4 shows the predication accuracy in testing settings of the three approaches based on the models from different training iterations. It is clear that with more iterations, our probing policy can greatly help increase the accuracy by discovering new behaviors, and consequently yields much higher testing accuracy than the baselines do. The results of “ours w/o fusion” and “2-LSTM” baselines further demonstrates the importance of our attention-based fusion layer and the use of a separate behavior tracker. By randomizing $10 \%$ of demonstrator’s actions (Figure 5), we show that the probing policy can also handle stochastic and sub-optimal policies. It can be clearly seen from the results that the performance of the two baselines based on different curiosity rewards is clearly inferior to ours, which demonstrates the advantage of defining the behavioral change as the intrinsic reward for the purpose of agent modeling. We have also evaluated the robustness of our approach by showing the standard deviation from multiple runs as shown in Figure 9, which demonstrates a reasonably low variance across multiple runs.
139
+
140
+ We demonstrate the effect of dimensionality of the latent vector $m ^ { t }$ (i.e., the complexity of the agent model) in Figure 4. In simple environments, our approach still outperforms the baselines even when the dimensionality is decreased from 8 to 2 or 4. In more complex tasks like Sorting, a higher dimension is necessary for the agent modeling.
141
+
142
+ # 4.3 EVOLUTION OF LEARNED PROBING STRATEGY
143
+
144
+ As training progresses, we observe that our probing policy is able to progressively discover new behaviors through interactions that are adapted to the demonstrator’s policy. For instance, in Maze Navigation, we find that the learner first learns to place one door, then gradually learns to place two doors at the appropriate moments to force the demonstrator to go back and forth to get the needed tools for opening the doors. Finally, the probing policy will even blocks the demonstrator for a while before it goes through the last door. Due to the space limit, we show this in the demo video.
145
+
146
+ We also provide more analysis and visualization of the probing behavior and the resulting latent vectors in Appendix B.2 and Appendix B.3.
147
+
148
+ # 4.4 EMERGENCE OF OBSTRUCTIVE BEHAVIORS FROM PROBING
149
+
150
+ Although we never explicitly set an adversarial goal for the learner, we do observe a natural emergence of obstructive behaviors caused by the probing, which can be quantitatively measured by the success rate of the demonstrator within a time limit as shown in Figure 6. This phenomenon is aligned with common sense that the optimal probing policy to discover new behaviors of the demonstrator should constantly force the demonstrator to change its plan, which will eventually delay the time when the demonstrator finishes the task. Because of the reward defined in Eq. (1), the probing policy learned from RL is also maximizing the accumulated behavioral change of the demonstrator just like the common sense. This further justifies our simple yet effective reward design.
151
+
152
+ ![](images/f79f849d4628693a408ffe9f369a47a5064b5907c7894cb647ef97d04aad2d23.jpg)
153
+ Figure 6: The average success rate of the demonstrator within the given time limit.
154
+
155
+ ![](images/22c56a09143e8dc063fbd0fed96feb71578073b1b84e64124f4c3a82addce74e.jpg)
156
+ Figure 7: The learning curves of the collaborative task (reward is rescaled).
157
+
158
+ ![](images/b2076ef0ebd4994b1be4f0abf9861f2baf22ffd6fcc9e875892dea55ad60f109.jpg)
159
+ Figure 8: The learning curves of the competitive task (reward is rescaled).
160
+
161
+ 4.5 APPLICATION 1: DISTILLING OPTIMAL PLANS TO A POLICY NET
162
+
163
+ Table 1: Success rates using the learned demonstrator’s policy in unseen tasking settings. Unless specified, the evaluated policies were learned from demonstrations without random actions.
164
+
165
+ <table><tr><td>Method</td><td>Passing</td><td>Maze Navigation</td><td>Construction</td><td>Sorting</td></tr><tr><td>Ours</td><td>0.71</td><td>0.60</td><td>0.48</td><td>0.82</td></tr><tr><td>Ours (from sub-optimal demo)</td><td>0.68</td><td>0.51</td><td>0.47</td><td>N/A</td></tr><tr><td>Ours w/o RL</td><td>0.13</td><td>0.31</td><td>0.23</td><td>0.80</td></tr><tr><td>Ours w/o fusion</td><td>0.11</td><td>0.19</td><td>0.29</td><td>0.10</td></tr><tr><td>Ours (2-LSTM)</td><td>0.17</td><td>0.02</td><td>0.17</td><td>0</td></tr><tr><td>Passive (ToMnet)</td><td>0.11</td><td>0</td><td>0.12</td><td>0</td></tr><tr><td>Count-based</td><td>0.22</td><td>0</td><td>0.31</td><td>0.39</td></tr><tr><td>Self-supervised</td><td>0.23</td><td>0</td><td>0.36</td><td>0.56</td></tr></table>
166
+
167
+ Optimal planning sometimes requires a long computational time. For acceleration, it is common to distill the optimal plans to a policy net (Lazaric et al., 2010; Guo et al., 2014). However, the distilled policy net may not generalize well in new scenarios if the training settings are not diverse enough. Thus, the nature of our approach makes it suitable for improving the generalization without manually designing a large number of diverse settings.
168
+
169
+ For this, we evaluate the success rates when the learner directly uses $\pi _ { d }$ (with an 8-dim latent vector) to perform tasks in testing settings without finetuning. The results summarized in Table 1 are consistent with the findings based on action predictions. We have also tested the success rate of the policy learned from sub-optimal demonstrations with $10 \%$ random actions. Its performance is comparable to the one learned from perfect demonstrations by our approach. It also outperforms the baselines trained from optimal demonstrations. We didn’t test the randomized demonstrations for Sorting as it is unnecessary to randomize bubble sort algorithm. Note that since the learner is unaware of the goal in Construction, we let the learner take over the task after the first block has been picked up.
170
+
171
+ # 4.6 APPLICATION 2: COLLABORATION
172
+
173
+ To test whether the improved agent modeling by learning a probing policy can facilitate multi-agent collaboration, we modify the Construction task to be a collaborative task, where the learner is trying to help the demonstrator (fixed policy) to finish the task. For every step the demonstrator takes, the learner will get a $- 0 . 0 5$ penalty. When the goal is reached, it will be given a reward of 1. This setting is difficult for training a collaborative policy since the demonstrator is capable of finishing the task by itself. In order to help finish the task faster, the learner must infer the true goal of the demonstrator quickly and shares part of the labor accordingly.
174
+
175
+ We fix the behavior tracker module, $\mathcal { M } ( \cdot )$ , trained from our interactive agent modeling and retrain the learner’s policy $\pi _ { l }$ using the task reward defined above. For comparison, we implement two baselines: i) retraining $\pi _ { l }$ based on $\mathcal { M }$ learned from passive agent modeling (i.e., ToMnet) and ii) training a policy without agent modeling, i.e., $\pi _ { l } ( a _ { l } ^ { t } | s _ { l } ^ { t } , s _ { d } ^ { t } )$ .
176
+
177
+ Figure 7 demonstrates the learning curves, where the reward is rescaled so that the theoretical maximum reward from a perfect policy is 1. From the curves, we may see that the policy trained with our interactively learned agent model significantly outperforms both baselines.
178
+
179
+ # 4.7 APPLICATION 3: COMPETITION
180
+
181
+ Similar to Section 4.6, we design a competitive task based on the Construction task, where the learner gets a 0.05 reward for every step and a -1.0 penalty if the opponent achieves its goal. We adopt the same training procedure as in Section 4.6, and also rescale the reward according to the maximum reward. As Figure 8 shows, the mind model learned by our approach improves the learning efficiency and the converged reward by a large margin.
182
+
183
+ # 5 CONCLUSIONS
184
+
185
+ In this work, we have proposed a novel agent modeling approach, i.e., probing-based interactive agent modeling. The core idea is to learn a probing policy using only a curiosity-driven reward, which is able to discover new behaviors of the target agent. We achieve this by incorporating two learning processes $\mathrm { I L }$ and RL) together. We are able to validate our approach in four distinct tasks. The results show that by learning a probing policy, the learner in our approach can build a more accurate agent model of the demonstrator. Thanks to this interactively learned agent model, the learner is able to i) approximate the demonstrator’s policy more accurately in unseen settings compared to passive agent modeling, ii) efficiently learn a good collaborative policy to help the demonstrator, and iii) develop an adversarial policy to compete with the demonstrator.
186
+
187
+ In the future, we can extend this framework to simultaneous agent modeling and world modeling with a more complex mind representation.
188
+
189
+ # REFERENCES
190
+
191
+ Maruan Al-Shedivat, Trapit Bansal, Yuri Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. In The Sixth International Conference on Learning Representations (ICLR), 2018.
192
+ Stefano V Albrecht and Peter Stone. Autonomous agents modelling other agents: A comprehensive survey and open problems. Artificial Intelligence, (258):66–95, 2018.
193
+ Jacob Andreas, Dan Klein, and Sergey Levine. Modular multitask reinforcement learning with policy sketches. In International Conference on Machine Learning (ICML), 2017.
194
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. In The Fifth International Conference on Learning Representations (ICLR), 2017.
195
+ Chris L Baker, Rebecca Saxe, and Joshua B Tenenbaum. Action understanding as inverse planning. Cognition, 113(3):329–349, 2009.
196
+ Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems (NIPS), pp. 1471–1479, 2016.
197
+ Lucian Busoniu, Robert Babuska, and Bart De Schutter. A comprehensive survey of multiagent reinforcement learning. IEEE Trans. Systems, Man, and Cybernetics, Part C, 38(2):156–172, 2008.
198
+ 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.0723, 2017.
199
+ Caroline Claus and Craig Boutilier. The dynamics of reinforcement learning in cooperative multiagent systems. The Fifteenth National Conference on Artificial Intelligence (AAAI), 1998:746–752, 1998.
200
+ 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 (NIPS), pp. 1087–1098, 2017.
201
+
202
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning (ICML), 2017.
203
+
204
+ Jakob N Foerster, Richard Y Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. In The 17th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), 2018.
205
+
206
+ Xiaoxiao Guo, Satinder P. Singh, Honglak Lee, Richard L. Lewis, and Xiaoshi Wang. Deep learning for realtime atari game play using offline monte-carlo tree search planning. In Advances in Neural Information Processing Systems (NIPS), 2014.
207
+
208
+ Bharath Hariharan and Ross Girshick. Low-shot visual recognition by shrinking and hallucinating features. In IEEE International Conference on Computer Vision (ICCV), 2017.
209
+
210
+ Johannes Heinrich and David Silver. Deep reinforcement learning from self-play in imperfectinformation games. arXiv preprint arXiv:1603.01121, 2016.
211
+
212
+ Johannes Heinrich, Marc Lanctot, and David Silver. Fictitious self-play in extensive-form games. In International Conference on Machine Learning (ICML), pp. 805–813, 2015.
213
+
214
+ Junling Hu and Michael P Wellman. Nash q-learning for general-sum stochastic games. In The 15th International Conference on Machine Learning (ICML), pp. 242–250, 2003.
215
+
216
+ Kshitij Judah, Alan Fern, and Thomas G. Dietterich. Active imitation learning via reduction to i.i.d. active learning. In The Conference on Uncertainty in Artificial Intelligence (UAI), 2012.
217
+
218
+ Ashish Kapoor, Kristen Grauman, Raquel Urtasun, and Trevor Darrell. Active learning with gaussian processes for object categorization. In International Conference on Computer Vision (ICCV), 2007.
219
+
220
+ Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Julien Perolat, David Silver, Thore Graepel, et al. A unified game-theoretic approach to multiagent reinforcement learning. In Advances in Neural Information Processing Systems (NIPS), pp. 4193–4206, 2017.
221
+
222
+ Alessandro Lazaric, Mohammad Ghavamzadeh, and Remi Munos. Analysis of a classification-based policy iteration algorithm. In International Conference on Machine Learning (ICML), 2010.
223
+
224
+ Michael L Littman. Markov games as a framework for multi-agent reinforcement learning. In The 11th International Conference on Machine Learning (ICML), pp. 157–163, 1994.
225
+
226
+ Manuel Lopes, Francisco Melo, and Luis Montesano. Active learning for reward estimation in inverse reinforcement learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, 2009.
227
+
228
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. In Advances in Neural Information Processing Systems (NIPS, 2017.
229
+
230
+ Dougal Maclaurin, David Duvenaud, and Ryan P. Adams. Gradient-based hyperparameter optimization through reversible learning. In International Conference on Machine Learning (ICML), 2015.
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 International Conference on Machine Learning (ICML), 2016.
233
+
234
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. In The Thirty-Second AAAI Conference on Artificial Intelligence (AAAI), 2018.
235
+
236
+ Stephane Ross nd Geoffrey J. Gordon and J. Andrew Bagnell. A reduction of imitation learning ´ and structured prediction to no-regret online learning. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2011.
237
+
238
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In International Conference on Machine Learning (ICML), 2017.
239
+
240
+ Rob Powers and Yoav Shoham. New criteria and a new algorithm for learning in multi-agent systems. In Advances in neural information processing systems (NIPS), pp. 1089–1096, 2005.
241
+
242
+ David Premack and Guy Woodruff. Does the chimpanzee have a theory of mind? Behavioral and brain sciences, 1(4):515–526, 1978.
243
+
244
+ Neil C. Rabinowitz, Frank Perbet, H. Francis Song, Chiyuan Zhang, S.M. Ali Eslami, and Matthew Botvinick. Machine theory of mind. arXiv preprint arXiv:1802.07740, 2018.
245
+
246
+ Aaron P. Shon, Deepak Verma, and Rajesh PN Rao. Active imitation learning. In The AAAI Conference on Artificial Intelligence (AAAI), 2007.
247
+
248
+ Tianmin Shu, Caiming Xiong, and Richard Socher. Hierarchical and interpretable skill acquisition in multi-task reinforcement learning. In The Sixth International Conference on Learning Representations (ICLR), 2018.
249
+
250
+ A. L. Strehl and M. L. Littman. An analysis of model-based interval estimation for markov decision processes. Journal of Computer and System Sciences, 74(8):1309–1331, 2008.
251
+
252
+ Richard S Sutton, Doina Precup, and Satinder Singh. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 112(1-2):181–211, 1999.
253
+
254
+ Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. #exploration: A study of count-based exploration for deep reinforcement learning. In 31st Conference on Neural Information Processing Systems (NIPS), 2017.
255
+
256
+ Gerald Tesauro. Extending q-learning to general adaptive multi-agent systems. In Advances in neural information processing systems (NIPS), pp. 871–878, 2004.
257
+
258
+ Tijmen Tieleman and Geoffrey Hinto. Lecture 6.5—rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
259
+
260
+ Simon Tong and Daphne Koller. Support vector machine active learning with applications to text classification. Journal of Machine Learning Research, pp. 45–66, 2001.
261
+
262
+ Jane X Wang, Zeb Kurth-Nelson, Dhruva Tirumala, Hubert Soyer, Joel Z Leibo, Remi Munos, Charles Blundell, Dharshan Kumaran, and Matt Botvinick. Learning to reinforcement learn. arXiv preprint arXiv:1611.05763, 2016.
263
+
264
+ 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. arXiv preprint arXiv:1703.04813, 2017.
265
+
266
+ Scott Cheng-Hsin Yang and Patrick Shafto. Teaching versus active learning: A computational analysis of conditions that affect learning. In The AAAI Conference on Artificial Intelligence (AAAI), 2017.
267
+
268
+ Tianhe Yu, Chelsea Finn, Annie Xie, Sudeep Dasari, Pieter Abbeel, and Sergey Levine. One-shot imitation from observing humans via domain-adaptive meta-learning. In Robotics: Science and Systems (RSS), 2018.
269
+
270
+ # A PSEUDO CODE OF OUR ALGORITHMS
271
+
272
+ # Algorithm 1 Rollout $ { T _ { \mathrm { m a x } } } )$
273
+
274
+ Input: Maximum steps $T _ { \mathrm { m a x } }$
275
+ Output: Episode length $T$ , trajectories $\Gamma _ { d } ^ { T }$ and $\Gamma _ { l } ^ { T }$ , and the latent vector sequence $M$
276
+ 1: Initialize the environment
277
+ 2: $\Gamma _ { d } ^ { 0 } \gets \emptyset , \Gamma _ { l } ^ { 0 } \gets \emptyset , M \gets \emptyset , m ^ { 0 } \gets \mathbf { 0 } , t \gets 0$
278
+ 3: repeat
279
+ 4: $t \gets t + 1$
280
+ 5: Observe $s _ { d } ^ { t }$ and $a _ { d } ^ { t }$ from the demonstrator
281
+ 6: Observe $s _ { l } ^ { t }$ from the environment
282
+ 7: Sample and execute the learner’s action $a _ { l } ^ { t } \sim \pi _ { l } ( s _ { l } ^ { t } , m ^ { t - 1 } )$
283
+ 8: $\Gamma _ { d } ^ { t } \Gamma _ { d } ^ { t - 1 } \cup \{ ( s _ { d } ^ { t } , a _ { d } ^ { t } ) \} , \Gamma _ { l } ^ { t } \Gamma _ { l } ^ { t - 1 } \cup \{ ( s _ { l } ^ { t } , a _ { l } ^ { t } ) \}$
284
+ 9: $m ^ { t } \gets \mathcal { M } ( \Gamma _ { d } ^ { t } ) , M \gets M \cup \{ m ^ { t } \}$
285
+
286
+ # Algorithm 2 Learning Algorithm
287
+
288
+ 1: Initialize parameters $\Theta = \left. \theta _ { M } , \theta _ { b } , \theta _ { l } , \theta _ { V } \right.$
289
+ 2: Set $T _ { \mathrm { m a x } }$ (the maximum steps in an episode) and $N$ (the number of training iterations)
290
+ 3: $i \gets 1$
291
+ 4: repeat
292
+ 5: $T , \Gamma _ { d } ^ { T } , \Gamma _ { l } ^ { T } , M \gets \mathrm { R o l l o u t } ( T _ { \mathrm { m a x } } )$
293
+ 6: IL: Update $\theta _ { M }$ and $\theta _ { d }$ based on Eq. (2) using $\Gamma _ { d } ^ { T }$
294
+ 7: RL: Update $\theta _ { l }$ and $\theta _ { V }$ based on Eq. (3 and Eq. (4) respectively using $\Gamma _ { l } ^ { T }$ , and $M$
295
+ 8: $i \gets i + 1$
296
+ 9: until $i = N$
297
+
298
+ # B MORE RESULTS
299
+
300
+ # B.1 ROBUSTNESS EVALUATION
301
+
302
+ We show the mean and standard deviation of the prediction accuracy from 5 runs by our full model in Figure 9 for Maze Navigation to validate the robustness of our approach.
303
+
304
+ ![](images/d3766e4783ca2f1226bf81c173ed6690f9a07ff438e980d834c86b081f958f61.jpg)
305
+ 10: until $t = T _ { \operatorname* { m a x } }$ or the task is finished 11: $T \gets t$
306
+ Figure 9: Mean and standard deviation of multiple runs in Maze Navigation.
307
+
308
+ # B.2 VISUALIZATION OF LATENT VECTORS
309
+
310
+ Figure 10 visualizes the latent vectors obtained from demonstrations with probing and without probing, where the latent vectors were computed by the same behavior tracker in both cases. This provides empirical evidences that by finding new latent vectors, we are able to discover new demonstrations with probing.
311
+
312
+ # B.3 VISUALIZATION OF THE CHANGE IN $m ^ { t }$ AND THE CHANGE IN POLICY
313
+
314
+ To show that the change in $m ^ { t }$ indeed indicates the change in policy, we compute the correlation of $| | m ^ { t } - m ^ { t - 1 } | | ^ { 2 }$ and $\tilde { K L } ( \pi _ { d } ( \cdot | s ^ { t + 1 } , m ^ { t } ) | | \pi _ { d } ( \cdot | s ^ { t + 1 } , m ^ { t - 1 } ) )$ (i.e., how different the policy conditioned on the new latent vector $m ^ { t }$ is compared to the one with the old latent vector $m ^ { t - 1 }$ ). Figure 11 demonstrates the correlation between the change in $m ^ { t }$ and the corresponding change in policy in testing settings. The high correlation validates our hypothesis that the distance between consecutive latent vectors $m ^ { t }$ and $\bar { m } ^ { t - 1 }$ reflects the policy change of the demonstrator.
315
+
316
+ ![](images/f82b7a583fb0ccf3c5a6ef501adc2d8413d68eb07d6414f87e572db80aaacff7.jpg)
317
+ Figure 10: t-SNE embedding of $m ^ { t }$ .
318
+
319
+ ![](images/069435882d499904bb6f9b71b6a7dc219cc94a8b05cbac2d28d7728bc6f34cb1.jpg)
320
+ Figure 11: Correlation between the change in $m ^ { t }$ and the change in policy in testing settings $\dot { \boldsymbol { r } }$ is Pearson correlation coefficient).
321
+
322
+ # C NETWORK ARCHITECTURE OF OUR MODEL
323
+
324
+ State Encoder. The input of the state encoder is a multi-channel tensor. For the grid world case, the input dimension is $1 1 \bar { \times } 1 1 \times ( N _ { \mathrm { b l o c k s } } + 1 )$ , where $1 1 \times 1 1$ is the size of the grid world, $N _ { \mathrm { i t e m s } }$ is the number of types of blocks, and the additional channel is to show the position of the corresponding agent, i.e., the position of the demonstrator for $s _ { d } ^ { t }$ or the position of the learner for $s _ { l } ^ { t }$ . The other agent is treated as an obstacle and its position is encoded into the channel corresponded to the wall block. In the case of Sorting task, the input dimension is $1 0 \times 1 \times 4$ , representing 10 numbers in an array where the size of each number is 4 bits. The state encoder has one convolutional layer which consists of 32 filters with kernel size of $1 \times 1$ and stride of 1.
325
+
326
+ Behavior Tracker. Assuming the action space is $A$ , we combine the state input and the action input by augmenting the state input with $A$ channels, each of which corresponds to an action. We set the channel of the observed action to be all ones and set the remaining $A - 1$ channels to be zeros. This combined state and action input is then fed into a convolutional layer with 32 filters (the kernel size is $1 \times 1$ and the stride is 1). The output is flatten into a vector and passed through two fully connected (FC) layers (all have 128 dimensions). The resulting 128-dim vector serves as the input of an LSTM with 128 hidden units. Finally, an FC layer takes in the hidden state from the LSTM and outputs the latent vector $m ^ { t }$ as the mind representation.
327
+
328
+ ![](images/9601707c6b27d9000ede144af1654db03552ded43028f6a05face04cd1b1a543.jpg)
329
+ Figure 12: The attention-based fusion module.
330
+
331
+ Fusion. As shown in Figure 12, we design our fusion module using an attention based mechanism similar to the one introduced by Chaplot et al. (2017), where the latent vector $m ^ { t - 1 }$ is fed into an FC layer outputting an $N$ -dim attention vector (each element is from 0 to 1) corresponding to the $N$ feature maps from the state encoder (here $N = 3 2$ ). Formally, we have an attention vector $h = \sigma ( m ^ { t - 1 } ) \in \dot { \mathbb { R } } ^ { 3 2 }$ , where $\sigma ( \cdot )$ is an FC layer with sigmoid activation. $h$ is spatially expanded to a $H \times W \times 3 2$ tensor, $\pmb { H } ( h ) \in \mathbb { R } ^ { H \times W \times 3 2 }$ , where the elements in $k$ -th channel correspond to the $k$ -th element in $h$ . We then reweight each feature maps using the attention vector, which becomes the fusion output. I.e., $f ( \phi ( s ^ { t } ) , m ^ { t - \tilde { 1 } } ) = \phi ( s ^ { t } ) \odot H ( \sigma \tilde { ( } m ^ { t - 1 } ) \mathbf { \tilde { ) } }$ , where $\phi ( s ^ { t } )$ are the feature maps from the state encoder, $f ( \cdot )$ is the fusion layer, and $\odot$ is element-wise product.
332
+
333
+ Policy. The input of this module is the flattened output from the fusion module, and is fed to an LSTM with 128 hidden units followed by an FC layer with softmax activation. The resulting output is an action distribution representing the policy (either $\pi _ { d }$ or $\pi _ { l }$ ). For Sorting task, we slightly modify the output to fit the problem. We decompose the demonstrator’s policy as ${ \pi } _ { d } ( a _ { d } ^ { t } \vert s _ { d } ^ { t } , m ^ { t - 1 } ) ~ = ~ { \pi } _ { d } ^ { ( 1 ) } ( a _ { d } ^ { \bar { t } , 1 } \vert s _ { d } ^ { t } , m ^ { t - 1 } ) { \pi } _ { d } ^ { ( 2 ) } ( a _ { d } ^ { t , 2 } \vert s _ { d } ^ { t } , m ^ { t - 1 } )$ , where $a _ { d } ^ { t , 1 }$ and $a _ { d } ^ { t , 2 }$ are the indices of the numbers the demonstrator chooses to swap. For the learner’s policy, it is decomposed as $\pi _ { l } ( a _ { l } ^ { t } | s _ { l } ^ { t } , m ^ { t - 1 } ) = \pi _ { l } ^ { \mathrm { i d } } ( a _ { l } ^ { t , 1 } | s _ { l } ^ { t } , m ^ { t - 1 } ) \pi _ { l } ^ { \mathrm { b i t } } ( a _ { l } ^ { t , 2 } | s _ { l } ^ { t } , m ^ { t - 1 } )$ instead, where $a _ { l } ^ { t , 1 }$ indicates the number that the learner selects to change and $a _ { l } ^ { t , 2 }$ is the bit of that number that needs to be flipped. When $a _ { d } ^ { t , 1 }$ or $a _ { l } ^ { t , 1 }$ is larger than the length of the array, it means that the demonstrator or the learner is choosing to do nothing respectively.
334
+
335
+ Value. We also have a value net designed for training the learner’s policy using A2C (i.e., $V ( s _ { l } ^ { t } , m ^ { t - 1 } ) )$ , which takes in the hidden state from the LSTM in the learner’s policy module and outputs a scalar value after an FC layer.
336
+
337
+ The network is trained with RMSProp (Tieleman & Hinto, 2012) using a learning rate of 0.001.
338
+ During training, $\epsilon$ -greedy is applied to the rollout, where the $\epsilon$ gradually decreases from 0.1 to 0.01.
339
+
340
+ # D TASK SETTINGS
341
+
342
+ We assume full observations of the world state for both agents in all tasks but the internal state of an agent (e.g., goals) is unobservable to another agent. The discounted factor is set to be $\Gamma = 0 . 9 5$ .
343
+
344
+ For the demonstrator in the grid world tasks, we implemented search based path planning and used simple heuristics to perform branch and bound for acceleration. In particular, the state for the search algorithm in Passing is the map status, whereas the state in Maze Navigation and Construction is the combination of map status and the demonstrator’s inventory.
345
+
346
+ # D.1 PASSING
347
+
348
+ ![](images/104fb1162f260d597db6e2b8b643e42e84d9eb60187fab5116d2e2aba9e01f85.jpg)
349
+ Figure 13: The training setting and examples of testing settings for Passing.
350
+
351
+ Figure 13 shows the training setting where the locations of the gap and the staring point of the demonstrator are fixed, and the examples of testing settings where the placement of the gap and the initial position of the demonstrator is randomized. We terminate a training episode if the demonstrator has not passed the obstacle after 15 steps.
352
+
353
+ # D.2 MAZE NAVIGATION
354
+
355
+ The training setting in Maze Navigation is designed as shown in Figure 14a, where the placement of the tools is restrained in the purple region, and the positions of the demonstrator’s starting point and the doors are fixed. For testing, we randomly put one or two doors to fill the gaps; the demonstrator
356
+
357
+ ![](images/7e7f142e00277a702495ff544dfc962f5c601cf88c03a1f6483f2f64ce64d982.jpg)
358
+ Figure 14: The training setting and examples of testing settings for Maze Navigation.
359
+
360
+ and the tools can be randomly placed in the purple region. The demonstrator is always guaranteed to be able to find a path from its starting point to the destination (the top-left room). A training episode has a time limit of 60 steps.
361
+
362
+ # D.3 CONSTRUCTION
363
+
364
+ ![](images/16b7b3aa92dee0ccd1525db6154d8b34c50807af6f08c7694f6469a3309c6d55.jpg)
365
+ Figure 15: The training setting and examples of testing settings for Construction.
366
+
367
+ The room layout in training setting is fixed and shown in Figure 15a. In testing settings, we randomly put six wall blocks around the three colored blocks to create obstacles. Figure 15b displays a few examples of testing scenarios. Note that in both training and testing, we allow randomized coloring as long as the goal can be achieved.
368
+
369
+ For each episode, we assign a random goal (a pair of colors) for the demonstrator. The maximum episode length is 30 steps during training.
370
+
371
+ # D.4 SORTING
372
+
373
+ # Algorithm 3 Modified Bubble Sort
374
+
375
+ Input: Initial array $X = [ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { n } ]$ , where $_ n$ is the length.
376
+ Output: Sorted array
377
+ 1: Last position $i \gets 0$
378
+ 2: Steps $t \gets 0$
379
+ 3: while $X$ is not in an ascending order do
380
+ 4: $c \gets 0$
381
+ 5: while $c < n - 1$ do
382
+ 6: if $x _ { i } > x _ { i + 1 }$ then
383
+ 7: Swap $x _ { i }$ and $x _ { i + 1 }$ , i.e., the demonstrator’s $t$ -th action is $( i , i + 1 )$
384
+ 8: $t \gets \bar { t } + 1$
385
+ 9: break
386
+ 10: end if
387
+ 11: $\begin{array} { l } { c c + 1 } \\ { i ( i + 1 ) \% ( n - 1 ) } \end{array}$
388
+ 12:
389
+ 13: end while
390
+ 14: end while
391
+
392
+ In training, there is only one sequence as the initial state, i.e., [2, 0, 5, 12, 14, 10, 3, 11, 9, 7]. The testing settings include 100 randomly generated initial sequences. Training episodes have a 30-step time limit.
393
+
394
+ Since the learner may change certain numbers during the process of sorting, the original bubble sort may fail to finish the sorting successfully since it will not look back at the sorted part of the array. To address this, we modify the original bubble sort algorithm so that it will continue to sort the sequence until it is in an ascending order. Algorithm 3 outlines how the demonstrator swaps the numbers.
395
+
396
+ # E DETAILS OF BASELINES
397
+
398
+ # E.1 REWARD FUNCTIONS IN BASELINES
399
+
400
+ We define the reward functions used for baselines, count-based reward and self-supervised prediction here.
401
+
402
+ # Count-based reward:
403
+
404
+ $$
405
+ r ^ { t } = R ( s _ { d } ^ { t } ) = \frac { \beta } { \sqrt { N ( s _ { d } ^ { t } ) } } ,
406
+ $$
407
+
408
+ where $\beta$ is a constant (we set $\beta = 1$ , which gives the best results in our experiments), and $N ( s _ { d } ^ { t } )$ is the counts of state visitation. In our experiments, the counting can be efficiently implemented by hashing. This reward encourages the learner to push the demonstrator to new states in order to incite new demonstrations.
409
+
410
+ # Self-supervised prediction:
411
+
412
+ $$
413
+ \begin{array} { r } { r ^ { t } = R ( s _ { d } ^ { t } , m ^ { t - 1 } , a _ { d } ^ { t } ) = - \log \pi _ { d } ( a _ { d } ^ { t } | s _ { d } ^ { t } , m ^ { t - 1 } ) , } \end{array}
414
+ $$
415
+
416
+ where $a _ { d } ^ { t }$ is the ground-truth action from the demonstrator. This reward essentially measures action prediction loss of the estimated demonstrator’s policy, which is designed to encourage the learner to find new scenarios where the previously learned demonstrator’s policy becomes less accurate.
417
+
418
+ E.2 NETWORK ARCHITECTURE OF THE 2-LSTM BASELINE
419
+
420
+ ![](images/4d94346a5d39928d4bc7f89cf3ad6b330ebd1c289bd68248bddb18577350c585.jpg)
421
+ Figure 16: The network architecture of the 2-LSTM baseline.
422
+
423
+ Figure 16 illustrates the network architecture of the 2-LSTM baseline, where two LSTMs all have 128 hidden units.
md/train/SJx9GQb0-/SJx9GQb0-.md ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING THE IMPROVED TRAINING OF WASSERSTEIN GANS: A CONSISTENCY TERM AND ITS DUAL EFFECT
2
+
3
+ Xiang $\mathbf { W e i } ^ { 1 , 2 * }$ , Boqing $\mathbf { G o n g ^ { 3 * } }$ , Zixia $\mathbf { L i u ^ { 1 } }$ , Wei $\mathbf { L } \mathbf { u } ^ { 2 }$ , Liqiang Wang1 1Department of Computer Science, University of Central Florida, Orlando, FL, USA 32816 2School of Software Engineering, Beijing Jiaotong University, Beijing, China 100044 3Tencent AI Lab, Bellevue, WA, USA 98004 yqweixiang@knights.ucf.edu, boqinggo@outlook.com zixia@knights.ucf.edu, luwei@bjtu.edu.cn, lwang@cs.ucf.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Despite being impactful on a variety of problems and applications, the generative adversarial nets (GANs) are remarkably difficult to train. This issue is formally analyzed by Arjovsky & Bottou (2017), who also propose an alternative direction to avoid the caveats in the minmax two-player training of GANs. The corresponding algorithm, called Wasserstein GAN (WGAN), hinges on the 1-Lipschitz continuity of the discriminator. In this paper, we propose a novel approach to enforcing the Lipschitz continuity in the training procedure of WGANs. Our approach seamlessly connects WGAN with one of the recent semi-supervised learning methods. As a result, it gives rise to not only better photo-realistic samples than the previous methods but also state-of-the-art semi-supervised learning results. In particular, our approach gives rise to the inception score of more than 5.0 with only 1,000 CIFAR-10 images and is the first that exceeds the accuracy of $90 \%$ on the CIFAR-10 dataset using only 4,000 labeled images, to the best of our knowledge.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ We have witnessed a great surge of interests in deep generative networks in recent years (Kingma & Welling, 2013; Goodfellow et al., 2014; Li et al., 2015). The central idea therein is to feed a random vector to a (e.g., feedforward) neural network and then take the output as the desired sample. This sampling procedure is very efficient without the need of any Markov chains.
12
+
13
+ In order to train such a deep generative network, two broad categories of methods are proposed. The first is to use stochastic variational inference (Kingma & Welling, 2013; Rezende et al., 2014; Kingma et al., 2014) to optimize the lower bound of the data likelihood. The other is to use the samples as a proxy to minimize the distribution divergence between the model and the real through a two-player game (Goodfellow et al., 2014; Salimans et al., 2016), maximum mean discrepancy (Li et al., 2015; Dziugaite et al., 2015; Li et al., 2017b), f-divergence (Nowozin et al., 2016; Nock et al., 2017), and the most recent Wasserstein distance (Arjovsky et al., 2017; Gulrajani et al., 2017).
14
+
15
+ With no doubt, the generative adversarial networks (GANs) among them (Goodfellow et al., 2014) have the biggest impact thus far on a variety of problems and applications (Radford et al., 2015; Denton et al., 2015; Im et al., 2016; Isola et al., 2016; Springenberg, 2015; Sutskever et al., 2015; Odena, 2016; Zhu et al., 2017). GANs learn the generative network (generator) by playing a twoplayer game between the generator and an auxiliary discriminator network. While the generator has no difference from other deep generative models in the sense that it translates a random vector into a desired sample, it is impossible to calculate the sample likelihood from it. Instead, the discriminator serves to evaluate the quality of the generated samples by checking how difficult it is to differentiate them from real data points.
16
+
17
+ However, it is remarkably difficult to train GANs without good heuristics (Goodfellow et al., 2014; Salimans et al., 2016; Radford et al., 2015) which may not generalize across different network architectures or application domains. The training dynamics are often unstable and the generated samples could collapse to limited modes. These issues are formally analyzed by Arjovsky & Bottou (2017), who also propose an alternative direction (Arjovsky et al., 2017) to avoid the caveats in the minmax two-player training of GANs. The corresponding algorithm, namely, Wasserstein GAN (WGAN), shows not only superior performance over GANs but also a nice correlation between the sample quality and the value function that GANs lack.
18
+
19
+ # 1.1 BACKGROUND: WGAN AND THE IMPROVED TRAINING OF WGAN
20
+
21
+ WGAN (Arjovsky et al., 2017) aims to learn the generator network $G ( z )$ , for any random vector $z \sim \mathbb { P } _ { z }$ , such that the Wasserstein distance is minimized between the resulting distribution $\mathbb { P } _ { G }$ of the generated samples $\{ G ( z ) \}$ and the real distribution $\mathbb { P } _ { r }$ underlying the observed data points $\{ { \pmb x } \}$ ; in other words, $\mathrm { m i n } _ { G } W ( \mathbb { P } _ { r } , \mathbb { P } _ { G } )$ . The Wasserstein distance $W ( \mathbb { P } _ { r } , \mathbb { P } _ { G } )$ is shown a more sensible cost function for learning the distributions supported by low-dimensional manifolds than the other popular distribution divergences and distances — for example, the Jensen-Shannon (JS) divergence implicitly employed in GANs (Goodfellow et al., 2014).
22
+
23
+ Due to the Kantorovich-Rubinstein duality (Villani, 2008) for calculating the Wasserstein distance, the value function of WGAN is then written as
24
+
25
+ $$
26
+ \operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D \in \mathcal { D } } \mathbb { E } _ { { \pmb x } \sim \mathbb { P } _ { r } } \big [ D ( { \pmb x } ) \big ] - \mathbb { E } _ { { \pmb z } \sim \mathbb { P } _ { z } } \big [ D ( G ( { \pmb z } ) ) \big ] ,
27
+ $$
28
+
29
+ where $\mathcal { D }$ is the set of 1-Lipschitz functions. Analogous to GANs, we still call $D$ the “discriminator” although it is actually a real-valued function and not a classifier at all. Arjovsky et al. (2017) specify this family of functions $\mathcal { D }$ by neural networks and then use weight clipping to enforce the Lipschitz continuity. However, as the authors note, the networks’ capacities become limited due to the weight clipping and there could be gradient vanishing problems in the training.
30
+
31
+ Improved training of WGAN. Gulrajani et al. (2017) give more concrete examples to illustrate the perils of the weight clipping and propose an alternative way of imposing the Lipschitz continuity. In particular, they introduce a gradient penalty term by noting that the differentiable discriminator $D ( \cdot )$ is 1-Lipschitz if and only if the norm of its gradients is at most 1 everywhere,
32
+
33
+ $$
34
+ G P | _ { \widehat { \pmb { x } } } : = \mathbb { E } _ { \widehat { \pmb { x } } } \Big [ \big ( \| \nabla _ { \widehat { \pmb { x } } } D ( \widehat { \pmb { x } } ) \| _ { 2 } - 1 \big ) ^ { 2 } \Big ]
35
+ $$
36
+
37
+ where $\widehat { \mathbf { x } }$ is uniformly sampled from the straight line between a pair of data points sampled from the model $\mathbb { P } _ { G }$ and the real $\mathbb { P } _ { r }$ , respectively. A similar regularization is used by Kodali et al. (2017).
38
+
39
+ Potential caveats. Unlike the weight clipping, however, by no means one can penalize everywhere using this term through a finite number of training iterations. As a result, the gradient penalty term $G P$ takes effect only upon the sampled points $\widehat { \mathbf { x } }$ , leaving significant parts of the support domain not bexamined at all. In particular, consider the observed data points and their underlying manifold that supports the real distribution $\mathbb { P } _ { r }$ . At the beginning of the training stage, the generated sample $G ( z )$ and hence $\widehat { \mathbf { x } }$ could be distant from the manifold. The Lipschitz continuity over the manifold is not benforced until the generative model $\mathbb { P } _ { G }$ becomes close enough to the real one $\mathbb { P } _ { r }$ , if it can.
40
+
41
+ # 1.2 OUR APPROACH AND CONTRIBUTIONS
42
+
43
+ In light of the above pros and cons, we propose to improve the improved training of WGAN by additionally laying the Lipschitz continuity condition over the manifold of the real data $\mathbf { \boldsymbol { x } } \sim \mathbb { P } _ { \boldsymbol { r } }$ . Moreover, instead of focusing on one particular data point at a time, we devise a regularization over a pair of data points drawn near the manifold following the most basic definition of the 1-Lipschitz continuity. In particular, we perturb each real data point $_ { \textbf { \em x } }$ twice and use a Lipschitz constant to bound the difference between the discriminator’s responses to the perturbed data points ${ \mathbf { } } x ^ { \prime } , x ^ { \prime \prime }$ .
44
+
45
+ Figure 1 illustrates our main idea. The gradient penalty $G P | _ { \widehat { \pmb { x } } }$ often fails to check the continuity of region near the real data $_ { \textbf { \em x } }$ b, around which the discriminator function can freely violate the 1- Lipschitz continuity. We alleviate this issue by explicitly checking the continuity condition using the two perturbed version ${ \mathbf { } } x ^ { \prime } , x ^ { \prime \prime }$ near any observed real data point $_ { \textbf { \em x } }$ .
46
+
47
+ In this paper, we make the following contributions. (1) We propose an alternative mechanism for enforcing the Lipschitz continuity over the family of discriminators by resorting to the basic definition of the Lipschitz continuity. It effectively improves the gradient penalty method (Gulrajani et al., 2017) and gives rise to generators with more photo-realistic samples and higher inception scores (Salimans et al., 2016). (2) Our approach is very data efficient in terms of being less prone to overfitting even for very small training sets. We do not observe obvious overfitting phenomena even when the model is trained on only 1000 images of CIFAR-10 (Krizhevsky & Hinton, 2009). (3) Our approach can be seamlessly integrated with GANs to be a competitive semi-supervised training technique (Chapelle et al., 2009) thanks to that both inject noise to the real data points.
48
+
49
+ As results, we are able to report the state-of-the-art results on the generative model with a inception score of $8 . 8 1 \pm 0 . 1 3$ on CIFAR-10, and the semi-supervised learning results of $9 . 9 8 \pm 0 . 2 1$ on CIFAR-10 using only 4,000 labeled images — especially, they are significantly better than all the existing GAN-based semi-supervised learning results, to the best of our knowledge.
50
+
51
+ ![](images/2db90a73234f20ca5dd9bd5010bdddf5b59275cab4cc2969bba65b1bfa731f59.jpg)
52
+ Figure 1: Illustration of our main idea. In addition to the gradient penalty over $\widehat { \mathbf { x } }$ , we also examine $\mathbf { x } ^ { \prime }$ and $\mathbf { x } ^ { \prime \prime }$ baround the real data point $_ { \textbf { \em x } }$ in each iteration.
53
+
54
+ # 2 APPROACH
55
+
56
+ We firstly review the definition of the Lipschitz continuity and then discuss how to use it to regularize the training of WGAN. We then arrive at an approach that can be seamlessly integrated with the semi-supervised learning method (Laine & Aila, 2016). By bringing the best of the two worlds, we report better semi-supervised learning results than both (Laine & Aila, 2016) and existing GANbased methods.
57
+
58
+ # 2.1 IMPROVING THE IMPROVED TRAINING OF WGAN
59
+
60
+ Let $d$ denote the $\ell _ { 2 }$ metric on an input space used in this paper. A discriminator $D : \mathcal { X } \mapsto \mathcal { Y }$ is Lipschitz continuous if there exists a real constant $M \geqslant 0$ such that, for all $\pmb { x } _ { 1 } , \pmb { x } _ { 2 } \in \mathcal { X }$ ,
61
+
62
+ $$
63
+ d ( D ( \pmb { x } _ { 1 } ) , D ( \pmb { x } _ { 2 } ) ) \leqslant M \cdot d ( \pmb { x } _ { 1 } , \pmb { x } _ { 2 } ) .
64
+ $$
65
+
66
+ Immediately, we can add the following soft consistency term $( C T )$ to the value function of WGAN in order to penalize the violations to the inequality in eq. (3),
67
+
68
+ $$
69
+ C T | _ { x _ { 1 } , x _ { 2 } } = \mathbb { E } _ { x _ { 1 } , x _ { 2 } } \left[ \operatorname* { m a x } \left( 0 , \frac { d ( D ( x _ { 1 } ) , D ( x _ { 2 } ) ) } { d ( x _ { 1 } , x _ { 2 } ) } - M ^ { \prime } \right) \right]
70
+ $$
71
+
72
+ Remarks. Here we face the same snag as in (Gulrajani et al., 2017), i.e., it is impractical to substitute all the possibilities of $( \pmb { x } _ { 1 } , \pmb { x } _ { 2 } )$ pairs into eq. (4). What pairs and which regions of the input set $\mathcal { X }$ should we check for eq. (4)? Arguably, it is fairly safe to limit our scope to the manifold that supports the real data distribution $\mathbb { P } _ { r }$ and its surrounding regions mainly for two reasons. First, we keep the gradient penalty term and improve it by the proposed consistency term in our overall approach. While the former enforces the continuity over the points sampled between the real and generated points, the latter complement the former by focusing on the region around the real data manifold instead. Second, the distribution of the generative model $\mathbb { P } _ { G }$ is virtually desired to be as close as possible to $\mathbb { P } _ { r }$ . We use the notation $M$ in eq. (3) and a different $M ^ { \prime }$ in eq. (4) to reflect the fact that the continuity will be checked only sparsely at finite data points in practice.
73
+
74
+ Perturbing the real data. To this end, the very first version we tried was to directly add Gaussian noise $\pmb { \delta }$ to each real data point, resulting in a pair of ${ \pmb x } + \delta _ { 1 } , { \pmb x } + \delta _ { 2 }$ , where $\mathbf { \boldsymbol { x } } \sim \mathbb { P } _ { \boldsymbol { r } }$ . However, as noted by Arjovsky et al. (2017) and Wu et al. (2016), we found that the samples from the generator become blurry due to the Gaussian noise used in the training. We have also tested the dropout noise that is applied to the input and found that the resulting MNIST samples are cut off here and there.
75
+
76
+ Algorithm 1 our proposed CT-GAN for training a generative neural net. Most of our experiments are conducted with the default values $\lambda _ { 1 } = 1 0 , \lambda _ { 2 } = 2 .$ , $N = 5$ , $\gamma = 0 . 0 0 0 2$ , $b = 6 4$ , $i t e r = 1 0 ^ { 6 }$
77
+
78
+ Require: $b$ , the batch size. $\lambda _ { 1 } , \lambda _ { 2 }$ , weights. $\gamma$ , the Learning rate. iter, number of iterations.
79
+ 1: for iter of training iterations do
80
+ 2: for $N$ of iterations do
81
+ 3: for $i = 1 , . . . , b$ do
82
+ 4: Sample real data $\mathbf { \boldsymbol { x } } \sim \mathbb { P } _ { \boldsymbol { r } }$ , random vector $z \sim \mathbb { P } _ { z }$ , and a random number $\epsilon \sim U [ 0 , 1 ]$ .
83
+ 5: $\hat { x } \overset { } { \epsilon } { \pmb x } + ( 1 - \epsilon ) G ( z )$
84
+ 6: $\begin{array} { r l } & { ~ L ^ { ( i ) } \gets \dot { D ( G ( z ) ) ^ { ' } } \dot { D ( } x ) + \lambda _ { 1 } G P | _ { \widehat { \mathbf { x } } } + \lambda _ { 2 } C T | _ { \mathbf { x } ^ { \prime } , \mathbf { x } ^ { \prime \prime } } } \\ & { \mathbf { e n d } \mathbf { f o r } } \\ & { \theta _ { d } \gets A d a m ( \nabla _ { \theta _ { d } } \frac { 1 } { b } \sum _ { i = 1 } ^ { b } L ^ { ( i ) } , \theta _ { d } , \gamma ) } \end{array}$
85
+ 7:
86
+ 8:
87
+ 9: end for
88
+ 10: Sample $b$ random vectors $\big \{ z ^ { ( i ) } \big \}$
89
+ 11: $\begin{array} { r } { \underrightarrow { \theta } _ { g } A d a m ( \nabla _ { \theta _ { g } } \frac { 1 } { b } \sum _ { i = 1 } ^ { b } - D ( G ( z ^ { ( i ) } ) ) , \theta _ { g } , \gamma ) } \end{array}$
90
+ 12: end for
91
+
92
+ The success comes after we perturb the hidden layers of the discriminator using dropout, as opposed to the input $_ { \textbf { \em x } }$ . When the dropout rate is small, the perturbed discriminator’s output can be considered as the output of the clean discriminator in response to a “virtual” data point $\mathbf { x } ^ { \prime }$ that is not far from $_ { \textbf { \em x } }$ . Thus, we denote by $D ( \pmb { x } ^ { \prime } )$ the discriminator output after applying dropout to its hidden layers. In the same manner, we find the second virtual point $\scriptstyle { \pmb x } ^ { \prime \prime }$ around $_ { \textbf { \em x } }$ by applying the (stochastic) dropout again to the hidden layers of the discriminator, and denote by $D ( \pmb { x } ^ { \prime \prime } )$ the corresponding output.
93
+
94
+ Note that, however, it becomes impossible to compute the distance $d ( { \pmb x } ^ { \prime } , { \pmb x } ^ { \prime \prime } )$ between the two virtual data points. In this work, we assume it is bounded by a constant and absorb the constant to $M ^ { \prime }$ . Accordingly, we tune $M ^ { \prime }$ in our experiments to take account of this unknown constant; the best results are obtained between $M ^ { \prime } = 0$ and $M ^ { \prime } = 0 . 2$ . For consistency, we use $M ^ { \prime } = 0$ to report all the results in this paper.
95
+
96
+ A consistency regularization. Our final consistency regularization takes the following form,
97
+
98
+ $$
99
+ C T | _ { \mathbf { x } ^ { \prime } , \mathbf { x } ^ { \prime \prime } } = \mathbb { E } _ { \mathbf { x } \sim \mathbb { P } _ { r } } \left[ \operatorname* { m a x } \left( 0 , d ( D ( \mathbf { x } ^ { \prime } ) , D ( \mathbf { x } ^ { \prime \prime } ) ) + 0 . 1 \cdot d ( D _ { - } ( \mathbf { x } ^ { \prime } ) , D _ { - } ( \mathbf { x } ^ { \prime \prime } ) ) - M ^ { \prime } \right) \right]
100
+ $$
101
+
102
+ where $D ( { \pmb x } ^ { \prime } )$ is the output of the discriminator given the input $_ { \textbf { \em x } }$ and after we apply dropout to the hidden layers of the discriminator. We envision this is equivalent to passing a “virtual” data point $\mathbf { x } ^ { \prime }$ through the clean discriminator. We find that it slightly improves the performance by further controlling the second-to-last layer $D _ { - } ( \cdot )$ of the discriminator, $i . e .$ , the $d ( D _ { - } ^ { \mathbf { \hat { \rho } } } ( { \pmb x } ^ { \prime } ) , D _ { - } ( { \pmb x } ^ { \prime \prime } ) )$ above.
103
+
104
+ This new consistent regularization $C T | _ { \pmb { x } ^ { \prime } , \pmb { x } ^ { \prime \prime } }$ enforces the Lipschitz continuity over the data manifold and its surrounding regions, effectively complementing and improving the gradient penalty $G P | _ { \widehat { \pmb { x } } }$ bused in the improved training of WGAN. Putting them together, our new objective function for updating the weigts of the discriminator is
105
+
106
+ $$
107
+ L = \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ D ( G ( z ) ) \right] - \mathbb { E } _ { \pmb { x } \sim \mathbb { P } _ { r } } \left[ D ( \pmb { x } ) \right] + \lambda _ { 1 } G P | _ { \hat { \pmb { x } } } + \lambda _ { 2 } C T | _ { \pmb { x } ^ { \prime } , \pmb { x } ^ { \prime \prime } } .
108
+ $$
109
+
110
+ Algorithm 1 shows the complete algorithm for learning a WGAN in this paper. For the hyperparameters, we borrow $\lambda _ { 1 } = 1 0$ from Gulrajani et al. (2017) and use $\lambda _ { 2 } = 2$ for all our experiments no matter on which dataset. Another hyper-parameter is $M ^ { \prime }$ in eq. (5). As stated previously, $M ^ { \prime }$ taking values between 0 and 0.2 gives rise to about the same results in our experiments.
111
+
112
+ # 2.2 A SEAMLESS CONNECTION WITH A SEMI-SUPERVISED LEARNING METHOD
113
+
114
+ In this section, we extend the WGAN to a semi-supervised learning approach by drawing insights from two related works.
115
+
116
+ • Following (Salimans et al., 2016), we modify the output layer of the discriminator such that it has $K + 1$ output neurons, where $K$ is the number of classes of interest and the $( K + 1 )$ -th neuron is reserved for contrasting the generated samples with the real data using the Wasserstein distance in the WGAN. We use a $( K + 1 )$ -way softmax as the activation function of the last layer.
117
+
118
+ ![](images/b65ca53fe23c10d4de9a1eee5825e7f0f587db7d9a1f3a42ade0843100429e27.jpg)
119
+ Figure 2: Framework for the semi-supervised training. For clarity, we have omitted the generator.
120
+
121
+ • Following (Laine & Aila, 2016), we add our consistency regularization $C T | _ { x ^ { \prime } , x ^ { \prime \prime } }$ to the objective function of the semi-supervised training, in order to take advantage of the effect of temporal ensembling.
122
+
123
+ Figure 2 shows the framework for training the discriminator, with the objective function below,
124
+
125
+ $$
126
+ \begin{array} { r l } & { L _ { \mathrm { s e m i . d i s } } = - \operatorname { \mathbb { E } } _ { \pmb { x } , \pmb { y } \sim \mathbb { P } _ { \mathrm { x y } } } \left[ \log D ( \pmb { y } | \pmb { x } ) \right] - \operatorname { \mathbb { E } } _ { \pmb { z } \sim \mathbb { P } _ { z } } \left[ \log D ( K + 1 | G ( \pmb { z } ) ) \right] } \\ & { \qquad - \operatorname { \mathbb { E } } _ { \pmb { x } \sim \mathbb { P } _ { r } } \left[ \log ( 1 - D ( K + 1 | \pmb { x } ) ) \right] + \lambda C T | _ { \pmb { x } ^ { \prime } , \pmb { x } ^ { \prime \prime } } , } \end{array}
127
+ $$
128
+
129
+ where the first three terms are the same as in (Salimans et al., 2016), while the last consistency regularization is calculated after we apply dropout to the discriminator. The last term essentially leads to a temporal self-ensembling scheme to benefit the semi-supervised learning. Please see (Laine & Aila, 2016) for more insightful discussions about it.
130
+
131
+ The generator loss matches the expected features of the generated sample and the real data points,
132
+
133
+ $$
134
+ L _ { \mathrm { s e m i . g e n } } = \| \mathbb { E } _ { z \sim \mathbb { P } _ { z } } ( D _ { - } ( G ( z ) ) - \mathbb { E } _ { { \pmb x } \sim \mathbb { P } _ { r } } ( D _ { - } ( { \pmb x } ) ) \| _ { 2 } ^ { 2 } .
135
+ $$
136
+
137
+ # 3 EXPERIMENTAL RESULTS
138
+
139
+ We conduct experiments on the prevalent MNIST (LeCun et al., 1998), and CIFAR-10 (Krizhevsky & Hinton, 2009) datasets. The code is available on https://github.com/biuyq/CT-GAN to facilitate the reproducibility of our results.
140
+
141
+ # 3.1 MNIST
142
+
143
+ The MNIST dataset provides 70,000 handwritten digits in total and 10,000 of them are often left out for the testing purpose. Following (Gulrajani et al., 2017), we use only 1,000 of them to train the WGAN for a fair comparison with it. We use all the 60,000 training examples in the semi-supervised learning experiments and reveal the labels of 100 of them (10 per class). This setup is the same as in (Rasmus et al., 2015). No data augmentation is used. Please see Appendix A for the network architectures of the generator and discriminator, respectively.
144
+
145
+ Qualitative results. Figure 3 shows the generated samples with improved training of WGAN by the gradient penalty (GP-WGAN) and ours with the consistency regularization (CT-GAN), respectively, after 50,000 generator iterations. It is clear that our approach gives rise to more realistic samples than GP-WGAN. The contrasts of our samples between the foreground and the background are in general sharper than those of GP-WGAN.
146
+
147
+ Overfitting. We find that our approach is less prone to overfitting. To demonstrate this point, we show the convergence curves of the discriminator’s value functions by GP-WGAN and our CT-GAN in Figure 4. The red curves are evaluated on the training set and the blue ones are on the test set. We can see that the results on the test set become saturated pretty early in GP-WGAN, while ours can consistently decrease the costs on both the training and the test sets. This observation also holds for the CIFAR-10 dataset (cf. Appendix E).
148
+
149
+ ![](images/8681645893db2d6f35b2e9b969262d80ba64bd7b995fdd6924754e6edc4bf18f.jpg)
150
+ Figure 3: Images generated by (a) GP-WGAN (Gulrajani et al., 2017) and (b) Our CT-GAN, respectively.
151
+
152
+ ![](images/b3fedcd75934f5d21cb397b2c5678493c20d58bf6f361902bcd6d953a888d842.jpg)
153
+ Figure 4: Convergence curves of the discriminator cost: (a) GP-WGAN and (b) Our CT-GAN.
154
+
155
+ Semi-supervised learning results. We compare our semi-supervised learning results with those of several competitive methods in Table 1. Our approach is among the best on this MNIST dataset.
156
+
157
+ # 3.2 CIFAR-10
158
+
159
+ CIFAR-10 (Krizhevsky & Hinton, 2009) contains 50,000 natural images of size $3 2 \times 3 2$ . We use it to test two networks for the generative model: a small CNN and a ResNet (cf. Appendix A for the network structures). For the former we use only 1,000 images to train the model and we use the whole training set to learn the ResNet.
160
+
161
+ Qualitative results. Figure 5 contrasts the samples we generated to those by GP-WGAN when the generator is the small CNN. Figure 7 shows the results by a larger-scale ResNet. Our results are more photo-realistic.
162
+
163
+ Additionally, we also draw the histograms of the discriminator’s weights in Figure 6 after we train it using GP-WGAN and CT-GAN, respectively. It is interesting to see that ours controls the weights within a smaller and more symmetric range $[ - 0 . 6 7 , 0 . 9 6 ]$ than the $[ - 2 . 0 0 , 1 0 . 1 2 ]$ by GP-WGAN, partially explaining why our approach is less prone to overfitting.
164
+
165
+ Table 1: Comparing our semi-supervised learning approach with state-of-the-art ones on MNIST.
166
+
167
+ <table><tr><td>Method</td><td>Test error (%)</td></tr><tr><td>Ladder (Rasmus et al., 2015)</td><td>1.06±0.37</td></tr><tr><td>VAT (Miyato et al., 2017)</td><td>1.36</td></tr><tr><td>CatGAN (Springenberg,2015)</td><td>1.39±0.28</td></tr><tr><td>Improved GAN (Salimans et al., 2016)</td><td>0.93 ± 0.065</td></tr><tr><td>Triple GAN (Li et al., 2017a)</td><td>0.91 ± 0.58</td></tr><tr><td>Our CT-GAN</td><td>0.89 ± 0.13</td></tr></table>
168
+
169
+ ![](images/aa12002406502061af7c698f3350a49fb5750013e7322ac6cab2d6c4287e124b.jpg)
170
+ Figure 5: Generated samples by (a) GP-WGAN and (b) our CT-GAN. Here the generator is a small CNN. See Figure 7 for the samples by a ResNet.
171
+
172
+ ![](images/249fc7181e82a988faf3d3e8057cd4dfd28a1b23595766db419b398a8d1059d8.jpg)
173
+ Figure 6: Histograms of the weights of the discriminators trained by (a) GP-WGAN and (b) CTGAN, respectively.
174
+
175
+ Table 2: Inception score and accuracy of different models on CIFAR-10
176
+
177
+ <table><tr><td>Method</td><td>Supervised IS</td><td>Unsupervised IS</td><td>Accuracy(%)</td></tr><tr><td>SteinGANs (Wang&amp;Liu,2016)</td><td>6.35</td><td></td><td></td></tr><tr><td>DCGANs (Radford et al., 2015)</td><td>6.58</td><td>6.16 ± 0.07</td><td></td></tr><tr><td>Improved GANs (Salimans et al., 2016)</td><td>8.09 ± 0.07</td><td>1</td><td></td></tr><tr><td>AC-GANs (Odena et al., 2016)</td><td>8.25 ± 0.07</td><td></td><td></td></tr><tr><td>GP-WGAN (Gulrajani et al., 2017)</td><td>8.42 ± 0.10</td><td>7.86± 0.07</td><td>91.85</td></tr><tr><td>SGANs (Huang et al., 2016)</td><td>8.59 ±0.12</td><td></td><td></td></tr><tr><td>ALI (Warde-Farley &amp; Bengio,2016)</td><td>1</td><td>5.34 ± 0.05</td><td></td></tr><tr><td>BEGAN (Berthelot et al., 2017)</td><td>一</td><td>5.62</td><td></td></tr><tr><td>EGAN-Ent-VI (Dai et al., 2017)</td><td></td><td>7.07 ± 0.10</td><td></td></tr><tr><td>DFM(Warde-Farley &amp; Bengio,2016)</td><td>1</td><td>7.72 ± 0.07</td><td>1</td></tr><tr><td>Our CT-GAN</td><td>8.81±0.13</td><td>8.12±0.12</td><td>95.91</td></tr></table>
178
+
179
+ Comparison of the inception scores. Finally, we compare our approach with GP-WGAN on the whole training set for both unsupervised and supervised generative-purpose task using ResNet. For model selection, we use the first 50,000 samples to compute the inception scores (Salimans et al., 2016), then choose the best model, and finally report the “test” score on another 50,000 samples. The experiment follows the previous setup in (Odena et al., 2016). From the comparison results in Tables 2, we conclude that our proposed model achieves the highest inception score on the CIFAR10 dataset, to the best of our knowledge. Some generated samples are shown in Figure 7.
180
+
181
+ For the small CNN based generator, the inception scores of GP-WGAN and our CT-GAN are $2 . 9 8 \pm$ 0.11 and $5 . 1 3 \pm 0 . 1 2$ , respectively.
182
+
183
+ ![](images/3c70b1dead917ecf56456f0a87519cf0cad0fc5a71fe26bb94f6752bce509e04.jpg)
184
+ Figure 7: Generated samples by our ResNet model: (a) Generated samples by unsupervised model and (b) Generated samples by supervised model. Each column corresponds to one class in the CIFAR-10 dataset.
185
+
186
+ Table 3: Comparing our semi-supervised learning approach with state-of-the-art ones on CIFAR-10
187
+
188
+ <table><tr><td>Method</td><td>Test error(%)</td></tr><tr><td>Ladder (Rasmus et al., 2015)</td><td>20.40±0.47</td></tr><tr><td>VAT (Miyato et al., 2017)</td><td>10.55</td></tr><tr><td>TE (Laine &amp; Aila,2016)</td><td>12.16 ±0.24</td></tr><tr><td>Teacher-Student (Tarvainen &amp; Valpola,2017)</td><td>12.31 ± 0.28</td></tr><tr><td>CatGANs (Springenberg,2015)</td><td>19.58 ± 0.58</td></tr><tr><td>Improved GANs (Salimans et al., 2016)</td><td>18.63 ± 2.32</td></tr><tr><td>ALI (Dumoulin et al., 2016)</td><td>17.99 ±1.62</td></tr><tr><td>CLS-GAN (Qi, 2017)</td><td>17.30 ± 0.50</td></tr><tr><td>Triple GAN (Li et al., 2017a)</td><td>16.99 ± 0.36</td></tr><tr><td>Improved semi-GAN (Kumar et al., 2017)</td><td>16.78 ± 1.80</td></tr><tr><td>Our CT-GAN</td><td>9.98± 0.21</td></tr></table>
189
+
190
+ Semi-supervised learning. For the semi-supervised learning approach, we follow the standard training/test split of the dataset but use only 4,000 labels in the training. A regular data augmentation with flipping the images horizontally and randomly translating the images within [-2,2] pixels is used in our paper (No ZCA whitening). We report the semi-supervised learning results in Table 3. The mean and standard errors are obtained by running the experiments 5 rounds. Comparing to several very competitive methods, ours is able to achieve state-of-the-art results. Notably, our CT-GAN outperfroms all the GAN based methods by a large margin. Please see Appendix A for the network architectures and Appendix C for the ablation study of our algorithm.
191
+
192
+ # 4 CONCLUSION
193
+
194
+ In this paper, we present a consistency term derived from Lipschitz inequality, which boosts the performance of GANs model. The proposed term has been demonstrated to be an efficient manner to ease the over-fitting problem when data amount is limited. Experiments show that our model obtains the state-of-the-art accuracy and Inception score on CIFAR-10 dataset for both the semisupervised learning task and the learning of generative models.
195
+
196
+ Acknowledgements. This work is partially supported by NSF IIS-1741431, IIS-1566511, and ONR N00014-18-1-2121. B.G. and L.W. would also like to thank Adobe Research and NVIDIA, and Amazon, respectively, for their gift donations.
197
+
198
+ # REFERENCES
199
+
200
+ Martin Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial´ networks. arXiv preprint arXiv:1701.04862, 2017.
201
+
202
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
203
+
204
+ David Berthelot, Tom Schumm, and Luke Metz. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
205
+
206
+ Olivier Chapelle, Bernhard Scholkopf, and Alexander Zien. Semi-supervised learning (chapelle, o. et al., eds.; 2006)[book reviews]. IEEE Transactions on Neural Networks, 20(3):542–542, 2009.
207
+
208
+ Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard Hovy, and Aaron Courville. Calibrating energy-based generative adversarial networks. arXiv preprint arXiv:1702.01691, 2017.
209
+
210
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
211
+
212
+ Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in neural information processing systems, pp. 1486–1494, 2015.
213
+
214
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
215
+
216
+ Gintare Karolina Dziugaite, Daniel M Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. arXiv preprint arXiv:1505.03906, 2015.
217
+
218
+ 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.
219
+
220
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
221
+
222
+ Xun Huang, Yixuan Li, Omid Poursaeed, John Hopcroft, and Serge Belongie. Stacked generative adversarial networks. arXiv preprint arXiv:1612.04357, 2016.
223
+
224
+ Daniel Jiwoong Im, Chris Dongjoo Kim, Hui Jiang, and Roland Memisevic. Generating images with recurrent adversarial networks. arXiv preprint arXiv:1602.05110, 2016.
225
+
226
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arXiv preprint arXiv:1611.07004, 2016.
227
+
228
+ Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
229
+
230
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pp. 3581–3589, 2014.
231
+
232
+ Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of gans. arXiv preprint arXiv:1705.07215, 2017.
233
+
234
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
235
+
236
+ Abhishek Kumar, Prasanna Sattigeri, and P Thomas Fletcher. Improved semi-supervised learning with gans using manifold invariances. arXiv preprint arXiv:1705.08850, 2017.
237
+
238
+ Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242, 2016.
239
+
240
+ 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.
241
+
242
+ Chongxuan Li, Kun Xu, Jun Zhu, and Bo Zhang. Triple generative adversarial nets. arXiv preprint arXiv:1703.02291, 2017a.
243
+
244
+ Chun-Liang Li, Wei-Cheng Chang, Yu Cheng, Yiming Yang, and Barnabas P ´ oczos. Mmd gan: ´ Towards deeper understanding of moment matching network. arXiv preprint arXiv:1705.08584, 2017b.
245
+
246
+ Yujia Li, Kevin Swersky, and Rich Zemel. Generative moment matching networks. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1718–1727, 2015.
247
+
248
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. arXiv preprint arXiv:1704.03976, 2017.
249
+
250
+ Richard Nock, Zac Cranko, Aditya Krishna Menon, Lizhen Qu, and Robert C Williamson. f-gans in an information geometric nutshell. arXiv preprint arXiv:1707.04385, 2017.
251
+
252
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, pp. 271–279, 2016.
253
+
254
+ Augustus Odena. Semi-supervised learning with generative adversarial networks. arXiv preprint arXiv:1606.01583, 2016.
255
+
256
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier gans. arXiv preprint arXiv:1610.09585, 2016.
257
+
258
+ Guo-Jun Qi. Loss-sensitive generative adversarial networks on lipschitz densities. arXiv preprint arXiv:1701.06264, 2017.
259
+
260
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
261
+
262
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In Advances in Neural Information Processing Systems, pp. 3546–3554, 2015.
263
+
264
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
265
+
266
+ 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.
267
+
268
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
269
+
270
+ Ilya Sutskever, Rafal Jozefowicz, Karol Gregor, Danilo Rezende, Tim Lillicrap, and Oriol Vinyals. Towards principled unsupervised learning. arXiv preprint arXiv:1511.06440, 2015.
271
+
272
+ Antti Tarvainen and Harri Valpola. Weight-averaged consistency targets improve semi-supervised deep learning results. arXiv preprint arXiv:1703.01780, 2017.
273
+
274
+ Cedric Villani. ´ Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008.
275
+
276
+ Dilin Wang and Qiang Liu. Learning to draw samples: With application to amortized mle for generative adversarial learning. arXiv preprint arXiv:1611.01722, 2016.
277
+
278
+ David Warde-Farley and Yoshua Bengio. Improving generative adversarial networks with denoising feature matching. 2016.
279
+
280
+ Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger Grosse. On the quantitative analysis of decoder-based generative models. arXiv preprint arXiv:1611.04273, 2016.
281
+
282
+ 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.
283
+
284
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017.
285
+
286
+ # Appendices
287
+
288
+ APPENDIX A NETWORK ARCHITECTURES
289
+
290
+ Table 4 (MNIST) and Table 5 (CIFAR-10) detail the network architectures used in our classificationpurpose CT-GAN, where the classifiers are the same as the widely used ones in most semi-supervised networks (Laine & Aila, 2016) except that we apply weight-norm rather than batch-norm. For the generators, we follow the network structures in GP-WGAN (Salimans et al., 2016), but we use lower dimensional noise (50D) as the input to the generator for CIFAR-10 in order not to reproduce the complicated images and instead shift the focus of the training to the classifier.
291
+
292
+ Table 4: Networks for semi-supervised learning on MNIST
293
+
294
+ <table><tr><td>Classifier C</td><td>Generator G</td></tr><tr><td>Input: Labels y,28*28 Images x,</td><td>Input: Noise 100 z</td></tr><tr><td>Gaussiannoise0.3,MLP1000,ReLU Gaussian noise 0.5,MLP 500,ReLU</td><td>MLP 500, Softplus,Batch norm</td></tr><tr><td>Gaussian noise O.5,MLP 250,ReLU</td><td>MLP 500, Softplus,Batch norm</td></tr><tr><td>Gaussian noise 0.5,MLP 250,ReLU</td><td>MLP 784, Sigmoid,Weight norm</td></tr><tr><td>Gaussian noise 0.5,MLP 250,ReLU</td><td></td></tr><tr><td></td><td></td></tr><tr><td>Gaussian noise O.5,MLP 10, Softmax</td><td></td></tr></table>
295
+
296
+ Table 5: Networks for semi-supervised learning on CIFAR-10
297
+
298
+ <table><tr><td>Classifier C</td><td>Generator G</td></tr><tr><td>Input: Labels y, 32*32*3 Colored Image x,</td><td>Input:Noise 50 z</td></tr><tr><td>0.2 Dropout 3*3 conv.128,Pad=1, Stride =1,lReLU,Weight norm 3*3 conv. 128, Pad =1, Stride =1, lReLU,Weight norm</td><td>MLP 8192, ReLU, Batch norm Reshape 512*4*4 5*5 deconv. 256*8*8,</td></tr><tr><td>3*3 conv. 128,Pad =1, Stride =2, lReLU, Weight norm 0.5 Dropout 3*3 conv. 256,Pad =1, Stride =1, lReLU, Weight norm 3*3 conv. 256,Pad=1, Stride =1, lReLU, Weight norm 3*3 conv. 256,Pad =1, Stride =2, lReLU, Weight norm</td><td>ReLU,Batch norm 5*5 deconv. 128*16*16, ReLU,Batch norm</td></tr><tr><td>0.5 Dropout 3*3 conv. 512, Pad =O, Stride =1, lReLU, Weight norm 3*3 conv. 256,Pad =O, Stride =1,lReLU, Weight norm 3*3 conv. 128,Pad =O, Stride =1, lReLU, Weight norm</td><td>5*5 deconv. 3*32*32,</td></tr><tr><td>Global pool MLP 10, Weight norm, Softmax</td><td>Tanh,Weight norm</td></tr></table>
299
+
300
+ # APPENDIX B HYPER-PARAMETERS AND OTHER TRAINING DETAILS
301
+
302
+ For the semi-supervised learning experiments, we set $\lambda = 1 . 0$ in Eq.(7) in all our experiments. For CIFAR-10, the number of training epochs is set to 1,000 with a constant learning rate of 0.0003. For
303
+
304
+ Table 6: Generative model for MNIST
305
+
306
+ <table><tr><td>Discriminator</td><td>Generator</td></tr><tr><td>Input: 1*28*28 Image x</td><td>Input:Noise z 128</td></tr><tr><td>5*5 conv. 64,Pad = same, Stride= 2, IReLU 0.5 Dropout</td><td>MLP4096,ReLU Reshape 256*4*4</td></tr><tr><td>5*5 conv. 128,Pad = same, Stride= 2,lReLU 0.5 Dropout</td><td>5*5 deconv. 128*8*8 ReLU, Cut 128*7*7</td></tr><tr><td>5*5 conv. 256, Pad = same, Stride = 2, IReLU 0.5 Dropout</td><td>5*5 deconv. 64*14*14</td></tr><tr><td>Reshape 256*4*4 (D-)</td><td>ReLU 5*5 deconv. 1*28*28</td></tr><tr><td>MLP 1 (D)</td><td>Sigmoid</td></tr></table>
307
+
308
+ Table 7: Generative model for CIFAR-10
309
+
310
+ <table><tr><td>Discriminator</td><td>Generator</td></tr><tr><td>Input: 3*32*32 Image x,</td><td>Input:Noise z 128</td></tr><tr><td>5*5 conv. 128, Pad = same, Stride =2, IReLU 0.5 Dropout</td><td>MLP 8192, ReLU, Batch norm Reshape 512*4*4</td></tr><tr><td>5*5 conv. 256, Pad = same, Stride = 2, IReLU 0.5 Dropout</td><td>5*5 deconv. 256*8*8 ReLU,Bach norm</td></tr><tr><td>5*5 conv. 512, Pad = same Stride= 2, IReLU</td><td>5*5 deconv. 128*16*16</td></tr><tr><td>0.5 Dropout Reshape 512*4*4 (D-)</td><td>ReLU, Batch norm 5*5 deconv. 3*32*32</td></tr><tr><td>MLP 1 (D)</td><td>Tanh</td></tr></table>
311
+
312
+ MNIST, the number of training epochs is set to 300 with a constant learning rate of 0.003. The other hyper-parameters are exactly the same as in the improved GAN (Salimans et al., 2016).
313
+
314
+ For the experiments on the generative models, to have a fair comparison for our results with the existing ones, we keep the network structure and hyper-parameters the same as in the improved training of WGAN (Gulrajani et al., 2017) except that we add three dropout layers to some of the hidden layers as shown in tables 6 to 8.
315
+
316
+ # APPENDIX C ABLATION STUDY OF OUR APPROACH TO SSL
317
+
318
+ We run an ablation study of our approach to the semi-supervised learning (SSL). Thanks to the dual effect of the proposed consistency (CT) term, we are able to connect GAN with the temporal ensembling (TE) Laine & Aila (2016) method for SSL. Our superior results thus benefit from both of them, verified by the ablation study detailed in Table 9.
319
+
320
+ Table 8: ResNet for CIFAR-10
321
+
322
+ <table><tr><td>Discriminator</td><td>Generator</td></tr><tr><td>Input: 3*32*32 Image x</td><td>Input: Noise bmz 128</td></tr><tr><td>[3*3]*2 Residual Block, Resample = DOWN 128*16*16</td><td>MLP2048 Reshape 128*4*4</td></tr><tr><td>[3*3]*2 Residual Block, Resample = DOWN 128*8*8 0.2 Dropout</td><td>[3*3]*2 Residual Block, Resample = UP</td></tr><tr><td>[3*3]*2 Residual Block, Resample = None 128*8*8 0.5 Dropout</td><td>128*8*8 [3*3]*2 Residual Block, Resample = UP</td></tr><tr><td>[3*3]*2 Residual Block, Resample = None</td><td>128*16*16 [3*3]*2 Residual Block, Resample = UP</td></tr><tr><td>128*8*8 0.5 Dropout</td><td>128*32*32</td></tr><tr><td>ReLU, Global mean pool (D-) MLP 1 (D)</td><td>3*3 conv. 3*32*32</td></tr><tr><td></td><td>Tanh</td></tr></table>
323
+
324
+ If we remove the CT term, the test error goes up to 14.98, signifying the effectiveness of the CT regularization.
325
+
326
+ If we remove GAN from our approach, it almost reduces to TE; in fact, all the settings here are the same as TE except that we use an extra regularization ${ \bf \it D _ { - } ( \dots ) }$ in CT) over the second-to-last layer. We can see that the error is still significantly larger than our overall method.
327
+
328
+ We use the weight normalization as in Salimans et al. (2016), which becomes a core constituent of our approach. The batch normalization would actually invalidate the feature matching in Salimans et al. (2016).
329
+
330
+ Finally, we also test the version without the regularization to the second-to-last layer and observe a little drop in the performance.
331
+
332
+ Table 9: Ablation study of our semi-supervised learning method
333
+
334
+ <table><tr><td>Method</td><td>Test Error</td></tr><tr><td>w/o CT</td><td>14.98±0.43</td></tr><tr><td>w/o GAN</td><td>11.98±0.32</td></tr><tr><td>w batch norm</td><td></td></tr><tr><td>w/o D-(.,.) over the second-to-last layer</td><td>10.70±0.24</td></tr><tr><td>Ours</td><td>9.98±0.21</td></tr></table>
335
+
336
+ # APPENDIX D EXAMINING THE 1-LIPSCHITZ CONTINUITY
337
+
338
+ Norm of gradient. In our experiments, we find that although the GP-WGAN (Gulrajani et al., 2017) has applied a Lipschitz constraint in the form of the gradient penalty over the input sampled between a real data point and a generated one, the actual effect on the $\ell _ { 2 }$ norm of the gradient is not as good as our CT-GAN model in the real data points, as illustrated in Figure 1. We empirically verify this fact by Figure 8, which shows the $\ell _ { 2 }$ norms of the gradients of the discriminator with respect to the real data points. The closer to 1 the norms are, the better the 1-Lipschitz continuity is preserved. Figure 8 further demonstrates that our consistency (CT) regularization is able to improve GP-WGAN (Gulrajani et al., 2017).
339
+
340
+ ![](images/c6d2218ee59678ad1515a1a0032f1d261c7a9421305f20dc50ea49e964a774d5.jpg)
341
+ Figure 8: The maximum $\ell _ { 2 }$ norm of the gradients of the discriminator with respect to the input on CIFAR-10 testing set in each iteration of the training using 1000 CIFAR-10 training images.
342
+
343
+ Definition of the Lipschitz continuity. Additionally, we check how much the 1-Lipschitz continuity is satisfied according to its vanilla definition (cf. Eq. (3)). Figures 9 and 10 plot the CTs of Eq. (4) and Eq. (5), respectively, over different iterations of the training using 1000 CIFAR-10 images. Figure 10 is the actual CTs used to train the generative model. Figure 9 is drawn as follows.
344
+
345
+ For every 100 iterations, we randomly pick up 64 real examples and split them into two subsets of the same size. We compute $d ( D ( x _ { 1 } ) - D ( x _ { 2 } ) ) / d ( x _ { 1 } - x _ { 2 } )$ for all the $( x _ { 1 } , x _ { 2 } )$ pairs, where $x _ { 1 }$ is from the first subset and $x _ { 2 }$ is from the second. The maximum of $d ( D ( x _ { 1 } ) - D ( x _ { 2 } ) ) / d ( x _ { 1 } - x _ { 2 } )$ is plotted in Figure 9. We can see that the CT-GAN curve converges under a certain value much faster than GP-WGAN. The 1-Lipschitz continuity is better maintained by CT-GAN than GP-WGAN over the whole course of the training procedure on the manifold of the real data.
346
+
347
+ ![](images/d187e15086c5f6a9cb6de72fa06b6e70dfcfd085991fab599baf7f77e568762b.jpg)
348
+ Figure 9: CT (cf. Eq. (4)) over different iterations of the training using 1000 CIFAR-10 images. In each iteration, we randomly pick up two real data points to compute the CT.
349
+
350
+ ![](images/78fb5bbee816494a12aed3f7636ed7d567abaa59689f378bed1c9131bedf1d60.jpg)
351
+ Figure 10: CT (cf. Eq. (5)) over different iterations of the training using 1000 CIFAR-10 images.
352
+
353
+ # APPENDIX E GP-WGAN WITH DROPOUT
354
+
355
+ We run another experiment of GP-WGAN by adding the same dropout layers used in our method to the networks of GP-WGAN, denoted by GP-WGAN+dropout. This may help understand the contribution of our approach in preventing the overfitting problem — is it due to the CT regularization, or merely due to the dropout? This experiment is done by removing the CT term out of our value function for training WGAN using 1,000 CIFAR-10 images and yet keep the dropout layers.
356
+
357
+ The Inception score of GP-WGAN+dropout is $4 . 2 9 \pm 0 . 1 2$ , and the generated samples are shown in Figure 11(a). We also plot the curve of CT in the training procedure of GP-WGAN $^ +$ dropout and contrast it to the curve of our CT-GAN in Figure 11(b). It is clear that GP-WGAN+dropout outperforms GP-WGAN $( 2 . 9 8 \pm 0 . 1 1 ) $ , and our method $( 5 . 1 3 \pm 0 . 1 2 )$ outperforms GP-WGAN with a large margin.
358
+
359
+ ![](images/95c8e3d138185e0fef7249995e192bbfa47adcdf3cf05b143734d134d5846b3a.jpg)
360
+ Figure 11: The results of GP-WGAN+dropout.
361
+
362
+ Finally, we plot the convergence curves of the discriminators’ negative cost function learned by GPWGAN, GP-WGAN $^ +$ Dropout, and our CT-GAN in Figure 12. We can see that dropout is able to reduce the overfitting of GP-WGAN, but it is not as effective as our CT-GAN.
363
+
364
+ ![](images/42b83c1468918cfe11735af7355568c9222ce3d2ece267e863f5e088144006fe.jpg)
365
+ Figure 12: Convergence curves of the discriminator cost: (a) GP-WGAN, (b) GP-WGAN $^ +$ Dropout, and (c) CT-GAN (ours).
366
+
367
+ # APPENDIX F EXPERIMENTS ON LARGE DATASET
368
+
369
+ In this section, we further present experimental results on the large-scale ImageNet (Deng et al., 2009) and LSUN bedroom (Yu et al., 2015) datasets. The experiment setup (e.g., network architecture, learning rates, etc.) is exactly the same as in the GP-WGAN work (Gulrajani et al., 2017). We refer readers to (Gulrajani et al., 2017) or our code on GitHub (https://github.com/biuyq/CT-GAN) for the details of the setup.
370
+
371
+ Our experiment on ImageNet is conducted using images of the size $6 4 \times 6 4$ . After 200, 000 generator iterations, the inception score of the proposed CT-GAN is ${ \bf 1 0 . 2 7 } \pm { \bf 0 . 1 5 }$ , whereas GP-WGAN’s is ${ \bf 9 . 8 5 \pm 0 . 1 7 }$ . In addition, the inception score comparison of GP-WGAN and our CT-GAN in each generator iteration is shown in Figure 13. We can observe that the inception score of our proposed CT-GAN becomes higher than GP-WGAN’s after early generator iterations. Finally, Figure 14 shows the samples generated by GP-WGAN and CT-GAN, respectively.
372
+
373
+ ![](images/8dad9e4369b46ff49ce7ce9c759e02deb243f3bc9efa497400438a821313cb50.jpg)
374
+ Figure 13: Inception score of GP-WGAN and our CT-GAN with respect to iterations
375
+
376
+ ![](images/072a288c32709d4684b8f5c996ac80ac24e2308673461cbdd52e9e49cc89c917.jpg)
377
+ Figure 14: Samples generated by GP-WGAN (a) and by CT-GAN (b), respectively.
378
+
379
+ For the LSUN bedroom dataset, we show some results in Figure 15. They are the generated samples by our CT-GAN generator after $2 0 \mathrm { k }$ training iterations.
380
+
381
+ ![](images/c22c5ba777606a67430cb6fc56b70ba287ba6b7735bdf11341a64160d55db6f6.jpg)
382
+ Figure 15: Image samples generated by CT-GAN trained model using LSUN bedroom images.
md/train/SJxbHkrKDH/SJxbHkrKDH.md ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVOLUTIONARY POPULATION CURRICULUM FORSCALING MULTI-AGENT REINFORCEMENT LEARNING
2
+
3
+ Qian Long∗
4
+ CMU
5
+ qianlong@cs.cmu.edu
6
+ Zihan Zhou∗
7
+ SJTU
8
+ footoredo@sjtu.edu.cn
9
+
10
+ Abhibav Gupta CMU, Facebook AI Research abhinavg@cs.cmu.edu
11
+
12
+ Fei Fang
13
+ CMU
14
+ feif@cs.cmu.edu
15
+ Yi Wu†
16
+ OpenAI
17
+ jxwuyi@openai.com
18
+
19
+ Xiaolong Wang† UCSD xiw012@ucsd.edu
20
+
21
+ # ABSTRACT
22
+
23
+ In multi-agent games, the complexity of the environment can grow exponentially as the number of agents increases, so it is particularly challenging to learn good policies when the agent population is large. In this paper, we introduce Evolutionary Population Curriculum (EPC), a curriculum learning paradigm that scales up MultiAgent Reinforcement Learning (MARL) by progressively increasing the population of training agents in a stage-wise manner. Furthermore, EPC uses an evolutionary approach to fix an objective misalignment issue throughout the curriculum: agents successfully trained in an early stage with a small population are not necessarily the best candidates for adapting to later stages with scaled populations. Concretely, EPC maintains multiple sets of agents in each stage, performs mix-and-match and fine-tuning over these sets and promotes the sets of agents with the best adaptability to the next stage. We implement EPC on a popular MARL algorithm, MADDPG, and empirically show that our approach consistently outperforms baselines by a large margin as the number of agents grows exponentially. The source code and videos can be found at https://sites.google.com/view/epciclr2020/.
24
+
25
+ # 1 INTRODUCTION
26
+
27
+ Most real-world problems involve interactions between multiple agents and the problem becomes significantly harder when there exist complex cooperation and competition among agents. Inspired by the tremendous success of deep reinforcement learning (RL) in single-agent applications, such as Atari games (Mnih et al., 2013), robotics manipulation (Levine et al., 2016), and navigation (Zhu et al., 2017; Wu et al., 2018; Yang et al., 2019), it has become a popular trend to apply deep RL techniques into multi-agent applications, including communication (Foerster et al., 2016; Sukhbaatar et al., 2016; Mordatch & Abbeel, 2018), traffic light control (Wu et al., 2017), physical combats (Bansal et al., 2018), and video games (Liu et al., 2019; OpenAI, 2018).
28
+
29
+ A fundamental challenge for multi-agent reinforcement learning (MARL) is that, as the number of agents increases, the problem becomes significantly more complex and the variance of policy gradients can grow exponentially (Lowe et al., 2017). Despite the advances on tackling this challenge via actor-critic methods (Lowe et al., 2017; Foerster et al., 2018), which utilize decentralized actors and centralized critics to stabilize training, recent works still scale poorly and are mostly restricted to less than a dozen agents. However, many real-world applications involve a moderately large population of agents, such as algorithmic trading (Wellman et al., 2005), sport team competition (Hausknecht & Stone, 2015), and humanitarian assistance and disaster response (Meier, 2015), where one agent should collaborate and/or compete with all other agents. When directly applying the existing MARL algorithms to complex games with a large number of agents, as we will show in Sec. 5.3, the agents may fail to learn good strategies and end up with little interaction with other agents even when collaboration is significantly beneficial. Yang et al. (2018) proposed a provably-converged meanfield formulation to scale up the actor-critic framework by feeding the state information and the average value of nearby agents’ actions to the critic. However, this formulation strongly relies on the assumption that the value function for each agent can be well approximated by the mean of local pairwise interactions. This assumption often does not hold when the interactions between agents become complex, leading to a significant drop in the performance.
30
+
31
+ In this paper, we propose a general learning paradigm called Evolutionary Population Curriculum (EPC), which allows us to scale up the number of agents exponentially. The core idea of EPC is to progressively increase the population of agents throughout the training process. Particularly, we divide the learning procedure into multiple stages with increasing number of agents in the environment. The agents first learn to play in simpler scenarios with less agents and then leverage these experiences to gradually adapt to later stages with more agents and ultimately our desired population.
32
+
33
+ There are two key components in our curriculum learning paradigm. To process the varying number of agents during the curriculum procedure, the policy/critic needs to be population-invariant. So, we choose a self-attention (Vaswani et al., 2017) based architecture which can generalize to an arbitrary number of agents with a fixed number of parameters. More importantly, we introduce an evolutionary selection process, which helps address the misalignment of learning goals across stages and improves the agents’ performance in the target environment. Intuitively, our within-stage MARL training objective only incentivizes agents to overfit a particular population in the current stage. When moving towards a new stage with a larger population, the successfully trained agents may not adapt well to the scaled environment. To mitigate this issue, we maintain multiple sets of agents in each stage, evolve them through cross-set mix-and-match and parallel MARL fine-tuning in the scaled environment, and select those with better adaptability to the next stage.
34
+
35
+ EPC is RL-algorithm agnostic and can be potentially integrated with most existing MARL algorithms. In this paper, we illustrate the empirical benefits of EPC by implementing it on a popular MARL algorithm, MADDPG (Lowe et al., 2017), and experimenting on three challenging environments, including a predator-prey-style individual survival game, a mixed cooperative-and-competitive battle game, and a fully cooperative food collection game. We show that EPC outperforms baseline approaches by a large margin on all these environments as the number of agents grows even exponentially. We also demonstrate that our method can improve the stability of the training procedure.
36
+
37
+ # 2 RELATED WORK
38
+
39
+ Multi-Agent Reinforcement Learning: It has been a long history in applying RL to multi-agent games (Littman, 1994; Shoham et al., 2003; Panait & Luke, 2005; Wright et al., 2019). Recently, deep RL techniques have been applied into the multi-agent scenarios to solve complex Markov games and great algorithmic advances have been achieved. Foerster et al. (2016) and He et al. (2016) explored a multi-agent variant of deep Q-learning; Peng et al. (2017) studied a fully centralized actor-critic variant; Foerster et al. (2018) developed a decentralized multi-agent policy gradient algorithm with a centralized baseline; Lowe et al. (2017) proposes the MADDPG algorithm which extended DDPG to the multi-agent setting with decentralized policies and centralized Q functions. Our population curriculum approach is a general framework for scaling MARL which can be potentially combined with any of these algorithms. Particularly, we implement our method on top of the MADDPG algorithm in this paper and take different MADDPG variants as baselines in experiments. There are also other works studying large-scale MARL recently (Lin et al., 2018; Jiang & Lu, 2018; Yang et al., 2018; Suarez et al., 2019), which typically simplify the problem by weight sharing and taking only local observations. We consider a much more general setting with global observations and unsharedweight agents. Additionally, our approach is a general learning paradigm which is complementary to the specific techniques proposed in these works.
40
+
41
+ Attention-Based Policy Architecture: Attention mechanism is widely used in RL policy representation to capture object level information (Duan et al., 2017; Wang et al., 2018), represent relations (Zambaldi et al., 2018; Malysheva et al., 2018; Yang et al., 2019) and extract communication channels (Jiang & Lu, 2018). Iqbal & Sha (2019) use an attention-based critic. In our work, we utilize an attention module in both policy and critic, inspired by the transformer architecture (Vaswani et al., 2017), for the purpose of generalization to an arbitrary number of input entities.
42
+
43
+ Curriculum Learning: Curriculum learning can be tracked back to Elman (1993), and its core idea is to “start small”: learn the easier aspects of the task first and then gradually increase the task difficulty. It has been extended to deep neural networks on both vision and language tasks (Bengio et al., 2009) and much beyond: Karras et al. (2017) propose to progressively increase the network capacity for synthesizing high quality images; Murali et al. (2018) apply a curriculum over the control space for robotic manipulation tasks; several works (Wu & Tian, 2016; Florensa et al., 2017; Sukhbaatar et al., 2017; Wang et al., 2019) have proposed to first train RL agents on easier goals and switch to harder ones later. Baker et al. (2019) show that multi-agent self-play can also lead to autocurricula in open-ended environments. In our paper, we propose to progressively increase the number of the agents as a curriculum for better scaling multi-agent reinforcement learning.
44
+
45
+ Evolutionary Learning: Evolutionary algorithms, originally inspired by Darwin’s natural selection, has a long history (Back & Schwefel, 1993), which trains a population of agents in parallel, and ¨ let them evolve via crossover, mutation and selection processes. Recently, evolutionary algorithms have been applied to learn deep RL policies with various aims, such as to enhance training scalability (Salimans et al., 2017), to tune hyper-parameters (Jaderberg et al., 2017), to evolve intrinsic dense rewards (Jaderberg et al., 2018), to learn a neural loss for better generalization (Houthooft et al., 2018), to obtain diverse samples for faster off-policy learning (Khadka & Tumer, 2018), and to encourage exploration (Conti et al., 2018). Leveraging this insight, we apply evolutionary learning to better scale MARL: we train several groups of agents in each curriculum stage and keep evolving them to larger populations for the purpose of better adaptation towards the desired population scale and improved training stability. Czarnecki et al. (2018) proposed a similar evolutionary mix-and-match training paradigm to progressively increase agent capacity, i.e., larger action spaces and more parameters. Their work considers a fixed environment with an increasingly more complex agent and utilizes the traditional parameter crossover and mutation during evolution. By contrast, we focus on scaling MARL, namely an increasingly more complex environment with a growing number of agents. More importantly, we utilize MARL fine-tuning as an implicit mutation operator rather than the classical way of mutating parameters, which is more efficient, guided and applicable to even a very small number of evolution individuals. A similar idea of using learning for mutation is also considered by Gangwani & Peng (2018) in the single-agent setting.
46
+
47
+ # 3 BACKGROUND
48
+
49
+ Markov Games: We consider a multi-agent Markov decision processes (MDPs) (Littman, 1994). Such an $N$ -agent Markov game is defined by state space $s$ of the game, action spaces $\mathcal { A } _ { 1 } , . . . , \mathcal { A } _ { N }$ and observation spaces $\mathcal { O } _ { 1 } , . . . , \mathcal { O } _ { N }$ for each agent. Each agent $i$ receives a private observation correlated with the state $\mathbf { o } _ { i } : { \mathcal { S } } \mapsto { \mathcal { O } } _ { i }$ and produces an action by a stochastic policy $\pmb { \pi } _ { \pmb { \theta } _ { i } } : \mathcal { O } _ { i } \times \mathcal { A } _ { i } \mapsto [ 0 , 1 ]$ parameterized by $\theta _ { i }$ . Then the next states are produced according to the transition function $\tau$ : $\mathcal { S } \times \mathcal { A } _ { 1 } \times . . . \times \mathcal { A } _ { N } \mapsto \mathcal { S }$ . The initial state is determined by a distribution $\rho : { \cal S } \mapsto [ 0 , 1 ]$ . Each agent $i$ obtains rewards as a function of the state and its action $r _ { i } : S \times \mathcal { A } _ { i } \mapsto \mathbb { R }$ , and aims to maximize its own expected return $\begin{array} { r } { R _ { i } = \sum _ { t = 0 } ^ { T } \gamma ^ { t } r _ { i } ^ { t } ( s ^ { t } , a _ { i } ^ { t } ) } \end{array}$ , where $\gamma$ is a discount factor and $T$ is the time horizon. To minimize notation, we omit subscript of policy when there is no ambiguity.
50
+
51
+ Multi-Agent Deep Deterministic Policy Gradient (MADDPG): MADDPG (Lowe et al., 2017) is a multi-agent variant of the deterministic policy gradient algorithm (Silver et al., 2014). It learns a centralized $\mathrm { \bf Q }$ function for each agent which conditions on global state information to resolve the non-stationary issue. Consider $N$ agents with deterministic policies $\pmb { \mu } = \{ \pmb { \mu } _ { 1 } , . . . , \pmb { \mu } _ { N } \}$ where $\pmb { \mu } _ { i } : \mathcal { O } _ { i } \mapsto \mathcal { A } _ { i }$ is parameterized by $\theta _ { i }$ . The policy gradient for agent $i$ is:
52
+
53
+ $$
54
+ \nabla _ { \boldsymbol { \theta } _ { i } } J ( \boldsymbol { \theta } _ { i } ) = \mathbb { E } _ { \mathbf { x } , a \sim \mathcal { D } } [ \nabla _ { \boldsymbol { \theta } _ { i } } \mu _ { i } ( o _ { i } ) \nabla _ { a _ { i } } Q _ { i } ^ { \mu } ( \mathbf { x } , a _ { 1 } , . . . , a _ { N } ) | _ { a _ { i } = \mu _ { i } ( o _ { i } ) } ] ,
55
+ $$
56
+
57
+ Here $\mathcal { D }$ denotes the replay buffer while $Q _ { i } ^ { \pmb { \mu } } ( { \bf x } , a _ { 1 } , . . . , a _ { N } )$ is a centralized action-value function for agent $i$ that takes the actions of all agents, $a _ { 1 } , \dots , a _ { N }$ and the state information $\mathbf { x }$ (i.e., $\mathbf { x } =$ $\left( o _ { 1 } , . . . , o _ { N } \right)$ or simply $\mathbf { x } = s$ if $s$ is available). Let $\mathbf { x } ^ { \prime }$ denote the next state from the environment transition. The replay buffer $\mathcal { D }$ contains experiences in the form of tuples $( \mathbf { x } , \mathbf { x } ^ { \prime } , a _ { 1 } , \ldots , a _ { N } , r _ { 1 } , \ldots , r _ { N } )$ Suppose the centralized critic $Q _ { i } ^ { \mu }$ is parameterized by $\phi _ { i }$ . Then it is updated via:
58
+
59
+ $$
60
+ \begin{array} { r } { \mathcal { L } ( \boldsymbol { \phi } _ { i } ) = \mathbb { E } _ { \mathbf { x } , a , r , \mathbf { x } ^ { \prime } } [ ( Q _ { i } ^ { \mu } ( \mathbf { x } , a _ { 1 } , \dots , a _ { N } ) - y ) ^ { 2 } ] , \quad y = r _ { i } + \gamma Q _ { i } ^ { \mu ^ { \prime } } ( \mathbf { x } ^ { \prime } , a _ { 1 } ^ { \prime } , \dots , a _ { N } ^ { \prime } ) \big | _ { a _ { j } ^ { \prime } = \mu _ { j } ^ { \prime } ( o _ { j } ) } , } \end{array}
61
+ $$
62
+
63
+ where $\boldsymbol { \mu } ^ { \prime } = \{ \pmb { \mu } _ { \theta _ { 1 } ^ { \prime } } , . . . , \pmb { \mu } _ { \theta _ { N } ^ { \prime } } \}$ is the set of target policies with delayed parameters $\theta _ { i } ^ { \prime }$ . Note that the centralized critic is only used during training. At execution time, each policy $\pmb { \mu } _ { \theta _ { i } }$ remains decentralized and only takes local observation $o _ { i }$ .
64
+
65
+ # 4 EVOLUTIONARY POPULATION CURRICULUM
66
+
67
+ In this section, we will first describe the base network architecture with the self-attention mechanism (Vaswani et al., 2017) which allows us to incorporate a flexible number of agents during training. Then we will introduce the population curriculum paradigm and the evolutionary selection process.
68
+
69
+ ![](images/093992fce52d59fed8fcd540a0f8bcee9ca8c0cffad4a0073640b1e5aa0f6948.jpg)
70
+ Figure 1: Our population-invariant Q function: (a) utilizes the attention mechanism to combine embeddings from different observation-action encoder $f _ { i }$ ; (b) is a detailed description for $f _ { i }$ , which also utilizes an attention module to combine $M$ different entities in one observation.
71
+
72
+ # 4.1 POPULATION-INVARIANT ARCHITECTURE
73
+
74
+ We describe our choice of architecture based on the MADDPG algorithm (Lowe et al., 2017), which is population-invariant in the sense that both the Q function and the policy can take in an arbitrary number of input entities. We first introduce the Q function (Fig. 1) and then the policy.
75
+
76
+ We adopt the decentralized execution framework, so each agent has its own Q function and policy network. Particularly for agent $i$ , its centralized Q function is represented as follows:
77
+
78
+ $$
79
+ Q _ { i } ^ { \mu } ( \mathbf { x } , a _ { 1 } , \ldots , a _ { N } ) = h _ { i } ( [ g _ { i } ( f _ { i } ( o _ { i } , a _ { i } ) ) , v _ { i } ] ) , { \mathrm { ~ w h e r e ~ } } v _ { i } = \mathrm { a t t e n t i o n } ( f _ { i } ( o _ { j } , a _ { j } ) \forall j \neq i )
80
+ $$
81
+
82
+ Here $f _ { i } ( o _ { j } , a _ { j } )$ is an observation-action encoder (the green box in Fig. 1(a)) which takes in the observation $o _ { j }$ and the action $a _ { j }$ from agent $j$ , and outputs the agent embedding of agent $j ; v _ { i }$ denotes the global attention embedding (the orange box in Fig. 1(a)) over all the agent embeddings. We will explain $v _ { i }$ and $f _ { i }$ later. $g _ { i }$ is a 1-layer fully connected network processing the embedding of the ith agent’s own observation and action. $h _ { i }$ is a 2-layer fully connected network that takes the concatenation of the output of $g _ { i }$ and the global attention embedding $v _ { i }$ and outputs the final $\mathrm { Q }$ value.
83
+
84
+ Attention Embedding $v _ { i }$ : We define the attention embedding $v _ { i }$ by a weighted sum of each agent’s embedding $f _ { i } ( o _ { j } , a _ { j } )$ for $j \neq i$ :
85
+
86
+ $$
87
+ v _ { i } = \sum _ { j \neq i } \alpha _ { i , j } f _ { i } ( o _ { j } , a _ { j } )
88
+ $$
89
+
90
+ The coefficient $\alpha _ { i , j }$ is computed by
91
+
92
+ $$
93
+ \alpha _ { i , j } = \frac { \exp { ( \beta _ { i , j } ) } } { \sum _ { j \neq i } \exp { ( \beta _ { i , j } ) } } , \quad \beta _ { i , j } = f _ { i } ^ { T } ( o _ { i } , a _ { i } ) \boldsymbol { W } _ { \psi } ^ { T } \boldsymbol { W } _ { \phi } f _ { i } ( o _ { j } , a _ { j } )
94
+ $$
95
+
96
+ where $W _ { \psi }$ and $W _ { \phi }$ are parameters to learn. $\beta _ { i , j }$ computes the correlation between the embeddings of agent $i$ and every other agent $j$ via an inner product. $\alpha _ { i , j }$ is then obtained by normalizing $\beta _ { i , j }$ by a softmax function. Since we represent the observations and actions of other agents with a weighted mean $v _ { i }$ from Eq. 4, we can model the interactions between agent $i$ and an arbitrary number of other agents, which allows us to easily increase the number of agents in our curriculum training paradigm.
97
+
98
+ Observation-Action Encoder $f _ { i }$ : We now define the structure of $f _ { i } ( o _ { j } , a _ { j } )$ (Fig. 1(b)). Note that the observation of agent $j$ , $o _ { j }$ , also includes many entities, i.e., states of all visible agents and objects in the game. Suppose $o _ { j }$ contains $M$ entities, i.e., $o _ { j } = [ o _ { j , 1 } , \dotsc , o _ { j , M } ]$ . $M$ may also vary as the agent population scales over training procedure or simply during an episode when some agents die. Thus, we apply another attention module to combine these entity observations together in a similar way to how $v _ { i }$ is computed (Eq. 4, 5).
99
+
100
+ In more details, we first apply an entity encoder for each entity type to obtain entity embeddings of all the entities within that type. For example, in $o _ { j }$ , we can have embeddings for agent entities (green boxes in Fig. 1(b)) and landmark/object entities (purple boxes in Fig. 1(b)). Then we apply an attention module over each entity type by attending the entity embedding of agent $j$ to all the entities of this type to obtain an attended type embedding (the orange box in Fig. 1(b)). Next, we concatenate all the type embeddings together with the entity embedding of agent $j$ as well as its action embedding. Finally, this concatenated vector is forwarded to a fully connected layer to generate the output of $f _ { i } ( o _ { j } , a _ { j } )$ . Note that in the overall critic network of agent $i$ , the same encoder $f _ { i }$ is applied to every observation-action pair so that the network can maintain a fixed size of parameters even when the number of agents increases significantly.
101
+
102
+ Policy Network: The policy network $\pmb { \mu } _ { i } ( o _ { i } )$ has a similar structure as the observation-action encoder $f _ { i } ( o _ { i } , a _ { i } )$ , which uses an attention module over the entities of each type in the observation $o _ { i }$ to adapt to the changing population during training. The only difference in this network is that the action $a _ { i }$ is not included in the input. Notably, we do not share parameters between the Q function and the policy.
103
+
104
+ # 4.2 POPULATION CURRICULUM
105
+
106
+ We propose to progressively scale the number of agents in MARL with a curriculum. Before combining with the evolutionary selection process, we first introduce a simpler version, the vanilla population curriculum (PC), where we perform the following stage-wise procedure: (i) the initial stage starts with MARL training over a small number of agents using MADDPG and our populationinvariant architecture; (ii) we start a new stage and double1 the number of agents by cloning each of the existing agents; (iii) apply MADDPG training on this scaled population until convergence; (iv) if the desired number of agents is not reached, go back to step (ii).
107
+
108
+ Mathematically, given $N$ trained agents with parameters $\pmb { \theta } = \{ \theta _ { 1 } , . . . , \theta _ { N } \}$ from the previous stage, we want to increase the number of the agents to $2 N$ with new parameters $\tilde { \pmb { \theta } } = \{ \tilde { \theta } _ { 1 } , . . . , \tilde { \theta } _ { N } , . . . , \tilde { \theta } _ { 2 N } \}$ for the next stage . In this vanilla version of population curriculum, we simply initialize $\tilde { \pmb { \theta } }$ by setting $\tilde { \theta } _ { i } \gets \theta _ { i }$ and $\widetilde { \theta } _ { N + i } \theta _ { i }$ , and then continue MADDPG training on $\tilde { \pmb { \theta } }$ to get the final policies for the new stage. Although $\tilde { \theta _ { i } }$ and $\tilde { \theta } _ { N + i }$ are both initialized from $\theta _ { i }$ , as training proceeds, they will converge to different policies since these policies are trained in a decentralized manner in MADDPG.
109
+
110
+ # 4.3 EVOLUTIONARY SELECTION
111
+
112
+ Introducing new agents by directly cloning existing ones from the previous stage has a clear limitation: the policy parameters suitable for the previous environment are not necessarily the best initialization for the current stage as the population is scaled up. In the purpose of better performance in the final game with our desired population, we need to promote agents with better adaptation abilities during early stages of training.
113
+
114
+ Therefore, we propose an evolutionary selection process to facilitate the agents’ scaling adaption ability during the curriculum procedure. Instead of training a single set of agents, we maintain $K$ parallel sets of agents in each stage, and perform crossover, mutation and selection among them for the next stage. This is the last piece in our proposed Evolutionary Population Curriculum (EPC) paradigm, which is essentially population curriculum enhanced by the evolutionary selection process.
115
+
116
+ Specifically, we assume the agents in the multi-agent game have $\Omega$ different roles. Agents in the same role have the same action set and reward structure. For example, we have $\Omega = 2$ roles in a predator-prey game, namely predators and prey, and $\Omega = 1$ role of agents for a fully cooperative game with homogeneous agents. For notation conciseness, we assume there are $N _ { 1 }$ agents of role 1, namely $A _ { 1 } = \{ \pmb { \mu } _ { 1 } , . . . , \pmb { \mu } _ { N _ { 1 } } \}$ ; $N _ { 2 }$ agents of role 2, namely $A _ { 2 } = \{ \pmb { \mu } _ { N _ { 1 } + 1 } , . . . , \pmb { \mu } _ { N _ { 1 } + N _ { 2 } } \}$ , and so on. In each stage, we keep $K$ parallel sets for each role of agents, denoted by $A _ { i } ^ { ( 1 ) } , \ldots , A _ { i } ^ { ( K ) }$ for role $i$ , and take a 3-step procedure, i.e., mix-and-match (crossover), MARL fine-tuning (mutation) and selection, as follows to evolve these $K$ parallel sets of agents for the next stage.
117
+
118
+ Mix-and-Match (Crossover): In the beginning of a curriculum stage, we scale the population of agents from $N$ to $2 N$ . Note that we have $K$ parallel agent sets of size $N _ { i }$ for role $i$ , namely A(1)i , . $A _ { i } ^ { ( 1 ) } , \ldots , A _ { i } ^ { ( K ) }$ . We first perform a mix-and-match over these parallel sets within every role $i$ : for each set A(j), we pair it with all the $K$ sets of the same role, which leads to $K ( K + 1 ) / 2$ new scaled agent sets of size $2 N _ { i }$ . Given these scaled sets of agents, we then perform another mix-and-match across all the $\Omega$ roles: we pick one scaled set for each role and combine these $\Omega$ selected sets to produce a scaled game with $2 N$ agents. For example, in the case of $\Omega = 2$ , we can pick one agent set A(k1)1 from the first role and another agent set $A _ { 2 } ^ { ( k _ { 2 } ) }$ from the second role to form a scaled game.
119
+
120
+ Thus, there are $C _ { \mathrm { m a x } } = \left( K ( K + 1 ) / 2 \right) ^ { \Omega }$ different combinations in total through this mix-and-match process. We sample $C$ games from these combinations for mutation in the next step. Since we are mixing parallel sets of agents, this process can be considered as the crossover operator in standard evolutionary algorithms.
121
+
122
+ MARL Fine-Tuning (Mutation): In standard evolutionary algorithms, mutations are directly performed on the parameters, which is inefficient in high-dimensional spaces and typically requires a large amount of mutants to achieve sufficient diversity for evolution. Instead, here we adopt MARL fine-tuning in each curriculum stage (step (iii) in vanilla PC) as our guided mutation operator, which naturally and efficiently explores effective directions in the parameter space. Meanwhile, due to the training variance, MARL also introduces randomness which benefits the overall diversity of the evolutionary process. Concretely, we apply parallel MADDPG training on each of the $C$ scaled games generated from the mix-and-match step and obtain $C$ mutated sets of agents for each role.
123
+
124
+ Selection: Among these $C$ mutated sets of agents for each role, only the best $K$ mutants can survive. In the case of $\Omega = 1$ , the fitness score of a set of agents is computed as their average reward after MARL training. In other cases when $\Omega \geq 2$ , given a particular mutated set of agents of a specific role, we randomly generate games for this set of agents and other mutated sets from different agent roles. We take its average reward from these randomly generated games as the fitness score for this mutated set. We pick the top- $K$ scored sets of agents in each role to advance to the next curriculum stage.
125
+
126
+ # Algorithm 1: Evolutionary Population Curriculum
127
+
128
+ Data: environment $E ( N , \{ A _ { i } \} _ { 1 \leq i \leq \Omega } )$ with $N$ agents of $\Omega$ roles, desired population $N _ { d }$ , initial population $N _ { 0 }$ , evolution size $K$ , mix-and-match size $C$
129
+ Result: a set of $N _ { d }$ best policies
130
+ $N \gets N _ { 0 }$ ;
131
+ initialize $K$ parallel agent sets $A _ { i } ^ { ( 1 ) } , \ldots , A _ { i } ^ { ( K ) }$ for each role $1 \leq i \leq \Omega$ ;
132
+ initial parallel MARL training on $K$ games, $E ( N , \{ A _ { i } ^ { ( j ) } \} _ { 1 \leq i \leq \Omega } )$ for $1 \leq j \leq K$ ;
133
+ while $N < N _ { d }$ do $N \gets 2 \times N$ ; for $1 \leq j \leq C$ do $\lfloor$ for each role $1 \leq i \leq \Omega \colon j _ { 1 } , j _ { 2 } \gets \mathrm { u n i f } ( 1 , K ) , ~ \tilde { A } _ { i } ^ { ( j ) } \gets A _ { i } ^ { ( j _ { 1 } ) } + A _ { i } ^ { ( j _ { 2 } ) }$ (mix-and-match); MARL training in parallel on $E ( N , \{ \tilde { A } _ { i } ^ { ( j ) } \} _ { 1 \leq i \leq \Omega } )$ for $1 \leq j \leq C$ (guided mutation) ; for role $1 \leq i \leq \Omega$ do for $1 \leq j \leq C$ do $S _ { i } ^ { ( \bar { j } ) } \stackrel { \smile } { } { \mathbb { E } } _ { k _ { t \neq i } \sim [ 1 , C ] } [ \mathrm { a v g . r e w a r d s o n } E ( N , \{ \tilde { A } _ { 1 } ^ { ( k _ { 1 } ) } , \dots , \tilde { A } _ { i } ^ { ( j ) } , \dots , \tilde { A } _ { \Omega } ^ { ( k _ { \Omega } ) } \} ) ]$ (fitness); $A _ { i } ^ { ( 1 ) } , \ldots , A _ { i } ^ { ( K ) } \gets \mathrm { t o p } { - } K$ w.r.t. $S _ { i }$ from $\tilde { A } _ { i } ^ { ( 1 ) } , \ldots , \tilde { A } _ { i } ^ { ( C ) }$ (selection);
134
+
135
+ return the best set of agents in each role, i.e., $\{ A _ { i } ^ { ( k _ { i } ^ { \star } ) } | k _ { i } ^ { \star } \in [ 1 , K ] \ \forall 1 \leq i \leq \Omega \} \colon$ ;
136
+
137
+ Overall Algorithm: Finally, when the desired population is achieved, we take the best set of agents in each role based on their last fitness scores as the output. We conclude the detailed steps of EPC in Alg. 1. Note that in the first curriculum stage, we just train $K$ parallel games without mix-and-match or mutation. So, EPC simply selects the best from the $K$ initial sets in the first stage while the evolutionary selection process only takes effect starting from the second stage. We emphasize that although we evolve multiple sets of agents in each stage, the three operators, mix-and-match, MARL fine-tuning and selection, are all perfectly parallel. Thus, the evolutionary selection process only introduces little influence on the overall training time. Lastly, EPC is an RL-algorithm-agnostic learning paradigm that can be potentially integrated with any MARL algorithm other than MADDPG.
138
+
139
+ # 5 EXPERIMENT
140
+
141
+ We experiment on three challenging environments, including a predatory-prey-style Grassland game, a mixed-cooperative-and-competitive Adversarial Battle game and a fully cooperative Food Collection game. We compare EPC with multiple baseline methods on these environments with different scales of agent populations and show consistently large gains over the baselines. In the following, we will first introduce the environments and the baselines, and then both qualitative and quantitative performances of different methods on all three environments.
142
+
143
+ # 5.1 ENVIRONMENTS
144
+
145
+ All these environments are built on top of the particle-world environment (Mordatch & Abbeel, 2018) where agents take actions in discrete timesteps in a continous 2D world.
146
+
147
+ Grassland: In this game, we have $\Omega \ = \ 2$ roles of agents, $N _ { S }$ sheep and $N _ { W }$ wolves, where sheep moves twice as fast as wolves. We also have a fixed amount of $L$ grass pellets (food for sheep) as green landmarks (Fig. 2a). A wolf will be rewarded when it collides with (eats) a sheep,
148
+
149
+ ![](images/24e6b7437d63af3c204e1fdc3e21a6e3d6ca8187435e82821283ac9a9da897d4.jpg)
150
+ Figure 2: Environment Visualizations
151
+
152
+ and the (eaten) sheep will obtain a negative reward and becomes inactive (dead). A sheep will be rewarded when it comes across a grass pellet and the grass will be collected and respawned in another random position. Note that in this survival game, each individual agent has its own reward and does not share rewards with others.
153
+
154
+ Adversarial Battle: This scenario consists of $L$ units of resources as green landmarks and two teams of agents (i.e., $\Omega = 2$ for each team) competing for the resources (Fig. 2b). Both teams have the same number of agents $( N _ { 1 } = N _ { 2 }$ ). When an agent collects a unit of resource, the resource will be respawned and all the agents in its team will receive a positive reward. Furthermore, if there are more than two agents from team 1 collide with one agent from team 2, the whole team 1 will be rewarded while the trapped agent from team 2 will be deactivated (dead) and the whole team 2 will be penalized, and vice versa.
155
+
156
+ Food Collection: This game has $N$ food locations and $N$ fully cooperative agents $\Omega = 1 \times$ ). The agents need to collaboratively occupy as many food locations as possible within the game horizon (Fig. 2c). Whenever a food is occupied by any agent, the whole team will get a reward of $6 / N$ in that timestep for that food. The more food occupied, the more rewards the team will collect.
157
+
158
+ In addition, we introduce collision penalties as well as auxiliary shaped rewards for each agent in each game for easier training. All the environments are fully observable so that each agent needs to handle a lot of entities and react w.r.t. the global state. More environment details are in Appx. A.
159
+
160
+ # 5.2 METHODS AND METRIC
161
+
162
+ We evaluate the following approaches in our experiments: (1) the MADDPG algorithm (Lowe et al., 2017) with its original architecture (MADDPG); (2) the provably-converged mean-field algorithm (Yang et al., 2018) (mean-field); (3) the MADDPG algorithm with our population-invariant architecture (Att-MADDPG); (4) the vanilla population curriculum without evolutionary selection (vanilla-PC); and (5) our proposed EPC approach (EPC). For EPC parameters, we choose $K = 2$ for Grassland and Adversarial Battle and $K = 3$ for Food Collection; for the mix-and-match size $C$ , we simply set it $C _ { \mathrm { m a x } }$ and enumerate all possible mix-and-match combinations instead of random sampling. All the baseline methods are trained until the same amount of accumulative episodes as EPC took. More training details can be found in Appx. B.
163
+
164
+ For Grassland and Adversarial Battle with $\Omega = 2$ , we evaluate the performance of different methods by competing their trained agents against our EPC trained agents. Specifically, in Grassland, we let sheep trained by each approach compete with the wolves from EPC and collect the average sheep reward as the evaluation metric for sheep. Similarly, we take the same measurement for wolves from each method. In Adversarial Battle, since two teams are symmetric, we just evaluate the shared reward of one team trained by each baseline against another team by EPC as the metric. For Food Collection with $\Omega = 1$ , since it is fully cooperative, we take the team reward for each method as the evaluation metric. In addition, for better visualization, we plot the normalized scores by normalizing the rewards of different methods between 0 and 1 in each scale for each game. More evaluation details are in Appx. C.
165
+
166
+ # 5.3 QUALITATIVE RESULTS
167
+
168
+ In Grassland, as the number of wolves goes up, it becomes increasingly more challenging for sheep to survive; meanwhile, as the sheep become more intelligent, the wolves will be incentivized to be more aggressive accordingly. In Fig. 3, we illustrate two representative matches for competition, including one using the MADDPG sheep against the EPC wolves (Fig. 3a), and the other between the EPC sheep and the MADDPG wolves (Fig. 3b). From Fig. 3a, we can observe that the MADDPG sheep can be easily eaten up by the EPC wolves (note that dark circle means the sheep is eaten). On the other hand, in Fig. 3b, we can see that the EPC sheep learns to eat the grass and avoid the wolves at the same time.
169
+
170
+ ![](images/223ac5dab1c175bc806b98e6d1e31b9b70e2c3c0554197d641200100c99c1760.jpg)
171
+
172
+ ![](images/7376a966ff95eb5db154ad9aa83eee6220f22869d5760b9e508f4b27aa2dc26c.jpg)
173
+ (a) MADDPG sheep vs EPC wolves (b) MADDPG wolves vs EPC sheep Figure 3: Example matches between EPC and MADDPG trained agents in Grassland
174
+
175
+ ![](images/95a8287041fa44173e285dd951c6bfbfbb28a9224d26eb93736f12999dcd645e.jpg)
176
+ Figure 4: Adversarial Battle: dark particles are dead agents.
177
+
178
+ ![](images/9c0a25c31414a42411d7b4ec11e490d99524f9dfc5529ea1456d8a37d564f272.jpg)
179
+ Figure 5: Food Collection
180
+
181
+ In Adversarial Battle, we visualize two matches in Fig. 4 with one over agents by EPC (Fig. 4a) and the other over agents by MADDPG (Fig. 4b). We can clearly see the collaborations between the EPC agents: although the agents are initially spread over the environment, they learn to quickly gather as a group to protect themselves from being killed. While for the MADDPG agents, their behavior shows little incentives to cooperate or compete — these agents stay in their local regions throughout the episode and only collect resources or kill enemies very infrequently.
182
+
183
+ In Food Collection (Fig. 5), the EPC agents in Fig. 5a learn to spread out and occupy as many food as possible to maximize the team rewards. While only one agent among the MADDPG agents in Fig. 5b successfully occupies a food in the episode.
184
+
185
+ # 5.4 QUANTITATIVE RESULTS
186
+
187
+ # Quantitative Results in Grassland
188
+
189
+ In the Grassland game, we perform curriculum training by starting with 3 sheep and 2 wolves, and gradually increase the population of agents. We denote a game with $N _ { S }$ sheep and $N _ { W }$ wolves by “scale $N _ { S ^ { - } } N _ { W }$ ”. We start with scale 3-2 and gradually increase the game size to scales 6-4, 12-8 and finally 24-16.For the two curriculum learning approach, vanilla-PC and EPC, we train over $1 0 ^ { 5 }$ episodes in the first curriculum stage (scale 3-2) and fine-tune the agents with $5 \times 1 0 ^ { 4 }$ episodes after mix-and-match in each of the following stage. For other methods that train the agents from scratch, we take the same accumulative training iterations as the curriculum methods for a fair comparison.
190
+
191
+ Main Results: We report the performance of different methods for each game scale in Fig. 6a. Overall, there are little differences between the mean-field approach and the original MADDPG algorithm while the using the population-invariant architecture (i.e., Att-MADDPG) generally boosts the performance of MADDPG. For the method with population curriculum, vanilla-PC performs almost the same as training from scratch (Att-MADDPG) when the number of agents in the environment is small (i.e., 6-4) but the performance gap becomes much more significant when the population further grows (i.e., 12-18 and 24-16). For our proposed EPC method, it consistently outperforms all the baselines across all the scales. Particularly, in the largest scale 24-16, EPC sheep receive $1 0 \mathrm { x }$ more rewards than the best baseline sheep without curriculum training.
192
+
193
+ Detailed Statistics: Besides rewards, we also compute the statistics of sheep to understand how the trained sheep behave in the game. We perform competitions between sheep trained by different methods against the EPC wolves and measure the average number of total grass pellets eaten per episode, i.e, #grass eaten, and the average percentage of sheep that survive until the end of an episode, i.e., survival rate, in Fig. 6b. We can observe that as the population increases, it becomes increasingly harder for sheep to survive while EPC trained sheep remain a high survival rate even on the largest scale. Moreover, as more sheep in the game, EPC trained sheep consistently learn to eat more grass even under the strong pressure from wolves. In contrast, the amount of eaten grass of MADDPG approach (i.e., Att-MADDPG) drastically decreases when the number of wolves becomes large.
194
+
195
+ # Quantitative Results in Adversarial Battle
196
+
197
+ ![](images/27ec6c79dc58012bdf0b0d8a3c43208bfd6a13b74c3fc0d482c7d261d8041a1e.jpg)
198
+ Figure 6: Results in Grassland. In part (a), we show the normalized scores of wolves and sheep trained by different methods when competing with EPC sheep and EPC wolves respectively. In part (b), we measure the sheep statistics over different scales $\mathbf { \dot { x } }$ -axis), including the average number of total grass pellets eaten per episode (left) and the average percentage of sheep that survive until the end of episode (right). EPC trained agents (yellow) are consistently better than any baseline method.
199
+
200
+ In this game, we evaluate on environments with different sizes of agent population $N$ , denoted by scale $N _ { 1 } – N _ { 2 }$ where $N _ { 1 } = N _ { 2 } =$ $\bar { N } / 2$ . We start the curriculum from scale 4-4 and the increase the population size to scale 8-8 $N = 1 6$ ) and finally 16-16 $N = 3 2$ ). Both vanilla-PC and EPC take $5 \times 1 0 ^ { 4 }$ training episodes in the first stage and then $2 \times 1 0 ^ { 4 }$ episodes in the following two curriculum stages. We report the normalized scores of different methods in Fig. 7, where agents trained by EPC outperforms all the baseline methods increasingly more significant as the agent population grows.
201
+
202
+ # Quantitative Results in Food Collection
203
+
204
+ ![](images/a5ec3320b5797a63d2419f5b17f6bd6ef8cdb45a064214a96d2e2c2b71f33076.jpg)
205
+ Figure 7: Adversarial Battle
206
+
207
+ In this game, we begin curriculum training with $N = 3$ , namely 3 agents and 3 food locations, and progressively increase the population size $N$ to 6, 12 and finally 24. Both vanilla-PC and EPC perform training on $5 \times 1 0 ^ { 4 }$ episodes on the first stage of $N = 3$ and then $2 \times 1 0 ^ { \overline { { 4 } } }$ episodes in each of the following curriculum stage. We report the normalized scores for all the methods in Fig. 8, where EPC is always the best among all the approaches with a clear margin. Note that the performance of the original MADDPG and the meanfield approach drops drastically as the population size $N$ increases. Particularly, the mean-field approach performs even worse than the original MADDPG method. We believe this is because in this game, the agents must act according to the global team state collaboratively, which means the local approximation assumption in the mean-field approach does not hold clearly.
208
+
209
+ ![](images/f70986fc2a2058a05b780148d32f36862c5672218cbd862eefe5756cd2c3b85c.jpg)
210
+ Figure 8: Food Collection
211
+
212
+ # Ablative Analysis
213
+
214
+ Stability Analysis: The evolutionary selection process in EPC not only leads to better final performances but also stabilizes the training procedure. We validate the stability of EPC by computing the variance over 3 training seeds for the same experiment and comparing with the variance of vanilla-PC, which is also obtained from 3 training seeds. Specifically, we pick the second stage of curriculum learning and visualize the variance of agent scores throughout the stage of training. These scores are computed by competing against the final policy trained by EPC. We perform analysis on all the 3 environments: Grassland with scale 6-4 (Fig. 9a), Adversarial Battle with scale 8-8 (Fig. 9b) and Food Collection with scale 6 (Fig. 9c). We can observe that the variance of EPC is much smaller than vanilla-PC in different games.
215
+
216
+ Convergence Analysis: To illustrate that the self-attention based policies trained from a smaller scale is able to well adapt to a larger scale via fine-tuning, we pick a particular mutant by EPC in the second curriculum stage and visualize its learning curve throughout fine-tuning for all the environments, Grassland (Fig. 9d), Adversarial Battle (Fig. 9e) and Food Collection (Fig. 9f). The scores are computed in the same way as the stability analysis. By comparing to MADDPG and Att-MADDPG, which train policies from scratch, we can see that EPC starts learning with a much higher score, continues to improve during fine-tuning and quickly converges to a better solution. Note that all baselines are in fact trained much longer. The full convergence curves are in App. D.1.
217
+
218
+ Generalization: We investigate whether the learned policies can generalize to a different test environment with even a larger scale than the training ones. To do so, we take the best polices trained by different methods on the largest population and directly apply these policies to a new environment with a doubled population by self-cloning. We evaluate in all the environments with EPC, vanilla-PC and Att-MADDPG and measure the normalized scores of different methods, which is computed in the same way as the fitness score. In all cases, we observe a large advantage of EPC over the other two methods, indicating the better generalization ability for policies trained by EPC.
219
+
220
+ ![](images/10de18c8599cba73aa5c05edfdbffa4e5cffd36cb0afcd13096be8716675afd4.jpg)
221
+ Figure 9: Ablation analysis on the second curriculum stage in all the games over 3 different training seeds. Stability comparison (top) in (a), (b) and (c): We observe EPC has much less variance comparing to vanilla-PC. Normalized scores during fine-tuning (bottom) in (d), (e) and (f): This illustrates that EPC can successfully transfer the agents trained with a smaller population to a larger population by fine-tuning.
222
+
223
+ ![](images/a6e38641f77a8b32c6b9abb93d8524efa1b23b0448d5ab5582bc0f09f2730fb0.jpg)
224
+ Figure 10: Environment Generalization: We take the agents trained on the largest scale and test on an environment with twice the population. We perform experiments on all the games and show that EPC also advances the agents’ generalizability.
225
+
226
+ # 6 CONCLUSION
227
+
228
+ In this paper, we propose to scale multi-agent reinforcement learning by using curriculum learning over the agent population with evolutionary selection. Our approach has shown significant improvements over baselines not only in the performance but also the training stability. Given these encouraging results on different environments, we believe our method is general and can potentially benefit scaling other MARL algorithms. We also hope that learning with a large population of agents can also lead to the emergence of swarm intelligence in environments with simple rules in the future.
229
+
230
+ # ACKNOWLEDGMENT
231
+
232
+ This research is supported in part by ONR MURI N000141612007, ONR Young Investigator to AG. FF is also supported in part by NSF grant IIS-1850477, a research grant from Lockheed Martin, and the U.S. Army Combat Capabilities Development Command Army Research Laboratory Cooperative Agreement Number W911NF-13-2-0045 (ARL Cyber Security CRA). 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 funding agencies. We also sincerely thank Bowen Baker and Ingmar Kanitscheider from OpenAI for valuable suggestions and comments.
233
+
234
+ # REFERENCES
235
+
236
+ Thomas Back and Hans-Paul Schwefel. An overview of evolutionary algorithms for parameter optimization. ¨ Evolutionary computation, 1(1):1–23, 1993.
237
+
238
+ Bowen Baker, Ingmar Kanitscheider, Todor Markov, Yi Wu, Glenn Powell, Bob McGrew, and Igor Mordatch Emergent tool use from multi-agent autocurricula. arXiv preprint arXiv:1909.07528, 2019.
239
+
240
+ Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. In ICLR, 2018.
241
+
242
+ Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ ICML, pp. 41–48. ACM, 2009.
243
+
244
+ Edoardo Conti, Vashisht Madhavan, Felipe Petroski Such, Joel Lehman, Kenneth Stanley, and Jeff Clune. Improving exploration in evolution strategies for deep reinforcement learning via a population of noveltyseeking agents. In NeurIPS, pp. 5027–5038, 2018.
245
+
246
+ Wojciech Marian Czarnecki, Siddhant M Jayakumar, Max Jaderberg, Leonard Hasenclever, Yee Whye Teh, Nicolas Heess, Simon Osindero, and Razvan Pascanu. Mix & match agent curricula for reinforcement learning. In ICML, pp. 1095–1103, 2018.
247
+
248
+ Yan Duan, Marcin Andrychowicz, Bradly Stadie, Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. In NIPS, pp. 1087–1098, 2017.
249
+
250
+ Jeffrey L Elman. Learning and development in neural networks: The importance of starting small. Cognition, 48(1):71–99, 1993.
251
+
252
+ Carlos Florensa, David Held, Markus Wulfmeier, Michael Zhang, and Pieter Abbeel. Reverse curriculum generation for reinforcement learning. In CoRL, pp. 482–495, 2017.
253
+
254
+ Jakob Foerster, Ioannis Alexandros Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate with deep multi-agent reinforcement learning. In NIPS, pp. 2137–2145, 2016.
255
+
256
+ Jakob N Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. In AAAI, 2018.
257
+
258
+ Tanmay Gangwani and Jian Peng. Genetic policy optimization. In ICLR, 2018.
259
+
260
+ Matthew Hausknecht and Peter Stone. Deep reinforcement learning in parameterized action space. arXiv preprint arXiv:1511.04143, 2015.
261
+
262
+ He He, Jordan Boyd-Graber, Kevin Kwok, and Hal Daume III. Opponent modeling in deep reinforcement ´ learning. In International Conference on Machine Learning, pp. 1804–1813, 2016.
263
+
264
+ Rein Houthooft, Yuhua Chen, Phillip Isola, Bradly Stadie, Filip Wolski, OpenAI Jonathan Ho, and Pieter Abbeel. Evolved policy gradients. In NeurIPS, pp. 5400–5409, 2018.
265
+
266
+ Shariq Iqbal and Fei Sha. Actor-attention-critic for multi-agent reinforcement learning. In ICML, pp. 2961–2970, 2019.
267
+
268
+ Max Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M Czarnecki, Jeff Donahue, Ali Razavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, et al. Population based training of neural networks. arXiv preprint arXiv:1711.09846, 2017.
269
+
270
+ Max Jaderberg, Wojciech M Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garcia Castaneda, Charles Beattie, Neil C Rabinowitz, Ari S Morcos, Avraham Ruderman, et al. Human-level performance in first-person multiplayer games with population-based deep reinforcement learning. arXiv preprint arXiv:1807.01281, 2018.
271
+
272
+ Jiechuan Jiang and Zongqing Lu. Learning attentional communication for multi-agent cooperation. In NeurIPS, 2018.
273
+
274
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
275
+
276
+ Shauharda Khadka and Kagan Tumer. Evolution-guided policy gradient in reinforcement learning. In NeurIPS, pp. 1188–1200, 2018.
277
+
278
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research, 17(1):1334–1373, 2016.
279
+
280
+ Kaixiang Lin, Renyu Zhao, Zhe Xu, and Jiayu Zhou. Efficient large-scale fleet management via multi-agent deep reinforcement learning. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1774–1783. ACM, 2018.
281
+
282
+ Michael L Littman. Markov games as a framework for multi-agent reinforcement learning. In ICML, volume 157, pp. 157–163, 1994.
283
+
284
+ Siqi Liu, Guy Lever, Nicholas Heess, Josh Merel, Saran Tunyasuvunakool, and Thore Graepel. Emergent coordination through competition. In ICLR, 2019.
285
+
286
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. NIPS, 2017.
287
+
288
+ Aleksandra Malysheva, Tegg Taekyong Sung, Chae-Bong Sohn, Daniel Kudenko, and Aleksei Shpilman. Deep multi-agent reinforcement learning with relevance graphs. arXiv preprint arXiv:1811.12557, 2018.
289
+
290
+ Patrick Meier. Digital humanitarians: how big data is changing the face of humanitarian response. Routledge, 2015.
291
+
292
+ 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.
293
+
294
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. In AAAI, 2018.
295
+
296
+ Adithyavairavan Murali, Lerrel Pinto, Dhiraj Gandhi, and Abhinav Gupta. Cassl: Curriculum accelerated self-supervised learning. In ICRA, pp. 6453–6460. IEEE, 2018.
297
+
298
+ OpenAI. OpenAI Five. https://blog.openai.com/openai-five/, 2018.
299
+
300
+ Liviu Panait and Sean Luke. Cooperative multi-agent learning: The state of the art. AAMAS, 11(3):387–434, 2005.
301
+
302
+ Peng Peng, Quan Yuan, Ying Wen, Yaodong Yang, Zhenkun Tang, Haitao Long, and Jun Wang. Multiagent bidirectionally-coordinated nets for learning to play starcraft combat games. arXiv preprint arXiv:1703.10069, 2, 2017.
303
+
304
+ Tim Salimans, Jonathan Ho, Xi Chen, Szymon Sidor, and Ilya Sutskever. Evolution strategies as a scalable alternative to reinforcement learning. arXiv preprint arXiv:1703.03864, 2017.
305
+
306
+ Yoav Shoham, Rob Powers, and Trond Grenager. Multi-agent reinforcement learning: a critical survey. Web manuscript, 2003.
307
+
308
+ David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In ICML, pp. 387–395, 2014.
309
+
310
+ Joseph Suarez, Yilun Du, Phillip Isola, and Igor Mordatch. Neural mmo: A massively multiagent game environment for training and evaluating intelligent agents. arXiv preprint arXiv:1903.00784, 2019.
311
+
312
+ Sainbayar Sukhbaatar, Rob Fergus, et al. Learning multiagent communication with backpropagation. In NIPS, pp. 2244–2252, 2016.
313
+
314
+ Sainbayar Sukhbaatar, Zeming Lin, Ilya Kostrikov, Gabriel Synnaeve, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. arXiv preprint arXiv:1703.05407, 2017.
315
+
316
+ 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, pp. 5998–6008, 2017.
317
+
318
+ Rui Wang, Joel Lehman, Jeff Clune, and Kenneth O Stanley. Paired open-ended trailblazer (poet): Endlessly generating increasingly complex and diverse learning environments and their solutions. arXiv preprint arXiv:1901.01753, 2019.
319
+
320
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018.
321
+
322
+ Michael P Wellman, Daniel M Reeves, Kevin M Lochner, Shih-Fen Cheng, and Rahul Suri. Approximate strategic reasoning through hierarchical reduction of large symmetric games. In AAAI, 2005.
323
+
324
+ Mason Wright, Yongzhao Wang, and Michael P Wellman. Iterated deep reinforcement learning in games: history-aware training for improved stability. In Proceedings of the 2019 ACM Conference on Economics and Computation, pp. 617–636. ACM, 2019.
325
+
326
+ Cathy Wu, Aboudy Kreidieh, Eugene Vinitsky, and Alexandre M Bayen. Emergent behaviors in mixed-autonomy traffic. In CoRL, pp. 398–407, 2017.
327
+ Yi Wu, Yuxin Wu, Georgia Gkioxari, and Yuandong Tian. Building generalizable agents with a realistic and rich 3d environment. arXiv preprint arXiv:1801.02209, 2018.
328
+ Yuxin Wu and Yuandong Tian. Training agent for first-person shooter game with actor-critic curriculum learning. In ICLR, 2016.
329
+ Wei Yang, Xiaolong Wang, Ali Farhadi, Abhinav Gupta, and Roozbeh Mottaghi. Visual semantic navigation using scene priors. In ICLR, 2019.
330
+ Yaodong Yang, Rui Luo, Minne Li, Ming Zhou, Weinan Zhang, and Jun Wang. Mean field multi-agent reinforcement learning. In ICML, pp. 5567–5576, 2018.
331
+ Vinicius Zambaldi, David Raposo, Adam Santoro, Victor Bapst, Yujia Li, Igor Babuschkin, Karl Tuyls, David Reichert, Timothy Lillicrap, Edward Lockhart, et al. Relational deep reinforcement learning. arXiv preprint arXiv:1806.01830, 2018.
332
+ 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, pp. 3357–3364. IEEE, 2017.
333
+
334
+ # A ENVIRONMENT DETAILS
335
+
336
+ In the Grassland game, sheep gets $+ 2$ reward when he eats the grass, -5 reward when eaten by wolf. The wolf get $^ { + 5 }$ reward when eats a sheep. We also shape the reward by distance, sheep will get less negative reward when it is closer to grass and wolf will get less negative reward when it is closer to sheep. This game is adapted from the original Predator-prey game in the MADDPG paper (Lowe et al., 2017) by introducing grass and allowing agent to die.
337
+
338
+ In the Adversarial Battle game, agent will get $+ 1$ reward when he eats the food, $- 6$ reward when killed by other agents. If $N$ agents kill an enemy, they will be rewarded $+ 6 / N$ . We shape the reward by distance. Agent will receive less negative rewards when it is closer to other agents and grass. We want to encourage collision within agents and also will be easier for them to learn to eat. This game is adapted from the mean-field MARL paper (Yang et al., 2018) by converting it from a grid world to particle-world, introducing food and only allowing 2-agent cooperative killing.
339
+
340
+ In the Food Collection game, there are $N$ agents and $N$ food locations. Each agent will get a shared $+ 6 / N$ reward per timestep when one food is occupied by any agent. If one agent gets collision with another, all of the agents will get a punish of $- 6 / N$ . We shape the reward by distance. Agents will receive less negative rewards when it gets closer to the food. Since the number of agents and food are equal, we want to avoid the collision within agents and let the agents to learn to occupy as many food as possible. This is exactly the same game as the Cooperative Navigation game in the MADDPG paper. We slightly change the reward function to ensure it is bounded w.r.t. arbitrary number of agents.
341
+
342
+ We use the normalized reward as the score during evaluation. For a particular game with a particular scale, we first collect the reward for each type of agents, namely the average reward of each individual of that type without the shaped rewards. Then we re-scale the collected rewards by considering the lowest reward among all methods as score 0 and highest reward as score 1.
343
+
344
+ # B TRAINING DETAILS
345
+
346
+ We follow all the hyper-parameters in the original MADDPG paper (Lowe et al., 2017) for both EPC and all the baseline methods considered. Particularly, we use the Adam optimizer with learning rate 0.01, $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ and $\varepsilon = 1 0 ^ { - 8 }$ across all experiments. $\tau = 0 . 0 1$ is set for target network update and $\gamma = 0 . 9 5$ is used as discount factor. We also use a replay buffer of size $1 0 ^ { 6 }$ and we update the network parameters after every 100 samples. The batch size is 1024. All the baseline methods are trained for a number of episodes that equals the accumulative number of episodes that EPC has taken.
347
+
348
+ We set $K \ : = \ : 2$ in all the games during training except that $K \ : = \ : 3$ in the food collection game due to computational constraints. During EPC training, in the grassland game, we train the scale of 3 sheep 2 wolf for 100000 episodes. We train another 50000 episodes every time the agents number doubles. In the adversarial battle game and food collection game, we train the first scale for 50000 episodes. We train another 20000 episodes every time the agents number doubles.
349
+
350
+ In the grassland game, the entity types are the agent itself, other sheep, other wolf and food. We thus have four types of entity encoders for each of those entity types. In the adversarial battle game, Similar to grassland game, the entity types are agent itself, other teammates, enemies and food. We also have four types of entity encoders for each of those entity types. Since there is only one group in the food collection game, the entity types are agent itself, other teammates and food. We thus have three entity encoders in our network.
351
+
352
+ # C EVALUATION DETAILS
353
+
354
+ To evaluate the agents trained in the environment with $\Omega = 2$ , we make two roles of agents trained with different approaches compete against each other. Each competition is simulated for 10000 episodes. The average normalized reward over the 10000 episodes will be used as the competition score for each side. Note that in our experiments, we let all the methods compete against our EPC approach for evaluation. For adversarial battle game, we take the average score of two teams as the model’s final evaluation score, since the two teams in this game are completely symmetric.
355
+
356
+ In the food collection game, since there is only one role, we simply simulate the model for 10000 episodes. The average normalized reward over the 10000 episodes will be used as the score of the model.
357
+
358
+ # D ADDITIONAL DETAILS ON EXPERIMENT RESULTS
359
+
360
+ # D.1 FULL TRAINING CURVES FOR BASELINES
361
+
362
+ All the baseline methods are trained for a number of episodes that equals the accumulative number of episodes that EPC has taken.
363
+
364
+ The purpose of Figure 9e,9e,9f is simply showing the transfer performance, i.e., the initialization produced by EPC from the previous stage is effective and can indeed leverage past experiences to warm-start. The $\mathbf { X }$ -axis of
365
+
366
+ the plot was shrunk for visualization purpose. Here we illustrate the complete convergence curve of baselines, i.e., ATT-MADDPG and MADDPG, in Figure 11a,11b,11c for the 3 games respective. Although Att-MADDPG takes a much longer time to learn, its performance is still far worse than EPC.
367
+
368
+ ![](images/7ad0517d06250593c39fc1f7fe0c29605484bee30b01e016035364f31af19d2c.jpg)
369
+ Figure 11: Full learning curves on the second curriculum stage in all the games. EPC fine-tunes the policies obtained from the previous stage while MADDPG and Att-MADDPG are trained from scratch for a much longer time.
370
+
371
+ # D.2 RAW REWARD NUMBERS OF EVALUATION RESULTS
372
+
373
+ In this section, we provide the actual rewards without normalization when comparing all the baselines with EPC.
374
+ These scores are corresponding to the histograms reported in Figure 6a, 7, 8.
375
+
376
+ Grassland game, wolf rewards, corresponding to wolf in Figure 6a:
377
+
378
+ <table><tr><td rowspan=1 colspan=1>scale</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>3-2</td><td rowspan=1 colspan=1>0.596</td><td rowspan=1 colspan=1>0.877</td><td rowspan=1 colspan=1>0.8145</td><td rowspan=1 colspan=1>0.8145</td><td rowspan=1 colspan=1>1.407</td></tr><tr><td rowspan=1 colspan=1>6-4</td><td rowspan=1 colspan=1>3.7735</td><td rowspan=1 colspan=1>0.9515</td><td rowspan=1 colspan=1>2.5905</td><td rowspan=1 colspan=1>2.001</td><td rowspan=1 colspan=1>3.7735</td></tr><tr><td rowspan=1 colspan=1>12-8</td><td rowspan=1 colspan=1>3.1915</td><td rowspan=1 colspan=1>3.385</td><td rowspan=1 colspan=1>10.2125</td><td rowspan=1 colspan=1>9.974</td><td rowspan=1 colspan=1>14.377</td></tr><tr><td rowspan=1 colspan=1>24-16</td><td rowspan=1 colspan=1>14.482</td><td rowspan=1 colspan=1>18.272</td><td rowspan=1 colspan=1>32.8945</td><td rowspan=1 colspan=1>47.6365</td><td rowspan=1 colspan=1>61.4245</td></tr></table>
379
+
380
+ Grassland game, sheep rewards, corresponding to sheep in Figure 6a:
381
+
382
+ <table><tr><td rowspan=1 colspan=1>scale</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>3-2</td><td rowspan=1 colspan=1>-4.0026</td><td rowspan=1 colspan=1>-3.9947</td><td rowspan=1 colspan=1>2.66</td><td rowspan=1 colspan=1>2.66</td><td rowspan=1 colspan=1>8.3846</td></tr><tr><td rowspan=1 colspan=1>6-4</td><td rowspan=1 colspan=1>-20.2494</td><td rowspan=1 colspan=1>-20.5107</td><td rowspan=1 colspan=1>0.9892</td><td rowspan=1 colspan=1>1.1804</td><td rowspan=1 colspan=1>10.1455</td></tr><tr><td rowspan=1 colspan=1>12-8</td><td rowspan=1 colspan=1>-52.863</td><td rowspan=1 colspan=1>-53.6338</td><td rowspan=1 colspan=1>-42.4801</td><td rowspan=1 colspan=1>-11.3736</td><td rowspan=1 colspan=1>3.3774</td></tr><tr><td rowspan=1 colspan=1>24-16</td><td rowspan=1 colspan=1>-119.1327</td><td rowspan=1 colspan=1>-118.5668</td><td rowspan=1 colspan=1>-111.0656</td><td rowspan=1 colspan=1>-70.1981</td><td rowspan=1 colspan=1>-44.1031</td></tr></table>
383
+
384
+ Adversarial Battle game, rewards of team 1, corresponding to Figure 7:
385
+
386
+ Food Collection game, team rewards, corresponding to Figure 8:
387
+
388
+ <table><tr><td rowspan=1 colspan=1>scale</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>4-4</td><td rowspan=1 colspan=1>7.51555</td><td rowspan=1 colspan=1>5.81165</td><td rowspan=1 colspan=1>22.6357</td><td rowspan=1 colspan=1>22.6357</td><td rowspan=1 colspan=1>26.86355</td></tr><tr><td rowspan=1 colspan=1>8-8</td><td rowspan=1 colspan=1>0.6692</td><td rowspan=1 colspan=1>-0.58115</td><td rowspan=1 colspan=1>43.7801</td><td rowspan=1 colspan=1>46.89595</td><td rowspan=1 colspan=1>65.75585</td></tr><tr><td rowspan=1 colspan=1>16-16</td><td rowspan=1 colspan=1>-46.6398</td><td rowspan=1 colspan=1>-35.5978</td><td rowspan=1 colspan=1>28.8336</td><td rowspan=1 colspan=1>109.4406</td><td rowspan=1 colspan=1>189.69775</td></tr></table>
389
+
390
+ <table><tr><td rowspan=1 colspan=1>scale</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>55.06</td><td rowspan=1 colspan=1>42.74</td><td rowspan=1 colspan=1>61.6488</td><td rowspan=1 colspan=1>61.6488</td><td rowspan=1 colspan=1>64.822</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>17.01</td><td rowspan=1 colspan=1>3.37</td><td rowspan=1 colspan=1>49.3626</td><td rowspan=1 colspan=1>58.0014</td><td rowspan=1 colspan=1>63.7004</td></tr><tr><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>6.32</td><td rowspan=1 colspan=1>6.735</td><td rowspan=1 colspan=1>49.45755</td><td rowspan=1 colspan=1>52.3625</td><td rowspan=1 colspan=1>59.54</td></tr><tr><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>10.346075</td><td rowspan=1 colspan=1>7.830975</td><td rowspan=1 colspan=1>33.435</td><td rowspan=1 colspan=1>49.998025</td><td rowspan=1 colspan=1>59.47035</td></tr></table>
391
+
392
+ # D.3 PAIRWISE COMPETITION RESULTS BETWEEN ALL METHODS IN COMPETITIVE GAMES
393
+
394
+ For visualization purpose, we only illustrate the scores of the competitions between baselines and EPC in the main paper. Here we provide the complete competition rewards between every pair of methods in both Grassland and Adversarial Battle with the largest population of agents as follows.
395
+
396
+ Here show the wolf rewards in Grassland with scale 24-16. For wolves trained by each approach, we compare them against the sheep by all the methods. EPC wolves always have the highest rewards as in the bottom row. Correspondingly, when different wolves compete against EPC sheep, they always obtain the lowest rewards as in the rightmost column.
397
+
398
+ <table><tr><td rowspan=1 colspan=1>sheepwolf</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>66.914</td><td rowspan=1 colspan=1>67.0945</td><td rowspan=1 colspan=1>66.34</td><td rowspan=1 colspan=1>23.048</td><td rowspan=1 colspan=1>14.482</td></tr><tr><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>75.7655</td><td rowspan=1 colspan=1>74.23</td><td rowspan=1 colspan=1>74.7375</td><td rowspan=1 colspan=1>28.3705</td><td rowspan=1 colspan=1>18.272</td></tr><tr><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>103.22</td><td rowspan=1 colspan=1>103.326</td><td rowspan=1 colspan=1>98.07</td><td rowspan=1 colspan=1>49.557</td><td rowspan=1 colspan=1>32.8945</td></tr><tr><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>110.333</td><td rowspan=1 colspan=1>111.3735</td><td rowspan=1 colspan=1>101.8975</td><td rowspan=1 colspan=1>64.53</td><td rowspan=1 colspan=1>47.6365</td></tr><tr><td rowspan=1 colspan=1>EPC</td><td rowspan=1 colspan=1>120.9025</td><td rowspan=1 colspan=1>121.4325</td><td rowspan=1 colspan=1>115.956</td><td rowspan=1 colspan=1>82.381</td><td rowspan=1 colspan=1>61.4245</td></tr></table>
399
+
400
+ Here show the sheep rewards in Grassland with scale 24-16. For sheep trained by each approach, we compete them against the all different wolves. EPC sheep always have the highest rewards as in the last row. Correspondingly, when competing different sheep against EPC wolves, the rewards are always the lowest as in the rightmost column.
401
+
402
+ <table><tr><td rowspan=1 colspan=1>wolfsheep</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>-63.5096</td><td rowspan=1 colspan=1>-72.5443</td><td rowspan=1 colspan=1>-100.4636</td><td rowspan=1 colspan=1>-107.825</td><td rowspan=1 colspan=1>-119.1327</td></tr><tr><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>-63.7089</td><td rowspan=1 colspan=1>-71.0714</td><td rowspan=1 colspan=1>-100.6304</td><td rowspan=1 colspan=1>-108.8917</td><td rowspan=1 colspan=1>-118.5668</td></tr><tr><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>-62.9416</td><td rowspan=1 colspan=1>-71.3339</td><td rowspan=1 colspan=1>-95.0522</td><td rowspan=1 colspan=1>-99.1207</td><td rowspan=1 colspan=1>-111.0656</td></tr><tr><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>-5.7086</td><td rowspan=1 colspan=1>-7.8011</td><td rowspan=1 colspan=1>-31.9936</td><td rowspan=1 colspan=1>-49.5186</td><td rowspan=1 colspan=1>-70.1981</td></tr><tr><td rowspan=1 colspan=1>EPC</td><td rowspan=1 colspan=1>9.2135</td><td rowspan=1 colspan=1>10.5892</td><td rowspan=1 colspan=1>-6.9846</td><td rowspan=1 colspan=1>-27.3475</td><td rowspan=1 colspan=1>-44.1031</td></tr></table>
403
+
404
+ Here we show the rewards of team 1 in Adversarial Battle with scale 16-16. For agents trained by each approach, we compare them as team 1 against all different methods as team 2. When EPC agents as team 1, no matter which opponent is, they always get the highest rewards as in the last row. When other methods compete against EPC, the obtained rewards are always the lowest as in the rightmost column.
405
+
406
+ <table><tr><td rowspan=1 colspan=1>comparedreported</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>61.4555</td><td rowspan=1 colspan=1>17.1591</td><td rowspan=1 colspan=1>2.8033</td><td rowspan=1 colspan=1>-29.9242</td><td rowspan=1 colspan=1>-46.6398</td></tr><tr><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>104.41315</td><td rowspan=1 colspan=1>59.01315</td><td rowspan=1 colspan=1>27.9004</td><td rowspan=1 colspan=1>11.1891</td><td rowspan=1 colspan=1>-35.5978</td></tr><tr><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>146.9829</td><td rowspan=1 colspan=1>117.3804</td><td rowspan=1 colspan=1>81.702</td><td rowspan=1 colspan=1>18.57425</td><td rowspan=1 colspan=1>28.8336</td></tr><tr><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>202.9163</td><td rowspan=1 colspan=1>155.2805</td><td rowspan=1 colspan=1>174.91965</td><td rowspan=1 colspan=1>123.7212</td><td rowspan=1 colspan=1>109.4406</td></tr><tr><td rowspan=1 colspan=1>EPC</td><td rowspan=1 colspan=1>339.63255</td><td rowspan=1 colspan=1>318.3223</td><td rowspan=1 colspan=1>256.8464</td><td rowspan=1 colspan=1>198.3621</td><td rowspan=1 colspan=1>189.69775</td></tr></table>
407
+
408
+ # D.4 VARIANCE OF PERFORMANCE EVALUATIONS
409
+
410
+ We present the performance of all approaches in all three games with the largest scale. We train all the approaches with 3 different seeds and show the normalized scores with variance as following. We can see that EPC not only gives better results but also much smaller variance.
411
+
412
+ E ADDITIONAL EXPERIMENTS ON THE ORIGINAL PREDATOR-PREY GAME Grassland is adapted from the Predator-prey game introduced by the original MADDPG paper (Lowe et al., 2017). To further validate our empirical results, we additionally study the performances of different algorithms on the unmodified Predator-prey game as follows.
413
+
414
+ ![](images/e0d570ad33e4661bc0897105082828623035242e35e446afc2e07eff4b7d26c9.jpg)
415
+ (a) Normalized scores with variances in Grassland in scale 24-16
416
+
417
+ ![](images/5636794dc9508a62df3bdc91c579a2bd12b03d89f153f9458ba4899e112580e0.jpg)
418
+ (b) Normalized scores with variances in Adversarial battle in scale 16-16
419
+
420
+ ![](images/6e5045416ab4949e110acc38daa49e0ea899f2e5e133e823194214af5c1c67e3.jpg)
421
+ (c) Normalized scores with variances in Food Collection with 24 agents
422
+
423
+ We first report the normalized score in Fig. 13 by comparing all the methods against EPC. EPC is consistently better than all methods in all the scales.
424
+
425
+ ![](images/9da201823fa2e419fb4a5093d6efce0dd5da78e7e7bcb0cceceefa37b0d18294.jpg)
426
+ Figure 13: Normalized scores in the original Predator-prey game
427
+
428
+ Besides, we also report the raw reward numbers when competing against EPC. Since the Predator-prey game is a zero-sum game, we simply report the predator rewards (the prey reward is exactly the negative value).
429
+
430
+ <table><tr><td rowspan=1 colspan=1>scale</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>3-2</td><td rowspan=1 colspan=1>10.405</td><td rowspan=1 colspan=1>7.39</td><td rowspan=1 colspan=1>8.675</td><td rowspan=1 colspan=1>8.675</td><td rowspan=1 colspan=1>12.662</td></tr><tr><td rowspan=1 colspan=1>6-4</td><td rowspan=1 colspan=1>31.458</td><td rowspan=1 colspan=1>25.529</td><td rowspan=1 colspan=1>31.747</td><td rowspan=1 colspan=1>45.155</td><td rowspan=1 colspan=1>54.546</td></tr><tr><td rowspan=1 colspan=1>12-8</td><td rowspan=1 colspan=1>74.939</td><td rowspan=1 colspan=1>64.377</td><td rowspan=1 colspan=1>133.261</td><td rowspan=1 colspan=1>200.638</td><td rowspan=1 colspan=1>214.328</td></tr></table>
431
+
432
+ Furthermore, we also demonstrate the results of full pairwise competition between every two methods for scale 12-8 below. Consistently, we can see that EPC predators always have the highest scores as in the last row. When competing against EPC prey, the lowest rewards are observed.
433
+
434
+ <table><tr><td rowspan=1 colspan=1>preypredator</td><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>EPC</td></tr><tr><td rowspan=1 colspan=1>MADDPG</td><td rowspan=1 colspan=1>229.887</td><td rowspan=1 colspan=1>249.4</td><td rowspan=1 colspan=1>247.423</td><td rowspan=1 colspan=1>122.878</td><td rowspan=1 colspan=1>74.939</td></tr><tr><td rowspan=1 colspan=1>mean-field</td><td rowspan=1 colspan=1>207.022</td><td rowspan=1 colspan=1>210.838</td><td rowspan=1 colspan=1>228.469</td><td rowspan=1 colspan=1>107.811</td><td rowspan=1 colspan=1>64.377</td></tr><tr><td rowspan=1 colspan=1>Att-MADDPG</td><td rowspan=1 colspan=1>569.862</td><td rowspan=1 colspan=1>532.611</td><td rowspan=1 colspan=1>373.979</td><td rowspan=1 colspan=1>204.743</td><td rowspan=1 colspan=1>133.261</td></tr><tr><td rowspan=1 colspan=1>Vanilla-PC</td><td rowspan=1 colspan=1>758.293</td><td rowspan=1 colspan=1>737.067</td><td rowspan=1 colspan=1>521.486</td><td rowspan=1 colspan=1>303.86</td><td rowspan=1 colspan=1>200.638</td></tr><tr><td rowspan=1 colspan=1>EPC</td><td rowspan=1 colspan=1>827.298</td><td rowspan=1 colspan=1>764.417</td><td rowspan=1 colspan=1>519.319</td><td rowspan=1 colspan=1>299.505</td><td rowspan=1 colspan=1>214.328</td></tr></table>
md/train/SJzRZ-WCZ/SJzRZ-WCZ.md ADDED
@@ -0,0 +1,439 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LATENT SPACE ODDITY: ON THE CURVATURE OF DEEP GENERATIVE MODELS
2
+
3
+ Georgios Arvanitidis, Lars Kai Hansen, Søren Hauberg Technical University of Denmark, Section for Cognitive Systems {gear,lkai,sohau}@dtu.dk
4
+
5
+ # ABSTRACT
6
+
7
+ Deep generative models provide a systematic way to learn nonlinear data distributions through a set of latent variables and a nonlinear “generator” function that maps latent points into the input space. The nonlinearity of the generator implies that the latent space gives a distorted view of the input space. Under mild conditions, we show that this distortion can be characterized by a stochastic Riemannian metric, and we demonstrate that distances and interpolants are significantly improved under this metric. This in turn improves probability distributions, sampling algorithms and clustering in the latent space. Our geometric analysis further reveals that current generators provide poor variance estimates and we propose a new generator architecture with vastly improved variance estimates. Results are demonstrated on convolutional and fully connected variational autoencoders, but the formalism easily generalizes to other deep generative models.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep generative models (Goodfellow et al., 2014; Kingma & Welling, 2014; Rezende et al., 2014) model the data distribution of observations $\mathbf { x } \in \mathcal { X }$ through corresponding latent variables $\mathbf { z } \in { \mathcal { Z } }$ and a stochastic generator function $f : { \mathcal { Z } } \to { \mathcal { X } }$ as
12
+
13
+ $$
14
+ \mathbf { x } = f ( \mathbf { z } ) .
15
+ $$
16
+
17
+ Using reasonably low-dimensional latent variables and highly flexible generator functions allows these models to efficiently represent a useful distribution over the underlying data manifold. These approaches have recently attracted a lot of attention, as deep neural networks are suitable generators which lead to the impressive performance of current variational autoencoders (VAEs) (Kingma & Welling, 2014) and generative adversarial networks (GANs) (Goodfellow et al., 2014).
18
+
19
+ Consider the left panel of Fig. 1, which shows the latent representations of digits 0 and 1 from MNIST under a VAE. Three latent points are highlighted: one point (A) far away from the class boundary, and two points (B, C) near the boundary, but on opposite sides. Points B and C near the boundary seem to be very close to each other, while the third is far away from the others. Intuitively, we would hope that points from the same class (A and B) are closer to each other than to members of other classes (C), but this is seemingly not the case. In this paper, we argue this seemed conclusion is incorrect and only due to a misinterpretation of the latent space — in fact points $A$ and $B$ are closer to each other than to $c$ in the latent representation. Correcting this misinterpretation not only improves our understanding of generative models, but also improves interpolations, clusterings, latent probability distributions, sampling algorithms, interpretability and more.
20
+
21
+ In general, latent space distances lack physical units (making them difficult to interpret) and are sensitive to specifics of the underlying neural nets. It is therefore more robust to consider infinitesimal distances along the data manifold in the input space. Let $\mathbf { z }$ be a latent point and let $\Delta \mathbf { z } _ { 1 }$ and $\Delta { \bf z } _ { 2 }$ be infinitesimals, then we can compute the squared distance
22
+
23
+ $$
24
+ \left\| f ( \mathbf { z } + \Delta \mathbf { z } _ { 1 } ) - f ( \mathbf { z } + \Delta \mathbf { z } _ { 2 } ) \right\| _ { 2 } ^ { 2 } = ( \Delta \mathbf { z } _ { 1 } - \Delta \mathbf { z } _ { 2 } ) ^ { \mathsf { T } } \left( \mathbf { J } _ { \mathbf { z } } ^ { \mathsf { T } } \mathbf { J } _ { \mathbf { z } } \right) ( \Delta \mathbf { z } _ { 1 } - \Delta \mathbf { z } _ { 2 } ) , \quad \mathbf { J } _ { \mathbf { z } } = \frac { \partial f } { \partial \mathbf { z } } \bigg | _ { \mathbf { z } = \mathbf { z } } ,
25
+ $$
26
+
27
+ using Taylor’s Theorem. This implies that the natural distance function in $\mathcal { Z }$ changes locally as it is governed by the local Jacobian. Mathematically, the latent space should not then be seen as a linear Euclidean space, but rather as a curved space. The right panel of Fig. 1 provides an example of the implications of this curvature. The figure shows synthetic data from two classes, and the corresponding latent representation of the data. The background color of the latent space corresponds to $\mathrm { \sqrt { d e t } } ( \mathbf { J _ { z } ^ { \mathsf { T } } } \mathbf { J _ { z } } )$ , which can be seen as a measure of the local distortion of the latent space. We interpolate two points from the same class by walking along the connecting straight line (red); in the right panel, we show points along this straight line which have been mapped by the generator to the input space. Since the generator defines a surface in the input space, we can alternatively seek the shortest curve along this surface that connects the two points; this is perhaps the most natural choice of interpolant. We show this shortest curve in green. From the center panel it is evident that the natural interpolant is rather different from the straight line. This is due to the distortion of the latent space, which is the topic of the present paper.
28
+
29
+ ![](images/4f6ab73930c0c558bca7cac815f1ab4cf01c5f356a658bc9c3f933e9ccea2d5e.jpg)
30
+ Figure 1: Left: An example of how latent space distances do not reflect actual data distances. Right: Shortest paths on the surface spanned by the generator do not correspond to straight lines in the latent space, as is assumed by the Euclidean metric.
31
+
32
+ Outline. In Sec. 2 we briefly present the VAE as a representative instance of generative models. In Sec. 3 we connect generative models with their underlying geometry, and in Sec. 4 we argue that a stochastic Riemannian metric is naturally induced in the latent space by the generator. This metric enables us to compute length-minimizing curves and corresponding distances. This analysis, however, reveals that the traditional variance approximations in VAEs are rather poor and misleading; we propose a solution in Sec. 4.1. In Sec. 5 we demonstrate how the resulting view of the latent space improves latent interpolations, gives rise to more meaningful latent distributions, clusterings and more. We discuss related work in Sec. 6 and conclude the paper with an outlook in Sec. 7.
33
+
34
+ # 2 THE VARIATIONAL AUTOENCODERS ACTING AS THE GENERATOR
35
+
36
+ The variational autoencoder (VAE) proposed by Kingma & Welling (2014) is a simple yet powerful generative model which consists of two parts: (1) an inference network or recognition network (encoder) learns the latent representation (codes) of the data in the input space $\chi = \mathbb { R } ^ { D }$ ; and (2) the generator (decoder) learns how to reconstruct the data from these latent space codes in $\mathcal { Z } = \mathbb { R } ^ { d }$ .
37
+
38
+ Formally, a prior distribution is defined for the latent representations $p ( \mathbf { z } ) = \mathcal { N } ( \mathbf { 0 } , \mathbb { I } _ { d } )$ , and there exists a mapping function $\mu _ { \theta } : \mathcal { Z } \to \mathcal { X }$ that generates a surface in $\mathcal { X }$ . Moreover, we assume that another function $\sigma _ { \theta } : \mathcal { Z } \to \mathbb { R } _ { + } ^ { D }$ captures the error (or uncertainty) between the actual data observation $\mathbf { x } \in \mathcal { X }$ and its reconstruction as $\mathbf { x } = \pmb { \mu } _ { \boldsymbol { \theta } } ( \mathbf { z } ) + \pmb { \sigma } _ { \boldsymbol { \theta } } \odot \pmb { \epsilon } ,$ , where $\epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbb { I } _ { D } )$ and $\odot$ is the Hadamard (element-wise) product. Then the likelihood is naturally defined as $p _ { \boldsymbol { \theta } } ( \mathbf { x } \mid \mathbf { z } ) =$ $\mathcal { N } ( \mathbf { x } \mid \pmb { \mu } _ { \boldsymbol { \theta } } ( \mathbf { z } ) , \mathbb { I } _ { D } \pmb { \sigma } _ { \boldsymbol { \theta } } ^ { 2 } ( \mathbf { z } ) )$ . The flexible functions $\mu _ { \theta }$ and $\pmb { \sigma } \theta$ are usually deep neural networks with parameters $\theta$ .
39
+
40
+ However, the corresponding posterior distribution $p _ { \theta } ( \mathbf { z } \mid \mathbf { x } )$ is unknown, as the marginal likelihood $p ( \mathbf { x } )$ is intractable. Hence, the posterior is approximated using a variational distribution $q _ { \phi } ( \mathbf { z } \mid \mathbf { x } ) =$ $\mathcal { N } ( \mathbf { z } \mid \pmb { \mu } _ { \phi } ( \mathbf { x } ) , \ \mathbb { I } _ { d } \pmb { \sigma } _ { \phi } ^ { 2 } ( \mathbf { x } ) )$ , where the functions $\mu _ { \phi } : \mathcal { X } \to \mathcal { Z }$ and $\pmb { \sigma } _ { \phi } : \mathcal { X } \mathbb { R } _ { + } ^ { d }$ are again deep neural networks with parameters $\phi$ . Since the generator (decoder) is a composition of linear maps and activation functions, its smoothness is based solely on the chosen activation functions.
41
+
42
+ The optimal parameters $\theta$ and $\phi$ are found by maximizing the evidence lower bound (ELBO) of the marginal likelihood $p ( \mathbf { x } )$ as
43
+
44
+ $$
45
+ \{ \theta ^ { * } , \phi ^ { * } \} = \underset { \theta , \phi } { \mathrm { a r g m a x } } \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } [ \log ( p _ { \theta } ( \mathbf { x } | \mathbf { z } ) ) ] - \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ) ,
46
+ $$
47
+
48
+ where the bound follows from Jensen’s inequality. The optimization is based on variations of gradient descent using the reparametrization trick (Kingma $\&$ Welling, 2014; Rezende et al., 2014). Further improvements have been proposed that provide more flexible posterior approximations (Rezende & Mohamed, 2015; Kingma et al., 2016) or tighter lower bound (Burda et al., 2016). In this paper, we consider the standard VAE for simplicity. The optimization problem in Eq. 3 is difficult since poor reconstructions by $\mu _ { \theta }$ can be explained by increasing the corresponding variance $\sigma _ { \theta } ^ { 2 }$ . A common trick, which we also follow, is to optimize $\mu _ { \theta }$ while keeping $\sigma _ { \theta } ^ { 2 }$ constant, and then finally optimize for the variance $\sigma _ { \theta } ^ { 2 }$ .
49
+
50
+ # 3 SURFACES AS THE FOUNDATION OF GENERATIVE MODELS
51
+
52
+ Mathematically, a deterministic generative model ${ \bf x } = f ( { \bf z } )$ can be seen as a surface model (Gauss, 1827) if the generator $f$ is sufficiently smooth. Here, we briefly review the basic concepts on surfaces, as they form the mathematical foundation of this work.
53
+
54
+ Intuitively, a surface is a smoothly-connected set of points embedded in $\mathcal { X }$ . When we want to make computations on a surface, it is often convenient to parametrize the surface by a low-dimensional (latent) variable $\mathbf { z }$ along with an appropriate function $f : { \mathcal { Z } } \to$ $\mathcal { X }$ . We let $d = \dim ( { \mathcal { Z } } )$ denote the intrinsic dimensionality of the surface, while $D \ = \ \dim ( { \mathcal { X } } )$ is the dimensionality of the input space. If we consider a smooth (latent) curve $\gamma _ { t } ^ { - } : [ \bar { 0 } , 1 ] \ \to \ \mathcal { Z }$ , then it has length $\begin{array} { r } { \int _ { 0 } ^ { 1 } \| \dot { \gamma } _ { t } \| \mathrm { d } t } \end{array}$ , where $\dot { \gamma } _ { t } = \mathrm { d } \gamma _ { t } / \mathrm { d } t$ denotes the velocity of the curve. In practice, the low-dimensional parametrization $\mathcal { Z }$ often lacks a principled meaningful metric, so we measure lengths in input space by mapping the curve through $f$ ,
55
+
56
+ ![](images/afdcd561f0b146263dabebec35098f3e72223fbc41c96c86ec27fc4a512e1cf6.jpg)
57
+ Figure 2: The Jacobian $\mathbf { J }$ of a nonlinear function $f$ provides a local basis in the input space, while $\sqrt { \operatorname* { d e t } ( \mathbf { J } \boldsymbol { \tau } \mathbf { J } ) }$ measures the volume of an infinitesimal region.
58
+
59
+ $$
60
+ \operatorname { L e n g t h } [ f ( \gamma _ { t } ) ] = \int _ { 0 } ^ { 1 } \left\| { \dot { f } } ( \gamma _ { t } ) \right\| _ { 2 } \mathrm { d } t = \int _ { 0 } ^ { 1 } \left\| \mathbf { J } _ { \gamma _ { t } } { \dot { \gamma } } _ { t } \right\| _ { 2 } \mathrm { d } t , \qquad \mathbf { J } _ { \gamma _ { t } } = \frac { \partial f } { \partial \mathbf { z } } \bigg | _ { \mathbf { z } = \gamma _ { t } }
61
+ $$
62
+
63
+ where the last step follows from the chain rule. This implies that the length of a curve $\gamma _ { t }$ along the surface can be computed directly in the latent space using the (locally defined) norm
64
+
65
+ $$
66
+ \| \mathbf { J } _ { \gamma } \dot { \gamma } \| _ { 2 } = \sqrt { ( \mathbf { J } _ { \gamma } \dot { \gamma } ) ^ { \intercal } ( \mathbf { J } _ { \gamma } \dot { \gamma } ) } = \sqrt { \dot { \gamma } ^ { \intercal } ( \mathbf { J } _ { \gamma } ^ { \intercal } \mathbf { J } _ { \gamma } ) \dot { \gamma } } = \sqrt { \dot { \gamma } ^ { \intercal } \mathbf { M } _ { \gamma } \dot { \gamma } } .
67
+ $$
68
+
69
+ Here, ${ \bf M } _ { \gamma } = { \bf J } _ { \gamma } ^ { \top } { \bf J } _ { \gamma }$ is a symmetric positive definite matrix, which acts akin to a local Mahalanobis distance measure. This gives rise to the definition of a Riemannian metric, which represents a smoothly changing inner product structure.
70
+
71
+ Definition 1. A Riemannian metric $\mathbf { M } : \mathcal { Z } \mathbb { R } ^ { d \times d }$ is a smooth function that assigns a symmetric positive definite matrix to any point in $\mathcal { Z }$ .
72
+
73
+ It should be clear that if the generator function $f$ is sufficiently smooth, then ${ { \bf { M } } _ { \gamma } }$ in Eq. 5 is a Riemannian metric.
74
+
75
+ When defining distances across a given surface, it is meaningful to seek the shortest curve connecting two points. Then a distance can be defined as the length of this curve. The shortest curve connecting points $\mathbf { z } _ { 0 }$ and $\mathbf { z } _ { 1 }$ is by (trivial) definition
76
+
77
+ $$
78
+ \boldsymbol \gamma _ { t } ^ { ( \mathrm { s h o r t e s t } ) } = \underset { \boldsymbol \gamma _ { t } } { \mathrm { a r g m i n L e n g t h } } [ f ( \boldsymbol \gamma _ { t } ) ] , \qquad \boldsymbol \gamma _ { 0 } = \mathbf z _ { 0 } , \boldsymbol \gamma _ { 1 } = \mathbf z _ { 1 } .
79
+ $$
80
+
81
+ A classic result of differential geometry (do Carmo, 1992) is that solutions to this optimization problem satisfy the following system of ordinary differential equations (ODEs)
82
+
83
+ $$
84
+ \ddot { \gamma } _ { t } = - \frac { 1 } { 2 } \mathbf { M } _ { \gamma _ { t } } ^ { - 1 } \left[ 2 \big ( \mathbb { I } _ { d } \otimes \dot { \gamma } _ { t } ^ { \intercal } \big ) \frac { \partial \mathrm { v e c } \big [ \mathbf { M } _ { \gamma _ { t } } \big ] } { \partial \gamma _ { t } } \dot { \gamma } _ { t } - \frac { \partial \mathrm { v e c } \big [ \mathbf { M } _ { \gamma _ { t } } \big ] ^ { \intercal } } { \partial \gamma _ { t } } ( \dot { \gamma } _ { t } \otimes \dot { \gamma } _ { t } ) \right] ,
85
+ $$
86
+
87
+ where vec[·] stacks the columns of a matrix into a vector and $\otimes$ is the Kronecker product. For completeness, we provide a derivation of this result in Appendix A. Shortest curves can then be computed by solving the ODEs numerically; our implementation uses $_ { \mathrm { b v p } 5 \mathrm { c } }$ from Matlab.
88
+
89
+ # 4 THE GEOMETRY OF STOCHASTIC GENERATORS
90
+
91
+ In the previous section, we considered deterministic generators $f$ to provide relevant background information. We now extend these results to the stochastic case; in particular we consider
92
+
93
+ $$
94
+ f ( \mathbf { z } ) = \pmb { \mu } ( \mathbf { z } ) + \pmb { \sigma } ( \mathbf { z } ) \odot \epsilon , \qquad \pmb { \mu } : \mathscr { Z } \pmb { \chi } , ~ \pmb { \sigma } : \mathscr { Z } \mathbb { R } _ { + } ^ { D } , ~ \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbb { I } _ { D } ) .
95
+ $$
96
+
97
+ This is the generator driving VAEs and related models. For our purposes, we will call $\mu ( \cdot )$ the mean function and $\sigma ^ { 2 } ( \cdot )$ the variance function.
98
+
99
+ Following the discussion from the previous section, it is natural to consider the Riemannian metric $\mathbf { M _ { z } } = \mathbf { J _ { z } ^ { \intercal } } \mathbf { J _ { z } }$ in the latent space. Since the generator is now stochastic, this metric also becomes stochastic, which complicates analysis. The following results, however, simplify matters.
100
+
101
+ Theorem 1. If the stochastic generator in Eq. 8 has mean and variance functions that are at least twice differentiable, then the expected metric equals
102
+
103
+ $$
104
+ \overline { { \mathbf { M } } } _ { \mathbf { z } } = \mathbb { E } _ { p ( \boldsymbol { \epsilon } ) } [ \mathbf { M } _ { \mathbf { z } } ] = \left( \mathbf { J } _ { \mathbf { z } } ^ { ( \boldsymbol { \mu } ) } \right) ^ { \intercal } \left( \mathbf { J } _ { \mathbf { z } } ^ { ( \boldsymbol { \mu } ) } \right) + \left( \mathbf { J } _ { \mathbf { z } } ^ { ( \boldsymbol { \sigma } ) } \right) ^ { \intercal } \left( \mathbf { J } _ { \mathbf { z } } ^ { ( \boldsymbol { \sigma } ) } \right) ,
105
+ $$
106
+
107
+ where $\mathbf { J _ { z } ^ { ( \mu ) } }$ and $\mathbf { J } _ { \mathbf { z } } ^ { ( \sigma ) }$ are the Jacobian matrices of $\mu ( \cdot )$ and $\sigma ( \cdot )$
108
+
109
+ Proof. See Appendix B.
110
+
111
+ Remark 1. By Definition $I$ , the metric tensor must change smoothly, which implies that the Jacobians must be smooth functions as well. This is easily ensured with activation functions for the neural networks that are $\mathcal { C } ^ { 2 }$ differentiable, e.g. tanh $( \cdot ) ,$ , sigmoid(·), and softplus(·).
112
+
113
+ Theorem 2 (Due to Tosi et al. (2014)). The variance of the metric under the $L _ { 2 }$ measure vanishes when the data dimension goes to infinity, i.e. $\begin{array} { r } { \operatorname* { l i m } _ { D \to \infty } \mathrm { V a r } \left( \mathbf { M } _ { \mathbf { z } } \right) = 0 } \end{array}$ .
114
+
115
+ Theorem 2 suggests that the (deterministic) expected metric $\overline { { \mathbf { M } } } _ { \mathbf { z } }$ is a good approximation to the underlying stochastic metric when the data dimension is large. We make this approximation, which allows us to apply the theory of deterministic generators.
116
+
117
+ This expected metric has a particularly appealing form, where the two terms capture the distortion of the mean and the variance functions respectively. In particular, the variance term $( \mathbf { J _ { z } ^ { ( \sigma ) } } ) ^ { \mathsf { T } } ( \mathbf { J _ { z } ^ { ( \sigma ) } } )$ will be large in regions of the latent space, where the generator has large variance. This implies that induced distances will be large in regions of the latent space where the generator is highly uncertain, such that shortest paths will tend to avoid these regions. These paths will then tend to follow the data in the latent space, c.f. Fig. 3. It is worth stressing, that no learning is needed to compute this metric: it only consists of terms that can be derived directly from the generator.
118
+
119
+ ![](images/954871399527a17cead87d658d94f6a7dfe5fa2172e6093b0a13ea64a1641026.jpg)
120
+ Figure 3: Example shortest paths and distances.
121
+
122
+ # 4.1 ENSURING PROPER GEOMETRY THROUGH MEANINGFUL VARIANCE FUNCTIONS
123
+
124
+ Theorem 1 informs us about how the geometry of the generative model depends on both the mean and the variance of the generator. Assuming successful training of the generator, we can expect to have good estimates of the geometry in regions near the data. But what happens in regions further away from the data? In general, the mean function cannot be expected to give useful extrapolations to such regions, so it is reasonable to require that the generator has high variance in regions that are not near the data. In practice, the neural net used to represent the variance function is only trained in regions where data is available, which implies that variance estimates are extrapolated to regions with no data. As neural nets tend to extrapolate poorly, practical variance estimates tend to be arbitrarily poor in regions without data.
125
+
126
+ ![](images/fa99796e62b2e36f02959898009e95b045fb0cd0c77b64f431b6792bd61c83be.jpg)
127
+ Figure 4: From left to right: training data in $\mathcal { X }$ , latent representations in $\mathcal { Z }$ , the standard deviation $\begin{array} { r } { \log ( \sum _ { j = 1 } ^ { D } \sigma _ { j } ( { \mathbf z } ) ) } \end{array}$ for the standard variance network, and the proposed solution.
128
+
129
+ Figure 4 illustrates this problem. The first two panels show the data and its corresponding latent representations (here both input and latent dimensions are 2 to ease illustration). The third panel shows the variance function under a standard architecture, deep multilayer perceptron with softplus nonlinearity for the output layer. It is evident that variance estimates in regions without data are not representative of either uncertainty or error of the generative process; sometimes variance is high, sometimes it is low. From a probabilistic modeling point-of-view, this is disheartening. An informal survey of publicly available VAE implementations also reveals that it is common to enforce a constant unit variance everywhere; this is further disheartening.
130
+
131
+ For our purposes, we need well-behaved variance functions to ensure a well-behaved geometry, but reasonable variance estimates are of general use. Here, as a general strategy, we propose to model the inverse variance with a network that extrapolates towards zero. This at least ensures that variances are large in regions without data. Specifically, we model the precision as $\begin{array} { r } { \beta _ { \psi } ( \mathbf { z } ) = \frac { 1 } { \pmb { \sigma } _ { \psi } ^ { 2 } ( \mathbf { z } ) } } \end{array}$ , where all operations are element-wise. Then, we model this precision with a radial basis function $( R B F )$ neural network (Que & Belkin, 2016). Formally this is written
132
+
133
+ $$
134
+ \begin{array} { r } { \beta _ { \psi } ( { \bf z } ) = { \bf W } { \bf v } ( { \bf z } ) + \boldsymbol { \zeta } , \quad \mathrm { w i t h } \quad v _ { k } ( { \bf z } ) = \exp \left( - \lambda _ { k } \left. { \bf z } - { \bf c } _ { k } \right. _ { 2 } ^ { 2 } \right) , k = 1 , \dots , K , } \end{array}
135
+ $$
136
+
137
+ where $\psi$ are all parameters, $\mathbf { W } \in \mathbb { R } _ { > 0 } ^ { D \times K }$ are the positive weights of the n ork (positivity ensures a positive precision), and $\lambda _ { k }$ are the centers and the bandwidth of the $K$ and $\zeta \to 0$ is a vector of positive constants to prevent division by zero. It is easy to see that with this approach the variance of the generator increases with the distance to the centers. The rightmost panel of Fig. 4 shows an estimated variance function, which indeed has the desired property that variance is large outside the data support. Further, note the increased variance between the two clusters, which captures that even interpolating between clusters comes with a level of uncertainty. In Appendix C we also demonstrate that this simple variance model improves the marginal likelihood $p ( \mathbf { x } )$ on held-out data.
138
+
139
+ Training the variance network amounts to fitting the RBF network. Assuming we have already trained the inference network (Sec. 2), we can encode the training data, and use $k$ -means to estimate the RBF centers. Then, an estimate for the bandwidths of each kernel can be computed as
140
+
141
+ $$
142
+ \lambda _ { k } = \frac { 1 } { 2 } \left( a \frac { 1 } { | \mathcal { C } _ { k } | } \sum _ { \mathbf { z } _ { j } \in \mathcal { C } _ { k } } \left\| \mathbf { z } _ { j } - \mathbf { c } _ { k } \right\| _ { 2 } \right) ^ { - 2 }
143
+ $$
144
+
145
+ where the hyper-parameter $a \in \mathbb { R } _ { + }$ controls the curvature of the Riemannian metric, i.e. how fast it changes based on the uncertainty. Since the mean function of the generator is already trained, the weights of the RBF can be found using projected gradient descent to ensure positive weights.
146
+
147
+ One visualization of the distortion of the latent space relative to the input space is the geometric volume measure $\sqrt { \operatorname* { d e t } ( \mathbf { M } _ { \mathbf { z } } ) }$ , which captures the volume of an infinitesimal area in the input space. Figure 5 shows this volume measure for both standard variance functions as well as our proposed RBF model. We see the trend of the data, unlike the standard model.
148
+
149
+ ![](images/c7075f8077cba97a8ced072d15552c951119f42cbb37ef44a5700aff838d8091.jpg)
150
+ Figure 5: Comparison of (log) measures of standard (top) and proposed (bottom) variances.
151
+
152
+ # 5 EMPIRICAL RESULTS
153
+
154
+ We demonstrate the usefulness of the geometric view of the latent space with several experiments. Model and implementation details can be found in Appendix D. In all experiments we first train a VAE and then use the induced Riemannian metric.
155
+
156
+ # 5.1 MEANINGFUL DISTANCES
157
+
158
+ First we seek to quantify if the induced Riemannian distance in the latent space is more useful than the usual Euclidean distance. For this we perform basic $k$ -means clustering under the two metrics. We construct 3 sets of MNIST digits, using 1000 random samples for each digit. We train a VAE for
159
+
160
+ <table><tr><td>Digits</td><td>Linear</td><td>Riemannian</td></tr><tr><td>{0,1,2}</td><td>77.57(±0.87)%</td><td>94.28(±1.14)%</td></tr><tr><td>{3,4,7}</td><td>77.80(±0.91)%</td><td>89.54(±1.61)%</td></tr><tr><td>{5,6,9}</td><td>64.93(±0.96)%</td><td>81.13(±2.52)%</td></tr></table>
161
+
162
+ Table 1: The $F$ -measure results for $k$ -means.
163
+
164
+ each set, and then subdivide each into 10 sub-sets, and performed $k$ -means clustering under both distances. One example result is shown in Fig. 6. Here it is evident that, since the latent points roughly follow a unit Gaussian, there is little structure to be discovered by the Euclidean $k$ -means, and consequently it performs poorly. The Riemannian clustering is remarkably accurate. Summary statistics across all subsets are provided in Table 1, which shows the established $F$ -measure for clustering accuracy. Again, the Riemannian metric significantly improves clustering. This implies that the underlying Riemannian distance is more useful than its Euclidean counterpart.
165
+
166
+ ![](images/d806b849a937f63ce95cada43c48d104ccea6c002aa6302cf87a7bb9d7b7e0eb.jpg)
167
+ Figure 6: The result of $k$ -means comparing the distance measures. For the decision boundaries we used 7-NN classification.
168
+
169
+ # 5.2 INTERPOLATIONS
170
+
171
+ Next, we investigate whether the Riemannian metric gives more meaningful interpolations. First, we train a VAE for the digits 0 and 1 from MNIST. The upper left panel of Fig. 7 shows the latent space with the Riemannian measure as background color, together with two interpolations. Images generated by both Riemannian and Euclidean interpolations are shown in the bottom of Fig. 7. The Euclidean interpolations seem to have a very abrupt change when transitioning from one class to another. The Riemannian interpolant gives smoother changes in the generated images. The topright panel of the figure shows the auto-correlation of images along the interpolants; again we see a very abrupt change in the Euclidean interpolant, while the Riemannian is significantly smoother. We also train a convolutional VAE on frames from a video. Figure 8 shows the corresponding latent space and some sample interpolations. As before, we see more smooth changes in generated images when we take the Riemannian metric into account.
172
+
173
+ # 5.3 LATENT PROBABILITY DISTRIBUTIONS
174
+
175
+ We have seen strong indications that the Riemannian metric gives a more meaningful view of the latent space, which may also improve probability distributions in the latent space. A relevant candidate distribution is the locally adaptive normal distribution (LAND) (Arvanitidis et al., 2016)
176
+
177
+ $$
178
+ \mathrm { L A N D } ( { \bf z } \mid { \pmb \mu } , { \pmb \Sigma } ) \propto \exp \left( - \frac { 1 } { 2 } \mathrm { d i s t } _ { { \pmb \Sigma } } ^ { 2 } ( { \bf z } , { \pmb \mu } ) \right) ,
179
+ $$
180
+
181
+ ![](images/7c6c7604b2beef99c6958e92dc2f972869e6161897c59d460e8cbd4c5540d244.jpg)
182
+ Figure 7: Left: the latent space with example interpolants. Right: auto-correlations of Riemannian (top) and Euclidean (bottom) samples along the curves of the left panel. Bottom: decoded images along Euclidean (top rows) and Riemannian (bottom rows) interpolants.
183
+
184
+ ![](images/1a1c6b5de149bfc16c6c0898140b356140a1b13ca85c6283cfaa6b15b9031579.jpg)
185
+ Figure 8: Left: the latent space and geodesic interpolants. Right: samples comparing Euclidean (top row) with Riemannian (bottom row) interpolation. Corresponding videos can be found here.
186
+
187
+ where $\mathrm { d i s t } _ { \Sigma }$ is the Riemannian extension of Mahalanobis distance. We fit a mixture of two LANDs to the MNIST data from Sec. 5.2 alongside a mixture of Euclidean normal distributions. The first column of Fig. 9 shows the density functions of the two mixture models. Only the Riemannian model reveals the underlying clusters. We then sample 40 points from each component of these generative models1 (center column of the figure). We see that the Riemannian model generates high-quality samples, whereas the Euclidean model generates several samples in regions where the generator is not trained and therefore produces blurry images. Finally, the right column of Fig. 9 shows all pairwise distances between the latent points under both Riemannian and Euclidean distances. Again, we see that the geometric view clearly reveals the underlying clusters.
188
+
189
+ # 5.4 RANDOM WALK ON THE DATA MANIFOLD
190
+
191
+ Finally, we consider random walks over the data manifold, which is a common tool for exploring latent spaces. To avoid the walk drifting outside the data support, practical implementations artificially restrict the walk to stay inside the $[ - 1 , 1 ] ^ { d }$ hypercube. Here, we consider unrestricted Brownian motion under both the Euclidean and Riemannian metric. We perform this random walk in the latent space of the convolutional VAE from Sec. 5.2. Figure 10 shows example walks, while Fig. 11 shows generated images (video here). While the Euclidean random walk moves freely, the Riemannian walk stays within the support of the data. This is explained in the left panel of Fig. 10, which shows that the variance term in the Riemannian metric creates a “wall” around the data, which the random walk will only rarely cross. These “walls” also force shortest paths to follow the data.
192
+
193
+ ![](images/577991ffae81ea5905686dbc7921ef66cea4290c0a2a878688a739565cdce305.jpg)
194
+ Figure 9: From left to right: the mixture models, generated samples, and pairwise distances. Top row corresponds to the Riemannian model and bottom row to the Euclidean model.
195
+
196
+ ![](images/a5f5f765ad4230246a37dbc4b51550a3462afbf7f547424e14ddfc378ba24947.jpg)
197
+ Figure 10: Left: the measure in the latent space. Right: the random walks.
198
+
199
+ ![](images/ca933ecdb20184b747d5f8fde4b873b1da41d8ad609bc99fed8eed4945dbc9fb.jpg)
200
+ Figure 11: The comparison of the random walks, at the steps 200, 300, 3000, 4000 and 5000.
201
+
202
+ # 6 RELATED WORK
203
+
204
+ Generative models. This unsupervised learning category attracted a lot of attention, especially, due to the advances on the deep neural networks. We have considered VAEs (Kingma & Welling, 2014; Rezende et al., 2014), but the ideas extend to similar related models. These include extensions that provide more flexible approximate posteriors (Rezende & Mohamed, 2015; Kingma et al., 2016). GANs (Goodfellow et al., 2014) also fall in this category, as these models have an explicit generator. While the inference network is not a necessary component in the GAN model, it has been shown that incorporating it improves overall performance (Donahue et al., 2017; Dumoulin et al., 2017). The same thoughts hold for approaches that transform the latent space through a sequence of bijective functions (Dinh et al., 2017)
205
+
206
+ Geometry in neural networks. Bengio et al. (2013) discuss the importance of geometry in neural networks as a tool to understand local generalization. For instance, the Jacobian matrix is a measure of smoothness for a function that interpolates a surface to the given data. This is exactly the implication in (Rifai et al., 2011), where the norm of the Jacobian acts as a regularizer for the deterministic autoencoder. Recently, Kumar et al. (2017) used the Jacobian to inject invariances in a classifier.
207
+
208
+ Riemannian Geometry. Like the present paper, Tosi et al. (2014) derive a suitable Riemannian metric in Gaussian process (GP) latent variable models (Lawrence, 2005), but the computational complexity of GPs causes practical concerns. Unlike works that explicitly learn a Riemannian metric (Hauberg et al., 2012; Peltonen et al., 2004), our metric is fully derived from the generator and requires no extra learning once the generator is available.
209
+
210
+ # 7 DISCUSSION AND FURTHER EXTENSIONS
211
+
212
+ The geometric interpretation of representation learning is that the latent space is a compressed and flattened version of the data manifold. We show that the actual geometry of the data manifold can be more complex than it first appears.
213
+
214
+ Here we have initiated the study of proper geometries for generative models. We showed that the latent space not only provides a low-dimensional representation of the data manifold, but at the same time, can reveal the underlying geometrical structure. We proposed a new variance network for the generator, which provides meaningful uncertainty estimates while regularizing the geometry. The new detailed understanding of the geometry provides us with more relevant distance measures, as demonstrated by the fact that a $k$ -means clustering, on these distances, is better aligned with the ground truth label structure than a clustering based on conventional Euclidean distances. We also found that the new distance measure produces smoother interpolation, and when training Riemannian “LAND” mixture models based on the new geometry, the components aligned much better with the ground truth group structure. Finally, inspired by the recent interest in sequence generation by random walks in latent space, we found that geometrically informed random walks stayed on the manifold for much longer runs than sequences based on Euclidean random walks.
215
+
216
+ The presented analysis easily extends to sophisticated generative models, where the latent space will be potentially endowed with more flexible nonlinear structures. This directly implies particularly interesting geometrical models. An obvious question is: can the geometry of the latent space play a role while we learn the generative model? Either way, we believe that this geometric perspective provides a new way of thinking and further interpreting the generative models, while at the same time it encourages development of new nonlinear models in the representation space.
217
+
218
+ # ACKNOWLEDGMENTS
219
+
220
+ LKH is supported by Innovation Fund Denmark / the Danish Center for Big Data Analytics Driven Innovation. SH was supported by a research grant (15334) from VILLUM FONDEN. This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement $\boldsymbol { \mathrm { n ^ { \circ } } }$ 757360). We gratefully acknowledge the support of the NVIDIA Corporation with the donation of the used Titan Xp GPU.
221
+
222
+ # REFERENCES
223
+
224
+ Georgios Arvanitidis, Lars Kai Hansen, and Søren Hauberg. A Locally Adaptive Normal Distribution. In Advances in Neural Information Processing Systems (NIPS), 2016.
225
+
226
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation Learning: A Review and New Perspectives. IEEE Trans. Pattern Anal. Mach. Intell., 35(8):1798–1828, August 2013.
227
+
228
+ Yuri Burda, Roger B. Grosse, and Ruslan Salakhutdinov. Importance Weighted Autoencoders. In International Conference on Learning Representations (ICLR), 2016.
229
+
230
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using Real NVP. In International Conference on Learning Representations (ICLR), 2017.
231
+
232
+ M.P. do Carmo. Riemannian Geometry. Mathematics (Boston, Mass.). Birkhauser, 1992. ¨
233
+
234
+ Jeff Donahue, Philipp Krhenbhl, and Trevor Darrell. Adversarial Feature Learning. In International Conference on Learning Representations (ICLR), 2017.
235
+
236
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially Learned Inference. In International Conference on Learning Representations (ICLR), 2017.
237
+
238
+ Carl Friedrich Gauss. Disquisitiones generales circa superficies curvas. Commentationes Societatis Regiae Scientiarum Gottingesis Recentiores, VI:99–146, 1827.
239
+
240
+ 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 (NIPS), 2014.
241
+
242
+ Søren Hauberg, Oren Freifeld, and Michael J. Black. A Geometric Take on Metric Learning. In Advances in Neural Information Processing Systems (NIPS) 25, pp. 2033–2041, 2012.
243
+
244
+ Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. In Proceedings of the 2nd International Conference on Learning Representations (ICLR), 2014.
245
+
246
+ Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved Variational Inference with Inverse Autoregressive Flow. In Advances in Neural Information Processing Systems (NIPS), 2016.
247
+
248
+ Abhishek Kumar, Prasanna Sattigeri, and Tom Fletcher. Improved Semi-supervised Learning with Gans using Manifold Invariances. In Advances in Neural Information Processing Systems (NIPS). 2017.
249
+
250
+ Neil Lawrence. Probabilistic non-linear principal component analysis with Gaussian process latent variable models. Journal of machine learning research, 6(Nov):1783–1816, 2005.
251
+
252
+ Jaakko. Peltonen, Arto Klami, and Samuel Kaski. Improved learning of riemannian metrics for exploratory analysis. Neural Networks, 17(8):1087–1100, 2004.
253
+
254
+ Qichao Que and Mikhail Belkin. Back to the future: Radial basis function networks revisited. In Artificial Intelligence and Statistics (AISTATS), 2016.
255
+
256
+ Danilo Rezende and Shakir Mohamed. Variational Inference with Normalizing Flows. In Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015.
257
+
258
+ 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 (ICML), 2014.
259
+
260
+ Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive AutoEncoders: Explicit Invariance During Feature Extraction. In Proceedings of the 28th International Conference on Machine Learning (ICML), 2011.
261
+
262
+ Alessandra Tosi, Søren Hauberg, Alfredo Vellido, and Neil D. Lawrence. Metrics for Probabilistic Geometries. In The Conference on Uncertainty in Artificial Intelligence (UAI), July 2014.
263
+
264
+ # A THE DERIVATION OF THE GEODESIC DIFFERENTIAL EQUATION
265
+
266
+ The shortest path between two points $\mathbf { x } , \mathbf { y } \in \mathcal { M }$ on a Riemannian manifold $\mathcal { M }$ is found by optimizing the functional
267
+
268
+ $$
269
+ \gamma _ { t } ^ { ( \mathrm { s h o r t e s t } ) } = \underset { \gamma _ { t } } { \arg \operatorname* { m i n } } \int _ { 0 } ^ { 1 } \sqrt { \langle \dot { \gamma } _ { t } , \mathbf { M } _ { \gamma _ { t } } \dot { \gamma } _ { t } \rangle } \mathrm { d } t , \quad \gamma ( 0 ) = \mathbf { x } , \gamma ( 1 ) = \mathbf { y }
270
+ $$
271
+
272
+ where $\gamma _ { t } : [ 0 , 1 ] \to \mathcal { M }$ and $\begin{array} { r } { \dot { \gamma } _ { t } ~ = ~ \frac { \partial \gamma _ { t } } { \partial t } } \end{array}$ ∂γt∂t . The minima of this problem can be found instead by optimizing the curve energy (do Carmo, 1992), so the functional becomes
273
+
274
+ $$
275
+ \gamma _ { t } ^ { ( \mathrm { s h o r t e s t } ) } = \underset { \gamma _ { t } } { \operatorname { a r g m i n } } \int _ { 0 } ^ { 1 } \langle \dot { \gamma } _ { t } , \mathbf { M } _ { \gamma _ { t } } \dot { \gamma } _ { t } \rangle \mathrm { d } t , \quad \gamma ( 0 ) = \mathbf { x } , \gamma ( 1 ) = \mathbf { y } .
276
+ $$
277
+
278
+ The inner product can be written explicitly as
279
+
280
+ $$
281
+ L ( \gamma _ { t } , \dot { \gamma } _ { t } , \mathbf { M } _ { \gamma _ { t } } ) = \langle \dot { \gamma } _ { t } , \mathbf { M } _ { \gamma _ { t } } \dot { \gamma } _ { t } \rangle = \sum _ { i = 1 } ^ { d } \sum _ { j = 1 } ^ { d } \dot { \gamma } _ { t } ^ { ( i ) } \cdot \dot { \gamma } _ { t } ^ { ( j ) } \cdot M _ { \gamma _ { t } } ^ { ( i j ) } = ( \dot { \gamma } _ { t } \otimes \dot { \gamma } _ { t } ) ^ { \top } \mathrm { v e c } [ \mathbf { M } _ { \gamma _ { t } } ]
282
+ $$
283
+
284
+ where the index in the parenthesis represents the corresponding element in the vector or matrix. In the derivation the $\otimes$ is the usual Kronecker product and the $\mathrm { v e c } [ \cdot ]$ stacks the column of a matrix into a vector. We find the minimizers by the Euler-Lagrange equation
285
+
286
+ $$
287
+ { \frac { \partial L } { \partial \gamma _ { t } } } = { \frac { \partial } { \partial t } } { \frac { \partial L } { \partial { \dot { \gamma } } _ { t } } }
288
+ $$
289
+
290
+ where
291
+
292
+ $$
293
+ \frac { \partial } { \partial t } \frac { \partial L } { \partial \dot { \gamma } _ { t } } = \frac { \partial } { \partial t } \frac { \partial \langle \dot { \gamma } _ { t } , \mathbf { M } _ { \gamma _ { t } } \dot { \gamma } _ { t } \rangle } { \partial \dot { \gamma } _ { t } } = \frac { \partial } { \partial t } \left( 2 \cdot \mathbf { M } _ { \gamma _ { t } } \dot { \gamma } _ { t } \right) = 2 \left[ \frac { \partial \mathbf { M } _ { \gamma _ { t } } } { \partial t } \dot { \gamma } _ { t } + \mathbf { M } _ { \gamma _ { t } } \ddot { \gamma } _ { t } \right] .
294
+ $$
295
+
296
+ Since the term
297
+
298
+ $$
299
+ \frac { \partial \mathbf { M } _ { \gamma _ { t } } } { \partial t } = \left[ \begin{array} { c c c } { \frac { \partial M _ { \gamma _ { t } } ^ { ( 1 1 ) } } { \partial t } } & { \ldots } & { \frac { \partial M _ { \gamma _ { t } } ^ { ( 1 D ) } } { \partial t } } \\ { \frac { \partial M _ { \gamma _ { t } } ^ { ( 2 1 ) } } { \partial t } } & { \ldots } & { \frac { \partial M _ { \gamma _ { t } } ^ { ( 2 D ) } } { \partial t } } \\ { \vdots } & { \ddots } & { \vdots } \\ { \frac { \partial M _ { \gamma } ^ { ( D 1 ) } } { \partial t } } & { \ldots } & { \frac { \partial M _ { \gamma _ { t } } ^ { ( D D ) } } { \partial t } } \end{array} \right] = \left[ \begin{array} { c c c c } { \frac { \partial M _ { \gamma _ { t } } ^ { ( 1 1 ) } \mathsf { T } } { \partial \gamma _ { t } } \dot { \gamma } _ { t } } & { \ldots } & { \frac { \partial M _ { \gamma _ { t } } ^ { ( 1 D ) } } { \partial \gamma _ { t } } \dot { \gamma } _ { t } } \\ { \frac { \partial M _ { \gamma _ { t } } ^ { ( 2 1 ) } \mathsf { T } } { \partial \gamma _ { t } } \dot { \gamma } _ { t } } & { \ldots } & { \frac { \partial M _ { \gamma } ^ { ( 2 D ) } } { \partial \gamma _ { t } } \dot { \gamma } _ { t } } \\ { \vdots } & { \ddots } & { \vdots } \\ { \frac { \partial M _ { \gamma _ { t } } ^ { ( D 1 ) } \mathsf { T } } { \partial \gamma _ { t } } \dot { \gamma } _ { t } } & { \ldots } & { \frac { \partial M _ { \gamma _ { t } } ^ { ( D D ) } } { \partial \gamma _ { t } } \dot { \gamma } _ { t } } \end{array} \right]
300
+ $$
301
+
302
+ we can write the right hand side of the Eq. 16 as
303
+
304
+ $$
305
+ \frac { \partial } { \partial t } \frac { \partial L } { \partial \dot { \gamma } _ { t } } = 2 \left[ ( \mathbb { I } _ { d } \otimes \dot { \gamma } _ { t } ^ { \mathsf { T } } ) \frac { \partial \mathrm { v e c } \left[ \mathbf { M } _ { \gamma _ { t } } \right] } { \partial \gamma _ { t } } \dot { \gamma } _ { t } + \mathbf { M } _ { \gamma _ { t } } \ddot { \gamma } _ { t } \right] .
306
+ $$
307
+
308
+ The left hand side term of the Eq. 16 is equal to
309
+
310
+ $$
311
+ \frac { \partial L } { \partial \gamma _ { t } } = \frac { \partial } { \partial \gamma _ { t } } \left( ( \dot { \gamma } _ { t } \otimes \dot { \gamma } _ { t } ) ^ { \top } \mathrm { v e c } \big [ \mathbf { M } _ { \gamma _ { t } } \big ] \right) = ( \dot { \gamma } _ { t } \otimes \dot { \gamma } _ { t } ) ^ { \top } \frac { \partial \mathrm { v e c } \big [ \mathbf { M } _ { \gamma _ { t } } \big ] } { \partial \gamma _ { t } } .
312
+ $$
313
+
314
+ The final system of $2 ^ { \mathrm { n d } }$ order ordinary differential equations is
315
+
316
+ $$
317
+ \ddot { \gamma } _ { t } = - \frac { 1 } { 2 } \mathbf { M } _ { \gamma _ { t } } ^ { - 1 } \left[ 2 \cdot ( \mathbb { I } _ { d } \otimes \dot { \gamma } _ { t } ^ { \intercal } ) \frac { \partial \mathrm { v e c } \big [ \mathbf { M } _ { \gamma _ { t } } \big ] } { \partial \gamma _ { t } } \dot { \gamma } _ { t } - \frac { \partial \mathrm { v e c } \big [ \mathbf { M } _ { \gamma _ { t } } \big ] ^ { \intercal } } { \partial \gamma _ { t } } ( \dot { \gamma } _ { t } \otimes \dot { \gamma } _ { t } ) \right] .
318
+ $$
319
+
320
+ B THE DERIVATION OF THE RIEMANNIAN METRIC
321
+
322
+ The proof of Theorem 1.
323
+
324
+ Proof. As we introduced in Eq. 8 the stochastic generator is
325
+
326
+ $$
327
+ f ( \mathbf { z } ) = \pmb { \mu } ( \mathbf { z } ) + \pmb { \sigma } ( \mathbf { z } ) \odot \epsilon , \qquad \pmb { \mu } : \mathscr { Z } \pmb { \chi } , ~ \pmb { \sigma } : \mathscr { Z } \mathbb { R } _ { + } ^ { D } , ~ \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbb { I } _ { D } ) .
328
+ $$
329
+
330
+ Thus, we can compute the corresponding Jacobian as follows
331
+
332
+ $$
333
+ \begin{array} { c } { { \displaystyle \frac { \partial f ( { \bf z } ) } { \partial { \bf z } } = { \bf J } _ { \bf z } = [ \begin{array} { c c c } { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 1 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 1 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \bf \cdots } } & { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 1 ) } } { \partial z _ { { \bf z } } } } } \\ { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 2 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 2 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \bf \cdots } } & { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 2 ) } } { \partial z _ { { \bf z } } } } } \\ { { \vdots } } & { { \vdots } } & { { \ddots } } & { { \vdots } } \\ { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( D ) } } { \partial z _ { { \bf z } } } } } & { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( D ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \bf \cdots } } & { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( D ) } } { \partial z _ { { \bf z } } } } } \end{array} ] _ { D ^ { \times d } } } } \\ = [ \begin{array} { c c c } { { \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 1 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \displaystyle \frac { \partial \mu _ { { \bf z } } ^ { ( 1 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & { { \bf \cdots } } & { { \displaystyle \frac { \partial \mu _ { { \bf z } } ^ { ( 1 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } \\ { { \displaystyle \frac { \partial \mu _ { { \bf z } } ^ { ( 2 ) } } { \partial z _ { { \bf z } } ^ { 2 } } } } & \displaystyle \frac { \partial f _ { { \bf z } } ^ { ( 1 ) } } \partial z _ { { \bf z } } ^ \end{array} \end{array}
334
+ $$
335
+
336
+ $$
337
+ \mathbf { S } _ { i } = \left[ \begin{array} { c c c c } { \frac { \partial \sigma _ { z } ^ { ( 1 ) } } { \partial z _ { i } } } & { 0 } & { \cdots } & { 0 } \\ { 0 } & { \frac { \partial \sigma _ { z } ^ { ( 2 ) } } { \partial z _ { i } } } & { \cdots } & { 0 } \\ { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { 0 } & { 0 } & { \cdots } & { \frac { \partial \sigma _ { z } ^ { ( D ) } } { \partial z _ { i } } } \end{array} \right] _ { D \times D } , i = 1 , \ldots , d
338
+ $$
339
+
340
+ and the resulting “random” metric in the latent space is $\mathbf { M _ { z } } = \mathbf { J _ { z } ^ { \intercal } } \mathbf { J _ { z } }$ . The randomness is due to the random variable $\epsilon$ , and thus, we can compute the expectation
341
+
342
+ $$
343
+ \begin{array} { r l } & { \mathbf { M _ { z } } = \mathbb { E } _ { p ( \epsilon ) } [ \mathbf { M _ { z } } ] = \mathbb { E } _ { p ( \epsilon ) } [ ( \mathbf { A } + \mathbf { B } ) ^ { \mathsf { T } } ( \mathbf { A } + \mathbf { B } ) ] = \mathbb { E } _ { p ( \epsilon ) } [ \mathbf { A ^ { \mathsf { T } } A } + \mathbf { A ^ { \mathsf { T } } B } + \mathbf { B ^ { \mathsf { T } } A } + \mathbf { B ^ { \mathsf { T } } B } ] . } \end{array}
344
+ $$
345
+
346
+ Using the linearity of expectation we get that
347
+
348
+ $$
349
+ \begin{array} { r } { \mathbb { E } _ { p ( \epsilon ) } [ \mathbf { A } ^ { \top } \mathbf { B } ] = \mathbb { E } _ { p ( \epsilon ) } \left[ \mathbf { A } ^ { \top } [ \mathbf { S } _ { 1 } \epsilon , \mathbf { S } _ { 2 } \epsilon , \cdot \cdot , \mathbf { S } _ { d } \epsilon ] \right] = \mathbf { A } ^ { \top } [ \mathbf { S } _ { 1 } \mathbb { E } _ { p ( \epsilon ) } [ \epsilon ] ^ { * } , \cdot \cdot , \mathbf { 0 } ] = 0 } \end{array}
350
+ $$
351
+
352
+ because $\mathbb { E } _ { p ( \epsilon ) } [ \epsilon ] = \mathbf { 0 }$ . The other term
353
+
354
+ $$
355
+ \begin{array} { r l } & { \mathbb { E } _ { p ( \epsilon ) } [ \mathbf { B } ^ { \mathsf { T } } \mathbf { B } ] = \mathbb { E } _ { p ( \epsilon ) } \left( \left[ \begin{array} { c } { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 1 } } \\ { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 2 } } \\ { \vdots } \\ { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { d } } \end{array} \right] _ { d \times D } \quad [ \mathbf { S } _ { 1 } \epsilon , \mathbf { S } _ { 2 } \epsilon , \cdots , \mathbf { S } _ { d } \epsilon ] \right) } \\ & { \quad \quad \quad \quad = \mathbb { E } _ { p ( \epsilon ) } \left( \left[ \begin{array} { c c c c } { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 1 } \mathbf { S } _ { 1 } \epsilon } & { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 1 } \mathbf { S } _ { 2 } \epsilon } & { \cdots } & { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 1 } \mathbf { S } _ { d } \epsilon } \\ { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 2 } \mathbf { S } _ { 1 } \epsilon } & { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 2 } \mathbf { S } _ { 2 } \epsilon } & { \cdots } & { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { 2 } \mathbf { S } _ { d } \epsilon } \\ { \vdots } & { \vdots } & { \vdots } \\ { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { d } \mathbf { S } _ { 1 } \epsilon } & { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { d } \mathbf { S } _ { 2 } \epsilon } & { \cdots } & { \epsilon ^ { \mathsf { T } } \mathbf { S } _ { d } \mathbf { S } _ { d } \epsilon } \end{array} \right] \right) } \end{array}
356
+ $$
357
+
358
+ with
359
+
360
+ $$
361
+ \begin{array} { r l } & { \mathbb { E } _ { p ( \epsilon ) } \left[ \epsilon ^ { \mathsf { T } } \mathbf { S } _ { i } \mathbf { S } _ { j } \epsilon \right] = \mathbb { E } _ { p ( \epsilon ) } \left[ \left( \epsilon _ { 1 } \frac { \partial \sigma _ { z } ^ { ( 1 ) } } { \partial z _ { i } } , \epsilon _ { 2 } \frac { \partial \sigma _ { z } ^ { ( 2 ) } } { \partial z _ { i } } , \cdots , \epsilon _ { D } \frac { \partial \sigma _ { z } ^ { ( D ) } } { \partial z _ { i } } \right) \left( \begin{array} { c } { \epsilon _ { 1 } \frac { \partial \sigma _ { z } ^ { ( 1 ) } } { \partial z _ { j } } } \\ { \epsilon _ { 2 } \frac { \partial \sigma _ { z } ^ { ( 2 ) } } { \partial z _ { j } } } \\ { \vdots } \\ { \epsilon _ { D } \frac { \partial \sigma _ { z } ^ { ( D ) } } { \partial z _ { j } } } \end{array} \right) \right] } \\ & { \quad = \mathbb { E } _ { p ( \epsilon ) } \left[ \epsilon _ { 1 } ^ { 2 } \left( \frac { \partial \sigma _ { z } ^ { ( 1 ) } } { \partial z _ { i } } \frac { \partial \sigma _ { z } ^ { ( 1 ) } } { \partial z _ { j } } \right) + \epsilon _ { 2 } ^ { 2 } \left( \frac { \partial \sigma _ { z } ^ { ( 2 ) } } { \partial z _ { i } } \frac { \partial \sigma _ { z } ^ { ( 2 ) } } { \partial z _ { j } } \right) + \cdots \epsilon _ { D } ^ { 2 } \left( \frac { \partial \sigma _ { z } ^ { ( D ) } } { \partial z _ { i } } \frac { \partial \sigma _ { z } ^ { ( D ) } } { \partial z _ { j } } \right) \right] } \end{array}
362
+ $$
363
+
364
+ $$
365
+ \begin{array} { r } { = d i a g ( \mathbf { S } _ { i } ) ^ { \mathsf { T } } d i a g ( \mathbf { S } _ { j } ) , } \end{array}
366
+ $$
367
+
368
+ because $\mathbb { E } _ { p ( \epsilon ) } [ \epsilon _ { i } ^ { 2 } ] = 1 , \forall i = 1 , \dots , D$ .
369
+
370
+ The matrix $\mathbf { A } = \mathbf { J } _ { \mathbf { z } } ^ { ( \mu ) }$ and for the variance network
371
+
372
+ $$
373
+ \mathbf { J } _ { \mathbf { z } } ^ { ( \sigma ) } = \left[ \begin{array} { c c c c } { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( 1 ) } } { \partial z _ { 1 } } } & { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( 1 ) } } { \partial z _ { 2 } } } & { \cdot \cdot \cdot } & { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( 1 ) } } { \partial z _ { d } } } \\ { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( 2 ) } } { \partial z _ { 1 } } } & { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( 2 ) } } { \partial z _ { 2 } } } & { \cdot \cdot \cdot } & { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( 2 ) } } { \partial z _ { d } } } \\ { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( D ) } } { \partial z _ { 1 } } } & { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( D ) } } { \partial z _ { 2 } } } & { \cdot \cdot \cdot } & { \frac { \partial \sigma _ { \mathbf { z } } ^ { ( D ) } } { \partial z _ { d } } } \end{array} \right]
374
+ $$
375
+
376
+ it is easy to see that $\mathbb { E } _ { p ( \epsilon ) } [ \mathbf { B } ^ { \intercal } \mathbf { B } ] = \left( \mathbf { J } _ { \mathbf { z } } ^ { ( \sigma ) } \right) ^ { \intercal } \mathbf { J } _ { \mathbf { z } } ^ { ( \sigma ) }$ . So the expectation of the induced Riemannian metric in the latent space by the generator is
377
+
378
+ $$
379
+ \bar { \mathbf { M _ { z } } } = \left( \mathbf { J _ { z } ^ { ( \mu ) } } \right) ^ { \mathsf { T } } \mathbf { J _ { z } ^ { ( \mu ) } } + \left( \mathbf { J _ { z } ^ { ( \sigma ) } } \right) ^ { \mathsf { T } } \mathbf { J _ { z } ^ { ( \sigma ) } }
380
+ $$
381
+
382
+ which concludes the proof.
383
+
384
+ # C INFLUENCE OF VARIANCE ON THE MARGINAL LIKELIHOOD
385
+
386
+ We trained a VAE on the digits 0 and 1 of the MNIST scaled to $[ - 1 , 1 ]$ . We randomly split the data to $9 0 \%$ training and $1 0 \%$ test data, ensuring balanced classes. First, we only trained the encoder and the mean function of the decoder. Then, keeping these fixed, we trained two variance functions: one based on standard deep neural network architecture, and the other using our proposed RBF model. Clearly, we have two generators with the same mean function, but different variance functions. Below we present the architectures for the standard neural networks. For the RBF model we used 32 centers and $a = 1$ .
387
+
388
+ <table><tr><td>Encoder/Decoder</td><td>Layer 1</td><td>Layer 2</td><td>Layer 3</td><td></td></tr><tr><td></td><td>64,(softplus)</td><td>32,(softplus)</td><td>d,(linear)</td><td rowspan="5"></td></tr><tr><td></td><td>64,(softplus)</td><td>32, (softplus)</td><td>d,(softplus)</td></tr><tr><td>μ</td><td>32,(softplus)</td><td>64,(softplus)</td><td>D,(tanh)</td></tr><tr><td>00</td><td>32, (softplus)</td><td>64,(softplus)</td><td>D,(softplus)</td></tr></table>
389
+
390
+ The numbers corresponds to the layer size together with the activation function in parenthesis. Further, the mean and the variance functions share the weights of the first layer. The input space dimension is $D = 7 8 4$ . Then, we computed the marginal likelihood $p ( \mathbf { x } )$ of the test data using Monte Carlo as:
391
+
392
+ $$
393
+ p ( \mathbf { x } ) = \int _ { \mathbb { Z } } p ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { z } ) \mathrm { d } \mathbf { z } \simeq \frac { 1 } { S } \sum _ { s = 1 } p ( \mathbf { x } | \mathbf { z } _ { s } ) , \quad \mathbf { z } _ { s } \sim p ( \mathbf { z } )
394
+ $$
395
+
396
+ using $S = 1 0 0 0 0$ samples. The generator with the standard variance function achieved -68.25 mean log-marginal likelihood, while our proposed model -50.34, where the higher the better.
397
+
398
+ The reason why the proposed RBF model performs better can be easily analyzed. The marginal likelihood under the Monte Carlo estimation is, essentially, a large Gaussian mixture model with equal weights $\textstyle { \frac { 1 } { S } }$ . Each mixture component is defined by the generator through the likelihood $p ( \mathbf { x } | \mathbf { z } ) = \mathcal { N } \left( \mathbf { x } \mid \pmb { \mu } _ { \theta } ( \mathbf { z } ) , \mathbb { I } _ { D } \pmb { \sigma } _ { \theta } ^ { 2 } ( \mathbf { z } ) \right)$ . Considering the variance term, the standard neural network approach is trained on the given data points and the corresponding latent codes. Unfortunately, its behavior is arbitrary in regions where there are not any encoded data. On the other hand our proposed model assigns large variance to these regions, while on the regions where we have latent codes its behavior will be approximately the same with the standard neural network. This implies that the resulting marginal likelihood $p ( \mathbf { x } )$ for the two models are highly similar in regions of high data density, but significantly different elsewhere. The RBF variance model ensures that mixture components in these regions have high variance, whereas the standard architecture assign arbitrary variance. Consequently, the RBF-based $p ( \mathbf { x } )$ assigns minimal density to regions with no data, and, thus, attains higher marginal likelihood elsewhere.
399
+
400
+ # D IMPLEMENTATION DETAILS FOR THE EXPERIMENTS
401
+
402
+ Algorithm 1 The training of a VAE that ensures geometry
403
+
404
+ Output: the estimated parameters of the neural networks $\theta , \phi , \psi$ 1: Train the $\mu _ { \phi } , \pmb { \sigma } _ { \phi } , \pmb { \mu } _ { \theta }$ as in Kingma & Welling (2014), keeping $\sigma _ { \psi }$ fixed. 2: Train the $\sigma _ { \psi }$ as explained in Sec. 4.1.
405
+
406
+ Details for Experiments 5.1, 5.2 & 5.3. The pixel values of the images are scaled to the interval $[ 0 , 1 ]$ . We use for the functions $\mu _ { \phi } , \pmb { \sigma } _ { \phi } , \pmb { \mu } _ { \theta }$ multilayer perceptron (MLP) deep neural networks, and for the $\beta _ { \psi }$ the proposed RBF model with 64 centers, so $\mathbf { W } \in \mathbb { R } ^ { D \times 6 4 }$ and the parameter $a$ of Eq. 11 is set to 2. We used $L _ { 2 }$ regularization with parameter equal to $1 e ^ { - 5 }$ .
407
+
408
+ <table><tr><td>Encoder/Decoder</td><td>Layer 1</td><td>Layer 2</td><td>Layer 3</td></tr><tr><td></td><td>64,(tanh)</td><td>32,(tanh)</td><td>d,(linear)</td></tr><tr><td></td><td>64, (tanh)</td><td>32, (tanh)</td><td>d,(softplus)</td></tr><tr><td>μ</td><td>32,(tanh)</td><td>64,(tanh)</td><td>D,(sigmoid)</td></tr></table>
409
+
410
+ The number corresponds to the size of the layer, and in the parenthesis the activation function. For the encoder, the mean and the variance functions share the weights of the Layer 1. The input space dimension $D = 7 8 4$ . After the training, the geodesics can be computed by solving Eq. 7 numerically. The LAND mixture model is fitted as explained in (Arvanitidis et al., 2016).
411
+
412
+ Details for Experiments 5.4. In this experiment we used Convolutional Variational AutoEncoders. The pixel values of the images are scaled to the interval [0, 1]. For the $\beta _ { \psi }$ we used the proposed RBF model with 64 centers and the parameter $a$ of Eq. 11 is set to 2.
413
+
414
+ Considering the variance network during the decoding stage, the RBF generates an image, which represents intuitively the total variance of each pixel for the decoded final image, but in an initial sub-sampled version. Afterwards, this image is passed through a sequence of deconvolution layers, and at the end will represent the variance of every pixel for each RGB channel. However, it is critical that the weights of the filters must be clipped during the training to $\mathbb { R } _ { + }$ to ensure positive variance.
415
+
416
+ <table><tr><td>Encoder</td><td>Layer 1 (Conv)</td><td>Layer 2 (Conv)</td><td>Layer 3 (MLP)</td><td>Layer 4 (MLP)</td></tr><tr><td>山</td><td>32,3,2,(tanh)</td><td>32,3,2,(tanh)</td><td>1024, (tanh)</td><td>d,(linear)</td></tr><tr><td>o</td><td>32,3,2,(tanh)</td><td>32,3,2,(tanh)</td><td>1024, (tanh)</td><td>d,(softplus)</td></tr></table>
417
+
418
+ For the convolutional and deconvolutional layers, the first number is the number of applied filters, the second is the kernel size, and third is the stride. Also, for the encoder, the mean and the variance functions share the convolutional layers. We used $L _ { 2 }$ regularization with parameter equal to $1 e ^ { - 5 }$ .
419
+
420
+ $$
421
+ \begin{array}{c} \frac { \mathrm { D e c o d e r } \mathrm { ~ ~ \cal ~ L ~ } . 1 ( \mathrm { M L P } ) \mathrm { ~ ~ \cal ~ L . ~ } 2 ( \mathrm { M L P } ) \mathrm { ~ ~ \cal ~ L . ~ } 3 ( \mathrm { D E } ) \mathrm { ~ ~ \cal ~ L . ~ } 4 ( \mathrm { D E } ) \mathrm { ~ ~ \cal ~ L . ~ } 5 ( \mathrm { D E } ) \mathrm { ~ ~ \cal ~ L . ~ } 6 ( \mathrm { C O } ) } { \mu _ { \theta } } \frac { D / 4 , ( t ) } { 3 2 , 3 , 2 , ( t ) } \frac { 3 2 , 3 , 2 , ( t ) } { 3 2 , 3 , 2 , ( t ) } \mathrm { ~ ~ \cal ~ 3 . 2 , } 3 , 1 , ( t ) \mathrm { ~ ~ \cal ~ 3 , 3 , 1 , } 3 , 1 , ( s ) \mathrm { ~ ~ \cal ~ 3 , 3 , 1 ~ } , 0 ) \mathrm { ~ ~ \cal ~ O ~ } \end{array}
422
+ $$
423
+
424
+ For the decoder, the acronyms $\mathrm { ( D E ) = }$ Deconvolution, $\left( \mathbf { C O } \right) =$ Convolution and $( t )$ , (s) stand for tanh and sigmoid, respectively. Also, $D = w i d t h \times h e i g h t \times$ channels of the images, in our case 64,64,3. For all the convolutions and deconvolutions, the padding is set to same. We used $L _ { 2 }$ regularization with parameter equal to $1 e ^ { - 5 }$ .
425
+
426
+ <table><tr><td>Decoder</td><td>rLayer1(RBF)</td><td>Layer 2 (Deconv)Layer 3 (Conv)</td><td></td></tr><tr><td>β</td><td>W ∈ R(D/2)×64</td><td>1,3,2 (linear)</td><td>3,3,1 (linear)</td></tr></table>
427
+
428
+ The Brownian motion over the Riemannian manifold in the latent space is presented in Alg. 2.
429
+
430
+ # Algorithm 2 Brownian motion on a Riemannian manifold
431
+
432
+ Input: the starting point $\mathbf { z } \in \mathbb { R } ^ { d \times 1 }$ , stepsize $s$ , number of steps $N _ { s }$ , the metric tensor $\mathbf { M } ( \cdot )$ Output: the random steps Z ∈ RNs×d.
433
+
434
+ 1: for $n = 0$ to $N _ { s }$ do
435
+ 2: $\mathbf { L } , \mathbf { U } = e i g \left( \mathbf { M ( z ) } \right) .$ (L: eigenvalues, U: eigenvectors)
436
+ 3: $\mathbf { v } = \mathbf { U } \mathbf { L } ^ { - \frac { 1 } { 2 } } \boldsymbol { \epsilon } , \qquad \boldsymbol { \epsilon } \sim \mathcal { N } ( \mathbf { 0 } , \mathbb { I } _ { d } )$
437
+ 4: z = z + s · v
438
+ 5: Z(n, :) = z
439
+ 6: end for
md/train/UoVpP8R2Vn/UoVpP8R2Vn.md ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PARP: Prune, Adjust and Re-Prune for Self-Supervised Speech Recognition
2
+
3
+ Cheng-I Jeff Lai1, Yang Zhang2⇤, Alexander H. Liu1⇤, Shiyu Chang2, 4⇤ Yi-Lun Liao1, Yung-Sung Chuang1, 3, Kaizhi Qian2, Sameer Khurana1 David $\mathbf { C o x } ^ { 2 }$ , James Glass1 1MIT CSAIL, 2MIT-IBM Watson AI Lab, 3National Taiwan University, $^ 4 \mathrm { U C }$ Santa Barbara
4
+
5
+ clai24@mit.edu
6
+
7
+ # Abstract
8
+
9
+ Self-supervised speech representation learning (speech SSL) has demonstrated the benefit of scale in learning rich representations for Automatic Speech Recognition (ASR) with limited paired data, such as wav2vec 2.0. We investigate the existence of sparse subnetworks in pre-trained speech SSL models that achieve even better low-resource ASR results. However, directly applying widely adopted pruning methods such as the Lottery Ticket Hypothesis (LTH) is suboptimal in the computational cost needed. Moreover, we show that the discovered subnetworks yield minimal performance gain compared to the original dense network.
10
+
11
+ We present Prune-Adjust-Re-Prune (PARP), which discovers and finetunes subnetworks for much better performance, while only requiring a single downstream ASR finetuning run. PARP is inspired by our surprising observation that subnetworks pruned for pre-training tasks need merely a slight adjustment to achieve a sizeable performance boost in downstream ASR tasks. Extensive experiments on lowresource ASR verify (1) sparse subnetworks exist in mono-lingual/multi-lingual pre-trained speech SSL, and (2) the computational advantage and performance gain of PARP over baseline pruning methods.
12
+
13
+ In particular, on the $1 0 \mathrm { { m i n } }$ Librispeech split without LM decoding, PARP discovers subnetworks from wav2vec 2.0 with an absolute $1 0 . 9 \% / 1 2 . 6 \%$ WER decrease compared to the full model. We further demonstrate the effectiveness of PARP via: cross-lingual pruning without any phone recognition degradation, the discovery of a multi-lingual subnetwork for 10 spoken languages in 1 finetuning run, and its applicability to pre-trained BERT/XLNet for natural language tasks1.
14
+
15
+ # 1 Introduction
16
+
17
+ For many low-resource spoken languages in the world, collecting large-scale transcribed corpora is very costly and sometimes infeasible. Inspired by efforts such as the IARPA BABEL program, Automatic Speech Recognition (ASR) trained without sufficient transcribed speech data has been a critical yet challenging research agenda in speech processing [31, 33, 42, 32, 21]. Recently, SelfSupervised Speech Representation Learning (speech SSL) has emerged as a promising pathway toward solving low-resource ASR [84, 25, 110, 6, 29, 127, 55, 27]. Speech SSL involves pre-training a speech representation module on large-scale unlabelled data with a self-supervised learning objective, followed by finetuning on a small amount of supervised transcriptions. Many recent studies have demonstrated the empirical successes of speech SSL on low-resource English and multi-lingual ASR, matching systems trained on fully-supervised settings [6, 29, 127, 4, 126]. Prior research attempts, however, focus on pre-training objectives [84, 25, 110, 72, 57, 74, 71, 73, 55, 22, 27, 17, 129], scaling up speech representation modules [5, 6, 53], pre-training data selections [108, 54, 107, 111, 78], or applications of pre-trained speech representations [26, 62, 94, 28, 63, 29, 76, 120, 64, 117, 112, 44, 4, 86, 59, 66, 2, 56, 102, 15, 30, 20]. In this work, we aim to develop an orthogonal approach that is complementary to these existing speech SSL studies, that achieves 1) lower architectural complexity and 2) higher performance (lower WER) under the same low-resource ASR settings.
18
+
19
+ Neural network pruning [65, 51, 49, 69], as well as the more recently proposed Lottery Ticket Hypothesis (LTH) $\mathbb { | \vert 3 9 \| }$ , provide a potential solution that accomplishes both objectives. According to LTH, there exists sparse subnetworks that can achieve the same or even better accuracy than the original dense network. Such phenomena have been successfully observed in various domains: Natural Language Processing (NLP) [123, 19, 88, 80], Computer Vision (CV) [18, 45], and many others. All finding sparse subnetworks with comparable or better performance than the dense network. Given the lack of similar studies on pruning self-supervised ASR, we intend to fill this gap by finding sparse subnetworks within a pre-trained speech SSL that can achieve superior performance to the full pre-trained model on downstream ASR tasks.
20
+
21
+ However, directly applying widely-adopted pruning methods, such as One-Shot Magnitude Pruning (OMP) and Iterative Magnitude Pruning (IMP) [49, 39], to pre-trained speech SSL suffers from two challenges. First, adopting these methods in the conventional pruning framework is extremely time-consuming for SOTA speech SSL models. OMP and IMP involve more than one round of finetuning on downstream tasks (c.f. Figure $\blacktriangleleft$ , and finetuning for ASR is timeconsuming and computationally demanding2. The second challenge is that we do not observe any performance improvement of the subnetworks over the original dense network with OMP or IMP. Figure 3 shows the WER under low-resource scenarios of the subnetworks identified by OMP (purple line) and IMP (blue dashed line) at different sparsity levels. None of the sparsity levels achieves a visible drop in WER compared to the zero sparsity case, corresponding to the original dense network. These two challenges have prompted us to ask – do there exist sparse subnetworks within pre-trained speech SSL with improved performance on low-resource ASR? How can we discover them efficiently in a single downstream finetuning run?
22
+
23
+ ![](images/5ad30abc480b483eec225c5622e6b8845d1bd60713e2b6d8a5af4e19dca47a3c.jpg)
24
+ Figure 1: Number of ASR finetuning iterations needed (y-axis) versus target sparsities $\mathbf { \check { X } }$ -axis) for each downstream task/language. Crossreferencing Figure $\textcircled { 3 }$ indicates that IMP requires linearly more compute to match the performance (either sparsity/WER) of PARP.
25
+
26
+ We propose a magnitude-based unstructured pruning method [41, 11], termed Prune-Adjust-Re-Prune (PARP), for discovering sparse subnetworks within pre-trained speech SSL. PARP consists of the following two steps:
27
+
28
+ 1. Directly prune the SSL pre-trained model at target sparsity, and obtain an initial subnetwork and an initial pruning mask.
29
+ 2. Finetune the initial subnetwork on target downstream task/language. During finetuning, zero out the pruned weights specified by the pruning mask, but allow the weights be updated by gradient descent during backpropogation. After a few number of model updates, re-prune the updated subnetwork at target sparsity again.
30
+
31
+ Step 1 provides an initial subnetwork that is agnostic to the downstream task, and Step 2 makes learnable adjustments by reviving pruned out weights. A formal and generalized description and its extension are introduced in Section $3 .$ Different from pruning methods in [49, 39], PARP allows pruned-out weights to be revived during finetuning. Although such a high-level idea was introduced in $\lVert \rVert \bigotimes \rVert$ , we provide an alternative insight: despite its flexibility, Step 2 only makes minimal adjustment to the initial subnetwork, and obtaining a good initial subnetwork in Step 1 is the key. We empirically show in Section $\textcircled { 3 }$ that any task-agnostic subnetwork surprisingly provides a good basis for Step 2, suggesting that the initial subnetwork can be cheaply obtained either from a readily available task/language or directly pruning the pre-trained SSL model itself. In addition, this observation allows us to perform cross-lingual pruning (mask transfer) experiments, where the initial subnetwork is obtained via a different language other than the target language.
32
+
33
+ Our Contributions. We conduct extensive PARP and baseline (OMP and IMP) pruning experiments on low-resource ASR with mono-lingual (pre-trained wav2vec 2.0 [6]) and cross-lingual (pre-trained XLSR-53 [29]) transfer. PARP finds significantly superior speech SSL subnetworks for low-resource
34
+
35
+ ASR, while only requiring a single pass of downstream ASR finetuning. Due to its simplicity, PARP adds minimal computation overhead to existing SSL downstream finetuning.
36
+
37
+ • We show that sparse subnetworks exist in pre-trained speech SSL when finetuned for low-resource ASR. In addition, PARP achieves superior results to OMP and IMP across all sparsities, amount of finetuning supervision, pre-trained model scale, and downstream spoken languages. Specifically, on Librispeech $1 0 \mathrm { { m i n } }$ without LM decoding, PARP discovers subnetworks from wav2vec 2.0 with an absolute $1 0 . 9 \% / 1 2 . 6 \%$ WER decrease compared to the full model, without modifying the finetuning hyper-parameters or objective (Section 4.1) • Ablation studies on demonstrating the importance of PARP’s initial subnetwork (Section 4.2) • PARP minimizes phone recognition error increases in cross-lingual mask transfer, where a subnetwork pruned for ASR in one spoken language is adapted for ASR in another language (Section $4 . 3 { \bar { ) } }$ . PARP can also be applied to efficient multi-lingual subnetwork discovery for 10 spoken languages (Section $4 . { \overset { \vartriangle } { 4 } } )$ • Last but not least, we demonstrate PARP’s effectiveness on pre-trained BERT/XLNet, mitigating the cross-task performance degradation reported in BERT-Ticket [19] (Section 4.5)
38
+
39
+ Significance. Findings of this work not only complement and advance current and future speech SSL for low-resource ASR, but also provide new insights for the rich body of pruning work.
40
+
41
+ # 2 Preliminaries
42
+
43
+ # 2.1 Problem Formulation
44
+
45
+ Consider the low-resource ASR problem, where there is only a small transcribed training set $( x , y ) \in$ $\mathcal { D } _ { l }$ . Here $x$ represents input audio, and $y$ represents output transcription. Subscript $l \in \{ 1 , 2 , \cdots \}$ represents the downstream spoken language identity. Because of the small dataset size, empirical risk minimization generally does not yield good results. Speech SSL instead assumes there is a much larger unannotated dataset $x \in \mathcal { D } _ { 0 }$ . SSL pre-trains a neural network $f ( x ; \theta )$ , where $\theta \in \mathcal { R } ^ { d }$ represents the network parameters and $d$ represents the number of parameters, on some self-supervised objective, and obtains the pre-trained weights $\theta _ { 0 }$ . $f ( x ; \theta _ { 0 } )$ is then finetuned on downstream ASR tasks specified by a downstream loss $\mathcal { L } _ { l } ( \boldsymbol { \theta } )$ , such as CTC, and evaluated on target dataset $\mathcal { D } _ { l }$ .
46
+
47
+ Our goal is to discover a subnetwork that minimizes downstream ASR WER on $\mathcal { D } _ { l }$ . Formally, denote $m \in \{ 0 , 1 \} ^ { d }$ , as a binary pruning mask for the pre-trained weights $\theta _ { 0 }$ , and $\theta ^ { l }$ as the finetuned weights on $\mathcal { D } _ { l }$ . The ideal pruning method should learn $( m , \theta ^ { l } )$ , such that the subnetwork $f ( x ; m \odot \theta ^ { l } )$ (where $\odot$ is element-wise product) achieves minimal finetuning $\mathcal { L } _ { l } ( \boldsymbol { \theta } )$ loss on $\mathcal { D } _ { l }$ .
48
+
49
+ # 2.2 Pruning Targets and Settings
50
+
51
+ We adopted pre-trained speech SSL wav2vec2 and xlsr for the pre-trained initialization $\theta _ { 0 }$ .
52
+
53
+ wav2vec 2.0 We took wav2vec 2.0 base (wav2vec2-base) and large (wav2vec2-large) pre-trained on Librispeech 960 hours $\textcircled { 6 }$ . During finetuning, a task specific linear layer is added on top of wav2vec2 and jointly finetuned with CTC loss. More details can be found in Appendix 8.
54
+
55
+ XLSR-53 (xlsr) shares the same architecture, pre-training and finetuning objectives as wav2vec2-large. xlsr is pre-trained on 53 languages sampled from CommonVoice, BABEL, and Multilingual LibriSpeech, totaling for 56k hours of multi-lingual speech data.
56
+
57
+ We consider three settings where wav2vec2 and xlsr are used as the basis for low-resource ASR:
58
+
59
+ LSR: Low-Resource English ASR. Mono-lingual pre-training and finetuning – an English pretrained speech SSL such as wav2vec2 is finetuned for low-resource English ASR.
60
+
61
+ H2L: High-to-Low Resource Transfer for Multi-lingual ASR. Mono-lingual pre-training and multi-lingual finetuning – a speech SSL pre-trained on a high-resource language such as English is finetuned for low-resource multi-lingual ASR.
62
+
63
+ CSR: Cross-lingual Transfer for Multi-lingual ASR. Multi-lingual pre-training and finetuning – a cross-lingual pretrained speech SSL such as xlsr is finetuned for low-resource multi-lingual ASR.
64
+
65
+ # 2.3 Subnetwork Discovery in Pre-trained SSL
66
+
67
+ One obvious solution to the aforementioned problem in Section $2 . 1$ is to directly apply pruning with rewinding to $\theta _ { 0 }$ , which has been successfully applied to pre-trained BERT $\dot { \mathbb { I D } }$ and SimCLR [18].
68
+
69
+ All pruning methods, including our proposed PARP, are based on Unstructured Magnitude Pruning (UMP) $\mathbb { B 9 } \mathbb { \breve { A 1 } }$ , where weights of the lowest magnitudes are pruned out regardless of the network structure to meet the target sparsity level. We introduce four pruning baselines below, and we also provide results with Random Pruning (RP) [39, 41, 19], where weights in $\theta _ { 0 }$ are randomly eliminated.
70
+
71
+ Task-Aware Subnetwork Discovery is pruning with target dataset $D _ { l }$ seen in advance, including One-Shot Magnitude Pruning (OMP) and Iterative Magnitude Pruning (IMP). OMP is summarized as:
72
+
73
+ 1. Finetune pretrained weights $\theta _ { 0 }$ on target dataset $\mathcal { D } _ { l }$ to get the finetuned weights $\theta ^ { l }$ .
74
+
75
+ 2. Apply UMP on $\theta ^ { l }$ and retrieve pruning mask $m$
76
+
77
+ IMP breaks down the above subnetwork discovery phase into multiple iterations – in our case multiple downstream ASR finetunings. Each iteration itself is an OMP with a fraction of the target sparsity pruned. We follow the IMP implementation described in BERT-Ticket $\mathbb { I m }$ , where each iteration prunes out $10 \%$ of the remaining weights. The main bottleneck for OMP and IMP is the computational cost, since multiple rounds of finetunings are required for subnetwork discovery.
78
+
79
+ Task-Agnostic Subnetwork Discovery refers to pruning without having seen $D _ { l }$ nor $l$ in advance. One instance is applying UMP directly on $\theta _ { 0 }$ without any downstream finetuning to retrieve $m$ , referred to as Magnitude Pruning at Pre-trained Initailizations (MPI). Another case is pruning weights finetuned for a different language $t$ , i.e. applying UMP on $\theta ^ { t }$ for the target language $l$ ; in our study, we refer to this as cross-lingual mask transfer. While these approaches do not require target task finetuning, the discovered subnetworks generally have worse performance than those from OMP or IMP.
80
+
81
+ The above methods are only for subnetwork discovery via applying pruning mask $m$ on $\theta _ { 0 }$ . The discovered subnetwork $f ( x ; m \odot \theta _ { 0 } )$ needs another downstream finetuning to recover the pruning loss3, i.e. finetune $f ( x ; m \odot \theta _ { 0 } )$ on $D _ { l }$ .
82
+
83
+ # 3 Method
84
+
85
+ In this section, we highlight our proposed pruning method, PARP (Section $3 . 1 )$ , its underlying intuition (Section $3 . 2 )$ , and an extension termed PARP-P (Section $\textcircled { 3 . 3 }$ .
86
+
87
+ # 3.1 Algorithm
88
+
89
+ We formally describe PARP with the notations from Section 2. A visual overview of PARP is Figure 8.
90
+
91
+ 1: Assume there are $N$ model updates in target task/language $l$ ’s downstream finetuning.
92
+ 2: Take a pre-trained SSL $f ( x ; { \bar { \theta } } _ { 0 } )$ model. Apply task-agnostic subnetwork discovery, such as MPI4 , at target
93
+ sparsity to obtain initial subnetwork $f ( x ; m _ { 0 } \odot \theta _ { 0 } )$ . Set $m = m _ { 0 }$ and variable .
94
+ 3: repeat
95
+ 4: Zero-out masked-out weights in $\theta _ { n 1 }$ given by $m$ . Lift up $m$ such that whole $\theta _ { n 1 }$ is updatable.
96
+ 5: Train $f ( x ; \theta _ { n 1 } )$ for $_ n$ model updates and obtain $f ( x ; \theta _ { n 2 } )$ .
97
+ 6: Apply UMP on $f ( x ; \theta _ { n 2 } )$ and adjust $m$ accordingly. The adjusted subnetwork is $f ( x ; m \odot \theta _ { n 2 } )$ . Set
98
+ variable $n _ { 1 } = n _ { 2 }$ .
99
+ 7: until total model updates reach $N$ .
100
+ 8: Return finetuned subnetwork $f ( x ; m \odot \theta _ { N } )$ .
101
+
102
+ Empirically, we found the choice of $n$ has little impact. In contrast to OMP/IMP/MPI, PARP allows the pruned-out weights to take gradient descent updates. A side benefit of PARP is it jointly discovers and finetunes subnetwork in a single pass, instead of two or more in OMP and IMP.
103
+
104
+ # 3.2 Obtaining and Adjusting the Initial Subnetwork
105
+
106
+ PARP achieves superior or comparable pruning results as task-aware subnetwork discovery, while inducing similar computational cost as task-agnostic subnetwork discovery. How does it get the best of both worlds? The key is the discovered subnetworks from task-aware and task-agnostic prunings have high, non-trivial overlaps in LSR, H2L, and CSR. We first define Intersection over Union (IOU) for quantifying subnetworks’ (represented by their pruning masks $m ^ { a }$ and $m ^ { b }$ ) similarity:
107
+
108
+ $$
109
+ \operatorname { I O U } ( m ^ { a } , m ^ { b } ) \triangleq { \frac { | ( m ^ { a } = 1 ) \cap ( m ^ { b } = 1 ) | } { | ( m ^ { a } = 1 ) \cup ( m ^ { b } = 1 ) | } }
110
+ $$
111
+
112
+ Take H2L and CSR for instance, Figure $2$ visualizes language pairs’ OMP pruning mask IOUs on wav2vec2 and xlsr. Observe the high overlaps across all pairs, but also the high IOUs with the MPI masks (second to last row). We generalize these observations to the following:
113
+
114
+ Observation 1 For any sparsity, any amount of finetuning supervision, any pre-training model scale, and any downstream spoken languages, the non-zero ASR pruning masks obtained from task-agnostic subnetwork discovery has high IOUs with those obtained from task-aware subnetwork discovery.
115
+
116
+ Observation 1 suggests that any task-agnostic subnetwork could sufficiently be a good initial subnetwork in PARP due to the high similarities. In the same instance for H2L and CSR, we could either take MPI on wav2vec2 and xlsr, or take OMP on a different spoken language as the initial subnetworks. Similarly in LSR, we take MPI on wav2vec2 as the initial subnetwork. The underlying message is – the initial subnetwork can be obtained cheaply, without target task finetuning.
117
+
118
+ Now, because of the high similarity, the initial subnetwork (represented by its pruning mask $m _ { 0 }$ ) needed merely a slight adjustment for the target downstream task. While there are techniques such as dynamic mask adjustment [48], important weights pruning $\mathbb { \underline { { \nabla 7 9 } } } ]$ , and deep rewiring $\mathbb { m }$ , we provide an even simpler alternative suited for our setting. Instead of permanently removing the masked-out weights from the computation graph, PARP merely zeroes them out. Weights that are important for the downstream task (the “important weights”) should emerge with gradient updates; those that are relatively irrelevant should decrease in magnitude, and thus be zero-outed at the end. Doing so circumvents the need of straight-through estimation or additional sparsity loss, see Table 1 of $\dot { \mathbb { Z } } \dot { \mathbb { Z } } \mathbb { I }$
119
+
120
+ # 3.3 PARP-Progressive (PARP-P)
121
+
122
+ An extension to PARP is PARP-P, where the second P stands for Progressive. In PARP-P, the initial subnetwork starts at a lower sparsity, and progressively prune up to the target sparsity $s$ in Step 2. The intuition is that despite Observation $\bigtriangledown$ not any subnetwork can be a good initial subnetwork, such as those obtained from RP, or those obtained at very high sparsities in MPI/OMP/IMP. We show later that PARP-P is especially effective in higher sparsity regions, e.g. $90 \%$ for LSR. Note that PARP-P has the same computational cost as PARP, and the only difference is the initial starting sparsity in Step 1.
123
+
124
+ ![](images/d1a8ab0cd8540ceffb7e200ce060ffbed2ea3fda8f98a261908fef21bcbe4cdc.jpg)
125
+ Figure 2: IOUs over all spoken language pairs’ OMP pruning masks on finetuned wav2vec2 and xlsr. Second to last row is the IOUs between OMP masks and the MPI masks from pre-trained wav2vec2 and xlsr. Here, we show the IOUs at $50 \%$ sparsity, and the rest can be found in Appendix $1 1 .$ Surprisingly at any sparsities, there is a high, non-trivial (c.f. RP in the last row), similarity $( > 9 0 \% )$ ) between all spoken language OMP masks, as well as with the MPI masks. Language IDs are in Appendix 9.
126
+
127
+ # 4 Experiments and Analysis
128
+
129
+ # 4.1 Comparing PARP, OMP, and IMP on LSR, H2L, and CSR
130
+
131
+ Our experimental setup can be found in Appendix $\bigtriangledown .$ We first investigate the existence of sparse subnetworks in speech SSL. Figure $3$ shows the pruning results on LSR. Observe that subnetworks discovered by PARP and PARP-P can achieve $60 \sim 8 0 \%$ sparsities with minimal degradation to the full models. The gap between PARP and other pruning methods also widens as sparsities increase. For instance, Table 1 compares PARP and PARP-P with OMP and IMP at $90 \%$ sparsity, and PARP-P has a $40 \%$ absolute WER reduction. In addition, observe the WER reduction with PARP in the low sparsity regions on the $1 0 \mathrm { { m i n } }$ split in Figure $3$ . The same effect is not seen with OMP, IMP, nor MPI. Table $\nsupseteq$ compares the subnetworks discovered by PARP with the full wav2vec2 and prior work on LSR under the same setting5. Surprisingly, the discovered subnetwork attains an absolute $1 0 . 9 \% / 1 2 . 6 \%$ WER reduction over the full wav2vec2-large. We hypothesize that the performance gains are attributed to pruning out generic, unnecessary weights while preserving important weights, which facilitates training convergence. In other words, PARP provides additional regularization effects to downstream finetuning. We also examined the effectiveness of IMP with different rewinding starting points as studied in $\mathbb { \lVert 4 0 , \rVert 9 3 \rVert }$ , and found rewinding initializations bear minimal effect on downstream ASR. Full rewinding details are in Appendix 10.
132
+
133
+ ![](images/0581ad7d5bca3d4e4c4e360ee99e63a3c6cf1c46b9eaea72b698a7344e6bc8c5.jpg)
134
+ Figure 3: Comparison of different pruning techniques on LSR (wav2vec2 with $1 0 \mathrm { { m i n } / 1 \mathrm { { h } / 1 0 \mathrm { { h } } } }$ Librispeech finetuning splits). PARP (black line) and PARP-P (black dashed line) are especially effective under ultra-low data regime (e.g. $1 0 \mathrm { { m i n } } )$ and high-sparsity $( 7 0 - 1 0 0 \% )$ regions.
135
+
136
+ Table 1: WER comparison of pruning LSR: wav2vec2-base at $90 \%$ sparsity with 10h finetuning on Librispeech without LM decoding. At $90 \%$ sparsity, OMP/IMP/MPI perform nearly as bad as RP. sub-finetuning stands for subnetwork finetuning.
137
+
138
+ <table><tr><td>Method</td><td>#ASR finetunings</td><td>test clean</td><td>test other</td></tr><tr><td>RP + sub-finetuning</td><td>1</td><td>94.5</td><td>96.4</td></tr><tr><td>MPI + sub-finetuning</td><td>1</td><td>93.6</td><td>96.1</td></tr><tr><td>OMP + sub-finetuning</td><td>2</td><td>92.0</td><td>95.3</td></tr><tr><td>IMP + sub-finetuning</td><td>10</td><td>89.6</td><td>93.9</td></tr><tr><td>PARP (90%→90%)</td><td>1</td><td>83.6</td><td>90.7</td></tr><tr><td>PARP-P 70%→90%</td><td>1</td><td>51.9</td><td>69.1</td></tr><tr><td>60%→80%→90%</td><td>2</td><td>33.6</td><td>53.3</td></tr></table>
139
+
140
+ Table 2: WER comparison of PARP for LSR with previous speech SSL results on Librispeech $1 0 \mathrm { { m i n } }$ . PARP discovers sparse subnetworks within wav2vec2 with lower WER while adding minimal computational cost to the original ASR finetuning.
141
+
142
+ <table><tr><td>Method</td><td>test clean</td><td>test other</td></tr><tr><td>Continuous BERT 国 + LM</td><td>49.5</td><td>66.3</td></tr><tr><td>Discrete BERT 国 + LM</td><td>16.3</td><td>25.2</td></tr><tr><td>wav2vec2-base reported 回</td><td>46.9</td><td>50.9</td></tr><tr><td>wav2vec2-large reported [6</td><td>43.5</td><td>45.3</td></tr><tr><td>wav2vec2-base replicated</td><td>49.3</td><td>53.2</td></tr><tr><td>wav2vec2-large replicated</td><td>46.3</td><td>48.1</td></tr><tr><td>wav2vec2-base w/10% PARP</td><td>38.0</td><td>44.3</td></tr><tr><td>wav2vec2-largew/10%PARP</td><td>33.7</td><td>37.2</td></tr></table>
143
+
144
+ Next, we examine if the pruning results of LSR transfers to H2L and CSR. Figure $\sharp$ is pruning H2L and CSR with 1h of Dutch $( n l )$ finetuning, and the same conclusion can be extended to other spoken languages. Comparing Figures $\textcircled { 3 }$ and $^ { 4 , }$ we notice that shapes of their pruning curves are different, which can be attributed to the effect of character versus phone predictions. Comparing left and center of Figure $\mathbb { H }$ we show that PARP and OMP reach $50 \%$ sparsity on H2L and $70 \%$ sparsity on CSR with minimal degradations. Furthermore, while PARP is more effective than OMP on H2L for all sparsities, such advantage is only visible in the higher sparsity regions on CSR. Lastly, Table $3$ compares the subnetworks from H2L and CSR with prior work. Even with as high as $90 \%$ sparsities in either settings, subnetworks from PARP and OMP out-performs prior art.
145
+
146
+ ![](images/368fc7de4c84f2fff3c1151872af912baa4191aaba16b87769268efdafa32b71.jpg)
147
+ Figure 4: Comparison of pruning techniques on H2L & CSR with 1h of Dutch $( n l )$ ASR finetuning. (Left) Pruning H2L (wav2vec2-base $+ n l )$ . (Center) Pruning CSR $( \mathbf { x } 1 \mathbf { s } \mathbf { r } + n l )$ . (Right) Pruning jointly-finetuned wav2vec2-base and xlsr on $n l$ . Trend is consistent for other 9 spoken languages.
148
+
149
+ Table 3: Comparing subnetworks discovered by OMP and PARP from wav2vec2-base and xlsr with prior work on H2L and CSR. PER is averaged over 10 languages.
150
+
151
+ <table><tr><td>Method</td><td>Pre-training</td><td>Sparsity</td><td>avg. PER</td></tr><tr><td>Bottleneck 38</td><td>Babel-1070h</td><td>0%</td><td>44.9</td></tr><tr><td>CPC 图</td><td>LS-100h</td><td>0%</td><td>50.9</td></tr><tr><td>Modified CPC 四</td><td>LS-360h</td><td>0%</td><td>44.5</td></tr><tr><td>wav2vec2-base</td><td>LS-960h</td><td>0%</td><td>18.7</td></tr><tr><td>wav2vec2+ OMP</td><td>LS-960h</td><td>70%</td><td>41.3</td></tr><tr><td>wav2vec2+PARP</td><td>LS-960h</td><td>90%</td><td>40.1</td></tr><tr><td> xlsr reported [29]</td><td>56,000h</td><td>0%</td><td>7.6</td></tr><tr><td>xlsr replicated</td><td>56.000h</td><td>0%</td><td>9.9</td></tr><tr><td>xlsr+OMP</td><td>56.000h</td><td>90%</td><td>33.9</td></tr><tr><td>xlsr+PARP-P</td><td>56,000h</td><td>90%</td><td>22.9</td></tr></table>
152
+
153
+ ![](images/a7694b462a9bd4edc7bebc7f494284e276f249da605557bab0d6e11d793a54a1.jpg)
154
+ Figure 5: PARP’s final subnetwork and its initial MPI subnetwork exceeds $9 9 . 9 9 \%$ IOU after $20 \%$ sparsity (black line).
155
+
156
+ # 4.2 How Important is the Initial Subnetwork (Step 1) in PARP?
157
+
158
+ Obtaining a good initial subnetwork (Step 1) is critical for PARP, as Adjust & Re-Prune (Step 2) is operated on top of it. In this section, we isolate the effect of Step 1 from Step 2 and examine the role of the initial subnetwork in PARP. Figure $\boxed { 6 }$ shows PARP with a random subnetwork from RP, instead of subnetwork from MPI, as the initial subnetwork. PARP with random initial subnetwork performs nearly as bad as RP (grey line), signifying the importance of the initial subnetwork.
159
+
160
+ Secondly, despite Observation 1, MPI in high sparsity regions (e.g. $90 \%$ in LSR) is not a good initial subnetwork, since the majority of the weights are already pruned out (thus is hard to be recovered from). From Figure 3, PARP performs only on par or even worse than IMP in high sparsity regions. In contrast, PARP-P starts with a relatively lower sparsity (e.g. $60 \%$ or $70 \%$ MPI), and progressively prunes up to the target sparsity. Doing so yields considerable performance gain (up to over $50 \%$ absolute WER reduction). Third, as shown in Figure $\underline { { \boldsymbol { \mathsf { F } } } } ,$ there is ${ > } 9 9 . 9 9 \%$ IOU between the final “adjusted” subnetwork from PARP and its initial MPI subnetwork after $2 0 \%$ sparsity, confirming Step 2 indeed only made minimal “adjustment” to the initial subnetwork.
161
+
162
+ ![](images/517450599b9f945f7458ac2802e6cf1240256e1de40f4600508dd23410512726.jpg)
163
+ Figure 6: PARP with random (red line) v.s. with MPI (black line) initial subnetworks in LSR.
164
+
165
+ ![](images/b448f34fe2f5b61d0a35a138bcba3b78cf3bdaf96af9e1f464158c795b7e04af.jpg)
166
+ Transferrability of Language Masks at $5 0 \%$ Sparsity in wav2vec 2.0 with PARP
167
+
168
+ ![](images/663911949f9d167024d6cfa3907289acfb193d6fa8fb47241943d41d0ad56c73.jpg)
169
+ Transferrability of Language Masks at $5 0 \%$ Sparsity in wav2vec 2.0
170
+ Figure 7: (Left) Cross-lingual OMP mask transfer with regular subnetwork finetuning. (Right) Cross-lingual OMP mask transfer with PARP. Last rows are RP. Values are relative PER gains over same-language pair transfer (hence the darker the bettter). Both are on H2L with pretrained wav2vec2. The same observation is observed on CSR with pretrained xlsr in Appendix 12.
171
+
172
+ # 4.3 Are Pruning Masks Transferrable across Spoken Languages?
173
+
174
+ Is it possible to discover subnetworks with the wrong guidance, and how transferrable are such subnetworks? More concretely, we investigate the transferability of OMP pruning mask discovered from a source language by finetuning its subnetwork on another target language. Such study should shed some insights on the underlying influence of spoken language structure on network pruning – that similar language pairs should be transferrable. From a practical perspective, consider pruning for an unseen new language in H2L, we could deploy the readily available discovered subnetworks and thus save the additional finetuning and memory costs.
175
+
176
+ In this case, the initial subnetwork of PARP is given by applying OMP on another spoken language. According to Observation $^ { 1 , }$ PARP’s Step 2 is effectively under-going cross-lingual subnetwork adaptation for the target language. Figure $\checkmark$ shows the transferability results on H2L with pre-trained wav2vec2-base. On the left is a subnetwork at $50 \%$ sparsity transfer with regular finetuning that contains subtle language clusters – for example, when finetuning on $r u$ , source masks from es, fr, it, ky, nl induces a much higher PER compare to that from sv-SE, tr, tt, zh-TW. On the right of Figure 7, we show that there is no cross-lingual PER degradation with PARP, supporting our claim above.
177
+
178
+ # 4.4 Discovering a Single Subnetwork for 10 Spoken Languages
179
+
180
+ A major downside of pruning pre-trained SSL models for many downstream tasks is the exponential computational and memory costs. In H2L and CSR, the same pruning method needs to be repeatedly re-run for each downstream spoken language at each given sparsity. Therefore, we investigate the possibility of obtaining a single shared subnetwork for all downstream languages. Instead of finetuning separately for each language, we construct a joint phoneme dictionary and finetune wav2vec2 and xlsr on all 10 languages jointly in H2L and CSR. Note that PARP with joint-finetuning can retrieve a shared subnetwork in a single run. The shared subnetwork can then be decoded for each language separately. The right side of Figure 4 illustrates the results.
181
+
182
+ Comparing joint-finetuning and individual-finetuning, in H2L, we found that the shared subnetwork obtained via OMP has lower PERs between $60 \sim 8 0 \%$ but slightly higher PERs in other sparsity regions; in CSR, the shared subnetwork from OMP has slightly worse PERs at all sparsities. Comparing PARP to OMP in joint-finetuning, we found that while PARP is effective in the individual-finetuning setting (left of Figure $\textcircled { 4 }$ , its shared subnetworks are only slightly better than OMP in both H2L and CSR (right of Figure $\bigoplus$ . The smaller performance gain of PARP over OMP in pruning jointly-finetuned models is expected, since the important weights for each language are disjoint and joint-finetuning may send mixed signal to the adjustment step in PARP (see Figure $\bigtriangledown$ for better illustration).
183
+
184
+ # 4.5 Does PARP work on Pre-trained BERT/XLNet?
185
+
186
+ We also analyzed whether Observation $\perp$ holds for pre-trained BERT/XLNet on 9 GLUE tasks. Surprisingly, we found that there are also high $( > 9 8 \% )$ overlaps between the 9 tasks’ IMP pruning masks. Given this observation, we replicated the cross-task subnetwork transfer experiment (take subnetwork found by IMP at task A and finetune it for task B) in BERT-Ticket $\mathbb { \oplus }$ on pre-trained BERT/XLNet with PARP. Table $\boxed { 4 }$ compares PARP (averaged for each target task) to regular finetuning, hinting the applicability of PARP to more pre-trained NLP models and downstream natural language tasks. Detailed scores and figures are in Appendix 13.
187
+
188
+ ![](images/6b33062236588c83677a91b2b658d463d018dbf68d345eb44aa4a62c1b368a57.jpg)
189
+ Figure 8: Conceptual sketch of pruning the few task-specific important weights in pretrained SSL. (A) Task-aware subnetwork discovery(OMP/IMP) is more effective than task-agnostic pruning (MPI) since it foresees the important weights in advance, via multiple downstream finetunings. $\mathbf { ( B ) }$ PARP starts with an initial subnetwork given by MPI. Observation 1 suggests that the subnetwork is only off by the few important weights, and thus Step 2 revives them by adjusting the initial subnetwork.
190
+
191
+ # 4.6 Implications
192
+
193
+ Observation 1 is consistent with the findings of probing large pre-trained NLP models, that pre-trained SSL models are over-parametrized and there exist task-oriented weights/neurons. Figure $2$ implies that these important weights only account for a small part of the pre-trained speech SSL. In fact, a large body of NLP work is dedicated to studying task-oriented weights in pre-trained models. To name a few, $\boxed { 1 3 7 } \boxed { 3 5 } \boxed { 7 } \boxed { 1 1 5 }$ measured, [7, 34, 61] leveraged, [81, 46] visualized, and [105, 36, 13] pruned out these important weights/neurons via probing and quantifying contextualized representations. Based on Observation 1, we can project that these NLP results should in general transfer to speech, see pioneering studies [9, 8, 24, 23]. However, different from them, PARP leverages important weights for UMP on the whole network structure instead of just the contextualized representations.
194
+
195
+ We could further hypothesize that a good pruning algorithm avoids pruning out task-specific neurons in pre-trained SSL [67, 48, 79], see Figure $8 .$ This hypothesis not only offers an explanation on why PARP is effective in high sparsity regions and cross-lingual mask transfer, it also suggests that an iterative method such as IMP is superior to OMP because IMP gradually avoids pruning out important weights in several iterations, at the cost of more compute6. Finally, we make connections to prior work that showed RP prevail [11, 19, 75, 77, 92] – under a certain threshold and setting, task-specific neurons are less likely to get “accidentally” pruned and thus accuracy is preserved even with RP.
196
+
197
+ # 5 Related Work
198
+
199
+ Modern Speech Paradigm and ASR Pruning. As model scale [101, 6, 50, 47, 124, 90, 89, 125, 16, 121, $\bar { \left\lfloor 6 8 \right\rfloor }$ and model pre-training [6, 127, 29, 60, 57, 63, 55, 118, 14, 58, 96, 95, 83, 86, 109] have become the two essential ingredients for obtaining SOTA performance in ASR and other speech tasks, applying and developing various forms of memory-efficient algorithms, such as network pruning, to these large-scale pre-trained models will predictably soon become an indispensable research endeavor. Early work on ASR pruning can be dated back to pruning decoding search spaces [1, 91, 100, 52, 116, 128] and HMM state space $\mathbb { I O 3 } \mathbb { I }$ . Since the seminal work of Yu et al. $\mathbb { \lVert 1 2 2 \rVert }$ , ASR pruning has focused primarily on end-to-end network architecture: [98, 114] applied pruning and quantization to LSTM-based RNN-Transducers, $\lVert \overline { { 8 5 } } \rVert$ applied knowledge distillation to Conformer-based RNN-Transducers, [104, 99, $\textcircled { 7 0 }$ designed efficient architecture/mechanisms for LSTM, Transformer, Conformer-based ASR models, $\pmb { \mathbb { B 2 } }$ applied pruning to Deep Speech, [12] introduced SNR-based probabilistic pruning on LSTM-based CTC model, $\check { \mathbb { B } } 3 \mathbb { I }$ proposed entropyregularizer for LSTM-based ASR model, [119, $\textcircled { 8 7 }$ applied SVD on ASR models’ weight matrices. We emphasize that our work is the first on pruning large self-supervised pre-trained models for low-resource and multi-lingual ASR. In addition, to our knowledge, none of the prior speech pruning work demonstrated the pruned models attain superior performance than its original counterpart.
200
+
201
+ # 6 Conclusions
202
+
203
+ We introduce PARP, a simple and intuitive pruning method for self-supervised speech recognition. We conduct extensive experiments on pruning pre-trained wav2vec 2.0 and XLSR-53 under three low-resource settings, demonstrating (1) PARP discovers better subnetworks than baseline pruning methods while requiring a fraction of their computational cost, (2) the discovered subnetworks yields over $10 \%$ WER reduction over the full model, (3) PARP induces minimal cross-lingual subnetwork adaptation errors, (4) PARP can discover a shared subnetwork for multiple spoken languages in one pass, and (5) PARP significantly reduces cross-task adaptation errors of pre-trained BERT/XLNet. Beyond the scope of our study, we aspire PARP as the beginning of many future endeavours on developing more efficient speech SSL models.
204
+
205
+ Broader Impact. The broader impact of this research work is making speech technologies more accessible in two orthogonal dimensions: (i) extending modern-day speech technology to many under-explored low-resource spoken languages, and (ii) introducing a new and flexible pruning technique to current and future speech SSL frameworks that reduces the computational costs required for adapting (finetuning) them to custom settings. We do not see its potential societal harm.
206
+
207
+ # Limitations and Future Work
208
+
209
+ We make clear of the major limitations of our work, and the full list is in Appendix 19. The basis of all the pruning methods in the study is unstructured magnitude weight pruning. Although sparsity is explicitly enforced in the models, we do not suggest that the sparse models are more memory or energy efficient than the original dense models. We do believe that our methodology and results should provide meaningful insights and be easily extended upon to more advanced unstructured or structured pruning methods. We are also curious of the possibility of finetuning or storing modern speech SSL models on local hardware devices.
210
+
211
+ Results on cross-lingual mask transfer on pre-trained wav2vec 2.0 in Section $\boxed { 4 . 3 }$ is limited to ASR. We do not claim pruning masks to be transferrable across speech tasks (e.g. prune wav2vec2 for speaker ID and transfer for ASR). We provide a pilot cross-task mask transfer study on 3 speech tasks (phone recognition, speaker recognition, slot-filling) in SUPERB [120], and results is in Appendix 16.
212
+
213
+ We claim PARP could improve the downstream ASR performance over the full wav2vec 2.0, yet we do not claim it as a plug-and-play method into any SOTA ASR pipeline, such as $\mathbb { L } 2 6 \mathbb { I }$ , to get a performance boost. We provide a preliminary experiment on combining PARP and transformer-LM decoding in Appendix $\boxed { 1 5 }$ Nonetheless, due to resource limitations and to isolate the effect of pruning, it remains upon investigations on the complete effects of speech pruning in different setups.
214
+
215
+ # Acknowledgments
216
+
217
+ We thank IBM for the donation to MIT of the Satori GPU cluster, and John Cohn for maintaining the cluster. We also thank Lucy Chai, Wei-Ning Hsu, Desh Raj, Shu-wen Leo Yang, Abdelrahman Mohamedm, Erica Cooper, and anonymous reviewers for helpful suggestions and paper editing. This work is part of the low-resource language learning project funded by the MIT-IBM Waston AI Lab.
218
+
219
+ # References
220
+
221
+ [1] Sherif Abdou and Michael S Scordilis. Beam search pruning in speech recognition using a posterior probability-based confidence measure. Speech Communication, 42(3-4):409–428, 2004.
222
+ [2] Junyi Ao, Rui Wang, Long Zhou, Shujie Liu, Shuo Ren, Yu Wu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, et al. Speecht5: Unified-modal encoder-decoder pre-training for spoken language processing. arXiv preprint arXiv:2110.07205, 2021.
223
+ [3] Alexei Baevski, Michael Auli, and Abdelrahman Mohamed. Effectiveness of self-supervised pre-training for speech recognition. arXiv preprint arXiv:1911.03912, 2019.
224
+ [4] Alexei Baevski, Wei-Ning Hsu, Alexis Conneau, and Michael Auli. Unsupervised speech recognition. arXiv preprint arXiv:2105.11084, 2021.
225
+ [5] Alexei Baevski, Steffen Schneider, and Michael Auli. vq-wav2vec: Self-supervised learning of discrete speech representations. arXiv preprint arXiv:1910.05453, 2019.
226
+ [6] Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, and Michael Auli. wav2vec 2.0: A framework for self-supervised learning of speech representations. arXiv preprint arXiv:2006.11477, 2020.
227
+ [7] Anthony Bau, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. Identifying and controlling important neurons in neural machine translation. arXiv preprint arXiv:1811.01157, 2018.
228
+ [8] Yonatan Belinkov, Ahmed Ali, and James Glass. Analyzing phonetic and graphemic representations in end-to-end automatic speech recognition. arXiv preprint arXiv:1907.04224, 2019.
229
+ [9] Yonatan Belinkov and James Glass. Analyzing hidden representations in end-to-end automatic speech recognition systems. arXiv preprint arXiv:1709.04482, 2017.
230
+ [10] Guillaume Bellec, David Kappel, Wolfgang Maass, and Robert Legenstein. Deep rewiring: Training very sparse deep networks. arXiv preprint arXiv:1711.05136, 2017.
231
+ [11] Davis Blalock, Jose Javier Gonzalez Ortiz, Jonathan Frankle, and John Guttag. What is the state of neural network pruning? arXiv preprint arXiv:2003.03033, 2020.
232
+ [12] Stefan Braun and Shih-Chii Liu. Parameter uncertainty for end-to-end speech recognition. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5636–5640. IEEE, 2019.
233
+ [13] Steven Cao, Victor Sanh, and Alexander M Rush. Low-complexity probing via finding subnetworks. arXiv preprint arXiv:2104.03514, 2021.
234
+ [14] William Chan, Daniel Park, Chris Lee, Yu Zhang, Quoc Le, and Mohammad Norouzi. Speechstew: Simply mix all available speech recognition data to train one large neural network. arXiv preprint arXiv:2104.02133, 2021.
235
+ [15] Xuankai Chang, Takashi Maekaku, Pengcheng Guo, Jing Shi, Yen-Ju Lu, Aswin Shanmugam Subramanian, Tianzi Wang, Shu-wen Yang, Yu Tsao, Hung-yi Lee, et al. An exploration of self-supervised pretrained representations for end-to-end speech recognition. arXiv preprint arXiv:2110.04590, 2021.
236
+ [16] Sanyuan Chen, Yu Wu, Zhuo Chen, Jian Wu, Jinyu Li, Takuya Yoshioka, Chengyi Wang, Shujie Liu, and Ming Zhou. Continuous speech separation with conformer. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5749–5753. IEEE, 2021.
237
+ [17] Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, et al. Unispeech-sat: Universal speech representation learning with speaker aware pre-training. arXiv preprint arXiv:2110.05752, 2021.
238
+ [18] 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 preprint arXiv:2012.06908, 2020.
239
+ [19] 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 preprint arXiv:2007.12223, 2020.
240
+ [20] Yi-Chen Chen, Shu-wen Yang, Cheng-Kuang Lee, Simon See, and Hung-yi Lee. Speech representation learning through self-supervised pretraining and multi-task finetuning. arXiv preprint arXiv:2110.09930, 2021.
241
+ [21] Jaejin Cho, Murali Karthick Baskar, Ruizhi Li, Matthew Wiesner, Sri Harish Mallidi, Nelson Yalta, Martin Karafiat, Shinji Watanabe, and Takaaki Hori. Multilingual sequence-to-sequence speech recognition: architecture, transfer learning, and language modeling. In 2018 IEEE Spoken Language Technology Workshop (SLT), pages 521–527. IEEE, 2018.
242
+ [22] Jan Chorowski, Grzegorz Ciesielski, Jarosław Dzikowski, Adrian Łancucki, Ricard Marxer, Mateusz Opala, Piotr Pusz, Paweł Rychlikowski, and Michał Stypułkowski. Aligned contrastive predictive coding. arXiv preprint arXiv:2104.11946, 2021.
243
+ [23] Shammur Absar Chowdhury, Nadir Durrani, and Ahmed Ali. What do end-to-end speech models learn about speaker, language and channel information? a layer-wise and neuron-level analysis. arXiv preprint arXiv:2107.00439, 2021.
244
+ [24] Yu-An Chung, Yonatan Belinkov, and James Glass. Similarity analysis of self-supervised speech representations. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 3040–3044. IEEE, 2021.
245
+ [25] Yu-An Chung, Wei-Ning Hsu, Hao Tang, and James Glass. An unsupervised autoregressive model for speech representation learning. arXiv preprint arXiv:1904.03240, 2019.
246
+ [26] Yu-An Chung, Wei-Hung Weng, Schrasing Tong, and James Glass. Unsupervised cross-modal alignment of speech and text embedding spaces. arXiv preprint arXiv:1805.07467, 2018.
247
+ [27] Yu-An Chung, Yu Zhang, Wei Han, Chung-Cheng Chiu, James Qin, Ruoming Pang, and Yonghui Wu. W2v-bert: Combining contrastive learning and masked language modeling for self-supervised speech pre-training. arXiv preprint arXiv:2108.06209, 2021.
248
+ [28] Yu-An Chung, Chenguang Zhu, and Michael Zeng. Splat: Speech-language joint pre-training for spoken language understanding. arXiv preprint arXiv:2010.02295, 2020.
249
+ [29] 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.
250
+ [30] Erica Cooper, Wen-Chin Huang, Tomoki Toda, and Junichi Yamagishi. Generalization ability of mos prediction networks. arXiv preprint arXiv:2110.02635, 2021.
251
+ [31] Jia Cui, Xiaodong Cui, Bhuvana Ramabhadran, Janice Kim, Brian Kingsbury, Jonathan Mamou, Lidia Mangu, Michael Picheny, Tara N Sainath, and Abhinav Sethy. Developing speech recognition systems for corpus indexing under the iarpa babel program. In 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, pages 6753–6757. IEEE, 2013.
252
+ [32] Jia Cui, Brian Kingsbury, Bhuvana Ramabhadran, Abhinav Sethy, Kartik Audhkhasi, Xiaodong Cui, Ellen Kislal, Lidia Mangu, Markus Nussbaum-Thom, Michael Picheny, et al. Multilingual representations for low resource speech recognition and keyword search. In 2015 IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU), pages 259–266. IEEE, 2015.
253
+ [33] Xiaodong Cui, Brian Kingsbury, Jia Cui, Bhuvana Ramabhadran, Andrew Rosenberg, Mohammad Sadegh Rasooli, Owen Rambow, Nizar Habash, and Vaibhava Goel. Improving deep neural network acoustic modeling for audio corpus indexing under the iarpa babel program. In Fifteenth Annual Conference of the International Speech Communication Association, 2014.
254
+ [34] Damai Dai, Li Dong, Yaru Hao, Zhifang Sui, and Furu Wei. Knowledge neurons in pretrained transformers. arXiv preprint arXiv:2104.08696, 2021.
255
+ [35] Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, Anthony Bau, and James Glass. What is one grain of sand in the desert? analyzing individual neurons in deep nlp models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6309–6317, 2019.
256
+ [36] Fahim Dalvi, Hassan Sajjad, Nadir Durrani, and Yonatan Belinkov. Analyzing redundancy in pretrained transformer models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4908–4926, 2020.
257
+ [37] Nadir Durrani, Hassan Sajjad, Fahim Dalvi, and Yonatan Belinkov. Analyzing individual neurons in pre-trained language models. arXiv preprint arXiv:2010.02695, 2020.
258
+ [38] Radek Fer, Pavel Matejka, Franti ˇ šek Grézl, Oldˇrich Plchot, Karel Vesely, and Jan Honza \` Cernock ˇ y. \` Multilingually trained bottleneck features in spoken language recognition. Computer Speech & Language, 46:252–267, 2017.
259
+ [39] Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. arXiv preprint arXiv:1803.03635, 2018.
260
+ [40] Jonathan Frankle, Gintare Karolina Dziugaite, Daniel Roy, and Michael Carbin. Linear mode connectivity and the lottery ticket hypothesis. In International Conference on Machine Learning, pages 3259–3269. PMLR, 2020.
261
+ [41] Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574, 2019.
262
+ [42] Mark JF Gales, Kate M Knill, Anton Ragni, and Shakti P Rath. Speech recognition and keyword spotting for low-resource languages: Babel project research at cued. In Fourth International Workshop on Spoken Language Technologies for Under-Resourced Languages (SLTU-2014), pages 16–23. International Speech Communication Association (ISCA), 2014.
263
+ [43] Dawei Gao, Xiaoxi He, Zimu Zhou, Yongxin Tong, Ke Xu, and Lothar Thiele. Rethinking pruning for accelerating deep inference at the edge. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 155–164, 2020.
264
+ [44] Heting Gao, Junrui Ni, Yang Zhang, Kaizhi Qian, Shiyu Chang, and Mark Hasegawa-Johnson. Zero-shot cross-lingual phonetic recognition with external language embedding. Proc. Interspeech 2021, pages 1304–1308, 2021.
265
+ [45] Sharath Girish, Shishira R Maiya, Kamal Gupta, Hao Chen, Larry Davis, and Abhinav Shrivastava. The lottery ticket hypothesis for object recognition. arXiv preprint arXiv:2012.04643, 2020.
266
+ [46] Gabriel Goh, Nick Cammarata, Chelsea Voss, Shan Carter, Michael Petrov, Ludwig Schubert, Alec Radford, and Chris Olah. Multimodal neurons in artificial neural networks. Distill, 6(3):e30, 2021.
267
+ [47] 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.
268
+ [48] Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. arXiv preprint arXiv:1608.04493, 2016.
269
+ [49] Song Han, Jeff Pool, John Tran, and William J Dally. Learning both weights and connections for efficient neural networks. arXiv preprint arXiv:1506.02626, 2015.
270
+ [50] 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.
271
+ [51] Babak Hassibi and David G Stork. Second order derivatives for network pruning: Optimal brain surgeon. Morgan Kaufmann, 1993.
272
+ [52] Tianxing He, Yuchen Fan, Yanmin Qian, Tian Tan, and Kai Yu. Reshaping deep neural network for fast decoding by node-pruning. In 2014 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 245–249. IEEE, 2014.
273
+ [53] Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, and Abdelrahman Mohamed. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. arXiv preprint arXiv:2106.07447, 2021.
274
+ [54] Wei-Ning Hsu, Anuroop Sriram, Alexei Baevski, Tatiana Likhomanenko, Qiantong Xu, Vineel Pratap, Jacob Kahn, Ann Lee, Ronan Collobert, Gabriel Synnaeve, et al. Robust wav2vec 2.0: Analyzing domain shift in self-supervised pre-training. arXiv preprint arXiv:2104.01027, 2021.
275
+ [55] Wei-Ning Hsu, Yao-Hung Hubert Tsai, Benjamin Bolte, Ruslan Salakhutdinov, and Abdelrahman Mohamed. Hubert: How much can a bad teacher benefit asr pre-training? In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6533–6537. IEEE, 2021.
276
+ [56] Wen-Chin Huang, Shu-Wen Yang, Tomoki Hayashi, Hung-Yi Lee, Shinji Watanabe, and Tomoki Toda. S3prl-vc: Open-source voice conversion framework with self-supervised speech representations. arXiv preprint arXiv:2110.06280, 2021.
277
+ [57] Dongwei Jiang, Wubo Li, Miao Cao, Ruixiong Zhang, Wei Zou, Kun Han, and Xiangang Li. Speech simclr: Combining contrastive and reconstruction objective for self-supervised speech representation learning. arXiv preprint arXiv:2010.13991, 2020.
278
+ [58] Naoyuki Kanda, Guoli Ye, Yu Wu, Yashesh Gaur, Xiaofei Wang, Zhong Meng, Zhuo Chen, and Takuya Yoshioka. Large-scale pre-training of end-to-end multi-talker asr for meeting transcription with single distant microphone. arXiv preprint arXiv:2103.16776, 2021.
279
+ [59] Eugene Kharitonov, Ann Lee, Adam Polyak, Yossi Adi, Jade Copet, Kushal Lakhotia, Tu-Anh Nguyen, Morgane Rivière, Abdelrahman Mohamed, Emmanuel Dupoux, et al. Text-free prosody-aware generative spoken language modeling. arXiv preprint arXiv:2109.03264, 2021.
280
+ [60] Qiuqiang Kong, Yin Cao, Turab Iqbal, Yuxuan Wang, Wenwu Wang, and Mark D Plumbley. Panns: Large-scale pretrained audio neural networks for audio pattern recognition. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 28:2880–2894, 2020.
281
+ [61] Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. Revealing the dark secrets of bert. arXiv preprint arXiv:1908.08593, 2019.
282
+ [62] Cheng-I Lai. Contrastive predictive coding based feature for automatic speaker verification. arXiv preprint arXiv:1904.01575, 2019.
283
+ [63] Cheng-I Lai, Yung-Sung Chuang, Hung-Yi Lee, Shang-Wen Li, and James Glass. Semi-supervised spoken language understanding via self-supervised speech and language model pretraining. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 7468–7472. IEEE, 2021.
284
+ [64] Kushal Lakhotia, Evgeny Kharitonov, Wei-Ning Hsu, Yossi Adi, Adam Polyak, Benjamin Bolte, Tu-Anh Nguyen, Jade Copet, Alexei Baevski, Adelrahman Mohamed, et al. Generative spoken language modeling from raw audio. arXiv preprint arXiv:2102.01192, 2021.
285
+ [65] Yann LeCun, John S Denker, and Sara A Solla. Optimal brain damage. In Advances in neural information processing systems, pages 598–605, 1990.
286
+ [66] Ann Lee, Peng-Jen Chen, Changhan Wang, Jiatao Gu, Xutai Ma, Adam Polyak, Yossi Adi, Qing He, Yun Tang, Juan Pino, et al. Direct speech-to-speech translation with discrete units. arXiv preprint arXiv:2107.05604, 2021.
287
+ [67] Namhoon Lee, Thalaiyasingam Ajanthan, and Philip HS Torr. Snip: Single-shot network pruning based on connection sensitivity. arXiv preprint arXiv:1810.02340, 2018.
288
+ [68] Bo Li, Ruoming Pang, Tara N Sainath, Anmol Gulati, Yu Zhang, James Qin, Parisa Haghani, W Ronny Huang, and Min Ma. Scaling end-to-end models for large-scale multilingual asr. arXiv preprint arXiv:2104.14830, 2021.
289
+ [69] Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016.
290
+ [70] Shengqiang Li, Menglong Xu, and Xiao-Lei Zhang. Efficient conformer-based speech recognition with linear attention. arXiv preprint arXiv:2104.06865, 2021.
291
+ [71] Shaoshi Ling and Yuzong Liu. Decoar 2.0: Deep contextualized acoustic representations with vector quantization. arXiv preprint arXiv:2012.06659, 2020.
292
+ [72] Alexander H Liu, Yu-An Chung, and James Glass. Non-autoregressive predictive coding for learning speech representations from local dependencies. arXiv preprint arXiv:2011.00406, 2020.
293
+ [73] Andy T Liu, Shang-Wen Li, and Hung-yi Lee. Tera: Self-supervised learning of transformer encoder representation for speech. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 29:2351– 2366, 2021.
294
+ [74] Andy T Liu, Shu-wen Yang, Po-Han Chi, Po-chun Hsu, and Hung-yi Lee. Mockingjay: Unsupervised speech representation learning with deep bidirectional transformer encoders. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6419–6423. IEEE, 2020.
295
+ [75] Zhuang Liu, Mingjie Sun, Tinghui Zhou, Gao Huang, and Trevor Darrell. Rethinking the value of network pruning. arXiv preprint arXiv:1810.05270, 2018.
296
+ [76] Takashi Maekaku, Xuankai Chang, Yuya Fujita, Li-Wei Chen, Shinji Watanabe, and Alexander Rudnicky. Speech representation learning combining conformer cpc with deep cluster for the zerospeech challenge 2021. arXiv preprint arXiv:2107.05899, 2021.
297
+ [77] Eran Malach, Gilad Yehudai, Shai Shalev-Schwartz, and Ohad Shamir. Proving the lottery ticket hypothesis: Pruning is all you need. In International Conference on Machine Learning, pages 6682–6691. PMLR, 2020.
298
+ [78] Yen Meng, Yi-Hui Chou, Andy T Liu, and Hung-yi Lee. Don’t speak too fast: The impact of data bias on self-supervised speech models. arXiv preprint arXiv:2110.07957, 2021.
299
+ [79] Pavlo Molchanov, Arun Mallya, Stephen Tyree, Iuri Frosio, and Jan Kautz. Importance estimation for neural network pruning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11264–11272, 2019.
300
+ [80] Rajiv Movva and Jason Y Zhao. Dissecting lottery ticket transformers: Structural and behavioral study of sparse neural machine translation. arXiv preprint arXiv:2009.13270, 2020.
301
+ [81] Jesse Mu and Jacob Andreas. Compositional explanations of neurons. arXiv preprint arXiv:2006.14032, 2020.
302
+ [82] Sharan Narang, Erich Elsen, Gregory Diamos, and Shubho Sengupta. Exploring sparsity in recurrent neural networks. arXiv preprint arXiv:1704.05119, 2017.
303
+ [83] Edwin G Ng, Chung-Cheng Chiu, Yu Zhang, and William Chan. Pushing the limits of non-autoregressive speech recognition. arXiv preprint arXiv:2104.03416, 2021.
304
+ [84] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
305
+ [85] Sankaran Panchapagesan, Daniel S Park, Chung-Cheng Chiu, Yuan Shangguan, Qiao Liang, and Alexander Gruenstein. Efficient knowledge distillation for rnn-transducer models. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5639–5643. IEEE, 2021.
306
+ [86] Adam Polyak, Yossi Adi, Jade Copet, Eugene Kharitonov, Kushal Lakhotia, Wei-Ning Hsu, Abdelrahman Mohamed, and Emmanuel Dupoux. Speech resynthesis from discrete disentangled self-supervised representations. arXiv preprint arXiv:2104.00355, 2021.
307
+ [87] Daniel Povey, Gaofeng Cheng, Yiming Wang, Ke Li, Hainan Xu, Mahsa Yarmohammadi, and Sanjeev Khudanpur. Semi-orthogonal low-rank matrix factorization for deep neural networks. In Interspeech, pages 3743–3747, 2018.
308
+ [88] Sai Prasanna, Anna Rogers, and Anna Rumshisky. When bert plays the lottery, all tickets are winning. arXiv preprint arXiv:2005.00561, 2020.
309
+ [89] Vineel Pratap, Anuroop Sriram, Paden Tomasello, Awni Hannun, Vitaliy Liptchinsky, Gabriel Synnaeve, and Ronan Collobert. Massively multilingual asr: 50 languages, 1 model, 1 billion parameters. arXiv preprint arXiv:2007.03001, 2020.
310
+ [90] Vineel Pratap, Qiantong Xu, Jacob Kahn, Gilad Avidov, Tatiana Likhomanenko, Awni Hannun, Vitaliy Liptchinsky, Gabriel Synnaeve, and Ronan Collobert. Scaling up online speech recognition using convnets. arXiv preprint arXiv:2001.09727, 2020.
311
+ [91] Janne Pylkkönen. New pruning criteria for efficient decoding. In Ninth European Conference on Speech Communication and Technology, 2005.
312
+ [92] Vivek Ramanujan, Mitchell Wortsman, Aniruddha Kembhavi, Ali Farhadi, and Mohammad Rastegari. What’s hidden in a randomly weighted neural network? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11893–11902, 2020.
313
+ [93] Alex Renda, Jonathan Frankle, and Michael Carbin. Comparing rewinding and fine-tuning in neural network pruning. arXiv preprint arXiv:2003.02389, 2020.
314
+ [94] Morgane Rivière, Armand Joulin, Pierre-Emmanuel Mazaré, and Emmanuel Dupoux. Unsupervised pretraining transfers well across languages. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 7414–7418. IEEE, 2020.
315
+ [95] Aaqib Saeed, David Grangier, and Neil Zeghidour. Contrastive learning of general-purpose audio representations. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 3875–3879. IEEE, 2021.
316
+ [96] Ramon Sanabria, Austin Waters, and Jason Baldridge. Talk, don’t write: A study of direct speech-based image retrieval. arXiv preprint arXiv:2104.01894, 2021.
317
+ [97] Victor Sanh, Thomas Wolf, and Alexander M Rush. Movement pruning: Adaptive sparsity by fine-tuning. arXiv preprint arXiv:2005.07683, 2020.
318
+ [98] Yuan Shangguan, Jian Li, Qiao Liang, Raziel Alvarez, and Ian McGraw. Optimizing speech recognition for the edge. arXiv preprint arXiv:1909.12408, 2019.
319
+ [99] Yangyang Shi, Yongqiang Wang, Chunyang Wu, Ching-Feng Yeh, Julian Chan, Frank Zhang, Duc Le, and Mike Seltzer. Emformer: Efficient memory transformer based acoustic model for low latency streaming speech recognition. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6783–6787. IEEE, 2021.
320
+ [100] Vesa Siivola, Teemu Hirsimaki, and Sami Virpioja. On growing and pruning kneser–ney smoothed $_ n$ -gram models. IEEE Transactions on Audio, Speech, and Language Processing, 15(5):1617–1624, 2007.
321
+ [101] Gabriel Synnaeve, Qiantong Xu, Jacob Kahn, Tatiana Likhomanenko, Edouard Grave, Vineel Pratap, Anuroop Sriram, Vitaliy Liptchinsky, and Ronan Collobert. End-to-end asr: from supervised to semisupervised learning with modern architectures. arXiv preprint arXiv:1911.08460, 2019.
322
+ [102] Liang-Hsuan Tseng, Yu-Kuan Fu, Heng-Jui Chang, and Hung-yi Lee. Mandarin-english code-switching speech recognition with self-supervised speech representation models. arXiv preprint arXiv:2110.03504, 2021.
323
+ [103] Hugo Van Hamme and Filip Van Aelten. An adaptive-beam pruning technique for continuous speech recognition. In Proceeding of Fourth International Conference on Spoken Language Processing. ICSLP’96, volume 4, pages 2083–2086. IEEE, 1996.
324
+ [104] Ganesh Venkatesh, Alagappan Valliappan, Jay Mahadeokar, Yuan Shangguan, Christian Fuegen, Michael L Seltzer, and Vikas Chandra. Memory-efficient speech recognition on smart devices. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 8368–8372. IEEE, 2021.
325
+ [105] Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head selfattention: Specialized heads do the heavy lifting, the rest can be pruned. arXiv preprint arXiv:1905.09418, 2019.
326
+ [106] 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. arXiv preprint arXiv:1804.07461, 2018.
327
+ [107] Chengyi Wang, Yu Wu, Shujie Liu, Jinyu Li, Yao Qian, Kenichi Kumatani, and Furu Wei. Unispeech at scale: An empirical study of pre-training method on large-scale speech recognition dataset. arXiv preprint arXiv:2107.05233, 2021.
328
+ [108] Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, and Xuedong Huang. Unispeech: Unified speech representation learning with labeled and unlabeled data. arXiv preprint arXiv:2101.07597, 2021.
329
+ [109] Jun Wang, Max W Y Lam, Dan Su, and Dong Yu. Contrastive separative coding for self-supervised representation learning. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 3865–3869. IEEE, 2021.
330
+ [110] Weiran Wang, Qingming Tang, and Karen Livescu. Unsupervised pre-training of bidirectional speech encoders via masked reconstruction. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6889–6893. IEEE, 2020.
331
+ [111] Yiming Wang, Jinyu Li, Heming Wang, Yao Qian, Chengyi Wang, and Yu Wu. Wav2vec-switch: Contrastive learning from original-noisy speech pairs for robust speech recognition. arXiv preprint arXiv:2110.04934, 2021.
332
+ [112] Matthew Wiesner, Desh Raj, and Sanjeev Khudanpur. Injecting text and cross-lingual supervision in few-shot learning from self-supervised models. arXiv preprint arXiv:2110.04863, 2021.
333
+ [113] John M Wu, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. Similarity analysis of contextual word representation models. arXiv preprint arXiv:2005.01172, 2020.
334
+ [114] Zhaofeng Wu, Ding Zhao, Qiao Liang, Jiahui Yu, Anmol Gulati, and Ruoming Pang. Dynamic sparsity neural networks for automatic speech recognition. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6014–6018. IEEE, 2021.
335
+ [115] Ji Xin, Jimmy Lin, and Yaoliang Yu. What part of the neural network does this? understanding lstms by measuring and dissecting neurons. 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), pages 5827–5834, 2019.
336
+ [116] Hainan Xu, Tongfei Chen, Dongji Gao, Yiming Wang, Ke Li, Nagendra Goel, Yishay Carmiel, Daniel Povey, and Sanjeev Khudanpur. A pruned rnnlm lattice-rescoring algorithm for automatic speech recognition. In 2018 IEEE international conference on acoustics, speech and signal processing (ICASSP), pages 5929–5933. IEEE, 2018.
337
+ [117] Qiantong Xu, Alexei Baevski, and Michael Auli. Simple and effective zero-shot cross-lingual phoneme recognition. arXiv preprint arXiv:2109.11680, 2021.
338
+ [118] Qiantong Xu, Alexei Baevski, Tatiana Likhomanenko, Paden Tomasello, Alexis Conneau, Ronan Collobert, Gabriel Synnaeve, and Michael Auli. Self-training and pre-training are complementary for speech recognition. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 3030–3034. IEEE, 2021.
339
+ [119] Jian Xue, Jinyu Li, and Yifan Gong. Restructuring of deep neural network acoustic models with singular value decomposition. In Interspeech, pages 2365–2369, 2013.
340
+ [120] Shu-wen Yang, Po-Han Chi, Yung-Sung Chuang, Cheng-I Jeff Lai, Kushal Lakhotia, Yist Y Lin, Andy T Liu, Jiatong Shi, Xuankai Chang, Guan-Ting Lin, et al. Superb: Speech processing universal performance benchmark. arXiv preprint arXiv:2105.01051, 2021.
341
+ [121] Zhao You, Shulin Feng, Dan Su, and Dong Yu. Speechmoe: Scaling to large acoustic models with dynamic routing mixture of experts. arXiv preprint arXiv:2105.03036, 2021.
342
+ [122] Dong Yu, Frank Seide, Gang Li, and Li Deng. Exploiting sparseness in deep neural networks for large vocabulary speech recognition. In 2012 IEEE International conference on acoustics, speech and signal processing (ICASSP), pages 4409–4412. IEEE, 2012.
343
+ [123] Haonan Yu, Sergey Edunov, Yuandong Tian, and Ari S Morcos. Playing the lottery with rewards and multiple languages: lottery tickets in rl and nlp. arXiv preprint arXiv:1906.02768, 2019.
344
+ [124] Jiahui Yu, Wei Han, Anmol Gulati, Chung-Cheng Chiu, Bo Li, Tara N Sainath, Yonghui Wu, and Ruoming Pang. Universal asr: Unify and improve streaming asr with full-context modeling. arXiv preprint arXiv:2010.06030, 2020.
345
+ [125] Jiahui Yu, Wei Han, Anmol Gulati, Chung-Cheng Chiu, Bo Li, Tara N Sainath, Yonghui Wu, and Ruoming Pang. Dual-mode asr: Unify and improve streaming asr with full-context modeling. Proceedings of ICLR, 2021.
346
+ [126] Yu Zhang, Daniel S Park, Wei Han, James Qin, Anmol Gulati, Joel Shor, Aren Jansen, Yuanzhong Xu, Yanping Huang, Shibo Wang, et al. Bigssl: Exploring the frontier of large-scale semi-supervised learning for automatic speech recognition. arXiv preprint arXiv:2109.13226, 2021.
347
+ [127] Yu Zhang, James Qin, Daniel S Park, Wei Han, Chung-Cheng Chiu, Ruoming Pang, Quoc V Le, and Yonghui Wu. Pushing the limits of semi-supervised learning for automatic speech recognition. arXiv preprint arXiv:2010.10504, 2020.
348
+ [128] Yuekai Zhang, Sining Sun, and Long Ma. Tiny transducer: A highly-efficient speech recognition model on edge devices. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6024–6028. IEEE, 2021.
349
+ [129] Han Zhu, Li Wang, Ying Hou, Jindong Wang, Gaofeng Cheng, Pengyuan Zhang, and Yonghong Yan. Wav2vec-s: Semi-supervised pre-training for speech recognition. arXiv preprint arXiv:2110.04484, 2021.
md/train/jnMjOctlfbZ/jnMjOctlfbZ.md ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ATOM3D: TASKS ON MOLECULES IN THREE DIMENSIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ While a variety of methods have been developed for predicting molecular properties, deep learning networks that operate directly on three-dimensional molecular structure have recently demonstrated particular promise. In this work we present ATOM3D, a collection of both novel and existing datasets spanning several key classes of biomolecules, to systematically assess such learning methods. We develop three-dimensional molecular learning networks for each of these tasks, finding that they consistently improve performance relative to one- and twodimensional methods. The specific choice of architecture proves to be critical for performance, with three-dimensional convolutional networks excelling at tasks involving complex geometries, while graph networks perform well on systems requiring detailed positional information. Furthermore, equivariant networks show significant promise but are currently unable to scale. Our results indicate many molecular problems stand to gain from three-dimensional molecular learning. All code and datasets are available at github.com/xxxxxxx/xxxxxx.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A molecule’s three-dimensional (3D) shape is critical to understanding its physical mechanisms of action, and can be used to answer a number of questions relating to drug discovery, molecular design, and fundamental biology. A molecule’s atoms often adopt specific 3D configurations that minimize its free energy, and by representing these 3D positions—the atomistic geometry—we can model this 3D shape in ways that would not be possible with 1D or 2D representations such as linear sequences or chemical bond graphs (Table 1). However, existing works that examine diverse molecular tasks, such as MoleculeNet (Wu et al., 2018) or TAPE (Rao et al., 2019), focus on these lower dimensional representations. In this work, we demonstrate the benefit yielded by learning on 3D atomistic geometry and promote the development of 3D molecular learning by providing a collection of datasets leveraging this representation.
12
+
13
+ Furthermore, we argue that the atom should be considered a “machine learning datatype” in its own right, deserving focused study much like images in computer vision or text in natural language processing. All molecules, including proteins, small molecule compounds, and nucleic acids, can be homogeneously represented as atoms in 3D space. These atoms can only belong to a fixed class of element types (e.g. carbon, nitrogen, oxygen), and are all governed by the same underlying laws of physics, leading to important rotational, translational, and permutational symmetries. These systems also contain higher-level patterns that are poorly characterized, creating a ripe opportunity for learning them from data: though certain basic components are well understood (e.g. amino acids, nucleic acids, functional groups), many others can not easily be defined. These patterns are in turn composed in a hierarchy that itself is only partially elucidated.
14
+
15
+ While deep learning methods such as graph neural networks (GNNs) and convolutional neural networks (CNNs) seem especially well suited to atomistic geometry, to date there has been no systematic evaluation of such methods on molecular tasks. Additionally, despite the growing number of 3D structures available in databases such as the Protein Data Bank (PDB) (Berman et al., 2000), they require significant processing before they are useful for machine learning tasks. Inspired by the success of accessible databases such as ImageNet (Jia Deng et al., 2009) and SQuAD (Rajpurkar et al., 2016) in sparking progress in their respective fields, we create and curate benchmark datasets for atomistic tasks, process them into a simple and standardized format, systematically benchmark
16
+
17
+ Table 1: Representation choice for molecules. Adding in 3D information consistently improves performance. The depicted 1D representations are the amino acid sequence and SMILES (Weininger, 1988) for proteins and small molecules, respectively.
18
+
19
+ <table><tr><td rowspan="2">Structure LevelDimension</td><td rowspan="2"></td><td rowspan="2">Representation</td><td colspan="2">Examples</td></tr><tr><td>Proteins</td><td>Small Molecules</td></tr><tr><td>primary</td><td>1D</td><td>linear sequence</td><td>KVKALPDA</td><td>CC(C)CC(C)NO</td></tr><tr><td> secondary</td><td>2D</td><td>chemical bond graph</td><td>00001 O00-01 。 0 Q Oo00 oQ00Q obo O ○ o O</td><td>80 ○</td></tr><tr><td>tertiary</td><td>3D</td><td>atomistic geometry</td><td></td><td>)</td></tr></table>
20
+
21
+ 3D molecular learning methods, and present a set of best practices for other machine learning researchers interested in entering the field of 3D molecular learning. We develop new methods for several datasets and reveal a number of insights related to 3D molecular learning, including the consistent improvements yielded by using atomistic geometry, the lack of a single dominant method, and the presence of several tasks that can be improved through 3D molecular learning.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Three dimensional molecular data have long been pursued as an attractive source of information in molecular learning and chemoinformatics, but until recently have achieved underwhelming results relative to 1D and 2D representations (Swamidass et al., 2005; Azencott et al., 2007). However, due to increases in data availability and methodological advances, machine learning methods based on 3D molecular structure have begun to demonstrate significant impact in the last couple of years on specific tasks such as protein structure prediction (Senior et al., 2020), equilibrium state sampling (Noe et al., 2019), and drug design (Zhavoronkov et al., 2019). While there have been some broader ´ assessments of groups of related biological tasks, these have focused on on either 1D (Rao et al., 2019) or 2D (Wu et al., 2018) representations. By focusing instead on atomistic geometry, we can consistently improve performance and address disparate problems involving any combination of small molecules, proteins, and nucleic acids through a unified lens.
26
+
27
+ Graph neural networks (GNNs) have grown to be a major area of study, providing a natural way of learning from data with complex spatial structure. Many GNN implementations have been motivated by applications to atomic systems, including molecular fingerprinting (Duvenaud et al., 2015), property prediction (Schutt et al., 2017; Gilmer et al., 2017; Liu et al., 2019), protein interface pre- ¨ diction (Fout et al., 2017), and protein design (Ingraham et al., 2019). Instead of encoding points in Euclidean space, GNNs encode their pairwise connectivity, capturing a structured representation of atomistic data.
28
+
29
+ Three-dimensional CNNs (3DCNNs) have also become popular as a way to capture these complex 3D geometries. They have been applied to a number of biomolecular applications such as protein interface prediction (Townshend et al., 2019), protein model quality assessment (Pages et al., 2019; \` Derevyanko et al., 2018), protein sequence design (Anand et al., 2020), and structure-based drug discovery (Wallach et al., 2015; Torng & Altman, 2017; Ragoza et al., 2017; Jimenez et al., 2018). ´ These 3DCNNs can encode translational and permutational symmetries, but incur significant computational expense and cannot capture rotational symmetries without data augmentation.
30
+
31
+ In an attempt to address many of the problems of representing atomistic geometries, equivariant neural networks (ENNs) have emerged as a new class of methods for learning from molecular systems. These networks are built such that geometric transformations of their inputs lead to well-defined transformations of their outputs. This setup leads to the neurons of the network learning rules that resemble physical interactions. Tensor field networks (Thomas et al., 2018) and Cormorant (Kondor,
32
+
33
+ 2018; Anderson et al., 2019) have applied these principles to atomic systems and begun to demonstrate promise on extended systems (Eismann et al., 2020; Weiler et al., 2018). However, in general, these methods have not been applied to larger-scale molecular tasks.
34
+
35
+ # 3 3D MOLECULAR LEARNING
36
+
37
+ We define 3D molecular learning as the set of tasks where the input space is atoms in three dimensions. We write this space as $\mathbb { A } ^ { N }$ where $\mathbb { A } = \mathbb { P } \times \mathbb { E }$ . $\mathbb { P } = \mathbb { R } ^ { 3 }$ is the position space and $\mathbb { E } = \left\{ C , H , O , N , P , S , \ldots \right\}$ is the element space.
38
+
39
+ We select 3D molecular learning tasks from structural biophysics and medicinal chemistry that span a variety of molecule types and address a range of important problems. Multiple of these datasets are novel, while others are extracted from existing sources (Table 2). We provide all datasets in a standardized format that requires no specialized libraries. Alongside these datasets, we present corresponding best practices, including splitting and filtering criteria, to minimize data leakage concerns and ensure generalizability and reproducibility. Taken together, we hope these efforts will lower the barrier to entry for machine learning researchers interested in developing methods for 3D molecular learning and encourage rapid progress in the field. Detailed descriptions of the preparation of each dataset can be found in Appendix C.1.
40
+
41
+ Table 2: Tasks included in ATOM3D dataset, along with schematic representation of their inputs. P indicates protein, SM indicates small molecule, R indicates RNA. Lines indicate interaction and the smaller square within proteins indicates an individual amino acid. New datasets are in bold.
42
+
43
+ <table><tr><td>Name (Task Code)</td><td>Schematic</td><td>Objective</td><td>Source</td></tr><tr><td>Small Molecule Properties (SMP)</td><td>SM</td><td>Properties</td><td>QM9 (Ruddigkeit et al., 2012)</td></tr><tr><td>Protein Interface Prediction (PIP)</td><td>P2 P1 G 与</td><td>Amino Acid Interaction</td><td>DIPS(Townshend et al.,2019) DB5 (Vreven et al., 2015)</td></tr><tr><td>Residue Identity (RES)</td><td>P</td><td>Amino Acid Identity</td><td>New, created from PDB (Berman et al., 2000)</td></tr><tr><td>Mutation Stability Prediction (MSP)</td><td>P1 白 P2 C vs. P1 P2 £ 白</td><td>Effect of Mutation</td><td>New, created from SKEMPI (Jankauskaité et al., 2019)</td></tr><tr><td>Ligand Binding Affinity (LBA)</td><td>P SM</td><td>Binding Strength</td><td>PDBBind (Wang et al., 2004)</td></tr><tr><td rowspan="2">Ligand Efficacy Prediction (LEP) Protein Structure</td><td>P SM VS. SM</td><td>Drug Efficacy</td><td>New, created from PDB (Berman et al., 2000)</td></tr><tr><td>P</td><td>Ranking</td><td>CASP-QA (Kryshtafovych et al.,2019)</td></tr><tr><td>Ranking (PSR) RNA Structure</td><td></td><td></td><td></td></tr><tr><td>Ranking (RSR)</td><td>R</td><td>Ranking</td><td>FARFAR2-Puzzles (Watkins &amp; Das,2019)</td></tr></table>
44
+
45
+ # 3.1 SMALL MOLECULE PROPERTIES (SMP)
46
+
47
+ Impact – Predicting physico-chemical properties of small molecules is a common task in medicinal chemistry and materials design. Quantum chemical calculations can save expensive experiments but are themselves costly and cannot cover the huge chemical space spanned by candidate molecules.
48
+
49
+ Dataset – The QM9 dataset (Ruddigkeit et al., 2012; Ramakrishnan et al., 2014) contains structures and energetic, electronic, and thermodynamic properties for 134,000 stable small organic molecules, obtained from quantum-chemical calculations.
50
+
51
+ Metrics – We predict the molecular properties from the ground-state structure.
52
+
53
+ Split – We split molecules randomly.
54
+
55
+ # 3.2 PROTEIN INTERFACE PREDICTION (PIP)
56
+
57
+ Impact – Proteins interact with each other in many scenarios—for example, antibody proteins recognize diseases by binding to antigens. A critical problem in understanding these interactions is to identify which amino acids of two given proteins will interact upon binding.
58
+
59
+ Dataset – For training, we use the Database of Interacting Protein Structures (DIPS), a comprehensive dataset of protein complexes mined from the PDB (Townshend et al., 2019). We predict on the Docking Benchmark 5 (Vreven et al., 2015), a smaller gold standard dataset.
60
+
61
+ Metrics – We predict if two amino acids will come into contact when their respective proteins bind.
62
+ Split – We split protein complexes by sequence identity at $30 \%$ .
63
+
64
+ # 3.3 RESIDUE IDENTITY (RES)
65
+
66
+ Impact – Understanding the structural role of individual amino acids is important for engineering new proteins. We can understand this role by predicting the propensity for different amino acids at a given protein site based on the surrounding structural environment (Torng & Altman, 2017).
67
+
68
+ Dataset – We generate a novel dataset consisting of atomic environments extracted from nonredundant structures in the PDB.
69
+
70
+ Metrics – We formulate this as a classification task where we predict the identity of the amino acid in the center of the environment based on all other atoms.
71
+
72
+ Split – We split residue environments by protein topology class.
73
+
74
+ # 3.4 MUTATION STABILITY PREDICTION (MSP)
75
+
76
+ Impact – Identifying mutations that stabilize a protein’s interactions is a key task in designing new proteins. Experimental techniques for probing these are labor-intensive (Antikainen & Martin, 2005; Lefevre et al., 1997), motivating the development of efficient computational methods. \`
77
+
78
+ Dataset – We derive a novel dataset by collecting single-point mutations from the SKEMPI database (Jankauskaite et al., 2019) and model each mutation into the structure to produce mutated structures. ˙ Metrics – We formulate this as a binary classification task where we predict whether the stability of the complex increases as a result of the mutation.
79
+
80
+ Split – We split protein complexes by sequence identity at $30 \%$
81
+
82
+ # 3.5 LIGAND BINDING AFFINITY (LBA)
83
+
84
+ Impact – Most therapeutic drugs and many molecules critical for biological signaling take the form of small molecules. Predicting the strength of the protein-small molecule interaction is a challenging but crucial task for drug discovery applications.
85
+
86
+ Dataset – We use the PDBBind database (Wang et al., 2004; Liu et al., 2015), a curated database containing protein-ligand complexes from the PDB and their corresponding binding strengths. Metrics – We predict $p K = - \log ( K )$ , where $K$ is the binding affinity in Molar units. Split – We split protein-ligand complexes by protein sequence identity at $30 \%$ .
87
+
88
+ # 3.6 LIGAND EFFICACY PREDICTION (LEP)
89
+
90
+ Impact – Many proteins switch on or off their function by changing shape. Predicting which shape a drug will favor is thus an important task in drug design.
91
+
92
+ Dataset – We develop a novel dataset by curating proteins from several families with both ”active” and ”inactive” state structures, and model in 527 small molecules with known activating or inactivating function using the program Glide (Friesner et al., 2004).
93
+
94
+ Metrics – We formulate this as a binary classification task where we predict whether or not a molecule bound to the structures will be an activator of the protein’s function or not.
95
+
96
+ Split – We split complex pairs by protein.
97
+
98
+ # 3.7 PROTEIN STRUCTURE RANKING (PSR)
99
+
100
+ Impact – Proteins are one of the primary workhorses of the cell, and knowing their structure is often critical to understanding (and engineering) their function.
101
+
102
+ Dataset – The Critical Assessment of Structure Prediction (CASP) (Kryshtafovych et al., 2019) is a blind international competition for predicting protein structure.
103
+
104
+ Metrics – We formulate this as a regression task, where we predict the global distance test (GDT TS) from the true structure for each of the predicted structures submitted in the last 18 years of CASP. Split – We split structures temporally by competition year.
105
+
106
+ # 3.8 RNA STRUCTURE RANKING (RSR)
107
+
108
+ Impact – Similar to proteins, RNA plays major functional roles (e.g., gene regulation) and can adopt well-defined 3D shapes. Yet the problem is data-poor, with only a few hundred known structures. Dataset – Candidate models generated by FARFAR2 (Watkins & Das, 2019) for the first 21 released RNA Puzzle challenges (Cruz et al., 2012), a blind structure prediction competition for RNA. Metrics – We predict the root-mean-squared deviation (RMSD) from the ground truth structure. Split – We split structures temporally by competition year.
109
+
110
+ # 4 EXPERIMENTAL SETUP
111
+
112
+ To assess the benefits of 3D molecular learning, we use a combination of existing and novel 3D molecular learning methods, and implement a number of robust baselines. Our 3D molecular learning methods belong to one of each of the major classes of deep learning algorithms that have been applied to atomistic systems: graph networks, three-dimensional convolutional networks, and equivariant networks. Here we describe the core networks and the novel extensions needed to adapt them to certain datasets. See Appendix C.2 for task-specific details and hyperparameters.
113
+
114
+ # 4.1 CORE NETWORKS
115
+
116
+ For GNNs, we represent molecular systems as graphs in which each node is an atom. Edges are defined between all atoms separated by less than $4 . 5 \textup { \AA }$ , and weighted by the distance between the atoms. Node features are one-hot-encoded by atom type. Our core model uses five layers of graph convolutions, each followed by batch normalization and ReLU activation, a sum pooling layer, and two fully-connected layers with dropout.
117
+
118
+ For 3DCNNs, we represent our data as a cube of fixed size (different per task due to the different molecular sizes) in 3D space that is discretized into voxels with resolution of $1 \textup { \AA }$ to form a grid. Each voxel is associated with a one-hot-encoded vector which denotes the presence or absence of each atom type. Our core model consists of four 3D-convolutional layers, each followed by maxpooling, dropout, and ReLU activation, and two fully-connected layers.
119
+
120
+ For ENNs, we use SE(3)-equivariant networks that represent each atom of a structure by its position as absolute coordinates in 3D space with one-hot-encoded atom type as features. No rotational augmentation is needed due to the rotational symmetry of the network. The core of all architectures in this work is a network of four layers of covariant neurons that use the Clebsch–Gordan transform as nonlinearity, as described and implemented in Anderson et al. (2019).
121
+
122
+ # 4.2 SIAMESE ARCHITECTURES
123
+
124
+ For tasks involving comparing two sets of atoms sampled from the same distributions, we also develop new architectures that are Siamese in nature. Specifically, the PIP dataset involves predicting a symmetric interaction between two proteins, while the MSP and LEP datasets involve a symmetric comparison between two interactions. Taking inspiration from Townshend et al. (2019)’s use of a Siamese 3DCNN network for the PIP dataset, we replicate that architecture for our PIP, MSP, and LEP datasets, and develop new Siamese GNN and Siamese ENN networks. Specifically, we train a pair of core networks with tied weights, ensuring symmetric treatment of both items of the pair. We then combine the final learned embeddings from both core networks to output a final prediction. Beyond the novelty of weight-tying atom-level GNNs and ENNs, to our knowledge this is also the first use of weight-tying across SE(3)-equivariant networks.
125
+
126
+ # 4.3 AMINO ACID OUTPUTS
127
+
128
+ Certain tasks involve making a prediction on a specific amino acid (PIP, RES, and MSP; see Table 2), yet GNNs and ENNs typically rely on summing over all node embeddings to compute a final graph embedding, making it difficult to isolate this amino acid. To remedy this, after our convolutional layers we implement the novel procedure of extracting the embedding of only the $\mathbf { \boldsymbol { C } } \alpha$ atom of the amino acid in question, thereby allowing our GNNs and ENNs to isolate it.
129
+
130
+ # 5 RESULTS
131
+
132
+ To assess the utility of 3D molecular learning, we evaluate our methods on the ATOM3D datasets and compare performance to state-of-the-art methods using 1D or 2D representations. We stress that in many cases, 3D molecular learning methods have never been applied to the proposed tasks, and that several of the tasks are novel. In the following sections, we describe the results of our benchmarking and some key insights that can be derived from them. We also aggregate these results along with additional metrics and standard deviations over three replicates in Appendix E.
133
+
134
+ # 5.1 3D REPRESENTATIONS CONSISTENTLY IMPROVE PERFORMANCE
135
+
136
+ Our evaluation of 3D methods on the tasks in ATOM3D reveals that incorporating atomistic geometry leads to consistently superior performance compared to 1D and 2D methods. For small molecules, state-of-the-art methods do not use 1D representations, so we focus instead on comparing to representations at the 2D level, i.e. the chemical bond graph. This is the approach taken by the 2D GNN introduced by Tsubaki et al. (2019) or the N-gram graph method by Liu et al. (2019), which both obtain similar results (Table 3) on the small-molecule-only dataset SMP. When we add 3D distance, as done for our GNN model, we improve performance across all targets in SMP (Table 3).
137
+
138
+ For tasks involving biopolymers (proteins and RNA), state-of-the-art methods do not use 2D representations, primarily because most of the chemical bond graph can be easily re-derived from the 1D representation, i.e. the linear sequence that makes up the biopolymer. We thus compare to representations at the 1D level (Table 7). For MSP and RES, both new datasets, we evaluate against Rao et al. (2019)’s TAPE model, a transformer architecture that operates on protein sequence and is state-of-the-art amongst 1D methods for many tasks. For PIP, we compare to the sequence-only version of BIPSPI (Sanchez-Garcia et al., 2018), a state-of-the-art boosted decision tree method for protein interaction prediction. We find that 3D methods outperform these 1D methods on all biopolymer-only datasets (PIP, RES, MSP).
139
+
140
+ For tasks involving both biopolymers and small molecules, we compare DeepDTA (Ozt ¨ urk et al., ¨ 2018). This network uses a 1D representation via a 1DCNN for both the biopolymer and small molecules. For LBA, we additionally compare to DeepAffinity (Karimi et al., 2019) which uses pairs of a ligand SMILES string and a novel representation of structurally-annotated protein sequences. Using a 3D representation for both ligand and protein instead leads to improved performance for the joint protein-small molecule datasets (LBA and LEP, see Table 5).
141
+
142
+ The biopolymer structure ranking tasks (PSR and RSR) are inherently 3D in nature, as they involve evaluating the correctness of different 3D shapes taken on by the same biopolymer. Thus, critically, a 1D or 2D representation would not be able to differentiate between these different shapes since the linear sequence and chemical bond graph would remain the same. We therefore compare to state-of-the-art 3D methods as shown in Table 6.
143
+
144
+ Table 3: Small molecule results. Metric is mean absolute error (MAE).
145
+
146
+ <table><tr><td rowspan="2">Task</td><td rowspan="2">Target</td><td colspan="3">3D</td><td colspan="2">Non-3D</td></tr><tr><td>3DCNN</td><td>GNN</td><td>ENN</td><td>Tsubaki et al. (2019)</td><td>Liu et al. (2019)</td></tr><tr><td rowspan="3">SMP</td><td>μ[D]</td><td>0.572</td><td>0.068</td><td>0.046</td><td>0.496</td><td>0.520</td></tr><tr><td>gap[eV]</td><td>0.589</td><td>0.091</td><td>0.065</td><td>0.154</td><td>0.184</td></tr><tr><td>Ut[ev]</td><td>1.615</td><td>0.070</td><td>0.023</td><td>0.182</td><td>0.218</td></tr></table>
147
+
148
+ Table 4: Biopolymer results. AUROC is the area under the receiver operating characteristic curve. Asterisks $( ^ { * } )$ indicate that the exact training data differed (though splitting criteria were the same).
149
+
150
+ <table><tr><td rowspan="2">Task</td><td rowspan="2">Metric</td><td colspan="3">3D</td><td colspan="2">Non-3D</td></tr><tr><td>3DCNN</td><td>GNN</td><td>ENN</td><td>Sanchez-Garcia et al. (2018)</td></tr><tr><td>PIP</td><td>AUROC</td><td>0.844</td><td>*0.669</td><td>一</td><td>0.841</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>Rao et al. (2019)</td></tr><tr><td>RES</td><td>accuracy</td><td>0.451</td><td>0.082</td><td>*0.072</td><td>*0.30</td></tr><tr><td>MSP</td><td>AUROC</td><td>0.520</td><td>0.637</td><td>0.678</td><td>0.554</td></tr></table>
151
+
152
+ Table 5: Joint small molecule/biopolymer results. $R _ { S }$ is Spearman correlation, $R _ { P }$ is Pearson correlation, AUROC is area under the receiver operating characteristic curve, and RMSD is root-mean-squared deviation. Asterisks $( ^ { * } )$ indicate that the exact training data differed (though splitting criteria were the same).
153
+
154
+ <table><tr><td rowspan="2">Task</td><td rowspan="2">Metric</td><td colspan="3">3D</td><td colspan="2">Non-3D</td></tr><tr><td>3DCNN</td><td>GNN</td><td>ENN</td><td>Oztirk et al. (2018)</td><td>Karimi et al. (2019)</td></tr><tr><td rowspan="3">LBA</td><td>RMSD</td><td>1.520</td><td>1.936</td><td>*1.429</td><td>1.565</td><td>1.893</td></tr><tr><td>glob.Rp</td><td>0.558</td><td>0.581</td><td>*0.541</td><td>0.573</td><td>0.415</td></tr><tr><td>glob.Rs</td><td>0.556</td><td>0.647</td><td>*0.532</td><td>0.574</td><td>0.426</td></tr><tr><td>LEP</td><td>AUROC</td><td>0.824</td><td>0.678</td><td>0.569</td><td>0.696</td><td>1</td></tr></table>
155
+
156
+ Table 6: Structure ranking results. $R _ { S }$ is Spearman correlation, $R _ { P }$ is Pearson correlation. Mean measures the correlation for structures corresponding to the same biopolymer, whereas global measures the correlation across all biopolymers.
157
+
158
+ <table><tr><td rowspan="2">Task</td><td rowspan="2">Metric</td><td colspan="3">3D</td></tr><tr><td>3DCNN</td><td>GNN</td><td>SotA</td></tr><tr><td rowspan="2">PSR</td><td>mean Rs</td><td>0.177</td><td>0.327</td><td>0.432 (Pages et al., 2019)</td></tr><tr><td>glob. Rs</td><td>0.837</td><td>0.716</td><td>0.796 (Pages et al., 2019)</td></tr><tr><td rowspan="2">RSR</td><td>mean Rs</td><td>0.414</td><td>0.195</td><td>0.173 (Alford et al.,2017)</td></tr><tr><td>glob. Rs</td><td>0.656</td><td>0.309</td><td>0.304 (Alford et al., 2017)</td></tr></table>
159
+
160
+ More generally, we find that learning methods that leverage the 3D geometry of molecules hold state-of-the-art on all tasks on our benchmark (Appendix D).
161
+
162
+ 5.2 MANY 3D MOLECULAR LEARNING PROBLEMS REMAIN UNDEREXPLORED
163
+
164
+ As demonstrated in the previous section, formulating a molecular problem through the lens of 3D molecular learning can lead to significantly improved performance. However, many important problems have not been studied within this framework, leaving significant room for further improvement. This opens up a ripe field of research with much low-hanging fruit. One prominent example we explore here is RNA structure ranking, where the state-of-the-art method uses Rosetta (Alford et al., 2017), a hand-designed potential energy function. When we instead apply our 3DCNN method that learns directly from the 3D atomistic geometry, we see dramatic increases in performance (Table 6).
165
+
166
+ In a similar vein, on the ligand efficacy prediction task we find that the 3DCNN method outperforms Glide (Friesner et al., 2004), a state-of-the-art scoring function for protein-small molecule docking. The 3DCNN achieves an AUROC of 0.824, compared to Glide’s 0.770.
167
+
168
+ We also find room for improvement in domains where 3D molecular learning is already being employed. Protein structure ranking is one such area, and we see that the 3DCNN model is competitive with the state-of-the-art deep learning method by Pages et al. (2019) (Table 6), surpassing it in terms \` of absolute assessment of correctness (i.e., comparing 3D candidates from different biopolymers) though not in terms of relative assessment (i.e., comparing 3D candidates from the same biopolymer).
169
+
170
+ Overall, these results demonstrate the potential of 3D molecular learning to address a wide range of problems involving molecular structure, and we anticipate that continued development of such models on less well-studied tasks will aid progress in biomedical research.
171
+
172
+ # 5.3 DIFFERENT TASKS REQUIRE DIFFERENT ARCHITECTURES
173
+
174
+ While atomistic methods consistently outperform their non-3D counterparts and provide a systematic way of representing molecular data, our results also provide evidence that architecture selection plays a critical role in performance. For tasks primarily focused on small molecules (SMP and LBA), we see superior performance from the particle-based methods (GNN and ENN) than from the volumetric 3DCNN. Small molecules are already intuitively represented as graph-like structures, with nodes (atoms) and edges (bonds), and the quantities computed in these small molecule tasks depend less on complex 3D geometry and more on the exact position of each atom relative to its neighbors. Unlike particle-based methods, 3DCNNs must approximate these positions, and while increasing spatial resolution increases precision, it also leads to cubic scaling of complexity.
175
+
176
+ On the other hand, for larger molecules and complex 3D geometries that are critical to tasks like PSR, RSR, LEP, and RES, we see that the 3DCNN method outperforms GNNs. Here, the 3DCNN’s ability to directly represent differences between patterns in 3D space, as opposed to trying to reconstruct them through pairwise distances, is likely what allows it to perform well. In these tasks, the exact position and relational information between atoms is less important than their overall conformation.
177
+
178
+ Finally, equivariant networks show promise but suffer from scalability issues. One motivation for the development of equivariant networks is that they fill a “happy medium” where they can both represent atom positions precisely and capture complex geometries. On some of the tasks where we could test the ENN (LBA, SMP), we often observed close to state-of-the-art performance, even on a reduced training set (LBA). Unfortunately, current implementations do not yet scale to most of our tasks due to the compute- and memory-intensive nature of the Clebsch-Gordan products used to maintain rotational equivariance. For some tasks, the performance was severely limited by only training on a fraction of the data $< 1 \%$ for RES) or a portion of the entire atomic structure (LEP), and for others we could not apply the ENN at all. These limitations point to the need for further architectural innovations before their performance can be demonstrated on extended systems.
179
+
180
+ # 6 CONCLUSION
181
+
182
+ In this work we present a vision of 3D atom-level data as a new “machine learning datatype” deserving focused study. Atomistic data shares several underlying symmetries, contains poorly understood higher-level patterns, and can be used to address many high-impact but unsolved problems.
183
+
184
+ We create several benchmark datasets and compare the performance of different types of 3D molecular learning models across these tasks. Many of these architectures were developed specifically for the tasks in question, such as the Siamese ENN and GNN models used for paired tasks (PIP, MSP, and LEP). For tasks that can be formulated in lower dimensions, we demonstrate that 3D molecular learning yields consistent gains in performance over 1D and 2D methods. We also show that selection of an appropriate architecture is critical for optimal performance on a given task; depending on the structure of the underlying data, a 3DCNN, GNN, or ENN may be most appropriate. As equivariant networks continue to improve in efficiency and stability, we expect these to become more and more viable due to their close modeling of physical laws.
185
+
186
+ While ATOM3D establishes a first set of benchmark datasets, there are many other open areas in biomedical research and molecular science that are ripe for 3D molecular learning, especially as structural data becomes readily available. Such tasks include virtual screening and pose prediction of small molecule drugs, or the prediction of conformational ensembles instead of static structures. The use of multiple 3D conformations per molecule represents an especially promising direction, as they would more faithfully reproduce the entire set of states a given molecule could adopt. As such, we envision expanding the ATOM3D framework beyond the tasks described here.
187
+
188
+ Through this work, we hope to lower the entry barrier for machine learning practitioners, encourage the development of machine learning algorithms focused on 3D atomistic data, and promote a novel paradigm within the fields of structural biology and medicinal chemistry.
189
+
190
+ # REFERENCES
191
+
192
+ Rebecca F. Alford, Andrew Leaver-Fay, Jeliazko R. Jeliazkov, Matthew J. O’Meara, Frank P. DiMaio, Hahnbeom Park, Maxim V. Shapovalov, P. Douglas Renfrew, Vikram K. Mulligan, Kalli Kappel, Jason W. Labonte, Michael S. Pacella, Richard Bonneau, Philip Bradley, Roland L. Dunbrack, Rhiju Das, David Baker, Brian Kuhlman, Tanja Kortemme, and Jeffrey J. Gray. The Rosetta All-Atom Energy Function for Macromolecular Modeling and Design. Journal of Chemical Theory and Computation, 13(6):3031–3048, 2017. ISSN 15499626. doi: 10.1021/acs.jctc.7b00125.
193
+
194
+ S F Altschul, W Gish, W Miller, E W Myers, and D J Lipman. Basic local alignment search tool. Journal of Molecular Biology, 215(3):403–10, 1990. ISSN 0022-2836. doi: 10.1016/S0022-2836(05)80360-2. URL http://www.sciencedirect.com/science/ article/pii/S0022283605803602.
195
+
196
+ Namrata Anand, Raphael R Eguchi, Alexander Derry, Russ B Altman, and Po-Ssu Huang. Protein sequence design with a learned potential. January 2020.
197
+
198
+ Brandon Anderson, Truong-Son Hy, and Risi Kondor. Cormorant: Covariant Molecular Neural Networks. 2019. URL http://arxiv.org/abs/1906.04015.
199
+
200
+ Antonina Andreeva, Dave Howorth, Cyrus Chothia, Eugene Kulesha, and Alexey G. Murzin. SCOP2 prototype: A new approach to protein structure mining. Nucleic Acids Research, 42 (D1):310–314, 2014. ISSN 03051048. doi: 10.1093/nar/gkt1242.
201
+
202
+ Nina M Antikainen and Stephen F Martin. Altering protein specificity: techniques and applications. Bioorganic & medicinal chemistry, 13(8):2701–2716, 2005.
203
+
204
+ Chloe-Agathe Azencott, Alexandre Ksikes, S Joshua Swamidass, Jonathan H Chen, Liva Ralaivola, ´ and Pierre Baldi. One-to four-dimensional kernels for virtual screening and the prediction of physical, chemical, and biological properties. Journal of chemical information and modeling, 47 (3):965–974, 2007.
205
+
206
+ Pedro J Ballester and John B O Mitchell. A machine learning approach to predicting protein–ligand binding affinity with applications to molecular docking. Bioinformatics, 26(9):1169–1175, May 2010.
207
+
208
+ Helen M Berman, John Westbrook, Zukang Feng, Gary Gilliland, Talapady N Bhat, Helge Weissig, Ilya N Shindyalov, and Philip E Bourne. The protein data bank. Nucleic acids research, 28(1): 235–242, 2000.
209
+
210
+ Wouter Boomsma and Jes Frellsen. Spherical convolutions and their application in molecular modelling. 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. 3433–3443. Curran Associates, Inc., 2017.
211
+
212
+ Sidhartha Chaudhury, Sergey Lyskov, and Jeffrey J Gray. Pyrosetta: a script-based interface for implementing molecular modeling algorithms using rosetta. Bioinformatics, 26(5):689–691, 2010.
213
+
214
+ Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’16, pp. 785–794, New York, NY, USA, 2016. Association for Computing Machinery. ISBN 9781450342322. doi: 10.1145/2939672.2939785. URL https://doi.org/10. 1145/2939672.2939785.
215
+
216
+ Jianlin Cheng, Arlo Randall, Michael Sweredoski, and Pierre Baldi. Scratch: a protein structure and structural feature prediction server. Nucleic acids research, 33:W72–6, 08 2005. doi: 10.1093/ nar/gki396.
217
+
218
+ Jose Almeida Cruz, Marc-Fr ´ ed´ erick Blanchet, Michal Boniecki, Janusz M Bujnicki, Shi-Jie Chen, ´ Song Cao, Rhiju Das, Feng Ding, Nikolay V Dokholyan, Samuel Coulbourn Flores, et al. Rnapuzzles: a casp-like evaluation of rna three-dimensional structure prediction. Rna, 18(4):610–625, 2012.
219
+
220
+ Natalie L Dawson, Tony E Lewis, Sayoni Das, Jonathan G Lees, David Lee, Paul Ashford, Christine A Orengo, and Ian Sillitoe. Cath: an expanded resource to predict protein function through structure and sequence. Nucleic acids research, 45(D1):D289–D295, 2017.
221
+
222
+ Georgy Derevyanko, Sergei Grudinin, Yoshua Bengio, and Guillaume Lamoureux. Deep convolutional networks for quality assessment of protein folds. Bioinformatics, 34(23):4046–4053, 2018.
223
+
224
+ 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.
225
+
226
+ Stephan Eismann, Raphael J L Townshend, Nathaniel Thomas, Milind Jagota, Bowen Jing, and Ron Dror. Hierarchical, rotation-equivariant neural networks to predict the structure of protein complexes. arXiv, 2020.
227
+
228
+ Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
229
+
230
+ Alex Fout, Jonathon Byrd, Basir Shariat, and Asa Ben-Hur. Protein interface prediction using graph convolutional networks. 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. 6530–6539. Curran Associates, Inc., 2017.
231
+
232
+ Richard A Friesner, Jay L Banks, Robert B Murphy, Thomas A Halgren, Jasna J Klicic, Daniel T Mainz, Matthew P Repasky, Eric H Knoll, Mee Shelley, Jason K Perry, et al. Glide: a new approach for rapid, accurate docking and scoring. 1. method and assessment of docking accuracy. Journal of medicinal chemistry, 47(7):1739–1749, 2004.
233
+
234
+ M. V. Shapovalov G. G. Krivov and R. L. Dunbrack. Improved prediction of protein side-chain conformations with scwrl4. Proteins, 2009. URL http://dunbrack.fccc.edu/SCWRL3. php/.
235
+
236
+ Joffrey Gabel, Jer´ emy Desaphy, and Didier Rognan. Beware of machine learning-based scoring ´ functions-on the danger of developing black boxes. J. Chem. Inf. Model., 54(10):2807–2815, October 2014.
237
+
238
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry, 2017.
239
+
240
+ Jie Hou, Renzhi Cao, and Jianlin Cheng. Deep convolutional neural networks for predicting the quality of single protein structural models. bioRxiv, 2019. doi: 10.1101/590620. URL https: //www.biorxiv.org/content/early/2019/03/28/590620.
241
+
242
+ John Ingraham, Vikas K Garg, Regina Barzilay, and Tommi Jaakkola. Generative models for GraphBased protein design. March 2019.
243
+
244
+ Justina Jankauskaite, Brian Jim ˙ enez-Garc ´ ´ıa, Justas Dapkunas, Juan Fern ¯ andez-Recio, and Iain H ´ Moal. Skempi 2.0: an updated benchmark of changes in protein–protein binding energy, kinetics and thermodynamics upon mutation. Bioinformatics, 35(3):462–469, 2019.
245
+
246
+ Jia Deng, Wei Dong, R. Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. pp. 248–255, 2009. doi: 10.1109/cvprw.2009.5206848.
247
+
248
+ Jose Jim ´ enez, Miha ´ Skali ˇ c, Gerard Mart ˇ ´ınez-Rosell, and Gianni De Fabritiis. KDEEP: ProteinLigand absolute binding affinity prediction via 3D-Convolutional neural networks. J. Chem. Inf. Model., 58(2):287–296, February 2018.
249
+
250
+ Robbie Joosten, Tim Beek, Elmar Krieger, Maarten Hekkelman, Rob Hooft, Reinhard Schneider, Chris Sander, and Gert Vriend. A series of pdb related databases for everyday needs. Nucleic acids research, 39:D411–9, 11 2010. doi: 10.1093/nar/gkq1105.
251
+
252
+ Wolfgang Kabsch and Christian Sander. Dictionary of protein secondary structure: Pattern recognition of hydrogen-bonded and geometrical features. Biopolymers, 22(12):2577–2637, 1983. ISSN 1097-0282. doi: 10.1002/bip.360221211. URL http://dx.doi.org/10.1002/ bip.360221211.
253
+
254
+ Mostafa Karimi, Di Wu, Zhangyang Wang, and Yang Shen. Deepaffinity: interpretable deep learning of compound–protein affinity through unified recurrent and convolutional neural networks. Bioinformatics, 35(18):3329–3338, 2019.
255
+
256
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
257
+
258
+ Risi Kondor. N-body networks: a covariant hierarchical neural network architecture for learning atomic potentials, 2018.
259
+
260
+ Christian Kramer and Peter Gedeck. Leave-cluster-out cross-validation is appropriate for scoring functions derived from diverse protein data sets. J. Chem. Inf. Model., 50(11):1961–1969, November 2010.
261
+
262
+ Andriy Kryshtafovych, Torsten Schwede, Maya Topf, Krzysztof Fidelis, and John Moult. Critical assessment of methods of protein structure prediction (casp)—round xiii. Proteins: Structure, Function, and Bioinformatics, 87(12):1011–1020, 2019.
263
+
264
+ Andrew Leaver-Fay, Michael Tyka, Steven Lewis, Oliver Lange, James Thompson, Ron Jacak, Kristian Kaufman, P. Renfrew, Colin Smith, Will Sheffler, Ian Davis, Seth Cooper, Adrien Treuille, Daniel Mandell, Florian Richter, Yih-En Ban, Sarel Fleishman, Jacob Corn, David Kim, and Philip Bradley. Rosetta3: an object-oriented software suite for the simulation and design of macromolecules. Methods in enzymology, 487:545–74, 01 2011.
265
+
266
+ Fabrice Lefevre, Marie-H \` el´ ene R \` emy, and Jean-Michel Masson. Alanine-stretch scanning muta- ´ genesis: a simple and efficient method to probe protein structure and function. Nucleic acids research, 25(2):447–448, 1997.
267
+
268
+ Yan Li, Zhihai Liu, Jie Li, Li Han, Jie Liu, Zhixiong Zhao, and Renxiao Wang. Comparative assessment of scoring functions on an updated benchmark: 1. compilation of the test set. J. Chem. Inf. Model., 54(6):1700–1716, June 2014.
269
+
270
+ Yang Li and Jianyi Yang. Structural and sequence similarity makes a significant impact on machinelearning-based scoring functions for protein–ligand interactions. Journal of Chemical Information and Modeling, 57(4):1007–1012, 2017.
271
+
272
+ Shengchao Liu, Mehmet F Demirel, and Yingyu Liang. N-gram graph: Simple unsupervised representation for graphs, with applications to molecules. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett (eds.), ´ Advances in Neural Information Processing Systems 32, pp. 8464–8476. Curran Associates, Inc., 2019.
273
+
274
+ Zhihai Liu, Yan Li, Li Han, Jie Li, Jie Liu, Zhixiong Zhao, Wei Nie, Yuchen Liu, and Renxiao Wang. PDB-wide collection of binding data: current status of the PDBbind database. Bioinformatics, 31 (3):405–412, February 2015.
275
+
276
+ Christophe Magnan and Pierre Baldi. Sspro/accpro 5: Almost perfect prediction of protein secondary structure and relative solvent accessibility using profiles, machine learning, and structural similarity. Bioinformatics (Oxford, England), 30:2592–97, 05 2014. doi: 10.1093/bioinformatics/ btu352.
277
+
278
+ Simon Mitternacht. FreeSASA: An open source C library for solvent accessible surface area calculations. F1000Research, 5(189), 2016. ISSN 1759796X. doi: 10.12688/f1000research.7931.1.
279
+
280
+ Frank Noe, Simon Olsson, Jonas K ´ ohler, and Hao Wu. Boltzmann generators: Sampling equilibrium ¨ states of many-body systems with deep learning. Science, 365(6457), 2019. ISSN 0036-8075. doi: 10.1126/science.aaw1147. URL https://science.sciencemag.org/content/ 365/6457/eaaw1147.
281
+
282
+ Hakime Ozt ¨ urk, Elif Ozkirimli, and Arzucan ¨ Ozg ¨ ur. DeepDTA: Deep Drug-Target Binding Affinity¨ Prediction. pp. 1–17, 2018. URL http://arxiv.org/abs/1801.10193.
283
+
284
+ Guillaume Pages, Benoit Charmettant, and Sergei Grudinin. Protein model quality assessment using \` 3d oriented convolutional neural networks. Bioinformatics, 35(18):3313–3319, 2019.
285
+
286
+ Matthew Ragoza, Joshua Hochuli, Elisa Idrobo, Jocelyn Sunseri, and David Ryan Koes. ProteinLigand scoring with convolutional neural networks. J. Chem. Inf. Model., 57(4):942–957, April 2017.
287
+
288
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. EMNLP 2016 - Conference on Empirical Methods in Natural Language Processing, Proceedings, (ii):2383–2392, 2016.
289
+
290
+ Raghunathan Ramakrishnan, Pavlo O. Dral, Matthias Rupp, and O. Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific Data, 1:1–7, 2014. ISSN 20524463. doi: 10.1038/sdata.2014.22.
291
+
292
+ Roshan Rao, Nicholas Bhattacharya, Neil Thomas, Yan Duan, Peter Chen, John Canny, Pieter Abbeel, and Yun Song. Evaluating protein transfer learning with tape. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Gar- ´ nett (eds.), Advances in Neural Information Processing Systems 32, pp. 9689– 9701. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 9163-evaluating-protein-transfer-learning-with-tape.pdf.
293
+
294
+ Lars Ruddigkeit, Ruud van Deursen, Lorenz C Blum, and Jean-Louis Reymond. Enumeration of 166 Billion Organic Small Molecules in the Chemical Universe Database GDB-17. Journal of Chemical Information and Modeling, 52(11):2864–2875, nov 2012. ISSN 1549-9596. doi: 10. 1021/ci300415d. URL https://doi.org/10.1021/ci300415d.
295
+
296
+ Ruben Sanchez-Garcia, C O S Sorzano, J M Carazo, and Joan Segura. BIPSPI: a method for the prediction of partner-specific protein–protein interfaces. Bioinformatics, 35(14):343–353, 2018. ISSN 1367-4803. doi: 10.1093/bioinformatics/bty647. URL https://academic.oup.com/bioinformatics/advance-article/doi/ 10.1093/bioinformatics/bty647/5055586.
297
+
298
+ Soumya Sanyal, Ivan Anishchenko, Anirudh Dagar, David Baker, and Partha Talukdar. Proteingcn: Protein model quality assessment using graph convolutional networks. bioRxiv, 2020. doi: 10. 1101/2020.04.06.028266. URL https://www.biorxiv.org/content/early/2020/ 04/07/2020.04.06.028266.
299
+
300
+ Schrodinger, LLC. The PyMOL molecular graphics system, version 1.8. November 2015. ¨
301
+
302
+ Kristof T. Schutt, Pieter-Jan Kindermans, Huziel E. Sauceda, Stefan Chmiela, Alexandre¨ Tkatchenko, and Klaus-Robert Muller. Schnet: A continuous-filter convolutional neural network¨ for modeling quantum interactions, 2017.
303
+
304
+ 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, pp. 1–5, 2020.
305
+
306
+ Minyi Su, Qifan Yang, Yu Du, Guoqin Feng, Zhihai Liu, Yan Li, and Renxiao Wang. Comparative assessment of scoring functions: The CASF-2016 update. J. Chem. Inf. Model., 59(2):895–913, February 2019.
307
+
308
+ S Joshua Swamidass, Jonathan Chen, Jocelyne Bruand, Peter Phung, Liva Ralaivola, and Pierre Baldi. Kernels for small molecules and the prediction of mutagenicity, toxicity and anti-cancer activity. Bioinformatics, 21(suppl 1):i359–i368, 2005.
309
+
310
+ Nathaniel Thomas, Tess Smidt, Steven M. Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation- and translation-equivariant neural networks for 3d point clouds. CoRR, abs/1802.08219, 2018. URL http://arxiv.org/abs/1802.08219.
311
+
312
+ Wen Torng and Russ B Altman. 3D deep convolutional neural networks for amino acid environment similarity analysis. BMC Bioinformatics, 18(1):302, June 2017.
313
+
314
+ Raphael Townshend, Rishi Bedi, Patricia Suriana, and Ron Dror. End-to-end learning on 3d protein structure for interface prediction. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, ´ E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 15642– 15651. 2019.
315
+
316
+ Masashi Tsubaki, Kentaro Tomii, and Jun Sese. Compound-protein interaction prediction with endto-end learning of neural networks for graphs and sequences. Bioinformatics, 35(2):309–318, 2019. ISSN 14602059. doi: 10.1093/bioinformatics/bty535.
317
+
318
+ Karolis Uziela, David Menendez Hurtado, Nanjiang Shu, Bj ´ orn Wallner, and Arne Elofsson. ¨ ProQ3d: improved model quality assessments using deep learning. Bioinformatics, pp. btw819, jan 2017. doi: 10.1093/bioinformatics/btw819. URL https://doi.org/10.1093% 2Fbioinformatics%2Fbtw819.
319
+
320
+ Thom Vreven, Iain H. Moal, Anna Vangone, Brian G. Pierce, Panagiotis L. Kastritis, Mieczyslaw Torchala, Raphael Chaleil, Brian Jimenez-Garc ´ ´ıa, Paul A. Bates, Juan Fernandez-Recio, Alexandre M.J.J. Bonvin, and Zhiping Weng. Updates to the integrated protein–protein interaction benchmarks: Docking benchmark version 5 and affinity benchmark version 2. Journal of Molecular Biology, 427(19):3031 – 3041, 2015. ISSN 0022-2836. doi: https://doi. org/10.1016/j.jmb.2015.07.016. URL http://www.sciencedirect.com/science/ article/pii/S0022283615004180.
321
+
322
+ Izhar Wallach, Michael Dzamba, and Abraham Heifets. Atomnet: A deep convolutional neural network for bioactivity prediction in structure-based drug discovery, 2015.
323
+
324
+ Renxiao Wang, Xueliang Fang, Yipin Lu, and Shaomeng Wang. The pdbbind database: collection of binding affinities for proteinligand complexes with known three-dimensional structures. Journal of Medicinal Chemistry, 47(12):2977–2980, 2004. doi: 10.1021/jm030580l. URL https: //doi.org/10.1021/jm030580l. PMID: 15163179.
325
+
326
+ Andrew M Watkins and Rhiju Das. Farfar2: Improved de novo rosetta prediction of complex global rna folds. bioRxiv, pp. 764449, 2019.
327
+
328
+ Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco Cohen. 3D steerable CNNs: Learning rotationally equivariant features in volumetric data. July 2018.
329
+
330
+ David Weininger. SMILES, a Chemical Language and Information System: 1: Introduction to Methodology and Encoding Rules. Journal of Chemical Information and Computer Sciences, 28 (1):31–36, 1988. ISSN 00952338. doi: 10.1021/ci00057a005.
331
+
332
+ Zhenqin Wu, Bharath Ramsundar, Evan N. Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S. Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chem. Sci., 9:513–530, 2018. doi: 10.1039/C7SC02664A. URL http://dx.doi.org/ 10.1039/C7SC02664A.
333
+
334
+ Yang Zhang and Jeffrey Skolnick. Scoring function for automated assessment of protein structure template quality. Proteins, 57:702–10, 09 2007. doi: 10.1002/prot.20264. URL https:// zhanglab.ccmb.med.umich.edu/TM-score/.
335
+
336
+ Alex Zhavoronkov, Yan A. Ivanenkov, Alex Aliper, Mark S. Veselov, Vladimir A. Aladinskiy, Anastasiya V. Aladinskaya, Victor A. Terentiev, Daniil A. Polykovskiy, Maksim D. Kuznetsov, Arip Asadulaev, Yury Volkov, Artem Zholus, Rim R. Shayakhmetov, Alexander Zhebrak, Lidiya I. Minaeva, Bogdan A. Zagribelnyy, Lennart H. Lee, Richard Soll, David Madge, Li Xing, Tao Guo, and Alan Aspuru-Guzik. Deep learning enables rapid identification of potent DDR1 ki- ´ nase inhibitors. Nature Biotechnology, 37(9):1038–1040, 2019. ISSN 15461696. doi: 10.1038/ s41587-019-0224-x. URL http://dx.doi.org/10.1038/s41587-019-0224-x.
337
+
338
+ David Zilian and Christoph A Sotriffer. SFCscore(RF): a random forest-based scoring function for improved affinity prediction of protein-ligand complexes. J. Chem. Inf. Model., 53(8):1923–1933, August 2013.
md/train/m4PC1eUknQG/m4PC1eUknQG.md ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # L2E: LEARNING TO EXPLOIT YOUR OPPONENT
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Opponent modeling is essential to exploit sub-optimal opponents in strategic interactions. One key challenge facing opponent modeling is how to fast adapt to opponents with diverse styles of strategies. Most previous works focus on building explicit models to predict the opponents’ styles or strategies directly. However, these methods require a large amount of data to train the model and lack the adaptability to new opponents of unknown styles. In this work, we propose a novel Learning to Exploit (L2E) framework for implicit opponent modeling. L2E acquires the ability to exploit opponents by a few interactions with different opponents during training so that it can adapt to new opponents with unknown styles during testing quickly. We propose a novel Opponent Strategy Generation (OSG) algorithm that produces effective opponents for training automatically. By learning to exploit the challenging opponents generated by OSG through adversarial training, L2E gradually eliminates its own strategy’s weaknesses. Moreover, the generalization ability of L2E is significantly improved by training with diverse opponents, which are produced by OSG through diversity-regularized policy optimization. We evaluate the L2E framework on two poker games and one grid soccer game, which are the commonly used benchmark for opponent modeling. Comprehensive experimental results indicate that L2E quickly adapts to diverse styles of unknown opponents.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ One core research topic in modern artificial intelligence is creating agents that can interact effectively with their opponents in different scenarios. To achieve this goal, the agents should have the ability to reason about their opponents’ behaviors, goals, and beliefs. Opponent modeling, which constructs the opponents’ models to reason about them, has been extensively studied in past decades (Albrecht & Stone, 2018). In general, an opponent model is a function that takes some interaction history as its input and predicts some property of interest of the opponent. Specifically, the interaction history may contain the past actions that the opponent took in various situations, and the properties of interest could be the actions that the opponent may take in the future, the style of the opponent (e.g., “defensive”, “aggressive”), or its current goals. The resulting opponent model can inform the agent’s decision-making by incorporating the model’s predictions in its planning procedure to optimize its interactions with the opponent. Opponent modeling has already been used in many practical applications, such as dialogue systems (Grosz & Sidner, 1986), intelligent tutor systems (McCalla et al., 2000), and security systems (Jarvis et al., 2005).
12
+
13
+ Many opponent modeling algorithms vary greatly in their underlying assumptions and methodology. For example, policy reconstruction based methods (Powers & Shoham, 2005; Banerjee & Sen, 2007) explicitly fit an opponent model to reflect the opponent’s observed behaviors. Type reasoning based methods (Dekel et al., 2004; Nachbar, 2005) reuse pre-learned models of several known opponents by finding the one which most resembles the behavior of the current opponent. Classification based methods (Huynh et al., 2006; Sukthankar & Sycara, 2007) build models that predict the play style of the opponent, and employ the counter-strategy, which is effective against that particular style. Some recent works combine opponent modeling with deep learning methods or reinforcement learning methods and propose many related algorithms (He et al., 2016; Foerster et al., 2018; Wen et al., 2018). Although these algorithms have achieved some success, they also have some obvious disadvantages. First, constructing accurate opponent models requires a lot of data, which is problematic since the agent does not have the time or opportunity to collect enough data about its opponent in most applications. Second, most of these algorithms perform well only when the opponents during testing are similar to the ones used for training, and it is difficult for them to adapt to opponents with new styles quickly. More related works on opponent modeling are in Appendix A.1.
14
+
15
+ To overcome these shortcomings, we propose a novel Learning to Exploit (L2E) framework in this work for implicit opponent modeling, which has two desirable advantages. First, L2E does not build an explicit model for the opponent, so it does not require a large amount of interactive data and eliminates the modeling errors simultaneously. Second, L2E can quickly adapt to new opponents with unknown styles, with only a few interactions with them. The key idea underlying L2E to train a base policy against various styles of opponents by using only a few interactions between them during training, such that it acquires the ability to exploit different opponents quickly. After training, the base policy can quickly adapt to new opponents using only a few interactions during testing. In effect, our L2E framework optimizes for a base policy that is easy and fast to adapt. It can be seen as a particular case of learning to learn, i.e., meta-learning (Finn et al., 2017). The meta-learning algorithm $( c . f . ,$ Appendix A.2 for details), such as MAML (Finn et al., 2017), is initially designed for single-agent environments. It requires manual design of training tasks, and the final performance largely depends on the user-specified training task distribution. The L2E framework is designed explicitly for the multi-agent competitive environments, which generates effective training tasks (opponents) automatically $( c . f . ,$ Appendix A.3 for details). Some recent works have also initially used meta-learning for opponent modeling. Unlike these works, which either use meta-learning to predict the opponent’s behaviors (Rabinowitz et al., 2018) or to handle the non-stationarity problem in multi-agent reinforcement learning (Al-Shedivat et al., 2018), we focus on how to improve the agent’s ability to adapt to unknown opponents quickly.
16
+
17
+ In our L2E framework, the base policy is explicitly trained such that a few interactions with a new opponent will produce an opponent-specific policy to effectively exploit this opponent, i.e., the base policy has strong adaptability that is broadly adaptive to many opponents. In specific, if a deep neural network models the base policy, then the opponent-specific policy can be obtained by fine-tuning the parameters of the base policy’s network using the new interactive data with the opponent. A critical step in L2E is how to generate effective opponents to train the base policy. The ideal training opponents should satisfy the following two desiderata. 1) The opponents need to be challenging enough (i.e., hard to exploit). By learning to exploit these challenging opponents, the base policy eliminates its weakness and learns a more robust strategy. 2) The opponents need to have enough diversity. The more diverse the opponents during training, the stronger the base policy’s generalization ability is, and the more adaptable the base policy to the new opponents.
18
+
19
+ To this end, we propose a novel opponent strategy generation (OSG) algorithm, which can produce challenging and diverse opponents automatically. We use the idea of adversarial training to generate challenging opponents. Some previous works have also been proposed to obtain more robust policies through adversarial training and showed that it improves the generalization (Pinto et al., 2017; Pattanaik et al., 2018). From the perspective of the base policy, giving an opponent, the base policy first adjusts itself to obtain an adapted policy, the base policy is then optimized to maximize the rewards that the adapted policy gets when facing the opponent. The challenging opponents are then adversarially generated by minimizing the base policy’s adaptability by automatically generating difficult to exploit opponents. These hard-to-exploit opponents are trained such that even if the base policy adapts to them, the adapted base policy cannot take advantage of them. Besides, our OSG algorithm can further produce diverse training opponents with a novel diversity-regularized policy optimization procedure. In specific, we use the Maximum Mean Discrepancy (MMD) metric (Gretton et al., 2007) to evaluate the differences between policies. The MMD metric is then incorporated as a regularization term into the policy optimization process to obtain a diverse set of opponent policies. By training with these challenging and diverse training opponents, the robustness and generalization ability of our L2E framework can be significantly improved. To summarize, the main contributions of this work are listed bellow in four-fold:
20
+
21
+ • We propose a novel learning to exploit (L2E) framework to exploit sub-optimal opponents without building explicit models for it. L2E can quickly adapt to a new opponent with unknown style using only a few interactions.
22
+ We propose to use an adversarial training procedure to generate challenging opponents automatically. These hard to exploit opponents help L2E eliminate its weakness and improve its robustness effectively.
23
+
24
+ ![](images/b707d933bb844758c8d3fff63a1cfa318bae8884d89228a071e70814ad52be3a.jpg)
25
+ Figure 1: The overview of our proposed L2E framework. The entire training process is based on the idea of adversarial learning (Alg. 1). The base policy training part maximizes the base policy’s adaptability by continually interacting with opponents of different strengths and styles (Section 2.1). The opponent strategy generation part first generates hard-to-exploit opponents for the current base policy (Hard-OSG, see Section 2.2.1), then generates diverse opponent policies to improve the generalization ability of the base policy (Diverse-OSG, see Section 2.2.2). The resulting base policy can fast adapt to completely new opponents with a few interactions.
26
+
27
+ • We further propose a diversity-regularized policy optimization procedure to generate diverse opponents automatically. The generalization ability of L2E is improved significantly by training with these diverse opponents. We conduct detailed experiments to evaluate the L2E framework in three different environments. The experimental results demonstrate that the base policy trained with L2E quickly exploits a wide range of opponents compared to other algorithms.
28
+
29
+ # 2 METHOD
30
+
31
+ In this paper, we propose a novel L2E framework to endow the agents to adapt to diverse opponents quickly. As shown in Fig. 1, L2E mainly consists of two modules, i.e., the base policy training part, and the opponent strategy generation part. In the base policy training part, our goal is to find a base policy that, given the unknown opponent, can fast adapt to it by using only a few interactions. To this end, the base policy is trained to be able to adapt to many opponents. In specific, giving an opponent $O$ , the base policy $B$ first adjusts itself to obtain an adapted policy $B ^ { \prime }$ by using a little interaction data between $O$ and $B$ , the base policy is then optimized to maximize the rewards that $B ^ { \prime }$ gets when facing $O$ . In other words, the base policy has learned how to adapt to its opponents and exploit them quickly.
32
+
33
+ The opponent strategy generation provides the base policy training part with challenging and diverse training opponents automatically. First, our proposed opponent strategy generation (OSG) algorithm can produce difficult to exploit opponents. In specific, the base policy $B$ first adjusts itself to obtain an adapted policy $B ^ { \prime }$ by using a little interaction data between $O$ and $B$ , the opponent $O$ is then optimized to minimize the rewards that $B ^ { \prime }$ gets when facing $O$ . The resulting opponent $O$ is hard to exploit since even if the base policy $B$ adapts to $O$ , the adapted policy $B ^ { \prime }$ can not take advantage of $O$ . By training with these hard to exploit opponents, the base policy can eliminate its weakness and improve its robustness effectively. Second, our OSG algorithm can further produce diverse training opponents with a novel diversity-regularized policy optimization procedure. More specifically, we first formalize the difference between opponent policies as the difference between the distribution of trajectories induced by each policy. The difference between distributions can be evaluated by the Maximum Mean Discrepancy (MMD) metric (Gretton et al., 2007). Then, MMD is integrated as a regularization term in the policy optimization process to identify various opponent policies. By training with these diverse opponents, the base policy can improve its generalization ability significantly. Next, we introduce these two modules in detail.
34
+
35
+ # 2.1 BASE POLICY TRAINING
36
+
37
+ Our goal is to find a base policy $B$ that can fast adapt to an unknown opponent $O$ by updating the parameters of $B$ using only a few interactions between $B$ and $O$ . The key idea is to train the base policy $B$ against many opponents to maximize its payoffs by using only a small amount of interactive data during training, such that it acquires the ability to exploit different opponents quickly. In effect, our L2E framework treats each opponent as a training example. After training, the resulting base policy $B$ can quickly adapt to new and unknown opponents using only a few interactions. Without loss of generality, the base policy $B$ is modeled by a deep neural network in this work, i.e., a parameterized function $\pi _ { \theta }$ with parameters $\theta$ . Similarly, the opponent $O$ for training is also a deep neural network $\pi _ { \phi }$ with parameters $\phi$ . We model the base policy as playing against an opponent in a two-player Markov game (Shapley, 1953). This Markov game $M \ =$ $( \bar { S } , ( A _ { B } , A _ { O } ) , \bar { T } , ( R _ { B } , R _ { O } ) )$ consists of the state space $S$ , the action space $A _ { B }$ and $A _ { O }$ , and a state transition function $T : S \times A _ { B } \times A _ { O } \to \Delta ( S )$ where $\Delta \left( S \right)$ is a probability distribution on $S$ . The reward function $R _ { i } : S \times A _ { B } \times A _ { O } \times S \to \mathbb { R }$ for each player $i \in \{ B , { \dot { O } } \}$ depends on the current state, the next state and both players’ actions. Given a training opponent $O$ whose policy is known and fixed, this two-player Markov game $M$ reduces to a single-player Markov Decision Process (MDP), i.e., $M _ { B } ^ { O } = ( \mathbf { \bar { { S } } } , \mathbf { \bar { { A } } } _ { B } , T _ { B } ^ { O } , R _ { B } ^ { O } ) $ . The state and action space of $\dot { M } _ { B } ^ { O }$ are the same as in $M$ . The transition and reward functions have the opponent policy embedded:
38
+
39
+ $$
40
+ T _ { B } ^ { O } ( s , a _ { B } ) = T ( s , a _ { B } , a _ { O } ) , \quad R _ { B } ^ { O } ( s , a _ { B } , s ^ { \prime } ) = R _ { B } ( s , a _ { B } , a _ { O } , s ^ { \prime } ) ,
41
+ $$
42
+
43
+ where the opponent’s action is sampled from its policy $a _ { O } \sim \pi _ { \phi } ( \cdot \mid s )$ . Throughout the paper, $M _ { X } ^ { Y }$ represents a single-player MDP, which is reduced from a two-player Markov game (i.e., player $X$ and player $Y$ ). In this MDP, the player $Y$ is fixed and can be regarded as part of the environment.
44
+
45
+ Suppose a set of training opponents can be constructed as described ab $\{ O _ { i } \} _ { i = 1 } ^ { N }$ is given. Fore base policy ch tra, i.e., ng opponent is allowed $O _ { i }$ , an MDP query a li $M _ { B } ^ { O _ { i } }$ $B$ $\pi _ { \theta }$
46
+ number of sample trajectories $\tau$ to adapt to $O _ { i }$ . In our method, the adapted parameters $\theta ^ { O _ { i } }$ of the
47
+ base policy are computed using one or more gradient descent updates with the sample trajectories
48
+ $\tau$ . For example, when using one gradient update:
49
+
50
+ $$
51
+ \theta ^ { O _ { i } } = \theta - \alpha \nabla _ { \theta } \mathcal { L } _ { B } ^ { O _ { i } } ( \pi _ { \theta } ) ,
52
+ $$
53
+
54
+ $$
55
+ \mathcal { L } _ { B } ^ { O _ { i } } ( \pi _ { \theta } ) = - \mathbb { E } _ { \tau \sim M _ { B } ^ { O _ { i } } } [ \sum _ { t } \gamma ^ { t } R _ { B } ^ { O _ { i } } ( s ^ { ( t ) } , a _ { B } ^ { ( t ) } , s ^ { ( t + 1 ) } ) ] .
56
+ $$
57
+
58
+ $\tau \sim M _ { B } ^ { O _ { i } }$ represents that the trajectory $\tau = \{ s ^ { ( 1 ) } , a _ { B } ^ { ( 1 ) } , s ^ { ( 2 ) } , \ldots , s ^ { ( t ) } , a _ { B } ^ { ( t ) } , s ^ { ( t + 1 ) } , \ldots \}$ is sampled from the MDP $M _ { B } ^ { O _ { i } }$ , where $s ^ { ( t + 1 ) } \sim T _ { B } ^ { O _ { i } } ( s ^ { ( t ) } , a _ { B } ^ { ( t ) } )$ and $a _ { B } ^ { ( t ) } \sim \pi _ { \theta } ( \cdot \mid s ^ { ( t ) } )$ .
59
+
60
+ We use $B ^ { O _ { i } }$ to denote the updated base policy, i.e., $\pi _ { \theta } o _ { i }$ . $B ^ { O _ { i } }$ can be seen as an opponent-specific policy, which is updated from the base policy through fast adaptation. Our goal is to find a generalizable base policy whose opponent-specific policy $B ^ { O _ { i } }$ can exploit its opponent $O _ { i }$ as much as possible. To this end, we optimize the parameters $\theta$ of the base policy to maximize the rewards that $\mathbf { \bar { \it B } } ^ { O _ { i } }$ gets when interacting with $O _ { i }$ . More concretely, the learning to exploit objective function is defined as follows:
61
+
62
+ $$
63
+ \operatorname* { m i n } _ { \theta } \sum _ { i = 1 } ^ { N } \mathcal { L } _ { B ^ { O _ { i } } } ^ { O _ { i } } ( \pi _ { \theta ^ { O _ { i } } } ) = \operatorname* { m i n } _ { \theta } \sum _ { i = 1 } ^ { N } \mathcal { L } _ { B ^ { O _ { i } } } ^ { O _ { i } } ( \pi _ { \theta - \alpha \nabla _ { \theta } \mathcal { L } _ { B } ^ { O _ { i } } ( \pi _ { \theta } ) } ) .
64
+ $$
65
+
66
+ It is worth noting that the optimization is performed over the base policy’s parameters $\theta$ , whereas the objective is computed using the adapted based policy’s parameters $\theta ^ { \boldsymbol { O } _ { i } }$ . The parameters $\theta$ of the base policy are updated as follows:
67
+
68
+ $$
69
+ \theta = \theta - \beta \nabla _ { \theta } \sum _ { i = 1 } ^ { N } \mathcal { L } _ { B ^ { O _ { i } } } ^ { O _ { i } } \big ( \pi _ { \theta ^ { O _ { i } } } \big ) .
70
+ $$
71
+
72
+ In effect, our L2E framework aims to find a base policy that can significantly exploit the opponent with only a few interactions with it (i.e., with a few gradient steps). The resulting base policy has learned how to adapt to different opponents and exploit them quickly. An overall description of the base policy training procedure is shown in Alg. 1. The algorithm consists of three main steps. First, generating hard to exploit opponents through the Hard-OSG module. Second, generating diverse opponent policies through the Diverse-OSG module. Third, training the base policy with these opponents to obtain fast adaptability.
73
+
74
+ # 2.2 AUTOMATIC OPPONENT GENERATION
75
+
76
+ Previously, we assumed that the set of opponents had been given. How to automatically generate effective opponents for training is the key to the success of our L2E framework. The training opponents should be challenging enough (i.e., hard to exploit). By learning to exploit these hard-toexploit opponents, the base policy $B$ can eliminate its weakness and become more robust. Besides, they should be sufficiently diverse. The more diverse they are, the stronger the generalization ability of the resulting base policy. We propose a novel opponent strategy generation (OSG) algorithm to achieve these goals.
77
+
78
+ # 2.2.1 HARD-TO-EXPLOIT OPPONENTS GENERATION
79
+
80
+ We use the idea of adversarial learning to generate challenging training opponents for the base policy $B$ . From the perspective of the base policy $B$ , giving an opponent $O$ , $B$ first adjusts itself to obtain an adapted policy, i.e., the opponent-specific policy $B ^ { O }$ , the base policy is then optimized to maximize the rewards that $B ^ { O }$ gets when interacting with $O$ . Contrary to the base policy’s goal, we want to find a hard-to-exploit opponent $\widehat { O }$ for the current base policy $B$ , such that even if $B$ adapts to $\widehat { O }$ , the adapted policy $B ^ { \widehat { O } }$ cannot take advantage of $\widehat { O }$ . In other words, the hard-to-exploit opponent $\widehat { O }$ is trained to minimize the rewards that $B ^ { \bar { \hat { O } } }$ gets when interacting with $\widehat { O }$ . The base policy attempts to increase its adaptability by learning to exploit different opponents, while the hardto-exploit opponent adversarially tries to minimize the base policy’s adaptability, i.e., maximize its counter-adaptability.
81
+
82
+ More concretely, the hard-to-exploit opponent $\widehat { O }$ is also a deep neural network $\pi _ { \widehat { \phi } }$ with randomly initialized parameters $\widehat { \phi }$ . At each training iteration, an MDP $M _ { B } ^ { \widehat { O } }$ can be constructed. The base policy $B$ first query a limited number of trajectories to adapt to $\widehat { O }$ . The parameters $\theta ^ { \hat { O } }$ of the adapted policy $B ^ { \widehat { O } }$ are computed using one gradient descent update,
83
+
84
+ $$
85
+ \theta ^ { \widehat { O } } = \theta - \alpha \nabla _ { \theta } \mathcal { L } _ { B } ^ { \widehat { O } } ( \pi _ { \theta } ) .
86
+ $$
87
+
88
+ $$
89
+ \mathcal { L } _ { B } ^ { \widehat { O } } ( \pi _ { \theta } ) = - \mathbb { E } _ { \tau \sim M _ { B } ^ { \widehat { O } } } [ \sum _ { t } \gamma ^ { t } R _ { B } ^ { \widehat { O } } ( s ^ { ( t ) } , a _ { B } ^ { ( t ) } , s ^ { ( t + 1 ) } ) ] .
90
+ $$
91
+
92
+ The parameters $\widehat { \phi }$ of $\widehat { O }$ is optimized to minimize the rewards that $B ^ { \widehat { O } }$ gets when interacting with $\widehat { O }$ . This is equivalent to maximize the rewards that $\widehat { O }$ gets since we only consider the competitive setting in this work. More concretely, the parameters $\widehat { \phi }$ are updated as follows:
93
+
94
+ $$
95
+ \widehat { \phi } = \widehat { \phi } - \alpha \nabla _ { \widehat { \phi } } \mathcal { L } _ { \widehat { O } } ^ { B ^ { \widehat { O } } } ( \pi _ { \widehat { \phi } } )
96
+ $$
97
+
98
+ $$
99
+ { \mathcal L } _ { \hat { O } } ^ { B ^ { \hat { O } } } ( \pi _ { \widehat { \phi } } ) = - \mathbb { E } _ { \tau ^ { \prime } \sim M _ { \hat { O } } ^ { B ^ { \hat { O } } } } [ \sum _ { t } \gamma ^ { t } R _ { \hat { O } } ^ { B ^ { \hat { O } } } ( s ^ { ( t ) } , a _ { \hat { O } } ^ { ( t ) } , s ^ { ( t + 1 ) } ) ] .
100
+ $$
101
+
102
+ After several rounds of iteration, we can obtain a hard-to-exploit opponent $\pi _ { \widehat { \phi } }$ for the current base policy $B$ . An overall description of this procedure is shown in Alg. 2.
103
+
104
+ # 2.2.2 DIVERSE OPPONENTS GENERATION
105
+
106
+ Training an effective base policy requires not only the hard-to-exploit opponents, but also diverse opponents of different styles. The more diverse the opponents used for training, the stronger the generalization ability of the resulting base policy. From a human player’s perspective, the opponent style is usually defined as different types, such as aggressive, defensive, elusive, etc. The most significant difference between opponents with different styles lies in the actions taken in the same state.
107
+
108
+ Take poker as an example; different opponents’ styles tend to take different actions when holding the same hand. Based on the above analysis, we formalize the difference between opponent policies as the difference between the distribution of trajectories induced by each policy when interacting with the base policy. We argue that differences in trajectories better capture the differences between different opponent policies.
109
+
110
+ Formally, given a base policy $B$ , i.e., $\pi _ { \theta }$ and an opponent policy $O _ { i }$ , i.e., $\pi _ { \phi _ { i } }$ , our diversityregularized policy optimization algorithm is to generate a new opponent $O _ { j }$ , i.e., $\pi _ { \phi _ { j } }$ whose style is different from $O _ { i }$ . We first construct two MDPs, i.e., $M _ { O _ { i } } ^ { B }$ and $M _ { O _ { j } } ^ { B }$ , and then sample two sets of trajectories, i.e., $\mathrm { T } _ { i } = \{ \tau \sim M _ { O _ { i } } ^ { B } \}$ and $\mathrm { T } _ { j } = \{ \tau \sim M _ { O _ { j } } ^ { B } \}$ from this two MDPs. The stochasticity in the MDP and the policy will induce a distribution over trajectories. We use the Maximum Mean Discrepancy (MMD) (Gretton et al., 2007) metric $( c . f$ . Appendix $\textrm { C }$ for details) to measure the differences between $\mathrm { T } _ { i }$ and $\mathrm { T } _ { j }$ :
111
+
112
+ $$
113
+ \begin{array} { r } { \mathbf { M M D } ^ { 2 } ( \mathrm { T } _ { i } , \mathrm { T } _ { j } ) = \mathbb { E } _ { \tau , \tau ^ { \prime } \sim M _ { \mathcal { O } _ { i } } ^ { B } } k \left( \tau , \tau ^ { \prime } \right) - 2 \mathbb { E } _ { \tau \sim M _ { \mathcal { O } _ { i } } ^ { B } , \tau ^ { \prime } \sim M _ { \mathcal { O } _ { j } } ^ { B } } k \left( \tau , \tau ^ { \prime } \right) + \mathbb { E } _ { \tau , \tau ^ { \prime } \sim M _ { \mathcal { O } _ { j } } ^ { B } } k \left( \tau , \tau ^ { \prime } \right) . } \end{array}
114
+ $$
115
+
116
+ $k$ is the Gaussian radial basis function kernel defined over a pair of trajectories:
117
+
118
+ $$
119
+ k ( \tau , \tau ^ { \prime } ) = \exp ( - \frac { \| g ( \tau ) - g ( \tau ^ { \prime } ) \| ^ { 2 } } { 2 } ) ,
120
+ $$
121
+
122
+ where $g$ stacks the states and actions of a trajectory into a vector. For trajectories with different length, we clip the long trajectory to the same length as the short one. There overall objective function of our proposed diversity-regularized policy optimization algorithm is as follows:
123
+
124
+ $$
125
+ \mathcal { L } ^ { \phi _ { i } } ( \phi _ { j } ) = - \mathbb { E } _ { \tau \sim M _ { \partial _ { j } } ^ { B } } [ \sum _ { t } \gamma ^ { t } R _ { O _ { j } } ^ { B } ( s ^ { ( t ) } , a _ { O _ { j } } ^ { ( t ) } , s ^ { ( t + 1 ) } ) ] - \alpha _ { m m d } \mathrm { M M D } ^ { 2 } ( \mathrm { T } _ { i } , \mathrm { T } _ { j } ) .
126
+ $$
127
+
128
+ The first term is to maximize the rewards that $O _ { j }$ gets when interacting with the base policy $B$ . The second term measures the difference between $O _ { j }$ and the existing opponent $O _ { i }$ . By this diversityregularized policy optimization, the resulting opponent $O _ { j }$ is not only useful in performance but also diverse relative to the existing policy.
129
+
130
+ We can iteratively apply the above algorithm to find a set of $N$ distinct and diverse opponents. In specific, subsequent opponents are learned by encouraging diversity with respect to previously generated opponent set $S$ . The distance between an opponent $O _ { m }$ and an opponent set $S$ is defined by the distance between have obtained a set of ocan be obtained by opti $O _ { m }$ and nentsg: $O _ { n }$ $O _ { n } \in S$ most s. The olicy to -th opp $O _ { m }$ . Suppt, i.e., $S = \{ O _ { m } \} _ { m = 1 } ^ { M } , M < N$ $M + 1$ $\pi _ { \phi _ { M + 1 } }$
131
+
132
+ $$
133
+ \mathcal { L } ^ { S } ( \phi _ { M + 1 } ) = - \mathbb { E } _ { \tau \sim M _ { \mathcal { O } _ { M + 1 } } ^ { B } } [ \sum _ { t } \gamma ^ { t } R _ { \mathcal { O } _ { M + 1 } } ^ { B } ( s ^ { ( t ) } , a _ { \mathcal { O } _ { M + 1 } } ^ { ( t ) } , s ^ { ( t + 1 ) } ) ] - \operatorname* { m i n } _ { \mathcal { O } _ { i } \in S } \mathrm { M M D } ^ { 2 } ( \mathrm { T } _ { i } , \mathrm { T } _ { M + 1 } ) .
134
+ $$
135
+
136
+ By doing so, the resulting $M + 1$ -th opponent remains diverse relative to the opponent set $S$ . An overall description of this procedure is shown in Alg. 3.
137
+
138
+ # 3 EXPERIMENTS
139
+
140
+ In this section, we conduct extensive experiments to evaluate the proposed L2E framework. We evaluate algorithm performance on the Leduc poker, the BigLeduc poker and a Grid Soccer environment, which are the commonly used benchmark for opponent modeling (Lanctot et al., 2017; Steinberger, 2019; He et al., 2016). We first verify the trained base policy using our L2E framework can fast exploit a wide range of opponents with only a few gradient updates. Then, we compare with other baseline methods to show the superiority of our L2E framework. Finally, we conduct a series of ablation experiments to demonstrate each part of our L2E framework’s effectiveness.
141
+
142
+ # 3.1 RAPID ADAPTABILITY
143
+
144
+ In this section, we verify the trained base policy’s ability to quickly adapt to different opponents in the Leduc poker environment $_ { . c . f }$ . Appendix $\mathrm { D }$ for details). We provide four opponents with different styles and strengths. 1) The random opponent randomly takes actions whose strategy is relatively weak but hard to exploit since it does not have an evident decision-making style. 2) The call opponent always takes call actions and has a fixed decision-making style that is easy to exploit. 3) The rocks opponent takes actions based on its hand-strength whose strategy is relatively strong. 4) The oracle opponent is a cheating, and the strongest player who can see the other players’ hands and make decisions based on this perfect information. As shown in Fig. 2, the base policy achieves a
145
+
146
+ ![](images/02cf3677b5c06c9ea5edc630829fc0af50cedbe0c7fd4b2e330cb28afec856ac.jpg)
147
+
148
+ Figure 2: The trained base policy using our L2E framework can quickly adapt to different opponents of different styles and strengths in the Leduc poker environment.
149
+
150
+ rapid increase in its average returns with a few gradient updates against all four opponent strategies. For the call opponent, which has a clear and monotonous style, the base policy can significantly exploit it. Against the random opponent with no clear style, the base policy can also exploit it quickly. When facing the strong rocks opponent or even the strongest oracle opponent, the base policy can quickly improve its average returns. One significant advantage of the proposed L2E framework is that the same base policy can exploit a wide range of opponents with different styles, demonstrating its strong generalization ability.
151
+
152
+ 3.2 COMPARISONS WITH OTHER BASELINE METHODS
153
+
154
+ <table><tr><td></td><td>Random</td><td>Call</td><td>Rocks</td><td>Nash</td><td>Oracle</td></tr><tr><td>L2E</td><td>0.42±0.32</td><td>1.34±0.14</td><td>0.38±0.17</td><td>-0.03±0.14</td><td>-1.15±0.27</td></tr><tr><td>MAML</td><td>1.27±0.17</td><td>-0.23±0.22</td><td>-1.42±0.07</td><td>-0.77±0.23</td><td>-2.93±0.17</td></tr><tr><td>Random</td><td>-0.02±3.77</td><td>-0.02±3.31</td><td>-0.68±3.75</td><td>-0.74±4.26</td><td>-1.90±4.78</td></tr><tr><td>TRPO</td><td>0.07±0.08</td><td>-0.22±0.09</td><td>-0.77±0.12</td><td>-0.42±0.07</td><td>-1.96±0.46</td></tr><tr><td>TRPO (pretrained)</td><td>0.15±0.17</td><td>-0.05±0.14</td><td>-0.70±0.27</td><td>-0.61±0.32</td><td>-1.32±0.27</td></tr><tr><td>EOM (Explicit Opponent Modeling)</td><td>0.30±0.15</td><td>-0.01±0.05</td><td>-0.13±0.20</td><td>-0.36±0.11</td><td>-1.82±0.28</td></tr></table>
155
+
156
+ Table 1: The average return of each method when performing rapid adaptation against different opponents in the Leduc Poker environment. The adaptation process is restricted to a three-step gradient update.
157
+
158
+ As discussed in Section 1, most previous opponent modeling methods require constructing explicit opponent models from a large amount of data before learning to adapt to new opponents. To the best of our knowledge, our L2E framework is the first attempt to use meta-learning to learn to exploit opponents without building explicit opponent models. To demonstrate the effectiveness of the L2E framework, we design several competitive baseline methods. As with the previous experiments, we also use three gradient updates when adapting to a new opponent. 1) MAML. The seminal meta-learning algorithm MAML (Finn et al., 2017) is designed for single-agent environments. We have redesigned and reimplemented the MAML algorithm for the two-player competitive environments. The MAML baseline trains a base policy by continually sampling the opponent’s strategies, either manually specified or randomly generated. 2) TRPO. The TRPO baseline does not perform pre-training and uses the TRPO algorithm (Schulman et al., 2015) to updated its parameters via three-step gradient updates to adapt to different opponents. 3) Random. The Random baseline is neither pre-trained nor updated online. To evaluate different algorithms more comprehensively, we additionally add a new Nash opponent. This opponent’s policy is a part of an approximate Nash Equilibrium generated iteratively by the CFR (Zinkevich et al., 2008) algorithm. Playing a strategy from a Nash Equilibrium in a two-player zero-sum game is guaranteed not to lose in expectation even if the opponent is the best response strategy when the value of the game is zero. We show the performance of the various algorithms in Table 1. It is clear that L2E maintains the highest profitability against all four types of opponents other than the random type. L2E can exploit the opponent with evident style significantly, such as the the Call opponent. Compared to other baseline methods, L2E achieved the highest average return against opponents with unclear styles, such as the Rocks opponent, the Nash opponent, and the cheating Oracle opponent.
159
+
160
+ # 3.3 ABLATION STUDIES
161
+
162
+ ![](images/b1d09b3308ce6796c8f703dbd5ac51a7a687e1e467bec10dd91e8a98bcd1ab4a.jpg)
163
+ Figure 3: Visualization of the styles of the strategies generated with or without the MMD regularization term in the Leduc poker environment.
164
+
165
+ In this section, we verify whether our proposed diversity-regularized policy optimization algorithm can effectively generate policies with different styles. In Leduc poker, hand-action pairs represent different combinations of hands and actions. In the pre-flop phase, each player’s hand has three possibilities, i.e., J, Q, and K. Meanwhile, each player also has three optional actions, i.e., Call (c), Rise (r), and Fold (f). For example, ‘Jc’ means to call when getting the jack. Action probability is the probability that a player will take a corresponding action with a particular hand. Fig. 3 demonstrates that without the MMD regularization term, the two sets of strategies generated in both the pre-flop and flop phases have similar styles. By optimizing with the MMD regularization term, the generated strategies are diverse enough which cover a wide range of different states and actions.
166
+
167
+ # 3.3.2 EFFECTS OF THE HARD-OSG AND THE DIVERSE-OSG
168
+
169
+ As discussed previously, a crucial step in L2E is the automatic generation of training opponents. The HardOSG and Diverse-OSG modules are used to generate opponents that are difficult to exploit and diverse in styles. Fig. 4 shows the impact of each module on the performance of L2E. ‘L2E w/o counter’ is L2E without the Hard-OSG module. Similarly, ‘L2E w/o diverse’ is L2E without the Diverse-OSG module. ‘L2E w/o diverse&counter’ removes both modules altogether. The results show that both Hard-OSG and Diverse-OSG have a crucial influence on L2E’s performance. It is clear that the Hard-OSG module helps to enhance the stability of the base policy, and the Diverse-OSG module can improve the base policy’s performance significantly. To further demonstrate the generalization ability of L2E, we conducted a series of additional experiments on the BigLeduc poker and a
170
+
171
+ ![](images/af475094bf5da7f87e35d8896c718dea65774c05e7ada4c61cc8398b927d199f.jpg)
172
+ Figure 4: Each curve shows the average normalized returns of the base policy trained with different variants of L2E in the grid soccer environment.
173
+
174
+ Grid Soccer game environment $( c . f .$ . Appendix E and Appendix F for details).
175
+
176
+ # 4 CONCLUSION
177
+
178
+ We propose a learning to exploit (L2E) framework to exploit sub-optimal opponents without building explicit opponent models. L2E acquires the ability to exploit opponents by a few interactions with different opponents during training, so that it adapts to new opponents during testing quickly. We propose a novel opponent strategy generation algorithm that produces effective training opponents for L2E automatically. We first design an adversarial training procedure to generate challenging opponents to improve L2E’s robustness effectively. We further exploit a diversity-regularized policy optimization procedure to generate diverse opponents to improve L2E’s generalization ability significantly. Detailed experimental results in three challenging environments demonstrate the effectiveness of the proposed L2E framework.
179
+
180
+ # REFERENCES
181
+
182
+ Mohammed Amin Abdullah, Hang Ren, Haitham Bou Ammar, Vladimir Milenkovic, Rui Luo, Mingtian Zhang, and Jun Wang. Wasserstein robust reinforcement learning. arXiv preprint arXiv:1907.13196, 2019.
183
+
184
+ Alexandros Agapitos, Julian Togelius, Simon M Lucas, Jurgen Schmidhuber, and Andreas Konstantinidis. Generating diverse opponents with multiobjective evolution. In IEEE Symposium On Computational Intelligence and Games, pp. 135–142, 2008.
185
+
186
+ Maruan Al-Shedivat, Trapit Bansal, Yura Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. In International Conference on Learning Representations, 2018.
187
+
188
+ Stefano V Albrecht and Peter Stone. Reasoning about hypothetical agent behaviours and their parameters. In International Conference on Autonomous Agents and Multiagent Systems, pp. 547– 555, 2017.
189
+
190
+ Stefano V Albrecht and Peter Stone. Autonomous agents modelling other agents: A comprehensive survey and open problems. Artificial Intelligence, 258:66–95, 2018.
191
+
192
+ 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.
193
+
194
+ George W Brown. Iterative solution of games by fictitious play. Activity analysis of production and allocation, 13(1):374–376, 1951.
195
+
196
+ 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.
197
+
198
+ Eddie Dekel, Drew Fudenberg, and David K Levine. Learning to play bayesian games. Games and Economic Behavior, 46(2):282–303, 2004.
199
+
200
+ Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. In International Conference on Learning Representations, 2018.
201
+
202
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pp. 1126–1135, 2017.
203
+
204
+ Jakob Foerster, Richard Y Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. In International Conference on Autonomous Agents and MultiAgent Systems, pp. 122–130, 2018.
205
+
206
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Matteo Hessel, Ian Osband, Alex Graves, Volodymyr Mnih, Remi Munos, Demis Hassabis, et al. Noisy networks for exploration. In International Conference on Learning Representations, 2018.
207
+
208
+ Arthur Gretton, Karsten Borgwardt, Malte Rasch, Bernhard Scholkopf, and Alex J Smola. A kernel ¨ method for the two-sample-problem. In Advances in neural information processing systems, pp. 513–520, 2007.
209
+
210
+ Barbara Grosz and Candace L Sidner. Attention, intentions, and the structure of discourse. Computational linguistics, 1986.
211
+
212
+ Abhishek Gupta, Benjamin Eysenbach, Chelsea Finn, and Sergey Levine. Unsupervised metalearning for reinforcement learning. arXiv preprint arXiv:1806.04640, 2018.
213
+
214
+ He He, Jordan Boyd-Graber, Kevin Kwok, and Hal Daume III. Opponent modeling in deep rein- ´ forcement learning. In International conference on machine learning, pp. 1804–1813, 2016.
215
+
216
+ Timothy Hospedales, Antreas Antoniou, Paul Micaelli, and Amos Storkey. Meta-learning in neural networks: A survey. arXiv preprint arXiv:2004.05439, 2020.
217
+
218
+ Trung Dong Huynh, Nicholas R Jennings, and Nigel R Shadbolt. An integrated trust and reputation model for open multi-agent systems. Autonomous Agents and Multi-Agent Systems, 13(2):119– 154, 2006.
219
+
220
+ Max Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M Czarnecki, Jeff Donahue, Ali Razavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, et al. Population based training of neural networks. arXiv preprint arXiv:1711.09846, 2017.
221
+
222
+ Max Jaderberg, Wojciech M Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garcia Castaneda, Charles Beattie, Neil C Rabinowitz, Ari S Morcos, Avraham Ruderman, et al. Humanlevel performance in 3d multiplayer games with population-based reinforcement learning. Science, 364(6443):859–865, 2019.
223
+
224
+ Peter A Jarvis, Teresa F Lunt, and Karen L Myers. Identifying terrorist activity with ai plan recognition technology. AI magazine, 26(3):73–73, 2005.
225
+
226
+ Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Karl Tuyls, Julien Perolat, David Silver, and Thore Graepel. A unified game-theoretic approach to multiagent re- ´ inforcement learning. In Advances in neural information processing systems, pp. 4190–4203, 2017.
227
+
228
+ Gordon McCalla, Julita Vassileva, Jim Greer, and Susan Bull. Active learner modelling. In International Conference on Intelligent Tutoring Systems, pp. 53–62, 2000.
229
+
230
+ Richard Mealing and Jonathan L Shapiro. Opponent modeling by expectation–maximization and sequence prediction in simplified poker. IEEE Transactions on Computational Intelligence and AI in Games, 9(1):11–24, 2015.
231
+
232
+ Christian Muise, Vaishak Belle, Paolo Felli, Sheila McIlraith, Tim Miller, Adrian R Pearce, and Liz Sonenberg. Planning over multi-agent epistemic states: A classical planning approach. In AAAI Conference on Artificial Intelligence, 2015.
233
+
234
+ John H Nachbar. Beliefs in repeated games. Econometrica, 73(2):459–480, 2005.
235
+
236
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. arXiv preprint arXiv:1803.02999, 2018.
237
+
238
+ Anay Pattanaik, Zhenyi Tang, Shuijing Liu, Gautham Bommannan, and Girish Chowdhary. Robust deep reinforcement learning with adversarial attacks. In International Conference on Autonomous Agents and MultiAgent Systems, pp. 2040–2042, 2018.
239
+
240
+ Lerrel Pinto, James Davidson, Rahul Sukthankar, and Abhinav Gupta. Robust adversarial reinforcement learning. In International Conference on Machine Learning, pp. 2817–2826, 2017.
241
+
242
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. In International Conference on Learning Representations, 2018.
243
+
244
+ Rob Powers and Yoav Shoham. Learning against opponents with bounded memory. In International joint conference on Artificial intelligence, pp. 817–822, 2005.
245
+
246
+ Neil Rabinowitz, Frank Perbet, Francis Song, Chiyuan Zhang, SM Ali Eslami, and Matthew Botvinick. Machine theory of mind. In International Conference on Machine Learning, pp. 4218–4227, 2018.
247
+
248
+ 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.
249
+
250
+ Lloyd S Shapley. Stochastic games. Proceedings of the national academy of sciences, 39(10): 1095–1100, 1953.
251
+
252
+ Eric Steinberger. Single deep counterfactual regret minimization. arXiv preprint arXiv:1901.07621, 2019.
253
+
254
+ Gita Sukthankar and Katia Sycara. Policy recognition for multi-player tactical scenarios. In International joint conference on Autonomous agents and multiagent systems, pp. 1–8, 2007.
255
+
256
+ Gabriel Synnaeve and Pierre Bessiere. A bayesian model for opening prediction in rts games with application to starcraft. In IEEE Conference on Computational Intelligence and Games, pp. 281– 288, 2011.
257
+
258
+ Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michael Mathieu, Andrew Dudzik, Juny- ¨ oung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
259
+
260
+ Jane X Wang, Zeb Kurth-Nelson, Dhruva Tirumala, Hubert Soyer, Joel Z Leibo, Remi Munos, Charles Blundell, Dharshan Kumaran, and Matt Botvinick. Learning to reinforcement learn. arXiv preprint arXiv:1611.05763, 2016.
261
+
262
+ Rui Wang, Joel Lehman, Jeff Clune, and Kenneth O Stanley. Paired open-ended trailblazer (poet): Endlessly generating increasingly complex and diverse learning environments and their solutions. arXiv preprint arXiv:1901.01753, 2019.
263
+
264
+ Ben G Weber and Michael Mateas. A data mining approach to strategy prediction. In IEEE Symposium on Computational Intelligence and Games, pp. 140–147, 2009.
265
+
266
+ Ying Wen, Yaodong Yang, Rui Luo, Jun Wang, and Wei Pan. Probabilistic recursive reasoning for multi-agent reinforcement learning. In International Conference on Learning Representations, 2018.
267
+
268
+ Zhongwen Xu, Hado P van Hasselt, and David Silver. Meta-gradient reinforcement learning. In Advances in neural information processing systems, pp. 2396–2407, 2018.
269
+
270
+ Martin Zinkevich, Michael Johanson, Michael Bowling, and Carmelo Piccione. Regret minimization in games with incomplete information. In Advances in neural information processing systems, pp. 1729–1736, 2008.
271
+
272
+ # A RELATED WORK
273
+
274
+ # A.1 OPPONENT MODELING
275
+
276
+ Opponent modeling is a long-standing research topic in artificial intelligence, and some of the earliest works go back to the early days of game theory research (Brown, 1951). The main goal of opponent modeling is to interact more effectively with other agents by building models to reason about their intentions, predicting their next moves or other properties (Albrecht & Stone, 2018). The commonly used opponent modeling methods can be roughly divided into four categories: policy reconstruction, classification, type-based reasoning and recursive reasoning. Policy reconstruction methods (Mealing & Shapiro, 2015) reconstruct the opponents’ decision making process by building models which make explicit predictions about their actions. Classification methods (Weber & Mateas, 2009; Synnaeve & Bessiere, 2011) produce models which assign class labels (e.g., “aggressive” or “defensive”) to the opponent and employ a precomputed strategy which is effective against that particular class of opponent. Type-based reasoning methods (He et al., 2016; Albrecht & Stone, 2017) assume that the opponent has one of several known types and update the belief using the new observations obtained during the real-time interactions. Recursive reasoning based methods (Muise et al., 2015; de Weerd et al., 2017) model the nested beliefs (e.g., “I believe that you believe that I believe...”) and simulate the reasoning processes of the opponents to predict their actions. Different from these existing methods which usually require a large amount of interactive data to generate useful opponent models, our L2E framework does not explicitly model the opponent and acquires the ability to exploit different opponents by training with limited interactions with different styles of opponents.
277
+
278
+ # A.2 META-LEARNING
279
+
280
+ Meta-learning is a new trend of research in the machine learning community which tackles the problem of learning to learn (Hospedales et al., 2020). It leverages past experiences in the training phase to learn how to learn, acquiring the ability to generalize to new environments or new tasks. Recent progress in meta-learning has achieved impressive results ranging from classification and regression in supervised learning (Finn et al., 2017; Nichol et al., 2018) to new task adaption in reinforcement learning (Wang et al., 2016; Xu et al., 2018). Some recent works have also initially explored the application of meta-learning in opponent modeling. For example, the theory of mind network (ToMnet) (Rabinowitz et al., 2018) uses meta-learning to improve the predictions about the opponents’ future behaviors. Another related work (Al-Shedivat et al., 2018) uses meta-learning to handle the non-stationarity problem in the multi-agent interactions. Different from these methods, we focus on how to improve the agents’ ability to quickly adapt to different and unknown opponents.
281
+
282
+ # A.3 STRATEGY GENERATION
283
+
284
+ The automatic generation of effective opponent strategies for training with is a critical step in our approach, and how to generate diverse strategies has been preliminarily studied in the reinforcement learning community. In specific, diverse strategies can be obtained in a variety of ways, including adding some diversity regularization to the optimization objective (Abdullah et al., 2019), randomly searching in some diverse parameter space (Plappert et al., 2018; Fortunato et al., 2018), using information-based strategy proposal (Eysenbach et al., 2018; Gupta et al., 2018) and searching diverse strategies with evolutionary algorithms (Agapitos et al., 2008; Wang et al., 2019; Jaderberg et al., 2017; 2019). More recently, the researchers from DeepMind propose a league training paradigm to obtain a Grandmaster level StarCraft II AI (i.e., AlphaStar) by training a diverse league of clorntinually adapting strategies and counter-strategies (Vinyals et al., 2019). Different from AlphaStar, our opponent strategy generation algorithm exploits adversarial training and diversityregularized policy optimization to produce challenging and diverse opponents respectively.
285
+
286
+ # B ALGORITHM
287
+
288
+ Algorithm 1: The base policy training procedure of our L2E framework.
289
+ Input: Step size hyper parameters $\alpha , \beta$ ; base policy $B$ with parameters $\theta$ ; opponent policy $O$ with parameters $\phi$ .
290
+ Output: An adaptive base policy $\mathbf { B }$ with parameters $\theta$
291
+ randomly initialize $\theta , \phi$ ;
292
+ initialize policy pool $\mathcal { M } = \{ O \}$ ;
293
+ for $1 < e \leq e p o c h s$ do $O = \mathbf { H } \mathbf { a r d - } \mathbf { O S } \mathbf { G } ( B )$ .(see Alg. 2 ) ; $\mathcal { P } =$ Diverse- $\mathbf { 0 s G } ( B , O , N )$ .(see Alg. 3) ; Update opponent policy pool ${ \mathcal { M } } = { \mathcal { M } } \cup { \mathcal { P } }$ ; Sample batch of opponents $O _ { i } \sim { \mathcal { M } }$ ; for Each opponent $O _ { i }$ do Construct a single-player MDP $M _ { B } ^ { O _ { i } }$ ; Sample trajectories $\tau$ using $B$ against fixed opponent $O _ { i }$ ; Use Eqn. (1) to update the parameters of $B$ to obtain an adapted policy $B ^ { O _ { i } }$ ; Resample trajectories $\tau ^ { \prime }$ using $B ^ { O _ { i } }$ against $O _ { i }$ ; Update the parameters $\theta$ of $B$ according to Eqn. (4);
294
+
295
+ # C MAXIMUM MEAN DISCREPANCY
296
+
297
+ We use the Maximum Mean Difference (MMD) (Gretton et al., 2007) metric to measure the differences between the distributions of trajectories induced by different opponent strategies.
298
+
299
+ Algorithm 2: Hard-OSG, the hard-to-exploit training opponent generation algorithm.
300
+
301
+ Input: The latest base policy $B$ with parameters $\theta$
302
+
303
+ Output: A hard-to-exploit opponent $\hat { \boldsymbol { O } }$ for $B$
304
+
305
+ Randomly initialize $\widehat { O }$ ’s parameters $\widehat { \phi }$ for $1 \leq i \leq$ epochs do
306
+
307
+ Construct a single-player MDP $M _ { B } ^ { \widehat { O } }$ ;
308
+ Sample a small number of trajectories $\tau \sim M _ { B } ^ { \widehat { O } }$ using $B$ against $\widehat { O }$ ;
309
+ Use Eqn. (5) to update the parameters of $B$ to obtain an adapted policy $B ^ { \widehat { O } }$ ;
310
+ Sample trajectories τ 0 ∼ M BObO u sing $\widehat { O }$ against $B ^ { \widehat { O } }$ ;
311
+ Update the parameters $\widehat { \phi }$ of $\widehat { O }$ according to Eqn. (7) ;
312
+
313
+ Algorithm 3: Diverse-OSG, the proposed diversity-regularized policy optimization algorithm to generate diverse training opponents.
314
+
315
+ Input: The latest base policy $B$ , an exsiting opponent $O _ { 1 }$ , the total number of opponents that to be generated $N$ .
316
+
317
+ $S = \{ O _ { m } \} _ { m = 1 } ^ { N }$
318
+
319
+ Initialize the opponent set $S = \{ O _ { 1 } \}$ ;
320
+
321
+ for $i = 2$ to $N$ do
322
+
323
+ Update the opponent set $S$ , i.e., $S = S \cup O _ { i }$
324
+
325
+ Definition 1 Let $\mathcal { F }$ be a function space $f : \mathcal { X } \mathbb { R }$ . Suppose we have two distributions $p$ and $q$ , $X : = \{ x _ { 1 } , . . . , x _ { m } \} \sim p$ , $Y : = \{ y _ { 1 } , . . . , y _ { n } \} \sim q$ . The MMD between $p$ and $q$ using test functions from the function space $\mathcal { F }$ is defined as follows:
326
+
327
+ $$
328
+ \mathrm { M M D } [ { \mathcal F } , p , q ] : = \operatorname* { s u p } _ { f \in { \mathcal F } } \left( { \mathbf E } _ { x \sim p } [ f ( x ) ] - { \mathbf E } _ { y \sim q } [ f ( y ) ] \right) .
329
+ $$
330
+
331
+ If we can pick a suitable function space $\mathcal { F }$ , we get the following important theorem (Gretton et al., 2007).
332
+
333
+ Theorem 1 Let $\mathcal { F } = \{ f \ | \ \| f \| _ { \mathcal { H } } \leq 1 \}$ be a unit ball in a Reproducing Kernel Hilbert Space (RKHS).
334
+ Then $\mathrm { M M D } [ \mathcal { F } , p , q ] = 0$ if and only if $p = q$ .
335
+
336
+ So the MMD distance between two strategies is 0 when the distributions of trajectories induced by them are identical. To obtain a set of strategies with diverse styles, we should increase the MMD distances between different strategies. $\varphi$ is a feature space mapping from $x$ to RKHS, we can easily
337
+
338
+ # Algorithm 4: The testing procedure of our L2E framework.
339
+
340
+ Input: Step size hyper parameters $\alpha$ ; The trained base policy $B$ with parameters $\theta$ ; an unknown opponent $O$ .
341
+ Output: The updated base policy $B ^ { O }$ that has been adapted to the opponent $O$ .
342
+ Construct a single-player MDP $\dot { M } _ { B } ^ { O }$ ;
343
+ for $0 < s t e p \leq s t e p s$ do Sample trajectories $\tau$ from the MDP $M _ { B } ^ { O }$ ; Update the parameters $\theta$ of $B$ according to Eqn. (1);
344
+
345
+ calculate the MMD distance using the kernel method $k ( x , x ^ { \prime } ) : = \langle \varphi ( x ) , \varphi ( x ^ { \prime } ) \rangle _ { \mathcal { H } }$ :
346
+
347
+ $$
348
+ \begin{array} { r l } { { \mathrm { M M D } ^ { 2 } ( \mathcal { F } , p , q ) } } \\ & { = \bigl \| \mathbb { E } _ { X \sim p } \varphi ( X ) - \mathbb { E } _ { Y \sim q } \varphi ( Y ) \bigr \| _ { \mathcal { H } } ^ { 2 } } \\ & { = \langle \mathbb { E } _ { X \sim p } \varphi ( X ) - \mathbb { E } _ { Y \sim q } \varphi ( Y ) , \mathbb { E } _ { X \sim p } \varphi ( X ) - \mathbb { E } _ { Y \sim q } \varphi ( Y ) \rangle } \\ & { = \mathbb { E } _ { X , X ^ { \prime } \sim p } k ( X , X ^ { \prime } ) - 2 \mathbb { E } _ { X \sim p , Y \sim q } k ( X , Y ) + \mathbb { E } _ { Y , Y ^ { \prime } \sim q } k ( Y , Y ^ { \prime } ) . } \end{array}
349
+ $$
350
+
351
+ The expectation terms in Eqn. (14) can be approximated using samples:
352
+
353
+ $$
354
+ \begin{array} { r l r } & { } & { \mathrm { M M D } ^ { 2 } [ { \mathcal F } , X , Y ] = \frac { 1 } { m ( m - 1 ) } \sum _ { i \neq j } ^ { m } k \left( x _ { i } , x _ { j } \right) } \\ & { } & { \qquad + \frac { 1 } { n ( n - 1 ) } \sum _ { i \neq j } ^ { n } k \left( y _ { i } , y _ { j } \right) - \frac { 2 } { m n } \sum _ { i , j = 1 } ^ { m , n } k \left( x _ { i } , y _ { j } \right) . } \end{array}
355
+ $$
356
+
357
+ The gradient of the MMD term with respect to the policy’s parameter $\phi _ { j }$ in our L2E framework can be calculated as follows:
358
+
359
+ $$
360
+ \begin{array} { r l } & { \nabla _ { \phi _ { j } } \mathrm { M M D } ^ { 2 } ( \mathrm { T } _ { i } , \mathrm { T } _ { j } ) = \nabla _ { \phi _ { j } } \mathrm { M M D } ^ { 2 } ( \{ \tau \sim M _ { O _ { i } } ^ { B } \} , \{ \tau \sim M _ { O _ { j } } ^ { B } \} ) } \\ & { \qquad = \mathbb { E } _ { \tau , \tau ^ { \prime } \sim M _ { O _ { i } } ^ { B } } [ k \left( \tau , \tau ^ { \prime } \right) \nabla _ { \phi _ { j } } \log ( p ( \tau ) p ( \tau ^ { \prime } ) ) ] } \\ & { \qquad - 2 \mathbb { E } _ { \tau \sim M _ { O _ { i } } ^ { B } , \tau ^ { \prime } \sim M _ { O _ { j } } ^ { B } } [ k \left( \tau , \tau ^ { \prime } \right) \nabla _ { \phi _ { j } } \log ( p ( \tau ) p ( \tau ^ { \prime } ) ) ] } \\ & { \qquad + \mathbb { E } _ { \tau , \tau ^ { \prime } \sim M _ { O _ { j } } ^ { B } } [ k \left( \tau , \tau ^ { \prime } \right) \nabla _ { \phi _ { j } } \log ( p ( \tau ) p ( \tau ^ { \prime } ) ) ] , } \end{array}
361
+ $$
362
+
363
+ where $p ( \tau )$ is the probability of the trajectory. Since $\mathrm { T } _ { i } = \{ \tau \sim M _ { O _ { i } } ^ { B } \}$ , $O _ { i }$ is the known opponent policy that has no dependence on $\phi _ { j }$ . The gradient with respect to the parameters $\phi _ { j }$ in first term is 0. The gradient of the second and third terms can be easily calculated as follows:
364
+
365
+ $$
366
+ \nabla _ { \phi _ { j } } \log ( p ( \tau ) ) = \sum _ { t = 0 } ^ { T } \nabla _ { \phi _ { j } } \log \pi _ { \phi _ { j } } ( a _ { t } | s _ { t } ) .
367
+ $$
368
+
369
+ # D LEDUC POKER
370
+
371
+ The Leduc poker generally uses a deck of six cards that includes two suites, each with three ranks (Jack, Queen, and King of Spades, Jack, Queen, and King of Hearts). The game has a total of two rounds. Each player is dealt with a private card in the first round, with the opponent’s deck information hidden. In the second round, another card is dealt with as a community card, and the information about this card is open to both players. If a player’s private card is paired with the community card, that player wins the game; otherwise, the player with the highest private card wins the game. Both players bet one chip into the pot before the cards are dealt. Moreover, a betting round follows at the end of each dealing round. The betting wheel alternates between two players, where each player can choose between the following actions: call, check, raise, or fold. If a player chooses to call, that player will need to increase his bet until both players have the same number of chips. If one player raises, that player must first make up the chip difference and then place an additional bet. Check means that a player does not choose any action on the round, but can only check if both players have the same chips. If a player chooses to fold, the hand ends, and the other player wins the game. When all players have equal chips for the round, the game moves on to the next round. The final winner wins all the chips in the game.
372
+
373
+ Next, we introduce how to define the state vector. Position in a poker game is a critical piece of information that determines the order of action. We define the button (the pre-flop first-hand position), the action position (whose turn it is to take action), and the current game round as one dimension of the state, respectively. In Poker, the combination of a player’s hole cards and board cards determines the game’s outcome. We encode the hole cards and the board cards separately. The amount of chips is an essential consideration in a player’s decision-making process. We encode this information into two dimensions of the state. The number of chips in the pot can reflect the action history of both players. The difference in bets between players in this round affects the choice of action (the game goes to the next round until both players have the same number of chips). In summary, the state vector has seven dimensions, i.e., button, to act, round, hole cards, board cards, chips to call, and pot.
374
+
375
+ # E BIGLEDUC POKER
376
+
377
+ We use a larger and more challenging BigLeduc poker environment to further verify the effectiveness of our L2E framework. The BigLeduc poker has the same rules as Leduc but uses a deck of 24 cards with 12 ranks. In addition to the larger state space, BigLeduc allows a maximum of 6 instead of 2 raises per round. As shown in Fig. 5, L2E still achieves fast adaptation to different opponents. In comparison with other baseline methods, L2E achieves the highest average return in Table 2.
378
+
379
+ Table 2: The average return of each method when performing rapid adaptation against different opponents in the BigLeduc poker environment.
380
+
381
+ <table><tr><td></td><td>Random</td><td>Call</td><td>Raise</td><td>Oracle</td></tr><tr><td>L2E</td><td>0.82±0.28</td><td>0.74±0.22</td><td>0.68±0.09</td><td>-1.02±0.24</td></tr><tr><td>MAML</td><td>0.77±0.30</td><td>0.17±0.08</td><td>-2.02±0.99</td><td>-1.21±0.30</td></tr><tr><td>Random</td><td>-0.00±3.08</td><td>-0.00±2.78</td><td>-2.83±5.25</td><td>-1.88±4.28</td></tr><tr><td>TRPO</td><td>0.19±0.09</td><td>0.10±0.16</td><td>-2.22±0.71</td><td>-1.42±0.47</td></tr><tr><td>TRPO (pretrained)</td><td>0.36±0.42</td><td>0.23±0.21</td><td>-2.03±1.61</td><td>-1.69±0.69</td></tr><tr><td>EOM</td><td>0.56±0.43</td><td>0.15±0.13</td><td>-1.15±0.12</td><td>-1.63±0.62</td></tr></table>
382
+
383
+ ![](images/f6d477f4d11aa1e84d11d6d7f38f20b6984973eea4df047f10e6c1463e92c88b.jpg)
384
+ Figure 5: The trained base policy using our L2E framework can quickly adapt to different opponents of different styles and strengths in the BigLeduc poker environment.
385
+
386
+ # F GRID SOCCER
387
+
388
+ This game contains a board with a $6 \times 9$ grid, two players, and their respective target areas. The position of the target area is fixed, and the two players appear randomly in their respective areas at the start of the game. One of the two players randomly has the ball. The goal of all players is to move the ball to the other player’s target position. When the two players move to the same grid, the player with the ball loses the ball. Players gain one point for moving the ball to the opponent’s area. The player can move in all four directions within the grid, and action is invalid when it moves to the boundary.
389
+
390
+ We train the L2E algorithm in this soccer environment in which both players are modeled by a neural network. Inputs to the network include information about the position of both players, the position of the ball, and the boundary. We provide two types of opponents to test the effectiveness of the resulting base policy. 1) A defensive opponent who adopts a strategy of not leaving the target area and preventing opposing players from attacking. 2) An aggressive opponent who adopts a strategy of continually stealing the ball and approaching the target area with the ball. Facing a defensive opponent won’t lose points, but the agent must learn to carry the ball and avoid the opponent moving to the target area to score points. Against an aggressive opponent, the agent must learn to defend at the target area to avoid losing points. Fig. 6 shows the comparisons between L2E, MAML, and TRPO. L2E adapts quickly to both types of opponents; TRPO works well against defensive opponents but loses many points against aggressive opponents; MAML is unstable due to its reliance on task specification during the training process.
391
+
392
+ ![](images/a5942e5de626a37bb169b7469505e9133863977d2f517cc76ea5ed8fe5f93911.jpg)
393
+ Figure 6: The trained base policy using our L2E framework can quickly adapt to opponents with different styles in a Grid Soccer environment.
394
+
395
+ # G CONVERGENCE
396
+
397
+ Since convergence in game theory is difficult to analyze theoretically, we have designed a series of small-scale experiments to empirically verify the convergence of L2E with the help of Rock-PaperScissors(RPS) game. There are several reasons why RPS game is chosen: 1. RPS game is easy to analyze due to the small state and action space. 2. RPS game is easy to visualize and analyze due to the small state and action space. 3. RPS game is often used in game theory for theoretical analysis. The experiments we designed contains the following parts: 1. Testing the adaptability of Policy Gradient (PG), Self Play (SF), and L2E by visualizing the adaptation process. 2. Analyzing the relationship between L2E strategy and Nash strategy. 3. Analyzing the convergence of L2E.
398
+
399
+ ![](images/ed71134ace0492d76a4a43e931ec1a04f3b1860ec90ac99979fb483e2fb31395.jpg)
400
+ Figure 7: A. Policy Gradient $:$ Optimize iteratively for the initial opponent (the orange dot), eventually converging to the best response of the initial opponent’s strategy. B. Self Play $:$ Each iteration seeks the best response to the previous round of strategy, which does not converge in an intransitive game like RPS. C. L2E’s adaptation process when facing a new opponent (the orange dot). D. Nash policy’s adaptation process when facing a new opponent (the orange dot).
401
+
402
+ As shown in Fig. 7, we can draw the following conclusions: 1. PG eventually converged to the best response, but it took dozens of gradient descent steps in our experiments (Each blue dot represents a ten-step gradient descent). SP failed to converge in the RPS game due to the intransitive nature of the RPS game (Rock>Scissors $>$ Paper $\textgreater$ Rock). In contrast, our L2E quickly converged to the best response strategy (Each blue dot represents a one-step gradient descent). 2. The strategy visualization in the Fig. 7.C shows that the base policy of L2E does not converge to the Nash equilibrium strategy after training but converges to the vicinity of the Nash equilibrium strategy. 3. If we fix the base policy to the Nash strategy by imitation learning and then adapting it, we do not get good results either. This further illustrates the difference between the L2E strategy and the Nash equilibrium strategy. And the Fig. 8 further shows the performance of L2E and Nash strategy in RPS game when facing new opponents.
403
+
404
+ ![](images/6879e74de3c4fb30ca264321f42c43f5b3727a65e23ec57434b2117ca295c813.jpg)
405
+ Figure 8: The performance of L2E and Nash strategy in RPS game when facing new opponents.
406
+
407
+ Although it is theoretically difficult to analyze the convergence properties of L2E, from the experimental results in Fig. 9, it can be seen that as the training progresses, L2E’s adaptability becomes stronger and stronger. After reaching a certain number of iterations, the improvement eventually reaches a plateau, which provides some empirical evidence for the convergence of L2E.
408
+
409
+ ![](images/dfd855071cd7625c082997c44e325ec3e6150976c1ca3ad88b044c6b93f1333b.jpg)
410
+ Figure 9: The convergence properties of L2E.
411
+
412
+ # H HYPER-PARAMETERS
413
+
414
+ The hyper-parameters of all experiments are shown in the table below.
415
+
416
+ Table 3: Hyper-parameters of L2E.
417
+
418
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Training step size hyper parameters (α,β)</td><td>(0.1,0.01)</td></tr><tr><td>Testing step size hyper parameter y</td><td>0.1</td></tr><tr><td>Number of opponents sampled per batch</td><td>40</td></tr><tr><td>Number of trajectories to sample for each opponent</td><td>20</td></tr><tr><td>Number of gradient steps in the training loop</td><td>1</td></tr><tr><td>Number of gradient steps in the testing loop</td><td>3</td></tr><tr><td>Policy network size(Leduc,BigLeduc,Grid Soccer)</td><td>[64,64,(4,4,5)]</td></tr><tr><td>Number of training steps required for convergence in Leduc</td><td>300</td></tr><tr><td>Number of training steps required for convergence in BigLeduc</td><td>400</td></tr><tr><td>Number of training steps required for convergence in GridSoccer</td><td>300</td></tr><tr><td>Hard-to-exploit opponent training epochs</td><td>20</td></tr><tr><td>Diverse opponent training epochs</td><td>50</td></tr><tr><td>Weight of the MMD term αMMD</td><td>0.8</td></tr><tr><td>Bandwidth of RBF kernel</td><td>1</td></tr><tr><td>Minimum trajectory length N to calculate MMD term</td><td>20</td></tr><tr><td>Number of opponent strategies generated by OSG per round of iteration</td><td>N≤5</td></tr><tr><td>Number of trajectories sampled to compute MMD term</td><td>8</td></tr></table>
md/train/onxoVA9FxMw/onxoVA9FxMw.md ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON POSITION EMBEDDINGS IN BERT
2
+
3
+ Benyou Wang University of Padova wang@dei.unipd.it
4
+
5
+ Lifeng Shang Huawei Noah’s Ark Lab Shang.Lifeng@huawei.com
6
+
7
+ Christina Lioma University of Copenhagen c.lioma@di.ku.dk
8
+
9
+ Xin Jiang Huawei Noah’s Ark Lab Jiang.Xin@huawei.com
10
+
11
+ Hao Yang Huawei Technologies Co., Ltd. yanghao30@huawei.com
12
+
13
+ # Qun Liu
14
+
15
+ Huawei Noah’s Ark Lab qun.liu@huawei.com
16
+
17
+ Jakob Grue Simonsen University of Copenhagen simonsen@di.ku.dk
18
+
19
+ # ABSTRACT
20
+
21
+ Various Position Embeddings (PEs) have been proposed in Transformer based architectures (e.g. BERT) to model word order. These are empirically-driven and perform well, but no formal framework exists to systematically study them. To address this, we present three properties of PEs that capture word distance in vector space: translation invariance, monotonicity, and symmetry. These properties formally capture the behaviour of PEs and allow us to reinterpret sinusoidal PEs in a principled way. Moreover, we propose a new probing test (called ‘identical word probing’) and mathematical indicators to quantitatively detect the general attention patterns with respect to the above properties. An empirical evaluation of seven PEs (and their combinations) for classification (GLUE) and span prediction (SQuAD) shows that: (1) both classification and span prediction benefit from translation invariance and local monotonicity, while symmetry slightly decreases performance; (2) The fully-learnable absolute PE performs better in classification, while relative PEs perform better in span prediction. We contribute the first formal and quantitative analysis of desiderata for PEs, and a principled discussion about their correlation to the performance of typical downstream tasks.
22
+
23
+ # 1 INTRODUCTION
24
+
25
+ Position embeddings (PEs) are crucial in Transformer-based architectures for capturing word order; without them, the representation is bag-of-words. Fully learnable absolute position embeddings (APEs) were first proposed by Gehring et al. (2017) to capture word position in Convolutional Seq2seq architectures. Sinusoidal functions were also used with Transformers to parameterize PEs in a fixed ad hoc way (Vaswani et al., 2017). Recently, Shaw et al. (2018) used relative position embedding (RPEs) with Transformers for machine translation. More recently, in Transformer pretrained language models, BERT (Devlin et al., 2018; Liu et al., 2019) and GPT (Radford et al., 2018) used fully learnable PEs. Yang et al. (2019) modified RPEs and used them in the XLNet pre-trained language model. To our knowledge, the fundamental differences between the various PEs have not been studied in a principled way.
26
+
27
+ We posit that the aim of PEs is to capture the sequential nature of positions in vector space, or technically, to bridge the distances in $\mathbb { N }$ (for positions) and $\mathbb { R } ^ { D }$ (for position vectors). We therefore propose three expected properties for PEs: monotonicity, translation invariance, and symmetry 1. Using these properties, we formally reinterpret existing PEs and show the limitations of sinusoidal
28
+
29
+ PEs (Vaswani et al., 2017): they cannot adaptively meet the monotonicity property – thus we propose learnable sinusoidal PEs.
30
+
31
+ We benchmark $1 3 ~ \mathrm { P E s }$ (including APEs, RPEs, and their combinations) in GLUE and SQuAD, in a total of 11 individual tasks. Several indicators are devised to quantitatively measure translation invariance, monotonicity, and symmetry, which can be further used to calculate their statistical correlations with empirical performance in downstream tasks. We empirically find that both text classification tasks (in GLUE) and span prediction tasks (SQuAD V1.0 and V 2.0) can benefit from monotonicity (in nearby offset) and translation invariance (in particular without considering special tokens like [CLS]), but symmetry decreases performance since it can not deal with directions between query vectors and key vectors when calculating attentions. Plus, models with unbalanced attention regarding directions (generally attending more to preceding tokens than to succeeding tokens) slightly correlate with better performance (especially for span prediction tasks).
32
+
33
+ Experiments also show that the fully-learnable APE performs better in classification, while RPEs perform better in span prediction tasks. This is explained by our proposed properties as follows: RPEs perform better in span prediction tasks since they meet better translation invariance, monotonicity , and asymmetry; the fully-learnable APE which does not strictly have the translation invariance and monotonicity properties during parameterizations (as it also performed worse in measuring translation invariance and local monotonicity than other APEs and all RPEs) still performs well because it can flexibly deal with special tokens (especially, unshiftable [CLS]).
34
+
35
+ Regarding the newly-proposed learnable sinusoidal PEs, the learnable sinusoidal APE satisfies the three properties to a greater extent than other APE variants, and the learnable sinusoidal RPE exhibits better direction awareness than other PE variants. Experiments show that BERT with sinusoidal APEs slightly outperforms the fully-learnable APE in span prediction, but underperforms in classification tasks. Both for APEs and RPEs, learning frequencies in sinusoidal PEs appears to be beneficial. Lastly, sinusoidal PEs can be generalized to treat longer documents because they completely satisfy the translation invariance property, while the fully-learnable APE does not.
36
+
37
+ The contributions of this paper are summarised below: 1) We propose three principled properties for PEs that are either formally examined or empirically evaluated by quantitative indicators in a novel Identical Word Probing test; 2) We benchmark 13 PEs (including APEs, RPEs and their combinations) in GLUE, SQuAD V1.1 and SQuAD V2.0, in a total of 11 individual tasks; 3) we experimentally evaluate how the performance in individual tasks benefits from the above properties; 4) We propose two new PEs to extend sinusoidal PEs to learnable versions for APEs/RPEs.
38
+
39
+ # 2 PROPERTIES OF POSITION EMBEDDINGS
40
+
41
+ Gehring et al. (2017); Vaswani et al. (2017) use absolute word positions as additional features in neural networks. Positions $x \in \mathbb { N }$ are distributively represented as an embedding of $x$ as an element $\vec { x } \in \mathbb R ^ { D }$ in some Euclidean space. By standard methods in representation learning, similarity between embedded objects $\vec { x }$ and $\vec { y }$ is typically expressed by an inner product $\langle \vec { x } , \vec { y } \rangle$ , for instance the dot product gives rise to the usual cosine similarity between $\vec { x }$ and $\vec { y }$ . Generally, if words appear close to each other in a text (i.e., their positions are nearby), they are more likely to determine the (local) semantics together, than if they occurred far apart. Hence, positional proximity of words $x$ and $y$ should result in proximity of their embedded representations $\vec { x }$ and $\vec { y }$ . One common way of formalizing this is that an embedding should preserve the order of distances among positions 2. We denote $\phi ( \cdot , \cdot )$ as a function to calculate closeness/proximity between embedded positions, and any inner product can be a special case of $\phi ( \cdot , \cdot )$ with good properties. We can express preservation of the order of distances as: For every $x , y , z \in \mathbb { N }$ ,
42
+
43
+ $$
44
+ | x - y | > | x - z | \Longrightarrow \phi ( \vec { x } , \vec { y } ) < \phi ( \vec { x } , \vec { z } )
45
+ $$
46
+
47
+ Note that on the underlying space, the property in Eq. (1) has been studied for almost 60 years (Shepard, 1962), in both algorithmics (Bilu & Linial, 2005; Badoiu et al., 2008; Maehara, 2013), and machine learning (Terada $\&$ Luxburg, 2014; Jain et al., 2016) under the name ordinal embedding. As we are interested in the simple case of positions from N, Eq. (1) reduces to the following property:
48
+
49
+ Property 1. Monotonicity: The proximity of embedded positions decreases when positions are further apart:
50
+
51
+ $$
52
+ \forall x , m , n \in \mathbb { N } : m > n \Longleftrightarrow \phi ( { \vec { x } } , { \overrightarrow { x + m } } ) < \phi ( { \vec { x } } , { \overrightarrow { x + n } } )
53
+ $$
54
+
55
+ A priori, a position embedding might treat every element $\mathbb { N }$ individually. However, considering pairs of positions based on their relative proximity (rather than the absolute value of the positions), can lead to simplified and efficient position embeddings (Wang et al., 2020). Such embeddings satisfy translation invariance:
56
+
57
+ Property 2. Translation invariance: The proximity of embedded positions are translation invariant:
58
+
59
+ $$
60
+ \forall x _ { 1 } , \dots , x _ { n } , m \in \mathbb { N } : \phi ( { \overrightarrow { x } } _ { 1 } , { \overrightarrow { x _ { 1 } + m } } ) = \phi ( { \overrightarrow { x } } _ { 2 } , { \overrightarrow { x _ { 2 } + m } } ) = \cdots = \phi ( { \overrightarrow { x } } _ { n } , { \overrightarrow { x _ { n } + m } } )
61
+ $$
62
+
63
+ since the inner product is symmetric, we also consider whether $\phi ( \cdot , \cdot )$ is symmetric:
64
+
65
+ Property 3. Symmetry: The proximity of embedded positions is symmetric,
66
+
67
+ $$
68
+ \forall x , y \in \mathbb { N } : \phi ( { \vec { x } } , { \vec { y } } ) = \phi ( { \vec { y } } , { \vec { x } } )
69
+ $$
70
+
71
+ There is no generally accepted standard set of properties for position embeddings; based on prior work as described above, we posit that the above properties are important, and now examine several existing PEs in relation to these properties, either formally (in Sec. 3) or empirically (in Sec. 4).
72
+
73
+ # 3 UNDERSTANDING PES VIA THE PROPERTIES
74
+
75
+ PEs come in two variants: absolute PEs (APEs) where single positions are mapped to elements of the representation space, and relative PEs (RPEs) where the difference between positions (i.e., $x - y$ for $x , y \in \mathbb { N } ,$ ) is mapped to elements of the embedding space. For Transformer-based architectures, the difference between APEs and RPEs manifests itself in the attention mechanism, in particular how the matrices of query, key, and value weights $W ^ { Q }$ , $W ^ { K }$ , and $W ^ { V }$ are used to calculate attention in each attention head. Consider two positions $x , y \in \mathbb { N }$ , let $\mathrm { W E } _ { x }$ be the word embedding of the word at position $x$ , and let $P _ { x }$ and $P _ { x - y }$ be the embeddings of the position $x$ and relative position $x - y$ , respectively. The query-key-value vector for the word at position $x$ is typically calculated as below for APEs and $\mathrm { R P E s } ^ { 3 }$ respectively:
76
+
77
+ $$
78
+ \mathbf { A P E : } \left[ \begin{array} { l } { Q _ { x } } \\ { K _ { x } } \\ { V _ { x } } \end{array} \right] = \left( \mathbf { W E } _ { x } + P _ { x } \right) \odot \left[ \begin{array} { l } { W ^ { Q } } \\ { W ^ { K } } \\ { W ^ { V } } \end{array} \right] \quad ; \quad \mathbf { R P E : } \left[ \begin{array} { l } { Q _ { x } } \\ { K _ { x } } \\ { V _ { x } } \end{array} \right] = \mathbf { W E } _ { x } \odot \left[ \begin{array} { l } { W ^ { Q } } \\ { W ^ { K } } \\ { W ^ { V } } \end{array} \right] + \left[ \begin{array} { l } { \mathbf { 0 } } \\ { P _ { x - y } } \\ { P _ { x - y } } \end{array} \right]
79
+ $$
80
+
81
+ Observe that while the APEs calculation is linear in $( W ^ { Q } , W ^ { K } , W ^ { V } )$ with the word and position embeddings merged into the coefficient, the RPEs calculation is affine, with the relative position embedding $P _ { x - y }$ acting as an offset independent of the word embedding $\mathrm { W E } _ { x }$ .
82
+
83
+ In Transformers, the resulting representation is a sum of value vectors with weights depending on√ $A = Q K ^ { T }$ , that is, Attention $( \dot { Q } , K , V ) = \operatorname { s o f t m a x } ( Q K ^ { T } / \sqrt { d _ { k } } ) V$ . In the rest of the paper, we examine PEs in the above architecture with respect to the properties introduced in Section 2. In particular, we study four well-known variants of PEs: (1) the fully learnable APE (Gehring et al., 2017), (2) the fixed sinusoidal APE (Vaswani et al., 2017), (3) the fully learnable RPE (Shaw et al., 2018), and (4) the fixed sinusoidal RPE (Wei et al., 2019).
84
+
85
+ # 3.1 UNDERSTANDING SINUSOIDAL PES
86
+
87
+ With a sinusoidal parameterization in PEs, we may use a specific proximity, i.e., an efficient inner product like a dot product, to check if the sinusoidal form of PEs meets the above properties. The dot product between any two position vectors is
88
+
89
+ $$
90
+ A _ { x , y } = \langle { \vec { x } } , { \vec { y } } \rangle = \sin ( { [ \begin{array} { l } { \sin ( \omega _ { 1 } x ) } \\ { \cos ( \omega _ { 1 } x ) } \\ { \cdots } \\ { \sin ( \omega _ { \frac { D } { 2 } } x ) } \\ { \cos ( \omega _ { \frac { D } { 2 } } x ) } \end{array} ] } ) [ { \begin{array} { l } { \sin ( \omega _ { 1 } y ) } \\ { \cos ( \omega _ { 1 } y ) } \\ { \cdots } \\ { \sin ( \omega _ { \frac { D } { 2 } } y ) } \\ { \cos ( \omega _ { \frac { D } { 2 } } y ) } \end{array} } ] ) = \sin ( { [ \begin{array} { l } { \sin ( \omega _ { 1 } x ) \sin ( \omega _ { 1 } y ) } \\ { \cos ( \omega _ { 1 } x ) \cos ( \omega _ { 1 } y ) } \\ { \cdots } \\ { \sin ( \omega _ { \frac { D } { 2 } } x ) \sin ( \omega _ { \frac { D } { 2 } } y ) } \\ { \cos ( \omega _ { \frac { D } { 2 } } x ) \cos ( \omega _ { \frac { D } { 2 } } y ) } \end{array} ] } ) = \sum _ { i = 0 } ^ { \frac { D } { 2 } } \cos ( \omega _ { i } ( x - y ) )
91
+ $$
92
+
93
+ Table 1: Overview of PEs. $P _ { x }$ or $P ( x )$ is the $x$ -th absolute/relative position vector (the latter is parameterized by sinusoidal functions). The newly-proposed PEs in this paper are in bold.
94
+
95
+ <table><tr><td>PEs</td><td>formulation</td><td>parameter scale</td></tr><tr><td>fully learnable APE (Gehring et al.,2017)</td><td>PxERD</td><td>L×D</td></tr><tr><td>fixed sinusoidal APE (Vaswani et al.,2017)</td><td>P(x)=[..,sin(wix),cos(wix),..]T; Wi=(1/10000)2i/D</td><td>0</td></tr><tr><td>learnable sinusoidal APE</td><td>P(x)=[...,sin(wix),cos(ωx)...]T;</td><td>D</td></tr><tr><td>fully learnable RPE</td><td>WiER PxERD</td><td>L×D</td></tr><tr><td>(Shaw et al.,2018) fixed sinusoidal RPE</td><td>P(x)=[.,sin(wix),cos(wix),T;</td><td>0</td></tr><tr><td>(Wei et al.,2019) learnable sinusoidal RPE</td><td>Wi=(1/10000)2i/D P(x)=[...,sin(ωix),cos(wx),...]; WiER</td><td>L</td></tr></table>
96
+
97
+ Note that sinusoidal PEs satisfy both Property 2 (translation invariance) because the inner product is only associated with its position difference $x - y$ , and Property 3 (symmetry), because the dot product itself is symmetric: $\langle \vec { x } , \vec { y } \rangle = \langle \vec { y } , \vec { x } \rangle$ . Note also that checking Property 1 is equivalent to checking monotonicity oits first order derivative $\begin{array} { r } { \psi ( m ) = \sum _ { i = 1 } ^ { D / 2 } \cos ( \omega _ { i } m ) } \end{array}$ $\psi ( m )$ is monotone on intervals wherehange sign, and these intervals $\begin{array} { r } { \psi ^ { \prime } ( m ) = \sum _ { i = 1 } ^ { D / 2 } - \omega _ { i } \sin ( \omega _ { i } m ) } \end{array}$
98
+ depend on the choice of $\omega _ { i }$ . With fixed frequencies $\omega _ { i } = ( 1 / 1 0 0 0 0 ) ^ { 2 i / D }$ , it is monotonous when $m$ is roughly between 0 and 50, indicating that it can only strictly perceive a maximum distance of 50 and it is insensitive to faraway distances (e.g. longer than 50).
99
+
100
+ Although sinusoidal PEs with fixed frequencies (i.e., $\omega _ { i } = ( 1 / 1 0 0 0 0 ) ^ { 2 i / D } )$ are common in APEs and RPEs, we argue that learning these frequencies is useful because it can adaptively adjust intervals of monotonicity (they do not have to be 0-50 as in the fixed sinusoidal APE) 4. With trainable frequencies, we can adaptively allocate a number of frequencies in a data-driven way. App. A.2 explains the expressive power of sinusoidal PEs with trainable frequencies from the perspective of the Fourier series. Extending existing fixed sinusoidal PEs to a learnable version with learnable frequencies gives two variants: a learnable sinusoidal APE and a learnable sinusoidal RPE.
101
+
102
+ # 3.2 UNDERSTANDING RPES
103
+
104
+ RPEs ignore the absolute position of words and directly encode their relative distance. The RPEs expression adheres to the translation invariance property during parameterization, since relative distance with the same offset will be embedded as the same embedding, namely, $P _ { x _ { 1 } - y _ { 1 } } = P _ { x _ { 2 } - y _ { 2 } }$ if $x _ { 1 } - y _ { 1 } = x _ { 2 } - y _ { 2 }$ . Plus, RPEs that separately embed forward and backward relative embeddings, i.e., $P _ { i - j } \neq P _ { j - i }$ , do not meet symmetry during parameterization.
105
+
106
+ Sinusoidal RPEs can also embed neighboring relative position in close vectors with a local monotonicity, similarly to sinusoidal APEs. Note that the dot products between two sinusoidal relative position vectors with the same offset, without distinguishing positive negative relative position vectors, should be identical 5. This makes it hardly perceive of the border between preceding and succeeding relative position vectors.
107
+
108
+ # 4 EXAMINING PE PROPERTIES IN PRE-TRAINED LANGUAGE MODEL
109
+
110
+ We train BERT with six basic PEs as in Tab. 1 and their combination variants, and conduct a probing test to check to which degree they satisfy the properties.
111
+
112
+ Pre-training The pre-trained “BERT-base-uncased” checkpoint (Devlin et al., 2018) is used to train by replacing the original absolute PE module with a new PE variant (including APEs and RPEs). We train the new models with a sequence length of 128 for 5 epochs and then 512 for another 2 epochs. The training is the same as in the original BERT, i.e., BooksCorpus and Wikipedia (16G raw documents) with whole word masking. To be fair, the BERT with the original fully-learnable
113
+
114
+ ![](images/30f1c450bd4b79e222786aa554bae24eb1aa15ffc26cb223cfab23b47e4800e1.jpg)
115
+ Figure 1: Dot products between absolute position vectors 6(top row) and relative position vectors (bottom row). Darker means the two position vectors are closer.
116
+
117
+ APE is also further trained in the same way. All models have about 110M parameters corresponding to a typical base setting, with minor differences solely depending on the parameterization in Tab. 1.
118
+
119
+ # 4.1 DOT PRODUCT BETWEEN POSITION VECTORS
120
+
121
+ APEs We calculate dot products between two arbitrary position vectors for APEs and RPEs (see Fig. 1). For APEs, neighboring position vectors are generally closer compared to faraway ones. This trend is clearer in the learnable sinusoidal APE, which imposes a strict sinusoidal regularization for PEs. Note that additionally adopting RPEs does not affect too much PE patterns, as can be seen by comparing Fig. 1(a) and 1(b), or Fig. 1(c) and 1(d).
122
+
123
+ RPEs In the fully-learnable RPE setting, the vertical and horizontal bright bands in 1(e) and 1(f) show that the relative position vectors for small offsets (e.g., $\{ P _ { - 5 } , \cdot \cdot \cdot , P _ { 0 } , \cdot \cdot \cdot P _ { 5 } \}$ ) are notably different to other relative position vectors; it indicates that the relative position vectors with small offsets are more distinguishable than faraway relative position vectors. The four dark corners in 1(e) and 1(f) means that relative position vectors with longer offset than 20, i.e., from -64 to -20 and from 20 to 64, are very close, showing that the fully-learnable RPE does not significantly distinguish far-distant RPEs. This suggests that truncating RPEs into a fixed distance (e.g. 64 in (Shaw et al., 2018)), is reasonable. This effect is further explained in App. D.
124
+
125
+ # 4.2 IDENTICAL WORD PROBING
126
+
127
+ In APEs, the attention matrix $( A = \operatorname { s o f t m a x } ( Q K ^ { T } ) )$ is related to individual words and their positions, an element of (inactivated) $A$ in the first layer is given by:
128
+
129
+ $$
130
+ \begin{array} { r l } & { a _ { i j } = ( w _ { i } + p _ { i } ) W ^ { Q , 1 } ( ( w _ { j } + p _ { j } ) W ^ { K , 1 } ) ^ { T } } \\ & { \quad = \underbrace { w _ { i } W ^ { Q , 1 } ( W ^ { K , 1 } ) ^ { T } w _ { j } ^ { T } } _ { \mathrm { w o r d - w o r d ~ c o r e s p o n d e n c e } } + \underbrace { w _ { i } W ^ { Q , 1 } ( W ^ { K , 1 } ) ^ { T } p _ { j } ^ { T } } _ { \mathrm { w o r d - p o i n i m ~ c o r r e s p o n d e n c e } } + \underbrace { p _ { i } W ^ { Q , 1 } ( W ^ { K , 1 } ) ^ { T } w _ { j } ^ { T } } _ { \mathrm { w o r d - p o i n i m ~ c o r r e s p o n d e n c e } } + \underbrace { p _ { i } W ^ { Q , 1 } ( W ^ { K , 1 } ) ^ { T } p _ { j } ^ { T } } _ { \mathrm { p o s i t i o n - p o s i t i o n ~ c o r r e s p o n d e n c e } } } \end{array}
131
+ $$
132
+
133
+ Identical word probing for PEs To study the effect of only PEs in $A$ without considering individual words, we use identical word probing: feed many repeated identical words (can be arbitrary,
134
+
135
+ ![](images/747fdde3ec02dea5b0654be29c91d4531195ea03942c0651b42adbabea11b8b6.jpg)
136
+ Figure 2: Identical word probing. Darker in the $i$ -th row and $j$ -th column means that the $i$ -th words generally attend more on the $j$ -th words.
137
+
138
+ denoted as $\bar { w }$ ) as a sentence to BERT to check the attention values $\bar { A } ^ { ( 1 ) }$ , with each element
139
+
140
+ $$
141
+ \bar { a } _ { i j } ^ { 1 } ( \bar { w } ) = ( \bar { w } + p _ { i } ) { W } ^ { Q , 1 } ( ( \bar { w } + p _ { j } ) { W } ^ { K , 1 } ) ^ { T }
142
+ $$
143
+
144
+ As we take an average of $\bar { A } ^ { ( 1 ) }$ over many randomly-selected words $\bar { w }$ , the general patterns of $\bar { A } ^ { ( 1 ) }$ will not be affected by any particular word. Namely, $\bar { A } ^ { ( 1 ) }$ is word-free and only related to learned PEs. Thus, $\bar { A } ^ { ( 1 ) }$ can be treated as a general attention bias and can also implicitly convey positionwise proximity in Transformers. Note that the probing test could also be applied to RPEs.
145
+
146
+ # 4.2.1 QUALITATIVE ANALYSIS
147
+
148
+ Fig. 2 shows the average attention weights among all heads in the first layer. BERT without $P E$ nearly treats all words uniformly (bag-of-words). Almost all APEs and RPEs have a clear pattern of translation invariance, local monotonicity in a neighboring window, and symmetry. Note that this is nontrivial since no specific constraints or priors were imposed on fully-learnable APEs/RPEs 7.
149
+
150
+ BERT with APEs does not show any direction awareness since Fig. 2(b) and 2(c) are nearly symmetrical. As seen from Fig. 2(f,h), BERT with learnable sinusoidal $R P E$ generally attends more on forward tokens than backward tokens, which cannot be clearly found in fully-learnable RPE and fixed sinusoidal RPE. Interestingly, the white bands along the diagonal in Fig. 2 (d, f, g) suggest that some words generally do not attend to themselves, as previously observed in (Clark et al., 2019) 8 .
151
+
152
+ # 4.2.2 QUANTITATIVE ANALYSIS
153
+
154
+ Using the activated attention values $\bar { A } ^ { ( 1 ) }$ in Eq. $8 ^ { 9 }$ we adopt three quantitative indicators to measure to which extent BERT models with individual PEs satisfy the three properties and their derivative indicators (see App. B for details of calculating these indicators) in Tab. 2. Basically, all APEs and RPEs satisfy monotonicity in small offsets and translation invariance compared to BERT without $P E$ ; All PEs nearly satisfy symmetry except for the learnable sinusoidal RPE and its combinations.
155
+
156
+ APEs and RPEs The learnable sinusoidal APE better satisfies all three properties than fully learnable APE and fixed sinusoidal APE; this is due to its sinusoidal parameterization and flexible frequencies. RPEs satisfy translation invariance to a higher degree than APEs, because they directly
157
+
158
+ Table 2: Quantitative measurement of the properties (monotonicity, translation invariance, symmetry, and direction balance 10). For these property indicators, the smaller the number, the better the property is met. 0 denotes that the property is ideally satisfied. Direction balance denotes the ratio between the sum of attention values for forward attending and backward attending. 1 means it is fully-balanced in directions. We have indicated the numbers that most closely correspond to satisfaction properties and direction balance for each group in bold.
159
+
160
+ <table><tr><td rowspan="2">PEs</td><td colspan="2">monotonicity</td><td colspan="2">translation invariance</td><td rowspan="2">symmetry</td><td rowspan="2">direction balance</td></tr><tr><td>all offsets</td><td>first 20 offsets</td><td>w/[CLS]</td><td>w/o[CLS]</td></tr><tr><td>BERT without PE</td><td>0.5430</td><td>0.1393</td><td>0.9497</td><td>0.9939</td><td>0.0005</td><td>1.0136</td></tr><tr><td>BERT-style APE</td><td>0.2461</td><td>0.0208</td><td>0.5030</td><td>0.0143</td><td>0.0012</td><td>1.1940</td></tr><tr><td>fixed sin. APE</td><td>0.1937</td><td>0.0190</td><td>0.2552</td><td>0.2143</td><td>0.0010</td><td>1.0266</td></tr><tr><td>learnable sin. APE</td><td>0.1936</td><td>0.0237</td><td>0.0653</td><td>0.0378</td><td>0.0004</td><td>1.0281</td></tr><tr><td>fully-learnable RPE</td><td>0.1576</td><td>0.0048</td><td>0.1178</td><td>0.0007</td><td>0.0007</td><td>1.1930</td></tr><tr><td>fixed sin. RPE</td><td>0.1273</td><td>0.0054</td><td>0.0924</td><td>0.0020</td><td>0.0007</td><td>1.1565</td></tr><tr><td>learnable sin. RPE</td><td>0.3157</td><td>0.0057</td><td>0.1397</td><td>0.0038</td><td>0.0014</td><td>1.3223</td></tr><tr><td>BERT-style APE + fully-learnable RPE</td><td>0.1993</td><td>0.0071</td><td>0.2601</td><td>0.0059</td><td>0.0009</td><td>1.1971</td></tr><tr><td>BERT-style APE + fixed sin. RPE</td><td>0.1579</td><td>0.0143</td><td>0.1376</td><td>0.0072</td><td>0.0007</td><td>1.1302</td></tr><tr><td>BERT-style APE+ learnable sin. RPE</td><td>0.2364</td><td>0.0158</td><td>0.2334</td><td>0.0088</td><td>0.0014</td><td>1.3804</td></tr><tr><td>learnablesin.APE + fully-learnable RPE</td><td>0.1248</td><td>0.0065</td><td>0.0487</td><td>0.0238</td><td>0.0007</td><td>1.1196</td></tr><tr><td>learnable sin. APE + fixed sin. RPE</td><td>0.0746</td><td>0.0040</td><td>0.0243</td><td>0.0168</td><td>0.0007</td><td>1.0773</td></tr><tr><td>learnable sin. APE + learnable sin. RPE</td><td>0.1796</td><td>0.0052</td><td>0.0399</td><td>0.0252</td><td>0.0027</td><td>1.6722</td></tr></table>
161
+
162
+ satisfy translation invariance during parameterization. In the last column, direction balance values of all PEs except for the fixed sin. APE are larger than one, which indicates that BERT models with all PEs generally attend more to preceding tokens than succeeding tokens, and this phenomenon appears to be stronger in learnable sinusoidal RPEs than others.
163
+
164
+ The fully learnable APE and [CLS] Fully learnable APE generally performs worse in translation invariance (see the 4-th column) as it has to deal with the unshiftable [CLS] which is always in the first position. Without considering [CLS] and [SEP] (see the 5-th column), the fully learnable $A P E$ satisfies translation invariance better than other APEs, showing that the fully learnable $A P E$ can flexibly deal with both special tokens and normal positions. The fully learnable APE also could handle the mismatch between special tokens and normal positions in the monotonicity property.
165
+
166
+ # 5 PES IN DOWNSTREAM TASKS
167
+
168
+ We empirically compare the performance of PEs in classification and span prediction tasks.
169
+
170
+ Fine-tuning The fine-tuning on GLUE and SQuAD is the same as in the Huggingface website as per Wolf et al. (2019), see App. E for details. We report the average values of five runs per dataset. For classification, we use the GLUE (Wang et al., 2018) benchmark, which includes datasets for both single document classification and sentence pair classification. For span prediction, we use the SQuAD V1.1 and V2.0 datasets consisting of $1 0 0 \mathrm { k }$ crowdsourced question/answer pairs (Rajpurkar et al., 2016). Given a question and a passage from Wikipedia containing the answer, the task is to predict the answer text span in the passage. In V2.0, it is possible that no short answer exists in the passage since it additionally has 50,000 unanswerable questions written adversarially by crowdworkers (Rajpurkar et al., 2018).
171
+
172
+ # 5.1 EXPERIMENTAL RESULTS FOR DOWNSTREAM TASKS
173
+
174
+ GLUE Tab. 3 shows that the fully-learnable APE (a.k.a, BERT-style APE) performs well in GLUE. No PE variants, especially BERT with solely APEs or RPEs, notably outperform the fullylearnable APE. BRRT models with a combination of an APE and an RPE do not always boost the performance of the model with solely the APE or RPE.
175
+
176
+ SQuAD Tab. 4 shows that nearly all BERT models with RPEs significantly outperform the fully learnable APE. The learnable sinusoidal APE is slightly better than the fully learnable $A P E$ in most cases. Both the best-performed models in SQuAD V1.1 and V2.0 adopt the fully-learnable RPE.
177
+
178
+ Table 3: Experiments on GLUE. The evaluation metrics are following the official GLUE benchmark (Wang et al., 2018). The best performance of each task is bold.
179
+
180
+ <table><tr><td rowspan="3">PEs</td><td colspan="10">single sentence</td></tr><tr><td>CoLA</td><td>SST-2</td><td>MNLI</td><td>MRPC</td><td>QNLI</td><td>QQP</td><td>sentence pair RTE</td><td>STS-B</td><td>WNLI</td><td></td></tr><tr><td>acc</td><td>acc</td><td>acc</td><td>F1</td><td>acc</td><td>F1</td><td>acc</td><td>spear. cor.</td><td>acc</td><td>mean ± std</td></tr><tr><td>BERT without PE</td><td>39.0</td><td>86.5</td><td>80.1</td><td>86.2</td><td>83.7</td><td>86.5</td><td>63.0</td><td>87.4</td><td>33.8</td><td>76.6 ± 0.41</td></tr><tr><td>fullylearnable (BERT-style) APE</td><td>60.2</td><td>93.0</td><td>84.8</td><td>89.4</td><td>88.7</td><td>87.8</td><td>65.1</td><td>88.6</td><td>37.5</td><td>82.2±0.30</td></tr><tr><td>fixed sin. APE</td><td>57.1</td><td>92.6</td><td>84.3</td><td>89.0</td><td>88.1</td><td>87.5</td><td>58.4</td><td>86.9</td><td>45.1</td><td>80.5±0.71</td></tr><tr><td>learnable sin. APE</td><td>56.0</td><td>92.8</td><td>84.8</td><td>88.7</td><td>88.5</td><td>87.7</td><td>59.1</td><td>87.0</td><td>40.8</td><td>80.6±0.29</td></tr><tr><td>fully-learnable RPE</td><td>58.9</td><td>92.6</td><td>84.9</td><td>90.5</td><td>88.9</td><td>88.1</td><td>60.8</td><td>88.6</td><td>50.4</td><td>81.7±0.31</td></tr><tr><td>fixed sin. RPE</td><td>60.4</td><td>92.2</td><td>84.8</td><td>89.5</td><td>88.8</td><td>88.0</td><td>62.9</td><td>88.1</td><td>45.1</td><td>81.8±0.53</td></tr><tr><td>learnable sin. RPE</td><td>60.3</td><td>92.6</td><td>85.2</td><td>90.3</td><td>89.1</td><td>88.1</td><td>63.5</td><td>88.3</td><td>49.9</td><td>82.2±0.40</td></tr><tr><td>fully learnable APE + fully-learnable RPE</td><td>59.8</td><td>92.8</td><td>85.1</td><td>89.6</td><td>88.6</td><td>87.8</td><td>62.5</td><td>88.3</td><td>51.5</td><td>81.8±0.17</td></tr><tr><td>fully learnable APE + fixed sin. RPE</td><td>59.2</td><td>92.4</td><td>84.8</td><td>89.9</td><td>88.8</td><td>87.9</td><td>61.0</td><td>88.3</td><td>48.2</td><td>81.5±0.20</td></tr><tr><td>fully learnable APE+ learnable sin. RPE</td><td>61.1</td><td>92.8</td><td>85.2</td><td>90.5</td><td>89.5</td><td>87.9</td><td>65.1</td><td>88.2</td><td>49.6</td><td>82.5±0.44</td></tr><tr><td>learnable sin. APE + fully-learnable RPE</td><td>57.2</td><td>92.7</td><td>84.8</td><td>88.9</td><td>88.5</td><td>87.8</td><td>58.6</td><td>88.0</td><td>51.3</td><td>80.8±0.44</td></tr><tr><td>learnable sin. APE + fixed sin. RPE</td><td>57.6</td><td>92.6</td><td>84.5</td><td>88.8</td><td>88.6</td><td>87.6</td><td>63.1</td><td>87.4</td><td>48.7</td><td>81.3±0.43</td></tr><tr><td>learnable sin. APE + learnable sin. RPE</td><td>57.7</td><td>92.7</td><td>85.0</td><td>89.6</td><td>88.7</td><td>87.8</td><td>62.3</td><td>87.5</td><td>50.1</td><td>81.4±0.33</td></tr></table>
181
+
182
+ Table 4: Performance (average and standard deviation in 5 runs) on dev of SQuAD V1.1 and V2.0. † indicates stat. significance over fully learnable APEs using a two-sided test with $p$ -value 0.05.
183
+
184
+ <table><tr><td rowspan="2">PEs</td><td colspan="2">SQuAD V1.1</td><td colspan="2">SQuAD V2.0</td></tr><tr><td>F1</td><td>EM</td><td>F1</td><td>EM</td></tr><tr><td>BERT without PE</td><td>36.47 ± 0.19</td><td>24.24 ± 0.33</td><td>50.48 ± 0.12</td><td>49.30 ± 0.14</td></tr><tr><td>fully learnable (BERT-style) APE</td><td>89.44±0.08</td><td>81.92 ± 0.11</td><td>76.43±0.63</td><td>73.07±0.63</td></tr><tr><td>fixed sin. APE</td><td>89.45 ± 0.07</td><td>81.93 ± 0.11</td><td>76.12 ± 0.48</td><td>72.75± 0.55</td></tr><tr><td>learmable sin. APE</td><td>89.65† ±0.11</td><td>82.24† ± 0.17</td><td>77.24 ± 0.43</td><td>73.93 ± 0.44</td></tr><tr><td>fully-learnable RPE</td><td>90.50† ±0.08</td><td>83.38 † ± 0.11</td><td>79.85† ± 0.27</td><td>76.68† ± 0.49</td></tr><tr><td>fixed sin. RPE</td><td>90.30† ± 0.07</td><td>83.24†±0.08</td><td>78.76† ±0.29</td><td>75.38† ±0.28</td></tr><tr><td>learnable sin. RPE</td><td>90.45† ± 0.11</td><td>83.49 †± 0.14</td><td>79.40† ± 0.37</td><td>76.14† ±0.33</td></tr><tr><td>fully learnable APE + fully-learnable RPE</td><td>90.57†±0.04</td><td>83.45±0.10</td><td>80.31±0.10</td><td>76.94†±0.20</td></tr><tr><td>fully learnable APE + fixed sin. RPE</td><td>90.24† ± 0.17</td><td>83.06†±0.21</td><td>78.74† ±0.50</td><td>75.40† ± 0.52</td></tr><tr><td>fully learnable APE+ learnable sin. RPE</td><td>89.56 ± 0.28</td><td>82.26†±0.30</td><td>77.82† ±0.42</td><td>74.51† ±0.39</td></tr><tr><td>learnable sin. APE + fully-learnable RPE</td><td>90.72† ±0.13</td><td>83.68†±0.27</td><td>80.24†±0.35</td><td>76.98†±0.34</td></tr><tr><td>learnable sin. APE+ fixed sin. RPE</td><td>90.36† ±0.08</td><td>83.25†±0.10</td><td>78.81† ± 0.33</td><td>75.71† ± 0.28</td></tr><tr><td>learnable sin. APE + learnable sin. RPE</td><td>90.49† ± 0.14</td><td>83.59†±0.14</td><td>79.93† ±0.34</td><td>76.69† ± 0.39</td></tr></table>
185
+
186
+ As demonstrated in Tab. 2, the fully learnable APE can flexibly deal with [CLS] and translation invariance in normal positions, thus it performs well in classification tasks (GLUE) which heavily relies on the unshiftable [CLS] token for inference. Span prediction tasks which do not infer from [CLS] can benefit from strict translation invariance during parameterization (e.g., sinusoidal APEs and RPEs), see Tab. 5 in Sec. 6.1 for the correlations between performance of SQuAD and the translation invariance property. Removing PEs (BERT without PE) dramatically decreases performance in SQuAD V1.1 and V2.0, and slightly harms performance on GLUE, showing that PEs are more important in SQuAD than GLUE.
187
+
188
+ Learnable sinusoidal PEs The sinusoidal APEs outperform fully-learnable APE in span prediction but underperform it in classification tasks. The learnable sinusoidal APE/RPE outperforms fixed sinusoidal APE/RPE in GLUE and SQuADs, showing the expressive power of flexible frequencies.
189
+
190
+ Complementarity of APEs and RPEs In SQuAD, jointly adopting APEs and RPEs can slightly boost performance in some cases. For instance, BERT with learnable sinusoidal $A P E + A P E + f u l l y$ $R P E$ achieves the best EM score in both SQuADs. However, this complementary effect is relatively weaker in GLUE, where the fully-learnable APE performs strongly.
191
+
192
+ # 6 DISCUSSIONS ON PES
193
+
194
+ # .1 HOW DO THE PROPERTIES CORRELATE TO INDIVIDUAL TASKS?
195
+
196
+ We conduct a correlation analysis between the properties and the performance on individual tasks 11, as shown in Tab. 5. The results show that violating monotonicity in relatively-small offsets (e.g., 20) and translation invariance is harmful since it is negatively correlated to the performance on
197
+
198
+ Table 5: Pearson correlations between the properties and evaluated tasks, evaluating on BERT models with 13 position embeddings. The positive (negative) numbers denote to which degree the performance of the task positively (negatively) correlate(s) to violating the property. This shows that violating local monotonicity and translation invariance is harmful, while violating symmetry (and direction-balance) is beneficial. Best correlation values are in bold for each row.
199
+
200
+ <table><tr><td colspan="2">Properties</td><td>CoLA</td><td>SST-2</td><td>MNLI</td><td>QQP</td><td>GLUE</td><td>SQuAD V1.1</td><td>SQuAD V2.0</td></tr><tr><td rowspan="2">monotonicity</td><td>all offsets</td><td>0.44</td><td>0.43</td><td>0.56</td><td>0.32</td><td>0.48</td><td>-0.31</td><td>-0.27</td></tr><tr><td>first 20 offsets</td><td>-0.18</td><td>0.44</td><td>-0.24</td><td>-0.42</td><td>-0.21</td><td>-0.91</td><td>-0.86</td></tr><tr><td rowspan="2">translation invariance</td><td>w/[CLS]/[SEP]</td><td>0.48</td><td>0.52</td><td>0.04</td><td>-0.07</td><td>0.42</td><td>-0.63</td><td>-0.57</td></tr><tr><td>w/o[CLS]/[SEP]</td><td>-0.47</td><td>0.01</td><td>-0.69</td><td>-0.68</td><td>-0.61</td><td>-0.51</td><td>-0.58</td></tr><tr><td colspan="2">symmetry</td><td>0.17</td><td>0.24</td><td>0.40</td><td>0.09</td><td>0.31</td><td>0.15</td><td>0.16</td></tr><tr><td colspan="2">direction balance</td><td>0.32</td><td>0.16</td><td>0.63</td><td>0.35</td><td>0.48</td><td>0.32</td><td>0.37</td></tr></table>
201
+
202
+ GLUE and SQuAD. However, violating symmetry (and direction-balance) is slightly beneficial. This shows that many tasks require BERT models to distinguish preceding and succeeding tokens, especially to attend more on preceding tokens. See Fig. 5b in App. C, the correlations between the direction balance indicators and the performance of downstream tasks will be much higher when only considering a few neighboring tokens for calculating the indicator.
203
+
204
+ # 6.2 MORE DISCUSSIONS ON THE PROPOSED PROPERTIES
205
+
206
+ Monotonicity Monotonicity holds locally in a small neighboring window (usually in 5-20 offsets) for all PE variants, see Fig.2. This shows that BERT models generally are not sensitive to longerdistance attendance patterns, also evidenced by the fact that performance in downstream tasks correlates more highly with monotonicity in middle-distance offsets (e.g., 20 in the second row of Tab. 5) than longer offsets (see App. C). To check monotonicity guided by learned frequencies of learnable sinusoidal APEs in individual tasks, see App. A.3
207
+
208
+ Translation invariance In BERT, we argue that absolute positions of words are uninformative since (1) absolute positions of the second segment depend on the length of the first sentence; (2) words are randomly truncated in the beginning or end if a sentence exceeds the expected maximum length, which may shift absolute positions of all tokens with an unexpected offset (Devlin et al., 2018). That is, absolute positions of words in pre-trained language models are arbitrarily replaceable, and thus adopting translation invariance is generally reasonable. Models with strict Translation invariance (all RPEs and sinusoidal APEs) naturally make PEs generalize to longer documents than the documents used in the pre-training phase, see App. F for some empirical evidence.
209
+
210
+ Symmetry APEs (especially sinusoidal APEs) express symmetry patterns without distinguishing the direction as shown in Fig 2. As seen from Eq. 7, it is nontrivial to model directions in two linearly-transformed query vectors and key vectors. This limits its performance in direction-sensitive downstream tasks. RPEs could behave better on direction perception, since forward and backward relative embeddings are separately embedded (see Tab. 1); Especially, learnable sinusoidal RPE or combination variants including it have more unbalanced attending patterns (see the last column in Tab. 2), as shown in Fig. 2 (f) and (h),
211
+
212
+ # 7 CONCLUSION
213
+
214
+ To theoretically and empirically understand position embeddings (PEs), we have defined three properties (translation invariance, monotonicity, and symmetry) inspired by distance mappings between the original domain of positions in $\mathbb { N }$ and their PEs in $\dot { \mathbb { R } } ^ { D }$ . A probing test has been proposed to quantitatively examine these properties using appropriate mathematical indicators. Our probing test has shown that these PEs nearly satisfy most properties even when they are fully-learnable without constraints. Experimental results have shown that violating local monotonicity and translation invariance decreases performance in downstream tasks (classification and span prediction tasks), and that violating symmetry benefits downstream tasks because of direction awareness. We also find that the fully-learnable absolute PE in general results in better performance for classification, and that relative PEs result in better performance for span prediction tasks, which can be explained by the connections between their properties and task characteristics.
215
+
216
+ # ACKNOWLEDGMENTS
217
+
218
+ The work is supported by the Quantum Access and Retrieval Theory (QUARTZ) project, which has received funding from the European Union‘s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 721321.
219
+
220
+ # REFERENCES
221
+
222
+ George B Arfken and Hans J Weber. Mathematical methods for physicists, 1999.
223
+
224
+ Mihai Badoiu, Erik D. Demaine, MohammadTaghi Hajiaghayi, Anastasios Sidiropoulos, and Morteza Zadimoghaddam. Ordinal embedding: Approximation algorithms and dimensionality reduction. In Ashish Goel, Klaus Jansen, Jose D. P. Rolim, and Ronitt Rubinfeld (eds.), ´ Approximation, Randomization and Combinatorial Optimization. Algorithms and Techniques, 11th International Workshop, APPROX 2008, and 12th International Workshop, RANDOM 2008, volume 5171 of Lecture Notes in Computer Science, pp. 21–34. Springer, 2008.
225
+
226
+ Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
227
+
228
+ Yonatan Bilu and Nathan Linial. Monotone maps, sphericity and bounded second eigenvalue. J. Comb. Theory, Ser. B, 95(2):283–299, 2005.
229
+
230
+ Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D Manning. What does bert look at? an analysis of bert’s attention. arXiv preprint arXiv:1906.04341, 2019.
231
+
232
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
233
+
234
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
235
+
236
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017.
237
+
238
+ Lalit Jain, Kevin G. Jamieson, and Robert D. Nowak. Finite sample prediction and recovery bounds for ordinal embedding. In Daniel D. Lee, Masashi Sugiyama, Ulrike von Luxburg, Isabelle Guyon, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems, pp. 2703–2711, 2016.
239
+
240
+ Guolin Ke, Di He, and Tie-Yan Liu. Rethinking positional encoding in language pre-training. arXiv preprint arXiv:2006.15595, 2020.
241
+
242
+ Xuanqing Liu, Hsiang-Fu Yu, Inderjit Dhillon, and Cho-Jui Hsieh. Learning to encode position for transformer with continuous dynamical model. arXiv preprint arXiv:2003.09229, 2020.
243
+
244
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
245
+
246
+ Hiroshi Maehara. Euclidean embeddings of finite metric spaces. Discrete Mathematics, 313(23): 2848 – 2856, 2013.
247
+
248
+ Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. arXiv preprint arXiv:1806.00187, 2018.
249
+
250
+ 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.
251
+
252
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training, 2018.
253
+
254
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
255
+ 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. arXiv preprint arXiv:1910.10683, 2019.
256
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
257
+ Pranav Rajpurkar, Robin Jia, and Percy Liang. Know what you don’t know: Unanswerable questions for squad. arXiv preprint arXiv:1806.03822, 2018.
258
+ Anna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in bertology: What we know about how bert works. arXiv preprint arXiv:2002.12327, 2020.
259
+ Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155, 2018.
260
+ Roger N Shepard. The analysis of proximities: Multidimensional scaling with an unknown distance function. Psychometrika, 27(2):125–140, 1962.
261
+ Yoshikazu Terada and Ulrike Luxburg. Local ordinal embedding. volume 32 of Proceedings of Machine Learning Research, pp. 847–855. PMLR, 2014.
262
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
263
+ Jesse Vig. A multiscale visualization of attention in the transformer model. arXiv preprint arXiv:1906.05714, 2019.
264
+ 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. arXiv preprint arXiv:1804.07461, 2018.
265
+ Benyou Wang, Donghao Zhao, Christina Lioma, Qiuchi Li, Peng Zhang, and Jakob Grue Simonsen. Encoding word order in complex embeddings. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
266
+ Xing Wang, Zhaopeng Tu, Longyue Wang, and Shuming Shi. Self-attention with structural position representations. arXiv preprint arXiv:1909.00383, 2019.
267
+ Yu-An Wang and Yun-Nung Chen. What do position embeddings learn? an empirical study of pretrained language model positional encoding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6840–6849, 2020.
268
+ Junqiu Wei, Xiaozhe Ren, Xiaoguang Li, Wenyong Huang, Yi Liao, Yasheng Wang, Jiashu Lin, Xin Jiang, Xiao Chen, and Qun Liu. Nezha: Neural contextualized representation for chinese language understanding. arXiv preprint arXiv:1909.00204, 2019.
269
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick ´ von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Huggingface’s transformers: Stateof-the-art natural language processing. ArXiv, abs/1910.03771, 2019.
270
+ Da Xu, Chuanwei Ruan, Evren Korpeoglu, Sushant Kumar, and Kannan Achan. Self-attention with functional time representation learning. In Advances in Neural Information Processing Systems, pp. 15915–15925, 2019.
271
+ Hang Yan, Bocao Deng, Xiaonan Li, and Xipeng Qiu. Tener: Adapting transformer encoder for name entity recognition. arXiv preprint arXiv:1911.04474, 2019.
272
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5753–5763, 2019.
273
+
274
+ # A UNDERSTANDING FREQUENCIES
275
+
276
+ # A.1 UNDERSTAND INDIVIDUAL FREQUENCIES
277
+
278
+ We argue in this paper that a learning schema for such frequencies will be useful in a sense it could adaptively adjust frequencies to meet different functions, see Fig. 3.
279
+
280
+ ![](images/0b3a5940412c876da733b7aeffffb2a457d72135726ac2f10aa0987f3ae53eed.jpg)
281
+ (1/10000)2i/D.
282
+ Figure 3: $\phi ( m )$ in (b) is a sum of many cosine functions of individual frequencies with increasing $m$ , which determines the closeness between arbitrary two $m$ -distance position vectors. As shown in (a), each frequency could play different roles: 1) the extremely small frequencies have few effects on the overall word representation $( \mathrm { W E } _ { x } + P _ { x } )$ in Eq. 5 since it makes such position embedding being almost identical with increasing positions; 2) some smaller frequencies can be beneficial to guarantee Property 1 if $\omega _ { i } < \frac { \pi } { L }$ ; 3) some bigger frequencies would promote the locally attending mechanism since such cos functions in Eq. 6 drop dramatically in the beginning if 4) Some big frequencies which $\omega _ { i } > \Pi$ would be smooth factors for the overall pattern since it would be randomly impose a bias to all positions.
283
+
284
+ # A.2 EXPRESSIVE POWER OF LEARNABLE SINUSOIDAL PES
285
+
286
+ In Transformers, linear transformation is commonly-used, for example query, key, and value transformations on word representations. Let $\mathbf { \nabla } _ { \mathbf { r } _ { i } }$ be the word representation paramertezied by the sum of word embeddings and position embeddings (like the learnable sinusoidal APEs). Then, each element in $\mathbf { \nabla } _ { \mathbf { r } _ { i } }$
287
+
288
+ $$
289
+ r _ { i , k } ( t ) = e _ { i , k } + p _ { k } ( t ) = \left\{ \begin{array} { l l } { e _ { i , k } + \sin ( \omega _ { \frac { k } { 2 } } t ) , } & { \mathrm { ~ i f ~ } k \mathrm { ~ i s ~ e v e n } } \\ { e _ { i , k } + \cos ( \omega _ { \frac { k - 1 } { 2 } } t ) , } & { \mathrm { ~ i f ~ } k \mathrm { ~ i s ~ o d d } } \end{array} \right.
290
+ $$
291
+
292
+ After a linear transformation parameterized by $\textbf { \em w }$ (e.g., the key transformation $W ^ { K }$ in the first Transformer layer), $\mathbf { \nabla } _ { \mathbf { r } _ { i } }$ is linearly transformed as $h _ { i } ( t ) = w r _ { i }$ ${ \bf \mathit { h } } _ { i } ( t )$ can be one of query/key/value vectors $Q _ { x } , K _ { x } , V _ { x }$ in $t$ -th position) with each element
293
+
294
+ $$
295
+ h _ { i , k } ( t ) = \sum _ { k = 1 } ^ { D } w _ { j , k } e _ { i , k } + \sum _ { k = 1 } ^ { D / 2 } \left( w _ { j , 2 k } \sin ( \omega _ { 2 k } t ) + w _ { j , 2 k + 1 } \cos ( \omega _ { 2 k + 1 } t ) \right)
296
+ $$
297
+
298
+ The RHS is a typical Fourier series with a base term $\sum w _ { j , k } e _ { i , k }$ and Fourier coefficients $\{ w _ { j , 2 k } , w _ { j , 2 k + 1 } \}$ . It is customarily assumed in physics and signal processing (Arfken & Weber, 1999) that the RHS in Eq. 10 with infinite $D$ and appropriate frequencies could approximate any continuous function on a given interval.
299
+
300
+ As using an infinite $D$ is not practical, dynamic allocation of a limited number of frequencies in a data-driven way could be beneficial for general approximation. The predefined frequencies $\omega _ { i } =$
301
+
302
+ ![](images/7334700f599f79b8e986ef4d19738410785967f0cba1303a156678f6ccb2028b.jpg)
303
+ (a) The learned frequencies of pre-trained BERT and (b) Dot products between two absolute positions with fine-tuned BERT in different downstream tasks. The increasing offset, indicates neighboring APES are empredefined frequencies in (Vaswani et al., 2017) (i.e., bedded together. $_ x$ axe refers to offset between posi$\bar { \omega } _ { i } = ( 1 / 1 0 0 0 0 ) ^ { 2 i / D } ~ \cdot$ ) is denoted as ‘default’ tions.
304
+
305
+ Figure 4: The learned frequencies in learnable sinusoidal $A P E$ in the pre-trained language model and downstream tasks
306
+
307
+ $( 1 / 1 0 0 0 0 ) ^ { 2 i / D }$ in the Transformer (Vaswani et al., 2017) can be considered as a special case when it enumerates various frequencies ranging from $1 / 1 0 0 0 0$ to 1 under a specific distribution.
308
+
309
+ # A.3 LEARNED FREQUENCIES OF LEARNABLE SINUSOIDAL APE
310
+
311
+ The learned frequencies are shown in Fig. 4a. Observe that the learned frequencies are generally smaller than the pre-defined ones from (Vaswani et al., 2017) (i.e., $\omega _ { i } = \bar { ( 1 / 1 0 0 0 0 ) ^ { 2 i / D } } )$ . The learned frequencies are close to the learned one since we use $\omega _ { i } = ( 1 / 1 0 0 0 0 ) ^ { 2 i / D }$ as initialization.
312
+
313
+ As shown in Fig. 4b, the patterns of dot products between positions for learnable frequencies are quite different to the predefined ones (denoted as ‘default’ in the figure); indeed, the former appears more predisposed to deeming remote positions similar. Moreover, fine-tuned models for span prediction tasks (including SQuAD and SQuAD2) satisfy strict monotonicity in larger windows than for classification tasks. Observe also that the patterns in pre-training language models seem more similar to those in classification tasks than span prediction tasks.
314
+
315
+ # B QUANTITATIVELY MEASURING THE PROPERTIES.
316
+
317
+ To quantitatively measure the primary properties we treat in this paper, we propose multiple criteria, described below.
318
+
319
+ Assume a position-wise attention matrix $\bar { A } ^ { ( 1 ) }$ (denoted as $A$ since there is no risk for confusion), in which each element is the (softmax) activated attention value from the $i$ -th query token to $j$ -th key token (all elements are positive).
320
+
321
+ Average In-group Variance (AIV) for translation invariance Let $l$ be an offset between two positions; we denote by $\tau ( l )$ the set of $l$ -offset attention values $\{ A _ { i , j } , j - i = l \}$ ; for example, $\tau ( 1 ) = \{ A _ { 1 , 2 } , A _ { 2 , 3 } , \cdot \cdot \cdot , A _ { L - 1 , L } \}$ . Translation invariance requires that all elements in each group $\tau ( l )$ should be identical, the smaller variance each $\tau ( l )$ has, it is closer to translation invariance. The Average In-group Variance (AIV) is defined as a weighted average over in-group variances of all $\{ \tau ( l ) \} _ { - L + 1 } ^ { L - 1 }$ , namely:
322
+
323
+ $$
324
+ \operatorname { A I V } ( A ) = { \frac { \sum _ { l = - L + 1 } ^ { L - 1 } \operatorname { v a r } \left( \tau ( l ) \right) \cdot | \tau ( l ) | } { \sum _ { l = - L + 1 } ^ { L - 1 } | \tau ( l ) | } }
325
+ $$
326
+
327
+ where $| \cdot |$ is the number of elements in the set. For normalization, this metric is further divided by the overall variance (i.e., $\operatorname { v a r } ( A ) )$ ).
328
+
329
+ Ordered Pair Ratio (OPR) for monotonicity For a word in $i$ -th position, based on the increasing distance to the $i$ -th position, there a forward attention sequence $S _ { i , + } = \{ A _ { i , i } , A _ { i , i + 1 } , \cdot \cdot \cdot , A _ { i , L } \}$ and a backward attention sequence $S _ { i , - } = \{ A _ { i , i } , A _ { i , i - 1 } , \cdot \cdot \cdot , A _ { i , 1 } \}$ . This results in $2 L$ sequences denoted as $\mathbb { S } = \{ S _ { 1 , + } , S _ { 1 , - } , S _ { 2 , + } , S _ { 2 , - } , \ldots , S _ { L , + } , S _ { L , - } \}$ . The ideal (decreasing) monotonicity requires that each $S$ (an element in $\mathbb { S }$ ) is totally ordered as $s _ { 0 } > s _ { 1 } > \cdot \cdot \cdot > s _ { L - 1 }$ . We define the Ordered Ratio of $S$ by:
330
+
331
+ $$
332
+ \mathrm { O P R } ( S ) = \frac { \sum _ { s _ { j } , s _ { i } \in S , i \neq j } \mathrm { s i g n } \left( ( s _ { i } - s _ { j } ) ( i - j ) \right) } { | S | ^ { 2 } - | S | }
333
+ $$
334
+
335
+ We define $\mathrm { s i g n } ( x ) = 1$ if $x > 0$ , and $\mathrm { s i g n } ( x ) = 0$ otherwise. Ideally, the OPR of a totally ordered decreasing (increasing) sequence $S$ should be zero (one). The expected OPR of a randomly-ordered sequence (average OPR of the set of all such sequences) should be 0.5.
336
+
337
+ Finally, we get a weighted sum of OPRs of all sequences in $\mathbb { S }$
338
+
339
+ $$
340
+ \operatorname { O P R } ( A ) = { \frac { \sum _ { S \in { \mathfrak { S } } } \operatorname { O P R } \left( S \right) \cdot | S | } { \sum _ { S \in { \mathfrak { S } } } | S | } }
341
+ $$
342
+
343
+ In the paper, we also consider a version of monotonicity within a offset of $k$ (e.g., ‘monotonicity (first 20 offsets)’ in Tab. 2), which OPR is calculated in first $k$ elements of each $S \in \mathbb S$ .
344
+
345
+ Symmetrical Discrepancy for symmetry We define the Symmetrical Discrepancy (SD) by:
346
+
347
+ $$
348
+ S D ( A ) = \frac { \sum _ { i , j , i < j } \left| A _ { i , j } - A _ { j , i } \right| } { L \times ( L - 1 ) / 2 }
349
+ $$
350
+
351
+ Direction Balance We define the Direction Balance (DB) as the ratio between the sum of the lower (left) triangle and the upper (right) triangle of $A$ . Note that all elements are positive in $A$ , DB(A) in $l$ -offset range is always positive.
352
+
353
+ $$
354
+ D B _ { l } ( A ) = \frac { \sum _ { i , j ; i < j , | i - j | < = l } A _ { i , j } } { \sum _ { i , j ; i > j , | i - j | < = l } A _ { i , j } }
355
+ $$
356
+
357
+ In Tab. 5 and 2, we report $D B$ for a offset range of 20, see Fig. 5b for the performance correlations with other offset ranges.
358
+
359
+ # C MEASURING CORRELATIONS BETWEEN PROPERTIES AND DOWNSTREAM TASKS.
360
+
361
+ In Tab. 5, monotonicity in 20 offsets and the correlations with performance in downstream tasks was reported; here we show how different ranges of the monotonicity correlate to performance in downstream tasks. Among all tasks, we choose all single sentence classification tasks (CoLA and SST-2), two biggest sentence pair classification tasks (MNLI and QQP tasks have more training samples than others), average performance in GLUE, and in SQuAd (F1 metrics nearly have identical trends with EM metrics).
362
+
363
+ As shown in Fig. 5a, the monotonicity indicators in nearly 20-55 offsets are highest correlated to the performance of span prediction tasks (with Pearson correlation larger than $9 0 \%$ ). Note that some classification tasks (especially SST-2) also show opposite correlations comparing to span prediction tasks, probably due to the unshiftable [CLS] on which classification tasks rely for interference does not need monotonicity.
364
+
365
+ In Fig. 5b, the performance correlates more to the direction balance indicators when considering neighboring tokens. For instance, the direction balance indicators within a small offset has correlation bigger than 0.5, this tends to be smaller with increasing offsets.
366
+
367
+ # D RELATIVE POSITION EMBEDDING WITH LONG OFFSETS
368
+
369
+ The dot product between two position embeddings are shown in Fig. 1(e) and (f). To analyze the behaviour, we replace the raw dot product with the cosine similarity (as the latter is normalized and (a) Pearson correlations between the performance of (b) Pearson correlations between the performance of downstream tasks (shown in Tables 3 and 4) and downstream tasks (shown in Tables 3 and 4) and direcmonotonicity indicators in different offset ranges. tion balance indicators in different ranges. This shows This shows violating monotonicity (especially in a $1 5 \mathrm { - }$ the more attending to preceding tokens than succeed60 offset range) is harmful for most tasks. ing tokens (especially for neighboring tokens) usually leads to better performance for GLUE in SQuAD.
370
+
371
+ ![](images/18d0d513801a363f23249c601b65b30a9d44dd36941cfd4241ed9ede6231f57e.jpg)
372
+
373
+ ![](images/fdf4ec166c78cc94947be3a43566ce305c2c2bdbfd2b9bc9d6eb3e0475127003.jpg)
374
+ Figure 5: In which offset ranges the properties correlate with the performance in downstream tasks.
375
+ Figure 6: Cosine similarities between any two relative position vectors. Cosine similarities bigger than $9 5 \%$ are in blue.
376
+
377
+ thus easier to interpret). When the cosine similarity is one, the two vectors are perfectly colinear and share the same direction. For the purposes of this investigation, we arbitrarily pick 0.95 as a threshold for the cosine similarity, denote that two vectors are not significantly different.
378
+
379
+ From Fig. 6 we observe the following for all PE variants with fully-learnable RPE: (1) There is no significant difference between relative position vectors with longer than 20-25 offsets; (2) forward relative position vectors are slightly more similar to forward relative position vectors instead of backward relative position vectors, and vice versa (see the central left-lower/right-upper white parts).
380
+
381
+ # E DETAILED EXPERIMENTAL SETTING
382
+
383
+ We train BERT base and BERT medium with both masked language prediction and next sentence prediction tasks; most parameters are listed in Tab. 6, with the remaining parameters set as in the original paper. Note that we share RPE in different heads and layers. Like (Shaw et al., 2018) RPE are truncated from $- 6 4$ to 64.
384
+
385
+ Table 6: Detailed Experimental Settings
386
+
387
+ <table><tr><td>Training</td><td>pre-training from scratch</td><td>max Length</td><td>epoch</td><td>learning rate</td><td>batch size</td></tr><tr><td>BERT-base on 128 length</td><td>X</td><td>128</td><td>5</td><td>5e-5</td><td>64</td></tr><tr><td>BERT-base on 512 length</td><td>X</td><td>512</td><td>2</td><td>5e-5</td><td>512</td></tr><tr><td>BERT-medium on 128 length</td><td>√</td><td>128</td><td>10</td><td>5e-5</td><td>128</td></tr><tr><td>BERT-medium on 512 length</td><td>√</td><td>512</td><td>2</td><td>5e-5</td><td>512</td></tr><tr><td>GLUE</td><td>-</td><td>128</td><td>3</td><td>2e-5</td><td>32</td></tr><tr><td>SQuAD</td><td>-</td><td>384</td><td>3</td><td>3e-5</td><td>32</td></tr></table>
388
+
389
+ We perform five runs for SQuAD and GLUE benchmark. The results in GLUE are for the last checkpoint during fine-tuning while SQuAD takes the best one for every 1000 steps. Finally, we calculate the average over 5 runs. All these settings are the same for all PEs. We use Mismatched MNLI. In GLUE (Wang et al., 2018), the train and dev are somewhat adversarial: training samples (in train and dev) containing the same sentence usually have opposite labels. Models may get worse when it overfits in the train set, resulting in unexpected results. Therefore, we exclude WNLI to calculate average in the last column in Tab. 3. The fine-tuning parameters are using default values in Huggingface project Wolf et al. (2019).
390
+
391
+ # F GENERALIZATION TO LONGER SENTENCES IN DOWNSTREAM TASKS
392
+
393
+ To fairly compare all models, we train a medium setting (8-layer transformer) on 128-length input in the first 10 epochs and 512-length input in the last 2 epochs from scratch. Fig. 7 shows that before 512-length pre-trained (like the 10-th epoch 128-length pre-trained) learnable sinusoidal APEs and RPEs perform better than BERT-style (without sinusoidal parameterization) in both SQuADs. This happens because PEs with translation invariance (learnable sinusoidal APEs and RPEs) generalize into longer positions 12, while position vectors between 128-512 positions are not trained in fullylearnable PEs and they are randomly initialized and finetuned in the downstream.
394
+
395
+ ![](images/42361133163358f3bc67a3d2d740b065b9b99123f9888fe8172cc1b174094584.jpg)
396
+ Figure 7: Experimental results on SQuADs with BERT-medium. X-axis: epoch number (first trained on 128-length seq. with 10 epochs and then 512-length with 2 epochs). Y-axis: F1 score.
397
+
398
+ # G THE EVOLUTION OF DOT PRODUCTS BETWEEN POSITION VECTORS
399
+
400
+ We exhibit dot products between position vectors during training a BERT-medium, as shown in Fig. 8. There is seemingly no pattern in the beginning, but as the number of training steps increase, a regular pattern with translation invariance and local monotonicity emerges.
401
+
402
+ ![](images/5a35b119583409841a0b2ee245c0692c082b2424f6ca01956d1c9ed1425d2bc9.jpg)
403
+ Figure 8: Dot products between absolute position vectors evolving with training steps.
404
+
405
+ # H DISCUSSIONS ON RELATED WORKS
406
+
407
+ Complementary effect between APE and RPE The complementary effect between APE and RPE was demonstrated to be effective in (Wang et al., 2019) for machine translation. In the pretrained language model, Ke et al. (2020) propose that combining APE and RPE could be beneficial for classification tasks (GLUE), which in this paper, this complementary effect is not significant since most PE combinations (APE and RPE) do not outperform the BERT-style fully-learnable APE on classification. Instead, we empirically conclude that most PE combinations boost the performance in span prediction tasks. The benefit in classification tasks in (Ke et al., 2020) may come from other modifications, for example, it unties the [CLS] symbol from other positions. Moreover, in the paper, it adopts a special relative position embedding like (Raffel et al., 2019) (as this paper also suggests to do so): a simplified form of PE that each “embedding” is simply a scalar bias added to the corresponding logits when computing the attention weights. The fundamental difference between the ‘position bias’ and position embedding is unknown from now.
408
+
409
+ Study on attention visualization. Many works are focusing on understanding attention patterns in individual heads. For example Vig (2019) introduced a tool for visualizing attention in the Transformer at multiple scales; Rogers et al. (2020) suggest attention mechanisms like Vertical, Diagonal, Vertical $^ +$ diagonal, Block, and Heterogeneous. Clark et al. (2019) found some attention mechanisms like attending broadly, to next, to [CLS] or [SEP], attend to punctuation. While our paper focuses on the general attention introduced by PEs from an average point of view, without considering any specific attention head.
410
+
411
+ Asymmetry in sequential labeling Yan et al. (2019) suggested asymmetry of position embedding in named-entity recognition task (without involving pre-trained language models) which is a kind of sequential labeling tasks like span prediction (SQuAD) in this paper. Their conclusion is generally compatible with ours, but we question its assumption that ‘the property of distance-awareness disappears when query and key projection are conducted’. As shown in Fig. 9, we could slightly see some distance-awareness by directly taking the average position-position correspondence in the first layer among many heads (i.e., $P W ^ { Q , 1 } ( W ^ { \mathbf { \bar { K } } , 1 } ) ^ { T } P ^ { T } )$ .
412
+
413
+ Functional parameterization of PEs Xu et al. (2019) proposes various variants of sinusoidal positional encodings inspired by functional analysis. Wang et al. (2020) proposed a sinusoid-like complex word embedding to encode word order. Both (Xu et al., 2019) and (Wang et al., 2020) assume that PEs should satisfy the translation invariance property, but they induce different types of sinusoidal PE parameterization either in real or complex vector space. Moreover, Liu et al. (2020) use a neural ODE component to parameterize position encoding as a continuous dynamical model, which could learn suitable PEs in neural networks. All of these PEs are inspiring. Since selecting the suitable parameterization type is not the main concern in this paper, we adopted the typical ones, namely, the fully-learnable, (learnable or fixed) sinusoidal APEs/RPEs. The fundamental difference between these PE parameterizations needs further investigation. More recently, (Wang & Chen, 2020) empirically study the behaviour of many position embeddings and their performance in Transformers for various NLP tasks.
414
+
415
+ ![](images/0c03a5b9cddb340afd5ef8a1a6c312b39a3782e8c6bf50173d7aa1c3d615ee10.jpg)
416
+ Figure 9: Position-wise correlation matrix $( P W ^ { Q , 1 } ( W ^ { K , 1 } ) ^ { T } P ^ { T } )$ for first 128 positions in BERT pre-trained models
417
+
418
+ # I THE THREE PROPERTIES IN OTHER MODELS
419
+
420
+ By using the proposed identical probing test, we also check the properties of other trained Transformer models with decoder components in Tab. 7 and Fig. 10. The machine translation model 13 is a typical encoder-decoder architecture using multiple-layer Transformers. GPT2 (Radford et al., 2019) adopts a purely decoder architecture; 12-layer base setting is used in this work.
421
+
422
+ Monotonicity Compared to BERT and the machine translation, GPT2 satisfies monotonicity (especially in the first 20 offsets) better than other models, showing capturing distance between neighboring tokens matters in the language model.
423
+
424
+ Translation invariance As seen from the translation invariance indicators in Tab. 7, GPT2 satisfies translation invariance poorer than other models, since tokens in it also additionally attend to a few beginning tokens no matter how far the attended tokens are.
425
+
426
+ Symmetry GPT2 shows the biggest symmetrical discrepancy, since GPT2, which aims to predict the next word, adopts an attention mask of succeeding tokens to avoid information leakage. Plus, the machine translation encoder slightly attends more to the succeeding tokens while BERT attends more on the preceding tokens than succeeding tokens.
427
+
428
+ Table 7: Quantitative measurement of the properties for models of machine translation, language models.
429
+
430
+ <table><tr><td rowspan="2">PEs</td><td rowspan="2">PE type</td><td rowspan="2">model type</td><td colspan="2">monotonicity</td><td rowspan="2">translation invariance w/o special tokens</td><td rowspan="2">symmetry</td><td rowspan="2">direction balance</td></tr><tr><td>all offsets</td><td>first 20 offsets</td></tr><tr><td>BERT</td><td>fully-learnable APE</td><td>encoder only</td><td>0.2461</td><td>0.0208</td><td>0.0143</td><td>0.0012</td><td>1.1940</td></tr><tr><td>GPT</td><td>fully-learnable APE</td><td>decoder only</td><td>0.1019</td><td>0.0044</td><td>0.1114</td><td>0.0070</td><td>inf</td></tr><tr><td>Machine Translation</td><td>fixed sin. APE</td><td>encoder &amp; decoder</td><td>0.3540</td><td>0.0841</td><td>0.0214</td><td>0.0002</td><td>0.8074</td></tr></table>
431
+
432
+ # J WHITE BAND EFFECTS ALONG THE DIAGONAL
433
+
434
+ In order to analyze the white band effects along the diagonal, we show all results of identical word probing (average attention values in the first layer of identical word probing with respect to 100 randomly-selected words). This effect is more clear for fully-learnable RPE, learnable sinusoidal RPE and any combination variants including them (see. Fig. 11 (d,f,g,i,j,l)). To show the obvious differences between these PEs, in this paper, we use average unnormalized attention weights matrix for probing, but all indicators are calculated using normalized attention values for better quantitative comparison.
435
+
436
+ ![](images/6f1e93c16f7f36a7d4c17cbe7f52b0348ef7bd8e244ac62251fa5a3e481401c5.jpg)
437
+ Figure 10: Identical word probing with different types of trained models.
438
+
439
+ # K THE REPLACEABLE PROPERTY ABOUT ABSOLUTE POSITIONS OF WORDS
440
+
441
+ For example (we do not consider subword tokenization for simplicity), we have two sentences for next sentence predictions (As BERT did)
442
+
443
+ sentence1 : Deadlines are the No.1 productive forces .
444
+
445
+ sentence2 : I think , therefore I am .
446
+
447
+ By adding three special tokens, we will have a example with 17 tokens as
448
+
449
+ [CLS] Deadlines are the No.1 productive forces . [SEP] I think , therefore I am .[SEP]
450
+
451
+ with absolute positions in the bracket as
452
+
453
+ [CLS](1) Deadlines(2) are(3) the(4) No.1(5) productive(6) forces(7) .(8) [SEP](9) I(10) think(11) ,(12) therefore(1 am(15) .(16) [SEP](17)
454
+
455
+ Assume that the expected maximum sequence length is 16 (actually 128 or 512 in BERT), we need to randomly remove the first token of the first sentence (i.e., Deadlines ) as
456
+
457
+ valid sample: I: [CLS](1) are(2) the(3) No.1(4) productive(5) forces(6) .(7) [SEP](8) I(9) think(10) ,(11) therefore(12) I(13) am(14) .(15) [SEP](16)
458
+
459
+ or last token of the second sentence (i.e., . )
460
+
461
+ valid sample: II: [CLS](1) Deadlines(2) are(3) the(4) No.1(5) productive(6) forces(7) .(8) [SEP](9) I(10) think(11) ,(12) therefore(13) I(14) am(15) [SEP](16)
462
+
463
+ Both the above two sentences are valid for training. If we replaced the first sentence with another shorter sentence (i.e., Publish/Launch or Perish ?), the sample would be
464
+
465
+ valid sample: III: [CLS](1) Publish(2) or(3) Perish(4) ?(5) [SEP](6) I(7) think(8) ,(9) therefore(10) I(11) am(12) [SEP](13) [PAD](14) [PAD](15) [PAD](16)
466
+
467
+ The three samples I,II,III are valid, but its absolute position indexes are not shiftable. Especially, the first sentence of the second sentence could be 9, 10, and 7, respectively, depending on the random seed for dropping and the length of the first sentence.
468
+
469
+ ![](images/d0646612ef1ba643abc24a4e026bb06203de08a9980c2caf93d949f70e70b2bc.jpg)
470
+ Figure 11: Identical word probing (models with more PEs are shown here comparing to Fig. 2). Darker in the $i$ -th row and $j$ -th column means that the $i$ -th words generally attend more on the $j$ -th words.
md/train/r1HhRfWRZ/r1HhRfWRZ.md ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING AWARENESS MODELS
2
+
3
+ Brandon Amos1∗ Laurent Dinh2 Serkan Cabi3 Thomas Rothorl ¨ 3 Sergio Gomez Colmenarejo ´ 3 Alistair Muldal3 Tom Erez3 Yuval Tassa3 Nando de Freitas3,4 Misha Denil3
4
+
5
+ 1Carnegie Mellon University 2University of Montreal 3DeepMind 4CIFAR
6
+
7
+ # ABSTRACT
8
+
9
+ We consider the setting of an agent with a fixed body interacting with an unknown and uncertain external world. We show that models trained to predict proprioceptive information about the agent’s body come to represent objects in the external world. In spite of being trained with only internally available signals, these dynamic body models come to represent external objects through the necessity of predicting their effects on the agent’s own body. That is, the model learns holistic persistent representations of objects in the world, even though the only training signals are body signals. Our dynamics model is able to successfully predict distributions over 132 sensor readings over 100 steps into the future and we demonstrate that even when the body is no longer in contact with an object, the latent variables of the dynamics model continue to represent its shape. We show that active data collection by maximizing the entropy of predictions about the body— touch sensors, proprioception and vestibular information—leads to learning of dynamic models that show superior performance when used for control. We also collect data from a real robotic hand and show that the same models can be used to answer questions about properties of objects in the real world. Videos with qualitative results of our models are available at https://goo.gl/mZuqAV.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Situation awareness is the perception of the elements in the environment within a volume of time and space, and the comprehension of their meaning, and the projection of their status in the near future. — Endsley (1987)
14
+
15
+ As artificial intelligence moves off of the server and out into the world at large; be this the virtual world, in the form of simulated walkers, climbers and other creatures (Heess et al., 2017), or the real world in the form of virtual assistants, self driving vehicles (Bojarski et al., 2016), and household robots (Jain et al., 2013); we are increasingly faced with the need to build systems that understand and reason about the world around them.
16
+
17
+ When building systems like this it is natural to think of the physical world as breaking into two parts. The first part is the platform, the part we design and build, and therefore know quite a lot about; and the second part is everything else, which comprises all the strange and exciting situations that the platform might encounter. As designers, we have very little control over the external part of the world, and the variety of situations that might arise are too numerous to anticipate in advance. Additionally, while the state of the platform is readily accessible (e.g. through deployment of integrated sensors), the state of the external world is generally not available to the system.
18
+
19
+ The platform hosts any sensors and actuators that are part of the system, and importantly it can be relied on to be the same across the wide variety situations where the system might be deployed. A virtual assistant can rely on having access to the camera and microphone on your smart phone, and the control system for a self driving car can assume it is controlling a specific make and model of vehicle, and that it has access to any specialized hardware installed by the manufacturer. These consistency assumptions hold regardless of what is happening in the external world.
20
+
21
+ This same partitioning of the world occurs naturally for living creatures as well. As a human being your platform is your body; it maintains a constant size and shape throughout your life (or at least these change vastly slower than the world around you), and you can hopefully rely on the fact that no matter what demands tomorrow might make of you, you will face them with the same number of fingers and toes.
22
+
23
+ ![](images/85f873020ce18593ab997648308688f800113b8e711e9316a66b635eb0ae5bda.jpg)
24
+ Figure 1: Illustration of a preprogrammed grasp and release cycle of a single episode of the MPL hand. The target block is only perceivable to the agent through the constraints it imposes on the movement of the hand. Note that the shape of the object is correctly predicted even when the hand is not in contact with it. That is, the hand neural network sensory model has learned persistent representations of the external world, which enable it to be aware of object properties even when not touching the objects.
25
+
26
+ This story of partitioning the world into the self and the other, that exchange information through the body, suggests an approach to building models for reasoning about the world. If the body is a consistent vehicle through which an agent interacts with the world and proprioceptive and tactile senses live at the boundary of the body, then predictive models of these senses should result in models that represent external objects, in order to accurately predict their future effects on the body. This is the approach we take in this paper.
27
+
28
+ We consider two robotic hand bodies, one in simulation and one in reality. The hands are induced to grasp a variety of target objects (see Figure 1 for an example) and we build forward models of their proprioceptive signals. The target objects are perceivable only through the constraints they place on the movement of the body, and we show that this information is sufficient for the dynamics models to form holistic, persistent representations of the targets. We also show that we can use the learned dynamics models for planning, and that we can illicit behaviors from the planner that depend on external objects, in spite of those objects not being included in the observations directly (see Figure 7).
29
+
30
+ Our simulated body is a model of the hand of the Johns Hopkins Modular Prosthetic Limb (Johannes et al., 2011), realized in MuJoCo (Todorov et al., 2012). The model is actuated by 13 motors each capable of exerting a bidirectional force on a single joint. The model is also instrumented with a series of sensors measuring angles and torques of the joints, as well as pressure sensors measuring contact forces at several locations across its surface. There are also inertial measurement units located at the end of each finger which measure translational and rotational accelerations. In total there are 132 sensor measurements whose values we predict using our dynamics model.
31
+
32
+ Our real body is the Shadow Dexterous Hand, which is a real robotic hand with 20 degree of freedom control. This allows us to show that that our ideas apply not only in simulation, but succeed in the real world as well. The Shadow Hand is instrumented with sensors measuring the tension of the tendons driving the fingers, and also has pressure sensors on the pad of each fingertip that measure contact forces with objects in the world. We apply the same techniques used on the simulated model to data collected from this real platform and use the resulting model to make predictions about states of external objects in the real world.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ Intrinsic motivation and exploration: Given our goal to gather information about the world and, and in particular to actively seek out information about external objects, our work is naturally related to work on intrinsic motivation. The literature on intrinsic motivation is vast and rich, and we do not attempt to review it fully here. Some representative works include Oudeyer & Kaplan (2008; 2009); Sequeira et al. (2011); Still & Precup (2012); Bellemare et al. (2016); Martius et al. (2013); Schmidhuber (2008); Mohamed & Rezende (2015); Haber et al. (2018b;a) Some of the ideas here, in particular the notion of choosing actions specifically to improve a model of the world, echo earlier speculative work of Schmidhuber (1991) and Storck et al. (1995).
37
+
38
+ Several authors have implemented intrinsic motivation, or curiosity based objectives in visual space, through predicting interactions with objects (Pinto et al., 2016), or through predicting summary statistics of the future (Venkatraman et al., 2017; Downey et al., 2017). Other authors have also investigated using learned future predictions directly for control (Dosovitskiy & Koltun, 2016).
39
+
40
+ Many works formulate intrinsic motivation as a problem of learning to induce errors in a forward model, possibly regularized by an additional inverse model (Pathak et al., 2017; de Abril & Kanai, 2018). However, since we use planning, rather than policies, for active control we cannot adapt their objectives directly. Objectives that depend on the observed error in a prediction cannot be rolled forward in time, and thus we are forced to work with similar, but different objectives in our planner.
41
+
42
+ When stochastic transition and observation models are available, it is possible to use simulation to infer optimal plans for exploring environments (Martinez-Cantin et al., 2009). Our setting uses predominantly deterministic distributed representations, and our models are learned from data.
43
+
44
+ A sea of other methods have been proposed for exploration (MacKay, 1992; Ghavamzadeh et al., 2015; Asmuth et al., 2009; Gal, 2016; Stachniss et al., 2005; Plappert et al., 2017; Fu et al., 2017). Our approach builds on this literature.
45
+
46
+ Haptics: Humans use their hands to gather information in structured task driven ways (Lederman & Klatzky, 1987); and it will become clear from the experiments why hands are relevant to our work. Our interest in hands and touch brings us into contact with a vast literature on haptics (Zheng et al., 2016; Gao et al., 2016; Cao et al., 2016; Loeb, 2013; Edmonds et al., 2017; Su et al., 2015; Navarro et al., 2012; Aggarwal et al., 2015; Liu et al.; Sung et al., 2017; Ciobanu et al., 2013; Karl et al., 2016; Su et al., 2012).
47
+
48
+ There is also work in robotics on using the anticipation of sensation to guide actions (Indranil Sur, 2017), and on showing how touch sensing can improve the performance of grasping tasks (Calandra et al., 2017). Model based planning has been very successful in these domains (Deisenroth & Rasmussen, 2011).
49
+
50
+ Sequence-to-sequence modelling: There has been a lot of recent interest in sequence-to-sequence modelling (Downey et al., 2017; Venkatraman et al., 2017; Chung et al., 2015; Fraccaro et al., 2016; Bayer & Osendorfer, 2014; Archer et al., 2015; Krishnan et al., 2015), particularly in the context of predicting distributions and in dynamics modelling in reinforcement learning. In this paper we use a sequence to sequence variant that shares weights between the encoder and decoder portions of the model.
51
+
52
+ Predicting unknown quantities in RL: The consciousness prior (Bengio, 2017) considers recurrent latent dynamics models similar to ours and suggests mapping from their hidden states to other spaces that aren’t directly modelled.
53
+
54
+ Yu et al. (2017) propose a method of learning control policies that operate under unknown dynamics models. They consider the dynamics model parameters as an unobserved part of the state, and train a system identification model to predict these parameters from a short history of observations. The predictions of the system identification model are used to augment the observations which are then fed to a universal policy, which has been trained to act optimally under an ensemble of dynamics models, when the dynamics parameters are observed. The key contribution of their work is a training procedure that makes this two stage modelling process robust.
55
+
56
+ Although the high level motivation of Yu et al. (2017) is similar, there is an obvious analogy between their system identification model and our diagnostics, many of the specifics are quite different from the work presented here. They explicitly do not consider memory-based tasks (the system identification model looks only at a short window of the past) whereas one of our key interests is in how our models preserve information in time. They also use a two stage training process, where both stages of training require knowledge of the system parameters; it is only at test time where these are
57
+
58
+ # Definitions
59
+
60
+ ![](images/857196e20b4c1ffb5daa32f405c79d3d033c07f4dab0484b5534926a78d33f0e.jpg)
61
+
62
+ Dynamics Model: Predicts the action-conditional future observations given the past observations and actions: $p ( x _ { t + 1 : t + k } | u _ { 1 : t + k - 1 } , x _ { 1 : t } )$
63
+
64
+ Awareness: The information about unobserved states that is represented by the dynamics model.
65
+
66
+ Diagnostic Model: A model used to evaluate (or diagnose) the awareness of a dynamics model by predicting unobserved states.
67
+
68
+ Figure 2: Overview of our notation and definitions.
69
+
70
+ unknown. In contrast, we use the system parameters only as an analysis strategy, and at no point require knowledge of them to train the system. Finally, the bodies we consider (robot hands) are substantially more complex than those of Yu et al. (2017), and we do not make use of an explicit parameterization of the system dynamics.
71
+
72
+ The work of Fu et al. (2016) also fits dynamics models using neural networks and uses planning in these models to guide action selection. They train a global dynamics model on data from several tasks, and use this global model as a prior for fitting a much simpler local dynamics model within each episode. The global model captures course grained dynamics of the robot and its environment, while the local model accounts for the specific configuration of the environment within an episode. Although they do not probe for this explicitly, one might hypothesize that the type of awareness of the environment that we are after in this work could be encoded in the parameters of their local models.
73
+
74
+ # 3 DYNAMICS, AWARENESS, AND DIAGNOSTICS
75
+
76
+ We consider an agent operating in a discrete-time setting where there is a stochastic unobservable global state $s _ { t } \in S$ at each timestep $t$ and the agent obtains a stochastic observation $\boldsymbol { x } _ { t } \in \mathcal { X }$ where ${ \mathcal { X } } \subseteq S$ and takes some action $u _ { t } \in \mathcal { U }$ . Our goal is to learn a predictive dynamics model of the agent’s action-conditional future observations $p ( x _ { t + 1 : t + k } | u _ { 1 : t + k - 1 } , x _ { 1 : t } )$ for $k$ timesteps into the future given all of the previous observations and actions it has taken. We assume that the dynamics model has some hidden state it uses to encode information in the observed trajectory. We will then use these models to reason about the global state $s _ { t }$ even though no information about this state is available during training, which we refer to as awareness. Figure 2 summarizes the notation and definitions we use throughout the rest of the paper.
77
+
78
+ To show that information required for reasoning is present in the states of our dynamics models we use auxiliary models, which we call diagnostic models. A diagnostic model looks at the states of a dynamics model and uses them to to predict an interpretable unobserved state in the world $y _ { t } \in \mathcal { V }$ , where $\mathcal { V } \subseteq \mathcal { S }$ and in most cases $\chi \cap \mathcal { y } = \emptyset$ . When training a diagnostic model we allow ourselves to use privileged information to define the loss, but we do not allow the diagnostic loss to influence the representations of the dynamics model.
79
+
80
+ The diagnostic models are a post-hoc analysis strategy. The dynamics models are trained using only the observed states, and then frozen. After the dynamics models are trained we train diagnostic models on their states, and the claim is that if we can successfully predict properties of unobserved states using diagnostic models trained in this way then information about the external objects is available in the states of the dynamics model.
81
+
82
+ # 4 THE PREDICTOR-CORRECTOR (PRECO) DYNAMICS MODEL
83
+
84
+ This section introduces the Predictor-Corrector (PreCo) dynamics model we use for long-horizon multi-step predictions over the observation space $p ( x _ { t + 1 : t + k } | u _ { 1 : t + k - 1 } , x _ { 1 : t } )$ . We first encode the observed trajectory $\{ u _ { 1 : t } , x _ { 1 : t } \}$ into a deterministic hidden state $h _ { t } \in \mathcal { H }$ using a recurrent model
85
+
86
+ ![](images/f0e9ff8d767e6ac211edb9e9029a2ee65f15dc4755772729043cafd7a0a04f15.jpg)
87
+ Figure 3: Top Left: A PreCo model generating single-step predictions and corrections, as in optimal filtering. Bottom Left: A PreCo model making multi-step predictions. Right: Multi-step rollouts, from all timesteps, are used for fitting a PreCo model to a trajectory. Deterministic nodes are represented with diamonds and stochastic nodes are represented with circles.
88
+
89
+ parameterized by $\theta$ and then use this hidden state to predict distributions over the future observations $x _ { t + 1 : t + k }$ . We show experimentally that even though the hidden states $h _ { t }$ were only trained on observed states, they contain an awareness of unobserved states in the environment.
90
+
91
+ Using a deterministic hidden state allows us to easily unroll the predictor without needing to approximate the distributions with sampling or other approximate methods. We assume that the observation predictions are independent of each other given the hidden state, and can be modeled as
92
+
93
+ $$
94
+ p ( x _ { t + 1 : t + k } | u _ { t : t + k - 1 } , h _ { t : t + k } ) = \prod _ { \kappa = 1 } ^ { k } p ( x _ { t + \kappa } | u _ { t : t + \kappa - 1 } , h _ { t : t + \kappa } )
95
+ $$
96
+
97
+ This modelling is done with three deterministic components:
98
+
99
+ 1. Predictor $\ d \ b \theta : \mathcal { H } \times \mathcal { U } \mathcal { H }$ predicts the next hidden state after taking an action, 2. Corrector $\theta : \mathcal { H } \times \mathcal { X } \mathcal { H }$ corrects the current hidden state after receiving an observation from the environment, and 3. $\operatorname { D e c o d e r } _ { \boldsymbol { \theta } } : \mathcal { H } P _ { \mathcal { X } }$ maps from the hidden state to a distribution over the observations.
100
+
101
+ Separating the dynamics model into predictor and corrector components allows us to operate in single-step and multi-step prediction modes as Figure 3 shows. The predictor can make action-conditional predictions using the hidden states from the corrector for single-step predictions as $h _ { t , 0 } ^ { p } = \operatorname { \bar { P } r e d i c t o r } _ { \theta } ( h _ { t - 1 } ^ { c } , \hat { u } _ { t } )$ or from itself for multi-step predictions as $\begin{array} { r l } { \bar { h } _ { t , i + 1 } ^ { p } } & { { } = } \end{array}$ Predictor $\mathbf { \nabla } _ { \theta } \bigl ( h _ { t , i } ^ { p } , u _ { t + i } \bigr )$ . In our notation, $h _ { t , i } ^ { p }$ denotes the predictor’s hidden state prediction at time $t + i$ starting from the corrector’s state at time $t - 1$ . The corrector then makes the updates $h _ { t } ^ { c } = \mathrm { C o r r e c t o r } _ { \theta } ( h _ { t , 0 } ^ { p } , x _ { t } )$ .
102
+
103
+ To train PreCo models, we maximize the likelihood on a reference set of trajectories using the singlestep predictions as well as multi-step predictions stemming from every timestep. The structure of the resulting graph of only the hidden states is shown on the right of Figure 3, omitting the observed states, trajectories, and predicted distributions. We call this technique overshooting, and we call the number of steps predicted forward by the decoder the overshooting length.
104
+
105
+ The predictor and corrector components use single layer LSTM cores. We embed the inputs with a separate embedding MLP for the controls and sensors. We predict independent mixtures of Gaussians at every step with a mixture density network (Bishop, 1994). Each dimension of each prediction is an independent mixture. We use separate MLPs to produce the means, standard deviations and mixture weights. We use Adam (Kingma & Ba, 2014) for parameter optimization.
106
+
107
+ # 5 CONTROL WITH DYNAMICS AND DIAGNOSTIC MODELS
108
+
109
+ Model predictive control (MPC), the strategy of controlling a system by repeatedly solving a modelbased optimization problem in a receding horizon fashion, is a powerful control technique when a dynamics model is known. Throughout this paper, we use MPC to achieve objectives based on predictions from our dynamics models. Formally, MPC requires that at each timestep after receiving an observation and correcting the hidden state, we solve the optimization problem
110
+
111
+ $$
112
+ \begin{array} { r l } { h _ { 1 : T } ^ { \star } , u _ { 1 : T } ^ { \star } \ = \ \underset { h _ { 1 : T } , u _ { 1 : T } } { \mathrm { a r g m i n } } } & { \displaystyle \sum _ { t } C ( h _ { t } , u _ { t } ) } \\ { \mathrm { s u b j e c t \ t o } } & { h _ { 0 } = h _ { \mathrm { i n i t } } } \\ & { h _ { t + 1 } = \mathrm { P r e d i c t o r } _ { \theta } ( h _ { t } , u _ { t } ) } \\ & { u _ { 1 : T } \in \mathcal { U } _ { 1 : T } } \end{array}
113
+ $$
114
+
115
+ where the timesteps in this problem are offset from the actual timestep in the real system, the initial hidden state $h _ { \mathrm { i n i t } }$ is from the most recent corrector’s state, and the remaining hidden states are unrolled from the predictor. In our experiments we also add constraints to the actions $\lambda _ { 1 : T }$ so that they lie in a box $| | u _ { t } | | _ { \infty } \leq 1$ and we enforce slew rate constraints $| | u _ { t + 1 } - u _ { t } | | _ { \infty } \leq 0 . 1$ . After solving this problem, we execute the first returned control $u _ { 1 } ^ { \star }$ on the real system, step forward in time, and repeat the process.
116
+
117
+ This formulation allows us to express standard objectives defined over the observation space by using the decoder to map from the hidden state to a distribution over observations at each timestep. We can also use other learned models, such as diagnostic models, to map from the hidden state to other unobservable quantities in the world.
118
+
119
+ Our MPC solver for (1) uses a shooting method with a modified version of Adam (Kingma & Ba, 2014) to iteratively find an optimal control sequence from some initial hidden state. At every iteration, we unroll the predictor, compute the objective at each timestep, and use automatic differentiation to compute the gradient of the objective with respect to the control sequence. To handle control constraints, we project onto a feasible set after each Adam iteration. During an episode, we warm-start the nominal control and hidden state sequence to the appropriately time-shifted control and hidden state sequence from the previous optimal solution.
120
+
121
+ # 6 COLLECTING TRAJECTORIES AND EXPLORATION
122
+
123
+ Learning dynamics models such as the PreCo model in Section 4 requires a collection of trajectories. In this section, we discuss two ways of collecting trajectories for training dynamics models: passive collection does not use any input from the dynamics model while active collection seeks to actively improve the dynamics model.
124
+
125
+ # 6.1 PASSIVE COLLECTION
126
+
127
+ The simplest data collection strategy is to hand design a behavior that is independent of the dynamics model. Such strategies can be completely open loop, for example taking random actions driven by a noise process, and also encompass closed loop policies such as following a pre-programmed nominal trajectory. In these situations, we are only interested in learning a dynamics model to achieve an awareness of the unobserved states, not to make policy improvements. We use the term passive collection to emphasize that the the data collection behavior does not depend on the model being trained. Once collected, the maximum likelihood PreCo training procedure described in Section 4 can be used to fit the PreCo dynamics model to the trajectories, but there is no feedback between the state of the dynamics model and the data collection behavior.
128
+
129
+ Beyond passive collection we can consider using using the dynamics model to guide exploration towards parts of the state space where the the model is poor. We call this process active collection to emphasize that the model being trained is also being used to guide the data collection process. This section describes the method of active collection we use in the experiments.
130
+
131
+ In this paper, we consider environments that are entirely deterministic, except for a stochastic initial unobserved state that the observed state can gather information about. When our dynamics model over the observed state makes uncertain predictions, the source of that uncertainty stems from one of two places: (1) the model is poor, as a consequence of there being too little data or from too small capacity, or (2) properties of the external objects are not yet resolved by the observations seen so far.
132
+
133
+ Our active exploration exploits this fact by choosing actions to maximize the uncertainty in the rollout predictions. An agent using this uncertainty maximization policy attempts to seek actions for which the outcome is not yet known. This uncertainty can then be resolved by executing these actions and observing their outcome, and the resulting trajectory of observations, actions, and sensations can be used to refine the model.
134
+
135
+ To choose actions to gather information we use MPC as described in Section 5 over an objective that maximizes the uncertainty in the predictions. Our predictions are Mixtures of Gaussians at each timestep, and the uncertainty over these distributions can be expressed in many ways. We use the Renyi entropy of our model predictions as our measure of uncertainty because it can be easily ´ computed in closed form. Concretely, for a single Mixture of Gaussians prediction $f ( x )$ we can write
136
+
137
+ $$
138
+ H _ { 2 } ( f ) = - \log \left[ \int f ( x ) ^ { 2 } \mathrm { d } x \right] = - \log \left[ \sum _ { i j } \alpha _ { i } \alpha _ { j } \frac { \exp \left\{ - \frac { ( \mu _ { i } - \mu _ { j } ) ^ { 2 } } { 2 \left( \sigma _ { i } ^ { 2 } + \sigma _ { j } ^ { 2 } \right) } \right\} } { \sqrt { 2 \pi } \sqrt { \sigma _ { i } ^ { 2 } + \sigma _ { j } ^ { 2 } } } \right]
139
+ $$
140
+
141
+ where $i$ and $j$ index the mixture components in the likelihood. A more complete derivation is shown in Appendix A, which extends the result of Wang et al. (2009) to the case when the mixture components have different variances. We obtain an information seeking objective by summing the entropy of the predictions across observations and across time, which is expressed as the cost function in MPC (1) as $\begin{array} { r } { C ( h _ { t } , u _ { t } ) = - \sum _ { f _ { i } } H _ { 2 } ( f _ { i } ) } \end{array}$ where, through a slight abuse of notation, $f _ { i } \in$ $\operatorname { D e c o d e r } _ { \theta } ( h _ { t } )$ is a distribution over the observation dimension $i$ .
142
+
143
+ We implement this information gathering policy to collect training data for the model in which it is planning. In our implementation these are two processes running in parallel: we have several actors each with a copy of the current model weights. These use MPC to plan and execute a trajectory of actions that maximizes the model’s predicted uncertainty over a fixed horizon trajectory into the future. The observations and actions generated by the actors are collected into a large shared buffer and stored for the learner.
144
+
145
+ While the actors are collecting data, a single learner process samples batches of the collected trajectories from the buffer being written to by the actors. The learner trains the PreCo model by maximum likelihood as described in Section 4, and the updated model propagates back to the actors who continue to plan using the updated model. We implemented this using the framework of Horgan et al. (2018).
146
+
147
+ # 7 EXPERIMENTS ON THE SIMULATED MPL HAND
148
+
149
+ # 7.1 THE MPL HAND ENVIRONMENT
150
+
151
+ Our simulated environment consists of a hand with a random object placed underneath of it in each episode. The observation state space consists of sensor readings from the hand, and the unobserved state space consists of properties of the object.
152
+
153
+ The hand is from the Johns Hopkins Modular Prosthetic Limb (Johannes et al., 2011) which we refer to as the “MPL hand”, or simply “the hand”. This model is distributed with the MuJoCo HAPTIX software and is available for download from the MuJoCo website.1 The hand is actuated by 13 motors and has sensors that provide a 132 dimensional observation, which we describe in more detail in Appendix C.
154
+
155
+ ![](images/617a2c2696a7a5254ad444002d14de28b6ac61bb79edfab758691df435813fd8.jpg)
156
+ Figure 4: Results for the passive data collection experiment. Black vertical lines mark timesteps where the hand is fully open (solid) or fully closed (dashed). See the main text for a description of the different baseline models. The baseline models are end-to-end supervised on the shape classification task, whereas the PreCo states are learned without the shape information. Top: Classification loss vs episode timestep for the diagnostic model and the three baselines. Lines show median loss averaged over 5000 test episodes. Middle: Cumulative distributions of loss at the indicated timesteps. Bottom: Curves showing the median probability that each baseline model achieves lower classification loss than the PreCo diagnostic model, as a function of episode timesteps. Computed by directly comparing loss values.
157
+
158
+ In each episode the hand starts suspended above the table with its palm facing downwards. A random geometric object that we call the “target” is placed on the table, and the hand is free to move to grasp or manipulate the object. The shape of the target is randomly chosen in each episode to be a box, cylinder or ellipsoid and the size and orientation of the target are randomly chosen from reasonable ranges. Figures 1 and 7 show renderings of the environment.
159
+
160
+ # 7.2 AWARENESS THROUGH PASSIVE DATA COLLECTION
161
+
162
+ We begin by exploring awareness in the passive setting, as a pure supervised learning problem. We manually design a policy for the hand, which executes a simple grasping motion that closes the hand about the target it and then releases it. We generate data from the environment by running this graspand-release cycle three times for each episode. Using the dataset generated by the grasping policy, we train a PreCo model described in Section 4. The full set of hyperparameters for this model can be found in Appendix D.
163
+
164
+ We evaluate the awareness of our model by measuring our ability to predict the shape of the target at each timestep. We are especially interested in the predictions at timesteps where the hand is not in direct contact with the target, since these are the points that allow us to measure the persistence of information in the dynamics model. We expect that even a na¨ıve model should have enough information to identify the target shape at the peak of a grasp, but our model should do a better job of preserving that information once contact has been lost.
165
+
166
+ Recall from Section 3 that the diagnostic model we use to predict the target shape is trained in a second phase after the dynamics model is fully trained. The identity of the target shape is used when training the diagnostic model, but is not available when training the dynamics model, and the training of the diagnostic does not modify the learned dynamics model, meaning that no information from the diagnostic loss is able to leak into the states of the dynamics model.
167
+
168
+ ![](images/f1fbfeba0e71dc4ca9a692e78cd62a8f8f2f00963b6157545167cd8453a6b244.jpg)
169
+ Figure 5: Left: Reward obtained by planning to achieve the max fingertip objective using dynamics models trained with different data collection strategies. Right: A frame from a planned max fingertip trajectory.
170
+
171
+ Figure 4 shows the results of this experiment. We compare the diagnostic predictions trained on the features of our dynamics model to three different baselines that do not use the dynamics model features.
172
+
173
+ 1. The MLP baseline uses an MLP trained to directly classify the target from the sensor readings of the hand, ignoring all dependencies between timesteps within an episode. We expect this baseline to give a lower bound on performance of the diagnostic. This is an important baseline to have since as the hand opens there is still residual information about the shape of the target in the position of joints, which is identified by this baseline.
174
+ 2. The LSTM baseline uses an LSTM trained to directly classify the target from the sensor readings of the hand, taking full account of dependencies between timesteps within an episode. Since this baseline has access to the target class at training time, and is also able to take advantage of the temporal dependence within each episode, we expect it to give an upper bound on performance of the diagnostic model, which only has access to the states of the pre-trained PreCo model.
175
+ 3. The RandLSTM baseline finds a middle ground between the MLP and LSTM models. We use the same architecture and training procedure as for the LSTM baseline, but we do not train the input or recurrent weights of the model. By comparing the performance of this baseline to the diagnostic model we can see that our success cannot be attributed merely to the existence of an arbitrary temporal dependence.
176
+
177
+ The results in Figure 4 show that the dynamics PreCo model reliably preserves information about the identity of the target over time, even though this information is not available to the model directly either in the input or in the training loss.
178
+
179
+ # 7.3 AWARENESS THROUGH ACTIVE DATA COLLECTION
180
+
181
+ In this section we explore how different data collection strategies lead to models of different quality. We evaluate the quality of the trained models by using them in an MPC planner to execute a simple diagnostic control task.
182
+
183
+ The diagnostic task we use in this section is to maximize the total pressure on the fingertip sensors on the hand. This is a good task to evaluate these models because the most straightforward way to maximize pressure on the fingers is to squeeze the target block, and demonstrating that we can achieve this objective through MPC shows that the models are able to anticipate the presence of the block, and reason about its effect on the body.
184
+
185
+ Note that because we act through planning, the implication for the representations of the model are stronger than they would be if we trained a policy to achieve the same objective. A policy need only learn that when the hand is open it should be closed to reach reward. In contrast, a model must learn that closing the hand will lead the fingers to encounter contacts, and it is only later that this prediction is turned into a reward for evaluation.
186
+
187
+ ![](images/5c7fa9e3209cba267648a869ec1825e7c00d6bae672ce73625d5f9b4762fa507.jpg)
188
+ Figure 6: Diagnostic comparison between active and passive data collection computed by directly comparing loss values. The model trained with actively collected data outperforms its passive counterpart in regions of the grasp trajectory where the hand is not in contact with the block.
189
+
190
+ We compare several different data collection policies, and their performances on the diagnostic task are shown in Figure 5.
191
+
192
+ 1. The IndNoise policy collects data by executing random actions sampled from a Normal distribution with standard deviation of 0.2.
193
+ 2. The CorNoise policy collects data by executing random actions sampled from a Ornstein Uhlenbeck process with damping of 0.2, driven by an independent normal noise source with standard deviation 0.2. Each of the 13 actions is sampled from an independent process, with correlation happening only over time.
194
+ 3. The AxEnt policy uses the MPC planner described in Section 5 to maximize the total entropy of the model predictions over a horizon of 100 steps. The objective for the planner is to maximize the Renyi entropy, as described in Section 6.2. ´
195
+ 4. The AxTask policy also uses the MPC planner of Section 5 to collect data, but here the planning objective for data collection is the same as for evaluation.
196
+
197
+ For both of the planning policies we found that adding correlated noise (using the same parameters as the CorNoise policy) to the actions chosen by the planner lead to much better models. Without this source of noise the planners do not generate enough variety in the episodes and the models underperform.
198
+
199
+ We evaluate each model by running several episodes where we plan to achieve maximum fingertip pressure, and show the resulting rewards in Figure 5. Note that the evaluation objective is different than the training objective for all models except AxTask. We do not add additional noise to planned actions when running the evaluation.
200
+
201
+ We also evaluate the awareness of the AxEnt model using the shape diagnostic task from Section 7.2. Figure 6 compares the performance of a diagnostic trained on the AxEnt dynamics model to the passive awareness diagnostic of Section 7.2. The model trained with actively collected data outperforms its passive counterpart in regions of the grasp trajectory where the hand is not in contact with the block.
202
+
203
+ # 7.4 QUALITATIVE EVALUATION
204
+
205
+ In this section we present qualitative results of using a the AxEnt model to execute different objectives through planning. We do this with MPC as described in Section 5.
206
+
207
+ 1. Maximizing entropy of the predictions, as we did during training, leads to exploratory behavior. In Figure 7 we show a typical frame from an entropy maximizing trajectory, as well as typical frames from controlling for two different objectives. 2. Optimizing for fingertip pressure tends to lead to grasping behavior, since the easiest way to achieve pressure on the fingertips is to push them against the target block. There is an alternative solution which is often found where the hand makes a tight fist, pushing its fingertips into its own palm. This is the same as the diagnostic task used in the previous section.
208
+
209
+ ![](images/6c8ab854ef89d219fa2bf7216363e676d704601246610119bab991786c3c7faa.jpg)
210
+ Figure 7: Examples of the hand behaving to maximize uncertainty about the future (top) or minimize uncertainty (bottom). When the hand is trained to maximize uncertainty it engages in playful behavior with the object. The body models learned with this objective, can then be re-used with novel objectives, such as minimizing uncertainty. When doing so, we see that the hand avoids contact so as to minimize uncertainty about future proprioceptive and haptic predictions.
211
+
212
+ 3. Minimizing entropy of the predictions is also quite interesting. This is the negation of the information gathering objective, and it attempts to make future observations as uninformative as possible. Optimizing for this objective results in behavior where the hand consistently pulls away from the target object.
213
+
214
+ Qualitative results from executing each of the above policies are shown in Figures 5 and 7. The behavior when minimizing entropy of the predictions is particularly relevant. The resulting behavior causes the hand to pull away from the target object, demonstrating that the model is aware not only of how to interact with the target, but also how to avoid doing so. Videos of the model in action are available online at https://goo.gl/mZuqAV.
215
+
216
+ # 8 EXPERIMENTS IN THE REAL WORLD
217
+
218
+ We have shown that our models work well in simulation. We now turn to demonstrating that they are effective in reality as well.
219
+
220
+ # 8.1 THE SHADOW HAND ENVIRONMENT
221
+
222
+ We use the 24-joint Shadow Dexterous Hand2 with 20-DOF tendon position control and set up a real life analog of our simulated environment, as shown in Figure 8. Since varying the spatial extents of an object in real life would be very labor intensive we instead use a single object fixed to a turntable that can rotate to any one of 255 orientations, and our diagnostic task in this environment is to recover the orientation of the grasped object.
223
+
224
+ We built a turntable mechanism for orienting the object beneath the hand, and design some randomized grasp trajectories for the hand to close around the block. The object is a soft foam wedge (the shape is chosen to have an unambiguous orientation) and fixed to the turntable. At each episode we turn the table to a randomly chosen orientation and execute two grasp release cycles with the hand robot.
225
+
226
+ # 8.2 DATA COLLECTION
227
+
228
+ Over the course of two days we collected 1140 grasp trajectories in three sessions of 47, 393 and 700 trajectories. We use the 47 trajectories from the initial session as test data, and use the remaining 1093 trajectories for training. Each trajectory is 81 frames long and consists of two grasp-release cycles with the target object at a fixed orientation. At each timestep we measure four different proprioceptive features from the robot:
229
+
230
+ 1. The actions, a set of 20 desired joint positions, sent to the robot for the current timestep. 2. The angles, a set of 24 measured joint positions, reported by the robot at the current timestep. There are more angles than actions because not all joints of the hand are separately actuated, and the measured angles may not match the intended actions due to force limits imposed by the low level controller.
231
+
232
+ ![](images/9d159416987e8eac9d46c8ff0188e1eb9526272cb26ac4ef79069075e8d5416f.jpg)
233
+ Figure 8: Left: The robotic hand setup. Center: Results on predicting block orientation with sensor data recorded from the shadow hand. The upper plot shows the median error as a function of time and the bottom plot shows a bootstrap estimate of the probability that using the model features fails to improve on using sensor measurements directly. Error regions in both plots show $9 5 \%$ confidence intervals, estimated by bootstrap sampling. Right: Predicted angles on test trajectories at step 40 using only sensor readings (top) and model features (bottom). Green lines show predicted angles for individual samples (rotated so ground truth is vertical). The solid and dashed red lines show 50 and 75 percentile error cones, respectively.
234
+
235
+ 3. The efforts, which provide 20 distinct torque readings. Each effort measurement is the signed difference in tension between tendons on the inside and outside of one of the actuated joints.
236
+
237
+ 4. The pressures are five scalar measurements that indicate the pressure experienced by the pads on the end of each finger.
238
+
239
+ Joint ranges of the hand are limited to prevent fingers pushing each other, and the actuator strengths are limited for the safety of the robot and the apparatus. At each grasp-release cycle final grasped and released positions are sampled from handcrafted distributions. Position targets sent to the robot are calculated by interpolating between these two positions in 20 steps.
240
+
241
+ There are multiple complexities the sensor model needs to deal with. First of all once a finger touches the object actual positions and target positions do not match, and the foam object bends and deforms. Also the hand can occasionally overcome the resistance in the turntable motor causing the target object to rotate during the episode (for about 10-20 degrees and rarely more). This creates extra unrecorded source of error in the data.
242
+
243
+ # 8.3 AWARENESS AND DIAGNOSTICS
244
+
245
+ We train a forward model on the collected data, and then treat prediction of the orientation of the block as a diagnostic task. Figure 8 shows that we can successfully predict the orientation of the block from the dynamics model state.
246
+
247
+ # 9 CONCLUSION
248
+
249
+ In this paper we showed that learning a forward predictive model of proprioception we obtain models that can be used to answer questions and reason about objects in the external world. We demonstrated this in simulation with a series of diagnostic tasks where we use the model features to identify properties of external objects, and also with a control task where we show that we can plan in the model to achieve objectives that were not seen during training.
250
+
251
+ We also showed that the same principles we applied to our simulated models are also successful in reality. We collected data from a real robotic platform and used the same modelling techniques to predict the orientation of a grasped block.
252
+
253
+ # ACKNOWLEDGMENTS
254
+
255
+ BA is supported by the National Science Foundation Graduate Research Fellowship Program under Grant No. DGE1252522. We thank Dougal Sutherland and Matthew W. Hoffman for insightful discussions.
256
+
257
+ # REFERENCES
258
+
259
+ Achint Aggarwal, Peter Kampmann, Johannes Lemburg, and Frank Kirchner. Haptic object recognition in underwater and deep-sea environments. Journal of field robotics, 32(1):167–185, 2015.
260
+ Evan Archer, Il Memming Park, Lars Buesing, John Cunningham, and Liam Paninski. Black box variational inference for state space models. arXiv preprint arXiv:1511.07367, 2015.
261
+ John Asmuth, Lihong Li, Michael L Littman, Ali Nouri, and David Wingate. A bayesian sampling approach to exploration in reinforcement learning. In Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, pp. 19–26. AUAI Press, 2009.
262
+ Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014.
263
+ Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems, pp. 1471–1479, 2016.
264
+ Yoshua Bengio. The consciousness prior. arXiv preprint arXiv:1709.08568, 2017.
265
+ Christopher M Bishop. Mixture density networks. 1994.
266
+ Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016.
267
+ Paul Bromiley. Products and convolutions of gaussian probability density functions. Tina-Vision Memo, 3(4): 1, 2003.
268
+ Roberto Calandra, Andrew Owens, Manu Upadhyaya, Wenzhen Yuan, Justin Lin, Edward H. Adelson, and Sergey Levine. The feeling of success: Does touch sensing help predict grasp outcomes? arXiv preprint arXiv:1710.05512, 2017.
269
+ Lele Cao, Ramamohanarao Kotagiri, Fuchun Sun, Hongbo Li, Wenbing Huang, and Zay Maung Maung Aye. Efficient spatio-temporal tactile object recognition with randomized tiling convolutional networks in a hierarchical fusion strategy. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, pp. 3337–3345. AAAI Press, 2016.
270
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015.
271
+ Vlad Ciobanu, Adrian Petrescu, Norman Hendrich, and Jianwei Zhang. Tactile sensor value preprocessing pipeline. In System Theory, Control and Computing (ICSTCC), 2013 17th International Conference, pp. 674–680. IEEE, 2013.
272
+ Ildefons Magrans de Abril and Ryota Kanai. Curiosity-driven reinforcement learning with homeostatic regulation. arXiv preprint arXiv:1801.07440, 2018.
273
+ Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pp. 465–472, 2011.
274
+ Alexey Dosovitskiy and Vladlen Koltun. Learning to act by predicting the future. arXiv preprint arXiv:1611.01779, 2016.
275
+ Carlton Downey, Ahmed Hefny, Byron Boots, Geoffrey J Gordon, and Boyue Li. Predictive state recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 6055–6066, 2017.
276
+ Mark Edmonds, Feng Gao, Xu Xie, Hangxin Liu, Siyuan Qi, Yixin Zhu, Brandon Rothrock, and Song-Chun Zhu. Feeling the force: Integrating force and pose for fluent discovery through imitation learning to open medicine bottles. In International Conference on Intelligent Robots and Systems (IROS), IEEE, 2017.
277
+ Mica R Endsley. Sagat: A methodology for the measurement of situation awareness (nor doc 87-83). Hawthorne, CA: Northrop Corporation, 1987.
278
+ Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential neural models with stochastic layers. In Advances in neural information processing systems, pp. 2199–2207, 2016.
279
+ Justin Fu, Sergey Levine, and Pieter Abbeel. One-shot learning of manipulation skills with online dynamics adaptation and neural network priors. In Intelligent Robots and Systems, 2016.
280
+ Justin Fu, John Co-Reyes, and Sergey Levine. Ex2: Exploration with exemplar models for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2574–2584, 2017.
281
+ Yarin Gal. Uncertainty in deep learning. University of Cambridge, 2016.
282
+ Yang Gao, Lisa Anne Hendricks, Katherine J Kuchenbecker, and Trevor Darrell. Deep learning for tactile understanding from visual and haptic data. In Robotics and Automation (ICRA), 2016 IEEE International Conference on, pp. 536–543. IEEE, 2016.
283
+ Mohammad Ghavamzadeh, Shie Mannor, Joelle Pineau, Aviv Tamar, et al. Bayesian reinforcement learning: A survey. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 8(5-6):359–483, 2015.
284
+ N. Haber, D. Mrowca, L. Fei-Fei, and D. L. K. Yamins. Emergence of Structured Behaviors from CuriosityBased Intrinsic Motivation. ArXiv e-prints, February 2018a.
285
+ N. Haber, D. Mrowca, L. Fei-Fei, and D. L. K. Yamins. Learning to Play with Intrinsically-Motivated SelfAware Agents. ArXiv e-prints, February 2018b.
286
+ Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
287
+ 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.
288
+ Heni Ben Amor Indranil Sur. Robots that anticipate pain: Anticipating physical perturbations from visual cues through deep predictive models. In IROS, 2017.
289
+ Ashesh Jain, Brian Wojcik, Thorsten Joachims, and Ashutosh Saxena. Learning trajectory preferences for manipulators via iterative improvement. In Advances in neural information processing systems, pp. 575– 583, 2013.
290
+ Matthew S Johannes, John D Bigelow, James M Burck, Stuart D Harshbarger, Matthew V Kozlowski, and Thomas Van Doren. An overview of the developmental process for the modular prosthetic limb. Johns Hopkins APL Technical Digest, 30(3):207–216, 2011.
291
+ Maximilian Karl, Justin Bayer, and Patrick van der Smagt. Unsupervised preprocessing for tactile data. arXiv preprint arXiv:1606.07312, 2016.
292
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
293
+ Rahul G Krishnan, Uri Shalit, and David Sontag. Deep kalman filters. arXiv preprint arXiv:1511.05121, 2015.
294
+ Susan J Lederman and Roberta L Klatzky. Hand movements: A window into haptic object recognition. Cognitive psychology, 19(3):342–368, 1987.
295
+ Chang Liu, Fuchun Sun, and Alan Yuille. Haptic object recognition: A recurrent approach.
296
+ Gerald E Loeb. Estimating point of contact, force and torque in a biomimetic tactile sensor with deformable skin. 2013.
297
+ David JC MacKay. Information-based objective functions for active data selection. Neural computation, 4(4): 590–604, 1992.
298
+ Ruben Martinez-Cantin, Nando de Freitas, Eric Brochu, Jose Castellanos, and Arnaud Doucet. A bayesian ´ exploration-exploitation approach for optimal online sensing and planning with a visually guided mobile robot. Autonomous Robots, 27(2):93–103, 2009.
299
+ Georg Martius, Ralf Der, and Nihat Ay. Information driven self-organization of complex robotic behaviors. PloS one, 8(5):e63400, 2013.
300
+ Shakir Mohamed and Danilo J. Rezende. Variational information maximisation for intrinsically motivated reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2125–2133, 2015.
301
+ Stefan Escaida Navarro, Nicolas Gorges, Heinz Worn, Julian Schill, Tamim Asfour, and R ¨ udiger Dillmann.¨ Haptic object recognition for multi-fingered robot hands. In Haptics Symposium (HAPTICS), 2012 IEEE, pp. 497–502. IEEE, 2012.
302
+ Pierre-Yves Oudeyer and Frederic Kaplan. How can we define intrinsic motivation? In Proceedings of the 8th International Conference on Epigenetic Robotics: Modeling Cognitive Development in Robotic Systems, Lund University Cognitive Studies, Lund: LUCS, Brighton. Lund University Cognitive Studies, Lund: LUCS, Brighton, 2008.
303
+ Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? a typology of computational approaches. Frontiers in neurorobotics, 1:6, 2009.
304
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by selfsupervised prediction. In International Conference on Machine Learning (ICML) 2017, 2017.
305
+ Lerrel Pinto, Dhiraj Gandhi, Yuanfeng Han, Yong-Lae Park, and Abhinav Gupta. The curious robot: Learning visual representations via physical interactions. In European Conference on Computer Vision, pp. 3–18. Springer, 2016.
306
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv preprint arXiv:1706.01905, 2017.
307
+ Jurgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building neural con- ¨ trollers. In Proc. of the international conference on simulation of adaptive behavior: From animals to animats, pp. 222–227, 1991.
308
+ Jurgen Schmidhuber. Driven by compression progress: A simple principle explains essential aspects of sub-¨ jective beauty, novelty, surprise, interestingness, attention, curiosity, creativity, art, science, music, jokes. In Workshop on Anticipatory Behavior in Adaptive Learning Systems, pp. 48–76. Springer, 2008.
309
+ Pedro Sequeira, Francisco S Melo, and Ana Paiva. Emotion-based intrinsic motivation for reinforcement learning agents. In International Conference on Affective Computing and Intelligent Interaction, pp. 326–336. Springer, 2011.
310
+ Cyrill Stachniss, Giorgio Grisetti, and Wolfram Burgard. Information gain-based exploration using raoblackwellized particle filters. In Robotics: Science and Systems, volume 2, pp. 65–72, 2005.
311
+ Susanne Still and Doina Precup. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, 131(3):139–148, 2012.
312
+ Jan Storck, Sepp Hochreiter, and Jurgen Schmidhuber. Reinforcement driven information acquisition in non- ¨ deterministic environments. In Proceedings of the international conference on artificial neural networks, Paris, volume 2, pp. 159–164. Citeseer, 1995.
313
+ Zhe Su, Jeremy A Fishel, Tomonori Yamamoto, and Gerald E Loeb. Use of tactile feedback to control exploratory movements to characterize object compliance. Frontiers in neurorobotics, 6, 2012.
314
+ Zhe Su, Karol Hausman, Yevgen Chebotar, Artem Molchanov, Gerald E Loeb, Gaurav S Sukhatme, and Stefan Schaal. Force estimation and slip detection/classification for grip control using a biomimetic tactile sensor. In Humanoid Robots (Humanoids), 2015 IEEE-RAS 15th International Conference on, pp. 297–303. IEEE, 2015.
315
+ Jaeyong Sung, J Kenneth Salisbury, and Ashutosh Saxena. Learning to represent haptic feedback for partiallyobservable tasks. arXiv preprint arXiv:1705.06243, 2017.
316
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. MuJoCo: A physics engine for model-based control. In IROS, pp. 5026–5033, 2012.
317
+ Arun Venkatraman, Nicholas Rhinehart, Wen Sun, Lerrel Pinto, Martial Hebert, Byron Boots, Kris Kitani, and J Bagnell. Predictive-state decoders: Encoding the future into recurrent networks. In Advances in Neural Information Processing Systems, pp. 1172–1183, 2017.
318
+ Fei Wang, Tanveer Syeda-Mahmood, Baba C Vemuri, David Beymer, and Anand Rangarajan. Closed-form jensen-renyi divergence for mixture of gaussians and applications to group-wise shape registration. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 648–655. Springer, 2009.
319
+ Wenhao Yu, Jie Tan, C. Karen Liu, and Greg Turk. Preparing for the unknown: Learning a universal policy with online system identification. In Robotics Science and Systems, 2017.
320
+ Haitian Zheng, Lu Fang, Mengqi Ji, Matti Strese, Yigitcan Ozer, and Eckehard Steinbach. Deep learning for ¨ surface material classification using haptic and visual information. IEEE Transactions on Multimedia, 18 (12):2407–2416, 2016.
321
+
322
+ A DERIVING THE RENYI ´ ENTROPY OF A MIXTURE OF GAUSSIANS
323
+
324
+ $$
325
+ \begin{array} { l } { \displaystyle { H _ { 2 } ( f ) = - \log \int f ( x ) ^ { 2 } \mathrm { d } x } } \\ { \displaystyle { \quad = - \log \int ( \sum _ { i } \alpha _ { i } f _ { i } ( x | \mu _ { i } , \sigma _ { i } ^ { 2 } ) ) ^ { 2 } \mathrm { d } x } } \\ { \displaystyle { \quad = - \log \int \sum _ { i } \sum _ { j } \alpha _ { i } \alpha _ { j } f _ { i } ( x | \mu _ { i } , \sigma _ { j } ^ { 2 } ) f _ { j } ( x | \mu _ { j } , \sigma _ { j } ^ { 2 } ) \mathrm { d } x } } \\ { \displaystyle { \quad = - \log \sum _ { i } \sum _ { j } \alpha _ { i } \alpha _ { j } \int \int ( x | \mu _ { i } , \sigma _ { i } ^ { 2 } ) f _ { j } ( x | \mu _ { j } , \sigma _ { j } ^ { 2 } ) \mathrm { d } x } } \\ { \displaystyle { \quad = - \log \sum _ { i } \sum _ { j } \alpha _ { i } \alpha _ { j } \frac { \exp \{ - \frac { ( \mu _ { i } - \mu _ { j } ) ^ { 2 } } { 2 } \} } { \sqrt { 2 \pi } \sqrt { \sigma _ { j } ^ { 2 } + \sigma _ { j } ^ { 2 } } } \} } } \end{array}
326
+ $$
327
+
328
+ where the last step can be computed with Mathematica, and is also given in Bromiley (2003):
329
+
330
+ Integrate[
331
+ PDF[NormalDistribution[Subscript[\[Mu], i], Subscript[\[Sigma], i]], x]\*PDF[NormalDistribution[Subscript[\[Mu], j], Subscript[\[Sigma], j]], x], {x, -\[Infinity], \[Infinity]},
332
+ Assumptions $- >$ {Subscript[\[Sigma], i] \[Element] Reals, Subscript[\[Sigma], j] \[Element] Reals, Re[Subscript[\[Sigma], i]] > 0, Re[Subscript[\[Sigma], j]] > 0}]
333
+
334
+ # B EXTRA RESULTS
335
+
336
+ Figures 9 and 10 show planned trajectories and model predictions when attempting to maximize fingertip pressure and to minimize predicted entropy, respectively.
337
+
338
+ # C MPL HAND
339
+
340
+ The MPL hand is actuated by 13 motors each capable of exerting a bidirectional force on a single degree of freedom of the hand model. Each finger is actuated by a motor that applies torque to the MCP joint, and the MCP joint of each finger is coupled by a tendon to the PIP and DIP joints of the same finger, causing a single action to flex all joints of the finger together. Abduction of the main digits (ABD) is controlled by two motors attached to the outside of the index and pinky fingers, respectively. Unlike the main digits, the thumb is fully actuated, with separate motors driving each joint. The thumb has its own abduction joint, and somewhat strangely the thumb is composed of three jointed segments (unlike a human thumb which has only two). Each segment is separately controlled for a total of four actuators controlling the thumb. Finally the hand is attached to the world by fully actuated three three degree of freedom wrist joint, for a total of 13 actuators.
341
+
342
+ The hand model includes several sensors which we use as proprioceptive information. We observe the position and velocity of each joint in the model (three joints in the wrist and four in each finger except the middle which has no abduction joint, for a total of 22 joints), as well as the position, velocity and force of each of the 13 actuators. We also record from inertial measurement units (IMUs) located in the distal segment of each of the five fingers. Each IMU records three axis rotational and translational acceleration for a total of 30 acceleration measurements. Finally there are 19 pressure sensors placed throughout the inside of the hand that measure the magnitude of contact forces. Each finger including the thumb has three touch sensors, one on each segment (recall that the thumb has three segments in this model), and the palm of the hand has four different touch sensors that cover different regions. In total these sensors give a 132 dimensional proprioceptive state.
343
+
344
+ ![](images/cbb1a73893ab744e5a10c3f574a4e7f06352c344a6990bf65f1a29dd4a451dee.jpg)
345
+ Figure 9: A visualization of the model planning to maximize predicted fingertip pressure.
346
+
347
+ ![](images/0b240db91d49a42f06676d5b65dfb51ff540c32cf87e0f442c79d455dfd31773.jpg)
348
+ Figure 10: A visualization of the model planning to minimize predicted entropy.
349
+
350
+ Table 1: Hyperparameters for various dynamics models used in the experiments.
351
+
352
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Passive</td><td rowspan=1 colspan=1>Active</td><td rowspan=1 colspan=1>Shadow</td></tr><tr><td rowspan=1 colspan=1>control_embed_depth</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>control_embed_hidden_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>48</td></tr><tr><td rowspan=1 colspan=1>control_embed_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>48</td></tr><tr><td rowspan=1 colspan=1>sensor_embed_depth</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>sensor_embed_hidden_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>31</td></tr><tr><td rowspan=1 colspan=1>sensor_embed_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>31</td></tr><tr><td rowspan=1 colspan=1>preco_hidden_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>34</td></tr><tr><td rowspan=1 colspan=1>mean_depth</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>mean_hidden_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>52</td></tr><tr><td rowspan=1 colspan=1>stddev_depth</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>stddev_hidden_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>122</td></tr><tr><td rowspan=1 colspan=1>likelihood_mixture_depth</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>likelihood_mixture_hidden_size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>60</td></tr><tr><td rowspan=1 colspan=1>likelihood_num_components</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>adam_learning_rate</td><td rowspan=1 colspan=1>0.00025</td><td rowspan=1 colspan=1>0.000436490726736</td><td rowspan=1 colspan=1>0.00195542112406</td></tr><tr><td rowspan=1 colspan=1>num_overshoot_steps</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td></tr></table>
353
+
354
+ # D HYPERPARAMETERS
355
+
356
+ Table 1 shows hyperparameters for several of the models used in the experiments. Some of the hyperparameters (notably the Adam learning rates) are found through random search, so the numbers are quite particular, but the particularity should not be taken as a sign of delicacy. The meaning of each parameter is shown in Figure 11.
357
+
358
+ ![](images/e9eec63be3e9504caef6172b2fe6321e6eba4910642906d8ad933b409422f041.jpg)
359
+ Figure 11: Detailed architecture diagrams of the components of the Preco model, along with labels that indicate different hyperparameters. A MLP sections of the models are parameterised with a depth and a hidden size, where a depth of $d$ and a hidden size of $k$ indicates $d$ hidden layers of size $k$ . We do not count the output layer or the input layer in the depth parameter (so a depth of 0 is a single linear transform followed by an activation function). The output layers of the MLP parts of the model are all indicated separately in the diagrams. The three pieces shown here are attached together in various ways, as shown in Figure 3 in the main body of the paper.
md/train/r1VGvBcxl/r1VGvBcxl.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REINFORCEMENT LEARNING THROUGH ASYN-CHRONOUS ADVANTAGE ACTOR-CRITIC ON A GPU
2
+
3
+ Mohammad Babaeizadeh
4
+ Department of Computer Science
5
+ University of Illinois at Urbana-Champaign, USA
6
+ mb2@uiuc.edu
7
+
8
+ Iuri Frosio, Stephen Tyree, Jason Clemons, Jan Kautz NVIDIA, USA {ifrosio,styree,jclemons,jkautz}@nvidia.com
9
+
10
+ # ABSTRACT
11
+
12
+ We introduce a hybrid CPU/GPU version of the Asynchronous Advantage ActorCritic (A3C) algorithm, currently the state-of-the-art method in reinforcement learning for various gaming tasks. We analyze its computational traits and concentrate on aspects critical to leveraging the GPU’s computational power. We introduce a system of queues and a dynamic scheduling strategy, potentially helpful for other asynchronous algorithms as well. Our hybrid CPU/GPU version of A3C, based on TensorFlow, achieves a significant speed up compared to a CPU implementation; we make it publicly available to other researchers at https://github.com/NVlabs/GA3C.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ In the past, the need for task-specific, or even hand-crafted, features limited the application of Reinforcement Learning (RL) in real world problems (Sutton & Barto, 1998). However, the introduction of Deep Q-Learning Networks (DQN) (Mnih et al., 2015) revived the use of Deep Neural Networks (DNNs) as function approximators for value and policy functions, unleashing a rapid series of advancements. Remarkable results include learning to play video games from raw pixels (Bellemare et al., 2016; Lample & Singh Chaplot, 2016) and demonstrating super-human performance on the ancient board game Go (Silver et al., 2016). Research has yielded a variety of effective training formulations and DNN architectures (van Hasselt et al., 2015; Wang et al., 2015), as well as methods to increase parallelism while decreasing the computational cost and memory footprint (Nair et al., 2015; Mnih et al., 2016). In particular, Mnih et al. (2016) achieve state-of-the-art results on many gaming tasks through a novel lightweight, parallel method called Asynchronous Advantage ActorCritic (A3C). When the proper learning rate is used, A3C learns to play an Atari game (Brockman et al., 2016) from raw screen inputs more quickly and efficiently than previous methods: on a 16- core CPU, A3C achieves higher scores than previously published methods run for the same amount of time on a GPU.
17
+
18
+ Our study sets aside many of the learning aspects of recent work and instead delves into the computational issues of deep RL. Computational complexities are numerous, largely centering on a common factor: RL has an inherently sequential aspect, since the training data are generated while learning. The DNN model is constantly queried to guide the actions of agents whose gameplay in turn feeds DNN training. Training batches are commonly small and must be efficiently shepherded from the agents and simulator to the DNN trainer. When using a GPU, the mix of small DNN architectures, small training batch sizes, and contention for the GPU for both inference and training can lead to a severe under-utilization of the computational resources.
19
+
20
+ To systematically investigate these issues, we implement both CPU and GPU versions of A3C in TensorFlow (TF) (Abadi et al., 2015), optimizing each for efficient system utilization and to approximately replicate published scores in the Atari 2600 environment (Brockman et al., 2016). We analyze a variety of “knobs” in the system and demonstrate effective automatic tuning of those during training. Our hybrid CPU/GPU implementation of A3C, named GA3C, generates and consumes training data substantially faster than its CPU counterpart, up to $\sim 6 \times$ faster for small DNNs and $\sim 4 5 \times$ for larger DNNs. While we focus on the A3C architecture, this analysis can be helpful for researchers and framework developers designing the next generation of deep RL methods.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ Recent advances in deep RL have derived from both novel algorithmic approaches and related systems optimizations. Investigation of the algorithmic space seems to be the most common approach among researchers. Deep Q-Learning Networks (DQN) demonstrate a general approach to the learning problem (Mnih et al., 2015), relying heavily on the introduction of an experience replay memory to stabilize the learning procedure. This improves reliability but also increases the computational cost and memory footprint of the algorithm. Inspired by DQN, researchers have proposed more effective learning procedures, achieving faster and more stable convergence: Prioritized DQN (Schaul et al., 2015) makes better use of the replay memory by more frequently selecting frames associated with significant experiences. Double-DQN (van Hasselt et al., 2015) separates the estimate of the value function from the choice of actions (policy), thus reducing the tendency in DQN to be overly optimistic when evaluating its choices. Dueling Double DQN (Wang et al., 2015) goes a step further by explicitly splitting the computation of the value and advantage functions within the network. The presence of the replay memory makes the DQN approaches more suitable for a GPU implementation when compared to other LR methods, but state-of-the-art results are achieved by A3C (Mnih et al., 2016), which does not make use of it.
25
+
26
+ Among systems approaches, AlphaGo (Silver et al., 2016) recently achieved astonishing results through combined algorithmic and hardware specialization. The computational effort is impressive: 40 search threads, 1202 CPUs, and 176 GPUs are used in the distributed version for inference only. Supervised training took around three weeks for the policy network, using 50 GPUs, and another day using the RL approach for refinement. A similar amount of time was required to train the value network. Gorilla DQN (Nair et al., 2015) is a similarly impressive implementation of distributed RL system, achieving a significant improvement over DQN. The system requires 100 concurrent actors on 31 machines, 100 learners and a central parameter server with the network model. This work demonstrates the potential scalability of deep RL algorithms, achieving better results in less time, but with a significantly increased computational load, memory footprint, and cost.
27
+
28
+ # 3 ASYNCHRONOUS ADVANTAGE ACTOR CRITIC (A3C)
29
+
30
+ # 3.1 REINFORCEMENT LEARNING BACKGROUND
31
+
32
+ In standard RL, an agent interacts with an environment over a number of discrete time steps. At each time step $t$ , the agent observes a state $s _ { t }$ and, in the discrete case, selects an action $a _ { t }$ from the set of valid actions. An agent is guided by policy $\pi$ , a function mapping from states $s _ { t }$ to actions $a _ { t }$ . After each action, the agent observes the next state $s _ { t + 1 }$ and receives feedback in the form of a reward $r _ { t }$ . This process continues until the agent reaches a terminal state or time limit, after which the environment is reset and a new episode is played.
33
+
34
+ The goal of learning is to find a policy $\pi$ that maximizes the expected reward. In policy-based modelfree methods, a function approximator such as a neural network computes the policy $\pi ( { a } _ { t } | { s } _ { t } ; \theta )$ , where $\theta$ is the set of parameters of the function. There are many methods for updating $\theta$ based on the rewarascent on $\mathbb { E } [ R _ { t } ]$ eived fr, where $\begin{array} { r } { R _ { t } = \sum _ { i = 0 } ^ { \infty } \gamma ^ { i } r _ { t + i } } \end{array}$ . REINFORCE methods (Williams, 1992) use grais the accumulated reward starting from time step $t$ ientand increasingly discounted at each subsequent step by factor $\gamma \in ( 0 , 1 ]$ .
35
+
36
+ The standard REINFORCE method updates $\theta$ using the gradient $\nabla _ { \theta } \log \pi ( a _ { t } | s _ { t } ; \theta ) R _ { t }$ , which is an unbiased estimator of $\nabla _ { \boldsymbol { \theta } } \mathbb { E } [ R _ { t } ]$ . The variance of the estimator is reduced by subtracting a learned baseline (a function of the state $b _ { t } ( s _ { t } ) )$ and using the gradient $\nabla _ { \theta } \log \pi ( a _ { t } | s _ { t } ; \theta ) \big ( R _ { t } ~ - ~ b _ { t } ( s _ { t } ) \big )$ instead. One common baseline is the value function defined as $V ^ { \pi } ( s _ { t } ) = \mathbb { E } [ R _ { t } | s _ { t } ]$ which is the expected return for following the policy $\pi$ in state $s _ { t }$ . In this approach the policy $\pi$ and the baseline $b _ { t }$ can be viewed as actor and critic in an actor-critic architecture (Sutton $\&$ Barto, 1998).
37
+
38
+ # 3.2 ASYNCHRONOUS ADVANTAGE ACTOR CRITIC (A3C)
39
+
40
+ A3C (Mnih et al., 2016), which achieves state-of-the-art results on many gaming tasks including Atari 2600, uses a single DNN to approximate both the policy and value function. The DNN has two convolutional layers with $1 6 \times 8 \times 8$ filters with a stride of 4, and $3 2 \times 4 \times 4$ filters with a stride of 2, followed by a fully connected layer with 256 units; each hidden layer is followed by a rectifier nonlinearity. The two outputs are a softmax layer which approximates the policy function $\pi \left( a _ { t } | s _ { t } ; \theta \right)$ , and a linear layer to output an estimate of $V \left( s _ { t } ; \theta \right)$ . Multiple agents play concurrently and optimize the DNN through asynchronous gradient descent. Similar to other asynchronous methods, the network weights are stored in a central parameter server (Figure 1a). Agents calculate gradients and send updates to the server after every $t _ { m a x } = 5$ actions, or when a terminal state is reached. After each update, the central server propagates new weights to the agents to guarantee they share a common policy.
41
+
42
+ Two cost functions are associated with the two DNN outputs. For the policy function, this is:
43
+
44
+ $$
45
+ f _ { \pi } \left( \theta \right) = \log \pi \left( a _ { t } | s _ { t } ; \theta \right) \left( R _ { t } - V \left( s _ { t } ; \theta _ { t } \right) \right) + \beta H \left( \pi \left( s _ { t } ; \theta \right) \right) ,
46
+ $$
47
+
48
+ where estima $\theta _ { t }$ are the values of the parameters discounted reward in the time i $\theta$ at time erval fro $t$ , $\begin{array} { r } { R _ { t } = \sum _ { i = 0 } ^ { k - 1 } \gamma ^ { i } r _ { t + i } + \gamma ^ { k } V \left( s _ { t + k } ; \theta _ { t } \right) } \end{array}$ $t$ $t + k$ $k$ $t _ { m a x }$ while $H \left( \pi \left( s _ { t } ; \boldsymbol { \theta } \right) \right)$ is an entropy term, used to favor exploration during the training process. The factor $\beta$ controls the strength of the entropy regularization term. The cost function for the estimated value function is:
49
+
50
+ $$
51
+ f _ { v } \left( \theta \right) = \left( R _ { t } - V \left( s _ { t } ; \theta \right) \right) ^ { 2 } .
52
+ $$
53
+
54
+ Training is performed by collecting the gradients $\nabla \theta$ from both of the cost functions and using the standard non-centered RMSProp algorithm (Tieleman $\&$ Hinton, 2012) as optimization:
55
+
56
+ $$
57
+ \begin{array} { l } { g = \alpha g + ( 1 - \alpha ) \Delta \theta ^ { 2 } } \\ { \theta \theta - \eta \Delta \theta / \sqrt { g + \epsilon } . } \end{array}
58
+ $$
59
+
60
+ The gradients $g$ can be either shared or separated between agent threads but the shared implementation is known to be more robust (Mnih et al., 2016).
61
+
62
+ The original implementation of A3C (Mnih et al., 2016) uses 16 agents on a 16 core CPU and it takes about four days to learn how to play an Atari game (Brockman et al., 2016). The main reason for using CPU other than GPU, is the inherently sequential nature of RL in general, and A3C in particular. In RL, the training data are generated while learning, which means the training and inference batches are small and GPU is mostly idle during the training, waiting for new data to arrive. Since A3C does not utilize any replay memory, it is completely sequential and therefore a CPU implementation is as fast as a naive GPU implementation.
63
+
64
+ # 4 HYBRID CPU/GPU A3C (GA3C)
65
+
66
+ We propose GA3C, an alternative architecture of A3C, with emphasize on an efficient GPU utilization to increase the number of training data generated and processed per second. We demonstrate that our implementation of GA3C effectively converges significantly faster than our CPU implementation of A3C, achieving the state-of-the-art performance in a shorter time.
67
+
68
+ # 4.1 GA3C ARCHITECTURE
69
+
70
+ The primary components of GA3C (Figure 1b) are a DNN with training and prediction on a GPU, as well as a multi-process, multi-thread CPU architecture with the following components:
71
+
72
+ • Agent is a process interacting with the simulation environment: choosing actions according to the learned policy and gathering experiences for further training. Similar to A3C, multiple concurrent agents run independent instances of the environment. Unlike the original, each agent does not have its own copy of the model. Instead it queues policy requests in a Prediction Queue before each action, and periodically submits a batch of input/reward experiences to a Training Queue; the size of each training batch is typically equal to $t _ { m a x }$ experiences, though it is sometimes smaller for experiences collected at the end of an episode.
73
+
74
+ ![](images/d529a55a2458aed93556db2b17245be6121593b3507fa86dc39534060ea4695e.jpg)
75
+ Figure 1: Comparison of A3C and GA3C architectures. Agents act concurrently both in A3C and GA3C. In A3C, however, each agent has a replica of the model, whereas in GA3C there is only one GPU instance of the model. In GA3C, agents utilize predictors to query the network for policies while trainers gather experiences for network updates.
76
+
77
+ • Predictor is a thread which dequeues as many prediction requests as are immediately available and batches them into a single inference query to the DNN model on the GPU. When predictions are completed, the predictor returns the requested policy to each respective waiting agent. To hide latency, one or more predictors can act concurrently.
78
+
79
+ • Trainer is a thread which dequeues training batches submitted by agents and submits them to the GPU for model updates. GPU utilization can be increased by grouping training batches among several agents; we found that this generally leads to a more stable convergence, but the convergence speed is reduced when the merged training batches are too large; a compromise is explored in Section 5.3. Multiple trainers may run in parallel to hide latency.
80
+
81
+ Unlike A3C, GA3C maintains only one copy of the DNN model (Fig. 1a and 1b), centralizing predictions and training updates and removing the need for synchronization. Also, in comparison with A3C, agents in GA3C do not compute the gradients themselves. Instead, they send experiences to trainers that update the network on the GPU accordingly. This introduces a potential lag between the generation and consumption of experiences, which we analyze in detail in Sections 4.4 and 5.3.
82
+
83
+ # 4.2 PERFORMANCE METRICS AND TRADE-OFFS
84
+
85
+ The GA3C architecture exposes numerous tradeoffs for tuning its computational efficiency. In general, it is most efficient to transfer data to a GPU in large enough blocks to maximize the usage of the bandwidth between the GPU and CPU. Application performance on the GPU is optimized when the application has large amounts of parallel computations that can hide the latency of fetching data from memory. Thus, we want to maximize the parallel computations the GPU is performing, maximize the size of data transfer to the GPU, and minimize the number of transfers to the GPU. Increasing the number of predictors, $N _ { P }$ , allows faster fetching prediction queries, but leads to smaller prediction batches, resulting in multiple data transfers and overall lower GPU utilization. A larger number of trainers, $N _ { T }$ , potentially leads to more frequent updates to the model, but an overhead is paid when too many trainers occupy the GPU while predictors cannot access it. Lastly, increasing the number of agents, $N _ { A }$ , ideally generates more training experiences while hiding prediction latency. However, we would expect diminishing returns from unnecessary context switching overheads after exceeding some threshold depending on the number of CPU cores.
86
+
87
+ These aspects are well captured by a metric like the Trainings Per Second (TPS), which is the rate at which we remove batches from the training queue. It corresponds to the rate of model updates and it is approximately proportional to the overall learning speed, given a fixed learning rate and training batch size. Another metric is the Predictions Per Second (PPS), the rate of issuing prediction queries from prediction queue, which maps to the combined rate of gameplay among all agents. Notice that in A3C a model update occurs every time an agent plays $t _ { m a x } = 5$ actions (Mnih et al., 2016).
88
+
89
+ ![](images/8281b416d1f3ce3805668c76149925533dd6d5611570574cd211760bedb0fd40.jpg)
90
+ Figure 2: Automatic dynamic adjustment of $N _ { T }$ , $N _ { P }$ , and $N _ { A }$ , to maximize TPS for BOXING (left) and PONG (right), starting from a sub-optimal configuration $( N _ { A } = N _ { T } = N _ { P } = 1 )$ )
91
+
92
+ Hence, in a balanced configuration, $\mathrm { P P S } \approx \mathrm { T P S } \times t _ { m a x }$ . Since each action is repeated four times as in (Mnih et al., 2016), the number of frames per second is $4 \times \mathrm { P P S }$ .
93
+
94
+ Computational aspects are not disconnected from the convergence of the learning algorithm. For instance, employing too many agents will tend to fill the training queue, introducing a significant time delay between agent experiences $( a _ { t } , ~ s _ { t }$ and $R _ { t }$ in Eq. (1)) and the corresponding model updates, possibly threatening model convergence (see Section 4.4). Another example is batching of training data: larger batches improves GPU occupancy by increasing the parallelism. They also decrease the TPS (i.e., the number of model updates per second), increasing the chance that the DNN model used in prediction and to compute the gradient in Eq. (4) are indeed the same model. The consequence (experimentally observed, see Section 5.3) is an increased stability of the learning process but, beyond a certain training batch size, this leads to a reduction in the convergence speed. In short, $N _ { T }$ , $N _ { P }$ , and $N _ { A }$ encapsulate many complex dynamics relating both computational and convergence aspects of the learning procedure. Their effect on the convergence of the learning process has to be measured by analyzing not only TPS but also the learning curves.
95
+
96
+ # 4.3 DYNAMIC ADJUSTMENT OF TRADE-OFFS
97
+
98
+ The setting of $N _ { P }$ , $N _ { T }$ and $N _ { A }$ that maximizes the TPS depends on many aspects such as the computational load of the simulation environment, the size of the DNN, and the available hardware. As a rule of thumb, we found that the number of agents $N _ { A }$ should at least match the available CPU cores, with two predictors and two trainers $N _ { P } = N _ { T } = 2$ . However, this rule hardly generalizes to a large variety of different situations and only occasionally corresponds to the computationally most efficient configuration. Therefore, we propose an annealing process to configure the system dynamically. Every minute, we randomly change $N _ { P }$ , $N _ { T }$ , or $N _ { A }$ by $\pm 1$ , monitoring alterations in TPS to accept or reject the new setting. The optimal configuration is then automatically identified in a reasonable time, for different environments or systems. Figure 2 shows the automatic adjustment procedure finding two different optimal settings for two different games, on the same real system.
99
+
100
+ # 4.4 POLICY LAG IN GA3C
101
+
102
+ At a first sight, GA3C and A3C are different implementations of the same algorithm, but GA3C has a subtle difference which affects the stability of the algorithm. This problem is caused by the latency between the time $t - k$ , when a training example has been generated, and when it is consumed for training, $t$ , essentially changing the gradients to:
103
+
104
+ $$
105
+ \nabla _ { \theta } \left[ \log \pi \left( a _ { t - k } | s _ { t - k } ; \theta \right) \left( R _ { t - k } - V \left( s _ { t - k } ; \theta _ { t } \right) \right) + \beta H \left( \pi \left( s _ { t - k } ; \theta \right) \right) \right] .
106
+ $$
107
+
108
+ Since the Training Queue is not blocking, the states it contains can be old. The value of the delay $k$ is bounded by the maximum size of the queue and influenced by how the system configuration balances training and prediction rates. In other words, the DNN controller selects the action $a _ { t - k }$ at time $t - k$ ; the corresponding experience lies in a training queue until time $t$ , when a trainer thread pops the element out of the queue to compute the gradient as in Eq. (4). The DNN controller at time $t$ generally differs from the one at time $t - k$ , since trainers can modify the DNN weights at any time. Therefore, the policy and value function $\pi$ and $V$ used to compute the gradient at time $t$ will differ from those used at time $t - k$ to collect the experience, whereas the action used to compute the gradient in Eq. (4) remains $a _ { t - k }$ .
109
+
110
+ This delay can lead to instabilities for two reasons. The first one is the possible generation of very large values in $\log \pi \left( a _ { t - k } | s _ { t - k } ; \theta _ { t } \right)$ . In fact, $\pi \left( a _ { t - k } | s _ { t - k } ; \theta _ { t - k } \right)$ is generally large, since it is the probability of sampled action $a _ { t - k }$ , but over the course of lag $k$ new parameters $\theta _ { t }$ can make $\pi \left( a _ { t - k } | s _ { t - k } ; \theta _ { t } \right)$ very small. In the worst case, the updated probability is zero, generating infinite values in the log and causing optimization to fail. To avoid this, we add a small term $\epsilon > 0$ :
111
+
112
+ $$
113
+ \nabla _ { \theta } \left[ \log \left( \pi \left( a _ { t - k } \middle | s _ { t - k } ; \theta \right) + \epsilon \right) \left( R _ { t - k } - V \left( s _ { t - k } ; \theta _ { t } \right) \right) + \beta H \left( \pi \left( s _ { t - k } ; \theta \right) + \epsilon \right) \right] .
114
+ $$
115
+
116
+ Beyond fixing the error in the case $\pi = 0$ , this fix also improves the stability of the algorithm and removes the necessity of gradient clipping. In fact, as $\bar { \partial \log ( \pi + \epsilon ) } / \partial \theta \stackrel { - } { = } ( \partial \pi / \partial \theta ) \bar { / } ( \pi + \epsilon ) ,$ $\epsilon$ establishes an upper bound for the multiplicative factor in front of $\partial \pi / \partial \theta$ . A similar term is also added in the entropy computation to avoid a similar explosion. It is important to remember that even A3C suffers from a similar issue. In fact, as the action $a _ { t }$ in Eq. (1) is selected by sampling the output softmax, there is a chance that $\pi ( { a } _ { t } )$ is very small and therefore $\partial \log ( \pi ) / \dot { \partial } \theta$ is large. However, gradient clipping prevents the usage of a gradient with large magnitude in A3C.
117
+
118
+ The second reason for introducing instabilities in GA3C is a generalization of the first one. Since training and predictions are computed with potentially different DNN parameters, the resulting gradient is noisy, and can therefore lead to unreliable updates of the DNN weights. This is different from A3C, where every agent has its own copy of the model and uses it to compute both $\pi$ and $\partial \log ( \pi ) / \partial \theta$ , before synchronizing the DNN model with the other agents.
119
+
120
+ # 5 ANALYSIS
121
+
122
+ We profile the performance of GA3C and in the process seek to better understand the system dynamics of deep RL training on hybrid CPU/GPU systems. Experiments are conducted on the GPUenabled systems described in Table 1 and monitored with CUDA profilers and custom profiling code based on performance counter timing within Python. We present profiling and convergence experiments both with and without automatic adjustment of the number of agents $N _ { A }$ , trainers $N _ { T }$ , and predictors $N _ { P }$ , and without constraints on the size of the prediction and training queues.
123
+
124
+ ![](images/06e9c560da6d5f597629e0687072ccae3030c4959e8c93f01c05686c94f37056.jpg)
125
+ Figure 3: TPS of the top three configurations of predictors $N _ { P }$ and trainers $N _ { T }$ for several settings of agents $N _ { A }$ , while learning PONG on System I from Table 1. TPS is normalized by best performance after 16 minutes. Larger DNN models are also shown, as described in the text.
126
+
127
+ # 5.1 EFFECT OF RESOURCE UTILIZATION ON TPS
128
+
129
+ Maximizing training speed. To begin, consider raw training speed as expressed in model update frequency, or trainings per second (TPS). Figure 3 shows TPS on System I in Table 1 for the first 16 minutes of training on PONG. We consider numbers of agents $N _ { A } \dot { \in } \{ 1 6 , 3 2 , 6 4 , 1 2 8 \}$ and plot the top 3 combinations of $N _ { P } , N _ { T } \in \{ 1 , 2 , 4 , 8 , 1 6 \}$ . On this system, increasing $N _ { A }$ yields a higher TPS up to $N _ { A } = 1 2 8$ where diminishing returns are observed, likely due to additional process overhead. The highest consistent TPS on this system is observed with $N _ { A } = 1 2 8$ and $N _ { P } = N _ { T } = 2$ with a speed-up of $\sim 4 \times$ relative to the CPU-only implementation (see Table 2).
130
+
131
+ ![](images/526023fd63c04b3b1262fd781abadbb999851fc3930efcd55d5e279396a31e95.jpg)
132
+ Figure 4: The average training queue size (left) and prediction batch size (right) of the top 3 performing configurations of $N _ { P }$ and $N _ { T }$ , for each $N _ { A }$ , with PONG and the System I in Table 1.
133
+
134
+ Table 1: Systems used for profiling and testing.
135
+
136
+ <table><tr><td></td><td>System I</td><td>System II</td><td>System III</td><td>System IV</td></tr><tr><td>Processor (Intel)</td><td>Xeon E5-2640v3 2.60 GHz 16 cores,dual socket</td><td>Core i-3820 3.60 GHz 8cores</td><td>HaswellE5-2698v3 2.30 GHz 16 cores</td><td>Xeon E5-2680v2 2.80 GHz 10 cores</td></tr><tr><td>GPU (NVIDIA)</td><td>Geforce Titan X (Maxwell)</td><td>GeForce 980 (Maxwell)</td><td>Tesla K80 (Kepler)</td><td>Quadro M6000 (Maxwell)</td></tr><tr><td>Software / Profilers</td><td colspan="4">Python 3.5,CUDA 7.5 (I-II)/CUDA 8 (IV), CUDNN v5.1,TensorFlow r0.11 nvprof, nvvp</td></tr></table>
137
+
138
+ GPU utilization and DNN size. The fastest configuration ( $N _ { A } = 1 2 8$ , $N _ { P } = N _ { T } = 2 $ ) for System I in Table 1 has an average GPU utilization time of only $5 6 \%$ , with average and peak occupancy of $7 6 \%$ and $9 8 \%$ , respectively.1 This suggests there is computational capacity for a larger network model. Therefore we profile GA3C on a series of deeper DNN architectures2 to evaluate this hypothesis. Figure 3 shows that TPS drops by only $7 \%$ with a one-layer deeper DNN controller; at the same time, the
139
+
140
+ Table 2: PPS on different systems (Table 1), for small and large DNNs, with CPU and GPU utilization for GA3C.
141
+
142
+ <table><tr><td></td><td></td><td colspan="3">PPS</td><td colspan="2">Utilization (%)</td></tr><tr><td>System</td><td>DNN</td><td>A3C</td><td>GA3C</td><td>Speed up</td><td>CPU</td><td>GPU</td></tr><tr><td rowspan="5">System I</td><td>small</td><td>352</td><td>1361</td><td>4×</td><td>32</td><td>56</td></tr><tr><td>large, stride 4</td><td>113</td><td>1271</td><td>11×</td><td>27</td><td>68</td></tr><tr><td>large,stride 3</td><td>97</td><td>1206</td><td>12×</td><td>27</td><td>77</td></tr><tr><td>large, stride 2</td><td>43</td><td>874</td><td>20×</td><td>26</td><td>82</td></tr><tr><td>large, stride 1</td><td>11</td><td>490</td><td>45×</td><td>17</td><td>90</td></tr><tr><td rowspan="2">System II</td><td>small</td><td>116</td><td>728</td><td>6×</td><td>62</td><td>33</td></tr><tr><td>large, stride 1</td><td>12</td><td>336</td><td>28×</td><td>49</td><td>78</td></tr><tr><td rowspan="2">System III</td><td>small</td><td>300</td><td>1248</td><td>4×</td><td>31</td><td>60</td></tr><tr><td>large, stride 1</td><td>38</td><td>256</td><td>6×</td><td>17</td><td>82</td></tr></table>
143
+
144
+ average GPU utilization and occupancy increase by approximately $1 2 \%$ and $0 . 5 \%$ , respectively. The $7 \%$ drop in TPS is the consequence of the increased depth which forces an additional serial computational on the GPU (and therefore a $1 2 \%$ increase in its utilization). The negligible $0 . 5 \%$ increase in occupancy is likely explained by an efficient management of the computational resources by cuDNN; there is still room available to run additional parallel tasks (or, in other words, a wider DNN) at minimal cost.
145
+
146
+ ![](images/ad0b179398676c633b7b47258fc7efaa5686750f4af3d0d5760ee3d128420c30.jpg)
147
+ Figure 5: Effect of PPS on convergence speed. For each game, four different settings of GA3C are shown, all starting from the same DNN initialization. Numbers on the right show the cumulative number of frames played among all agents for each setting over the course of 3 hours. Configurations playing more frames converge faster. The dynamic configuration method is capable of catching up with the optimal configuration despite starting with a sub-optimal setting, $N _ { T } = N _ { P } = N _ { A } = 1$ .
148
+
149
+ By reducing the stride of the first layer of the DNN (in addition to adding a convolutional layer), we scale DNN size with finer granularity, and we compare FPS between GA3C and our CPU implementation of A3C. Table 2 shows the speed up provided by GA3C increases as the DNN grows. This is mainly due to increasing GPU utilization, as reported in Table 2. With the largest DNN, our CPU implementation achieves $\mathrm { T P S } \approx 1 1$ , which is approximately $4 5 \times$ slower than GA3C. This behavior is consistent across different systems, as shown in Table 2, where the CPU implementation of A3C using the largest DNN with stride 1 is $7 \times$ (System III) to $3 2 \times$ (System I) slower than the small network. Scaling with DNN size is more favorable on a GPU, with a slow down factor of $4 . 9 \times$ in the worst case (System III) and $2 . 2 \times$ in the best case (System II). Further, more recent GPUs (Maxwell architecture) scale better ( $2 . 2 \times$ and $2 . 7 \times$ slow down for Systems I and II) than older GPUs $( 4 . 8 \times$ slow down for the Kepler architecture, System III).
150
+
151
+ Generally speaking, for large DNNs, maximum TPS and FPS are achieved by intensively using the GPU for prediction and training, while the CPU runs the simulation environment and remains mostly idle. In practice, this allows experimenting with larger architectures, which may be particularly important for real world problems, e.g. robotics or autonomous driving (Lillicrap et al., 2015). Moreover, the idle CPU represents an additional computational resource, but such investigation is beyond the scope of this paper.
152
+
153
+ Significant latency. Profiling on System I in Table 1 reveals that the average time spent by an agent waiting for a prediction call to be completed is $1 0 8 \mathrm { m s }$ , only $1 0 \%$ of which is taken by the GPU inference. The remaining $9 0 \%$ is overhead spent accumulating the batch and calling the prediction function in Python. Similarly, for training we find that of the average 11.1ms spent performing a DNN update, $5 9 \%$ is overhead. This seems to suggest that a more optimized implementation (possibly based on a low level language like $\mathrm { C } { + + }$ ) may reduce these overheads, but this investigation remains for future work.
154
+
155
+ Manually balancing components. Agents, predictors, and trainers all share the GPU as a resource; thus balance is important. Figure 3 shows the top three performing configurations of $N _ { P }$ and $N _ { T }$ for different numbers of agents, $N _ { A }$ , with System I in Table 1. A $1 4 \%$ drop in TPS is exhibited between the best and worst depicted configuration, despite the exclusion of all but the top three performers for each number of agents. The best results have 4 or fewer predictor threads, seemingly preventing batches from becoming too small. The $N _ { P } : N _ { T }$ ratios for top performers tend to be $1 : 2 , 1 : 1$ , or $2 : 1$ , whereas higher ratios such as $1 : 8$ and $1 : 4$ are rarely successful, likely due to the implicit dependence of training on prediction speed. However, if the training queue is too full, training calls take more GPU time, thereby throttling prediction speed. This is further confirmed by our experimental finding that TPS and PPS plots track closely. Figure 4 shows training queue size and prediction batch size for the top configurations. In all cases, the training queue stabilizes well below its maximum capacity. Additionally, the fastest configuration has one of the largest average prediction batch sizes, yielding higher GPU utilization.
156
+
157
+ <table><tr><td></td><td colspan="8">Atari Game Scores</td><td colspan="2">Attributes</td></tr><tr><td></td><td>AMIDAR BOXING CENTIPEDE</td><td></td><td></td><td>NAME THISGAME</td><td>PACMANPONG</td><td></td><td>QBERT SEAQUEST</td><td>UP-DOWN</td><td>Time</td><td>System</td></tr><tr><td>Human</td><td>1676</td><td>10</td><td>10322</td><td>6796</td><td>15375</td><td>16 12085</td><td>40426</td><td>9896</td><td></td><td>1</td></tr><tr><td>Random</td><td>6</td><td>-2</td><td>1926</td><td>198</td><td>1748</td><td>-18 272</td><td>216</td><td>533</td><td></td><td>1</td></tr><tr><td>A3C</td><td>264</td><td>60</td><td>3756</td><td>10476</td><td>654</td><td>6 15149</td><td>2355</td><td>74706</td><td>4 days</td><td>CPU</td></tr><tr><td>GA3C</td><td>218</td><td>92</td><td>7386</td><td>5643</td><td>1978</td><td>18 14966</td><td>1706</td><td>8623</td><td>1day</td><td>GPU</td></tr></table>
158
+
159
+ Table 3: Average scores on a subset of Atari games achieved by: a random player (Mnih et al., 2015); a human player (Mnih et al., 2015); A3C after four days of training on a CPU (Mnih et al., 2016); and GA3C after one day of training. For GA3C, we measured the average score on 30 games, each initialized with a random seed.
160
+
161
+ # 5.2 EFFECT OF TPS ON LEARNING SPEED
162
+
163
+ The beneficial effect of an efficient configuration on the training speed is shown in Figure 5. Training with a suboptimal configuration (e.g. $N _ { P } = N _ { T } = N _ { A } = 1$ or $N _ { P } = N _ { T } = 1$ , $N _ { A } = 1 6$ ) leads to a severe underutilization of the GPU, a low TPS, and a slow training process. Using the optimal configuration achieves a much higher score in a shorter period of time, mainly driven by playing more frames, i.e. collecting more experiences, in the same amount of time.
164
+
165
+ Mnih et al. (2016) note that asynchronous methods generally achieve significant speedups from using a greater number of agents, and even report superlinear speedups for asynchronous one-step Q-learning. It is worth noting that optimal configurations for GA3C generally employ a much higher number of agents compared to the CPU counterpart, e.g. the optimal configuration for System I in Table 1 uses 128 agents. This suggests that GPU implementations of asynchronous learning methods may benefit from both a higher TPS and from collecting experiences from a wider number of agents.
166
+
167
+ The learning curve for GA3C with dynamic configuration (Figure 5) tracks closely with the learning curve of the optimal configuration. The total number of frames played is generally slightly lower over the same time due to the search procedure overhead: the configuration is changed once every minute, tending to oscillate around the optimal configuration. Notice also that, in Figure 5, the starting point of the dynamic configuration is $N _ { T } = N _ { P } = N _ { A } = 1$ , which is much slower than the optimal configuration. But scoring performance is nearly identical, indicating that the dynamic method may ease the burden of configuring GA3C on a new system.
168
+
169
+ Table 3 compares scores achieved by A3C on the CPU (as reported in (Mnih et al., 2016)) with the best agent trained by our TensorFlow implementation of GA3C. Unfortunately, a direct speed comparison is infeasible without either the original source code or the average number of frames or training updates per second. However, results in this table do show that after one day of training our open-source implementation can achieve similar scores to A3C after four days of training.
170
+
171
+ Figure 6 shows typical training curves for GA3C on several Atari games as a function of wallclock time. When compared to the training curves reported in Mnih et al. (2016), GA3C shows faster convergence toward the maximum score in a shorter time for certain games such as PONG, convergence towards a better score in a larger amount of time (e.g. QBERT) or, for other games, a slower convergence rate (e.g. BREAKOUT). It has to be noted, however, that data reported by Mnih et al. (2016) are the average learning curves of the top five learners in a set of fifty learners, each with a different learning rate. On the other hand, in Figure 6, we are reporting three different runs for two (not essentially optimal) learning rates, fixed for all the games. This demonstrates some robustness of GA3C with respect to the choice of the learning rate, whereas it is also likely that better learning curves can be obtained using optimized learning rates. A deeper investigation on a large amount of data, potentially facilitated by our release of the GA3C code, may also reveal how peculiarities of each game differently affect the convergence of A3C and GA3C, but this goes beyond the scope of this paper.
172
+
173
+ # 5.3 POLICY LAG, LEARNING STABILITY AND CONVERGENCE SPEED
174
+
175
+ One of the main differences between GA3C and A3C is the asynchronous computation of the forward step (policy $\pi$ ) and the gradients (Eq. (4)) used to update the DNN. Delays between these two operations may introduce noise in the gradients, making the learning process unstable. We experimentally investigated the impact of this asynchrony on the learning process to determine if a synchronization mechanism, which may negatively impact both PPS and TPS, can increase the stability of the algorithm.
176
+
177
+ ![](images/0c16b7d73245082b17a8e33dba0e2a6872587f179bdffd9c7e929b578017e41b.jpg)
178
+ Figure 6: Training curves for GA3C on five Atari games. Each training has been performed three times for each of two learning rates (0.0003 and 0.0001) on System IV in Table 1.
179
+
180
+ ![](images/e18b30807e242a8195c95e4286f18a813a54e1147dbd6401fa2dfaaca1809132.jpg)
181
+ Figure 7: Training GA3C with a range of minimum training batch sizes. Increasing the minimum training batch size from 1 to 40 reduces the effect of the policy lag (delay $k$ in Eq. (4)), leading to convergence that is faster and more stable. GA3C achieved the overall best results with a minimum batch size between 20 and 40. Increasing beyond this threshold dramatically reduces convergence speed for some games, especially those inclined to unstable learning curves.
182
+
183
+ In GA3C, each agent generally pushes $t _ { m a x }$ experiences in the training queue. By default, trainers collect a batch of experiences from a single agent from the training queue and send the batch to the GPU to compute gradients, as in Eq. (5). Each time a trainer updates the DNN weights, the remaining experiences in the training queue are no longer in sync with the DNN model. This situation becomes worse when the average length of the training queue is large.
184
+
185
+ By allowing larger training batch sizes, we reduce the number of DNN updates per second (TPS), and consequently diminish the effect of the delay $k$ in Eq. (5). In this way we increase the chance that the collected experiences and the computed gradients are in sync, which improves the stability. Notice that, even if the TPS is lower, the average magnitude of the updates is indeed larger, since we sum the gradients computed over the training batch.
186
+
187
+ In this setting, the optimal training batch size compromises among TPS, the average gradient step magnitude and the training stability. Another factor to be considered is that batching training data potentially leverages the GPU computational capability better by reducing the time devoted to compute the DNN updates while increasing the GPU occupancy during this phase. This gives more GPU time to the predictors, potentially increasing the PPS. However, this advantage tends to disappear when the training batch size is too large and predictors stay idle while the DNN update is computed.
188
+
189
+ Figure 7 compares convergence curves when no minimum size for training batch is compulsory (the default GA3C implementation where gradient updates are computed on a single agent’s batch) and when a minimum training batch size is enforced (combining multiple agent batches into a single gradient update). In the latter case, trainers collect experiences from multiple agents at the same time from the training queue and send them to the GPU for computation of gradients as in Eq. (5). Up to a certain batch size (between 20 and 40, in our experiments), increasing the training batch size stabilizes the learning procedure and generally leads to faster convergence. Some games such as PONG indeed do not suffer from this instability, and the effect of the minimum batch size is less evident in this case. We speculate that a careful selection of the learning rate combined with the proper minimum training batch size may lead to even faster convergence.
190
+
191
+ # 6 CONCLUSION
192
+
193
+ By investigating the computational aspects of our hybrid CPU/GPU implementation of GA3C, we achieve a significant speed up with respect to its CPU counter part. This comes as a result of a flexible system capable of finding a reasonable allocation of the available computational resources. Our approach allows producing and consuming training data at the maximum pace on different systems, or to adapt to temporal changes of the computational load on one system. Despite the fact that we analyze A3C only, most of our findings can be applied to similar RL asynchronous algorithms.
194
+
195
+ We believe that the analysis of the computational aspects of RL algorithms may be a consistent theme in RL in the future, motivating further studies such as this one. The potential benefits of such investigation goes well beyond the computational aspects. For instance, we demonstrate that GA3C scales with the size of the DNN much more efficiently than our CPU implementation of A3C, thus opening the possibility to explore the use of large DNN controllers to solve real world RL problems.
196
+
197
+ By open sourcing GA3C (see https://github.com/NVlabs/GA3C), we allow other researchers to further explore this space, investigate in detail the computational aspects of deep RL algorithms, and test new algorithmic solutions, including strategies for the combined utilization of the CPU and GPU computational resources.
198
+
199
+ # ACKNOWLEDGMENTS
200
+
201
+ We thank Prof. Roy H. Campbell for partially supporting this work.
202
+
203
+ # REFERENCES
204
+
205
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
206
+
207
+ M. G. Bellemare, S. Srinivasan, G. Ostrovski, T. Schaul, D. Saxton, and R. Munos. Unifying CountBased Exploration and Intrinsic Motivation. ArXiv e-prints, June 2016.
208
+
209
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
210
+
211
+ G. Lample and D. Singh Chaplot. Playing FPS Games with Deep Reinforcement Learning. ArXiv e-prints, September 2016.
212
+
213
+ 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. CoRR, abs/1509.02971, 2015. URL http://arxiv.org/abs/1509.02971.
214
+
215
+ V. Mnih, A. Puigdomenech Badia, M. Mirza, A. Graves, T. P. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous Methods for Deep Reinforcement Learning. ArXiv preprint arXiv:1602.01783, 2016.
216
+
217
+ 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, 02 2015. URL http://dx.doi.org/10.1038/ nature14236.
218
+
219
+ Arun Nair, Praveen Srinivasan, Sam Blackwell, Cagdas Alcicek, Rory Fearon, Alessandro De Maria, Vedavyas Panneershelvam, Mustafa Suleyman, Charles Beattie, Stig Petersen, Shane Legg, Volodymyr Mnih, Koray Kavukcuoglu, and David Silver. Massively parallel methods for deep reinforcement learning. CoRR, abs/1507.04296, 2015. URL http://arxiv.org/abs/ 1507.04296.
220
+
221
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. CoRR, abs/1511.05952, 2015. URL http://arxiv.org/abs/1511.05952.
222
+
223
+ David Silver, Aja Huang, Christopher J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nature, 529:484–503, 2016. URL http: //www.nature.com/nature/journal/v529/n7587/full/nature16961.html.
224
+
225
+ Richard S. Sutton and Andrew G. Barto. Introduction to Reinforcement Learning. MIT Press, Cambridge, MA, USA, 1st edition, 1998. ISBN 0262193981.
226
+
227
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 4(2), 2012.
228
+
229
+ Hado van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. CoRR, abs/1509.06461, 2015. URL http://arxiv.org/abs/1509.06461.
230
+
231
+ Ziyu Wang, Nando de Freitas, and Marc Lanctot. Dueling network architectures for deep reinforcement learning. CoRR, abs/1511.06581, 2015. URL http://arxiv.org/abs/1511. 06581.
232
+
233
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
md/train/r1lnxTEYPS/r1lnxTEYPS.md ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DETECTING OUT-OF-DISTRIBUTION INPUTS TO DEEP GENERATIVE MODELS USING TYPICALITY
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Recent work has shown that deep generative models can assign higher likelihood to out-of-distribution data sets than to their training data (Nalisnick et al., 2019; Choi et al., 2019). We posit that this phenomenon is caused by a mismatch between the model’s typical set and its areas of high probability density. In-distribution inputs should reside in the former but not necessarily in the latter, as previous work has presumed (Bishop, 1994). To determine whether or not inputs reside in the typical set, we propose a statistically principled, easy-to-implement test using the empirical distribution of model likelihoods. The test is model agnostic and widely applicable, only requiring that the likelihood can be computed or closely approximated. We report experiments showing that our procedure can successfully detect the out-of-distribution sets in several of the challenging cases reported by Nalisnick et al. (2019).
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recent work (Nalisnick et al., 2019; Choi et al., 2019; Shafaei et al., 2018) showed that a variety of deep generative models fail to distinguish training from out-of-distribution (OOD) data according to the model likelihood. This phenomenon occurs not only when the data sets are similar but also when they have dramatically different underlying semantics. For instance, Glow (Kingma & Dhariwal, 2018), a state-of-the-art normalizing flow, trained on CIFAR-10 will assign a higher likelihood to SVHN than to its CIFAR-10 training data (Nalisnick et al., 2019; Choi et al., 2019). This result is surprising since CIFAR-10 contains images of frogs, horses, ships, trucks, etc. and SVHN contains house numbers. A human would be very unlikely to confuse the two sets. These findings are also troubling from an algorithmic standpoint since higher OOD likelihoods break previously proposed methods for classifier validation (Bishop, 1994) and anomaly detection (Pimentel et al., 2014).
12
+
13
+ We conjecture that these high OOD likelihoods are evidence of the phenomenon of typicality.1 Due to concentration of measure, a generative model will draw samples from its typical set (Cover & Thomas, 2012), a subset of the model’s full support. However, the typical set may not necessarily intersect with regions of high probability density. For example, consider a $d$ -dimensional isotropic Gaussian. Its highest density region is at its mode (the mean) but the typical set resides at a distance of $\sqrt { d }$ from the mode (Vershynin, 2018). Thus a point near the mode will have high likelihood while being extremely unlikely to be sampled from the model. We believe that deep generative models exhibit a similar phenomenon since, to return to the CIFAR-10 vs SVHN example, Nalisnick et al. (2019) showed that sampling from the model trained on CIFAR-10 never generates SVHN-looking images despite SVHN having higher likelihood.
14
+
15
+ Based on this insight, we propose that OOD detection should be done by checking if an input resides in the model’s typical set, not just in a region of high density. Unfortunately it is impossible to analytically derive the regions of typicality for the vast majority of deep generative models. To define a widely applicable and scalable OOD-detection algorithm, we formulate Shannon (1948)’s entropy-based definition of typicality into a statistical hypothesis test. To ensure that the test is robust even in the low-data regime, we employ a bootstrap procedure (Efron & Tibshirani, 1994) to set the OOD-decision threshold. In the experiments, we demonstrate that our detection procedure succeeds in many of the challenging cases presented by Nalisnick et al. (2019). In addition to these successes, we also discuss failure modes that reveal drastic variability in OOD detection for the same data set pairs under different generative models. We highlight these cases to inspire future work.
16
+
17
+ ![](images/00f952eeb3d167f8274fde3c42e1a9f99126668b7eb46da53a3316557a33d4cd.jpg)
18
+ Figure 1: Typical Sets. Subfigure (a) shows the example of a Gaussian with its mean located at the high-dimensional all-gray image. Subfigure (b) shows how the typical set arises due to the nature of high-dimensional integration. The figure is inspired by Betancourt (2017)’s similar illustration. Subfigure (c) shows our proposed method (Equation 3, higher ˆ implies OOD) applied to a Gaussian simulation. The values have been re-scaled for purposes of visualization.
19
+
20
+ # 2 BACKGROUND: TYPICAL SETS
21
+
22
+ The typical set of a probability distribution is the set whose elements have an information content sufficiently close to that of the expected information (Shannon, 1948). A formal definition follows.
23
+
24
+ Definition 2.1 $( \epsilon , \bf N )$ -Typical Set (Cover & Thomas, 2012) For a distribution $p ( \mathbf { x } )$ with support $\mathbf { x } \in \mathcal { X }$ , the $( \epsilon , N )$ -typical set $\mathcal { A } _ { \epsilon } ^ { N } [ p ( \mathbf { x } ) ] \in \mathcal { X } ^ { N }$ is comprised of all $N$ -length sequences that satisfy
25
+
26
+ $$
27
+ \mathbb { H } [ p ( \mathbf { x } ) ] - \epsilon \leq \frac { 1 } { N } - \log p ( \pmb { x } _ { 1 } , \dots , \pmb { x } _ { N } ) \leq \mathbb { H } [ p ( \mathbf { x } ) ] + \epsilon
28
+ $$
29
+
30
+ where $\begin{array} { r } { \mathbb { H } [ p ( \mathbf { x } ) ] = \int _ { \mathbb { X } } p ( \mathbf { x } ) [ - \log p ( \mathbf { x } ) ] d \mathbf { x } } \end{array}$ and $\epsilon \in \mathbb { R } ^ { + }$ is a small constant.
31
+
32
+ When the joint density in Definition 2.1 factorizes, we can write:
33
+
34
+ $$
35
+ \mathbb { H } [ p ( \mathbf { x } ) ] - \epsilon \leq \frac { 1 } { N } \sum _ { n = 1 } ^ { N } - \log p ( \pmb { x } _ { n } ) \leq \mathbb { H } [ p ( \mathbf { x } ) ] + \epsilon .
36
+ $$
37
+
38
+ This is the definition we will use from here forward as we assume both training data and
39
+ samples from our generative model are identically and independently distributed (i.i.d.). In tity can be interpreted as an . The asymptotic equipartiti $N$ -sa pr pirical entropy:EP) (Cover &
40
+ $1 / N \textstyle \sum _ { n = 1 } ^ { N } - \log p ( \pmb { x } _ { n } ) \ = \ \hat { \mathbb H } ^ { N } [ p ( \mathbf { x } ) ]$ $N \to \infty$
41
+
42
+ To build intuition, let $p ( \mathbf { x } ) = \mathbf { N } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbb { I } )$ and consider its $( \epsilon , 1 )$ -typical set. Plugging in the relevant quantities to Equation 1 and simplifying, we have $\mathbf { x } \in \mathcal { A } _ { \epsilon } ^ { 1 } [ \mathrm { N } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbb { I } ) ]$ if $\begin{array} { r } { \frac 1 2 | d - | | { \bf x } - \mu | | _ { 2 } ^ { 2 } / \sigma ^ { 2 } | \le \epsilon } \end{array}$ where $d$ denotes dimensionality. See Appendix A.1 for a complete derivation. The inequality will√ hold for any choice of $\epsilon$ if $| | \mathbf { x } - \mu | | _ { 2 } = \sigma { \sqrt { d } }$ . In turn, we can geometrically interpret $\mathcal { A } _ { \epsilon } ^ { 1 } [ \mathrm { N } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbb { I } ) ]$ as an annulus centered at $\mu$ with radius $\sigma { \sqrt { d } }$ and whose width is a function of $\epsilon$ (and $\sigma$ ). This is a well-known concentration of measure result often referred to as the Gaussian Annulus Theorem (Vershynin, 2018). Figure 1(a) illustrates a Gaussian centered on the all gray image (pixel value 128). We show that samples from this model never resemble the all gray image, despite it having the highest probability density, because they are drawn from the annulus. In Figure 1(b) we visualize the interplay between density and volume that gives rise to the typical set. The connection between typicality and concentration of measure can be stated formally as:
43
+
44
+ Theorem 2.1 Probability of the Typical Set (Cover & Thomas, 2012) For $N$ sufficiently large, the typical set has probability
45
+
46
+ $$
47
+ P \left( \mathcal { A } _ { \epsilon } ^ { N } [ p ( \mathbf { x } ) ] \right) > 1 - \epsilon .
48
+ $$
49
+
50
+ This result speaks to the central role of typical sets in compression: $\mathcal { A } _ { \epsilon } ^ { N }$ is an efficient representation of $\mathcal { X } ^ { N }$ as it is sampled under $p ( \mathbf { x } )$ .2 Returning to the Gaussian example, we could ‘compress’ $\mathbb { R } ^ { d }$ under $\mathbf { N } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbb { I } )$ to just the $\sigma { \sqrt { d } }$ -radius annulus.3
51
+
52
+ # 3 A TYPICALITY TEST FOR OOD INPUTS
53
+
54
+ We next describe our core contribution: a reformulation of Definition 2.1 into a scalable goodnessof-fit test to determine if a batch of test data was likely drawn from a given deep generative model.
55
+
56
+ 3.1 SETTING OF INTEREST: GOODNESS-OF-FIT TESTING FOR DEEP GENERATIVE MODELS
57
+
58
+ Assume we have a generative model $p ( \mathbf { x } ; \pmb { \theta } )$ —with $\pmb \theta$ denoting the parameters—that was trained on a data set $\pmb { X } = \{ \pmb { x } _ { 1 } , \ldots , \pmb { x } _ { N } \}$ . Take $\mathbf { x }$ to be high-dimensional ( $Q > 5 0 0$ ) and $N$ to be sufficiently large $( N > 2 5 , 0 0 0 )$ so as to enable training a high-capacity neural-network parametrized model—a so-called ‘deep generative model’ (DGM). Furthermore, we assume that $p ( \mathbf { x } ; \theta )$ has a likelihood that can be evaluated either directly or closely approximated via Monte Carlo sampling. Examples of DGMs that meet these specifications include normalizing flows (Tabak & Turner, 2013) such as Glow (Kingma & Dhariwal, 2018), latent variable models such as variational autoencoders (VAEs) (Kingma $\&$ Welling, 2014; Rezende et al., 2014), and auto-regressive models such as PixelCNN (van den Oord et al., 2016). We do not consider implicit generative models (Mohamed & Lakshminarayanan, 2016) (such as GANs (Goodfellow et al., 2014)) due to their likelihood being difficult to even approximate.
59
+
60
+ The primary focus of this paper is in performing a goodness-of-fit (GoF) test (D’Agostino, 1986; Huber-Carol et al., 2012) for $p ( \mathbf { x } ; \pmb { \theta } )$ . Specifically, given an $M$ -sized batch of test observations $\widetilde { \pmb { X } } = \{ \tilde { \pmb { x } } _ { 1 } , \ldots , \tilde { \pmb { x } } _ { M } \}$ $M \geq 1 \mathrm { ~ }$ ), we desire to determine if $\widetilde { X }$ was sampled (i.i.d.) from $p _ { \pmb { \theta } }$ or from some other distribution $q \neq p _ { \pm }$ . We assume no knowledge of $q$ , thus making our desired GoF test omnibus (Eubank & LaRiccia, 1992). The vast majority of GoF tests operate via the model’s cumulative distribution function (CDF) and/or being able to compute an empirical distribution function (EDF) (Cramer´ , 1928; Massey Jr, 1951; Anderson & Darling, 1954; Stephens, 1974). However, the CDFs of DGMs are not available analytically, and numerical approximations are hopelessly slow due to the curse of dimensionality. Likewise, EDFs lose statistical strength exponentially as dimensionality grows (Wasserman, 2006). Our goal is to formulate a scalable test that does not rely on strong parametric assumptions (e.g. Chen & Xia (2019)) and has better computational properties than kernel-based alternatives (e.g. Liu et al. (2016)).
61
+
62
+ # 3.2 A HYPOTHESIS TEST FOR TYPICALITY
63
+
64
+ Returning to the results of Nalisnick et al. (2019) and Choi et al. (2019), the high-dimensionality of natural images $d = 3 0 7 2$ for CIFAR and SVHN) alone is enough to suspect the influence of phenomena akin to the Gaussian Annulus Theorem. Yet there are stronger parallels still: Nalisnick et al. (2019) showed that the all-black image has the highest density of any tested input to their FashionMNIST DGM, but this model is never observed to generate all-black images. Thus we are inspired to critique DGMs not via density but via typical set membership:
65
+
66
+ The intuition is that if $\widetilde { X }$ is indeed sampled from $p _ { \pmb { \theta } }$ , then with high probability it must reside in the typical set (Theorem 2.1). To determine if $\widetilde { \pmb { X } } \in \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ , we can plug $\overrightharpoon { x }$ into Equation 1 as a length $M$ sequence and check if the $\epsilon$ -bound holds:
67
+
68
+ $$
69
+ \mathrm { i } \mathrm { \cdot ~ } \left| \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \log p ( \widetilde { x } _ { m } ; \pmb { \theta } ) - \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] \right| = \hat { \epsilon } \leq \epsilon \mathrm { \ t h e n \ } \widetilde { \mathbf { X } } \in \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ] ,
70
+ $$
71
+
72
+ where $\hat { \epsilon }$ denotes the test statistic. We provide a sanity check for Equation 3 in Subfigure 1(c), showing $\hat { \epsilon }$ calculated for the high-dimensional Gaussian example described in Section 2. We see that $\hat { \epsilon }$ achieves its minimum value exactly at $\sqrt { d }$ -distance from 128.
73
+
74
+ In Appendix A.2 we show that our test is consistent unless the alternative’s typical set is a subset of $p _ { \theta }$ ’s: $\mathcal { A } _ { \epsilon } ^ { M } [ \boldsymbol { q } ( \mathbf { x } ) ] \subseteq \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ . This limitation is reasonable and expected given our fundamental assumption in Equation 2. Since the size of the typical set is upper bounded as a function of entropy—lo $\mathrm { g } \lvert \mathcal { A } _ { \epsilon } ^ { M } [ p ( \dot { \mathbf { x } } ; \pmb { \theta } ) ] \rvert \leq M ( \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] + \epsilon )$ (Cover & Thomas, 2012)—the model entropy determines the probability of type-II error: higher entropy implies a larger typical set, a larger set implies more chance of $\mathbf { \bar { \mathcal { A } } } _ { \epsilon } ^ { M } \tilde { \left[ q \right] } ^ { \mathbf { \bar { \alpha } } } \subseteq \mathcal { A } _ { \epsilon } ^ { M } \tilde { \left[ p _ { \pm } \right] }$ , and a higher degree of intersection leads to a better chance of incorrectly failing to reject $H _ { 0 } : \tilde { { \boldsymbol { x } } } \sim p \varrho$ . Yet it is not uncommon to sacrifice consistency for generality when testing GoF (e.g. Chi-square vs Kolmogorov-Smirnov tests (Haberman, 1988)).
75
+
76
+ # 3.3 IMPLEMENTATION DETAILS
77
+
78
+ In an ideal setting, we could mathematically derive the regions in $\mathcal { X }$ that correspond to the typical set (e.g. the Gaussian’s annulus) and check if $\tilde { \pmb x }$ resides within that region. Unfortunately, finding these regions is analytically intractable for neural-network-based generative models. A practical implementation of Equation 3 requires computing the entropy $\mathbb { H } [ p ( \bar { \mathbf { x } } ; \pmb { \theta } ) ]$ and the threshold $\epsilon$ .
79
+
80
+ Entropy Estimator The entropy of DGMs is not available in closed-form and therefore we resort to the following sampling-based approximation. Recall from Subsection 2 that the AEP states that the sample entropy will converge to the true entropy as the number of samples grows. Since we have access to the model and can drawn a large number of samples from it, the empirical entropy should be a good approximation for the true model entropy:
81
+
82
+ $$
83
+ \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] = \int _ { \pmb { \chi } } p ( \mathbf { x } ; \pmb { \theta } ) [ - \log p ( \mathbf { x } ; \pmb { \theta } ) ] d \mathbf { x } \approx \frac { 1 } { S } \sum _ { s = 1 } ^ { S } - \log p ( \hat { \pmb { x } } _ { s } ; \pmb { \theta } )
84
+ $$
85
+
86
+ where $\hat { \pmb { x } } _ { s } \sim p ( { \bf x } ; { \pmb \theta } )$ . However, in preliminary experiments (reported in Appendix E.1) we observed markedly better OOD detection when using an alternative estimator known as the resubstitution estimator (Beirlant et al., 1997). This estimator uses the training set for calculating the expectation:
87
+
88
+ $$
89
+ \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] \approx \mathbb { H } _ { \mathrm { R E S U B } } ^ { N } [ p ( \mathbf { x } ; \pmb { \theta } ) ] = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } - \log p ( \pmb { x } _ { n } ; \pmb { \theta } ) .
90
+ $$
91
+
92
+ This approximation should be good as well since we assume $N$ to be large.4
93
+
94
+ Setting the OOD-Threshold with the Bootstrap Concerning the threshold $\epsilon$ , we propose setting its value through simulation—by constructing a bootstrap confidence interval (BCI) (Efron, 1992; Arcones & Gine, 1992) for the null hypothesis $H _ { 0 } : \widetilde { \pmb { X } } \in \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ , with the alternative being $H _ { 1 } : \widetilde { X } \notin \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ . In a slight deviation from the tradition procedure for BCI construction, we assume the existence of a validation set $X ^ { \prime }$ that was held-out from $\boldsymbol { X }$ before training the generative model (just as is usually done for hyperparameter tuning).This is only to account for the generative model overfitting to the training set. From this validation set, we bootstrap sample $K$ ‘new’ data sets $\{ X _ { k } ^ { \prime } \} _ { k = 1 } ^ { K }$ of size $M$ and then plug each into Equation 3 in place of $\widetilde { X }$ :
95
+
96
+ $$
97
+ \left| \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \log p ( x _ { k , m } ^ { \prime } ; \theta ) - \hat { { \mathbb H } } _ { \mathtt { R E S U B } } ^ { N } [ p ( { \bf x } ; \theta ) ] \right| = \hat { \epsilon } _ { k }
98
+ $$
99
+
100
+ where $\hat { \epsilon } _ { k }$ is the estimate for the $k$ th bootstrap sample. All $K$ estimates then form the bootstrap distribution F () = 1K PKk=1 . Calculating the e reject the null h $\alpha$ -quantile of othesis with $F ( \epsilon )$ , which wedence-level note as (Arcon $\epsilon _ { \alpha } ^ { M }$ $\alpha$ $\&$ Gine, 1992). If we reject the null, then we decide that the sample does not reside in the typical set and therefore is OOD. The complete procedure is summarized in Algorithm 1 in Appendix B. Observe that nearly all of the computation can be performed offline before any test set is received, including all bootstrap simulations. The rejection threshold $\epsilon _ { \alpha } ^ { M }$ depends on a particular $M$ and $\alpha$ setting, but these computations can be done in parallel across multiple machines. The most expensive test-time operation is obtaining $\log p ( \tilde { \pmb { x } } , \pmb { \theta } )$ . After this is done, only an $\mathcal { O } ( M )$ operation to sum the likelihoods is required.
101
+
102
+ # 4 RELATED WORK
103
+
104
+ Goodness-of-Fit Tests As mentioned in Section 3.1, many of the traditional GoF tests are not applicable to the DGMs and high-dimensional data sets that we consider since CDFs and EDFs are both intractable in this setting. Kernelized Stein discrepancy (Chwialkowski et al., 2016; Liu et al., 2016) is a recently-proposed GoF test that can scale to the DGM regime, and we compare against it in the experiments. Several works have proposed GoF tests based on entropy (Gokhale, 1983; Parzen, 1990)—e.g. for normal (Vasicek, 1976), uniform (Dudewicz & Van Der Meulen, 1981), and exponential (Crzcgorzewski & Wirczorkowski, 1999) distributions. However, these tests are derived from maximum entropy results and not motivated from typicality. There are also directed GoF tests such as ones based on likelihood ratios (Neyman & Pearson, 1933; Wilks, 1938) or discrepancies such as KL divergence (Noughabi & Arghami, 2013). These tests require an explicit definition of $q$ , which may be difficult in many DGM-appropriate scenarios. Yet the recent work of Ren et al. (2019) does apply likelihood ratios to PixelCNNs by constructing $q$ such that it models a background process (i.e. some perturbed version of the original data).
105
+
106
+ Typical and Minimum Volume Sets We are aware of only two previous works that use a notion of typicality for GoF tests or OOD detection. Sabeti & Hst-Madsen (2019) propose a typicality framework based on minimum description length. They deem data as ‘atypical’ if it can be represented in less bits than one would expect under the generative model. While our frameworks share the same conceptual foundation, Sabeti & Hst-Madsen (2019)’s implementation relies on strong parametric assumptions and cannot be generalized to deep models (without drastic approximations). Choi et al. (2019), the second work, leverages normalizing flows to test for typicality by transforming the data to a normal distribution and then deeming points outside the annulus to be anomalous. This approach restricts the generative model to be a Gaussian normalizing flow whereas ours is applicable to any generative model with a computable likelihood. Our work is also related to the concept of minimum volume (MV) sets (Sager, 1979; Polonik, 1997; Garcia et al., 2003). MV sets have been used for GoF testing (Polonik, 1999; Glazer et al., 2012) and to detect outliers (Platt et al., 2001; Scott & Nowak, 2006; Clemenc¸on et al. ´ , 2018). However, we are not aware of any work that scales MV-set-based methodologies to the degree required to be applicable to DGMs.
107
+
108
+ Generative Models and Outlier Detection Probabilistic but non-test-based techniques have also been widely employed to discover outliers and anomalies (Pimentel et al., 2014). One of the most common is to use a (one-sided) threshold on the density function to classify points as OOD (Barnett et al., 1994); this idea is used in Tarassenko et al. (1995) Bishop (1994), and Parra et al. (1996), among others. Other work has applied more sophisticated techniques to density function evaluations—for instance, Clifton et al. (2014) applies extreme value theory. Yet this work and all others of which we are aware do not identify points with abnormally high density as OOD. Thus they would fail in the settings presented by Nalisnick et al. (2019). As for work focusing on DGMs in particular, most previous work proposes training improvements to make the model more robust. For instance, Hendrycks et al. (2019) show that robustness and uncertainty quantification w.r.t. outliers can be improved by exposing the model to an auxiliary data set (a proxy for OOD data) during training. As for post-training outlier and OOD detection, Choi et al. (2019) proposes using an ensemble of models to compute the Watanabe-Akaike information criterion (WAIC). However, there are no rigorous arguments for why WAIC should quantify GoF. Skv ˇ ara et al. ´ (2018) proposes using a VAE’s conditional likelihood as an outlier criterion, finding that this works well only when the hyperparameters can be tuned using anomalous data. As far as we are aware, we are the first to apply a hypothesis testing framework to the problem of OOD or anomaly detection for DGMs. As mentioned above, Ren et al. (2019) use likelihood ratios, but they do not perform a hypothesis test.
109
+
110
+ # 5 EXPERIMENTS
111
+
112
+ We now evaluate our typicality test’s OOD detection abilities, focusing in particular on the image data set pairs highlighted by Nalisnick et al. (2019). We use the same three generative models as they did—Glow (Kingma & Dhariwal, 2018), PixelCNN (van den Oord et al., 2016), and Rosca et al. (2018)’s VAE architecture—attempting to replicate training and evaluation as closely as possible. See Appendix C for a full description of model architectures and training. See Appendix D for more details on evaluation. We consider the following baselines5; all statistical tests use $\alpha = 0 . 9 9$ :
113
+
114
+ 1. t-test: We apply a two-sample students’ t-test to check for a difference in means in the empirical likelihoods. In terms of Equation 3, this baseline will reject for any $\epsilon > 0$ , and thus we expect it to be overly conservative. Moreover, this test does not have access to validation data and therefore improvements upon it can be attributed to our bootstrap procedure.
115
+ 2. Kolmogorov-Smirnov test (KS-test): We apply a two-sample KS-test to the likelihood EDFs. This test is stronger than our typicality test since it is checking for equivalence in all moments whereas ours (and the t-test) is restricted to the first moment. In turn, this test has a greater computational complexity— $\mathcal { O } ( M \log M )$ compared to $\mathcal { O } ( M )$ .
116
+ 3. Maximum Mean Discrepancy (MMD): We apply a two-sample MMD (Gretton et al., 2012) test to the data directly. Yet we incorporate the generative model by using a Fisher kernel (Jaakkola & Haussler, 1999). We also apply the same bootstrap procedure on validation data to construct the test statistic. MMD has greater runtime still at $\mathcal { O } ( \bar { N M d } )$ . It also requires access to (a subset of) the training data at test-time, which is undesirable.
117
+ 4. Kernelized Stein Discrepancy (KSD): We apply KSD (Liu et al., 2016) to test for GoF to the generative model and again use a Fisher kernel and the bootstrap procedure on validation data. KSD has runtime $\mathcal { O } ( M ^ { 2 } d )$ . While we have ignored the construction of the kernel in the runtime analysis, KSD is the most costly since it requires computing three model gradients.
118
+ 5. Annulus Method: We use a modified version of Choi et al. (2019)’s annulus method applied to Gaussian normalizing flows. Like them, we classify something as OOD based on its distance√ to the sphere with radius $\sqrt { d }$ . This is essentially performing our test but via closed-form expressions for entropy made available by the Gaussian base distribution. We use the same bootstrap procedure on validation data to set the ‘slack’ variable $\epsilon$ .
119
+
120
+ Grayscale Images We first evaluate our typicality test on grayscale images. We trained a Glow, PixelCNN, and VAE each on the FashionMNIST training split and tested OOD detection using the FashionMNIST, MNIST, and NotMNIST test splits. We use the FashionMNIST test split to evaluate for type-I error (incorrect rejection of the null) and the MNIST and NotMNIST splits for type-II error (incorrect rejection of the alternative). In Figure 2 we show the empirical distribution of likelihoods over each data set for each model. We see the same phenomenon as reported by Nalisnick et al. (2019)—namely, that the MNIST OOD test set (green) has a higher likelihood than the training set (black). Lower-sided thresholding (Bishop, 1994) would clearly fail to detect the OOD sets. Table 1 reports a comparison against baselines, showing the fraction of $M$ -sized batches classified as OOD. The IN-DIST. column reports the value for the FashionMNIST test set and ideally this number should be 0.00; any deviation from zero corresponds to type-I error. Conversely, the MNIST and NOTMNIST columns should be 1.00, and any deviation corresponds to type-II error. We see that for $M = 2$ all tests find it hard to reject the null hypothesis, which is not surprising given the overlap in the histograms in Figure 2. The exceptions are the annulus method for NotMNIST-Glow $( 9 6 \% )$ , the typicality test for MNIST-PixelCNN $( 5 6 \% )$ , and all methods except KS-test for NotMNIST-VAE. One failure mode for almost all methods is NotMNIST for the PixelCNN. None of the likelihoodbased tests can distinguish NotMNIST as OOD due to the near perfect overlap in histograms shown in Figure 2(b). KSD and especially MMD are able to perform better in this case due to having access to the original feature-space representations (in addition to the generative model). Yet, surprisingly, KSD and MMD perform comparatively poorly for MNIST, especially at $M = 1 0$ and $M = 2 5$ . The annulus method was unable to detect MNIST, which we found surprising given its close relationship to our typicality test, which does perform well. Yet Choi et al. (2019) note that Gaussian normalizing flows do not necessarily make the latent space normally distributed, and our typicality test may be able to use information from the volume element that is not available to the annulus method.
121
+
122
+ ![](images/6255daa222d1a45ebfc0c184b37dfe1577181a8f5e67dbf51fe3ee72c4d6cc3c.jpg)
123
+ Figure 2: Empirical Distribution of Likelihoods. The above figure shows the histogram of loglikelihoods for FashionMNIST (train, test), MNIST (test), and NotMNIST (test) for the (a) Glow, (b) PixelCNN, and (c) VAE.
124
+
125
+ Table 1: Grayscale Images: Fraction of $M$ -Sized Batches Classified as OOD. The in-distribution column reflects type-I error and the MNIST and NotMNIST columns reflect type-II.
126
+
127
+ <table><tr><td rowspan="2">METHOD</td><td rowspan="2">IN-DIST.</td><td rowspan="2">M=2 MNIST</td><td rowspan="2"></td><td colspan="3">M=10</td><td colspan="3">M=25</td></tr><tr><td>NOTMNIST|IN-DIST.</td><td>MNIST</td><td>NOTMNIST</td><td>IN-DIST.</td><td>MNIST</td><td>NOTMNIST</td></tr><tr><td colspan="10">Glow Trained on FashionMNIST</td></tr><tr><td>Typicality Test</td><td>0.02±.01</td><td>0.14±.10</td><td>0.08±.04</td><td>0.02±.02</td><td>1.00±.00</td><td>0.69±.11</td><td>0.01±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>t-Test</td><td>0.01±.00</td><td>0.08±.00</td><td>0.06±.00</td><td>0.01±.00</td><td>1.00±.00</td><td>0.67±.01</td><td>0.01±.00</td><td>1.00±.00</td><td>0.99±.00</td></tr><tr><td>KS-Test</td><td>0.00±.00</td><td>0.00±.00</td><td>0.00±.00</td><td>0.01±.00</td><td>1.00±.00</td><td>0.61±.01</td><td>0.00±.00</td><td>1.00±.00</td><td>0.98±.01</td></tr><tr><td>Max Mean Dis.</td><td>0.05±.02</td><td>0.17±.06</td><td>0.04±.03</td><td>0.02±.02</td><td>0.63±.12</td><td>0.37±.24</td><td>0.04±.04</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>Kern. Stein Dis.</td><td>0.05±.05</td><td>0.16±.14</td><td>0.01±.01</td><td>0.01±.01</td><td>0.21±.11</td><td>0.01±.00</td><td>0.02±.03</td><td>0.76±.21</td><td>0.00±.00</td></tr><tr><td>Annulus Method</td><td>0.01±.01</td><td>0.00±.00</td><td>0.96±.03</td><td>0.02±.00</td><td>0.00±.00</td><td>1.00±.00</td><td>0.03±.03</td><td>0.00±.00</td><td>1.00±.00</td></tr><tr><td colspan="10">PixelCNN Trained on FashionMNIST</td></tr><tr><td>Typicality Test</td><td>0.03±.01</td><td>0.56±.13</td><td>0.01±.00</td><td>0.04±.02</td><td>1.00±.00</td><td>0.01±.01</td><td>0.05±.03</td><td>1.00±.00</td><td>0.01±.01</td></tr><tr><td>t-Test</td><td>0.01±.00</td><td>0.23±.00</td><td>0.00±.00</td><td>0.01±.00</td><td>1.00±.00</td><td>0.00±.00</td><td>0.02±.00</td><td>1.00±.00</td><td>0.00±.00</td></tr><tr><td>KS-Test</td><td>0.00±.00</td><td>0.00±.00</td><td>0.00±.00</td><td>0.02±.00</td><td>1.00±.00</td><td>0.00±.00</td><td>0.04±.00</td><td>1.00±.00</td><td>0.01±.00</td></tr><tr><td>Max Mean Dis.</td><td>0.02±.00</td><td>0.05±.01</td><td>0.36±.05</td><td>0.05±.02</td><td>0.27±.06</td><td>1.00±.00</td><td>0.06±.04</td><td>0.59±.10</td><td>1.00±.00</td></tr><tr><td>Kern. Stein Dis.</td><td>0.01±.00</td><td>0.05±.02</td><td>0.08±.03</td><td>0.02±.01</td><td>0.29±.14</td><td>0.61±.20</td><td>0.05±.02</td><td>0.70±.11</td><td>0.99±.01</td></tr><tr><td colspan="10">VAETrained on FashionMNIST</td></tr><tr><td>Typicality Test</td><td>0.03±.01</td><td>0.37±.05</td><td>0.99±.00</td><td>0.04±.02</td><td>0.94±.02</td><td>1.00±.00</td><td>0.04±.03</td><td>0.96±.01</td><td>1.00±.00</td></tr><tr><td>t-Test KS-Test</td><td>0.01±.00</td><td>0.20±.00</td><td>0.99±.00</td><td>0.02±.00</td><td>0.93±.00</td><td>1.00±.00</td><td>0.02±.00</td><td>0.96±.00</td><td>1.00±.00</td></tr><tr><td></td><td>0.00±.00</td><td>0.00±.00</td><td>0.00±.00</td><td>0.02±.00</td><td>1.00±.00</td><td>1.00±.00</td><td>0.02±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>Max Mean Dis. Kern. Stein Dis.</td><td>0.03±.02</td><td>0.16±.07</td><td>0.73±.01</td><td>0.03±.04</td><td>0.41±.16</td><td>1.00±.00 1.00±.00</td><td>0.01±.01</td><td>0.64±.05</td><td>1.00±.00</td></tr><tr><td></td><td>0.04±.01</td><td>0.05±.01</td><td>0.74±.00</td><td>0.11±.04</td><td>0.17±.01</td><td></td><td>0.06±.04</td><td>0.37±.03</td><td>1.00±.00</td></tr></table>
128
+
129
+ Natural Images We next turn to data sets of natural images—in particular SVHN, CIFAR-10, and ImageNet. We train Glow on SVHN, CIFAR-10, and ImageNet and use the two non-training sets for OOD evaluation. We found using MMD and KSD to be too expensive to make OOD decisions in an online system. Table 2 reports the fraction of $M$ -sized batches classified as OOD. We see that our method (first row, bolded) is able to easily detect the OOD sets for SVHN, rejecting size-two batches at the rate of $9 8 \% +$ while having only $1 \%$ type-I error. Performance on the CIFAR-10-trained model is good as well with $4 2 \% +$ of OOD batches detected at $M = 2$ and $1 0 0 \%$ at $M = 1 0$ (type-I error at $1 \%$ in both cases). The hardest case is Glow trained on ImageNet: the KS-test performed best at $M = 2 5$ with $8 9 \%$ , followed by the $\mathbf { t - }$ and typicality tests at $7 2 \%$ and $7 4 \%$ respectively. The annulus method again had varying performance, being conspicuously inferior at detecting SVHN for the CIFAR and ImageNet models while having the best performance on ImageNet for the CIFAR model. We report additional results in Appendix E.3 for our method, showing performance for all $M \in [ 1 , 1 5 0 ]$ and when using CIFAR-100 as an OOD set.
130
+
131
+ Lastly, we report two challenging cases worthy of note and further attention. Figure 3(a) shows our method applied to Glow when trained on CIFAR-10, tested on CIFAR-100. The $y$ -axis again shows fraction of batches reported as OOD and the $x$ -axis the batch size $M$ . Even at $M = 1 5 0$ our method classifies only $\sim 2 0 \%$ of batches as OOD. Yet this result is not surprising given that CIFAR
132
+
133
+ Table 2: Natural Images: Fraction of M-Sized Batches Classified as OOD.
134
+
135
+ <table><tr><td rowspan="2">METHOD</td><td rowspan="2">SVHN</td><td rowspan="2">M=2 CIFAR-10</td><td rowspan="2">IMAGENET</td><td rowspan="2">SVHN</td><td rowspan="2">M=10 CIFAR-10</td><td rowspan="2">IMAGENET|</td><td colspan="3">M=25 CIFAR-10</td></tr><tr><td>SVHN</td><td></td><td>IMAGENET</td></tr><tr><td colspan="9">Glow Trained on SVHN</td></tr><tr><td>Typicality Test</td><td>0.01±.00</td><td>0.98±.00</td><td>1.00±.00</td><td>0.00±.00</td><td>1.00±.00</td><td>1.00±.00</td><td>0.02±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>t-Test</td><td>0.00±.00</td><td>0.95±.00</td><td>1.00±.00</td><td>0.04±.00</td><td>1.00±.00</td><td>1.00±.00</td><td>0.03±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>KS-Test</td><td>0.00±.00</td><td>0.00±.00</td><td>0.00±.00</td><td>0.08±.00</td><td>1.00±.00</td><td>1.00±.00</td><td>0.03±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>Annulus Method</td><td>0.02±.01</td><td>0.70±.05</td><td>1.00±.00</td><td>0.02±.01</td><td>1.00±.00</td><td>1.00±.00</td><td>0.00±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td colspan="10">Glow Trained on CIFAR-10</td></tr><tr><td>Typicality Test</td><td>0.42±.09</td><td>0.01±.01</td><td>0.64±.04</td><td>1.00±.00</td><td>0.01±.01</td><td>1.00±.00</td><td>1.00±.00</td><td>0.01±.01</td><td>1.00±.00</td></tr><tr><td>t-Test</td><td>0.44±.01</td><td>0.01±.00</td><td>0.65±.00</td><td>1.00±.00</td><td>0.02±.00</td><td>1.00±.00</td><td>1.00±.00</td><td>0.02±.00</td><td>1.00±.00</td></tr><tr><td>KS-Test</td><td>0.00±.00</td><td>0.00±.00</td><td>0.00±.00</td><td>1.00±.00</td><td>0.01±.00</td><td>0.98±.00</td><td>1.00±.00</td><td>0.01±.00</td><td>1.00±.00</td></tr><tr><td>Annulus Method</td><td>0.09±.03</td><td>0.02±.00</td><td>0.87±.05</td><td>0.19±.01</td><td>0.03±.00</td><td>1.00±.00</td><td>0.35±.02</td><td>0.04±.00</td><td>1.00±.00</td></tr><tr><td colspan="10">Glow Trained on ImageNet</td></tr><tr><td>Typicality Test</td><td>0.78±.08</td><td>0.02±.01</td><td>0.01±.00</td><td>1.00±.00</td><td>0.20±.06</td><td>0.01±.01</td><td>1.00±.00</td><td>0.74±.05</td><td>0.01±.01</td></tr><tr><td>t-Test</td><td>0.76±.00</td><td>0.02±.00</td><td>0.01±.00</td><td>1.00±.00</td><td>0.18±.01</td><td>0.01±.00</td><td>1.00±.00</td><td>0.72±.01</td><td>0.01±.00</td></tr><tr><td>KS-Test</td><td>0.00±.00</td><td>0.00±.00</td><td>0.00±.00</td><td>1.00±.00</td><td>0.29±.01</td><td>0.01±.00</td><td>1.00±.00</td><td>0.89±.01</td><td>0.02±.00</td></tr><tr><td>Annulus Method</td><td>0.00±.00</td><td>0.03±.00</td><td>0.02±.01</td><td>0.02±.02</td><td>0.15±.04</td><td>0.02±.00</td><td>0.16±.04</td><td>0.57±.12</td><td>0.02±.00</td></tr></table>
136
+
137
+ 10 is a subset of CIFAR-100, which means that our test’s subset assumptions for consistency are violated. More interesting is the case of Glow trained on CelebA, tested on CIFAR-10 and CIFAR100. Figure 3(b) shows the histogram of log-likelihoods: all distributions peak at nearly the same value. The distribution of $\epsilon$ observed during the bootstrap procedure $M = 2 0 0$ ) is shown in Figure 3(c), with the red and black dotted lines denoting $\hat { \epsilon }$ computed using the whole set. We see that $\hat { \epsilon }$ for the OOD set is even less than the in-distribution’s, meaning that it would be impossible to reliably reject the OOD data while not rejecting the in-distribution test set as well. Interestingly, PixelCNN and VAE do not have as dramatic of an overlap in likelihoods—a phenomenon that can also be observed in Figure 2—which implies that the ability to detect OOD sets does not only depend on the data involved but the models as well. Some models may have likelihood functions that are reliably discriminative, and this presents an intriguing area for future work.
138
+
139
+ ![](images/9ca02de438f58f6e6b49dd426979e6fca608b7c7a81667c852ad457b52d4b33a.jpg)
140
+ Figure 3: Challenging Cases: CIFAR-10 vs CIFAR-100, CelebA vs CIFAR’s.
141
+
142
+ # 6 DISCUSSION AND CONCLUSIONS
143
+
144
+ We have presented a model-agnostic and computationally efficient statistical test for OOD inputs derived from the concept of typical sets. In the experiments we showed that the proposed test is especially well-suited to DGMs, identifying the OOD set for SVHN vs CIFAR-10 vs ImageNet (Nalisnick et al., 2019) with high accuracy (while maintaining $\leq 1 \%$ type-I error). In this work we used the null hypothesis $H _ { 0 } : \widetilde { \pmb { X } } \in \mathcal { A } _ { \epsilon } ^ { M }$ , which was necessary since we assumed access to only one training data set. One avenue for future work is to use auxiliary data sets (Hendrycks et al., 2019) to construct a test statistic for the null $H _ { 0 } : \widetilde { X } \notin \mathcal { A } _ { \epsilon } ^ { M }$ , as would be proper for safety-critical applications. In our experiments we also noticed two cases—PixelCNN trained on FashionMNIST, tested on NotMNIST and Glow trained on CelebA, tested on CIFAR—in which the empirical distributions of in- and out-of-distribution likelihoods matched near perfectly. Thus use of the likelihood distribution produced by DGMs has a fundamental limitation that is seemingly worse than what was reported by Nalisnick et al. (2019).
145
+
146
+ # REFERENCES
147
+
148
+ Theodore W Anderson and Donald A Darling. A Test of Goodness of Fit. Journal of the American statistical association, 49(268):765–769, 1954.
149
+
150
+ Miguel A Arcones and Evarist Gine. On the Bootstrap of U and V Statistics. The Annals of Statistics, pp. 655–674, 1992.
151
+
152
+ V. Barnett, P.S.V. Barnett, and T. Lewis. Outliers in Statistical Data. Wiley Series in Probability and Statistics. Wiley, 1994.
153
+
154
+ Jan Beirlant, Edward J Dudewicz, Laszl ´ o Gy ´ orfi, and Edward C Van der Meulen. Nonparametric En- ¨ tropy Estimation: An Overview. International Journal of Mathematical and Statistical Sciences, 6(1):17–39, 1997.
155
+
156
+ Michael Betancourt. A Conceptual Introduction to Hamiltonian Monte Carlo. ArXiv e-print, 2017.
157
+
158
+ Christopher M Bishop. Novelty Detection and Neural Network Validation. IEE Proceedings-Vision, Image and Signal processing, 141(4):217–222, 1994.
159
+
160
+ Mikoaj Bikowski, Dougal J. Sutherland, Michael Arbel, and Arthur Gretton. Demystifying MMD GANs. In International Conference on Learning Representations (ICLR), 2018.
161
+
162
+ Hao Chen and Yin Xia. A Nonparametric Normality Test for High-dimensional Data. ArXiv ePrints, 2019.
163
+
164
+ Hyunsun Choi, Eric Jang, and Alexander Alemi. WAIC, but Why?: Generative Ensembles for Robust Anomaly Detection. ArXiv e-Print arXiv:1810.01392v3, 2019.
165
+
166
+ Kacper Chwialkowski, Heiko Strathmann, and Arthur Gretton. A Kernel Test of Goodness of Fit. In International Conference on Machine Learning, pp. 2606–2615, 2016.
167
+
168
+ Stephan Clemenc¸on, Albert Thomas, et al. Mass Volume Curves and Anomaly Ranking. ´ Electronic Journal of Statistics, 12(2):2806–2872, 2018.
169
+
170
+ David A Clifton, Lei Clifton, Samuel Hugueny, and Lionel Tarassenko. Extending the Generalised Pareto Distribution for Novelty Detection in High-Dimensional Spaces. Journal of Signal Processing Systems, 74(3):323–339, 2014.
171
+
172
+ Thomas M Cover and Joy A Thomas. Elements of Information Theory. John Wiley & Sons, 2012.
173
+
174
+ Harald Cramer. On the Composition of Elementary Errors. ´ Scandinavian Actuarial Journal, 1928 (1):13–74, 1928.
175
+
176
+ Przeniyslaw Crzcgorzewski and Robert Wirczorkowski. Entropy-Based Goodness-of-Fit Test for Exponentiality. Communications in Statistics - Theory and Methods, 28(5):1183–1202, 1999.
177
+
178
+ Ralph B D’Agostino. Goodness-of-Fit Techniques, volume 68. CRC press, 1986.
179
+
180
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density Estimation Using Real NVP. In International Conference on Learning Representations (ICLR), 2017.
181
+
182
+ Edward J Dudewicz and Edward C Van Der Meulen. Entropy-Based Tests of Uniformity. Journal of the American Statistical Association, 76(376):967–974, 1981.
183
+
184
+ Bradley Efron. Bootstrap Methods: Another Look at the Jackknife. In Breakthroughs in statistics, pp. 569–593. Springer, 1992.
185
+
186
+ Bradley Efron and Robert J Tibshirani. An Introduction to the Bootstrap. CRC press, 1994.
187
+
188
+ RL Eubank and VN LaRiccia. Asymptotic Comparison of Cramer-von Mises and Nonparametric Function Estimation Techniques for Testing Goodness-of-Fit. The Annals of Statistics, 20(4): 2071–2086, 1992.
189
+
190
+ Javier Nunez Garcia, Zoltan Kutalik, Kwang-Hyun Cho, and Olaf Wolkenhauer. Level Sets and ˜ Minimum Volume Sets of Probability Density Functions. International Journal of Approximate Reasoning, 34(1):25–47, 2003.
191
+
192
+ Assaf Glazer, Michael Lindenbaum, and Shaul Markovitch. Learning High-Density Regions for a Generalized Kolmogorov-Smirnov Test in High-Dimensional Data. In Advances in Neural Information Processing Systems, pp. 728–736, 2012.
193
+
194
+ D.V. Gokhale. On Entropy-Based Goodness-of-Fit Tests. Computational Statistics & Data Analysis, 1:157 – 165, 1983.
195
+
196
+ 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 (NeurIPS), 2014.
197
+
198
+ Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Scholkopf, and Alexander Smola. ¨ A Kernel Two-Sample Test. Journal of Machine Learning Research, 13(Mar):723–773, 2012.
199
+
200
+ Shelby J Haberman. A Warning on the Use of Chi-Squared Statistics with Frequency Tables with Small Expected Cell Counts. Journal of the American Statistical Association, 83(402):555–560, 1988.
201
+
202
+ Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep Anomaly Detection with Outlier Exposure. In International Conference on Learning Representations (ICLR), 2019.
203
+
204
+ Catherine Huber-Carol, Narayanaswamy Balakrishnan, M Nikulin, and M Mesbah. Goodness-of-Fit Tests and Model Validity. Springer Science & Business Media, 2012.
205
+
206
+ Tommi Jaakkola and David Haussler. Exploiting Generative Models in Discriminative Classifiers. In Advances in Neural Information Processing Systems, pp. 487–493, 1999.
207
+
208
+ Harry Joe. Estimation of Entropy and Other Functionals of a Multivariate Density. Annals of the Institute of Statistical Mathematics, 41(4):683–697, 1989.
209
+
210
+ Diederik P. Kingma and Prafulla Dhariwal. Glow: Generative Flow with Invertible 1x1 Convolutions. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
211
+
212
+ Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. International Conference on Learning Representations (ICLR), 2014.
213
+
214
+ Qiang Liu, Jason Lee, and Michael Jordan. A Kernelized Stein Discrepancy for Goodness-of-Fit Tests. In International Conference on Machine Learning, pp. 276–284, 2016.
215
+
216
+ Frank J Massey Jr. The Kolmogorov-Smirnov Test for Goodness of Fit. Journal of the American Statistical Association, 46(253):68–78, 1951.
217
+
218
+ Shakir Mohamed and Balaji Lakshminarayanan. Learning in Implicit Generative Models. ArXiv e-Print, 2016.
219
+
220
+ Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do Deep Generative Models Know What They Don’t Know? In International Conference on Learning Representations (ICLR), 2019.
221
+
222
+ Jerzy Neyman and Egon Sharpe Pearson. On the Problem of the Most Efficient Tests of Statistical Hypotheses. Philosophical Transactions of the Royal Society of London. Series A, 231(694-706): 289–337, 1933.
223
+
224
+ Hadi Alizadeh Noughabi and Naser Reza Arghami. General Treatment of Goodness-of-Fit Tests Based on Kullback-Leibler Information. Journal of Statistical Computation and Simulation, 83 (8):1556–1569, 2013.
225
+
226
+ Lucas Parra, Gustavo Deco, and Stefan Miesbach. Statistical Independence and Novelty Detection with Information Preserving Nonlinear Maps. Neural Computation, 8(2):260–269, 1996.
227
+
228
+ Emanuel Parzen. Goodness of Fit Tests and Entropy. Technical report, Texas A&M University, Department of Statistics, 1990.
229
+ Marco AF Pimentel, David A Clifton, Lei Clifton, and Lionel Tarassenko. A Review of Novelty Detection. Signal Processing, 99:215–249, 2014.
230
+ John C Platt, John Shawe-Taylor, Alex J Smola, Robert C Williamson, et al. Estimating the Support of a High-Dimensional Distribution. Neural Computation, 2001.
231
+ Wolfgang Polonik. Minimum Volume Sets and Generalized Quantile Processes. Stochastic Processes and Their Applications, 69(1):1–24, 1997.
232
+ Wolfgang Polonik. Concentration and Goodness-of-Fit in Higher Dimensions: (Asymptotically) Distribution-Free Methods. The Annals of Statistics, 27(4):1210–1229, 1999.
233
+ Jie Ren, Peter J Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark A DePristo, Joshua V Dillon, and Balaji Lakshminarayanan. Likelihood Ratios for Out-of-Distribution Detection. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
234
+ Danilo Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. In Proceedings of the 31st International Conference on Machine Learning (ICML), pp. 1278–1286, 2014.
235
+ Mihaela Rosca, Balaji Lakshminarayanan, and Shakir Mohamed. Distribution Matching in Variational Inference. ArXiv e-Print arXiv:1802.06847, 2018.
236
+ Elyas Sabeti and Anders Hst-Madsen. Data Discovery and Anomaly Detection Using Atypicality for Real-Valued Data. Entropy, 21(3), 2019.
237
+ Thomas W Sager. An Iterative Method for Estimating a Multivariate Mode and Isopleth. Journal of the American Statistical Association, 74(366a):329–339, 1979.
238
+ Clayton D Scott and Robert D Nowak. Learning Minimum Volume Sets. Journal of Machine Learning Research, 7(Apr):665–704, 2006.
239
+ Alireza Shafaei, Mark Schmidt, and James J Little. Does Your Model Know the Digit 6 Is Not a Cat? A Less Biased Evaluation of “Outlier” Detectors. ArXiv e-Print arXiv:1809.04729, 2018.
240
+ Claude Elwood Shannon. A Mathematical Theory of Communication. Bell System Technical Journal, 27(3):379–423, 1948.
241
+ V´ıt Skv ˇ ara, Tom ´ a´s Pevn ˇ y, and V \` aclav ´ Smˇ ´ıdl. Are Generative Deep Models for Novelty Detection Truly Better? KDD Workshop on Outlier Detection De-Constructed (ODD v5.0), 2018.
242
+ Michael A Stephens. EDF Statistics for Goodness of Fit and Some Comparisons. Journal of the American Statistical Association, 69(347):730–737, 1974.
243
+ EG Tabak and Cristina V Turner. A Family of Nonparametric Density Estimation Algorithms. Communications on Pure and Applied Mathematics, 66(2):145–164, 2013.
244
+ L Tarassenko, P Hayton, N Cerneaz, and M Brady. Novelty Detection for the Identification of Masses in Mammograms. In 1995 Fourth International Conference on Artificial Neural Networks, pp. 442–447. IET, 1995.
245
+ Aaron van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, Alex Graves, et al. Condi- ¨ tional Image Generation with Pixel CNN Decoders. In Advances in Neural Information Processing Systems (NeurIPS), 2016.
246
+ Oldrich Vasicek. A Test for Normality Based on Sample Entropy. Journal of the Royal Statistical Society: Series B (Methodological), 38(1):54–59, 1976.
247
+ Roman Vershynin. High-Dimensional Probability: An Introduction with Applications in Data Science, volume 47. Cambridge University Press, 2018.
248
+ Larry Wasserman. All of Nonparametric Statistics. Springer Science & Business Media, 2006.
249
+ Samuel S Wilks. The Large-Sample Distribution of the Likelihood Ratio for Testing Composite Hypotheses. The Annals of Mathematical Statistics, 9(1):60–62, 1938.
250
+
251
+ # A THEORETICAL PROPERTIES
252
+
253
+ # A.1 CONNECTION BETWEEN ENTROPY AND GAUSSIAN ANNULUS
254
+
255
+ For the sake of completeness, we make explicit the connection between Definition 2.1 and the Gaussian annulus example. Plugging in the spherical Gaussian’s entropy and density function into Equation 1, we have:
256
+
257
+ $$
258
+ \begin{array} { l } { \displaystyle \epsilon \geq \left| d \log \sigma + \frac { d } { 2 } ( 1 + \log 2 \pi ) - d \log \sigma - \frac { d } { 2 } \log 2 \pi - \frac { 1 } { N } \sum _ { n } \frac { | | \mathbf { x } _ { n } - \mu | | _ { 2 } ^ { 2 } } { 2 \sigma ^ { 2 } } \right| } \\ { \displaystyle \quad = \frac { 1 } { 2 } \left| d - \frac { 1 } { N } \sum _ { n } \frac { | | \mathbf { x } _ { n } - \mu | | _ { 2 } ^ { 2 } } { \sigma ^ { 2 } } \right| . } \end{array}
259
+ $$
260
+
261
+ For $N = 1$ , we see that any point $\mathbf { x }$ that satisfies $| | \mathbf { x } - \mu | | _ { 2 } = \sigma { \sqrt { d } }$ guarantees the bound for any $\epsilon$ :
262
+
263
+ $$
264
+ \epsilon \geq \frac { 1 } { 2 } \left| d - \frac { ( \sigma \sqrt { d } ) ^ { 2 } } { \sigma ^ { 2 } } \right| = \frac { 1 } { 2 } \left| d - \frac { \sigma ^ { 2 } d } { \sigma ^ { 2 } } \right| = 0 .
265
+ $$
266
+
267
+ Recalling Figure 1(a), $\sigma { \sqrt { d } }$ is exactly the radius of the annulus at which the Gaussian’s mass con-√ centrates. Of course as $\epsilon$ grows, points further from or nearer to the mean than $\sigma { \sqrt { d } }$ are included as typical. The behavior for finite $N$ is harder to characterize, as the definition is essential testing the $\epsilon$ -bound for the average squared norm. Yet we know that for large samples $N \to \infty$ ,
268
+
269
+ $$
270
+ { \frac { 1 } { N } } \sum _ { n } { \frac { | | x _ { n } - \mu | | _ { 2 } ^ { 2 } } { \sigma ^ { 2 } } } \to { \frac { \mathbb { E } [ | | \mathbf { x } - \mu | | _ { 2 } ^ { 2 } ] } { \sigma ^ { 2 } } } = d ,
271
+ $$
272
+
273
+ which again allows the bound to hold for any $\epsilon$
274
+
275
+ # A.2 CONSISTENCY OF THE TEST
276
+
277
+ Below we show that the test presented in Section 3.2 is consistent unless $\mathcal { A } _ { \epsilon } ^ { M } [ { \boldsymbol { q } } ( \mathbf { x } ) ] \subseteq \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$
278
+
279
+ Proposition A.1 $\mathbf { p } _ { \pmb { \theta } } \overset { \mathbf { d } } { = } \mathbf { q }$ When $\tilde { \mathbf { X } } \sim p ( \mathbf { x } ; \pmb { \theta } )$ , the test statistic
280
+
281
+ $$
282
+ | \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \log p ( \tilde { x } _ { m } ; \pmb { \theta } ) - \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] | = \hat { \epsilon } \xrightarrow [ ] { p } 0 \ a s M \infty .
283
+ $$
284
+
285
+ Proof : The result follows directly from the AEP (Cover & Thomas, 2012). Alternatively, as $M $ $\begin{array} { r } { \infty , \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \log p ( \tilde { \mathbfit { x } } _ { m } ; \pmb { \theta } ) - \mathbb { E } [ \log p ( \tilde { \mathbf { x } } ; \pmb { \theta } ) ] } \end{array}$ . We then have
286
+
287
+ $$
288
+ \begin{array} { r } { | - \mathbb { E } [ \log p ( \tilde { \mathbf { x } } ; \pmb { \theta } ) ] - \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] | = \mathrm { K L D } \left[ p ( \mathbf { x } ; \pmb { \theta } ) | | p ( \mathbf { x } ; \pmb { \theta } ) \right] = 0 . } \end{array}
289
+ $$
290
+
291
+ Proposition $\mathbf { A . 2 } { \mathbf { \nabla p } } _ { \theta } \neq \mathbf { q }$ When $\begin{array} { l l } { \tilde { \mathbf { X } } } & { \sim } & { q ( \mathbf { x } ) } \end{array}$ such that $p ( \mathbf { x } ; \pmb { \theta } ) \neq q ( \mathbf { x } )$ and $\mathcal { A } _ { \epsilon } ^ { M } [ q ( \mathbf { x } ) ]$ 6⊆ $\mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ , the test statistic
292
+
293
+ $$
294
+ | \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \log p ( \tilde { x } _ { m } ; \pmb { \theta } ) - \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] | > 0 ~ a s ~ M \infty .
295
+ $$
296
+
297
+ Prothat $( B y$ $M \infty$ ,a $\begin{array} { r } { \frac { 1 } { M } \sum _ { m = 1 } ^ { M } - \log p ( \tilde { \mathbfit { x } } _ { m } ; \pmb { \theta } ) - \mathbb { E } _ { q } [ \log p ( \tilde { \mathbfit { x } } ; \pmb { \theta } ) ] } \end{array}$ . Assume Definition $\left| - \mathbb { E } _ { q } [ \log p ( \tilde { \mathbf { x } } ; \pmb { \theta } ) ] - \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] \right| = 0$ $\mathcal { A } _ { \epsilon } ^ { M } [ { \boldsymbol { q } } ( \mathbf { x } ) ] \subset \mathcal { A } _ { \epsilon } ^ { M } [ { \boldsymbol { p } } ( \mathbf { x } ; \pmb { \theta } ) ]$ 2.1 we have
298
+
299
+ $$
300
+ \mathbb { H } [ p ( \mathbf { x } ) ] - \epsilon \ \leq \ - \mathbb { E } _ { q } [ \log p ( \tilde { \mathbf { x } } ; \theta ) ] \ \leq \ \mathbb { H } [ p ( \mathbf { x } ) ] + \epsilon ,
301
+ $$
302
+
303
+ which implies that $\mathcal { A } _ { \epsilon } ^ { M } [ \boldsymbol { q } ( \mathbf { x } ) ] \subseteq \mathcal { A } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ for sufficiently large $M$ . This contradicts our assumption that $\bar { \mathcal { A } } _ { \epsilon } ^ { M } [ q ( \mathbf { x } ) ] \ \bar { \mathcal { G } } \ \bar { \mathcal { A } } _ { \epsilon } ^ { M } [ p ( \mathbf { x } ; \pmb { \theta } ) ]$ and therefore $\lvert - \mathbb { E } _ { q } [ \log { \bar { p } ( \tilde { \mathbf { x } } ; \mathbf { \bar { \pmb { \theta } } } ) } ] - \mathbb { H } [ p ( \mathbf { x } ; \pmb { \theta } ) ] \rvert > 0$ .
304
+
305
+ Algorithm 1 A Bootstrap Test for Typicality
306
+
307
+ Input: Training data $\boldsymbol { X }$ , validation data $X ^ { \prime }$ , trained model $p ( \mathbf { x } ; \pmb { \theta } )$ , number of bootstrap samples $K$ , significance level $\alpha$ , $M$ -sized batch of possibly OOD inputs $\widetilde { X }$ .
308
+
309
+ Offline prior to deployment
310
+
311
+ 1. Compute $\begin{array} { r l } { { \hat { \mathbb { H } } ^ { N } [ \bar { p } ( \mathbf { x } ; \pmb { \theta } ) ] = \frac { - 1 } { N } \sum _ { n = 1 } ^ { N } \log p ( \mathbf { \boldsymbol { x } } _ { n } ; \pmb { \theta } ) } } \end{array}$
312
+
313
+ 2. Sample $K M$ -sized data sets from $\mathbf { X } ^ { \prime }$ using bootstrap resampling.
314
+
315
+ For all $k \in [ 1 , K ]$ : Compute $\begin{array} { r l } { \hat { \epsilon } _ { k } = \left| \frac { - 1 } { M } \sum _ { m = 1 } ^ { M } \log p ( \pmb { x } _ { k , m } ^ { \prime } ; \pmb { \theta } ) - \hat { \mathbb { H } } ^ { N } [ p ( \mathbf { x } ; \pmb { \theta } ) ] \right| } & { { } ( E q u a t i o n \theta ) } \end{array}$
316
+
317
+ 4. Set $\epsilon _ { \alpha } ^ { M } = \mathtt { q u a n t i l e } ( F ( \epsilon ) , \alpha )$ (e.g. $\alpha = . 9 9 ,$
318
+
319
+ Online during deployment
320
+
321
+ Return $\widetilde { \mathbf { X } }$ is out-of-distribution Else: Return $\widetilde { \mathbf { X } }$ is in-distribution
322
+
323
+ # B ALGORITHMIC IMPLEMENTATION
324
+
325
+ The pseudocode of the procedure is described in Algorithm 1.
326
+
327
+ # C GENERATIVE MODEL DETAILS
328
+
329
+ Glow Our Glow (Kingma & Dhariwal, 2018) implementation was derived from OpenAI’s open source repository6 and modified following the specifications in Appendix A of Nalisnick et al. (2019). All versions were trained with RMSProp, batch size of 32, with a learning rate of $1 \times 1 0 ^ { - 5 }$ for 100k steps and decayed by a factor of 2 after 80k and 90k steps. All priors were chosen to be standard Normal distributions. We follow Nalisnick et al. (2019)’s zero-initialization strategy (last coupling layer set to zero) and in turn did not apply any normalization. Similarly, our convolutional layers were initialized by sampling from the same truncated Normal distribution (Nalisnick et al., 2019). For our FashionMNIST experiment, Glow had two blocks of 16 affine coupling layers (ACLs) (Dinh et al., 2017). The spatial dimension was only squeezed between blocks. For the SVHN, CIFAR-10, and ImageNet models, we used three blocks of 8 ACLs with multi-scale factorization occurring between each block. All ACL transformations used a three-layer highway network. 200 hidden units were used for fashionMNIST and 400 for all other data sets.
330
+
331
+ PixelCNN We trained a GatedPixelCNN (van den Oord et al., 2016) using Adam $\mathrm { 1 \times 1 0 ^ { - 4 } }$ initial learning rate, decayed by $1 / 3$ at steps $8 0 \mathrm { k }$ and $9 0 \mathrm { k }$ , 100k total steps) for FashionMNIST and RMSProp $\bar { ( 1 \times 1 0 ^ { - 4 } }$ initial learning rate, decayed by $1 / 3$ at steps 120k, 180k, and 195k, 200k total steps) for all other data sets. The FashionMNIST network had 5 gated layers (32 features) and a 256-sized skip connection. All other networks used 15 gated layers (128 features) and a 1024-sized skip connection
332
+
333
+ Variational Autoencoder We used the convolutional decoder VAE (Kingma & Welling, 2014) variant described by Rosca et al. (2018). For Fashion MNIST, the decoder contained three convolutional layers with filter sizes 32, 32, and 256 and stides of 2, 2, and 1. Training was done again via RMSProp $\mathrm { 1 \times 1 0 ^ { - 4 } }$ initial learning rate, no decay, 200k total steps). For all other models, we followed the specifications in Rosca et al. (2018) Appendix K.
334
+
335
+ # D EXPERIMENTAL DETAILS
336
+
337
+ MMD and KSD Kernels We found that MMD and KSD only had good performance when using the Fisher kernel (Jaakkola & Haussler, 1999): $\begin{array} { r } { k ( \pmb { x } _ { i } , \pmb { x } _ { j } ) = \bar { ( } \nabla _ { \pmb { \theta } } \log p ( \hat { \pmb { x } } _ { i } ; \pmb { \theta } ) ) ^ { T } \nabla _ { \pmb { \theta } } \log p ( \pmb { x } _ { j } ; \pmb { \theta } ) } \end{array}$ . All other kernels attempted required substantial tuning to the scale parameters and we did not want to assume access to enough data to perform this tuning. The ineffectiveness of MMD on pixelspace has been noted previously (Bikowski et al., 2018). Furthermore, we found the memory cost of implementing the traditional Fisher kernel to be quite costly for Glow, each vector having 2million $^ +$ elements. Hence in the experiments we use the kernel modified such that the derivative is taken w.r.t. the input (making it the likelihood score): $\begin{array} { r } { k ^ { \prime } ( \pmb { x } _ { i } , \pmb { x } _ { j } ) = ( \nabla _ { \pmb { x } _ { i } } \log p ( \pmb { x } _ { i } ; \pmb { \theta } ) ) ^ { T } \nabla _ { \pmb { x } _ { j } } \log p ( \pmb { x } _ { j } ; \pmb { \theta } ) . } \end{array}$ .
338
+
339
+ Data Set Splits and Bootstrap Re-Samples For each data set we used the canonical train-test splits. To construct the validation set and perform bootstrapping, we extracted 5, 000 samples from the test split and bootstrap sampled (with replacement) $K = 5 0$ data sets to calculate $F ( \epsilon )$ . We didn’t find using $K > 5 0$ to markedly change performance. We then extracted another $5 , 0 0 0$ samples from the test split, divided them into $M$ -sized batches, and classified each other as OOD or not according to the various tests. We repeated this whole process 10 times, randomizing the instances in the validation and testing splits, in order to compute the means and standard deviations that are reported in Tables 1 and 2.
340
+
341
+ $\alpha$ -Level In preliminary experiments, we did not find a notable difference in type-II error when using $\alpha = 0 . 9 5$ vs $\alpha = 0 . 9 9$ . Using the latter slightly improved type-I error and thus we used that value for all experiments and all methods.
342
+
343
+ # E ADDITIONAL RESULTS
344
+
345
+ # E.1 COMPARING ENTROPY ESTIMATORS
346
+
347
+ In the tables below, we report results comparing the two entropy estimators considered—the Monte Carlo approximation with samples from the model (Equation 4) vs the resubstitution estimator (Equation 5). We see that the samples-based estimator performs better in only one setting, FashionMNIST vs MNIST at $M = 2$ . In all other cases, the resubstitution estimator performs equally well or better. In fact, the samples-based estimator could not detect NotMNIST as OOD at all, having $0 \%$ even at $M = 1 0$ and $M = 2 5$ . This inferior performance is mostly due to the distribution of likelihoods being more diffuse when computed with samples. We suspect improvements to the generative models that enable them to better capture the true generative process will in turn improve the MC sample-based estimator.
348
+
349
+ Table 3: Grayscale Images: Fraction of $M$ -Sized Batches Classified as OOD. The in-distribution column reflects type-I error and the MNIST and NotMNIST columns reflect type-II.
350
+
351
+ <table><tr><td>METHOD</td><td>IN-DIST.</td><td>M=2 MNIST</td><td>NOTMNIST</td><td>IN-DIST.</td><td>M=10 MNIST</td><td>NOTMNIST</td><td>IN-DIST.</td><td>M=25 MNIST</td><td>NOTMNIST</td></tr><tr><td></td><td></td><td></td><td></td><td>Glow Trained on FashionMNIST</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10"></td></tr><tr><td>Typicality Test w/Data</td><td>0.02±.01</td><td>0.14±.10</td><td>0.08±.04</td><td>0.02±.02</td><td>1.00±.00</td><td>0.69±.11</td><td>0.01±.00</td><td>1.00±.00</td><td>1.00±.00</td></tr><tr><td>Typicality Test w/ Samples</td><td>0.02±.01</td><td>0.44±.17</td><td>0.00±.00</td><td>0.03±.03</td><td>1.00±.00</td><td>0.00±.00</td><td>0.06±.05</td><td>1.00±.00</td><td>0.00±.00</td></tr></table>
352
+
353
+ Table 4: Natural Images: Fraction of $M$ -Sized Batches Classified as OOD.
354
+
355
+ <table><tr><td>METHOD</td><td>SVHN</td><td>M=2 CIFAR-10</td><td>IN-DIST.</td><td>SVHN</td><td>M=10 CIFAR-10</td><td>IN-DIST.</td><td>SVHN</td><td>M=25 CIFAR-10</td><td>IN-DIST.</td></tr><tr><td colspan="10">Glow Trained on ImageNet</td></tr><tr><td>Typicality Test w/ Data</td><td>0.78±.08</td><td>0.02±.01</td><td>0.01±.00</td><td>1.00±.00</td><td>0.20±.06</td><td>0.01±.01</td><td>1.00±.00</td><td>0.74±.05</td><td>0.01±.01</td></tr><tr><td>Typicality Test w/ Samples</td><td>0.29±.08</td><td>0.02±.01</td><td>0.01±.00</td><td>1.00±.00</td><td>0.16±.05</td><td>0.01±.01</td><td>1.00±.00</td><td>0.73±.08</td><td>0.01±.01</td></tr></table>
356
+
357
+ # E.2 REPLICATION OF WAIC RESULTS
358
+
359
+ We did not include WAIC because we were not able to replicate the results of Choi et al. (2019). The figure to the right shows a WAIC histogram for CIFAR-10 (blue) vs SVHN (OOD, orange) computed using our Glow implementation (ensemble size 5). We attempted to reproduce Choi et al.’s Figure 3, which shows SVHN having lower and more dispersed scores than CIFAR-10. We did not observe this: all SVHN WAIC scores overlap with or are higher than CIFAR-10’s, meaning that SVHN can not be distinguished as the OOD set. Two differences between our Glow implementation and theirs were that they use Adam (vs RMSprop) and early stopping on a validation set. We found neither difference affected results.
360
+
361
+ ![](images/e7ee42e31e3995f63e1417b04418cd596cb8bdc29340e0cf0b8432ee65a8b445.jpg)
362
+
363
+ # E.3 VARYING M FOR GLOW
364
+
365
+ ![](images/51f727bbd866271aba6a9f2ab6d0704c474a835325e64227cb2f5ce44c7494dc.jpg)
366
+ Figure 4 reports results for our typicality test on Glow, varying $M$ from [1, 150]. Table 2’s results are a subset of these. We also report evaluations using CIFAR-100 as an OOD set.
367
+ Figure 4: Natural Image OOD Detection for Glow. The above plots show the fraction of $M .$ -sized batches rejected for three Glow models trained on SVHN, CIFAR-10, and ImageNet. The OOD distribution data sets are these three training sets as well as CIFAR-100.
md/train/rJqBEPcxe/rJqBEPcxe.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ZONEOUT: REGULARIZING RNNS BY RANDOMLY PRESERVING HIDDEN ACTIVATIONS
2
+
3
+ David Krueger1,?, Tegan Maharaj2,?, János Kramár2
4
+ Mohammad Pezeshki1 Nicolas Ballas1, Nan Rosemary ${ \bf K } \mathbf { e } ^ { 2 }$ , Anirudh Goyal1
5
+ Yoshua Bengio1†, Aaron Courville1‡, Christopher Pal2
6
+
7
+ 1 MILA, Université de Montréal, firstname.lastname@umontreal.ca.
8
+ 2 École Polytechnique de Montréal, firstname.lastname@polymtl.ca.
9
+ ? Equal contributions. †CIFAR Senior Fellow. ‡CIFAR Fellow.
10
+
11
+ # ABSTRACT
12
+
13
+ We propose zoneout, a novel method for regularizing RNNs. At each timestep, zoneout stochastically forces some hidden units to maintain their previous values. Like dropout, zoneout uses random noise to train a pseudo-ensemble, improving generalization. But by preserving instead of dropping hidden units, gradient information and state information are more readily propagated through time, as in feedforward stochastic depth networks. We perform an empirical investigation of various RNN regularizers, and find that zoneout gives significant performance improvements across tasks. We achieve competitive results with relatively simple models in character- and word-level language modelling on the Penn Treebank and Text8 datasets, and combining with recurrent batch normalization (Cooijmans et al., 2016) yields state-of-the-art results on permuted sequential MNIST.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Regularizing neural nets can significantly improve performance, as indicated by the widespread use of early stopping, and success of regularization methods such as dropout and its recurrent variants (Hinton et al., 2012; Srivastava et al., 2014; Zaremba et al., 2014; Gal, 2015). In this paper, we address the issue of regularization in recurrent neural networks (RNNs) with a novel method called zoneout.
18
+
19
+ RNNs sequentially construct fixed-length representations of arbitrary-length sequences by folding new observations into their hidden state using an input-dependent transition operator. The repeated application of the same transition operator at the different time steps of the sequence, however, can make the dynamics of an RNN sensitive to minor perturbations in the hidden state; the transition dynamics can magnify components of these perturbations exponentially. Zoneout aims to improve RNNs’ robustness to perturbations in the hidden state in order to regularize transition dynamics.
20
+
21
+ Like dropout, zoneout injects noise during training. But instead of setting some units’ activations to 0 as in dropout, zoneout randomly replaces some units’ activations with their activations from the previous timestep. As in dropout, we use the expectation of the random noise at test time. This results in a simple regularization approach which can be applied through time for any RNN architecture, and can be conceptually extended to any model whose state varies over time.
22
+
23
+ Compared with dropout, zoneout is appealing because it preserves information flow forwards and backwards through the network. This helps combat the vanishing gradient problem (Hochreiter, 1991; Bengio et al., 1994), as we observe experimentally.
24
+
25
+ We also empirically evaluate zoneout on classification using the permuted sequential MNIST dataset, and on language modelling using the Penn Treebank and Text8 datasets, demonstrating competitive or state of the art performance across tasks. In particular, we show that zoneout performs competitively with other proposed regularization methods for RNNs, including recently-proposed dropout variants. Code for replicating all experiments can be found at: http://github.com/teganmaharaj/zoneout
26
+
27
+ # 2 RELATED WORK
28
+
29
+ # 2.1 RELATIONSHIP TO DROPOUT
30
+
31
+ Zoneout can be seen as a selective application of dropout to some of the nodes in a modified computational graph, as shown in Figure 1. In zoneout, instead of dropping out (being set to 0), units zone out and are set to their previous value $( h _ { t } = h _ { t - 1 }$ ). Zoneout, like dropout, can be viewed as a way to train a pseudo-ensemble (Bachman et al., 2014), injecting noise using a stochastic “identity-mask” rather than a zero-mask. We conjecture that identity-masking is more appropriate for RNNs, since it makes it easier for the network to preserve information from previous timesteps going forward, and facilitates, rather than hinders, the flow of gradient information going backward, as we demonstrate experimentally.
32
+
33
+ ![](images/fe3d0d0d8949fb13b47017abb5a00b1b00be4e3299f8baf423a1a7fc3e0fae82.jpg)
34
+ Figure 1: Zoneout as a special case of dropout; $\tilde { h } _ { t }$ is the unit $h$ ’s hidden activation for the next time step (if not zoned out). Zoneout can be seen as applying dropout on the hidden state delta, $\tilde { h } _ { t } - h _ { t - 1 }$ . When this update is dropped out (represented by the dashed line), $h _ { t }$ becomes $h _ { t - 1 }$ .
35
+
36
+ # 2.2 DROPOUT IN RNNS
37
+
38
+ Initially successful applications of dropout in RNNs (Pham et al., 2013; Zaremba et al., 2014) only applied dropout to feed-forward connections (“up the stack”), and not recurrent connections (“forward through time”), but several recent works (Semeniuta et al., 2016; Moon et al., 2015; Gal, 2015) propose methods that are not limited in this way. Bayer et al. (2013) successfully apply fast dropout (Wang & Manning, 2013), a deterministic approximation of dropout, to RNNs.
39
+
40
+ Semeniuta et al. (2016) apply recurrent dropout to the updates to LSTM memory cells (or GRU states), i.e. they drop out the input/update gate in LSTM/GRU. Like zoneout, their approach prevents the loss of long-term memories built up in the states/cells of GRUs/LSTMS, but zoneout does this by preserving units’ activations exactly. This difference is most salient when zoning out the hidden states (not the memory cells) of an LSTM, for which there is no analogue in recurrent dropout. Whereas saturated output gates or output nonlinearities would cause recurrent dropout to suffer from vanishing gradients (Bengio et al., 1994), zoned-out units still propagate gradients effectively in this situation. Furthermore, while the recurrent dropout method is specific to LSTMs and GRUs, zoneout generalizes to any model that sequentially builds distributed representations of its input, including vanilla RNNs.
41
+
42
+ Also motivated by preventing memory loss, Moon et al. (2015) propose rnnDrop. This technique amounts to using the same dropout mask at every timestep, which the authors show results in improved performance on speech recognition in their experiments. Semeniuta et al. (2016) show, however, that past states’ influence vanishes exponentially as a function of dropout probability when taking the expectation at test time in rnnDrop; this is problematic for tasks involving longer-term dependencies.
43
+
44
+ Gal (2015) propose another technique which uses the same mask at each timestep. Motivated by variational inference, they drop out the rows of weight matrices in the input and output embeddings and LSTM gates, instead of dropping units’ activations. The proposed variational RNN technique achieves single-model state-of-the-art test perplexity of 73.4 on word-level language modelling of Penn Treebank.
45
+
46
+ # 2.3 RELATIONSHIP TO STOCHASTIC DEPTH
47
+
48
+ Zoneout can also be viewed as a per-unit version of stochastic depth (Huang et al., 2016), which randomly drops entire layers of feed-forward residual networks (ResNets (He et al., 2015)). This is equivalent to zoning out all of the units of a layer at the same time. In a typical RNN, there is a new input at each timestep, causing issues for a naive implementation of stochastic depth. Zoning out an entire layer in an RNN means the input at the corresponding timestep is completely ignored, whereas zoning out individual units allows the RNN to take each element of its input sequence into account. We also found that using residual connections in recurrent nets led to instability, presumably due to the parameter sharing in RNNs. Concurrent with our work, Singh et al. (2016) propose zoneout for ResNets, calling it SkipForward. In their experiments, zoneout is outperformed by stochastic depth, dropout, and their proposed Swapout technique, which randomly drops either or both of the identity or residual connections. Unlike Singh et al. (2016), we apply zoneout to RNNs, and find it outperforms stochastic depth and recurrent dropout.
49
+
50
+ # 2.4 SELECTIVELY UPDATING HIDDEN UNITS
51
+
52
+ Like zoneout, clockwork RNNs (Koutnik et al., 2014) and hierarchical RNNs (Hihi & Bengio, 1996) update only some units’ activations at every timestep, but their updates are periodic, whereas zoneout’s are stochastic. Inspired by clockwork RNNs, we experimented with zoneout variants that target different update rates or schedules for different units, but did not find any performance benefit. Hierarchical multiscale LSTMs (Chung et al., 2016) learn update probabilities for different units using the straight-through estimator (Bengio et al., 2013; Courbariaux et al., 2015), and combined with recently-proposed Layer Normalization (Ba et al., 2016), achieve competitive results on a variety of tasks. As the authors note, their method can be interpreted as an input-dependent form of adaptive zoneout.
53
+
54
+ In recent work, Ha et al. (2016) use a hypernetwork to dynamically rescale the row-weights of a primary LSTM network, achieving state-of-the-art 1.21 BPC on character-level Penn Treebank when combined with layer normalization (Ba et al., 2016) in a two-layer network. This scaling can be viewed as an adaptive, differentiable version of the variational LSTM (Gal, 2015), and could similarly be used to create an adaptive, differentiable version of zoneout. Very recent work conditions zoneout probabilities on suprisal (a measure of the discrepancy between the predicted and actual state), and sets a new state of the art on enwik8 (Rocki et al., 2016).
55
+
56
+ # 3 ZONEOUT AND PRELIMINARIES
57
+
58
+ We now explain zoneout in full detail, and compare with other forms of dropout in RNNs. We start by reviewing recurrent neural networks (RNNs).
59
+
60
+ # 3.1 RECURRENT NEURAL NETWORKS
61
+
62
+ Recurrent neural networks process data $x _ { 1 } , x _ { 2 } , \ldots , x _ { T }$ sequentially, constructing a corresponding sequence of representations, $h _ { 1 } , h _ { 2 } , \ldots , h _ { T }$ . Each hidden state is trained (implicitly) to remember and emphasize all task-relevant aspects of the preceding inputs, and to incorporate new inputs via a transition operator, $\tau$ , which converts the present hidden state and input into a new hidden state: $h _ { t } = \mathcal { T } ( h _ { t - 1 } , x _ { t } )$ . Zoneout modifies these dynamics by mixing the original transition operator $\tilde { \tau }$ with the identity operator (as opposed to the null operator used in dropout), according to a vector of Bernoulli masks, $d _ { t }$ :
63
+
64
+ $$
65
+ { \mathcal { T } } = d _ { t } \odot { \tilde { \mathcal { T } } } + ( 1 - d _ { t } ) \odot 1 \qquad { \mathrm { D r o p o u t : } } \qquad { \mathcal { T } } = d _ { t } \odot { \tilde { \mathcal { T } } } + ( 1 - d _ { t } ) \odot 0
66
+ $$
67
+
68
+ # 3.2 LONG SHORT-TERM MEMORY
69
+
70
+ In long short-term memory RNNs (LSTMs) (Hochreiter & Schmidhuber, 1997), the hidden state is divided into memory cell $c _ { t }$ , intended for internal long-term storage, and hidden state $h _ { t }$ , used as a transient representation of state at timestep $t$ . In the most widely used formulation of an LSTM (Gers et al., 2000), $c _ { t }$ and $h _ { t }$ are computed via a set of four “gates”, including the forget gate, $f _ { t }$ , which directly connects $c _ { t }$ to the memories of the previous timestep $c _ { t - 1 }$ , via an element-wise multiplication. Large values of the forget gate cause the cell to remember most (not all) of its previous value. The other gates control the flow of information in $( i _ { t } , g _ { t } )$ and out $\left( o _ { t } \right)$ of the cell. Each gate has a weight matrix and bias vector; for example the forget gate has $W _ { x f }$ , $W _ { h f }$ , and $b _ { f }$ . For brevity, we will write these as $W _ { x } , W _ { h } , b$ .
71
+
72
+ An LSTM is defined as follows:
73
+
74
+ $$
75
+ \begin{array} { r l } & { i _ { t } , f _ { t } , o _ { t } = \sigma ( W _ { x } x _ { t } + W _ { h } h _ { t - 1 } + b ) } \\ & { \qquad g _ { t } = \operatorname { t a n h } ( W _ { x g } x _ { t } + W _ { h g } h _ { t - 1 } + b _ { g } ) } \\ & { \qquad c _ { t } = f _ { t } \odot c _ { t - 1 } + i _ { t } \odot g _ { t } } \\ & { \qquad h _ { t } = o _ { t } \odot \operatorname { t a n h } ( c _ { t } ) } \end{array}
76
+ $$
77
+
78
+ A naive application of dropout in LSTMs would zero-mask either or both of the memory cells and hidden states, without changing the computation of the gates $( i , f , o , g )$ . Dropping memory cells, for example, changes the computation of $c _ { t }$ as follows:
79
+
80
+ $$
81
+ c _ { t } = d _ { t } \odot ( f _ { t } \odot c _ { t - 1 } + i _ { t } \odot g _ { t } )
82
+ $$
83
+
84
+ Alternatives abound, however; masks can be applied to any subset of the gates, cells, and states. Semeniuta et al. (2016), for instance, zero-mask the input gate:
85
+
86
+ $$
87
+ c _ { t } = \left( f _ { t } \odot c _ { t - 1 } + d _ { t } \odot i _ { t } \odot g _ { t } \right)
88
+ $$
89
+
90
+ When the input gate is masked like this, there is no additive contribution from the input or hidden state, and the value of the memory cell simply decays according to the forget gate.
91
+
92
+ ![](images/fca1f5e28d087dfc871c894a9c9f28a5b350c663ef282e077425a04520303fb9.jpg)
93
+ Figure 2: (a) Zoneout, vs (b) the recurrent dropout strategy of (Semeniuta et al., 2016) in an LSTM. Dashed lines are zero-masked; in zoneout, the corresponding dotted lines are masked with the corresponding opposite zero-mask. Rectangular nodes are embedding layers.
94
+
95
+ In zoneout, the values of the hidden state and memory cell randomly either maintain their previous value or are updated as usual. This introduces stochastic identity connections between subsequent time steps:
96
+
97
+ $$
98
+ \begin{array} { r l } & { c _ { t } = d _ { t } ^ { c } \odot c _ { t - 1 } + ( 1 - d _ { t } ^ { c } ) \odot \left( f _ { t } \odot c _ { t - 1 } + i _ { t } \odot g _ { t } \right) } \\ & { h _ { t } = d _ { t } ^ { h } \odot h _ { t - 1 } + ( 1 - d _ { t } ^ { h } ) \odot \left( o _ { t } \odot \operatorname { t a n h } \left( f _ { t } \odot c _ { t - 1 } + i _ { t } \odot g _ { t } \right) \right) } \end{array}
99
+ $$
100
+
101
+ We usually use different zoneout masks for cells and hiddens. We also experiment with a variant of recurrent dropout that reuses the input dropout mask to zoneout the corresponding output gates:
102
+
103
+ $$
104
+ \begin{array} { r l } & { c _ { t } = \left( f _ { t } \odot c _ { t - 1 } + d _ { t } \odot i _ { t } \odot g _ { t } \right) } \\ & { h _ { t } = \left( \left( 1 - d _ { t } \right) \odot o _ { t } + d _ { t } \odot o _ { t - 1 } \right) \odot \operatorname { t a n h } ( c _ { t } ) } \end{array}
105
+ $$
106
+
107
+ The motivation for this variant is to prevent the network from being forced (by the output gate) to expose a memory cell which has not been updated, and hence may contain misleading information.
108
+
109
+ # 4 EXPERIMENTS AND DISCUSSION
110
+
111
+ We evaluate zoneout’s performance on the following tasks: (1) Character-level language modelling on the Penn Treebank corpus (Marcus et al., 1993); (2) Word-level language modelling on the Penn Treebank corpus (Marcus et al., 1993); (3) Character-level language modelling on the Text8 corpus (Mahoney, 2011); (4) Classification of hand-written digits on permuted sequential MNIST (pMNIST) (Le et al., 2015). We also investigate the gradient flow to past hidden states, using pMNIST.
112
+
113
+ # 4.1 PENN TREEBANK LANGUAGE MODELLING DATASET
114
+
115
+ The Penn Treebank language model corpus contains 1 million words. The model is trained to predict the next word (evaluated on perplexity) or character (evaluated on BPC: bits per character) in a sequence. 1
116
+
117
+ # 4.1.1 CHARACTER-LEVEL
118
+
119
+ For the character-level task, we train networks with one layer of 1000 hidden units. We train LSTMs with a learning rate of 0.002 on overlapping sequences of 100 in batches of 32, optimize using Adam, and clip gradients with threshold 1. These settings match those used in Cooijmans et al. (2016). We also train GRUs and tanh-RNNs with the same parameters as above, except sequences are nonoverlapping and we use learning rates of 0.001, and 0.0003 for GRUs and tanh-RNNs respectively. Small values (0.1, 0.05) of zoneout significantly improve generalization performance for all three models. Intriguingly, we find zoneout increases training time for GRU and tanh-RNN, but decreases training time for LSTMs.
120
+
121
+ We focus our investigation on LSTM units, where the dynamics of zoning out states, cells, or both provide interesting insight into zoneout’s behaviour. Figure 3 shows our exploration of zoneout in LSTMs, for various zoneout probabilities of cells and/or hiddens. Zoneout on cells with probability 0.5 or zoneout on states with probability 0.05 both outperform the best-performing recurrent dropout $( p = 0 . 2 5 )$ . Combining $z _ { c } = 0 . 5$ and $z _ { h } = 0 . 0 5$ leads to our best-performing model, which achieves 1.27 BPC, competitive with recent state-of-the-art set by (Ha et al., 2016). We compare zoneout to recurrent dropout (for $p \in \{ 0 . 0 5 , 0 . 2 , 0 . 2 5 , 0 . 5 , 0 . 7 \} $ ), weight noise $\langle \sigma = 0 . 0 7 5$ ), norm stabilizer $( \beta = 5 0 )$ (Krueger & Memisevic, 2015), and explore stochastic depth (Huang et al., 2016) in a recurrent setting (analagous to zoning out an entire timestep). We also tried a shared-mask variant of zoneout as used in $p \mathrm { M N I S T }$ experiments, where the same mask is used for both cells and hiddens. Neither stochastic depth or shared-mask zoneout performed as well as separate masks, sampled per unit. Figure 3 shows the best performance achieved with each regularizer, as well as an unregularized LSTM baseline. Results are reported in Table 1, and learning curves shown in Figure 4.
122
+
123
+ Low zoneout probabilities (0.05-0.25) also improve over baseline in GRUs and tanh-RNNs, reducing BPC from 1.53 to 1.41 for GRU and 1.67 to 1.52 for tanh-RNN. Similarly, low zoneout probabilities work best on the hidden states of LSTMs. For memory cells in LSTMs, however, higher probabilities (around 0.5) work well, perhaps because large forget-gate values approximate the effect of cells zoning out. We conjecture that best performance is achieved with zoneout LSTMs because of the stability of having both state and cell. The probability that both will be zoned out is very low, but having one or the other zoned out carries information from the previous timestep forward, while having the other react ’normally’ to new information.
124
+
125
+ # 4.1.2 WORD-LEVEL
126
+
127
+ For the word-level task, we replicate settings from Zaremba et al. (2014)’s best single-model performance. This network has 2 layers of 1500 units, with weights initialized uniformly [-0.04, $+ 0 . 0 4 ]$ . The model is trained for 14 epochs with learning rate 1, after which the learning rate is reduced by a factor of 1.15 after each epoch. Gradient norms are clipped at 10.
128
+
129
+ With no dropout on the non-recurrent connections (i.e. zoneout as the only regularization), we do not achieve competitive results. We did not perform any search over models, and conjecture that the large model size requires regularization of the feed-forward connections. Adding zoneout ( $z _ { c } = 0 . 2 5$ and $z _ { h } = 0 . 0 2 5$ ) on the recurrent connections to the model optimized for dropout on the non-recurrent connections however, we are able to improve test perplexity from 78.4 to 77.4. We report the best performance achieved with a given technique in Table 1.
130
+
131
+ ![](images/9f7fa52a777f922d2e80196f24b93c61af9e5225c5a045e17e810a7dd2b487f8.jpg)
132
+ Figure 3: Validation BPC (bits per character) on Character-level Penn Treebank, for different probabilities of zoneout on cells $z _ { c }$ and hidden states $z _ { h }$ (left), and comparison of an unregularized LSTM, zoneout $z _ { c } = 0 . 5 , z _ { h } = 0 . 0 5$ , stochastic depth zoneout $z = 0 . 0 5$ , recurrent dropout $p = 0 . 2 5$ , norm stabilizer $\beta = 5 0$ , and weight noise $\sigma = 0 . 0 7 5$ (right).
133
+
134
+ ![](images/d87991b3e61dcb303c30c939ac2c248a52e2f3e56599db39e367897f863308b5.jpg)
135
+ Figure 4: Training and validation bits-per-character (BPC) comparing LSTM regularization methods on character-level Penn Treebank (left) and Text8. (right)
136
+
137
+ # 4.2 TEXT8
138
+
139
+ Enwik8 is a corpus made from the first $1 0 ^ { 9 }$ bytes of Wikipedia dumped on Mar. 3, 2006. Text8 is a "clean text" version of this corpus; with html tags removed, numbers spelled out, symbols converted to spaces, all lower-cased. Both datasets were created and are hosted by Mahoney (2011).
140
+
141
+ We use a single-layer network of 2000 units, initialized orthogonally, with batch size 128, learning rate 0.001, and sequence length 180. We optimize with Adam (Kingma & Ba, 2014), clip gradients to a maximum norm of 1 (Pascanu et al., 2012), and use early stopping, again matching the settings of Cooijmans et al. (2016). Results are reported in Table 1, and Figure 4 shows training and validation learning curves for zoneout $( z _ { c } = 0 . 5 , z _ { h } = 0 . 0 5 )$ ) compared to an unregularized LSTM and to recurrent dropout.
142
+
143
+ # 4.3 PERMUTED SEQUENTIAL MNIST
144
+
145
+ In sequential MNIST, pixels of an image representing a number [0-9] are presented one at a time, left to right, top to bottom. The task is to classify the number shown in the image. In $p \mathrm { M N I S T }$ , the pixels are presented in a (fixed) random order.
146
+
147
+ We compare recurrent dropout and zoneout to an unregularized LSTM baseline. All models have a single layer of 100 units, and are trained for 150 epochs using RMSProp (Tieleman & Hinton, 2012) with a decay rate of 0.5 for the moving average of gradient norms. The learning rate is set to 0.001 and the gradients are clipped to a maximum norm of 1 (Pascanu et al., 2012).
148
+
149
+ As shown in Figure 5 and Table 2, zoneout gives a significant performance boost compared to the LSTM baseline and outperforms recurrent dropout (Semeniuta et al., 2016), although recurrent batch normalization (Cooijmans et al., 2016) outperforms all three. However, by adding zoneout to the recurrent batch normalized LSTM, we achieve state of the art performance. For this setting, the zoneout mask is shared between cells and states, and the recurrent dropout probability and zoneout probabilities are both set to 0.15.
150
+
151
+ Table 1: Validation and test results of different models on the three language modelling tasks. Results are reported for the best-performing settings. Performance on Char-PTB and Text8 is measured in bitsper-character (BPC); Word-PTB is measured in perplexity. For Char-PTB and Text8 all models are 1-layer unless otherwise noted; for Word-PTB all models are 2-layer. Results above the line are from our own implementation and experiments. Models below the line are: NR-dropout (non-recurrent dropout), V-Dropout (variational dropout), RBN (recurrent batchnorm), H-LSTM+LN (HyperLSTM $^ +$ LayerNorm), 3-HM-LSTM+LN (3-layer Hierarchical Multiscale LSTM $^ +$ LayerNorm).
152
+
153
+ <table><tr><td></td><td colspan="2">Char-PTB</td><td colspan="2">Word-PTB</td><td colspan="2">Text8</td></tr><tr><td>Model</td><td>Valid</td><td>Test</td><td>Valid</td><td>Test</td><td>Valid</td><td>Test</td></tr><tr><td>Unregularized LSTM</td><td>1.466</td><td>1.356</td><td>120.7</td><td>114.5</td><td>1.396</td><td>1.408</td></tr><tr><td>Weight noise</td><td>1.507</td><td>1.344</td><td>1</td><td>1</td><td>1.356</td><td>1.367</td></tr><tr><td>Norm stabilizer</td><td>1.459</td><td>1.352</td><td>1</td><td>1</td><td>1.382</td><td>1.398</td></tr><tr><td>Stochastic depth</td><td>1.432</td><td>1.343</td><td>1</td><td>一</td><td>1.337</td><td>1.343</td></tr><tr><td>Recurrent dropout</td><td>1.396</td><td>1.286</td><td>91.6</td><td>87.0</td><td>1.386</td><td>1.401</td></tr><tr><td>Zoneout</td><td>1.362</td><td>1.252</td><td>81.4</td><td>77.4</td><td>1.331</td><td>1.336</td></tr><tr><td>NR-dropout (Zaremba et al., 2014)</td><td>、</td><td>1</td><td>82.2</td><td>78.4</td><td>1</td><td>1</td></tr><tr><td>V-dropout (Gal, 2015)</td><td>一</td><td>1</td><td>1</td><td>73.4</td><td>1</td><td></td></tr><tr><td>RBN (Cooijmans et al., 2016)</td><td>1</td><td>1.32</td><td>1</td><td>1</td><td>1</td><td>1.36</td></tr><tr><td>H-LSTM+ LN (Ha et al., 2016)</td><td>1.281</td><td>1.250</td><td></td><td></td><td></td><td>一</td></tr><tr><td>3-HM-LSTM + LN (Chung et al., 2016)</td><td>1</td><td>1.24</td><td>一</td><td>1</td><td>1</td><td>1.29</td></tr></table>
154
+
155
+ Table 2: Error rates on the pMNIST digit classification task. Zoneout outperforms recurrent dropout, and sets state of the art when combined with recurrent batch normalization.
156
+
157
+ <table><tr><td>Model</td><td>Valid</td><td>Test</td></tr><tr><td>Unregularized LSTM</td><td>0.092</td><td>0.102</td></tr><tr><td>Recurrent dropout p = 0.5</td><td>0.083</td><td>0.075</td></tr><tr><td>Zoneout zc = zh = 0.15</td><td>0.063</td><td>0.069</td></tr><tr><td>Recurrent batchnorm</td><td>1</td><td>0.046</td></tr><tr><td>Recurrent batchnorm &amp; Zoneout zc = zh = 0.15</td><td>0.045</td><td>0.041</td></tr></table>
158
+
159
+ ![](images/04d068b1519c44044614c13f0e36091977576dbcf61d04ab2adf3529545f36cc.jpg)
160
+ Figure 5: Training and validation error rates for an unregularized LSTM, recurrent dropout, and zoneout on the task of permuted sequential MNIST digit classification.
161
+
162
+ # 4.4 GRADIENT FLOW
163
+
164
+ We investigate the hypothesis that identity connections introduced by zoneout facilitate gradient flow to earlier timesteps. Vanishing gradients are a perennial issue in RNNs. As effective as many techniques are for mitigating vanishing gradients (notably the LSTM architecture Hochreiter & Schmidhuber (1997)), we can always imagine a longer sequence to train on, or a longer-term dependence we want to capture.
165
+
166
+ We compare gradient flow in an unregularized LSTM to zoning out (stochastic identity-mapping) and dropping out (stochastic zero-mapping) the recurrent connections after one epoch of training on $p \mathrm { M N I S T }$ . We compute the average gradient norms $\| \frac { \partial L } { \partial c _ { t } } \|$ of loss $L$ with respect to cell activations $c _ { t }$ at each timestep $t$ , and for each method, normalize the average gradient norms by the sum of average gradient norms for all timesteps.
167
+
168
+ Figure 6 shows that zoneout propagates gradient information to early timesteps much more effectively than dropout on the recurrent connections, and even more effectively than an unregularized LSTM. The same effect was observed for hidden states $h _ { t }$ .
169
+
170
+ ![](images/d526f126a76865692c5df5e0c7478955ede7d58821c1eb1cc722700e79c86161.jpg)
171
+ Figure 6: Normalized $\sum { \| \frac { \partial L } { \partial c _ { t } } \| }$ of loss $L$ with respect to cell activations $c _ { t }$ at each timestep $t$ for zoneout $( z _ { c } = 0 . 5 )$ , dropout $( \dot { z } _ { c } = 0 . 5 )$ , and an unregularized LSTM on one epoch of $p \mathrm { M N I S T }$
172
+
173
+ # 5 CONCLUSION
174
+
175
+ We have introduced zoneout, a novel and simple regularizer for RNNs, which stochastically preserves hidden units’ activations. Zoneout improves performance across tasks, outperforming many alternative regularizers to achieve results competitive with state of the art on the Penn Treebank and Text8 datasets, and state of the art results on $p \mathrm { M N I S T }$ . While searching over zoneout probabilites allows us to tune zoneout to each task, low zoneout probabilities $( 0 . 0 5 - 0 . 2 )$ on states reliably improve performance of existing models.
176
+
177
+ We perform no hyperparameter search to achieve these results, simply using settings from the previous state of the art. Results on $p \mathbf { M N I S T }$ and word-level Penn Treebank suggest that Zoneout works well in combination with other regularizers, such as recurrent batch normalization, and dropout on feedforward/embedding layers. We conjecture that the benefits of zoneout arise from two main factors: (1) Introducing stochasticity makes the network more robust to changes in the hidden state; (2) The identity connections improve the flow of information forward and backward through the network.
178
+
179
+ # ACKNOWLEDGMENTS
180
+
181
+ We are grateful to Hugo Larochelle, Jan Chorowski, and students at MILA, especially Çaglar ˘ Gülçehre, Marcin Moczulski, Chiheb Trabelsi, and Christopher Beckham, for helpful feedback and discussions. We thank the developers of Theano (Theano Development Team, 2016), Fuel, and Blocks (van Merriënboer et al., 2015). We acknowledge the computing resources provided by ComputeCanada and CalculQuebec. We also thank IBM and Samsung for their support. We would also like to acknowledge the work of Pranav Shyam on learning RNN hierarchies. This research was developed with funding from the Defense Advanced Research Projects Agency (DARPA) and the Air
182
+
183
+ Force Research Laboratory (AFRL). The views, opinions and/or findings expressed are those of the authors and should not be interpreted as representing the official views or policies of the Department of Defense or the U.S. Government.
184
+
185
+ REFERENCES
186
+ Lei Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016. URL http://arxiv.org/abs/1607.06450.
187
+ Philip Bachman, Ouais Alsharif, and Doina Precup. Learning with pseudo-ensembles. In Advances in Neural Information Processing Systems, pp. 3365–3373, 2014.
188
+ J. Bayer, C. Osendorfer, D. Korhammer, N. Chen, S. Urban, and P. van der Smagt. On Fast Dropout and its Applicability to Recurrent Networks. ArXiv e-prints, November 2013.
189
+ Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. Neural Networks, IEEE Transactions on, 5(2):157–166, 1994.
190
+ Yoshua Bengio, Nicholas Léonard, and Aaron C. Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. CoRR, abs/1308.3432, 2013. URL http://arxiv.org/abs/1308.3432.
191
+ Junyoung Chung, Sungjin Ahn, and Yoshua Bengio. Hierarchical multiscale recurrent neural networks. CoRR, abs/1609.01704, 2016. URL http://arxiv.org/abs/1609.01704.
192
+ Tim Cooijmans, Nicolas Ballas, César Laurent, Caglar Gulcehre, and Aaron Courville. Recurrent batch normalization. arXiv preprint arXiv:1603.09025, 2016.
193
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In NIPS, pp. 3123–3131, 2015.
194
+ Yarin Gal. A Theoretically Grounded Application of Dropout in Recurrent Neural Networks. ArXiv e-prints, December 2015.
195
+ Felix A. Gers, Jürgen Schmidhuber, and Fred A. Cummins. Learning to forget: Continual prediction with LSTM. Neural Computation, 12(10):2451–2471, 2000.
196
+ David Ha, Andrew M. Dai, and Quoc V. Le. Hypernetworks. CoRR, abs/1609.09106, 2016. URL http://arxiv.org/abs/1609.09106.
197
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
198
+ Salah El Hihi and Yoshua Bengio. Hierarchical recurrent neural networks for long-term dependencies. In Advances in Neural Information Processing Systems. 1996.
199
+ Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
200
+ Sepp Hochreiter. Untersuchungen zu dynamischen neuronalen netzen. Master’s thesis, Institut fur Informatik, Technische Universitat, Munchen, 1991.
201
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
202
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Weinberger. Deep networks with stochastic depth. arXiv preprint arXiv:1603.09382, 2016.
203
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
204
+ Jan Koutnik, Klaus Greff, Faustino Gomez, and Juergen Schmidhuber. A clockwork rnn. arXiv preprint arXiv:1402.3511, 2014.
205
+
206
+ David Krueger and Roland Memisevic. Regularizing rnns by stabilizing activations. arXiv preprint arXiv:1511.08400, 2015.
207
+
208
+ Quoc V Le, Navdeep Jaitly, and Geoffrey E Hinton. A simple way to initialize recurrent networks of rectified linear units. arXiv preprint arXiv:1504.00941, 2015.
209
+
210
+ Matt Mahoney. About the test data, 2011. URL http://mattmahoney.net/dc/textdata.
211
+
212
+ 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.
213
+
214
+ Taesup Moon, Heeyoul Choi, Hoshik Lee, and Inchul Song. Rnndrop: A novel dropout for rnns in asr. Automatic Speech Recognition and Understanding (ASRU), 2015.
215
+
216
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. Understanding the exploding gradient problem. CoRR, abs/1211.5063, 2012. URL http://arxiv.org/abs/1211.5063.
217
+
218
+ V. Pham, T. Bluche, C. Kermorvant, and J. Louradour. Dropout improves Recurrent Neural Networks for Handwriting Recognition. ArXiv e-prints, November 2013.
219
+
220
+ Kamil Rocki, Tomasz Kornuta, and Tegan Maharaj. Surprisal-driven zoneout. CoRR, abs/1610.07675, 2016. URL http://arxiv.org/abs/1610.07675.
221
+
222
+ Stanislau Semeniuta, Aliaksei Severyn, and Erhardt Barth. Recurrent dropout without memory loss. arXiv preprint arXiv:1603.05118, 2016.
223
+
224
+ S. Singh, D. Hoiem, and D. Forsyth. Swapout: Learning an ensemble of deep architectures. ArXiv e-prints, May 2016.
225
+
226
+ 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.
227
+
228
+ Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688, May 2016.
229
+
230
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 4:2, 2012.
231
+
232
+ Bart van Merriënboer, Dzmitry Bahdanau, Vincent Dumoulin, Dmitriy Serdyuk, David Warde-Farley, Jan Chorowski, and Yoshua Bengio. Blocks and fuel: Frameworks for deep learning. CoRR, abs/1506.00619, 2015.
233
+
234
+ Sida Wang and Christopher Manning. Fast dropout training. In Proceedings of the 30th International Conference on Machine Learning, pp. 118–126, 2013.
235
+
236
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
237
+
238
+ # 6 APPENDIX
239
+
240
+ # 6.1 STATIC IDENTITY CONNECTIONS EXPERIMENT
241
+
242
+ This experiment was suggested by AnonReviewer2 during the ICLR review process with the goal of disentangling the effects zoneout has (1) through noise injection in the training process and (2) through identity connections. Based on these results, we observe that noise injection is essential for obtaining the regularization benefits of zoneout.
243
+
244
+ In this experiment, one zoneout mask is sampled at the beginning of training, and used for all examples. This means the identity connections introduced are static across training examples (but still different for each timestep). Using static identity connections resulted in slightly lower training (but not validation) error than zoneout, but worse performance than an unregularized LSTM on both train and validation sets, as shown in Figure 7.
245
+
246
+ ![](images/a985466faa11d6ed4abef00e1246963841c9478e7fe1f1610b9930e083a2b59a.jpg)
247
+ Figure 7: Training and validation curves for an LSTM with static identity connections compared to zoneout (both $Z _ { c } = 0 . 5$ and $Z _ { h } = 0 . 0 5 )$ ) and compared to a vanilla LSTM, showing that static identity connections fail to capture the benefits of zoneout.
md/train/rkeYL1SFvH/rkeYL1SFvH.md ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WIKIMATRIX: MINING 135M PARALLEL SENTENCES IN 1620 LANGUAGE PAIRS FROM WIKIPEDIA
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We present an approach based on multilingual sentence embeddings to automatically extract parallel sentences from the content of Wikipedia articles in 85 languages, including several dialects or low-resource languages. We do not limit the extraction process to alignments with English, but systematically consider all possible language pairs. In total, we are able to extract 135M parallel sentences for 1620 different language pairs, out of which only 34M are aligned with English. This corpus of parallel sentences is freely available.1
8
+
9
+ To get an indication on the quality of the extracted bitexts, we train neural MT baseline systems on the mined data only for 1886 languages pairs, and evaluate them on the TED corpus, achieving strong BLEU scores for many language pairs. The WikiMatrix bitexts seem to be particularly interesting to train MT systems between distant languages without the need to pivot through English.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Most of the current approaches in Natural Language Processing (NLP) are data-driven. The size of the resources used for training is often the primary concern, but the quality and a large variety of topics may be equally important. Monolingual texts are usually available in huge amounts for many topics and languages. However, multilingual resources, typically sentences in two languages which are mutual translations, are more limited, in particular when the two languages do not involve English. An important source of parallel texts are international organizations like the European Parliament (Koehn, 2005) or the United Nations (Ziemski et al., 2016). These are professional human translations, but they are in a more formal language and tend to be limited to political topics. There are several projects relying on volunteers to provide translations for public texts, e.g. news commentary (Tiedemann, 2012), OpensubTitles (Lison & Tiedemann, 2016) or the TED corpus (Qi et al., 2018)
14
+
15
+ Wikipedia is probably the largest free multilingual resource on the Internet. The content of Wikipedia is very diverse and covers many topics. Articles exist in more than 300 languages. Some content on Wikipedia was human translated from an existing article into another language, not necessarily from or into English. Eventually, the translated articles have been later independently edited and are not parallel any more. Wikipedia strongly discourages the use of unedited machine translation,2 but the existence of such articles can not be totally excluded. Many articles have been written independently, but may nevertheless contain sentences which are mutual translations. This makes Wikipedia a very appropriate resource to mine for parallel texts for a large number of language pairs. To the best of our knowledge, this is the first work to process the entire Wikipedia and systematically mine for parallel sentences in all language pairs. We hope that this resource will be useful for several research areas and enable the development of NLP applications for more languages.
16
+
17
+ In this work, we build on a recent approach to mine parallel texts based on a distance measure in a joint multilingual sentence embedding space (Schwenk, 2018; Artetxe & Schwenk, 2018b). For this, we use the freely available LASER toolkit3 which provides a language agnostic sentence encoder which was trained on 93 languages (Artetxe & Schwenk, 2018a). We approach the computational challenge to mine in almost six hundred million sentences by using fast indexing and similarity search algorithms.
18
+
19
+ The paper is organized as follows. In the next section, we first discuss related work. We then summarize the underlying mining approach. Section 4 describes in detail how we applied this approach to extract parallel sentences from Wikipedia in 1620 language pairs. To asses the quality of the extracted bitexts, we train NMT systems for a subset of language pairs and evaluate them on the TED corpus (Qi et al., 2018) for 45 languages. These results are presented in section 5. The paper concludes with a discussion of future research directions.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ There is a large body of research on mining parallel sentences in collections of monolingual texts, usually named “comparable coprora”. Initial approaches to bitext mining have relied on heavily engineered systems often based on metadata information, e.g. (Resnik, 1999; Resnik & Smith, 2003). More recent methods explore the textual content of the comparable documents. For instance, it was proposed to rely on cross-lingual document retrieval, e.g. (Utiyama & Isahara, 2003; Munteanu & Marcu, 2005) or machine translation, e.g. (Abdul-Rauf & Schwenk, 2009; Bouamor & Sajjad, 2018), typically to obtain an initial alignment that is then further filtered. In the shared task for bilingual document alignment (Buck & Koehn, 2016), many participants used techniques based on n-gram or neural language models, neural translation models and bag-of-words lexical translation probabilities for scoring candidate document pairs. The STACC method uses seed lexical translations induced from IBM alignments, which are combined with set expansion operations to score translation candidates through the Jaccard similarity coefficient (Etchegoyhen & Azpeitia, 2016; Azpeitia et al., 2017; 2018). Using multilingual noisy web-crawls such as ParaCrawl4 for filtering good quality sentence pairs has been explored in the shared tasks for high resource (Koehn et al., 2018) and low resource (Koehn et al., 2019) languages.
24
+
25
+ In this work, we rely on massively multilingual sentence embeddings and margin-based mining in the joint embedding space, as described in (Schwenk, 2018; Artetxe & Schwenk, 2018b;a). This approach has also proven to perform best in a low resource scenario (Chaudhary et al., 2019; Koehn et al., 2019). Closest to this approach is the research described in Espana-Bonet et al. (2017); Hassan ˜ et al. (2018); Guo et al. (2018); Yang et al. (2019). However, in all these works, only bilingual sentence representations have been trained. Such an approach does not scale to many languages, in particular when considering all possible language pairs in Wikipedia. Finally, related ideas have been also proposed in Bouamor & Sajjad (2018) or Gregoire & Langlais (2017). However, in those ´ works, mining is not solely based on multilingual sentence embeddings, but they are part of a larger system. To the best of our knowledge, this work is the first one that applies the same mining approach to all combinations of many different languages, written in more than twenty different scripts.
26
+
27
+ Wikipedia is arguably the largest comparable corpus. One of the first attempts to exploit this resource was performed by Adafre & de Rijke (2006). An MT system was used to translate Dutch sentences into English and to compare them with the English texts. This method yielded several hundreds of Dutch/English parallel sentences. Later, a similar technique was applied to the Persian/English pair (Mohammadi & GhasemAghaee, 2010). Structural information in Wikipedia such as the topic categories of documents was used in the alignment of multilingual corpora (Otero & Lopez, 2010). In another work, the mining approach of Munteanu & Marcu (2005) was applied to ´ extract large corpora from Wikipedia in sixteen languages (Smith et al., 2010). Otero et al. (2011) measured the comparability of Wikipedia corpora by the translation equivalents on three languages Portuguese, Spanish, and English. Patry & Langlais (2011) came up with a set of features such as Wikipedia entities to recognize parallel documents, and their approach was limited to a bilingual setting. Tufis et al. (2013) proposed an approach to mine parallel sentences from Wikipedia textual content, but they only considered high-resource languages, namely German, Spanish and Romanian paired with English. Tsai & Roth (2016) grounded multilingual mentions to English wikipedia by training cross-lingual embeddings on twelve languages. Gottschalk & Demidova (2017) searched for parallel text passages in Wikipedia by comparing their named entities and time expressions. Finally, Aghaebrahimian (2018) propose an approach based on bilingual BiLSTM sentence encoders to mine German, French and Persian parallel texts with English. Parallel data consisting of aligned
28
+
29
+ Wikipedia titles have been extracted for twenty-three languages5. Since Wikipedia titles are rarely entire sentences with a subject, verb and object, it seems that only modest improvements were observed when adding this resource to the training material of NMT systems.
30
+
31
+ We are not aware of other attempts to systematically mine for parallel sentences in the textual content of Wikipedia for a large number of languages.
32
+
33
+ # 3 DISTANCE-BASED MINING APPROACH
34
+
35
+ The underling idea of the mining approach used in this work is to first learn a multilingual sentence embedding, i.e. an embedding space in which semantically similar sentences are close independently of the language they are written in. This means that the distance in that space can be used as an indicator whether two sentences are mutual translations or not. Using a simple absolute threshold on the cosine distance was shown to achieve competitive results (Schwenk, 2018). However, it has been observed that an absolute threshold on the cosine distance is globally not consistent, e.g. (Guo et al., 2018). The difficulty to select one global threshold is emphasized in our setting since we are mining parallel sentences for many different language pairs.
36
+
37
+ # 3.1 MARGIN CRITERION
38
+
39
+ The alignment quality can be substantially improved by using a margin criterion instead of an absolute threshold (Artetxe & Schwenk, 2018b). In that work, the margin between two candidate sentences $x$ and $y$ is defined as the ratio between the cosine distance between the two sentence embeddings, and the average cosine similarity of its nearest neighbors in both directions:
40
+
41
+ $$
42
+ \operatorname* { m a r g i n } ( x , y ) = \frac { \cos ( x , y ) } { \displaystyle \sum _ { z \in \mathrm { N N } _ { k } ( x ) } \frac { \cos ( x , z ) } { 2 k } + \sum _ { z \in \mathrm { N N } _ { k } ( y ) } \frac { \cos ( y , z ) } { 2 k } }
43
+ $$
44
+
45
+ where $\mathrm { N N } _ { k } ( x )$ denotes the $k$ unique nearest neighbors of $x$ in the other language, and analogously for $\mathrm { N N } _ { k } ( y )$ . We used $k = 4$ in all experiments.
46
+
47
+ We follow the “max” strategy as described in (Artetxe & Schwenk, 2018b): the margin is first calculated in both directions for all sentences in language $L _ { 1 }$ and $L _ { 2 }$ . We then create the union of these forward and backward candidates. Candidates are sorted and pairs with source or target sentences which were already used are omitted. We then apply a threshold on the margin score to decide whether two sentences are mutual translations or not. Note that with this technique, we always get the same aligned sentences, independently of the mining direction, e.g. searching translations of French sentences in a German corpus, or in the opposite direction. The reader is referred to Artetxe & Schwenk (2018b) for a detailed discussion with related work.
48
+
49
+ The complexity of a distance-based mining approach is ${ \cal O } ( N \times M )$ , where $N$ and $M$ are the number of sentences in each monolingual corpus. This makes a brute-force approach with exhaustive distance calculations intractable for large corpora. Margin-based mining was shown to significantly outperform the state-of-the-art on the shared-task of the workshop on Building and Using Comparable Corpora (BUCC) (Artetxe & Schwenk, 2018b). The corpora in the BUCC corpus are rather small: at most $5 6 7 \mathrm { k }$ sentences.
50
+
51
+ The languages with the largest Wikipedia are English and German with 134M and 51M sentences, respectively, after pre-processing (see Section 4.1 for details). This would require $6 . 8 \times 1 0 ^ { 1 5 }$ distance calculations.6 We show in Section 3.3 how to tackle this computational challenge.
52
+
53
+ # 3.2 MULTILINGUAL SENTENCE EMBEDDINGS
54
+
55
+ Distance-based bitext mining requires a joint sentence embedding for all the considered languages. One may be tempted to train a bi-lingual embedding for each language pair, e.g. (Espana-Bonet ˜ et al., 2017; Hassan et al., 2018; Guo et al., 2018; Yang et al., 2019), but this is difficult to scale to thousands of language pairs present in Wikipedia. Instead, we chose to use one single massively multilingual sentence embedding for all languages, namely the one proposed by the open-source LASER toolkit (Artetxe & Schwenk, 2018a). Training one joint multilingual embedding on many languages at once also has the advantage that low-resource languages can benefit from the similarity to other language in the same language family. For example, we were able to mine parallel data for several Romance (minority) languages like Aragonese, Lombard, Mirandese or Sicilian although data in those languages was not used to train the multilingual LASER embeddings.
56
+
57
+ ![](images/0c69143780424e7ba1459afc045677b08df82cc7dd399379ca8ace6d7f7458cc.jpg)
58
+ Table 1: Architecture of the system used to train massively multilingual sentence embeddings. See Artetxe & Schwenk (2018a) for details.
59
+
60
+ The underlying idea of LASER is to train a sequence-to-sequence system on many language pairs at once using a shared BPE vocabulary and a shared encoder for all languages. The sentence representation is obtained by max-pooling over all encoder output states. Figure 1 illustrates this approach. The reader is referred to Artetxe & Schwenk (2018a) for a detailed description.
61
+
62
+ # 3.3 FAST SIMILARITY SEARCH
63
+
64
+ Fast large-scale similarity search is an area with a large body of research. Traditionally, the application domain is image search, but the algorithms are generic and can be applied to any type of vectors. In this work, we use the open-source FAISS library7 which implements highly efficient algorithms to perform similarity search on billions of vectors (Johnson et al., 2017). An additional advantage is that FAISS has support to run on multiple GPUs. Our sentence representations are 1024-dimensional. This means that the embeddings of all English sentences require $1 5 3 \cdot 1 0 ^ { 6 } \times 1 0 2 4 \times 4 = 5 1 3$ GB of memory. Therefore, dimensionality reduction and data compression are needed for efficient search. In this work, we chose a rather aggressive compression based on a 64-bit product-quantizer (Jegou et al., 2011), and portioning the search space in 32k cells. This ´ corresponds to the index type “OPQ64,IVF32768, $\textstyle \mathrm { P Q 6 4 } ^ { \prime \prime }$ in FAISS terms.8 Another interesting compression method is scalar quantization. A detailed comparison is left for future research. We build and train one FAISS index for each language.
65
+
66
+ The compressed FAISS index for English requires only 9.2GB, i.e. more than fifty times smaller than the original sentences embeddings. This makes it possible to load the whole index on a standard GPU and to run the search in a very efficient way on multiple GPUs in parallel, without the need to shard the index. The overall mining process for German/English requires less than 3.5 hours on 8 GPUs, including the nearest neighbor search in both direction and scoring all candidates
67
+
68
+ # 4 BITEXT MINING IN WIKIPEDIA
69
+
70
+ For each Wikipedia article, it is possible to get the link to the corresponding article in other languages. This could be used to mine sentences limited to the respective articles. One one hand, this local mining has several advantages: 1) mining is very fast since each article usually has a few hundreds of sentences only; 2) it seems reasonable to assume that a translation of a sentence is more likely to be found in the same article than anywhere in the whole Wikipedia. On the other hand, we hypothesize that the margin criterion will be less efficient since one article has usually few sentences which are similar. This may lead to many sentences in the overall mined corpus of the type “NAME was born on DATE in CITY”, “BUILDING is a monument in CITY built on DATE”, etc. Although those alignments may be correct, we hypothesize that they are of limited use to train an NMT system, in particular when they are too frequent. In general, there is a risk that we will get sentences which are close in structure and content.
71
+
72
+ Table 2: Illustration how sentences in the wrong language can hurt the alignment process with a margin criterion. See text for a detailed discussion.
73
+
74
+ <table><tr><td></td><td>L1 (French)| Ceci est une tres grande maison</td></tr><tr><td>L2 (German)</td><td>Das ist ein sehr groβes Haus</td></tr><tr><td></td><td>Thisis a very big house</td></tr><tr><td></td><td>Ez egy nagyon nagy haz Inirumah yang sangatbesar</td></tr></table>
75
+
76
+ The other option is to consider the whole Wikipedia for each language: for each sentence in the source language, we mine in all target sentences. This global mining has several potential advantages: 1) we can try to align two languages even though there are only few articles in common; 2) many short sentences which only differ by the name entities are likely to be excluded by the margin criterion. A drawback of this global mining is a potentially increased risk of misalignment and a lower recall.
77
+
78
+ In this work, we chose the global mining option. This will allow us to scale the same approach to other, potentially huge, corpora for which document-level alignments are not easily available, e.g. Common Crawl. An in depth comparison of local and global mining (on Wikipedia) is left for future research.
79
+
80
+ # 4.1 CORPUS PREPARATION
81
+
82
+ Extracting the textual content of Wikipedia articles in all languages is a rather challenging task, i.e. removing all tables, pictures, citations, footnotes or formatting markup. There are several ways to download Wikipedia content. In this study, we use the so-called CirrusSearch dumps since they directly provide the textual content without any meta information.9 We downloaded this dump in March 2019. A total of about 300 languages are available, but the size obviously varies a lot between languages. We applied the following processing:
83
+
84
+ • extract the textual content;
85
+ • split the paragraphs into sentences;
86
+ • remove duplicate sentences;
87
+ • perform language identification and remove sentences which are not in the expected language (usually, citations or references to texts in another language).
88
+
89
+ It should be pointed out that sentence segmentation is not a trivial task, with many exceptions and specific rules for the various languages. For instance, it is rather difficult to make an exhaustive list of common abbreviations for all languages. In German, points are used after numbers in enumerations, but numbers may also appear at the end of sentences. Other languages do not use specific symbols to mark the end of a sentence, namely Thai. We are not aware of a reliable and freely available sentence segmenter for Thai and we had to exclude that language. We used the freely available Python tool10 which is based on Moses scripts. Regular expressions were used for most of the Asian languages, falling back to English for the remaining languages. This gives us 879 million sentences in 300 languages. The margin criterion to mine for parallel data requires that the texts do not contain duplicates. This removes about $2 5 \%$ of the sentences.11
90
+
91
+ ![](images/aec35d54bc6a850c1603af688e57f434d6c994676b4e0d59b56bbc1f9cfc0221.jpg)
92
+ Figure 1: BLEU scores (continuous lines) for several NMT systems trained on bitexts extracted from Wikipedia for different margin thresholds. The size of the mined bitexts are depicted as dashed lines.
93
+
94
+ LASER’s sentence embeddings are totally language agnostic. This has the side effect that the sentences in other languages (e.g. citations or quotes) may be considered closer in the embedding space than a potential translation in the target language. Table 2 illustrates this problem. The algorithm would not select the German sentence although it is a perfect translation. The sentences in the other languages are also valid translations which would yield a very small margin. To avoid this problem, we perform language identification (LID) on all sentences and remove those which are not in the expected language. LID is performed with fasttext12 (Joulin et al., 2016). Fasttext does not support all the 300 languages present in Wikipedia and we disregarded the missing ones (which typically have only few sentences anyway). After deduplication and LID, we dispose of 595M sentences in 182 languages. English accounts for 134M sentences, and German with 51M sentences is the second largest language. The sizes for all languages are given in Tables 4 and 6.
95
+
96
+ # 4.2 THRESHOLD OPTIMIZATION
97
+
98
+ Artetxe & Schwenk (2018b) optimized their mining approach for each language pair on a provided corpus of gold alignments. This is not possible when mining Wikipedia, in particular when considering many language pairs. In this work, we use an evaluation protocol inspired by the WMT shared task on parallel corpus filtering for low-resource conditions (Koehn et al., 2019): an NMT system is trained on the extracted bitexts – for different thresholds – and the resulting BLEU scores are compared. We choose newstest2014 of the WMT evaluations since it provides an $N$ -way parallel test sets for English, French, German and Czech. We favoured the translation between two morphologically rich languages from different families and considered the following language pairs: German/English, German/French, Czech/German and Czech/French. The size of mined bitexts is in the range of $1 0 0 \mathrm { k }$ to more than 2M (see Table 3 and Figure 1). We did not try to optimize the architecture of the NMT system to the size of the bitexts and used the same architecture for all systems: the encoder and decoder are 5-layer transformer models as implemented in fairseq (Ott et al., 2019). The goal of this study is not to develop the best performing NMT system for the considered languages pairs, but to compare different mining parameters.
99
+
100
+ The evolution of the BLEU score in function of the margin threshold is given in Figure 1. Decreasing the threshold naturally leads to more mined data – we observe an exponential increase of the data size. The performance of the NMT systems trained on the mined data seems to change as expected, in a surprisingly smooth way. The BLEU score first improves with increasing amounts of available training data, reaches a maximum and than decreases since the additional data gets more and more noisy, i.e. contains wrong translations. It is also not surprising that a careful choice of the margin threshold is more important in a low-resource setting. Every additional parallel sentence is important. According to Figure 1, the optimal value of the margin threshold seems to be 1.05 when many sentences can be extracted, in our case German/English and German/French. When less parallel data is available, i.e. Czech/German and Czech/French, a value in the range of 1.03–1.04 seems to be a better choice. Aiming at one threshold for all language pairs, we chose a value of 1.04. It seems to be a good compromise for most language pairs. However, for the open release of this corpus, we provide all mined sentence with a margin of 1.02 or better. This would enable end users to choose an optimal threshold for their particular applications. However, it should be emphasized that we do not expect that many sentence pairs with a margin as low as 1.02 are good translations.
101
+
102
+ Table 3: Comparison of NMT systems trained on the Europarl corpus and on bitexts automatically mined in Wikipedia by our approach at a threshold of 1.04. We give the number of sentences (first line) and the BLEU score (second line of each bloc) on newstest2014.
103
+
104
+ <table><tr><td rowspan=1 colspan=1>Bitexts</td><td rowspan=1 colspan=1>de-en</td><td rowspan=1 colspan=1>de-fr</td><td rowspan=1 colspan=1>cs-de</td><td rowspan=1 colspan=1>cs-fr</td></tr><tr><td rowspan=2 colspan=1>Europarl</td><td rowspan=1 colspan=1>1.9M21.5</td><td rowspan=1 colspan=1>1.9M23.6</td><td rowspan=1 colspan=1>568k14.9</td><td rowspan=1 colspan=1>627k21.5</td></tr><tr><td rowspan=1 colspan=1>1.0M21.2</td><td rowspan=1 colspan=1>370k21.1</td><td rowspan=1 colspan=1>200k12.6</td><td rowspan=1 colspan=1>220k19.2</td></tr><tr><td rowspan=1 colspan=1>Mined Wikipedia</td><td rowspan=1 colspan=1>1.0M24.4</td><td rowspan=1 colspan=1>372k22.7</td><td rowspan=1 colspan=1>201k13.1</td><td rowspan=1 colspan=1>219k16.3</td></tr><tr><td rowspan=1 colspan=1>Europarl+ Wikipedia</td><td rowspan=1 colspan=1>3.0M25.5</td><td rowspan=1 colspan=1>2.3M25.6</td><td rowspan=1 colspan=1>768k17.7</td><td rowspan=1 colspan=1>846k24.0</td></tr></table>
105
+
106
+ For comparison, we also trained NMT systems on the Europarl corpus V7 (Koehn, 2005), i.e. professional human translations, first on all available data, and then on the same number of sentences than the mined ones (see Table 3). With the exception of Czech/French, we were able to achieve better BLEU scores with the automatically mined bitexts in Wikipedia than with Europarl of the same size. Adding the mined text to the full Europarl corpus, also leads to further improvements of 1.1 to 3.1 BLEU. We argue that this is a good indicator of the quality of the automatically extracted parallel sentences.
107
+
108
+ # 5 RESULT ANALYSIS
109
+
110
+ We run the alignment process for all possible combinations of languages in Wikipedia. This yielded 1620 language pairs for which we were able to mine at least ten thousand sentences. Remember that mining $L _ { 1 } L _ { 2 }$ is identical to $L _ { 2 } \to L _ { 1 }$ , and is counted only once. We propose to analyze and evaluate the extracted bitexts in two ways. First, we discuss the amount of extracted sentences (Section 5.1). We then turn to a qualitative assessment by training NMT systems for all language pairs with more than twenty-five thousand mined sentences (Section 5.2).
111
+
112
+ # 5.1 QUANTITATIVE ANALYSIS
113
+
114
+ Due to space limits, Table 4 summarizes the number of extracted parallel sentences only for languages which have a total of at least five hundred thousand parallel sentences (with all other languages at a margin threshold of 1.04). Additional results are given in Table 6 in the Appendix.
115
+
116
+ There are many reasons which can influence the number of mined sentences. Obviously, the larger the monolingual texts, the more likely it is to mine many parallel sentences. Not surprisingly, we observe that more sentences could be mined when English is one of the two languages. Let us point out some languages for which it is usually not obvious to find parallel data with English, namely Indonesian (1M), Hebrew (545k), Farsi (303k) or Marathi (124k sentences). The largest mined texts not involving English are Russian/Ukrainian (2.5M), Catalan/Spanish (1.6M), between the Romance languages French, Spanish, Italian and Portuguese (480k–923k), and German/French (626k).
117
+
118
+ It is striking to see that we were able to mine more sentences when Galician and Catalan are paired with Spanish than with English. On one hand, this could be explained by the fact that LASER’s multilingual sentence embeddings may be better since the involved languages are linguistically very similar. On the other, it could be that the Wikipedia articles in both languages share a lot of content, or are obtained by mutual translation.
119
+
120
+ Services from the European Commission provide human translations of (legal) texts in all the 24 official languages of the European Union. This N-way parallel corpus enables training of MT system to directly translate between these languages, without the need to pivot through English. This is usually not the case when translating between other major languages, for example in Asia. Let us list some interesting language pairs for which we were able to mine more than hundred thousand sentences: Korean/Japanese (222k), Russian/Japanese (196k), Indonesian/Vietnamese (146k), or Hebrew/Romance languages (120–150k sentences).
121
+
122
+ 自585
123
+
124
+ <table><tr><td>70 115 8 37 3 8 14 6 6 50 L8I 5 30 4 76 1 1153783315511 113321131131525253535331 8 91LL 4111 11s 8 9 1110 17111155555533558598881514 1 2 g16 8 8 43 2 42 8851113131 54 111111 33111311315153155151 9191916 811119 1118 3213331333531111 5 3 2 3333333333333 1D 20 16 833535 10 0 17 11 9 34 8 57 11111</td><td>517335873 8 4 2 4 = 3 11 114514453 1 4 4 6 29 16 2813313114 10 4 133333 ∠I9I9I6 113338000 71 111I 8 113311111 11111 3 4 3 8 4050 879 87316 16 550</td><td>485757 202 11833711711 69 B 3 1 2 343 16 1 9111155 24124424 3 4 5 1 6 2 46484456 1D</td><td>45 B 1111535551 98 2 35 1 1111458 91SI4I8 11 91116 0101119 4</td><td>21515029782 2 3030 F 8 5 3739273 2 2 291212 41 81616 1333335 2 6</td><td>16 6 = 10 6</td><td rowspan="8">50 3 0 4 11871 Preraitn</td></tr><tr><td>221 4 40 国 2 1</td><td>331111111311115511133111111115113513115151111 11113131131515113831731553133313551111 331111333333111313511313153313153 3535335333131333331313138373337111111 114511111115411214 333813133155311 203035 251255 33333 2732 21 9001 4</td><td>25155 20 6 17 16 B B 7 20 30 39 2125</td><td>2244444454404 88143355 353535555331 3533711 411155 【4441114 414140 10 8 854978 10 43 742827 8 5 40 764342 10 2 5047 4 30 E 120</td><td rowspan="8">4 4 48515031 51 11133 5 34725 107 1 6 223 22 7</td><td rowspan="8"></td></tr><tr><td>9 10 8 3250 2021 1111 3131373135155 3 2 8 61 9 10 8 83171 3513715111155317 T11118355555 121 07769011969 4742 6 1 4 5 3 46 89 11445 252423 7 21 1 23 833 B15 10</td><td>29 18 7 3521 61999 S8 899 1I99 B 131173315111 30 35 48</td><td>25 30292225 1 D 8 3 25 52 21 2 8 100 8 460 50 32</td></tr><tr><td>3531 115555351311 L3 9 4 551 1441154 8151 331110 11855511151511 099L6 64 88500000 50 49 8 6 60 35 8 3560 3332222 28 10 10 25 7</td><td>20015000660 05 971711118816 3220 22 646 2 LI £95</td><td>1137175311113 1 3 55 35 L498 441911016 64 70 4 B 5</td></tr><tr><td>31215113333153351335355511115553111311313351181 18117113111131311 15 71311311115111311 1511511511 2222 35 3355551 6007 333319 8333335333 398888 30 111238895 II6I6I 1 用 89 8 23 35 50333 20 = 55 20 2 52 37 11811838113158 8 6 4 2 4 2 111113511155 9 5 8 3 B 1 38 3356 11133331111 11155 697111 80111 1555 40 000803 2526 24 64 54 64 20 7 2 9 3 5 2 I6 4 333585 10 10</td><td>11 14545818 290115 101010 9 Ⅱ 28123 2 2 60 11112154114441355471133511154 3556 2 6 9 38 48444 24 6 27 16 3 6 43 18 27 4945 8 1144 9 3 8 二 614 12500 9 8130 1 50 8 460 46 11 458588494354 19 4 R 16 31 47 6 3 58</td><td>185218 181 5 4146 6 9 3</td></tr><tr><td>1124313515313535355111131355 3933332332353213153555433 5718313553857355913511531117 33 31 3121355 325 313325 222 9 A 3 2 9 OI6 11415412125141442131444333 10 江 2929 24 7 4 334 16 24 4 12 10 8</td><td>48 4</td><td></td></tr><tr><td>312828 9 9 22211333111441 44111133111144 2110 8 ILI 5</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>5 5 844 25444 2221 0 1133 1</td><td>20 3 8</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>3 4 7</td><td></td><td></td><td></td><td></td></tr><tr><td>669399555035551115119 11114114494 168 111641</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>3</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>2225</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>3</td><td></td><td>Errerui</td></tr><tr><td></td><td></td><td></td><td>16041</td><td></td></tr><tr><td>60 3 50 300 3 144 8333 454 3 54544 3321 11311 31</td><td></td><td>21015</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>naenees</td></tr><tr><td></td><td></td><td></td><td>3</td><td></td></tr><tr><td></td><td></td><td>33531 4894 3000 3301 12 5</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>6 0791 15333 3 32531 0</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>Noeerereeen</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>Sarait</td></tr><tr><td></td><td></td><td></td><td></td><td>3</td></tr><tr><td></td><td></td><td></td><td></td><td>0 35</td></tr><tr><td></td><td></td><td></td><td>Porreee</td><td>0 3 4444 906LI</td></tr><tr><td>1lrr-oppa</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>ceernistee</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>erarrar</td><td>T ir-ippa</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>irerad</td><td></td><td></td><td></td></tr><tr><td>erreen</td><td></td><td>T lrr-ippa</td><td></td><td></td></tr><tr><td>eiareiar</td><td>onneer</td><td></td><td></td><td>6</td></tr><tr><td>moneeer</td><td>errear</td><td></td><td></td><td></td></tr><tr><td></td><td>monreer</td><td></td><td>Jrale</td><td></td></tr><tr><td>Hrle</td><td>orrrr Rooneer</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>Wprrreaaa</td><td> rrr-oppa</td><td></td></tr><tr><td></td><td>-irrlrsariai</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>ceitt</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>JIale JIalr</td><td></td><td></td><td></td><td></td></tr><tr><td>Aaarriiet erastsasrlag</td><td>rrrr</td><td></td><td></td><td></td></tr><tr><td>Vqerec Jalr</td><td>Jale</td><td></td><td></td><td></td></tr><tr><td>Trt</td><td></td><td>oorerer</td><td></td><td></td></tr><tr><td></td><td>iatra Tnrirr Daera Fara</td><td></td><td>Preerr eererce Ronmrrr</td><td></td></tr><tr><td></td><td></td><td>Praoder</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>Cerrir</td></tr><tr><td></td><td></td><td></td><td></td><td>Art</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>Trts arreerrreeeiia</td><td></td><td></td></tr><tr><td></td><td></td><td>iarlrratra</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>Jiaels</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>Je 2 Srle Torrr</td><td>Dpraagn rrarg SIll Jale -N uoo Srarrirn Aaraa Trla serean ssipest a nng 1</td></tr><tr><td></td><td></td><td>1rt-opu eirerain</td></table>
125
+
126
+ Table 5: BLEU scores on the TED test set as proposed in (Qi et al., 2018). NMT systems were trained on bitexts mined in Wikipedia only (with at least twenty-five thousand parallel sentences). No other resources were used.
127
+
128
+ <table><tr><td rowspan=1 colspan=33>Src/Trgarbgbs cs da de el en eo esfifr-caghe hr hu idit ja ko mk nb nl pl ptpt-br ro ru sksl sr svtr ukvizh-cnzh-tw</td></tr><tr><td rowspan=1 colspan=1>ar</td><td rowspan=1 colspan=6>4.9 1.83.04.53.8 6.720.3</td><td rowspan=1 colspan=26>4.113.212.29.05.63.52.22.79.29.94.25.35.54.94.43.012.012.25.65.61.52.71.24.02.4 4.512.38.24.9</td></tr><tr><td rowspan=1 colspan=1>bs</td><td rowspan=1 colspan=1>1.2 6.1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>4.13.7</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>4.521.7</td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=2>6.7.4.6</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=2>2.45.3 6.5</td><td rowspan=1 colspan=1>1.4</td><td rowspan=1 colspan=4>12.9</td><td rowspan=1 colspan=2>2.99.9</td><td rowspan=1 colspan=1>10.9</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=4>3.110.410.6 4.4</td><td rowspan=1 colspan=2>1.55.4 5.8</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=1>1.8</td></tr><tr><td rowspan=1 colspan=1>cs</td><td rowspan=1 colspan=1>1.97.8</td><td rowspan=1 colspan=1>3.7</td><td rowspan=1 colspan=2>7.1</td><td rowspan=1 colspan=1>8.3</td><td rowspan=1 colspan=1>6.420.0</td><td rowspan=1 colspan=1>10.412.</td><td rowspan=1 colspan=2>11.48.6</td><td rowspan=1 colspan=1>5.0</td><td rowspan=1 colspan=1>2.5</td><td rowspan=1 colspan=1>6.5</td><td rowspan=1 colspan=2>4.97.8 9.6</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=4>5.55.06.37.6</td><td rowspan=1 colspan=2>8.110.8</td><td rowspan=1 colspan=1>12.1</td><td rowspan=1 colspan=1>6.3</td><td rowspan=1 colspan=1>9.4</td><td rowspan=1 colspan=2>28.16.7</td><td rowspan=1 colspan=2>1.67.0</td><td rowspan=1 colspan=2>2.67.89.0</td><td rowspan=1 colspan=1>6.6</td><td rowspan=1 colspan=1>4.7</td></tr><tr><td rowspan=1 colspan=1>da</td><td rowspan=1 colspan=1>2.08.9</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=2>5.2</td><td rowspan=1 colspan=1>14.0</td><td rowspan=1 colspan=1>9.032.9</td><td rowspan=1 colspan=1>6.716.</td><td rowspan=1 colspan=2>16.712.8</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>4.4</td><td rowspan=1 colspan=2>4.710.813.4</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=4>6.06.233.112.4</td><td rowspan=1 colspan=2>4.814.0</td><td rowspan=1 colspan=1>16.2</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=2>3.1 5.2</td><td rowspan=1 colspan=2>1.425.8</td><td rowspan=1 colspan=2>2.76.311.2</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>4.9</td></tr><tr><td rowspan=1 colspan=1>de</td><td rowspan=1 colspan=1>2.49.7</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=2>8.116.9</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>7.824.5</td><td rowspan=1 colspan=1>15.917.4</td><td rowspan=1 colspan=2>18.314.7</td><td rowspan=1 colspan=1>6.8</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>8.613.5</td><td rowspan=1 colspan=1>6.4</td><td rowspan=1 colspan=2>6.65.6</td><td rowspan=1 colspan=2>11.517.6</td><td rowspan=1 colspan=2>6.814.2</td><td rowspan=1 colspan=1>15.2</td><td rowspan=1 colspan=1>8.7</td><td rowspan=1 colspan=1>9.2</td><td rowspan=1 colspan=2>5.4 8.6</td><td rowspan=1 colspan=2>1.512.7</td><td rowspan=1 colspan=2>3.67.811.3</td><td rowspan=1 colspan=1>9.2</td><td rowspan=1 colspan=1>4.3</td></tr><tr><td rowspan=1 colspan=1>el</td><td rowspan=1 colspan=1>4.111.2</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=2>5.59.7</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>27.9</td><td rowspan=1 colspan=1>8.018.</td><td rowspan=1 colspan=2>16.313.5</td><td rowspan=1 colspan=1>10.1</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>13.115.3</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=2>6.110.2</td><td rowspan=1 colspan=2>9.38.7</td><td rowspan=1 colspan=2>5.118.0</td><td rowspan=1 colspan=1>18.3</td><td rowspan=1 colspan=1>10.4</td><td rowspan=1 colspan=1>8.4</td><td rowspan=1 colspan=2>3.1 6.4</td><td rowspan=1 colspan=2>2.07.2</td><td rowspan=1 colspan=2>3.47.214.4</td><td rowspan=1 colspan=1>8.7</td><td rowspan=1 colspan=1>5.3</td></tr><tr><td rowspan=1 colspan=1>en</td><td rowspan=1 colspan=1>11.923.9</td><td rowspan=1 colspan=1>14.7</td><td rowspan=1 colspan=2>15.530.9</td><td rowspan=1 colspan=1>20.4</td><td rowspan=1 colspan=1>27.1</td><td rowspan=1 colspan=1>22.635.8</td><td rowspan=1 colspan=2>32.625.1</td><td rowspan=1 colspan=1>24.3</td><td rowspan=1 colspan=1>17.3</td><td rowspan=1 colspan=1>8.8</td><td rowspan=1 colspan=1>13.5</td><td rowspan=1 colspan=1>28.829.5</td><td rowspan=1 colspan=1>0.2</td><td rowspan=1 colspan=2>18.621.83</td><td rowspan=1 colspan=2>1.825.1</td><td rowspan=1 colspan=2>12.031.4</td><td rowspan=1 colspan=1>37.0</td><td rowspan=1 colspan=1>20.4</td><td rowspan=1 colspan=1>17.4</td><td rowspan=1 colspan=2>13.816.5</td><td rowspan=1 colspan=2>5.529.1</td><td rowspan=1 colspan=2>10.317.626.9</td><td rowspan=1 colspan=1>18.0</td><td rowspan=1 colspan=1>10.7</td></tr><tr><td rowspan=1 colspan=1>eo</td><td rowspan=1 colspan=1>1.86.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>7.37.4</td><td rowspan=1 colspan=1>13.5</td><td rowspan=1 colspan=1>8.123.1</td><td rowspan=1 colspan=1>16.1</td><td rowspan=1 colspan=2>17.612.7</td><td rowspan=1 colspan=1>10.5</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>3.0</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1>9.213.9</td><td rowspan=1 colspan=1>2.5</td><td rowspan=1 colspan=2>4.86.2</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>12.1</td><td rowspan=1 colspan=2>6.712.4</td><td rowspan=1 colspan=1>16.0</td><td rowspan=1 colspan=1>6.9</td><td rowspan=1 colspan=1>8.6</td><td rowspan=1 colspan=2>7.45.6</td><td rowspan=1 colspan=2>0.68.8</td><td rowspan=1 colspan=2>1.85.47.7</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>3.6</td></tr><tr><td rowspan=1 colspan=1>es</td><td rowspan=1 colspan=1>6.214.3</td><td rowspan=1 colspan=1>6.8</td><td rowspan=1 colspan=2>8.015.7</td><td rowspan=1 colspan=1>12.9</td><td rowspan=1 colspan=1>16.433.2</td><td rowspan=1 colspan=1>13.5</td><td rowspan=1 colspan=2>25.619.9</td><td rowspan=1 colspan=1>30.1</td><td rowspan=1 colspan=2>8.18.7</td><td rowspan=1 colspan=1>7.7</td><td rowspan=1 colspan=1>16.123.8</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=2>9.911.9</td><td rowspan=1 colspan=1>13.3</td><td rowspan=1 colspan=1>14.1</td><td rowspan=1 colspan=2>8.127.6</td><td rowspan=1 colspan=1>27.8</td><td rowspan=1 colspan=1>14.7</td><td rowspan=1 colspan=1>11.6</td><td rowspan=1 colspan=2>6.0 8.1</td><td rowspan=1 colspan=2>2.613.7</td><td rowspan=1 colspan=2>5.210.017.8</td><td rowspan=1 colspan=1>12.3</td><td rowspan=1 colspan=1>6.6</td></tr><tr><td rowspan=1 colspan=1>fr-ca</td><td rowspan=1 colspan=1>4.912.5</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=2>7.814.3</td><td rowspan=1 colspan=1>12.9</td><td rowspan=1 colspan=1>15.427.8</td><td rowspan=1 colspan=1>14.023.7</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>18.1</td><td rowspan=1 colspan=1>6.8</td><td rowspan=1 colspan=1>6.8</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=1>13.723.4</td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=2>8.810.3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>15.1</td><td rowspan=1 colspan=2>7.218.6</td><td rowspan=1 colspan=1>23.2</td><td rowspan=1 colspan=1>15.3</td><td rowspan=1 colspan=1>11.3</td><td rowspan=1 colspan=1>6.1</td><td rowspan=1 colspan=1>6.6</td><td rowspan=1 colspan=2>3.312.5</td><td rowspan=1 colspan=2>5.09.715.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>6.2</td></tr><tr><td rowspan=1 colspan=1>gl</td><td rowspan=1 colspan=1>2.6 7.3</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=2>2.9,7.4</td><td rowspan=1 colspan=2>5.38.523.4</td><td rowspan=1 colspan=1>9.234.4</td><td rowspan=1 colspan=2>16.015.2</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.5</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=1>9.819.3</td><td rowspan=1 colspan=1>3.6</td><td rowspan=1 colspan=2>4.2 5.6</td><td rowspan=1 colspan=2>6.96.5</td><td rowspan=1 colspan=2>4.322.4</td><td rowspan=1 colspan=1>23.7</td><td rowspan=1 colspan=1>7.7</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>1.7</td><td rowspan=1 colspan=1>3.1</td><td rowspan=1 colspan=2>0.24.3</td><td rowspan=1 colspan=2>2.33.99.4</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>4.2</td></tr><tr><td rowspan=1 colspan=1>hr</td><td rowspan=1 colspan=1>1.6 8.729.9</td><td rowspan=1 colspan=1>29.9</td><td rowspan=1 colspan=1>7.0</td><td rowspan=1 colspan=1>6.5</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>6.624.4</td><td rowspan=1 colspan=1>4.412.6</td><td rowspan=1 colspan=2>9.97.8</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>8.210.4</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>14.1</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>6.1</td><td rowspan=1 colspan=2>5.412.1</td><td rowspan=1 colspan=1>12.6</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>8.3</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>12.6</td><td rowspan=1 colspan=1>11.7</td><td rowspan=1 colspan=1>6.0</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>6.99.4</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1>2.9</td></tr><tr><td rowspan=1 colspan=1>hu</td><td rowspan=1 colspan=1>1.6 5.6</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>7.0</td><td rowspan=1 colspan=1>5.516.7</td><td rowspan=1 colspan=1>6.510.8</td><td rowspan=1 colspan=2>10.99.3</td><td rowspan=1 colspan=1>3.9</td><td rowspan=1 colspan=1>2.1</td><td rowspan=1 colspan=1>3.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>6.68.2</td><td rowspan=1 colspan=1>4.4</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=1>3.9</td><td rowspan=1 colspan=1>4.5</td><td rowspan=1 colspan=1>6.0</td><td rowspan=1 colspan=2>4.39.7</td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=1>7.1</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>3.4</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>1.2</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>3.0</td><td rowspan=1 colspan=1>3.0 4.4 8.5</td><td rowspan=1 colspan=1>6.5</td><td rowspan=1 colspan=1>4.2</td></tr><tr><td rowspan=1 colspan=1>id</td><td rowspan=1 colspan=1>4.1 9.1</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>10.1</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>11.124.9</td><td rowspan=1 colspan=1>8.216.4</td><td rowspan=1 colspan=2>15.111.1</td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=1>5.1</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>12.7</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=2>9.1 7.0</td><td rowspan=1 colspan=1>10.0</td><td rowspan=1 colspan=1>9.4</td><td rowspan=1 colspan=2>5.514.6</td><td rowspan=1 colspan=1>16.7</td><td rowspan=1 colspan=1>9.8</td><td rowspan=1 colspan=1>8.1</td><td rowspan=1 colspan=1>3.6</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>9.3</td><td rowspan=1 colspan=2>4.6 7.318.5</td><td rowspan=1 colspan=1>11.0</td><td rowspan=1 colspan=1>6.2</td></tr><tr><td rowspan=1 colspan=1>it</td><td rowspan=1 colspan=1>5.311.7</td><td rowspan=1 colspan=1>5.0</td><td rowspan=1 colspan=1>6.9</td><td rowspan=1 colspan=1>13.1</td><td rowspan=1 colspan=1>11.5</td><td rowspan=1 colspan=1>14.530.0</td><td rowspan=1 colspan=1>13.926.4</td><td rowspan=1 colspan=2>24.920.0</td><td rowspan=1 colspan=1>19.3</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=1>7.0</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>14.0</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=2>9.09.9</td><td rowspan=1 colspan=1>13.3</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=2>7.322.8</td><td rowspan=1 colspan=1>24.9</td><td rowspan=1 colspan=1>13.3</td><td rowspan=1 colspan=1>10.2</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>7.1</td><td rowspan=1 colspan=1>2.3</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=2>4.6 8.815.3</td><td rowspan=1 colspan=1>10.7</td><td rowspan=1 colspan=1>5.8</td></tr><tr><td rowspan=1 colspan=1>ja</td><td rowspan=1 colspan=1>1.41.9</td><td rowspan=1 colspan=1>0.7</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>3.1</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>2.57.9</td><td rowspan=1 colspan=1>2.26.0</td><td rowspan=1 colspan=2>6.04.7</td><td rowspan=1 colspan=1>2.3</td><td rowspan=1 colspan=1>1.4</td><td rowspan=1 colspan=1>1.3</td><td rowspan=1 colspan=1>2.0</td><td rowspan=1 colspan=1>3.5 4.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>16.91.6</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1>3.1</td><td rowspan=1 colspan=2>1.8 5.1</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>1.2</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=2>1.92.25.9</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>ko</td><td rowspan=1 colspan=1>0.91.7</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.3</td><td rowspan=1 colspan=1>2.0</td><td rowspan=1 colspan=1>1.7</td><td rowspan=1 colspan=1>1.78.7</td><td rowspan=1 colspan=1>1.34.7</td><td rowspan=1 colspan=2>4.43.4</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>0.7</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=1>3.13.2</td><td rowspan=1 colspan=1>9.2</td><td rowspan=1 colspan=2>1.2</td><td rowspan=1 colspan=1>1.3</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=2>1.44.3</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>2.0</td><td rowspan=1 colspan=1>2.1</td><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=1>0.4</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=2>1.41.54.3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>mk</td><td rowspan=1 colspan=1>2.418.2</td><td rowspan=1 colspan=1>12.0</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>10.323.4</td><td rowspan=1 colspan=1>8.915.2</td><td rowspan=1 colspan=1>11.5</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1>3.7</td><td rowspan=1 colspan=1>8.911.1</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=2>4.513.9</td><td rowspan=1 colspan=1>15.6</td><td rowspan=1 colspan=1>8.3</td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>7.1</td><td rowspan=1 colspan=1>3.7</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=1>2.0</td><td rowspan=1 colspan=1>6.410.9</td><td rowspan=1 colspan=1>6.3</td><td rowspan=1 colspan=1>4.3</td></tr><tr><td rowspan=1 colspan=1>nl</td><td rowspan=1 colspan=2>2.4 8.2 2.9</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>14.2</td><td rowspan=1 colspan=1>16.1</td><td rowspan=1 colspan=1>8.426.5</td><td rowspan=1 colspan=1>13.416.8</td><td rowspan=1 colspan=1>16.7</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>3.9</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>11.413.3</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>5.313.8</td><td rowspan=1 colspan=1>15.4</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=1>7.6</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=1>5.1</td><td rowspan=1 colspan=1>1.6</td><td rowspan=1 colspan=1>1.1</td><td rowspan=1 colspan=1>3.2</td><td rowspan=1 colspan=1>6.110.6</td><td rowspan=1 colspan=1>8.0</td><td rowspan=1 colspan=1>5.1</td></tr><tr><td rowspan=1 colspan=1>pl</td><td rowspan=1 colspan=1>1.8 7.4</td><td rowspan=1 colspan=1>2.9</td><td rowspan=1 colspan=2>8.26.6</td><td rowspan=1 colspan=1>6.5</td><td rowspan=1 colspan=1>5.415.1</td><td rowspan=1 colspan=1>7.511.4</td><td rowspan=1 colspan=1>11.3</td><td rowspan=1 colspan=1>8.6</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>2.3</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>7.5 8.6</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=2>9.6</td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=1>9.5</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=2>2.4 8.9 7.7</td><td rowspan=1 colspan=1>6.3</td><td rowspan=1 colspan=1>3.6</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><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><td></td><td></td><td rowspan=1 colspan=1>5.8</td></tr><tr><td rowspan=1 colspan=1>pt-br</td><td rowspan=1 colspan=1>6.514.7</td><td rowspan=1 colspan=1>7.4</td><td rowspan=1 colspan=2>8.616.8</td><td rowspan=1 colspan=1>12.9</td><td rowspan=1 colspan=1>17.637.3</td><td rowspan=1 colspan=1>16.031.0</td><td rowspan=1 colspan=1>26.6</td><td rowspan=1 colspan=1>20.3</td><td rowspan=1 colspan=1>23.0</td><td rowspan=1 colspan=1>8.7</td><td rowspan=1 colspan=1>9.8</td><td rowspan=1 colspan=1>8.1</td><td rowspan=1 colspan=1>18.624.8</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=1>10.7</td><td rowspan=1 colspan=1>2.5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>14.8</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>15.1</td><td rowspan=1 colspan=1>11.8</td><td rowspan=1 colspan=1>6.4</td><td rowspan=1 colspan=1>8.9</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>10.818.8</td><td rowspan=1 colspan=1>13.2</td><td rowspan=1 colspan=1>6.7</td></tr><tr><td rowspan=1 colspan=1>r0</td><td rowspan=1 colspan=1>3.2,9.7</td><td rowspan=1 colspan=1>3.7</td><td rowspan=1 colspan=2>5.19.4</td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=1>10.425.0</td><td rowspan=1 colspan=1>6.718.8</td><td rowspan=1 colspan=1>19.3</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>10.0</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>11.015.5</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>6.4</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>8.0</td><td rowspan=1 colspan=1>8.1</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>15.4</td><td rowspan=1 colspan=1>17.7</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>8.0</td><td rowspan=1 colspan=1>3.6</td><td rowspan=1 colspan=1>5.0</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>7.0</td><td rowspan=1 colspan=1>3.3</td><td rowspan=1 colspan=1>6.612.7</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=1>4.9</td></tr><tr><td rowspan=1 colspan=1>ru</td><td rowspan=1 colspan=2>3.312.6 4.2</td><td rowspan=1 colspan=2>7.78.5</td><td rowspan=1 colspan=1>8.8</td><td rowspan=1 colspan=1>8.318.7</td><td rowspan=1 colspan=1>9.914.3</td><td rowspan=1 colspan=1>14.5</td><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1>6.0</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>6.8</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=1>9.511.7</td><td rowspan=1 colspan=1>6.1</td><td rowspan=1 colspan=1>7.7</td><td rowspan=1 colspan=1>7.4</td><td rowspan=1 colspan=1>8.0</td><td rowspan=1 colspan=1>8.1</td><td rowspan=1 colspan=1>8.9</td><td rowspan=1 colspan=1>12.4</td><td rowspan=1 colspan=1>13.9</td><td rowspan=1 colspan=1>8.2</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>8.2</td><td rowspan=1 colspan=1>2.9</td><td rowspan=1 colspan=1>22.511.5</td><td rowspan=1 colspan=1>9.1</td><td rowspan=1 colspan=1>5.2</td></tr><tr><td rowspan=1 colspan=1>sk</td><td rowspan=1 colspan=2>0.75.12.7</td><td rowspan=1 colspan=2>27.04.3</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>3.216.9</td><td rowspan=1 colspan=1>9.39.4</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1>5.1</td><td rowspan=1 colspan=1>3.7</td><td rowspan=1 colspan=1>4.96.9</td><td rowspan=1 colspan=1>2.2</td><td rowspan=1 colspan=1>3.9</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>5.0</td><td rowspan=1 colspan=1>7.1</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>6.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>5.0</td><td rowspan=1 colspan=1>1.5</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>1.6</td><td rowspan=1 colspan=1>5.45.4</td><td rowspan=1 colspan=1>2.3</td><td rowspan=1 colspan=1>2.5</td></tr><tr><td rowspan=1 colspan=1>sl</td><td rowspan=1 colspan=2>1.2 6.2 7.6</td><td rowspan=1 colspan=2>5.5 4.7</td><td rowspan=1 colspan=1>7.6</td><td rowspan=1 colspan=1>5.817.3</td><td rowspan=1 colspan=1>5.911.4</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>6.4</td><td rowspan=1 colspan=1>3.2</td><td rowspan=1 colspan=1>1.2</td><td rowspan=1 colspan=1>1.2</td><td rowspan=1 colspan=1>3.9</td><td rowspan=1 colspan=1>6.57.8</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>6.3</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>3.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=1>2.2</td><td rowspan=1 colspan=1>4.37.4</td><td rowspan=1 colspan=1>3.8</td><td rowspan=1 colspan=1>2.6</td></tr><tr><td rowspan=1 colspan=1>SV</td><td rowspan=1 colspan=2>2.2,7.4.4.8</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>26.5</td><td rowspan=1 colspan=1>12.6</td><td rowspan=1 colspan=1>8.131.8</td><td rowspan=1 colspan=1>11.016.9</td><td rowspan=1 colspan=1>15.7</td><td rowspan=1 colspan=1>0.7</td><td rowspan=1 colspan=1>7.1</td><td rowspan=1 colspan=1>3.3</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>11.613.3</td><td rowspan=1 colspan=1>4.8</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>11.5</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>15.0</td><td rowspan=1 colspan=1>17.4</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=1>8.1</td><td rowspan=1 colspan=1>3.8</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=1>1.0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.2</td><td rowspan=1 colspan=1>6.912.9</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=1>4.8</td></tr><tr><td rowspan=1 colspan=1>tr</td><td rowspan=1 colspan=2>2.2,3.52.0</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1>3.9</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=1>4.715.9</td><td rowspan=1 colspan=1>29.94</td><td rowspan=1 colspan=1>7.7</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>3.6</td><td rowspan=1 colspan=1>1.6</td><td rowspan=1 colspan=1>2.1</td><td rowspan=1 colspan=1>3.4</td><td rowspan=1 colspan=1>6.7.6.4</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>7.0</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>3.1</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>2.5</td><td rowspan=1 colspan=1>9.0</td><td rowspan=1 colspan=1>8.4</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>1.8</td><td rowspan=1 colspan=1>2.3</td><td rowspan=1 colspan=1>0.8</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.3 8.2</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>4.4</td></tr><tr><td rowspan=1 colspan=1>uk</td><td rowspan=1 colspan=2>2.912.35.3</td><td rowspan=1 colspan=1>7.4</td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=1>8.420.7</td><td rowspan=1 colspan=1>6.514.2</td><td rowspan=1 colspan=1>14.1</td><td rowspan=1 colspan=1>1.2</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>6.6</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=1>9.511.2</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>5.8</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>6.3</td><td rowspan=1 colspan=1>6.9</td><td rowspan=1 colspan=1>9.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>12.9</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1>6.9</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1>11.4</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=1>4.9</td></tr><tr><td rowspan=1 colspan=1>vi</td><td rowspan=1 colspan=2>4.2,7.5.4.0</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>6.0</td><td rowspan=1 colspan=1>8.820.2</td><td rowspan=1 colspan=1>7.313.7</td><td rowspan=1 colspan=1>13.2</td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=1>6.5</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>4.7</td><td rowspan=1 colspan=1>14.710.7</td><td rowspan=1 colspan=1>5.6</td><td rowspan=1 colspan=1>9.3</td><td rowspan=1 colspan=1>6.9</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>4.5</td><td rowspan=1 colspan=1>13.0</td><td rowspan=1 colspan=1>14.1</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>3.4</td><td rowspan=1 colspan=1>4.6</td><td rowspan=1 colspan=1>1.7</td><td rowspan=1 colspan=1>8.2</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>9.9</td><td rowspan=1 colspan=1>6.7</td></tr><tr><td rowspan=1 colspan=1>zh-cn</td><td rowspan=1 colspan=2>2.13.2 1.0</td><td rowspan=1 colspan=1>2.2</td><td rowspan=1 colspan=1>3.8</td><td rowspan=1 colspan=1>3.2</td><td rowspan=1 colspan=1>4.511.8</td><td rowspan=1 colspan=1>3.88.2</td><td rowspan=1 colspan=1>7.6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.2</td><td rowspan=1 colspan=1>1.7</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>3.0</td><td rowspan=1 colspan=1>6.66.0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.8</td><td rowspan=1 colspan=1>2.2</td><td rowspan=1 colspan=1>7.1</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=1>1.6</td><td rowspan=1 colspan=1>2.4</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>3.1</td><td rowspan=1 colspan=1>2.3</td><td rowspan=1 colspan=1>3.010.8</td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>zh-tw</td><td rowspan=1 colspan=2>2.2 3.1 1.1</td><td rowspan=1 colspan=4>2.13.7 2.8 3.910.7</td><td rowspan=1 colspan=1>3.4 7.5</td><td rowspan=1 colspan=1>7.2</td><td rowspan=1 colspan=1>6.1</td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=2>1.8 1.6</td><td rowspan=1 colspan=1>3.0</td><td rowspan=1 colspan=1>6.2 5.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=2>2.3 6.3</td><td rowspan=1 colspan=1>6.9</td><td rowspan=1 colspan=2>3.53.9</td><td rowspan=1 colspan=1>1.4</td><td rowspan=1 colspan=2>2.1 0.9</td><td rowspan=1 colspan=1>3.0</td><td rowspan=1 colspan=2>2.42.910.0</td><td rowspan=1 colspan=2></td></tr></table>
129
+
130
+ Overall, we were able to extract at least ten thousand parallel sentences for 85 different languages.13 For several low-resource languages, we were able to extract more parallel sentences with other languages than English. These include, among others, Aragonse with Spanish, Lombard with Italian, Breton with several Romance languages, Western Frisian with Dutch, Luxembourgish with German or Egyptian Arabic and Wu Chinese with the respective major language.
131
+
132
+ Finally, Cebuano (ceb) falls clearly apart: it has a rather huge Wikipedia (17.9M filtered sentence), but most of it was generated by a bot, as for the Waray language14. This certainly explains that only a very small number of parallel sentences could be extracted. Although the same bot was also used to generate articles in the Swedish Wikipedia, our alignments seem to be better for that language.
133
+
134
+ # 5.2 QUALITATIVE EVALUATION
135
+
136
+ Aiming to perform a large-scale assessment of the quality of the extracted parallel sentences, we trained NMT systems on the extracted parallel sentences. We identified a publicly available data set which provide test sets for many language pairs: translations of TED talks as proposed in the context of a study on pretrained word embeddings for $\mathbf { N M T } ^ { 1 5 }$ (Qi et al., 2018). We would like to emphasize that we did not use the training data provided by TED – we only trained on the mined sentences from Wikipedia. The goal of this study is not to build state-of-the-art NMT system for for the TED task, but to get an estimate of the quality of our extracted data, for many language pairs. In particular, there may be a mismatch in the topic and language style between Wikipedia texts and the transcribed and translated TED talks.
137
+
138
+ For training NMT systems, we used a transformer model from fairseq (Ott et al., 2019) with the parameter settings shown in Figure 2 in the appendix. For preprocessing, the text was tokenized using the Moses tokenizer (without true casing) and a 5000 subword vocabulary was learnt using SentencePiece (Kudo & Richardson, 2018). Decoding was done with beam size 5 and length normalization 1.2.
139
+
140
+ We evaluate the trained translation systems on the TED dataset (Qi et al., 2018). The TED data consists of parallel TED talk transcripts in multiple languages, and it provides development and test sets for 50 languages. Since the development and test sets were already tokenized, we first detokenize them using Moses. We trained NMT systems for all possible language pairs with more than twentyfive thousand mined sentences. This gives us in total 1886 language pairs in 45 languages. We train $L _ { 1 } L _ { 2 }$ and $L _ { 2 } \to L _ { 1 }$ with the same mined bitexts $L _ { 1 } / L _ { 2 }$ . Scores on the test sets were computed with SacreBLEU (Post, 2018). Table 5 summarizes all the results. Due to space constraints, we are unable to report BLEU score for all language combinations in that table. Some additional results are reported in Table 7 in the annex. 23 NMT systems achieve BLEU scores over 30, the best one being 37.3 for Brazilian Portuguese to English. Several results are worth mentioning, like Farsi/English: 16.7, Hebrew/English: 25.7, Indonesian/English: 24.9 or English/Hindi: 25.7 We also achieve interesting results for translation between various non English language pairs for which it is usually not easy to find parallel data, e.g. Norwegian Danish ${ \approx } 3 3$ , Norwegian Swedish ${ \approx } 2 5 $ , Indonesian Vietnamese ${ \approx } 1 6$ or Japanese / Korean ${ \approx } 1 7$ .
141
+
142
+ Our results on the TED set give an indication on the quality of the mined parallel sentences. These BLEU scores should be of course appreciated in context of the sizes of the mined corpora as given in Table 4. Obviously, we can not exclude that the provided data contains some wrong alignments even though the margin is large. Finally, we would like to point out that we run our approach on all available languages in Wikipedia, independently of the quality of LASER’s sentence embeddings for each one.
143
+
144
+ # 6 CONCLUSION
145
+
146
+ We have presented an approach to systematically mine for parallel sentences in the textual content of Wikipedia, for all possible language pairs. We use a recently proposed mining approach based on massively multilingual sentence embeddings (Artetxe & Schwenk, 2018a) and a margin criterion (Artetxe & Schwenk, 2018b). The same approach is used for all language pairs without the need of a language specific optimization. In total, we make available 135M parallel sentences in 85 languages, out of which only 34M sentences are aligned with English. We were able to mine more than ten thousands sentences for 1620 different language pairs. This corpus of parallel sentences is freely available.16 We also performed a large scale evaluation of the quality of the mined sentences by training 1886 NMT systems and evaluating them on the 45 languages of the TED corpus (Qi et al., 2018).
147
+
148
+ This work opens several directions for future research. The mined texts could be used to first retrain LASER’s multilingual sentence embeddings with the hope to improve the performance on low-resource languages, and then to rerun mining in Wikipedia. This process could be iteratively repeated. We also plan to apply the same methodology to other large multilingual collections. The monolingual texts made available by ParaCrawl or CommonCrawl17 are good candidates.
149
+
150
+ We expect that the WikiMatrix corpus has mostly well-formed sentences and it should not contain social media language. The mined parallel sentences are not limited to specific topics like many of the currently available resources (parliament proceedings, subtitles, software documentation, . . .), but are expected to cover many topics of Wikipedia. The fraction of unedited machine translated text is also expected to be low. We hope that this resource will be useful to support research in multilinguality, in particular machine translation.
151
+
152
+ # REFERENCES
153
+
154
+ Sadaf Abdul-Rauf and Holger Schwenk. On the Use of Comparable Corpora to Improve SMT performance. In EACL, pp. 16–23, 2009. URL http://www.aclweb.org/anthology/ E09-1003.
155
+
156
+ Sisay Fissaha Adafre and Maarten de Rijke. Finding similar sentences across multiple languages in Wikipedia. In Proceedings of the Workshop on NEW TEXT Wikis and blogs and other dynamic text sources, 2006.
157
+
158
+ Ahmad Aghaebrahimian. Deep neural networks at the service of multilingual parallel sentence extraction. In Coling, 2018.
159
+
160
+ Mikel Artetxe and Holger Schwenk. Massively multilingual sentence embeddings for zero-shot cross-lingual transfer and beyond. In https://arxiv.org/abs/1812.10464, 2018a.
161
+
162
+ Mikel Artetxe and Holger Schwenk. Margin-based Parallel Corpus Mining with Multilingual Sentence Embeddings. https://arxiv.org/abs/1811.01136, 2018b.
163
+
164
+ Andoni Azpeitia, Thierry Etchegoyhen, and Eva Mart´ınez Garcia. Weighted Set-Theoretic Alignment of Comparable Sentences. In BUCC, pp. 41–45, 2017. URL http://aclweb.org/ anthology/W17-2508.
165
+
166
+ Andoni Azpeitia, Thierry Etchegoyhen, and Eva Mart´ınez Garcia. Extracting Parallel Sentences from Comparable Corpora with STACC Variants. In BUCC, may 2018.
167
+
168
+ Houda Bouamor and Hassan Sajjad. H2@BUCC18: Parallel Sentence Extraction from Comparable Corpora Using Multilingual Sentence Embeddings. In BUCC, may 2018.
169
+
170
+ Christian Buck and Philipp Koehn. Findings of the wmt 2016 bilingual document alignment shared task. In Proceedings of the First Conference on Machine Translation, pp. 554–563, Berlin, Germany, August 2016. Association for Computational Linguistics. URL http://www.aclweb. org/anthology/W/W16/W16-2347.
171
+
172
+ Vishrav Chaudhary, Yuqing Tang, Francisco Guzman, Holger Schwenk, and Philipp Koehn. Low- ´ resource corpus filtering using multilingual sentence embeddings. In Proceedings of the Fourth Conference on Machine Translation (WMT), 2019.
173
+
174
+ Cristina Espana-Bonet, ˜ Ad´ am Csaba Varga, Alberto Barr ´ on-Cede ´ no, and Josef van Genabith. An ˜ Empirical Analysis of NMT-Derived Interlingual Embeddings and their Use in Parallel Sentence Identification. IEEE Journal of Selected Topics in Signal Processing, pp. 1340–1348, 2017.
175
+
176
+ Thierry Etchegoyhen and Andoni Azpeitia. Set-Theoretic Alignment for Comparable Corpora. In ACL, pp. 2009–2018, 2016. doi: 10.18653/v1/P16-1189. URL http://www.aclweb.org/ anthology/P16-1189.
177
+
178
+ Simon Gottschalk and Elena Demidova. Multiwiki: Interlingual text passage alignment in Wikipedia. ACM Transactions on the Web (TWEB), 11(1):6, 2017.
179
+
180
+ Francis Gregoire and Philippe Langlais. BUCC 2017 Shared Task: a First Attempt Toward a Deep ´ Learning Framework for Identifying Parallel Sentences in Comparable Corpora. In BUCC, pp. 46–50, 2017. URL http://aclweb.org/anthology/W17-2509.
181
+
182
+ Mandy Guo, Qinlan Shen, Yinfei Yang, Heming Ge, Daniel Cer, Gustavo Hernandez Abrego, Keith Stevens, Noah Constant, Yun-Hsuan Sung, Brian Strope, and Ray Kurzweil. Effective Parallel Corpus Mining using Bilingual Sentence Embeddings. arXiv:1807.11906, 2018.
183
+
184
+ Hany Hassan, Anthony Aue, Chang Chen, Vishal Chowdhary, Jonathan Clark, Christian Federmann, Xuedong Huang, Marcin Junczys-Dowmunt, William Lewis, Mu Li, Shujie Liu, Tie-Yan Liu, Renqian Luo, Arul Menezes, Tao Qin, Frank Seide, Xu Tan, Fei Tian, Lijun Wu, Shuangzhi Wu, Yingce Xia, Dongdong Zhang, Zhirui Zhang, and Ming Zhou. Achieving Human Parity on Automatic Chinese to English News Translation. arXiv:1803.05567, 2018.
185
+
186
+ Jeff Johnson, Matthijs Douze, and Herve J ´ egou. Billion-scale similarity search with GPUs. ´ arXiv preprint arXiv:1702.08734, 2017.
187
+
188
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. https://arxiv.org/abs/1607.01759, 2016.
189
+
190
+ H. Jegou, M. Douze, and C. Schmid. Product quantization for nearest neighbor search. ´ IEEE Trans. PAMI, 33(1):117–128, 2011.
191
+
192
+ Philipp Koehn. Europarl: A parallel corpus for statistical machine translation. In MT summit, 2005.
193
+
194
+ Philipp Koehn, Huda Khayrallah, Kenneth Heafield, and Mikel L. Forcada. Findings of the wmt 2018 shared task on parallel corpus filtering. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pp. 726–739, Belgium, Brussels, October 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/W18-6453.
195
+
196
+ Philipp Koehn, Francisco Guzman, Vishrav Chaudhary, and Juan M. Pino. Findings of the wmt 2019 ´ shared task on parallel corpus filtering for low-resource conditions. In Proceedings of the Fourth Conference on Machine Translation, Volume 2: Shared Task Papers, Florence, Italy, August 2019. Association for Computational Linguistics.
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, 2018. Association for Computational Linguistics. URL https://www.aclweb. org/anthology/D18-2012.
199
+
200
+ P. Lison and J. Tiedemann. Opensubtitles2016: Extracting large parallel corpora from movie and tv subtitles. In LREC, 2016.
201
+
202
+ Mehdi Zadeh Mohammadi and Nasser GhasemAghaee. Building bilingual parallel corpora based on Wikipedia. In 2010 Second International Conference on Computer Engineering and Applications, pp. 264–268, 2010.
203
+
204
+ Dragos Stefan Munteanu and Daniel Marcu. Improving Machine Translation Performance by Exploiting Non-Parallel Corpora. Computational Linguistics, 31(4):477–504, 2005. URL http://www.aclweb.org/anthology/J05-4003.
205
+
206
+ P Otero, I Lopez, S Cilenis, and Santiago de Compostela. Measuring comparability of multilingual ´ corpora extracted from Wikipedia. Iberian Cross-Language Natural Language Processings Tasks (ICL), pp. 8, 2011.
207
+
208
+ Pablo Gamallo Otero and Isaac Gonzalez L ´ opez. Wikipedia as multilingual source of comparable ´ corpora. In Proceedings of the 3rd Workshop on Building and Using Comparable Corpora, LREC, pp. 21–25, 2010.
209
+
210
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan $\mathrm { N g }$ , David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 48–53, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/N19-4009.
211
+
212
+ Alexandre Patry and Philippe Langlais. Identifying parallel documents from a large bilingual collection of texts: Application to parallel article extraction in Wikipedia. In Proceedings of the 4th Workshop on Building and Using Comparable Corpora: Comparable Corpora and the Web, pp. 87–95. Association for Computational Linguistics, 2011.
213
+
214
+ 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.
215
+
216
+ Ye Qi, Devendra Sachan, Matthieu Felix, Sarguna Padmanabhan, and Graham Neubig. When and why are pre-trained word embeddings useful for neural machine translation? In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 529– 535, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/N18-2084.
217
+ Philip Resnik. Mining the Web for Bilingual Text. In ACL, 1999. URL http://www.aclweb. org/anthology/P99-1068.
218
+ Philip Resnik and Noah A. Smith. The Web as a Parallel Corpus. Computational Linguistics, 29(3): 349–380, 2003. URL http://www.aclweb.org/anthology/J03-3002.
219
+ Holger Schwenk. Filtering and mining parallel data in a joint multilingual space. In ACL, pp. 228–234, 2018.
220
+ Jason R. Smith, Chris Quirk, and Kristina Toutanova. Extracting parallel sentences from comparable corpora using document level alignment. In NAACL, pp. 403–411, 2010.
221
+ J. Tiedemann. Parallel data, tools and interfaces in OPUS. In LREC, 2012.
222
+ Chen-Tse Tsai and Dan Roth. Cross-lingual wikification using multilingual embeddings. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 589–598, 2016.
223
+ Dan Tufis, Radu Ion, S, tefan Daniel, Dumitrescu, and Dan S, tefanescu. Wikipedia as an smt training ˘ corpus. In RANLP, pp. 702–709, 2013.
224
+ Masao Utiyama and Hitoshi Isahara. Reliable Measures for Aligning Japanese-English News Articles and Sentences. In ACL, 2003. URL http://www.aclweb.org/anthology/ P03-1010.
225
+ Yinfei Yang, Gustavo Hernandez ´ Abrego, Steve Yuan, Mandy Guo, Qinlan Shen, Daniel Cer, Yun- ´ Hsuan Sung, Brian Strope, and Ray Kurzweil. Improving multilingual sentence embedding using bi-directional dual encoder with additive margin softmax. In https://arxiv.org/abs/ 1902.08564, 2019.
226
+ Michał Ziemski, Marcin Junczys-Dowmunt, and Bruno Pouliquen. The United Nations Parallel
227
+
228
+ Corpus v1.0. In LREC, may 2016.
229
+
230
+ # A APPENDIX
231
+
232
+ Table 6 provides the amounts of mined parallel sentences for languages which have a rather small Wikipedia. Aligning those languages obviously yields to a very small amount of parallel sentences. Therefore, we only provide these results for alignment with high resource languages. It is also likely that several of these alignments are of low quality since the LASER embeddings were not directly trained on most these languages, but we still hope to achieve reasonable results since other languages of the same family may be covered.
233
+
234
+ <table><tr><td>ISO</td><td>Name</td><td>Language Family</td><td></td><td></td><td></td><td></td><td></td><td>size ca da de en es fr it nl pl pt sv ru zh total</td><td></td><td></td><td></td></tr><tr><td>an</td><td>Aragonese</td><td>Romance</td><td>222 24</td><td>71223331613</td><td></td><td></td><td></td><td>91014</td><td>9</td><td>11</td><td>6324</td></tr><tr><td>arz</td><td>Egyptian</td><td>Arabic</td><td>120 7</td><td>611</td><td></td><td>18 121210</td><td></td><td>8</td><td>910</td><td>812</td><td>278</td></tr><tr><td>as</td><td>Arabic Assamese</td><td>Indo-Aryan</td><td>124</td><td>611</td><td></td><td>7111 12</td><td>10</td><td>9</td><td>8</td><td>9</td><td>216</td></tr><tr><td>azb</td><td>South Azer- Turkic</td><td></td><td>398</td><td>4 9</td><td>8</td><td>910</td><td>9</td><td>7</td><td>8</td><td>7</td><td>172</td></tr><tr><td></td><td>baijani</td><td>Germanic</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>bar</td><td>Bavarian</td><td>Bishnupriya Indo-Aryan</td><td>214 128</td><td>641</td><td>161212</td><td></td><td>10</td><td>8</td><td>910</td><td>8 10 3</td><td>261</td></tr><tr><td>bpy br</td><td>Breton</td><td>Celtic</td><td>413</td><td>1 4 20 16 22 23 22</td><td>4</td><td>3 4</td><td>2</td><td>2</td><td>2 19</td><td>2 16</td><td>71 6200</td></tr><tr><td>ce</td><td>Chechen</td><td>Northeast</td><td>315</td><td>1</td><td>2 2</td><td>2 2</td><td>2</td><td>2</td><td>2</td><td>2</td><td>56</td></tr><tr><td>ceb</td><td>Cebuano</td><td>Caucasian Malayo-</td><td>17919 14</td><td>922 29272424151720 5521</td><td></td><td></td><td></td><td></td><td></td><td></td><td>9594</td></tr><tr><td>ckb</td><td>Central Kur- Iranian</td><td>Polynesian</td><td>127</td><td>2</td><td>6</td><td></td><td></td><td>4</td><td>4</td><td></td><td>113</td></tr><tr><td></td><td>dish</td><td>Turkic</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4</td><td>3</td><td></td></tr><tr><td>Cv</td><td>Chuvash Maldivian</td><td>Indo-Aryan</td><td>198 52 2</td><td>3 2 5</td><td>5 6</td><td>6 6</td><td>7</td><td>5</td><td>6</td><td>5 5</td><td>129 96</td></tr><tr><td>dv fo</td><td>Faroese</td><td>Germanic</td><td>114</td><td>131214322118 15</td><td></td><td>4 4</td><td>3</td><td>3</td><td>3 5111117</td><td>3</td><td>6335</td></tr><tr><td>fy</td><td>Western</td><td>Germanic</td><td>493 13</td><td>816</td><td>3221</td><td>1817</td><td></td><td>38</td><td>1218</td><td>1213 1314</td><td>453</td></tr><tr><td></td><td>Frisian</td><td>Celtic</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>gd</td><td>Gaelic Irish</td><td>Irish</td><td>66 216</td><td>1 2</td><td>1 1 3 4</td><td>1 1 3</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1 41 1 70</td></tr><tr><td>ga gom</td><td>Goan</td><td>Indo-Aryan</td><td>69</td><td>710</td><td>81313</td><td></td><td>3 13</td><td>2 9</td><td>3 911</td><td>2 9 10</td><td>240</td></tr><tr><td>ht</td><td>Konkami Haitian Cre-Creole</td><td></td><td>60</td><td>1 3</td><td>4</td><td></td><td></td><td></td><td></td><td></td><td>72</td></tr><tr><td></td><td>ole</td><td></td><td></td><td></td><td></td><td></td><td>3</td><td>2</td><td>2</td><td>3</td><td></td></tr><tr><td>ilo io</td><td>Iloko Ido</td><td>Philippine constructed</td><td>63</td><td>2 4</td><td>5</td><td>4</td><td>4</td><td>3</td><td>4</td><td>4</td><td>2 96</td></tr><tr><td>jv</td><td>Javanese</td><td>Malayo-</td><td>153 220</td><td>3 6 5 8</td><td>11 13</td><td>7</td><td>5</td><td>5</td><td>6</td><td>5</td><td>3 143 3 219</td></tr><tr><td></td><td></td><td>Polynesian</td><td></td><td></td><td></td><td></td><td>121011</td><td>8</td><td>711</td><td>8 8</td><td></td></tr><tr><td>ka</td><td>Georgian</td><td>Kartvelian</td><td>480 11</td><td>715</td><td>1216171612111412 13</td><td></td><td></td><td></td><td></td><td></td><td>5 288</td></tr><tr><td>ku</td><td>Kurdish</td><td>Iranian</td><td>165 5</td><td>4 8</td><td>5</td><td>7</td><td>8</td><td>7</td><td>7</td><td>6</td><td>3 222</td></tr><tr><td>la</td><td>Latin</td><td>Romance</td><td>558 12</td><td>9 17</td><td>322018</td><td></td><td>17</td><td>12 13</td><td>18</td><td>13 14</td><td>6 478</td></tr><tr><td>Ib</td><td></td><td>LuxembourgShrmanic</td><td>372 12 6</td><td>7 2622</td><td></td><td></td><td>19 18 15</td><td>11 11</td><td>16</td><td>12 11</td><td>4 305</td></tr><tr><td>Imo</td><td>Lombard</td><td>Romance</td><td>147</td><td>3 710</td><td></td><td>7</td><td>11</td><td>6 5</td><td>7</td><td>5</td><td>3 144</td></tr><tr><td>mg</td><td>Malagasy</td><td>Malayo- Polynesian</td><td>263</td><td>5</td><td>913</td><td>912</td><td></td><td></td><td>&gt;</td><td>8</td><td>4 199</td></tr><tr><td>mhr</td><td>Eastern Mari</td><td>Uralic</td><td>61</td><td>2 4</td><td></td><td>4 4</td><td></td><td></td><td></td><td></td><td>96</td></tr><tr><td>min</td><td>MinangkabatMalayo-</td><td></td><td>255</td><td>2 6</td><td></td><td></td><td></td><td></td><td></td><td></td><td>121</td></tr><tr><td>mn</td><td>Mongolian Mongolic</td><td>Polynesian</td><td>255</td><td>3</td><td>5</td><td>6</td><td></td><td>6</td><td>5</td><td>5</td><td>3 197</td></tr><tr><td>nds nl Low</td><td>mwl Mirandese Romance</td><td>Ger- Germanic</td><td>64 65</td><td>3 4 4</td><td>10 610</td><td>6</td><td>5</td><td>3</td><td>434</td><td>3 4 5</td><td>2 154 3</td></tr><tr><td></td><td>man/Saxon</td><td></td><td></td><td></td><td></td><td>7</td><td>6</td><td>15</td><td>6</td><td>5</td><td>151</td></tr><tr><td>ps</td><td>Pashto</td><td>Iranian</td><td>89</td><td>2 3</td><td>2</td><td>3</td><td>3 3</td><td>3</td><td>3 3</td><td>3 3</td><td>73 86</td></tr><tr><td>rm sah</td><td>Romansh Yakut</td><td>Italic Turkic/Sib</td><td>57 134</td><td>2 10 3 7</td><td>5 5</td><td>4 6</td></table>
235
+
236
+ Table 2 gives the detailed configuration which was used to train NMT models on the mined data in Section 5.
237
+
238
+ ![](images/0cb585c2c9118ad040b3d003d6c1ff91d257986263dccbb19a6895d1af418b4d.jpg)
239
+ Figure 2: Model settings for NMT training with fairseq
240
+
241
+ Finally, Table 7 gives the BLEU scores on the TED corpus when translating into and from English for some additional languages.
242
+
243
+ Table 7: BLEU scores on the TED test set as proposed in (Qi et al., 2018). NMT systems were trained on bitexts mined in Wikipedia only. No other resources were used.
244
+
245
+ <table><tr><td rowspan=1 colspan=1>Lang</td><td rowspan=1 colspan=2>XX→en</td><td rowspan=1 colspan=1>en→xx</td></tr><tr><td rowspan=2 colspan=1>eteu</td><td rowspan=2 colspan=2>15.910.1</td><td rowspan=1 colspan=1>14.3</td></tr><tr><td rowspan=1 colspan=1>10.1</td><td rowspan=1 colspan=1>7.6</td></tr><tr><td rowspan=1 colspan=1>fa</td><td rowspan=1 colspan=2>16.7</td><td rowspan=1 colspan=1>8.8</td></tr><tr><td rowspan=1 colspan=1>fi</td><td rowspan=1 colspan=2>10.9</td><td rowspan=1 colspan=1>10.9</td></tr><tr><td rowspan=1 colspan=1>lt</td><td rowspan=1 colspan=2>13.7</td><td rowspan=1 colspan=1>10.0</td></tr><tr><td rowspan=1 colspan=1>hi</td><td rowspan=1 colspan=2>17.8</td><td rowspan=1 colspan=1>21.9</td></tr><tr><td rowspan=1 colspan=1>mr</td><td rowspan=1 colspan=2>2.6</td><td rowspan=1 colspan=1>3.5</td></tr></table>
md/train/rkevMnRqYQ/rkevMnRqYQ.md ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PREFERENCES IMPLICIT IN THE STATE OF THE WORLD
2
+
3
+ Rohin Shah ∗ † UC Berkeley
4
+
5
+ Dmitrii Krasheninnikov ∗ † ‡ University of Amsterdam
6
+
7
+ Jordan Alexander † ‡ Stanford University
8
+
9
+ Pieter Abbeel UC Berkeley
10
+
11
+ Anca D. Dragan UC Berkeley
12
+
13
+ # ABSTRACT
14
+
15
+ Reinforcement learning (RL) agents optimize only the features specified in a reward function and are indifferent to anything left out inadvertently. This means that we must not only specify what to do, but also the much larger space of what not to do. It is easy to forget these preferences, since these preferences are already satisfied in our environment. This motivates our key insight: when a robot is deployed in an environment that humans act in, the state of the environment is already optimized for what humans want. We can therefore use this implicit preference information from the state to fill in the blanks. We develop an algorithm based on Maximum Causal Entropy IRL and use it to evaluate the idea in a suite of proof-of-concept environments designed to show its properties. We find that information from the initial state can be used to infer both side effects that should be avoided as well as preferences for how the environment should be organized. Our code can be found at https://github.com/HumanCompatibleAI/rlsp.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Deep reinforcement learning (deep RL) has been shown to succeed at a wide variety of complex tasks given a correctly specified reward function. Unfortunately, for many real-world tasks it can be challenging to specify a reward function that captures human preferences, particularly the preference for avoiding unnecessary side effects while still accomplishing the goal (Amodei et al., 2016). As a result, there has been much recent work (Christiano et al., 2017; Fu et al., 2017; Sadigh et al., 2017) that aims to learn specifications for tasks a robot should perform.
20
+
21
+ Typically when learning about what people want and don’t want, we look to human action as evidence: what reward they specify (Hadfield-Menell et al., 2017), how they perform a task (Ziebart et al., 2010; Fu et al., 2017), what choices they make (Christiano et al., 2017; Sadigh et al., 2017), or how they rate certain options (Daniel et al., 2014). Here, we argue that there is an additional source of information that is potentially rather helpful, but that we have been ignoring thus far:
22
+
23
+ The key insight of this paper is that when a robot is deployed in an environment that humans have been acting in, the state of the environment is already optimized for what humans want.
24
+
25
+ For example, consider an environment in which a household robot must navigate to a goal location without breaking any vases in its path, illustrated in Figure 1. The human operator, Alice, asks the robot to go to the purple door, forgetting to specify that it should also avoid breaking vases along the way. However, since the robot has been deployed in a state that only contains unbroken vases, it can infer that while acting in the environment (prior to robot’s deployment), Alice was using one of the relatively few policies that do not break vases, and so must have cared about keeping vases intact.
26
+
27
+ ![](images/f9aa5b013d6e89cceeedb74ce4122761126fe5629ca0ebfb51a700904a443afc.jpg)
28
+ Figure 1: An illustration of learning preferences from an initial state. Alice attempts to accomplish a goal in an environment with an easily breakable vase in the center. The robot observes the state of the environment, $s _ { 0 }$ , after Alice has acted for some time from an even earlier state $s _ { - T }$ . It considers multiple possible human reward functions, and infers that states where vases are intact usually occur when Alice’s reward penalizes breaking vases. In contrast, it doesn’t matter much what the reward function says about carpets, as we would observe the same final state either way. Note that while we consider a specific $s _ { - T }$ for clarity here, the robot could also reason using a distribution over $s _ { - T }$ .
29
+
30
+ The initial state $s _ { 0 }$ can contain information about arbitrary preferences, including tasks that the robot should actively perform. For example, if the robot observes a basket full of apples near an apple tree, it can reasonably infer that Alice wants to harvest apples. However, $s _ { 0 }$ is particularly useful for inferring which side effects humans care about. Recent approaches avoid unnecessary side effects by penalizing changes from an inaction baseline (Krakovna et al., 2018; Turner, 2018). However, this penalizes all side effects. The inaction baseline is appealing precisely because the initial state has already been optimized for human preferences, and action is more likely to ruin $s _ { 0 }$ than inaction. If our robot infers preferences from $s _ { 0 }$ , it can avoid negative side effects while allowing positive ones.
31
+
32
+ This work is about highlighting the potential of this observation, and as such makes unrealistic assumptions, such as known dynamics and hand-coded features. Given just $s _ { 0 }$ , these assumptions are necessary: without dynamics, it is hard to tell whether some feature of $s _ { 0 }$ was created by humans or not. Nonetheless, we are optimistic that these assumptions can be relaxed, so that this insight can be used to improve deep RL systems. We suggest some approaches in our discussion.
33
+
34
+ Our contributions are threefold. First, we identify the state of the world at initialization as a source of information about human preferences. Second, we leverage this insight to derive an algorithm, Reward Learning by Simulating the Past (RLSP), which infers reward from initial state based on a Maximum Causal Entropy (Ziebart et al., 2010) model of human behavior. Third, we demonstrate the properties and limitations of RLSP on a suite of proof-of-concept environments: we use it to avoid side effects, as well as to learn implicit preferences that require active action. In Figure 1 the robot moves to the purple door without breaking the vase, despite the lack of a penalty for breaking vases.
35
+
36
+ # 2 RELATED WORK
37
+
38
+ Preference learning. Much recent work has learned preferences from different sources of data, such as demonstrations (Ziebart et al., 2010; Ramachandran and Amir, 2007; Ho and Ermon, 2016; Fu et al., 2017; Finn et al., 2016), comparisons (Christiano et al., 2017; Sadigh et al., 2017; Wirth et al., 2017), ratings (Daniel et al., 2014), human reinforcement signals (Knox and Stone, 2009; Warnell et al., 2017; MacGlashan et al., 2017), proxy rewards (Hadfield-Menell et al., 2017), etc. We suggest preference learning with a new source of data: the state of the environment when the robot is first deployed. It can also be seen as a variant of Maximum Causal Entropy Inverse Reinforcement Learning (Ziebart et al., 2010): while inverse reinforcement learning (IRL) requires demonstrations, or at least state sequences without actions (Edwards et al., 2018; Yu et al., 2018), we learn a reward function from a single state, albeit with the simplifying assumption of known dynamics. This can also be seen as an instance of IRL from summary data (Kangasra¨asi ¨ o and Kaski, 2018). ¨
39
+
40
+ Frame properties. The frame problem in AI (McCarthy and Hayes, 1981) refers to the issue that we must specify what stays the same in addition to what changes. In formal verification, this manifests as a requirement to explicitly specify the many quantities that the program does not change (Andreescu, 2017). Analogously, rewards are likely to specify what to do (the task), but may forget to say what not to do (the frame properties). One of our goals is to infer frame properties automatically.
41
+
42
+ Side effects. An impact penalty can mitigate reward specification problems, since it penalizes unnecessary “large” changes (Armstrong and Levinstein, 2017). We could penalize a reduction in the number of reachable states (Krakovna et al., 2018) or attainable utility (Turner, 2018). However, such approaches will penalize all irreversible effects, including ones that humans want. In contrast, by taking a preference inference approach, we can infer which effects humans care about.
43
+
44
+ Goal states as specifications. Desired behavior in RL can be specified with an explicitly chosen goal state (Kaelbling, 1993; Schaul et al., 2015; Nair et al., 2018; Bahdanau et al., 2018; Andrychowicz et al., 2017). In our setting, the robot observes the initial state $s _ { 0 }$ where it starts acting, which is not explicitly chosen by the designer, but nonetheless contains preference information.
45
+
46
+ # 3 PRELIMINARIES
47
+
48
+ A finite-horizon Markov decision process (MDP) is a tuple $\mathcal { M } = \langle \mathcal { S } , \mathcal { A } , \mathcal { T } , r , T \rangle$ , where $s$ is the set of states, $\mathcal { A }$ is the set of actions, $\mathcal { T } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mapsto [ 0 , 1 ]$ is the transition probability function, $r : S \mapsto \mathbb { R }$ is the reward function, and $T \in \mathbb { Z } _ { + }$ is the finite planning horizon. We consider MDPs where the reward is linear in features, and does not depend on action: ${ \bf \nabla } _ { r ( s ; \theta ) } = \theta ^ { T } f ( s )$ , where $\theta$ are the parameters defining the reward function and $f$ computes features of a given state.
49
+
50
+ Inverse Reinforcement Learning (IRL). In IRL, the aim is to infer the reward function $r$ given an MDP without reward $\mathcal { M } \backslash r$ and expert demonstrations $\mathcal { D } = \{ \tau _ { 1 } , . . . , \tau _ { n } \}$ , where each $\tau _ { i } =$ $( s _ { 0 } , a _ { 0 } , . . . , s _ { T } , a _ { T } )$ is a trajectory sampled from the expert policy acting in the MDP. It is assumed that each $\tau _ { i }$ is feasible, so that $\mathcal { T } ( s _ { j + 1 } \mid s _ { j } , a _ { j } ) > 0$ for every $j$ .
51
+
52
+ Maximum Causal Entropy IRL (MCEIRL). As human demonstrations are rarely optimal, Ziebart et al. (2010) models the expert as a Boltzmann-rational agent that maximizes total reward and causal entropy of the policy. This leads to the policy $\pi _ { t } ( a \mathbin | \mathbin { \bar { \ s } } , \theta ) = \exp ( Q _ { t } ( s , a ; \theta ) - V _ { t } ( s ; \theta ) )$ , where $\begin{array} { r } { V _ { t } ( s ; \bar { \theta } ) = \ln \bar { \sum _ { a } } e x p ( Q _ { t } ( s , a ; \theta ) ) } \end{array}$ plays the role of a normalizing constant. Intuitively, the expert is assumed to act close to randomly when the difference in expected total reward across the actions is small, but nearly always chooses the best action when it leads to a substantially higher expected return. The soft Bellman backup for the state-action value function $Q$ is the same as usual, and is given by $\begin{array} { r } { Q _ { t } ( s , a ; \theta ) = \theta ^ { T } f ( s ) \dot { + } \sum _ { s ^ { \prime } } \mathcal { T } ( s ^ { \prime } \mid s , a ) V _ { t + 1 } ( s ^ { \prime } ; \theta ) } \end{array}$ .
53
+
54
+ The likelihood of a trajectory $\tau$ given the reward parameters $\theta$ is:
55
+
56
+ $$
57
+ p ( \tau \mid \theta ) = p ( s _ { 0 } ) \bigg ( \prod _ { t = 0 } ^ { T - 1 } \mathcal { T } ( s _ { t + 1 } \mid s _ { t } , a _ { t } ) \pi _ { t } ( a _ { t } \mid s _ { t } , \theta ) \bigg ) \pi _ { T } ( a _ { T } \mid s _ { T } , \theta ) .
58
+ $$
59
+
60
+ MCEIRL finds the reward parameters $\theta ^ { * }$ that maximize the log-likelihood of the demonstrations:
61
+
62
+ $$
63
+ \theta ^ { * } = \operatorname * { a r g m a x } _ { \theta } \ln { p ( \mathcal { D } \mid \theta ) } = \operatorname * { a r g m a x } _ { \theta } \sum _ { i } \sum _ { t } \ln { \pi } _ { t } ( a _ { i , t } \mid s _ { i , t } , \theta ) .
64
+ $$
65
+
66
+ $\theta ^ { * }$ gives rise to a policy whose feature expectations match those of the expert demonstrations.
67
+
68
+ # 4 REWARD LEARNING BY SIMULATING THE PAST
69
+
70
+ We solve the problem of learning the reward function of an expert Alice given a single final state of her trajectory; we refer to this problem as IRL from a single state. Formally, we aim to infer Alice’s reward $\theta$ given an environment $\mathcal { M } \backslash r$ and the last state of the expert’s trajectory $s _ { 0 }$ .
71
+
72
+ Formulation. To adapt MCEIRL to the one state setting we modify the observation model from Equation 1. Since we only have a single end state $s _ { 0 }$ of the trajectory $\tau _ { 0 } = ( s _ { - T } , a _ { - T } , . . . , s _ { 0 } , a _ { 0 } )$ , we marginalize over all of the other variables in the trajectory:
73
+
74
+ $$
75
+ p ( s _ { 0 } \mid \theta ) = \sum _ { s _ { - T } , a _ { - T } , \ldots s _ { - 1 } , a _ { - 1 } , a _ { 0 } } p ( \tau _ { 0 } \mid \theta ) ,
76
+ $$
77
+
78
+ where $p ( \tau _ { 0 } \mid \theta )$ is given in Equation 1. We could invert this and sample from $p ( \theta \mid s _ { 0 } )$ ; the resulting algorithm is presented in Appendix C, but is relatively noisy and slow. We instead find the MLE:
79
+
80
+ $$
81
+ \theta ^ { * } = \operatorname * { a r g m a x } _ { \theta } \ln p ( s _ { 0 } \mid \theta ) .
82
+ $$
83
+
84
+ Solution. Similarly to MCEIRL, we use a gradient ascent algorithm to solve the IRL from one state problem. We explain the key steps here and give the full derivation in Appendix B. First, we express the gradient in terms of the gradients of trajectories:
85
+
86
+ $$
87
+ \nabla _ { \theta } \ln p ( s _ { 0 } \mid \theta ) = \sum _ { \tau _ { - T ; - 1 } } p ( \tau _ { - T ; - 1 } \mid s _ { 0 } , \theta ) \nabla _ { \theta } \ln p ( \tau _ { - T ; 0 } \mid \theta ) .
88
+ $$
89
+
90
+ This has a nice interpretation – compute the Maximum Causal Entropy gradients for each trajectory, and then take their weighted sum, where each weight is the probability of the trajectory given the evidence $s _ { 0 }$ and current reward $\theta$ . We derive the exact gradient for a trajectory instead of the approximate one in Ziebart et al. (2010) in Appendix A and substitute it in to get:
91
+
92
+ $$
93
+ \nabla _ { \theta } \ln p ( s _ { 0 } ) = \frac { 1 } { p ( s _ { 0 } ) } \sum _ { \tau _ { - } , \tau _ { : - 1 } } \left[ p ( \tau _ { - T : - 1 } , s _ { 0 } ) \sum _ { t = - T } ^ { - 1 } \left( f ( s _ { t } ) + \mathbb { E } _ { s _ { t + 1 } ^ { \prime } } \left[ \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ^ { \prime } ) \right] - \mathcal { F } _ { t } ( s _ { t } ) \right) \right] ,
94
+ $$
95
+
96
+ where we have suppressed the dependence on $\theta$ for readability. $\mathcal { F } _ { t } ( s _ { t } )$ denotes the expected features when starting at $s _ { t }$ at time $t$ and acting until time 0 under the policy implied by $\theta$ .
97
+
98
+ Since we combine gradients from simulated past trajectories, we name our algorithm Reward Learning by Simulating the Past (RLSP). The algorithm computes the gradient using dynamic programming, detailed in Appendix B. We can easily incorporate a prior on $\theta$ by adding the gradient of the log prior to the gradient in Equation 5.
99
+
100
+ # 5 EVALUATION
101
+
102
+ Evaluation of RLSP is non-trivial. The inferred reward is very likely to assign state $s _ { 0 }$ maximal reward, since it was inferred under the assumption that when Alice optimized the reward she ended up at $s _ { 0 }$ . If the robot then starts in state $s _ { 0 }$ , if a no-op action is available (as it often is), the RLSP reward is likely to incentivize no-ops, which is not very interesting.
103
+
104
+ Ultimately, we hope to use RLSP to correct badly specified instructions or reward functions. So, we created a suite of environments with a true reward $R _ { \mathrm { t r u e } }$ , a specified reward $R _ { \mathrm { s p e c } }$ , Alice’s first state $s _ { - T }$ , and the robot’s initial state $s _ { 0 }$ , where $R _ { \mathrm { s p e c } }$ ignores some aspect(s) of $R _ { \mathrm { t r u e } }$ . RLSP is used to infer a reward $\theta _ { \mathrm { A l i c e } }$ from $s _ { 0 }$ , which is then combined with the specified reward to get a final reward $\theta _ { \mathrm { f i n a l } } = \theta _ { \mathrm { A l i c e } } + \lambda \theta _ { \mathrm { s p e c } }$ . (We considered another method for combining rewards; see Appendix D for details.) We inspect the inferred reward qualitatively and measure the expected amount of true reward obtained when planning with $\theta _ { \mathrm { f i n a l } }$ , as a fraction of the expected true reward from the optimal policy. We tune the hyperparameter $\lambda$ controlling the tradeoff between $R _ { \mathrm { s p e c } }$ and the human reward for all algorithms, including baselines. We use a Gaussian prior over the reward parameters.
105
+
106
+ # 5.1 BASELINES
107
+
108
+ Specified reward policy $\pi _ { \mathbf { s p e c } }$ . We act as if the true reward is exactly the specified reward.
109
+
110
+ Policy that penalizes deviations πdeviation. This baseline minimizes change by penalizing deviations from the observed features $f ( s _ { 0 } )$ , giving $R _ { \mathrm { f i n a l } } ( s ) = \theta _ { \mathrm { s p e c } } ^ { T } f ( s ) + \lambda \vert \vert f ( s ) ^ { } - \bar { f ( s _ { 0 } ) } \vert \vert$ .
111
+
112
+ Relative reachability policy πreachability. Relative reachability (Krakovna et al., 2018) considers a change to be negative when it decreases coverage, relative to what would have happened had the agent done nothing. Here, coverage is a measure of how easily states can be reached from the current state. We compare against the variant of relative reachability that uses undiscounted coverage and a baseline policy where the agent takes no-op actions, as in the original paper. Relative reachability requires known dynamics but not a handcoded featurization. A version of relative reachability that operates in feature space instead of state space would behave similarly.
113
+
114
+ # 5.2 COMPARISON TO BASELINES
115
+
116
+ We compare RLSP to our baselines with the assumption of known $s _ { - T }$ , because it makes it easier to analyze RLSP’s properties. We consider the case of unknown $s _ { - T }$ in Section 5.3. We summarize the results in Table 1, and show the environments and trajectories in Figure 2.
117
+
118
+ Table 1: Performance of algorithms on environments designed to test particular properties.
119
+
120
+ <table><tr><td></td><td>Side effects Room</td><td>Env effect Toy train</td><td>Implicitreward Apple collection</td><td colspan="2">Desirable effect Batteries</td><td>Unseen effect Far away vase</td></tr><tr><td>Tspec</td><td>×</td><td></td><td></td><td>Easy √</td><td>Hard</td><td></td></tr><tr><td>Tdeviation Treachability</td><td>√</td><td>xx/</td><td>xxx</td><td>~ ~ 厂</td><td>xxx √</td><td>√</td></tr></table>
121
+
122
+ ![](images/5bc1b06f0cdfb776a4e0850326a57f20ab09faf9e97b0af2a2156e6de40728b7.jpg)
123
+ Figure 2: Evaluation of RLSP on our environments. Silhouettes indicate the initial position of an object or agent, while filled in version indicate their positions after an agent has acted. The first row depicts the information given to RLSP. The second row shows the trajectory taken by the robot when following the policy $\pi _ { \mathrm { s p e c } }$ that is optimal for $\theta _ { \mathrm { s p e c } }$ . The third row shows the trajectory taken when following the policy $\pi _ { \mathrm { R L S P } }$ that is optimal for $\dot { \theta } _ { \mathrm { f i n a l } } = \theta _ { \mathrm { A l i c e } } + \lambda \theta _ { \mathrm { s p e c } }$ . (a) Side effects: Room with vase (b) Distinguishing environment effects: Toy train (c) Implicit reward: Apple collection (d) Desirable side effect: Batteries (e) “Unseen” side effect: Room with far away vase.
124
+
125
+ Side effects: Room with vase (Figure 2a). The room tests whether the robot can avoid breaking a vase as a side effect of going to the purple door. There are features for the number of broken vases, standing on a carpet, and each door location. Since Alice didn’t walk over the vase, RLSP infers a negative reward on broken vases, and a small positive reward on carpets (since paths to the top door usually involve carpets). So, $\pi _ { \mathrm { R L S P } }$ successfully avoids breaking the vase. The penalties also achieve the desired behavior: πdeviation avoids breaking the vase since it would change the “number of broken vases” feature, while relative reachability avoids breaking the vase since doing so would result in all states with intact vases becoming unreachable.
126
+
127
+ Distinguishing environment effects: Toy train (Figure 2b). To test whether algorithms can distinguish between effects caused by the agent and effects caused by the environment, as suggested in Krakovna et al. (2018), we add a toy train that moves along a predefined track. The train breaks if the agent steps on it. We add a new feature indicating whether the train is broken and new features for each possible train location. As before, the specified reward only has a positive weight on the purple door, while the true reward also penalizes broken trains and vases.
128
+
129
+ RLSP infers a negative reward on broken vases and broken trains, for the same reason as before. It also infers not to put any weight on any particular train location, even though it changes frequently, because it doesn’t help explain $s _ { 0 }$ . As a result, $\pi _ { \mathrm { R L S P } }$ walks over a carpet, but not a vase or a train. πdeviation immediately breaks the train to keep the train location the same. πreachability deduces that breaking the train is irreversible, and so follows the same trajectory as πRLSP.
130
+
131
+ Implicit reward: Apple collection (Figure 2d). This environment tests whether the algorithms can learn tasks implicit in $s _ { 0 }$ . There are three trees that grow apples, as well as a basket for collecting apples, and the goal is for the robot to harvest apples. However, the specified reward is zero: the robot must infer the task from the observed state. We have features for the number of apples in baskets, the number of apples on trees, whether the robot is carrying an apple, and each location that the agent could be in. $s _ { 0 }$ has two apples in the basket, while $s _ { - T }$ has none.
132
+
133
+ $\pi _ { \mathrm { s p e c } }$ is arbitrary since every policy is optimal for the zero reward. πdeviation does nothing, achieving zero reward, since its reward can never be positive. πreachability also does not harvest apples. RLSP infers a positive reward on apples in baskets, a negative reward for apples on trees, and a small positive reward for carrying apples. Despite the spurious weights, $\pi _ { \mathrm { R L S P } }$ harvests apples as desired.
134
+
135
+ Desirable side effect: Batteries (Figure $2 c$ ). This environment tests whether the algorithms can tell when a side effect is allowed. We take the toy train environment, remove vases and carpets, and add batteries. The robot can pick up batteries and put them into the (now unbreakable) toy train, but the batteries are never replenished. If the train runs for 10 timesteps without a new battery, it stops operating. There are features for the number of batteries, whether the train is operational, each train location, and each door location. There are two batteries at $s _ { - T }$ but only one at $s _ { 0 }$ . The true reward incentivizes an operational train and being at the purple door. We consider two variants for the task reward – an “easy” case, where the task reward equals the true reward, and a “hard” case, where the task reward only rewards being at the purple door.
136
+
137
+ Unsurprisingly, $\pi _ { \mathrm { s p e c } }$ succeeds at the easy case, and fails on the hard case by allowing the train to run out of power. Both πdeviation and πreachability see the action of putting a battery in the train as a side effect to be penalized, and so neither can solve the hard case. They penalize picking up the batteries, and so only solve the easy case if the penalty weight is small. RLSP sees that one battery is gone and that the train is operational, and infers that Alice wants the train to be operational and doesn’t want batteries (since a preference against batteries and a preference for an operational train are nearly indistinguishable). So, it solves both the easy and the hard case, with πRLSP picking up the battery, then staying at the purple door except to deliver the battery to the train.
138
+
139
+ “Unseen” side effect: Room with far away vase (Figure 2e). This environment demonstrates a limitation of our algorithm: it cannot identify side effects that Alice would never have triggered. In this room, the vase is nowhere close to the shortest path from the Alice’s original position to her goal, but is on the path to the robot’s goal. Since our baselines don’t care about the trajectory the human takes, they all perform as before: $\pi _ { \mathrm { s p e c } }$ walks over the vase, while $\pi _ { \mathrm { d e v i a t i o n } }$ and πreachability both avoid it. Our method infers a near zero weight on the broken vase feature, since it is not present on any reasonable trajectory to the goal, and so breaks it when moving to the goal. Note that this only applies when Alice is known to be at the bottom left corner at $s _ { - T }$ : if we have a uniform prior over $s _ { - T }$ (considered in Section 5.3) then we do consider trajectories where vases are broken.
140
+
141
+ # 5.3 COMPARISON BETWEEN KNOWING $s _ { - T }$ VS. A DISTRIBUTION OVER $s _ { - T }$
142
+
143
+ So far, we have considered the setting where the robot knows $s _ { - T }$ , since it is easier to analyze what happens. However, typically we will not know $s _ { - T }$ , and will instead have some prior over $s _ { - T }$ . Here, we compare RLSP in two settings: perfect knowledge of $s _ { - T }$ (as in Section 5.2), and a uniform distribution over all states.
144
+
145
+ Side effects: Room with vase (Figure 2a) and toy train (Figure $2 b$ ). In both room with vase and toy train, RLSP learns a smaller negative reward on broken vases when using a uniform prior. This is because RLSP considers many more feasible trajectories when using a uniform prior, many of which do not give Alice a chance to break the vase, as in Room with far away vase in Section 5.2. In room with vase, the small positive reward on carpets changes to a near-zero negative reward on carpets. With known $s _ { - T }$ , RLSP overfits to the few consistent trajectories, which usually go over carpets, whereas with a uniform prior it considers many more trajectories that often don’t go over carpets, and so it correctly infers a near-zero weight. In toy train, the negative reward on broken trains becomes slightly more negative, while other features remain approximately the same. This may be because when Alice starts out closer to the toy train, she has more of an opportunity to break it, compared to the known $s _ { - T }$ case.
146
+
147
+ Implicit preference: Apple collection (Figure 2d). Here, a uniform prior leads to a smaller positive weight on the number of apples in baskets compared to the case with known $s _ { - T }$ . Intuitively, this is because RLSP is considering cases where $s _ { - T }$ already has one or two apples in the basket, which implies that Alice has collected fewer apples and so must have been less interested in them. States where the basket starts with three or more apples are inconsistent with the observed $s _ { 0 }$ and so are not considered. Following the inferred reward still leads to good apple harvesting behavior.
148
+
149
+ Desirable side effects: Batteries (Figure $2 c$ ). With the uniform prior, we see the same behavior as in Apple collection, where RLSP with a uniform prior learns a slightly smaller negative reward on the batteries, since it considers states $s _ { - T }$ where the battery was already gone. In addition, due to the particular setup the battery must have been given to the train two timesteps prior, which means that in any state where the train started with very little charge, it was allowed to die even though a battery could have been provided before, leading to a near-zero positive weight on the train losing charge. Despite this, RLSP successfully delivers the battery to the train in both easy and hard cases.
150
+
151
+ “Unseen” side effect: Room with far away vase (Figure 2e). With a uniform prior, we “see” the side effect: if Alice started at the purple door, then the shortest trajectory to the black door would break a vase. As a result, πRLSP successfully avoids the vase (whereas it previously did not). Here, uncertainty over the initial state $s _ { - T }$ can counterintuitively improve the results, because it increases the diversity of trajectories considered, which prevents RLSP from “overfitting” to the few trajectories consistent with a known $s _ { - T }$ and $s _ { 0 }$ .
152
+
153
+ Overall, RLSP is quite robust to the use of a uniform prior over $s _ { - T }$ , suggesting that we do not need to be particularly careful in the design of that prior.
154
+
155
+ # 5.4 ROBUSTNESS TO THE CHOICE OF ALICE’S PLANNING HORIZON
156
+
157
+ We investigate how RLSP performs when assuming the wrong value of Alice’s planning horizon $T$ . We vary the value of $T$ assumed by RLSP, and report the true return achieved by $\pi _ { \mathrm { R L S P } }$ obtained using the inferred reward and a fixed horizon for the robot to act. For this experiment, we used a uniform prior over $s _ { - T }$ , since with known $s _ { - T }$ , RLSP often detects that the given $s _ { - T }$ and $s _ { 0 }$ are incompatible (when $T$ is misspecified). The results are presented in Figure 3.
158
+
159
+ The performance worsens when RLSP assumes that Alice had a smaller planning horizon than she actually had. Intuitively, if we assume that Alice has only taken one or two actions ever, then even if we knew the actions they could have been in service of many goals, and so we end up quite uncertain about Alice’s reward.
160
+
161
+ When the assumed $T$ is larger than the true horizon, RLSP correctly infers things the robot should not do. Knowing that the vase was not broken for longer than $T$ timesteps is more evidence to suspect that Alice cared about not breaking the vase. However, overestimated $T$ leads to worse performance at inferring implicit preferences, as in the Apples environment. If we assume Alice has only collected two apples in 100 timesteps, she must not have cared about them much, since she could have collected many more. The batteries environment is unusual – assuming that Alice has been acting for 100 timesteps, the only explanation for the observed $s _ { 0 }$ is that Alice waited until the $9 8 \mathrm { t h }$ timestep to put the battery into the train. This is not particularly consistent with any reward function, and performance degrades.
162
+
163
+ ![](images/6b3a606294f2021c91c945d45ed1bd8c8aa90d0b1c89de72e8a4bf50375e9ceb.jpg)
164
+ Figure 3: Reward achieved by $\pi _ { \mathrm { R L S P } }$ , as a fraction of the expected reward of the optimal policy, for different values of Alice’s planning horizon $T$ .
165
+
166
+ Overall, $T$ is an important parameter and needs to be set appropriately. However, even when $T$ is misspecified, performance degrades gracefully to what would have happened if we optimized $\theta _ { \mathrm { s p e c } }$ by itself, so RLSP does not hurt. In addition, if $T$ is larger than it should be, then RLSP still tends to accurately infer parts of the reward that specify what not to do.
167
+
168
+ # 6 LIMITATIONS AND FUTURE WORK
169
+
170
+ Summary. Our key insight is that when a robot is deployed, the state that it observes has already been optimized to satisfy human preferences. This explains our preference for a policy that generally avoids side effects. We formalized this by assuming that Alice has been acting in the environment prior to the robot’s deployment. We developed an algorithm, RLSP, that computes a MAP estimate of Alice’s reward function. The robot then acts according to a tradeoff between Alice’s reward function and the specified reward function. Our evaluation showed that information from the initial state can be used to successfully infer side effects to avoid as well as tasks to complete, though there are cases in which we cannot infer the relevant preferences. While we believe this is an important step forward, there is still much work to be done to make this accurate and practical.
171
+
172
+ Realistic environments. The primary avenue for future work is to scale to realistic environments, where we cannot enumerate states, we don’t know dynamics, and the reward function may be nonlinear. This could be done by adapting existing IRL algorithms (Fu et al., 2017; Ho and Ermon, 2016; Finn et al., 2016). Unknown dynamics is particularly challenging, since we cannot learn dynamics from a single state observation. While acting in the environment, we would have to learn a dynamics model or an inverse dynamics model that can be used to simulate the past, and update the learned preferences as our model improves over time. Alternatively, if we use unsupervised skill learning (Achiam et al., 2018; Eysenbach et al., 2018; Nair et al., 2018) or exploration (Burda et al., 2018), or learn a goal-conditioned policy (Schaul et al., 2015; Andrychowicz et al., 2017), we could compare the explored states with the observed $s _ { 0 }$ .
173
+
174
+ Hyperparameter choice. While our evaluation showed that RLSP is reasonably robust to the choice of planning horizon $T$ and prior over $s _ { - T }$ , this may be specific to our gridworlds. In the real world, we often make long term hierarchical plans, and if we don’t observe the entire plan (corresponding to a choice of $\mathrm { T }$ that is too small) it seems possible that we infer bad rewards, especially if we have an uninformative prior over $s _ { - T }$ . We do not know whether this will be a problem, and if so how bad it will be, and hope to investigate it in future work with more realistic environments.
175
+
176
+ Conflicts between $\theta _ { \mathbf { s p e c } }$ and $\theta _ { \mathbf { A l i c e } }$ . RLSP allows us to infer $\theta _ { \mathrm { A l i c e } }$ from $s _ { 0 }$ , which we must somehow combine with $\theta _ { \mathrm { s p e c } }$ to produce a reward $\theta _ { \mathrm { f i n a l } }$ for the robot to optimize. $\theta _ { \mathrm { A l i c e } }$ will usually prefer the status quo of keeping the state similar to $s _ { 0 }$ , while $\theta _ { \mathrm { s p e c } }$ will probably incentivize some change to the state, leading to conflict. We traded off between the two by optimizing their sum, but future work could improve upon this. For example, $\theta _ { \mathrm { A l i c e } }$ could be decomposed into $\theta _ { \mathrm { A l i c e , t a s k } }$ , which says which task Alice is performing (“go to the black door”), and $\theta _ { \mathrm { f r a m e } }$ , which consists of the frame conditions (“don’t break vases”). The robot then optimizes $\theta _ { \mathrm { f r a m e } } + \lambda \theta _ { \mathrm { s p e c } }$ . This requires some way of performing the decomposition. We could model the human as pursuing multiple different subgoals, or the environment as being created by multiple humans with different goals. $\theta _ { \mathrm { f r a m e } }$ would be shared, while $\theta _ { \mathrm { t a s k } }$ would vary, allowing us to distinguish between them. However, combination may not be the answer – instead, perhaps the robot ought to use the inferred reward to inform Alice of any conflicts and actively query her for more information, along the lines of Amin et al. (2017).
177
+
178
+ Learning tasks to perform. The apples and batteries environments demonstrate that RLSP can learn preferences that require the robot to actively perform a task. It is not clear that this is desirable, since the robot may perform an inferred task instead of the task Alice explicitly sets for it.
179
+
180
+ Preferences that are not a result of human optimization. While the initial state is optimized for human preferences, this may not be a result of human optimization, as assumed in this paper. For example, we prefer that the atmosphere contain oxygen for us to breathe. The atmosphere meets this preference in spite of human action, and so RLSP would not infer this preference. While this is of limited relevance for household robots, it may become important for more capable AI systems.
181
+
182
+ # ACKNOWLEDGMENTS
183
+
184
+ We thank the researchers at the Center for Human Compatible AI for valuable feedback. This work was supported by the Open Philanthropy Project, AFOSR, and National Science Foundation Graduate Research Fellowship Grant No. DGE 1752814.
185
+
186
+ # REFERENCES
187
+
188
+ Joshua Achiam, Harrison Edwards, Dario Amodei, and Pieter Abbeel. Variational option discovery algorithms. arXiv preprint arXiv:1807.10299, 2018.
189
+
190
+ Kareem Amin, Nan Jiang, and Satinder Singh. Repeated inverse reinforcement learning. In Advances in Neural Information Processing Systems, pages 1815–1824, 2017.
191
+
192
+ Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mane.´ Concrete problems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
193
+
194
+ Oana Fabiana Andreescu. Static analysis of functional programs with an application to the frame problem in deductive verification. PhD thesis, Rennes 1, 2017.
195
+
196
+ Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, pages 5048–5058, 2017.
197
+
198
+ Stuart Armstrong and Benjamin Levinstein. Low impact artificial intelligences. arXiv preprint arXiv:1705.10720, 2017.
199
+
200
+ Dzmitry Bahdanau, Felix Hill, Jan Leike, Edward Hughes, Pushmeet Kohli, and Edward Grefenstette. Learning to understand goal specifications by modelling reward. arXiv preprint arXiv:1806.01946, 2018.
201
+
202
+ Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A Efros. Large-scale study of curiosity-driven learning. arXiv preprint arXiv:1808.04355, 2018.
203
+
204
+ Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, pages 4299–4307, 2017.
205
+
206
+ Christian Daniel, Malte Viering, Jan Metz, Oliver Kroemer, and Jan Peters. Active reward learning. In Robotics: Science and Systems, 2014.
207
+
208
+ Ashley D Edwards, Himanshu Sahni, Yannick Schroeker, and Charles L Isbell. Imitating latent policies from observation. arXiv preprint arXiv:1805.07914, 2018.
209
+
210
+ Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018.
211
+
212
+ Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, pages 49–58, 2016.
213
+
214
+ Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248, 2017.
215
+
216
+ Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, Stuart J Russell, and Anca Dragan. Inverse reward design. In Advances in Neural Information Processing Systems, pages 6765–6774, 2017.
217
+
218
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pages 4565–4573, 2016.
219
+
220
+ Leslie Pack Kaelbling. Learning to achieve goals. In IJCAI, pages 1094–1099. Citeseer, 1993.
221
+
222
+ Antti Kangasra¨asi ¨ o and Samuel Kaski. Inverse reinforcement learning from summary data. ¨ Machine Learning, 107(8-10):1517–1535, 2018.
223
+
224
+ W Bradley Knox and Peter Stone. Interactively shaping agents via human reinforcement: The tamer framework. In Proceedings of the fifth international conference on Knowledge capture, pages 9–16. ACM, 2009.
225
+
226
+ Victoria Krakovna, Laurent Orseau, Miljan Martic, and Shane Legg. Measuring and avoiding side effects using relative reachability. arXiv preprint arXiv:1806.01186, 2018.
227
+
228
+ James MacGlashan, Mark K Ho, Robert Loftin, Bei Peng, David Roberts, Matthew E Taylor, and Michael L Littman. Interactive learning from policy-dependent human feedback. arXiv preprint arXiv:1701.06049, 2017.
229
+
230
+ John McCarthy and Patrick J Hayes. Some philosophical problems from the standpoint of artificial intelligence. In Readings in artificial intelligence, pages 431–450. Elsevier, 1981.
231
+
232
+ Ashvin Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. arXiv preprint arXiv:1807.04742, 2018.
233
+
234
+ Deepak Ramachandran and Eyal Amir. Bayesian inverse reinforcement learning. Urbana, 51(61801): 1–4, 2007.
235
+
236
+ Dorsa Sadigh, Anca Dragan, Shankar Sastry, and Sanjit A Seshia. Active preference-based learning of reward functions. In Robotics: Science and Systems (RSS), 2017.
237
+
238
+ Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function approximators. In International Conference on Machine Learning, pages 1312–1320, 2015.
239
+
240
+ Alex Turner. Towards a new impact measure, 2018. https://www.alignmentforum.org/ posts/yEa7kwoMpsBgaBCgb/towards-a-new-impact-measure, Last accessed on 2018-09-26.
241
+
242
+ Garrett Warnell, Nicholas Waytowich, Vernon Lawhern, and Peter Stone. Deep tamer: Interactive agent shaping in high-dimensional state spaces. arXiv preprint arXiv:1709.10163, 2017.
243
+
244
+ Christian Wirth, Riad Akrour, Gerhard Neumann, and Johannes Furnkranz. A Survey of Preference- ¨ Based Reinforcement Learning Methods. Journal of Machine Learning Research, 18(136):1–46, 2017. ISSN 15337928. doi: 10.1109/CIS.2008.204. URL http://jmlr.org/papers/ v18/16-634.html.
245
+
246
+ Tianhe Yu, Chelsea Finn, Annie Xie, Sudeep Dasari, Tianhao Zhang, Pieter Abbeel, and Sergey Levine. One-shot imitation from observing humans via domain-adaptive meta-learning. arXiv preprint arXiv:1802.01557, 2018.
247
+
248
+ Brian D Ziebart, J Andrew Bagnell, and Anind K Dey. Modeling interaction via the principle of maximum causal entropy. 2010.
249
+
250
+ A
251
+
252
+ Here, we derive an exact gradient for the maximum causal entropy distribution introduced in Ziebart et al. (2010), as the existing approximation is insufficient for our purposes. Given a trajectory $\tau _ { T } = s _ { 0 } a _ { 0 } \ldots s _ { T } a _ { T }$ , we seek the gradient $\nabla _ { \boldsymbol { \theta } } \ln { p ( \tau _ { T } ) }$ . We assume that the expert has been acting according to the maximum causal entropy IRL model given in Section 3 (where we have dropped $\theta$ from the notation for clarity):
253
+
254
+ $$
255
+ \begin{array} { r l r } & { \displaystyle \pi _ { t } ( a \mid s ) = \exp ( Q _ { t } ( s , a ) - V _ { t } ( s ) ) , } & \\ & { \displaystyle V _ { t } ( s ) = \ln \sum _ { a } \exp ( Q _ { t } ( s , a ) ) } & { \qquad \mathrm { f o r ~ } 1 \leq t \leq T , } \\ & { \displaystyle Q _ { t } ( s , a ) = \theta ^ { T } f ( s ) + \sum _ { s ^ { \prime } } \mathcal { T } ( s ^ { \prime } \mid s , a ) V _ { t + 1 } ( s ^ { \prime } ) } & { \qquad \mathrm { f o r ~ } 1 \leq t \leq T , } \\ & { \displaystyle V _ { T + 1 } ( s ) = 0 . } & \end{array}
256
+ $$
257
+
258
+ In the following, unless otherwise specified, all expectations over states and actions use the probability distribution over trajectories from the above model, starting from the state and action just prior. For example, Es0T ,a0T [X (s0T , a0T )] = Ps0 ,a0 $\begin{array} { r } { \mathbb { E } _ { s _ { T } ^ { \prime } , a _ { T } ^ { \prime } } \left[ \bar { X } ( s _ { T } ^ { \prime } , a _ { T } ^ { \prime } ) \right] = \sum _ { s _ { T } ^ { \prime } , a _ { T } ^ { \prime } } \mathcal { T } ( s _ { T } ^ { \prime } \mid s _ { T - 1 } , a _ { T - 1 } ) \pi _ { T } ( a _ { T } ^ { \prime } \mid s _ { T } ^ { \prime } ) X ( s _ { T } ^ { \prime } , a _ { T } ^ { \prime } ) } \end{array}$ . In addition, for all probability distributions over states and actions, we drop the dependence on $\theta$ for readability, so the probability of reaching state $s _ { T }$ is written as $p ( { \boldsymbol { s } } _ { T } )$ instead of $p ( s _ { T } \mid \theta )$ .
259
+
260
+ First, we compute the gradient of $V _ { t } ( s )$ . We have $\nabla _ { \boldsymbol { \theta } } V _ { T + 1 } ( s ) = 0$ , and for $0 \leq t \leq T$
261
+
262
+ $$
263
+ \begin{array} { r l } & { \nabla _ { \theta } V _ { \lfloor \epsilon ( s ) \rfloor } } \\ & = \nabla _ { \theta } \log \Big [ \operatorname* { m i n } _ { \epsilon ^ { \prime } \in \mathcal { N } _ { \epsilon ^ { \prime } } ( \epsilon _ { s } , a _ { \epsilon } ^ { \prime } ) \big \} } \\ & { \quad \times _ { \epsilon ^ { \prime } } ^ { \epsilon ^ { \prime } } } \\ & { = \frac { 1 } { \exp { [ ( V _ { \epsilon } ( s _ { \epsilon } ) ) ] } } \sum _ { \epsilon ^ { \prime } \in \mathcal { N } ( \mathcal { G } _ { \epsilon } ( s _ { \epsilon } , a _ { \epsilon } ^ { \prime } ) ) \in \mathcal { G } _ { \epsilon } ( s _ { \epsilon } , a _ { \epsilon } ^ { \prime } ) } } \\ & { = \frac { 1 } { \exp { [ ( V _ { \epsilon } ( s _ { \epsilon } ) ) ] } } \sum _ { \epsilon ^ { \prime } \in \mathcal { N } ( \mathcal { G } _ { \epsilon } ( s _ { \epsilon } , a _ { \epsilon } ^ { \prime } ) ) \in \mathcal { V } _ { \epsilon } } \Big [ \theta ^ { T } \int ( s _ { \epsilon } ) + \mathbb { E } _ { s _ { \epsilon } ^ { \prime } ( s _ { \epsilon } ^ { \prime } ) \sim \mathcal { V } ( \epsilon ^ { \prime } \cup s , a _ { \epsilon } ^ { \prime } ) } \left[ V _ { \epsilon + 1 } ( s _ { \epsilon + 1 } ^ { \prime } ) \right] \Big ] } \\ & = \sum _ { \epsilon ^ { \prime } \in \mathcal { N } ( \mathcal { G } _ { \epsilon } ( s _ { \epsilon } , a _ { \epsilon } ^ { \prime } ) ) \sim \mathcal { V } _ { \epsilon } ( s _ { \epsilon } , a _ { \epsilon } ^ { \prime } ) \in \mathcal { F } _ { \epsilon } ( s _ { \epsilon } ) \sim \mathbb { V } _ { \epsilon } ( s _ { \epsilon + 1 } ^ { \prime } ) \sim \mathcal { V } ( \epsilon | a _ { \epsilon } , a _ { \epsilon } ^ { \prime } ) \left[ V _ { \epsilon } ( s _ { \epsilon + 1 } ^ { \prime } ) - V _ { \epsilon } ( s _ { \epsilon + 1 } ^ { \prime } ) \right] } \\ & = \sum _ \epsilon ^ { \prime } \in \mathcal { F } ( a _ { \epsilon } ^ { \prime } \mid s _ { \epsilon } ) \in \mathcal { F } _ { \epsilon } ( s _ { \epsilon } ^ { \prime } ) \sim \mathcal { V } _ { \epsilon } ( s _ { \epsilon } ^ { \prime } ) \sim \mathcal { V } _ \epsilon \end{array}
264
+ $$
265
+
266
+ Unrolling the recursion, we get that the gradient is the expected feature counts under the policy implied by $\theta$ from $s _ { t }$ onwards, which we could prove using induction. Define:
267
+
268
+ $$
269
+ \mathcal { F } _ { t } ( s _ { t } ) \equiv f ( s _ { t } ) + \mathbb { E } _ { a _ { t : T - 1 } ^ { \prime } , s _ { t + 1 : T } ^ { \prime } } \left[ \sum _ { t ^ { \prime } = t + 1 } ^ { T } f ( s _ { t ^ { \prime } } ^ { \prime } ) \right] .
270
+ $$
271
+
272
+ Then we have:
273
+
274
+ $$
275
+ \nabla _ { \boldsymbol { \theta } } V _ { t } ( s _ { t } ) = \mathcal { F } _ { t } ( s _ { t } ) .
276
+ $$
277
+
278
+ We can now calculate the gradient we actually care about:
279
+
280
+ $$
281
+ \begin{array} { l } { { \nabla _ { 0 } \ln p ( \hat { \rho } _ { T } ) } } \\ { { { } } } \\ { { \displaystyle = \nabla _ { \theta } \left[ \ln p ( s _ { 0 } ) + \sum _ { k = 0 } ^ { T } \ln \pi ( i \alpha _ { k } \mid s _ { k } ) + \sum _ { t = 0 } ^ { T - 1 } \ln \pi ( s _ { t + 1 } \mid s _ { k } , \alpha _ { k } ) \right] } } \\ { { { } } } \\ { { { } } } \\ { { { } = \displaystyle \sum _ { \ell = 0 } ^ { T } \nabla _ { \theta } \ln \pi _ { \ell } ( \alpha _ { \ell } \mid s _ { \ell } ) } } \\ { { { } } } \\ { { { } = \displaystyle \sum _ { \ell = 0 } ^ { T } \nabla _ { \theta } \left[ Q _ { \ell } ( s _ { \ell } , \alpha _ { \ell } ) - V _ { \ell } ( s _ { \ell } ) \right] } } \\ { { { } } } \\ { { { } = \displaystyle \sum _ { \ell = 0 } ^ { T } \nabla _ { \theta } \left[ \theta ^ { \ell } J ( s _ { \ell } ) + \mathbb { E } _ { s _ { \ell + 1 } } \left[ \mathbb { V } _ { \ell + 1 } ( s _ { \ell + 1 } ^ { \ell } ) \right] - V _ { \ell } ( s _ { \ell } ) \right] } } \\ { { { } } } \\ { { { } = \displaystyle \sum _ { \ell = 0 } ^ { T } \left( f ( s _ { \ell } ) + \mathbb { E } _ { s _ { \ell - 1 } } \left[ \nabla _ { \theta } V _ { \ell + 1 } ( s _ { \ell + 1 } ^ { \ell } ) \right] - \nabla _ { \theta } V _ { \ell } ( s _ { \ell } ) \right) . } } \end{array}
282
+ $$
283
+
284
+ only $\pi _ { t }$ depends on $\theta$
285
+
286
+ The last term of the summation is $f ( s _ { T } ) + \mathbb { E } _ { s _ { T + 1 } ^ { \prime } } \left[ \nabla _ { \theta } V _ { T + 1 } ( s _ { T + 1 } ^ { \prime } ) \right] - \nabla _ { \theta } V _ { T } ( s _ { T } )$ , which simplifies to $f ( s _ { T } ) + 0 - \mathcal { F } _ { T } ( s _ { T } ) = f ( s _ { T } ) - f ( s _ { T } ) = { \bar { 0 } }$ , so we can drop it. Thus, our gradient is:
287
+
288
+ $$
289
+ \nabla _ { \theta } \ln p ( \tau _ { T } ) = \sum _ { t = 0 } ^ { T - 1 } \left( f ( s _ { t } ) + \mathbb { E } _ { s _ { t + 1 } ^ { \prime } } \left[ \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ^ { \prime } ) \right] - \mathcal { F } _ { t } ( s _ { t } ) \right) .
290
+ $$
291
+
292
+ This is the gradient we will use in Appendix $\mathbf { B }$ , but a little more manipulation allows us to compare with the gradient in Ziebart et al. (2010). We reintroduce the terms that we cancelled above:
293
+
294
+ $$
295
+ \begin{array} { r l } & { = \left( \displaystyle \sum _ { t = 0 } ^ { T } f ( s _ { t } ) \right) + \left( \displaystyle \sum _ { t = 0 } ^ { T - 1 } \mathbb { E } _ { s _ { t + 1 } ^ { \prime } } \left[ \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ^ { \prime } ) \right] \right) - \left( \mathcal { F } _ { 0 } ( s _ { 0 } ) + \displaystyle \sum _ { t = 0 } ^ { T - 1 } \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ) \right) } \\ & { = \left( \displaystyle \sum _ { t = 0 } ^ { T } f ( s _ { t } ) \right) - \mathcal { F } _ { 0 } ( s _ { 0 } ) + \displaystyle \sum _ { t = 0 } ^ { T - 1 } \left( \mathbb { E } _ { s _ { t + 1 } ^ { \prime } } \left[ \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ^ { \prime } ) \right] - \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ) \right) . } \end{array}
296
+ $$
297
+
298
+ Ziebart et al. (2010) states that the gradient is given by the expert policy feature expectations minus the learned policy feature expectations, and in practice uses the feature expectations from demonstrations to approximate the expert policy feature expectations. Assuming we have $N$ trajectories $\{ \tau _ { i } \}$ , the gradient would be $\begin{array} { r } { \Big ( \frac { 1 } { N } \sum _ { i } \sum _ { t = 0 } ^ { T } f ( s _ { t , i } ) \Big ) - \mathbb { E } _ { s _ { 0 } } \left[ \mathscr { F } _ { 0 } ( s _ { 0 } ) \right] } \end{array}$ . The first term matches our first term exactly. Our second term matches the second term in the limit of sufficiently many trajectories, so that the starting states $s _ { 0 }$ follow the distribution $p ( s _ { 0 } )$ . Our third term converges to zero with sufficiently many trajectories, since any $s _ { t } , a _ { t }$ pair in a demonstration will be present sufficiently often that the empirical counts of $s _ { t + 1 }$ will match the expected proportions prescribed by $\mathcal { T } ( \cdot \mid s _ { t } , \mathbf { \bar { \alpha } } { a } _ { t } )$ .
299
+
300
+ In a deterministic environment, we have $\begin{array} { r } { \mathcal { T } ( s _ { t + 1 } ^ { \prime } \mid s _ { t } , a _ { t } ) = 1 [ s _ { t + 1 } ^ { \prime } = s _ { t + 1 } ] } \end{array}$ since only one transition is possible. Thus, the third term is zero and even for one trajectory the gradient reduces to $\begin{array} { r l } { { ( \sum _ { t = 0 } ^ { T } f ( s _ { t } ) ) - \mathcal { F } _ { 0 } ( s _ { 0 } ) } } & { { } } \end{array}$ . This differs from the gradient in Ziebart et al. (2010) only in that it computes feature expectations from the observed starting state $s _ { 0 }$ instead of the MDP distribution over initial states $p ( s _ { 0 } )$ .
301
+
302
+ In a stochastic environment, the third term need not be zero, and corrects for the “bias” in the observed states $s _ { t + 1 }$ . Intuitively, when the expert chose action $a _ { t }$ , she did not know which next state $s _ { t + 1 } ^ { \prime }$ would arise, but the first term of our gradient upweights the particular next state $s _ { t + 1 }$ that we observed. The third term downweights the future value of the observed state and upweights the future value of all other states, all in proportion to their prior probability $\mathcal { T } ( s _ { t + 1 } ^ { \prime } \mid s _ { t } , \bar { a _ { t } } )$ .
303
+
304
+ # B
305
+
306
+ This section provides a derivation of the gradient $\nabla _ { \theta } \ln p ( s _ { 0 } )$ , which is needed to solve argmax ${ } _ { \theta } \ln p ( s _ { 0 } )$ with gradient ascent. We provide the results first as a quick reference:
307
+
308
+ $$
309
+ \begin{array} { r l } & { \nabla _ { \theta } \ln p ( s _ { 0 } ) = \displaystyle \frac { G _ { 0 } ( s _ { 0 } ) } { p ( s _ { 0 } ) } , } \\ & { \qquad p ( s _ { t + 1 } ) = \displaystyle \sum _ { s _ { t } , a _ { t } } p ( s _ { t } ) \pi _ { t } ( a _ { t } \mid s _ { t } ) { \mathcal { T } } ( s _ { t + 1 } \mid s _ { t } , a _ { t } ) , } \\ & { G _ { t + 1 } ( s _ { t + 1 } ) = \displaystyle \sum _ { s _ { t } , a _ { t } } { \mathcal { T } } ( s _ { t + 1 } \mid s _ { t } , a _ { t } ) \pi _ { t } ( a _ { t } \mid s _ { t } ) \bigg ( p ( s _ { t } ) g ( s _ { t } , a _ { t } ) + G _ { t } ( s _ { t } ) \bigg ) , } \\ & { \qquad g ( s _ { t } , a _ { t } ) = f ( s _ { t } ) + \mathbb { E } _ { s _ { t + 1 } ^ { \prime } } \left[ { \mathcal { F } } _ { t + 1 } ( s _ { t + 1 } ^ { \prime } ) \right] - { \mathcal { F } } _ { t } ( s _ { t } ) , } \\ & { { \mathcal { F } } _ { t - 1 } ( s _ { t - 1 } ) = f ( s _ { t - 1 } ) + \displaystyle \sum _ { a _ { t - 1 } ^ { \prime } , s _ { t } ^ { \prime } } { \pi } _ { t - 1 } ( a _ { t - 1 } ^ { \prime } \mid s _ { t - 1 } ) { \mathcal { T } } ( s _ { t } ^ { \prime } \mid s _ { t - 1 } , a _ { t - 1 } ^ { \prime } ) { \mathcal { F } } _ { t } ( s _ { t } ) . } \end{array}
310
+ $$
311
+
312
+ Base cases: first, $p ( s _ { - T } )$ is given, second, $G _ { - T } ( s _ { - T } ) = 0$ , and third, $\mathcal { F } _ { 0 } ( s _ { 0 } ) = f ( s _ { 0 } )$ .
313
+
314
+ For the derivation, we start by expressing the gradient in terms of gradients of trajectories, so that we can use the result from Appendix A. Note that, by inspecting the final form of the gradient in Appendix A, we can see that $\nabla _ { \theta } p \big ( \tau _ { - T : 0 } \big )$ is independent of $a _ { 0 }$ . Then, we have:
315
+
316
+ $$
317
+ \begin{array} { r l } & { \nabla _ { \theta } \ln p ( s _ { 0 } ) = \displaystyle \frac { 1 } { p ( s _ { 0 } ) } \nabla _ { \theta } p ( s _ { 0 } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \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}
318
+ $$
319
+
320
+ This has a nice interpretation – compute the gradient for each trajectory and take the weighted sum, where each weight is the probability of the trajectory given the evidence $s _ { 0 }$ and current reward $\theta$ .
321
+
322
+ We can rewrite the gradient in Equation 6 as $\begin{array} { r } { \nabla _ { \theta } \ln p ( \tau _ { T } ) = \sum _ { t = 0 } ^ { T - 1 } g ( s _ { t } , a _ { t } ) } \end{array}$ , where
323
+
324
+ $$
325
+ \begin{array} { r } { g ( s _ { t } , a _ { t } ) \equiv f ( s _ { t } ) + \mathbb { E } _ { s _ { t + 1 } ^ { \prime } } \left[ \mathcal { F } _ { t + 1 } ( s _ { t + 1 } ^ { \prime } ) \right] - \mathcal { F } _ { t } ( s _ { t } ) . } \end{array}
326
+ $$
327
+
328
+ We can now substitute this to get:
329
+
330
+ $$
331
+ \begin{array} { l } { \displaystyle \nabla _ { \theta } \ln p ( s _ { 0 } ) = \sum _ { s - { T } : - 1 , a - { T } : - 1 } p ( \tau _ { - T : - 1 } \mid s _ { 0 } ) \left( \sum _ { t = - { T } } ^ { - 1 } g ( s _ { t } , a _ { t } ) \right) } \\ { = \displaystyle \frac { 1 } { p ( s _ { 0 } ) } \sum _ { s - { T } : - 1 , a - { T } : - 1 } \left[ p ( \tau _ { - T : - 1 } , s _ { 0 } ) \sum _ { t = - { T } } ^ { - 1 } g ( s _ { t } , a _ { t } ) \right] } \\ { = \displaystyle \frac { 1 } { p ( s _ { 0 } ) } \sum _ { s - { T } : - 1 , a - { T } : - 1 } \left[ p ( \tau _ { - T : - 1 } , s _ { 0 } ) \sum _ { t = - { T } } ^ { - 1 } g ( s _ { t } , a _ { t } ) \right] . } \end{array}
332
+ $$
333
+
334
+ Note that we can compute $p ( s _ { t } )$ since we are given the distribution $p ( s _ { - T } )$ and we can use the recursive rule $\begin{array} { r } { p ( s _ { t + 1 } ) = \sum _ { s _ { t } , a _ { t } } p ( s _ { t } ) \pi _ { t } ( a _ { t } \mid s _ { t } ) \mathcal { T } ( s _ { t + 1 } \mid s _ { t } , a _ { t } ) } \end{array}$ .
335
+
336
+ In order to compute $g ( s _ { t } , a _ { t } )$ we need to compute $\mathcal { F } _ { t } ( s _ { t } )$ , which has base case $\mathcal { F } _ { 0 } ( s _ { 0 } ) = f ( s _ { 0 } )$ and recursive rule:
337
+
338
+ $$
339
+ \begin{array} { r l } & { \mathcal { F } _ { t - 1 } \big ( s _ { t - 1 } \big ) } \\ & { = f ( s _ { t - 1 } ) + \mathbb { E } _ { a _ { t - 1 : 1 } ^ { \prime } , s _ { t } ^ { \prime } , 0 } \left[ \underset { t ^ { \prime } = t } { \overset { 0 } { \sum } } f \big ( s _ { t ^ { \prime } } ^ { \prime } \big ) \right] } \\ & { = f ( s _ { t - 1 } ) + \underset { a _ { t - 1 } ^ { \prime } , s _ { t } ^ { \prime } } { \sum } \pi _ { t - 1 } \big ( a _ { t - 1 } ^ { \prime } \mid s _ { t - 1 } \big ) \mathcal { T } \big ( s _ { t } ^ { \prime } \mid s _ { t - 1 } , a _ { t - 1 } ^ { \prime } \big ) \left[ f \big ( s _ { t } ^ { \prime } \big ) + \mathbb { E } _ { a _ { t - 1 } ^ { \prime } , s _ { t + 1 : 0 } ^ { \prime } } \left[ \underset { t ^ { \prime } = t + 1 } { \overset { 0 } { \sum } } f \big ( s _ { t ^ { \prime } } ^ { \prime } \big ) \right] \right] } \\ & { = f ( s _ { t - 1 } ) + \underset { a _ { t - 1 } ^ { \prime } , s _ { t } ^ { \prime } } { \sum } \pi _ { t - 1 } \big ( a _ { t - 1 } ^ { \prime } \mid s _ { t - 1 } \big ) \mathcal { T } \big ( s _ { t } ^ { \prime } \mid s _ { t - 1 } , a _ { t - 1 } ^ { \prime } \big ) \mathcal { F } _ { t } \big ( s _ { t } \big ) . } \end{array}
340
+ $$
341
+
342
+ For the remaining part of the gradient, define $G _ { t }$ such that $\begin{array} { r } { \nabla _ { \theta } \ln { p ( s _ { 0 } ) } = \frac { G _ { 0 } ( s _ { 0 } ) } { p ( s _ { 0 } ) } } \end{array}$ :
343
+
344
+ $$
345
+ G _ { t } ( s _ { t } ) \equiv \sum _ { s _ { - T : t - 1 } , a _ { - T : t - 1 } } \left[ p ( \tau _ { - T : t - 1 } , s _ { t } ) \sum _ { t ^ { \prime } = - T } ^ { t - 1 } g ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ) \right] .
346
+ $$
347
+
348
+ We now derive a recursive relation for $G$ :
349
+
350
+ $$
351
+ \begin{array} { r l } & { \mathcal { G } _ { + + } [ s _ { + + } ] } \\ & { = \displaystyle \sum _ { s = - \infty } \Bigg [ p ( \sigma _ { - 2 : s } , s _ { + + } ) \sum _ { \psi = - \infty } ^ { s } g ( s _ { \psi } , \sigma _ { \psi } ) } \\ & { \quad - \sum _ { s = \infty } ^ { s } \gamma _ { s } \left[ \mathcal { F } _ { - \mathcal { R } _ { + + } } ^ { \prime } , s _ { + + } ) \sum _ { \psi = - \infty } ^ { s } ( s _ { \psi } , \sigma _ { \psi } ) g ( s _ { \psi } , \sigma _ { \psi } ) \right] } \\ & { = \displaystyle \sum _ { s \neq \infty } \sum _ { s \neq \infty } \sum _ { s = - \infty + \infty - 1 } \mathcal { F } _ { \left( s _ { \psi + + + } \right. } [ s _ { s _ { \psi } , \sigma _ { \psi } } ] s _ { \psi } [ \sigma _ { \psi } , | s _ { \psi } | ) ( \sigma _ { \psi } - \mathbb { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal { R } _ { - \mathcal } { R _ - \mathcal { R } _ { - \mathcal } { R _ } } } } } } } } } } } ) } \Bigg ( g ( s _ { \psi } , u _ { s } , u _ { s + + } ) + \displaystyle \sum _ { s = - \infty } ^ { - 1 } g ( s _ { \psi } , \pi _ { \psi } ) \\ & { = \displaystyle \sum _ { s = \infty } \Bigg [ \mathcal { T } _ { \left( s _ { + + } \right. } [ s _ { + } , \sigma _ { s } ] ) \pi _ { \mathfrak { c } _ { \psi } } ( \sigma _ { \psi } ) \left( s _ { \psi } \right) \left( \displaystyle \sum _ { s = - \infty + \infty - \infty + \infty } p ( \sigma _ { - 2 : s _ { - } \{ s _ { - } \} , s _ { \psi } } ) \right) g ( s _ { \psi } , \sigma _ { \psi } ) \Bigg ] } \\ & \quad + \displaystyle \sum _ { s = \infty } \Bigg [ \mathcal { T } _ { \left( s _ { + } \right. } [ s _ { + } , \sigma _ { s } ] ) \pi _ { \mathfrak { c } _ { \psi } } ( \sigma _ { \psi } ) \underset { s = \pm \infty } { \sum _ { s = - \infty } ^ { s } } \ \end{array}
352
+ $$
353
+
354
+ For the base case, note that
355
+
356
+ $$
357
+ \begin{array} { l } { \tilde { \mathfrak { r } } _ { - T + 1 } \big ( \mathfrak { s } _ { - T + 1 } \big ) = \displaystyle \sum _ { \substack { s _ { - T } , a _ { - T } } } \left[ p \big ( \mathfrak { s } _ { - T } , a _ { - T } , \mathfrak { s } _ { - T + 1 } \big ) g \big ( \mathfrak { s } _ { - T } , a _ { - T } , \mathfrak { s } _ { - T + 1 } \big ) \right] } \\ { = \displaystyle \sum _ { \substack { s _ { - T } , a _ { - T } } } \mathcal { T } \big ( \mathfrak { s } _ { - T + 1 } \mid \mathfrak { s } _ { - T } , a _ { - T } \big ) \pi _ { - T } \big ( a _ { - T } \mid \mathfrak { s } _ { - T } \big ) \bigg ( p \big ( \mathfrak { s } _ { - T } \big ) g \big ( \mathfrak { s } _ { - T } , a _ { - T } , \mathfrak { s } _ { - T + 1 } \big ) \bigg ) . } \end{array}
358
+ $$
359
+
360
+ Comparing this to the recursive rule, for the base case we can set $G _ { - T } ( s _ { - T } ) = 0$ .
361
+
362
+ # C
363
+
364
+ Instead of estimating the MLE (or MAP if we have a prior) using RLSP, we could approximate the entire posterior distribution. One standard way to address the computational challenges involved with the continuous and high-dimensional nature of $\theta$ is to use MCMC sampling to sample from $p ( \theta \mid s _ { 0 } ) \propto p ( s _ { 0 } \mid \theta ) p ( \theta )$ . The resulting algorithm resembles Bayesian IRL (Ramachandran and Amir, 2007) and is presented in Algorithm 1.
365
+
366
+ While this algorithm is less efficient and noisier than RLSP, it gives us an estimate of the full posterior distribution. In our experiments, we collapsed the full distribution into a point estimate by taking the mean. Initial experiments showed that the algorithm was slower and noisier than the gradientbased RLSP, so we did not test it further. However, in future work we could better leverage the full distribution, for example to create risk-averse policies, to identify features that are uncertain, or to identify features that are certain but conflict with the specified reward, after which we could actively query Alice for more information.
367
+
368
+ # Algorithm 1 MCMC sampling from the one state IRL posterior
369
+
370
+ Require: MDP $\mathcal { M }$ , prior $p ( \theta )$ , step size $\delta$
371
+ 1: $\theta \gets$ random sample $( p ( \theta ) )$
372
+ 2: $\pi , V = \operatorname { s o f t }$ value iteration $( \mathcal { M } , \theta )$
373
+ 3: $p \gets p ( s _ { 0 } \mid \theta ) p ( \theta )$
374
+ 4: repeat
375
+ 5: $\theta ^ { \prime } \gets$ random sample $\left( \mathcal { N } ( \theta , \delta ) \right)$
376
+ 6: π0, V 0 = soft value iteration $( { \mathcal { M } } , \theta ^ { \prime } )$ . The value function is initialized with $V$ .
377
+ 7: $p ^ { \prime } \gets p ( s _ { 0 } \mid \theta ^ { \prime } ) p ( \theta ^ { \prime } )$
378
+ 8: if random sample $( { \mathrm { U n i f } } ( 0 , 1 ) ) \leq \operatorname* { m i n } ( 1 , \frac { p ^ { \prime } } { p } )$ then
379
+ 9: $\theta \theta ^ { \prime } ; \ V V ^ { \prime }$
380
+ 10: end if
381
+ 11: append $\theta$ to the list of samples
382
+ 12: until have generated the desired number of samples
383
+
384
+ ![](images/c7573fdcd26b33dcaa2892a029cc2bd0e7b6ea73a9d5666d72622d443f5d6366.jpg)
385
+ Figure 4: Comparison of the Additive and Bayesian methods. We show how the percentage of true reward obtained by $\pi _ { \mathrm { R L S P } }$ varies as we change the tradeoff between $\theta _ { \mathrm { A l i c e } }$ and $\theta _ { \mathrm { s p e c } }$ . The zero temperature case corresponds to traditional value iteration; this often leads to identical behavior and so the lines overlap. So, we also show the results when planning with soft value iteration, varying the softmax temperature, to introduce some noise into the policy. Overall, there is not much difference between the two methods. We did not include the Apples environment because $\theta _ { \mathrm { s p e c } }$ is uniformly zero and the Additive and Bayesian methods do exactly the same thing.
386
+
387
+ # D COMBINING THE SPECIFIED REWARD WITH THE INFERRED REWARD
388
+
389
+ In Section 5, we evaluated RLSP by combining the reward it infers with a specified reward to get a final reward $\theta _ { \mathrm { f i n a l } } = \theta _ { \mathrm { A l i c e } } + \lambda \theta _ { \mathrm { s p e c } }$ . As discussed in Section 6, the problem of combining $\theta _ { \mathrm { A l i c e } }$ and $\theta _ { \mathrm { s p e c } }$ is difficult, since the two rewards incentivize different behaviors and will conflict. The Additive method above is a simple way of trading off between the two.
390
+
391
+ Both RLSP and the sampling algorithm of Appendix C can incorporate a prior over $\theta$ . Another way to combine the two rewards is to condition the prior on $\theta _ { \mathrm { s p e c } }$ before running the algorithms. In particular, we could replace our prior $P ( \theta _ { \mathrm { A l i c e } } )$ with a new prior $P ( \theta _ { \mathrm { A l i c e } } \mid \theta _ { \mathrm { s p e c } } )$ , such as a Gaussian distribution centered at $\theta _ { \mathrm { s p e c } }$ . When we use this prior, the reward returned by RLSP can be used as the final reward $\theta _ { \mathrm { f i n a l } }$ .
392
+
393
+ It might seem like this is a principled Bayesian method that allows us to combine the two rewards. However, the conflict between the two reward functions still exists. In this formulation, it arises in the new prior $P ( \theta _ { \mathrm { A l i c e } } \mid \theta _ { \mathrm { s p e c } } )$ . Modeling this as a Gaussian centered at $\theta _ { \mathrm { s p e c } }$ suggests that before knowing $s _ { 0 }$ , it seems likely that $\theta _ { \mathrm { A l i c e } }$ is very similar to $\theta _ { \mathrm { s p e c } }$ . However, this is not true – Alice is probably providing the reward $\theta _ { \mathrm { s p e c } }$ to the robot so that it causes some change to the state that she has optimized, and so it will be predictably different from $\theta _ { \mathrm { s p e c } }$ . On the other hand, we do need to put high probability on $\theta _ { \mathrm { s p e c } }$ , since otherwise $\theta _ { \mathrm { f i n a l } }$ will not incentivize any of the behaviors that $\theta _ { \mathrm { s p e c } }$ did.
394
+
395
+ Nonetheless, this is another simple heuristic for how we might combine the two rewards, that manages the tradeoff between $\theta _ { \mathrm { s p e c } }$ and $\theta _ { \mathrm { A l i c e } }$ . We compared the Additive and Bayesian methods by evaluating their robustness. We vary the parameter that controls the tradeoff and report the true reward obtained by $\pi _ { \mathrm { R L S P } }$ , as a fraction of the expected true reward under the optimal policy. For the Bayesian method, we vary the standard deviation $\sigma$ of the Gaussian prior over $\theta _ { \mathrm { A l i c e } }$ that is centered at $\theta _ { \mathrm { s p e c } }$ . For the Additive method, the natural choice would be to vary $\lambda$ ; however, in order to make the results more comparable, we instead set $\lambda = 1$ and vary the standard deviation of the Gaussian prior used while inferring $\theta _ { \mathrm { A l i c e } }$ , which is centered at zero instead of at $\theta _ { \mathrm { s p e c } }$ . A larger standard deviation allows $\theta _ { \mathrm { A l i c e } }$ to become larger in magnitude (since it is penalized less for deviating from the mean of zero reward), which effectively corresponds to a smaller $\lambda$ .
396
+
397
+ While we typically create $\pi _ { \mathrm { R L S P } }$ using value iteration, this leads to deterministic policies with very sharp changes in behavior that make it hard to see differences between methods, and so we also show results with soft value iteration, which creates stochastic policies that vary more continuously. As demonstrated in Figure 4, our experiments show that overall the two methods perform very similarly, with some evidence that the Additive method is slightly more robust. The Additive method also has the benefit that it can be applied in situations where the inferred reward and specified reward are over different feature spaces, by creating the final reward $R _ { \mathrm { f i n a l } } ( s ) = { \theta _ { \mathrm { A l i c e } } } ^ { T } f _ { \mathrm { A l i c e } } ( s ) + \lambda R _ { \mathrm { s p e c } } ( s )$ .
md/train/rkjZ2Pcxe/rkjZ2Pcxe.md ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADDING GRADIENT NOISE IMPROVES LEARNING FOR VERY DEEP NETWORKS
2
+
3
+ Arvind Neelakantan∗ †, Luke Vilnis∗ † College of Information and Computer Sciences University of Massachusetts Amherst {arvind,luke}@cs.umass.edu
4
+
5
+ Quoc V. Le, Lukasz Kaiser, Karol Kurach Google Brain {qvl,lukaszkaiser,kkurach}@google.com
6
+
7
+ Ilya Sutskever†
8
+ OpenAI
9
+ {ilyasu}@openai.com
10
+ James Martens
11
+ University of Toronto
12
+ {jmartens}@cs.toronto.edu
13
+
14
+ # ABSTRACT
15
+
16
+ Deep feedforward and recurrent networks have achieved impressive results in many perception and language processing applications. Recently, more complex architectures such as Neural Turing Machines and Memory Networks have been proposed for tasks including question answering and general computation, creating a new set of optimization challenges. In this paper, we explore the lowoverhead and easy-to-implement optimization technique of adding annealed Gaussian noise to the gradient, which we find surprisingly effective when training these very deep architectures. Unlike classical weight noise, gradient noise injection is complementary to advanced stochastic optimization algorithms such as Adam and AdaGrad. The technique not only helps to avoid overfitting, but also can result in lower training loss. We see consistent improvements in performance across an array of complex models, including state-of-the-art deep networks for question answering and algorithm learning. We observe that this optimization strategy allows a fully-connected 20-layer deep network to escape a bad initialization with standard stochastic gradient descent. We encourage further application of this technique to additional modern neural architectures.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ Deep neural networks have shown remarkable success in diverse domains including image recognition (Krizhevsky et al., 2012), speech recognition (Hinton et al., 2012) and language processing applications (Sutskever et al., 2014; Bahdanau et al., 2014). This broad success comes from a confluence of several factors. First, the creation of massive labeled datasets has allowed deep networks to demonstrate their advantages in expressiveness and scalability. The increase in computing power has also enabled training of far larger networks with more forgiving optimization dynamics (Choromanska et al., 2015). Additionally, architectures such as convolutional networks (LeCun et al., 1998) and long short-term memory networks (Hochreiter & Schmidhuber, 1997) have proven to be easier to optimize than classical feedforward and recurrent models. Finally, the success of deep networks is also a result of the development of simple and broadly applicable learning techniques such as dropout (Srivastava et al., 2014), ReLUs (Nair & Hinton, 2010), gradient clipping (Pascanu et al., 2013; Graves, 2013), optimization algorithms and weight initialization strategies (Glorot & Bengio, 2010; Sutskever et al., 2013; He et al., 2015).
21
+
22
+ Recent work has aimed to push neural network learning into more challenging domains, such as question answering or program induction. These more complicated problems demand more complicated architectures (e.g. Graves et al. (2014); Sukhbaatar et al. (2015)), thereby posing new optimization challenges. While there is very active research in improving learning in deep feedforward and recurrent networks, such as layer-wise deep supervision (Lee et al., 2015), novel activation functions (Maas et al., 2013), initialization schemes (He et al., 2015), and cell architectures (Cho et al., 2014a; Yao et al., 2015), these are not always sufficient or applicable in networks with complex structure over the latent variables. In order to achieve good performance, researchers have reported the necessity of additional techniques such as explicit labeling of latent variables (Weston et al., 2014), relaxing weight-tying constraints (Kaiser & Sutskever, 2016), warmstarts (Peng et al., 2015), random restarts, and the removal of certain activation functions in early stages of training (Sukhbaatar et al., 2015).
23
+
24
+ The recurring theme is that commonly-used optimization techniques are not always sufficient to robustly optimize the models of interest. In this work, we explore a simple technique of adding annealed Gaussian noise to the gradient, which we find to be surprisingly effective in training deep neural networks with stochastic gradient descent. While there is a long tradition of adding random weight noise in neural networks, it has been under-explored in the optimization of modern deep architectures. Furthermore, although weight and gradient noise are equivalent when using standard SGD updates, the use of adaptive and momentum based stochastic optimizers such as Adam and AdaGrad (Duchi et al., 2011; Kingma & Ba, 2014) breaks this equivalence, allowing the noise to effectively adapt to the curvature of the optimization landscape. We find this property to be important when optimizing the most complex models.
25
+
26
+ While there exist theoretical and empirical results on the regularizing effects of conventional stochastic gradient descent, especially for the minimization of convex losses (Bousquet & Bottou, 2008), we find that in practice the added noise can actually help us achieve lower training loss by encouraging active exploration of parameter space. This exploration proves especially necessary and fruitful when optimizing neural network models containing many layers or complex latent structures. For neural network learning, it has long been known that the noise in the stochastic gradient can help to escape saddle points and local optima (Bottou, 1992). For this reason, neural network practitioners sometimes avoid overly-large mini-batch sizes to achieve the best results. We find that the Gaussian noise added in our technique is complementary to the noisy stochastic gradient, and a combination of Gaussian noise and tuned mini-batch sizes is necessary for the most complex models.
27
+
28
+ The main contribution of this work is to demonstrate the broad applicability of this simple method to the training of many complex modern neural architectures. To our knowledge, neither the exponentially decayed noise schedule nor the black box combination of injected gradient noise with adaptive optimizers have been used before in the training of deep networks. We consistently see improvements from Gaussian gradient noise when optimizing a wide variety of models, including very deep fully-connected networks, and special-purpose architectures for question answering and algorithm learning. For example, this method allows us to escape a poor initialization and successfully train a 20-layer rectifier network on MNIST with standard gradient descent. It also enables a $72 \%$ relative reduction in error in question answering, and doubles the number of accurate binary multiplication models learned across 7,000 random restarts. Gradient noise also possesses attractive robustness properties. We examine only two distinct settings of the noise variance hyperparameter in total across all experiments. We additionally observe that in cases where gradient noise fails to improve over other learning techniques, it rarely significantly hurts a models ability to generalize.
29
+
30
+ We hope that practitioners will see similar improvements in their own research by adding this simple technique, implementable in a single line of code, to their repertoire.
31
+
32
+ # 2 RELATED WORK
33
+
34
+ Adding random noise to the weights, inputs, or hidden units has been a known technique amongst neural network practitioners for many years (e.g. Murray & Edwards; An (1996)). However, the benefits of gradient noise have not been fully explored with modern deep networks nor combined with advanced stochastic optimization techniques, which allow the noise to take into account the geometry of the optimization problem and the statistical manifold.
35
+
36
+ Weight noise (Steijvers, 1996) and adaptive weight noise (Graves, 2011; Blundell et al., 2015), which usually maintains a Gaussian variational posterior over network weights, similarly aim to improve learning by added noise during training. In adaptive weight noise, an extra set of parameters for the variance must be maintained. This adaptation is different than our use of an adaptive optimizer, as it aims to capture an accurate estimate of uncertainty in the weights and not guide the exploration of parameter space. They differ from our proposed method in that the noise is not annealed and at convergence will be non-zero.
37
+
38
+ Similarly, the technique of dropout (Srivastava et al., 2014) randomly sets groups of hidden units to zero at train time to improve generalization in a manner similar to ensembling.
39
+
40
+ An annealed Gaussian gradient noise schedule was used to train the highly non-convex Stochastic Neighbor Embedding model in Hinton & Roweis (2002). The gradient noise schedule that we found to be most effective is very similar to the Stochastic Gradient Langevin Dynamics (SGLD) algorithm of Welling & Teh (2011), who use gradients with added noise to accelerate MCMC inference for logistic regression and independent component analysis models. This use of gradient information in MCMC sampling for machine learning to allow faster exploration of state space was previously proposed by Neal (2011). However, standard SGLD analysis does not allow for the use of adaptive optimizers or momentum, limiting the efficiency for very pathological optimization landscapes. Stochastic Gradient Riemannian Langevin Dynamics (Patterson & Teh, 2013) adapts the gradient and noise using the Fisher information matrix, effectively following trajectories along the same manifold as the natural gradient (Amari, 1998), but is applied only to models for which that matrix is tractable to estimate in closed form.
41
+
42
+ Various optimization techniques have been proposed to improve the training of neural networks. Most notable is the use of momentum (Polyak, 1964; Sutskever et al., 2013; Kingma & Ba, 2014) or adaptive learning rates (Duchi et al., 2011; Dean et al., 2012; Zeiler, 2012). These methods are normally developed to provide good convergence rates for the convex setting, and then heuristically applied to nonconvex problems. Similarly, batch normalization and related methods (Ioffe & Szegedy, 2015; Arpit et al., 2016; Salimans & Kingma, 2016), natural gradient descent (Amari, 1998; Desjardins et al., 2015), and K-FAC (Martens & Grosse, 2015) can all be seen as various preconditioning methods using approximations to the inverse Fisher information of the neural network. While there has been some difficulty in combining batch normalization-type algorithms with recurrent networks (Laurent et al., 2015), recent work has had success in this area (Cooijmans et al., 2016; Ba et al., 2016).
43
+
44
+ Injecting noise in the gradient can be combined with any of the above methods, and can be seen as a complementary technique especially suitable for nonconvex problems. By adding additional artificial stochasticity to the gradient, this technique allows the model more chances to escape local minima or saddle-points (see a similar argument in Bottou (1992)), or to traverse quickly through the “transient” plateau phase of early learning (see a similar analysis for momentum in Sutskever et al. (2013)). This is born out empirically in our observation that adding gradient noise can actually result in lower training loss. In this sense, we suspect adding gradient noise is similar to simulated annealing (Kirkpatrick et al., 1983) which exploits random noise to explore complex optimization landscapes. This can be contrasted with well-known benefits of stochastic gradient descent as a learning algorithm (Robbins & Monro, 1951; Bousquet & Bottou, 2008), where both theory and practice have shown that the noise induced by the stochastic process aids generalization by reducing overfitting.
45
+
46
+ Recently, there has been a surge in research examining the use of gradient and weight noise when training deep neural networks. Mobahi (2016) present an optimization technique for recurrent networks that applies an annealed Gaussian kernel smoothing method to the loss function, of which annealed weight noise is a Monte Carlo estimator. Li et al. (2016) present a version of SGLD that incorporates both Gaussian noise and adaptively estimated learning rates (but no momentum term). Though significantly more complex than our proposed method, the most similar work is the Santa algorithm of Chen et al. (2016). Santa combines SGLD with adaptive learning rates and adaptive per-coordinate momentum parameters, and shows that the scheme can approach global optima of the objective function under certain assumptions.
47
+
48
+ # 3 METHOD
49
+
50
+ We consider a simple technique of adding time-dependent Gaussian noise to the gradient $g$ at every training step $t$ :
51
+
52
+ $$
53
+ g _ { t } \gets g _ { t } + N ( 0 , \sigma _ { t } ^ { 2 } )
54
+ $$
55
+
56
+ The gradient $g _ { t }$ is then used to update the weights $\theta _ { t }$ as if it were the original gradient of the loss function, and can be used with any stochastic optimization algorithm. Our experiments indicate that adding annealed Gaussian noise by decaying the variance often works better and more robustly than using fixed Gaussian noise (see Section 4.6). We use a schedule inspired from Welling & Teh (2011) in our experiments and take:
57
+
58
+ $$
59
+ \sigma _ { t } ^ { 2 } = \frac { \eta } { ( 1 + t ) ^ { \gamma } }
60
+ $$
61
+
62
+ We examine only 2 distinct noise hyperparameter configurations in our experiments, selecting $\eta$ from $\{ 0 . 0 1 , 1 . 0 \}$ and setting $\gamma = 0 . 5 5$ in all experiments. We believe this shows that annealed gradient noise is robust to minimal tuning. For example, in the experiments on Neural Programmer and Neural GPUs, we tried only a single configuration of noise parameters, simply setting $\eta = 1 . 0$ and tuning only the model hyperparameters as normal.
63
+
64
+ # 4 EXPERIMENTS
65
+
66
+ In the following experiments, we examine the effect of gradient noise on deep networks for MNIST digit classification, and consider a variety of complex neural network architectures: EndTo-End Memory Networks (Sukhbaatar et al., 2015) and Neural Programmer (Neelakantan et al., 2016) for question answering, Neural Random Access Machines (Kurach et al., 2016) and Neural GPUs (Kaiser & Sutskever, 2016) for algorithm learning. The models and results are described as follows.
67
+
68
+ # 4.1 DEEP FULLY-CONNECTED NETWORKS
69
+
70
+ For our first set of experiments, we examine the impact of adding gradient noise when training a very deep fully-connected network on the MNIST handwritten digit classification dataset (LeCun et al., 1998). Our network is deep: it has 20 hidden layers, with each layer containing 50 hidden units, posing a significant optimization and generalization problem. We use the ReLU activation function (Nair & Hinton, 2010).
71
+
72
+ In this experiment, we train with SGD without momentum, using the fixed learning rates of 0.1 and 0.01. Unless otherwise specified, the weights of the network are initialized from a Gaussian with mean zero, and standard deviation of 0.1, which we call Simple Init. When adding gradient noise, we tried both settings of the variance detailed in Section 3, and found that decaying variance according to the schedule in Equation (1) with $\eta = 0 . 0 1$ worked best.
73
+
74
+ The results of our experiment are in Table 1. When trained from Simple Init we can see that adding noise to the gradient helps in achieving higher average and best accuracy over 20 runs using each learning rate for a total of 40 runs (Table 1, Experiment 1). We note that the average is closer to $50 \%$ because the small learning rate of 0.01 usually gives very slow convergence. We also try our approach on a more shallow network of 5 layers, but adding noise does not improve the training in that case.
75
+
76
+ Next, we experiment with clipping the gradients with two threshold values: 100 and 10 (Table 1, Experiment 2, and 3). Here, we find training with gradient noise is insensitive to the gradient clipping values. By tuning the clipping threshold, it is possible to get comparable accuracy without noise for this problem.
77
+
78
+ In our fourth and fifth experiments (Table 1, Experiment 4), we use two analytically-derived ReLU initialization techniques (which we term Good Init 1 and 2) recently-proposed by Sussillo (2014) and He et al. (2015), and find that adding gradient noise does not help. Previous work has found that stochastic gradient descent with carefully tuned initialization, momentum, learning rate, and learning rate decay can optimize such extremely deep fully-connected ReLU networks (Srivastava et al., 2015). It would be harder to find such a robust initialization technique for the more complex heterogeneous architectures considered in later sections. Accordingly, we find in later experiments (e.g., Section 4.3) that random restarts and the use of a momentum-based optimizer like Adam are not sufficient to achieve the best results in the absence of added gradient noise.
79
+
80
+ To test how sensitive the methods are to poor initialization, in addition to the sub-optimal Simple Init, we run an experiment where all the weights in the neural network are initialized at zero. The results (Table 1, Experiment 5) show that if we do not add noise to the gradient, the networks fail to learn. If we add some noise, the networks can learn and reach $9 4 . 5 \%$ accuracy. While the pessimal performance of the noiseless model is unsurprising (initializing weights at 0 introduces symmetries that make gradient-descent impossible), it is interesting to note that gradient noise can overcome what is perhaps the canonical “bad initialization.”
81
+
82
+ Experiment 1: Simple Init, No Gradient Clip
83
+
84
+ <table><tr><td rowspan=1 colspan=1>Setting</td><td rowspan=1 colspan=1>Best Test Acc.</td><td rowspan=1 colspan=1>Avg. Test Acc.</td></tr><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>89.9%</td><td rowspan=1 colspan=1>43.1%</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>96.7%</td><td rowspan=1 colspan=1>52.7%</td></tr><tr><td rowspan=1 colspan=1>No Noise + Dropout</td><td rowspan=1 colspan=1>11.3%</td><td rowspan=1 colspan=1>10.8%</td></tr></table>
85
+
86
+ Experiment 2: Simple Init, Gradient ${ \mathrm { C l i p } } = 1 0 0$
87
+
88
+ <table><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>90.0%</td><td rowspan=1 colspan=1>46.3%</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>96.7%</td><td rowspan=1 colspan=1>52.3%</td></tr></table>
89
+
90
+ Experiment 3: Simple Init, Gradient ${ \mathrm { C l i p } } = 1 0$
91
+
92
+ <table><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>95.7%</td><td rowspan=1 colspan=1>51.6%</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>97.0%</td><td rowspan=1 colspan=1>53.6%</td></tr></table>
93
+
94
+ Experiment 4: Good Init $1 +$ Gradient Clip = 10
95
+
96
+ <table><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>97.4%</td><td rowspan=1 colspan=1>92.1%</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>97.5%</td><td rowspan=1 colspan=1>92.2%</td></tr></table>
97
+
98
+ Experiment 5: Good Init $^ { 2 + }$ Gradient Clip = 10
99
+
100
+ <table><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>97.4%</td><td rowspan=1 colspan=1>91.7%</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>97.2%</td><td rowspan=1 colspan=1>91.7%</td></tr></table>
101
+
102
+ Experiment 6: Bad Init (Zero Init) $^ +$ Gradient Clip = 10
103
+ Table 1: Average and best test accuracy on MNIST over 40 runs. Higher values are better.
104
+
105
+ <table><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>11.4%</td><td rowspan=1 colspan=1>10.1%</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>94.5%</td><td rowspan=1 colspan=1>49.7%</td></tr></table>
106
+
107
+ In summary, these experiments show that if we are careful with initialization and gradient clipping values, it is possible to train a very deep fully-connected network without adding gradient noise. However, if the initialization is poor, optimization can be difficult, and adding noise to the gradient is a good mechanism to overcome the optimization difficulty. Additionally, the noise need not be heavily tuned and rarely decreases performance.
108
+
109
+ This set of results suggests that added gradient noise can be an effective mechanism for training complex networks. This is because it is more difficult to initialize the weights properly for these architectures. In the following, we explore the training of more complex models such as End-ToEnd Memory Networks and Neural Programmer, whose initialization is less well studied.
110
+
111
+ # 4.2 END-TO-END MEMORY NETWORKS
112
+
113
+ We test added gradient noise for training End-To-End Memory Networks (Sukhbaatar et al., 2015), an approach for question answering using deep networks. Memory Networks have been demonstrated to perform well on a relatively challenging toy question answering problem (Weston et al., 2015).
114
+
115
+ In Memory Networks, the model has access to a context, a question, and is asked to predict an answer. Internally, the model has an attention mechanism which focuses on the right clue to answer the question. In the original formulation (Weston et al., 2015), Memory Networks were provided with additional supervision as to what pieces of context were necessary to answer the question. This was replaced in the End-To-End formulation by a latent attention mechanism implemented by a softmax over contexts. As this greatly complicates the learning problem, the authors implement a two-stage training procedure: First train the networks with a linear attention, then use those weights to warmstart the model with softmax attention.
116
+
117
+ In our experiments with Memory Networks, we use the same model hyperparameter settings as Sukhbaatar et al. (2015), and we try both settings of the variance detailed in Section 3, finding $\eta = 0 . 0 1$ worked best for this task. This noise is added to the gradient after clipping.
118
+
119
+ We set the number of training epochs to 200 because we would like to understand the behaviors of Memory Networks near convergence. We test the effect of gradient noise with the published two-stage training approach, and additionally with a one-stage approach where we train the networks with softmax attention and without warmstarting. Following the experimental protocol of Sukhbaatar et al. (2015), we take the model with lowest training error out of 10 random restarts. Results are reported in Table 2. We find some fluctuations during each run of the training, but the reported results reflect the typical gains obtained by adding random noise.
120
+
121
+ We find that warmstarting does indeed help the networks. In all cases, adding random noise to the gradient also helps the network both in terms of training errors and validation errors, and never hurts. Added noise, however, is especially helpful for the training of End-To-End Memory Networks without the warmstarting stage.
122
+
123
+ One-Stage Training
124
+
125
+ <table><tr><td rowspan=1 colspan=1>Setting</td><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>With Noise</td></tr><tr><td rowspan=1 colspan=1>Train error:</td><td rowspan=1 colspan=1>10.5%</td><td rowspan=1 colspan=1>9.6%</td></tr><tr><td rowspan=1 colspan=1>Validation error:</td><td rowspan=1 colspan=1>19.5%</td><td rowspan=1 colspan=1>16.6%</td></tr></table>
126
+
127
+ Two-Stage Training
128
+ Table 2: The effects of adding gradient noise to End-to-End Memory Networks. Lower values are better.
129
+
130
+ <table><tr><td rowspan=1 colspan=1>Train error:</td><td rowspan=1 colspan=1>6.2%</td><td rowspan=1 colspan=1>5.9%</td></tr><tr><td rowspan=1 colspan=1>Validation error:</td><td rowspan=1 colspan=1>10.9%</td><td rowspan=1 colspan=1>10.8%</td></tr></table>
131
+
132
+ # 4.3 NEURAL PROGRAMMER
133
+
134
+ Neural Programmer is a neural network architecture augmented with a small set of built-in arithmetic and logic operations that learns to induce latent programs. It is proposed for the task of question answering from tables (Neelakantan et al., 2016). Examples of operations on a table include the sum of a set of numbers, or the list of numbers greater than a particular value. Key to Neural Programmer is the use of “soft selection” to assign a probability distribution over the list of operations. This probability distribution weighs the result of each operation, and the cost function compares this weighted result to the ground truth. This soft selection, inspired by the soft attention mechanism of Bahdanau et al. (2014), allows for full differentiability of the model. Running the model for several steps of selection allows the model to induce a complex program by chaining the operations, one after the other. At convergence, the soft selection tends to become peaky (hard selection). Figure 1 shows the architecture of Neural Programmer at a high level.
135
+
136
+ ![](images/103af5e9384f10e63f4ef6686fe5aa03b123e3553d6760d47ab8ea34ba802dbb.jpg)
137
+ Figure 1: Neural Programmer, a neural network with built-in arithmetic and logic operations. At every time step, the controller selectes an operation and a data segment. Figure reproduced with permission from Neelakantan et al. (2016).
138
+
139
+ In a synthetic table comprehension task, Neural Programmer takes a question and a table (or database) as input and the goal is to predict the correct answer. To solve this task, the model has to induce a program and execute it on the table. A major challenge is that the supervision signal is in the form of the correct answer and not the program itself. The model runs for a fixed number of steps, and at each step selects a data segment and an operation to apply to the selected data segment. Soft selection is performed at training time so that the model is differentiable, while at test time hard selection is employed.
140
+
141
+ We examine only the noise configuration with $\eta = 1 . 0$ , and add noise to the gradient after clipping, optimizing all other hyperparameters of the model. The model is optimized with Adam (Kingma & Ba, 2014), which combines momentum and adaptive learning rates.
142
+
143
+ For our first experiment, we train Neural Programmer to answer questions involving a single column of numbers. We use 72 different hyper-parameter configurations with and without adding annealed random noise to the gradients. We also run each of these experiments for 3 different random initializations of the model parameters and we find that only $1 / 2 1 6$ runs achieve $1 0 0 \%$ test accuracy without adding noise while $9 / 2 1 6$ runs achieve $1 0 0 \%$ accuracy when random noise is added. The 9 successful runs consisted of models initialized with all the three different random seeds, demonstrating robustness to initialization. We find that when using dropout (Srivastava et al., 2014) none of the 216 runs give $100 \%$ accuracy.
144
+
145
+ We consider a more difficult question answering task where tables have up to five columns containing numbers. We also experiment on a task containing one column of numbers and another column of text entries. Table 3 shows the performance of adding noise vs. no noise on Neural Programmer.
146
+
147
+ Question Answering Accuracy
148
+
149
+ <table><tr><td rowspan=1 colspan=1>Setting</td><td rowspan=1 colspan=1>Dropout</td><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>With Noise</td></tr><tr><td rowspan=1 colspan=1>Five columns</td><td rowspan=1 colspan=1>No</td><td rowspan=1 colspan=1>95.3%</td><td rowspan=1 colspan=1>98.7%</td></tr><tr><td rowspan=1 colspan=1>Text entries</td><td rowspan=1 colspan=1>No</td><td rowspan=1 colspan=1>97.6%</td><td rowspan=1 colspan=1>98.8%</td></tr><tr><td rowspan=1 colspan=1>Five columns</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>97.4%</td><td rowspan=1 colspan=1>99.2%</td></tr><tr><td rowspan=1 colspan=1>Text entries</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>99.1%</td><td rowspan=1 colspan=1>97.3%</td></tr></table>
150
+
151
+ Table 3: The effects of adding random noise to the gradient on Neural Programmer. Higher values are better. Adding random noise to the gradient always helps the model. When the models are applied to these more complicated tasks than the single column experiment, using dropout and noise together seems to be beneficial in one case while using only one of them achieves the best result in the other case.
152
+
153
+ Figure 2 shows an example of the effect of adding random noise to the gradients in our experiment with 5 columns. The differences between the two models are much more pronounced than Table 3 indicates because that table reflects the results from the best hyperparameters. Figure 2 indicates a more typical training run.
154
+
155
+ ![](images/0a1e50a67d834ff2dfdac9f418a072266c4e7a59d8bd015eb741c661ea8cd996.jpg)
156
+ Figure 2: Noise Vs. No Noise in our experiment with 5 columns. The models trained with noise generalizes almost always better.
157
+
158
+ In all cases, we see that added gradient noise improves performance of Neural Programmer. Its performance when combined with or used instead of dropout is mixed depending on the problem, but the positive results indicate that it is worth attempting on a case-by-case basis.
159
+
160
+ # 4.4 NEURAL RANDOM ACCESS MACHINES
161
+
162
+ We now conduct experiments with Neural Random-Access Machines (NRAM) (Kurach et al., 2016). NRAM is a model for algorithm learning that can store data, and explicitly manipulate and dereference pointers. NRAM consists of a neural network controller, memory, registers and a set of built-in operations. This is similar to the Neural Programmer in that it uses a controller network to compose built-in operations, but both reads and writes to an external memory. An operation can either read (a subset of) contents from the memory, write content to the memory or perform an arithmetic operation on either input registers or outputs from other operations. The controller runs for a fixed number of time steps. At every step, the model selects a “circuit” to be executed: both the operations and its inputs.
163
+
164
+ These selections are made using soft attention (Bahdanau et al., 2014) making the model end-to-end differentiable. NRAM uses an LSTM (Hochreiter & Schmidhuber, 1997) controller. Figure 3 gives an overview of the model.
165
+
166
+ ![](images/94341ba07767fbb398d37953fef5a9fe3f4a1ce8f10de8bdda526db81385e635.jpg)
167
+ Figure 3: One timestep of the NRAM architecture with $R = 4$ registers and a memory tape. $m _ { 1 }$ , $m _ { 2 }$ and $m _ { 3 }$ are example operations built-in to the model. The operations can read and write from memory. At every time step, the LSTM controller softly selects the operation and its inputs. Figure reproduced with permission from Kurach et al. (2016).
168
+
169
+ For our experiment, we consider a problem of finding the $k$ -th element’s value in a linked list. The network is given a pointer to the head of the linked list, and has to find the value of the $k$ -th element. Note that this is highly nontrivial because pointers and their values are stored at random locations in memory, so the model must learn to traverse a complex graph for $k$ steps.
170
+
171
+ Because of this complexity, training the NRAM architecture can be unstable, especially when the number of steps and operations is large. We once again experiment with the decaying noise schedule from Equation (1), setting $\eta = 0 . 0 1$ . We run a large grid search over the model hyperparameters (detailed in Kurach et al. (2016)), and find the top 3 parameter settings separately for both noised and un-noised models. For each model, for each of these 3 settings, we try 100 different random initializations and look at the percentage of runs that give $1 0 0 \%$ accuracy across each one for training both with and without noise.
172
+
173
+ As in our experiments with Neural Programmer, we find that adding the noise after gradient clipping is crucial. This is likely because the effect of random noise is washed away when gradients become too large. For models trained with noise we observed much better reproduce rates, which are presented in Table 4. Although it is possible to train the model to achieve $\bar { 1 } 0 0 \%$ accuracy without noise, it is less robust across multiple random restarts, with over $1 0 \mathrm { x }$ as many initializations leading to a correct answer when using noise.
174
+
175
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>With Noise</td></tr><tr><td rowspan=1 colspan=1>Hyperparameter-1</td><td rowspan=1 colspan=1>1%</td><td rowspan=1 colspan=1>5%</td></tr><tr><td rowspan=1 colspan=1>Hyperparameter-2</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>22%</td></tr><tr><td rowspan=1 colspan=1>Hyperparameter-3</td><td rowspan=1 colspan=1>3%</td><td rowspan=1 colspan=1>7%</td></tr><tr><td rowspan=1 colspan=1>Average</td><td rowspan=1 colspan=1>1.3%</td><td rowspan=1 colspan=1>11.3%</td></tr></table>
176
+
177
+ Table 4: Percentage of successful runs on the $k$ -th element task. All tests were performed with the same set of 100 random initializations (seeds). Higher values are better.
178
+
179
+ # 4.5 CONVOLUTIONAL GATED RECURRENT NETWORKS (NEURAL GPUS)
180
+
181
+ Convolutional Gated Recurrent Networks (CGRN) or Neural GPUs (Kaiser & Sutskever, 2016) are a recently proposed model that is capable of learning arbitrary algorithms. CGRNs use a stack of convolution layers, unfolded with tied parameters like a recurrent network. The input data (usually a list of symbols) is first converted to a three dimensional tensor representation containing a sequence of embedded symbols in the first two dimensions, and zeros padding the next dimension. Then, multiple layers of modified convolution kernels are applied at each step. The modified kernel is a combination of convolution and Gated Recurrent Units (GRU) (Cho et al., 2014b). The use of convolution kernels allows computation to be applied in parallel across the input data, while the gating mechanism helps the gradient flow. The additional dimension of the tensor serves as a working memory while the repeated operations are applied at each layer. The output at the final layer is the predicted answer.
182
+
183
+ The key difference between Neural GPUs and other architectures for algorithmic tasks (e.g., Neural Turing Machines (Graves et al., 2014)) is that instead of using sequential data access, convolution kernels are applied in parallel across the input, enabling the use of very deep and wide models. The model is referred to as Neural GPU because the input data is accessed in parallel. Neural GPUs were shown to outperform previous sequential architectures for algorithm learning on tasks such as binary addition and multiplication, by being able to generalize from much shorter to longer data cases.
184
+
185
+ In our experiments, we use Neural GPUs for the task of binary multiplication. The input consists two concatenated sequences of binary digits separated by an operator token, and the goal is to multiply the given numbers. During training, the model is trained on 20-digit binary numbers while at test time, the task is to multiply 200-digit numbers. We add Gaussian noise with decaying variance according to the schedule in Equation (1) with $\eta = 1 . 0$ , to the gradient after clipping. The model is optimized using Adam (Kingma & Ba, 2014).
186
+
187
+ Table 5 gives the results of a large-scale experiment using Neural GPUs with a 7290 grid search. The experiment shows that models trained with added gradient noise are more robust across many random initializations and parameter settings. As you can see, adding gradient noise both allows us to achieve the best performance, with the number of models with $< 1 \%$ error over twice as large as without noise. But it also helps throughout, improving the robustness of training, with more models training to higher error rates as well. This experiment shows that the simple technique of added gradient noise is effective even in regimes where we can afford a very large numbers of random restarts.
188
+
189
+ Table 5: Number of successful runs on 7290 random trials. Higher values are better. The models are trained on length 20 and tested on length 200.
190
+
191
+ <table><tr><td rowspan=1 colspan=1>Setting</td><td rowspan=1 colspan=1>Error&lt;1%</td><td rowspan=1 colspan=1>&lt;2%</td><td rowspan=1 colspan=1>&lt;3%</td><td rowspan=1 colspan=1>&lt;5%</td></tr><tr><td rowspan=1 colspan=1>No Noise</td><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>172</td><td rowspan=1 colspan=1>387</td></tr><tr><td rowspan=1 colspan=1>With Noise</td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>159</td><td rowspan=1 colspan=1>282</td><td rowspan=1 colspan=1>570</td></tr></table>
192
+
193
+ # 4.6 DISCUSSION
194
+
195
+ In this work we propose an annealed Gaussian gradient noise scheme for the optimization of complex neural networks. Our experiments show improvement from gradient noise on a variety of models. We conduct a small set of additional experiments below to examine the factors that make this technique successful, and report a failure mode.
196
+
197
+ Annealed vs. fixed noise We use a single fixed decay value $\gamma = 0 . 5 5$ when applying Equation (1) in our experiments, inspired by Stochastic Gradient Langevin Dynamics, and recommend it as a default. We conduct several experiments to determine the importance of annealed vs. fixed noise added to the gradient. We find that for the End2End model, similar results can be achieved with fixed noise values, however requiring significantly more tuning (compared to trying only two different values of $\eta$ in our experiments with annealed noise). We achieve nearly identical results on the End2End experiment using a fixed noise value of $\eta = 0 . 0 0 1$ . We also experiment with fixed noise on the Neural Programmer and NRAM models, and find that they make a larger difference. For both models, we select fixed noise values log-uniformly from between $1 \mathrm { e } { - 4 }$ and 0.1 and optimize the other hyperparameters. Using 216 runs per variance setting, the best Neural Programmer models without annealing can achieve equivalent errors to the annealed models. However, only 5/216 achieve the best error compared to 9/216 for the model using annealing. For NRAM, using 180 runs per setting, fixed noise never achieves the perfect error of 0 that is achieved by the annealed model. While annealing shows the most benefit with the most complex models, we generally recommend it as a robust default that requires less hyperparameter tuning than fixed noise.
198
+
199
+ Gaussian noise vs. gradient stochasticity We assert that gradient noise helps the model explore the optimization landscape, escaping saddle points and local minima. Analysis of SGD for neural networks suggests that the stochasticity of the gradient serves much the same purpose (Bottou, 1992). This suggests a strategy: add noise to the gradient by simply reducing the minibatch size, increasing the variance of the gradient estimator. While arguments based on SGLD and kernel smoothing provide evidence that the specific form of the Gaussian noise is important, we run a pair of small experiments. For both Neural Programmer and NRAM, we tried batch sizes of 10, 25, and 50 (50 being the value used in the best results). For NRAM, after 100 tasks at each batch size and no gradient noise, 2 tasks at batch size 50 converged to 0 error, 1 task at batch size 10, and none at batch size 25. For Neural Programmer, over 216 experiments at each batch size we see none of the models without gradient noise converge to the best error. These results are far worse than our results using added noise, indicating that merely lowering the batch size does not introduce the same sort of helpful stochasticity.
200
+
201
+ Gradient noise vs. weight noise While weight noise is relatively well-known, it is not equivalent to gradient noise in the case of adaptive or momentum-based optimizers, which effectively adapt the noise to the curvature of the optimization landscape. Both Neural Programmer and NRAM are greatly helped in training by the use of the Adam algorithm for optimization. We find here, using the same experimental setup as when examining annealed vs. fixed noise, that the models fail to learn when adding noise directly to the weights. Even when using starting noise rates as low as $1 \mathrm { e } { - 6 }$ , with the usual annealing schedule, the models fail to train significantly, achieving $57 \%$ error for NRAM and $68 \%$ for Neural Programmer at the lowest. Importantly, these noise rates are on the same order as the adaptive learning rates. This indicates that the issue is not just the noise scale, but that the very poor conditioning of the loss functions makes it necessary to adapt the noise. Similar concerns motivated the development of very recent algorithms for preconditioned SGLD in the Bayesian setting (Li et al., 2016).
202
+
203
+ Negative results While we see improvements on a large number of neural network architectures, we note a case where gradient noise does not improve over standard SGD. We conduct language modeling experiments on the Penn Treebank (Marcus et al., 1993), using the experimental setup and architecture from Zaremba et al. (2014). We report results using a 200-unit LSTM with dropout, but observe a similar lack of improvement from gradient noise when using models without dropout. We try the two proposed noise rates from Section (method) and find the best results using $\eta = 0 . 0 1$ are slightly worse than the noiseless model, achieving a perplexity of 98 rather than 95. By further lowering the noise parameter to $\eta = 0 . 0 0 1$ we are able to achieve the same perplexity as the baseline, but do not see improvement. While adding gradient noise does not help in this case, it is simple to try and does not significantly hurt the results.
204
+
205
+ # 5 CONCLUSION
206
+
207
+ In this paper, we demonstrate the effectiveness of adding noise to the gradient when training deep neural networks. We find that adding noise to the gradient helps optimization and generalization of complicated neural networks and is compatible with and complementary to other stochastic optimization methods. We suspect that the effects are pronounced for complex models because they have many saddle points.
208
+
209
+ We believe that this surprisingly simple yet effective idea, essentially a single line of code, should be in the toolset of neural network practitioners when facing issues with training neural networks.
210
+
211
+ # REFERENCES
212
+
213
+ Shun-Ichi Amari. Natural gradient works efficiently in learning. Neural computation, 1998.
214
+
215
+ Guozhong An. The effects of adding noise during backpropagation training on a generalization performance. Neural Computation, 1996.
216
+
217
+ Devansh Arpit, Yingbo Zhou, Bhargava U Kota, and Venu Govindaraju. Normalization propagation: A parametric technique for removing internal covariate shift in deep networks. ICML, 2016.
218
+
219
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
220
+
221
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2014.
222
+
223
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. ICML, 2015.
224
+
225
+ Leon Bottou. Stochastic gradient learning in neural networks. In ´ Neuro-N¨ımes, 1992.
226
+
227
+ Olivier Bousquet and Leon Bottou. The tradeoffs of large scale learning. In ´ NIPS, 2008.
228
+
229
+ Changyou Chen, David Carlson, Zhe Gan, Chunyuan Li, and Lawrence Carin. Bridging the gap between stochastic gradient mcmc and stochastic optimization, 2016.
230
+
231
+ Kyunghyun Cho, Bart van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014a.
232
+
233
+ 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 EMNLP, 2014b.
234
+
235
+ Anna Choromanska, Mikael Henaff, Michael Mathieu, G ¨ erard Ben Arous, and Yann LeCun. The ´ loss surfaces of multilayer networks. In AISTATS, 2015.
236
+
237
+ Tim Cooijmans, Nicolas Ballas, Cesar Laurent, and Aaron Courville. Recurrent batch normalization. ´ arXiv preprint arXiv:1603.09025, 2016.
238
+
239
+ Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In NIPS, 2012.
240
+
241
+ Guillaume Desjardins, Karen Simonyan, Razvan Pascanu, and koray kavukcuoglu. Natural neural networks. In NIPS. 2015.
242
+
243
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. JMLR, 2011.
244
+
245
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proc. AISTATS, pp. 249–256, 2010.
246
+
247
+ Alex Graves. Practical variational inference for neural networks. In NIPS, 2011.
248
+
249
+ Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arxiv:1308.0850, 2013.
250
+
251
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural Turing Machines. arXiv preprint arXiv:1410.5401, 2014.
252
+
253
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. ICCV, 2015.
254
+
255
+ Geoffrey Hinton and Sam Roweis. Stochastic neighbor embedding. In NIPS, 2002.
256
+
257
+ Geoffrey Hinton, Li Deng, Dong Yu, George Dahl, Abdel rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara Sainath, and Brian Kingsbury. Deep neural networks for acoustic modeling in speech recognition. Signal Processing Magazine, 2012.
258
+
259
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 1997.
260
+
261
+ Sergey Ioffe and Christian Szegedy. Batch normalization: accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
262
+
263
+ Lukasz Kaiser and Ilya Sutskever. Neural GPUs learn algorithms. In ICLR, 2016.
264
+
265
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
266
+
267
+ Scott Kirkpatrick, Mario P Vecchi, et al. Optimization by simulated annealing. Science, 1983.
268
+
269
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. ImageNet classification with deep convolutional neural networks. In NIPS, 2012.
270
+
271
+ Karol Kurach, Marcin Andrychowicz, and Ilya Sutskever. Neural random-access machines. In ICLR, 2016.
272
+
273
+ Cesar Laurent, Gabriel Pereyra, Phil ´ emon Brakel, Ying Zhang, and Yoshua Bengio. Batch normal- ´ ized recurrent neural networks. arXiv preprint arXiv:1510.01378, 2015.
274
+
275
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 1998.
276
+
277
+ Chen-Yu Lee, Saining Xie, Patrick W. Gallagher, Zhengyou Zhang, and Zhuowen Tu. Deeplysupervised nets. AISTATS, 2015.
278
+
279
+ Chunyuan Li, Changyou Chen, David Carlson, and Lawrence Carin. Preconditioned stochastic gradient langevin dynamics for deep neural networks, 2016.
280
+
281
+ Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. ICML, 2013.
282
+
283
+ Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 1993.
284
+
285
+ James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. arXiv preprint arXiv:1503.05671, 2015.
286
+
287
+ Hossein Mobahi. Training recurrent neural networks by diffusion, 2016.
288
+
289
+ Alan F Murray and Peter J Edwards. Synaptic weight noise during mlp learning enhances faulttolerance, generalization and learning trajectory.
290
+
291
+ Vinod Nair and Geoffrey Hinton. Rectified linear units improve Restricted Boltzmann Machines. In ICML, 2010.
292
+
293
+ Radford M Neal. MCMC using Hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2011.
294
+
295
+ Arvind Neelakantan, Quoc V. Le, and Ilya Sutskever. Neural Programmer: Inducing latent programs with gradient descent. In ICLR, 2016.
296
+
297
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. Proc. ICML, 2013.
298
+
299
+ Sam Patterson and Yee Whye Teh. Stochastic gradient riemannian langevin dynamics on the probability simplex. In NIPS, 2013.
300
+
301
+ Baolin Peng, Zhengdong Lu, Hang Li, and Kam-Fai Wong. Towards neural network-based reasoning. arXiv preprint arxiv:1508.05508, 2015.
302
+
303
+ Boris Teodorovich Polyak. Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 1964.
304
+
305
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, 1951.
306
+
307
+ Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. 2016.
308
+
309
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 2014.
310
+
311
+ Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Training very deep networks. ¨ NIPS, 2015.
312
+
313
+ Mark Steijvers. A recurrent network that performs a context-sensitive prediction task. In CogSci, 1996.
314
+
315
+ Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. In NIPS, 2015.
316
+
317
+ David Sussillo. Random walks: Training very deep nonlinear feed-forward networks with smart initialization. CoRR, 2014.
318
+
319
+ Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In ICML, 2013.
320
+
321
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
322
+
323
+ Max Welling and Yee Whye Teh. Bayesian learning via stochastic gradient Langevin dynamics. In ICML, 2011.
324
+
325
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
326
+
327
+ Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. Towards AI-complete question answering: a set of prerequisite toy tasks. In ICML, 2015.
328
+
329
+ Kaisheng Yao, Trevor Cohn, Katerina Vylomova, Kevin Duh, and Chris Dyer. Depth-gated recurrent neural networks. arXiv preprint arXiv:1508.03790, 2015.
330
+
331
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. CoRR, 2014.
332
+
333
+ Matthew D Zeiler. Adadelta: An adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
md/train/rsRq--gsiE/rsRq--gsiE.md ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Small random initialization is akin to spectral learning: Optimization and generalization guarantees for overparameterized low-rank matrix reconstruction
2
+
3
+ Dominik Stöger Katholische Universität Eichstätt-Ingolstadt 85072 Eichstätt, Germany Dominik.Stoeger@ku.de
4
+
5
+ Mahdi Soltanolkotabi University of Southern California Los Angeles, CA 90089 soltanol@usc.edu
6
+
7
+ # Abstract
8
+
9
+ Recently there has been significant theoretical progress on understanding the convergence and generalization of gradient-based methods on nonconvex losses with overparameterized models. Nevertheless, many aspects of optimization and generalization and in particular the critical role of small random initialization are not fully understood. In this paper, we take a step towards demystifying this role by proving that small random initialization followed by a few iterations of gradient descent behaves akin to popular spectral methods. We also show that this implicit spectral bias from small random initialization, which is provably more prominent for overparameterized models, also puts the gradient descent iterations on a particular trajectory towards solutions that are not only globally optimal but also generalize well. Concretely, we focus on the problem of reconstructing a low-rank matrix from a few measurements via a natural nonconvex formulation. In this setting, we show that the trajectory of the gradient descent iterations from small random initialization can be approximately decomposed into three phases: (I) a spectral or alignment phase where we show that that the iterates have an implicit spectral bias akin to spectral initialization allowing us to show that at the end of this phase the column space of the iterates and the underlying low-rank matrix are sufficiently aligned, (II) a saddle avoidance/refinement phase where we show that the trajectory of the gradient iterates moves away from certain degenerate saddle points, and (III) a local refinement phase where we show that after avoiding the saddles the iterates converge quickly to the underlying low-rank matrix. Underlying our analysis are insights for the analysis of overparameterized nonconvex optimization schemes that may have implications for computational problems beyond low-rank reconstruction.
10
+
11
+ # 1 Introduction
12
+
13
+ Many contemporary problems in machine learning and signal estimation spanning deep learning to low-rank matrix reconstruction involve fitting nonlinear models to training data. Despite tremendous empirical progress, theoretical understanding of these problems poses two fundamental challenges. First, from an optimization perspective, fitting these models often requires solving highly nonconvex optimization problems and except for a few special cases, it is not known how to provably find globally or approximately optimal solutions. Yet simple heuristics such as running (stochastic) gradient descent from (typically) small random initialization is surprisingly effective at finding globally optimal solutions. A second generalization challenge is that many modern learning models including neural network architectures are trained in an overparameterized regime where the parameters of the model exceed the size of the training dataset. It is well understood that in this overparameterized regime, these large models are highly expressive and have the capacity to (over)fit arbitrary training datasets including pure noise. Mysteriously however overparameterized models trained via simple algorithms such as (stochastic) gradient descent when initialized at random continue to predict well or generalize on yet unseen test data. In particular, it has been noted in a number of works that for many modern machine learning architectures, the scale of initialization is important for the generalization/test behavior [1, 2]. It has been noted that stronger generalization performance is typically observed for a smaller scale initialization. Indeed, small random initialization followed by (stochastic) gradient descent iterative updates is arguably the most widely used learning algorithm in modern machine learning and signal estimation.
14
+
15
+ There has been a large number of exciting results aimed at demystifying both the optimization and generalization aspects over the past few years. We will elaborate on these results in detail in the supplementary, however, we would like to briefly mention the common techniques and their existing limitations. On the optimization front a large body of work has emerged on providing guarantees for nonconvex optimization which can roughly be put into two categories: (I) smart initialization+local convergence and (II) landscape analysis $^ +$ saddle escaping algorithms. Approaches in (I) focus on showing local convergence of local search techniques from carefully designed spectral initializations [3, 4, 5, 6, 7, 8, 9, 10]. Approaches in (II) focus on showing that in some cases the optimization landscape is benign in the sense that all local minima are global (no spurious local minima) and the saddle points have a direction of strict negative curvature (strict saddle) [11]. Then specialized truncation or saddle escaping algorithms such as trust region, cubic regularization [12, 13], or noisy (stochastic) gradient-based methods [14, 15, 16, 17] are deployed to provably find a global optimum. Both approaches fail to fully explain the typical behavior of local search techniques in practice. Indeed, for many nonconvex problems local search techniques or simple variants, when initialized at random, quickly converge to globally optimal solutions without getting stuck in local optima/saddles without the need for sophisticated initialization or saddle escaping heuristics. We note that while for differentiable losses eventual convergence to local minimizers is known from a random initialization [18] on problems of the form (II), these results cannot rule out exponentially slow cases in the worst-case [19]. Indeed, it has been argued that in general a more granular analysis of the trajectory of gradient descent beyond the landscape may be necessary [20]. For example, some recent advances has been made by analysing the trajectory of gradient descent using a leave-one-out analysis for the phase retrieval problem [21].
16
+
17
+ Similarly, there has been a lot of exciting progress on the generalization front, especially for neural networks. Specific to generalization capabilities of gradient-based approaches these results broadly fall into two categories: (a) the first category is based on a linearization principle which characterizes the performance of nonlinear models such as neural networks by comparing it to a linearized kernel problem around the initialization (a.k.a. Neural Tangent Kernels) [22, 23, 24, 25, 26, 27, 28]. This has often been referred to as ”lazy training". (b) the second category is based on a continuous limit analysis in the limit of width going to infinity and learning rate going to zero (mean-field analysis) [29, 30, 31, 32, 33]. However, these existing analyses contain many idealized and nonrealistic assumptions (e.g. requiring large, random initialization in (a), which typically leads to worse generalization than what is observed in practice, or unrealistically large widths in (b)) and therefore cannot fully explain the success of overparameterized models or serve as a guiding principle for practitioners [34].
18
+
19
+ Despite the aforementioned exciting recent theoretical progress many aspects of optimization and generalization and in particular the role of random initialization remains mysterious. This leads us to the main challenge of this paper
20
+
21
+ Why is small random initialization combined with gradient descent updates so effective at finding globally optimal models that generalize well despite the nonconvex nature of the optimization landscape or model overparameterization?
22
+
23
+ In this paper we wish to take a step towards addressing the above challenge by demystifying the critical role of small random initialization in gradient-based approaches. Specifically we show that
24
+
25
+ Small random initialization followed by a few iterations of gradient descent behaves akin to spectral initialization.
26
+
27
+ By that, we mean more precisely, that if the initialization is chosen small enough, then in the initial stage of the training, gradient descent implicitly behaves like spectral initialization techniques such as those commonly used in techniques based on the method of moments. This implicit spectral bias of gradient descent from random initialization puts the gradient descent iterations on a particular trajectory towards solutions that are not only globally optimal but also generalize well for overparameterized models. We also show that with small random initialization this implicit spectral bias phenomenon is more prominent for more overparameterized models in the sense that it materializes after fewer iterations. This intriguing phenomenon is depicted in Figure 1 in the context of a low-rank reconstruction problem. This figure clearly demonstrates that the first few iterations of gradient descent starting from a small random initialization are virtually identical to that of running power iterations (a popular algorithm to find the spectral initialization, see, e.g. [35]).
28
+
29
+ ![](images/529cc7c147b35826e3f6274037ac6cf0cce6109d6a6d365cdfdb021513bce9d5.jpg)
30
+ Figure 1: Gradient descent from small random initialization is akin to spectral initialization. The left figure depicts the empirical landscape of a low-rank matrix reconstruction problem with the two green circles depicting the two global minima and the white circle the saddle point at the origin. In this figure, we also depict the trajectory of the gradient descent iterations (magenta) together with the power method based on a popular spectral initialization technique (blue). Both gradient descent and power method use the same small initialization near the origin. We see that in the early stage, the two trajectories are almost the same. The figure on the right depicts the angle between the gradient descent (magenta)/power method (blue) iterates and a popular spectral initialization technique, denoted by $\theta _ { G D }$ and $\theta _ { P }$ respectively. This figure clearly demonstrates that for the first iterations these angles are practically the same further confirming that the initial trajectory of gradient descent and power methods are similar. See Section 5 for further detail on the experimental setup. (In this figure we have used $r = r _ { \star } = 1 .$ )
31
+
32
+ Concretely we focus on the problem of low-rank matrix recovery, which appears in many different application areas such as recommendation systems, phase retrieval, and quantum tomography [36]. Here, our goal is to recover a low-rank matrix of the form $X X ^ { T }$ from a few linear measurements. We consider a natural, non-convex approach based on matrix factorization, where we minimize the loss function via gradient descent. In this paper, we show that, regardless of the amount of overparameterization used, for small random initialization vanilla gradient descent will always converge towards the low-rank solution. This holds as long as the measurement operator obeys a popular restricted isometry property [37].
33
+
34
+ Our analysis consists of three phases. The first phase is the aforementioned spectral or alignment phase where we show gradient descent from small random initialization behaves akin to spectral initialization, which is a key insight of this paper. Indeed, we show that the first few gradient descent iterates can be accurately approximated by power method iterates. Next, we show that after this first spectral or alignment phase, gradient descent enters a second phase, which we refer to as saddle avoidance phase. In this phase, we show that the trajectory of the gradient iterates moves away from degenerate saddle points, while the iterates maintain almost the same effective rank as $X X ^ { T }$ . In the third phase, the local refinement phase, we show that the iterates approximately converge towards the underlying low-rank matrix $X X ^ { T }$ with a geometric rate up to a certain error floor which depends on the initialization scale. In particular, by decreasing the scale of initialization this error threshold can be made arbitrarily small. While in this paper our main focus is on low-rank matrix reconstruction, we believe that our analysis holds more generally for a variety of contemporary machine learning and signal estimation tasks including neural networks.
35
+
36
+ Finally we note that while a similar setting has already been studied in [38], our analysis goes beyond it in many important ways. For example, our result holds for any amount of overparameterization and allows for arbitrarily small initialization. Maybe most importantly, we study the spectral phase phenomenon at initialization.
37
+
38
+ # 2 Low-rank matrix recovery via non-convex optimization
39
+
40
+ As mentioned earlier in this paper we focus on reconstructing a (possibly overparameterized) Positive Semidefinite (PSD) low rank matrix from a few measurements. In this problem, given $m$ observations of the form
41
+
42
+ $$
43
+ y _ { i } = \left. A _ { i } , X X ^ { T } \right. = \operatorname { T r } \left( A _ { i } X X ^ { T } \right) \qquad { \mathrm { ~ } } i = 1 , \ldots , m ,
44
+ $$
45
+
46
+ we wish to reconstruct the unknown matrix $X X ^ { T }$ . Here, $X \in \mathbb { R } ^ { n \times r _ { \star } }$ with $1 \leq r _ { \star } \leq n$ is a factor of the unknown matrix and $\left\{ A _ { i } \right\} _ { i = 1 } ^ { m }$ are known symmetric measurement matrices. A common approach to solving this problem is via minimizing the loss function
47
+
48
+ $$
49
+ \operatorname* { m i n } _ { \bar { U } \in \mathbb { R } ^ { n \times r } } f ( \bar { U } ) : = \operatorname* { m i n } _ { \bar { U } \in \mathbb { R } ^ { n \times r } } \frac { 1 } { 4 m } \sum _ { i = 1 } ^ { m } \left( y _ { i } - \langle A _ { i } , \bar { U } \bar { U } ^ { T } \rangle \right) ^ { 2 } ,
50
+ $$
51
+
52
+ with $r \geq r _ { \star }$ . More compactly one can rewrite the optimization problem above in the form
53
+
54
+ $$
55
+ \operatorname* { m i n } _ { \bar { U } \in \mathbb { R } ^ { n \times r } } f ( \bar { U } ) : = \operatorname* { m i n } _ { \bar { U } \in \mathbb { R } ^ { n \times r } } \frac { 1 } { 4 } \left. A \left( \bar { U } \bar { U } ^ { T } - X X ^ { T } \right) \right. _ { \ell _ { 2 } } ^ { 2 } ,
56
+ $$
57
+
58
+ where $\mathcal { A } : \mathbb { R } ^ { n \times n } \longrightarrow \mathbb { R } ^ { m }$ is the measurement operator defined by $\begin{array} { r } { [ \boldsymbol { \mathcal { A } } \left( Z \right) ] _ { i } : = \frac { 1 } { \sqrt { m } } \big \langle \boldsymbol { A } _ { i } , Z \big \rangle } \end{array}$ .
59
+
60
+ In order to solve the minimization problem (2) we run gradient descent iterations starting from (often small) random initialization. More specifically,
61
+
62
+ $$
63
+ \begin{array} { r l } & { U _ { t + 1 } = U _ { t } - \mu \nabla f \left( U _ { t } \right) = U _ { t } + \mu \mathcal { A } ^ { * } \left[ y - \mathcal { A } \left( U _ { t } U _ { t } ^ { T } \right) \right] U _ { t } } \\ & { \qquad = U _ { t } + \mu \left[ \left( \mathcal { A } ^ { * } \mathcal { A } \right) \left( X X ^ { T } - U _ { t } U _ { t } ^ { T } \right) \right] U _ { t } . } \end{array}
64
+ $$
65
+
66
+ where we have set $U _ { 0 } = \alpha U$ is the initialization matrix, $A ^ { * }$ denotes the adjoint operator of $\mathcal { A }$ and $y = \left( y _ { i } \right) _ { i = 1 } ^ { m } \in \mathbb { R } ^ { m }$ = A denotes the measurement vector. Here, $U \in \mathbb { R } ^ { n \times r }$ Ais a typically random matrix =which represents the form of the initialization and $\alpha > 0$ is a scaling parameter.
67
+
68
+ There are two challenges associated with analyzing such randomly initialized gradient descent updates. The first is an optimization challenge. Since $f$ is non-convex it is a priori not clear whether gradient descent converges to a global optimum or whether it gets stuck in a local minima and/or saddle. The second challenge is that of generalization. This is particularly pronounced in the overparameterized scenario where the number of parameters are larger than the number of data points i.e. $r n \geq m$ . In this case, there are infinitely many $\bar { U }$ such that $\check { f ( U ) } = 0$ , but $\| \bar { U } \bar { U } ^ { T } - X X ^ { T } \| _ { F }$ is arbitrarily large (see, e.g., [39, Proposition 1]). That is, even if gradient descent converges to a global optimum, i.e. $f \left( { \bar { U } } \right) { \bar { = } } 0$ , it is a priori not clear whether it has found the low-rank solution $X X ^ { T }$ (see also Figure 5).
69
+
70
+ # 3 Main results
71
+
72
+ In this section, we present our main results. Stating these results requires a couple of simple definitions.
73
+ The first definition concerns the measurement operator $\mathcal { A }$ .
74
+
75
+ Definition 3.1 (Restricted Isometry Property (RIP)). The measurement operator $\mathcal { A } : \mathbb { R } ^ { n \times n } \longrightarrow \mathbb { R } ^ { m }$ satisfies RIP of rank $r$ with constant $\delta > 0$ , if it holds for all matrices $Z$ of rank at most $r$
76
+
77
+ $$
78
+ \left( 1 - \delta \right) \left\| Z \right\| _ { F } ^ { 2 } \leq \left\| A \left( Z \right) \right\| _ { \ell _ { 2 } } ^ { 2 } \leq \left( 1 + \delta \right) \left\| Z \right\| _ { F } ^ { 2 } .
79
+ $$
80
+
81
+ We note that for a Gaussian measurement operator $A ^ { 1 }$ , RIP of rank $r$ and constant $\delta > 0$ holds with high probability, if the number of observations satisfies $m \gtrsim n r / \delta ^ { 2 }$ [37, 40].
82
+
83
+ The second definition concerns the condition number of the factor $X$ .
84
+
85
+ Definition 3.2 (condition number). We denote the condition number of $X \in \mathbb { R } ^ { n \times r _ { \star } }$ by $\kappa : = { \frac { \| X \| } { \sigma _ { r , \star } ( X ) } }$ , where $\sigma _ { r _ { \star } }$ $( X )$ denotes $r _ { \star }$ -th largest singular value of $X$ .
86
+
87
+ With these definitions in place we are now ready to state our main results. Due to space limitations in the main paper we focus on the case of $r \geq 2 r _ { \star }$ . With refer the reader to the supplementary for results covering all $r \geq r _ { \star }$ including two special cases: (1) the fully overparameterized case, i.e., $r = n$ along with comparisons with existing work, in this case [38], and (2) the scenario that $U$ has the same number of parameters as $X$ , i.e., $r = r _ { \star }$ .
88
+
89
+ Theorem 3.3. Let $X \in \mathbb { R } ^ { n \times r _ { * } }$ and assume we have m measurements of the low rank matrix $X X ^ { T }$ of the form $y = \mathcal { A } \left( X X ^ { T } \right)$ with $\mathcal { A }$ the measurement operator. We assume $\mathcal { A }$ satisfies the restricted isometry property for all matrices of rank at most $2 r _ { \star } + 1$ with constant $\delta \le c \kappa ^ { - 4 } { r _ { \star } } ^ { - 1 / 2 }$ . To reconstruct $X X ^ { T }$ from the measurements we fit a model of the form $\bar { U } \mapsto \mathcal { A } \left( \bar { U } \bar { U } ^ { T } \right)$ with $\bar { U } \in \mathbb { R } ^ { n \times r }$ via running gradient descent iterations of the form $U _ { t + 1 } = U _ { t } - \mu \nabla f \left( U _ { t } \right)$ on the objective (2) with a step size obeying $\mu \leq c \kappa ^ { - 4 } \| X \| ^ { - 2 }$ . Here, the initialization is given by $U _ { 0 } = \alpha U$ , where $U \in \mathbb { R } ^ { n \times r }$ has i.i.d. entries distributed as $\mathcal { N } \left( 0 , 1 / \sqrt { r } \right)$ . Furthermore, we assume $r \geq 2 r _ { \star }$ and that the scale of initialization fulfills
90
+
91
+ $$
92
+ \alpha \lesssim \operatorname* { m i n } \left\{ \frac { \left( \operatorname* { m i n } \left\{ r ; n \right\} \right) ^ { 1 / 4 } } { \kappa ^ { 1 / 2 } n ^ { 3 / 4 } } \left( 2 \kappa ^ { 2 } \sqrt { \frac { n } { \operatorname* { m i n } \left\{ r ; n \right\} } } \right) ^ { - 6 \kappa ^ { 2 } } ; \frac { 1 } { \kappa ^ { 7 } n } \right\} \| X \| .
93
+ $$
94
+
95
+ Then, after
96
+
97
+ $$
98
+ \hat { t } \lesssim \frac { 1 } { \mu \sigma _ { \mathrm { m i n } } \left( \boldsymbol X \right) ^ { 2 } } \ln \left( \frac { C _ { 1 } n \kappa } { \operatorname* { m i n } \left\{ \boldsymbol r ; n \right\} } \cdot \operatorname* { m a x } \left\{ 1 ; \frac { \kappa r _ { \star } } { \operatorname* { m i n } \left\{ \boldsymbol r ; n \right\} - r _ { \star } } \right\} \cdot \frac { \| \boldsymbol X \| } { \alpha } \right)
99
+ $$
100
+
101
+ iterations we have that
102
+
103
+ $$
104
+ \frac { \| U _ { \widehat { t } } U _ { \widehat { t } } ^ { T } - X X ^ { T } \| _ { F } } { \| X \| ^ { 2 } } \lesssim \frac { n ^ { 2 } \kappa ^ { 8 1 / 1 6 } r _ { \star } ^ { 1 / 8 } } { \left( \operatorname* { m i n } \left\{ r ; n \right\} \right) ^ { 1 5 / 1 6 } } \cdot \frac { \alpha ^ { 2 1 / 1 6 } } { \| X \| ^ { 2 1 / 1 6 } } ,
105
+ $$
106
+
107
+ holds with probability at least $1 - C e ^ { - \tilde { c } r }$ . Here, $c , \tilde { c } , C , C _ { 1 } > 0$ are fixed numerical constants.
108
+
109
+ Note that the test error $\| U _ { \hat { t } } U _ { \hat { t } _ { \cdot } } ^ { T } - X X ^ { T } \| _ { F } ^ { 2 }$ can be made arbitrarily small by choosing the scale of initialization $\alpha$ small enough. In particular, the dependence of the test error on $\alpha$ is polynomial and the dependence of the number of iterations on $\alpha$ is logarithmic, which means that reducing the test error by scaling down $\alpha$ introduces only modest additional computational cost. Hence, as long as the rank at most $2 r _ { \star } + 1$ RIP with constant $\delta \le c \kappa ^ { - 4 } { r _ { \star } } ^ { - 1 / 2 }$ holds, gradient descent converges to a point in the proximity of the low-rank solution, whenever the initialization is chosen small enough regardless of the choice of $r$ . This holds even when the model is overparameterized i.e. $r n \gg m$ and the optimization problem has many global optima many of which do not obey $U U ^ { T } \approx X X ^ { T }$ . This result thus further demonstrates that when initialized with a small random initialization gradient descent has an implicit bias towards solutions of low-rank or small nuclear norm. This is in sharp contrast to Neural Tangent Kernel (NTK)-based theory for low-rank matrix recovery (see [23, Section 4.2]) which will not approximately recover the ground truth matrix $X X ^ { T }$ due to the larger scale of initialization required when using that technique.
110
+
111
+ As discussed in Section 2, the restricted isometry property holds with high probability for a sample complexity $m \gtrsim n r _ { \star } ^ { 2 } \kappa ^ { 8 }$ for Gaussian measurement matrices. Up to constants, this sample complexity is optimal in $n$ , while it is sub-optimal in $r _ { \star }$ and $\kappa$ compared to approaches based on nuclear-norm minimization (see, e.g., [37]). While there is numerical evidence that the true scaling of $m$ in $r _ { \star }$ should also be linear in the non-convex case [41], we note that the optimal dependence of the sample complexity on $r _ { \star }$ is a major open problem in the field, as the sample complexities in all theoretical results for non-convex approaches in the literature scale at least quadratically in $r _ { \star }$ .
112
+
113
+ Interpretation: Recall from Section 1 that our convergence analysis can be divided into three phases: the spectral phase, the saddle avoidance phase, and the local refinement phase. As it will become clear from the proofs in the supplementary when $r \geq 2 r _ { \star }$ the bound on the number of iterations can
114
+
115
+ be decomposed as follows
116
+
117
+ $$
118
+ \begin{array} { r l } { \hat { t } \lesssim \frac { 1 } { \mu \sigma _ { \operatorname* { m i n } } ( X ) ^ { 2 } } \Bigg [ \ln ( 2 \kappa ^ { 2 } \sqrt { \frac { n } { \operatorname* { m i n } \{ r ; n \} } } ) + } & \ : \underbrace { \ln ( \frac { \sigma _ { \operatorname* { m i n } } ( X ) } { \alpha } ) } _ { \displaystyle \mu \sigma _ { \operatorname* { m i n } } ( X ) ; \frac { 1 } { \operatorname* { m i n } \{ r ; n \} - r _ { \star } } \} \frac { \| X \| } { \alpha } \Bigg ) \Bigg ] . } \end{array}
119
+ $$
120
+
121
+ Phase III: local refinement phase
122
+
123
+ First, we note that the duration of all three phases scales inversely with $\sigma _ { \mathrm { m i n } } \left( X \right) ^ { 2 }$ . This is due to the fact that in all three phases the dynamics associated the smallest singular value of $X$ is the slowest one and hence needs the most time to complete.
124
+
125
+ In the spectral phase, the eigenvectors corresponding to the leading $r _ { \star }$ eigenvalues of $U _ { t } U _ { t } ^ { T }$ become aligned with the eigenvectors corresponding to the leading $r _ { \star }$ eigenvalues of $\mathcal { A } ^ { \ast } \mathcal { A } \left( X X ^ { T } \right)$ . We observe in (6) that in the spectral phase increasing $r$ , i.e. the amount of parameters, decreases the number of iterations in this phase. As we will explain in the supplementary, the reason is that increasing $r$ decreases the angle between the column space of the initialization $U _ { 0 }$ and the span of the eigenvectors corresponding to the leading $r _ { \star }$ eigenvalues of $\mathcal { A } ^ { \ast } \mathcal { A } \left( X X ^ { T } \right)$ used in spectral initialization. As a consequence, gradient descent needs fewer iterations to align these two subspaces.
126
+
127
+ In the saddle avoidance phase (Phase II), $\sigma _ { r _ { \star } } \left( U _ { t } \right)$ , the $r _ { \star }$ th largest singular value of $U _ { t }$ , grows geometrically until it is on the order of $\sigma _ { \mathrm { m i n } } \left( X \right)$ . Hence, this duration depends on the ratio between the $\sigma _ { \mathrm { m i n } } \left( X \right)$ and the the scale of initialization $\alpha$ . This is clearly reflected in the upper bound on the number of needed iterations in equation (6).
128
+
129
+ In Phase III, the local refinement phase, the matrix $U _ { t } U _ { t } ^ { T }$ converges towards $X X ^ { T }$ . In particular, at iteration $\hat { t }$ the test error obeys (5). We observe that a smaller $\alpha$ allows for a smaller test error in (5) but per (6) this higher accuracy is achieved with a modest increase in the required iterations.
130
+
131
+ # 4 A glimpse of our analysis
132
+
133
+ In our proofs, we show that the trajectory of the gradient descent iterations can be approximately decomposed into three phases: (I) a spectral or alignment phase where we show that gradient descent from random initialization behaves akin to spectral initialization allowing us to show that at the end of this phase the column spaces of the iterates $U _ { t }$ and the ground truth matrix $X$ are sufficiently aligned, (II) a saddle avoidance phase, where we show that the trajectory of the gradient iterates move away from certain degenerate saddle points , and (III) a refinement phase, where the product of the gradient descent iterates $U _ { t } U _ { t } ^ { T }$ converges quickly to the underlying low-rank matrix $X X ^ { T }$ . The latter result holds up to a small error that is commensurate with the scale of the initialization and tends to zero as the scale of the initialization goes to zero.
134
+
135
+ To formalize the above, we use $L$ and $L _ { t }$ to denote the subspaces spanned by the eigenvectors corresponding to the $r _ { \star }$ largest eigenvalues of the matrix $\mathcal { A } ^ { \ast } \bar { \mathcal { A } } \left( X X ^ { \bar { T } } \right)$ , and $U _ { t } U _ { t } ^ { T }$ , respectively. Moreover, for a subspace $L$ of dimension $r _ { \star }$ we use $V _ { L } \in \mathbb { R } ^ { n \times r _ { \star } }$ to denote an orthonormal matrix whose columns span the subspace $L$ . Note that $L$ is the subspace, which is obtained by commonly used spectral methods. Using this notation, Figure 2a depicts the three phases described above.
136
+
137
+ In the spectral phase we will prove that we can approximate the iterate $U _ { t }$ by
138
+
139
+ $$
140
+ U _ { t } \approx \underbrace { \big ( \mathbf { I d } + \mu \mathbf { \mathcal { A } } ^ { * } \mathbf { \mathcal { A } } \left( X X ^ { T } \right) \big ) } _ { = : Z _ { t } } ^ { t } U _ { 0 } = Z _ { 1 } ^ { t } U _ { 0 } : = \tilde { U } _ { t } .
141
+ $$
142
+
143
+ We note that the matrix $Z _ { 1 } \ = \ \mathrm { I d } + \mu \mathcal { A } ^ { * } \mathcal { A } \left( X X ^ { T } \right)$ is the basis for the commonly used spectral initialization, where typically a factorization of the rank $r _ { * }$ approximation of this matrix is used as the initialization [6, 5, 42]. Therefore, the approximation (7) suggests that gradient descent iterates modulo the normalization are akin to running power method on $Z _ { 1 }$ . Hence, we expect that at the end of the spectral phase the subspace $L _ { t }$ to be closely aligned with the subspace $L$ , i.e. the subspace obtained by commonly used spectral initialization techniques. In particular, this also implies that $L _ { t }$ is also aligned with the subspace $X$ . Figure 2b clearly illustrates that the first few iterations of gradient descent behave essentially identical to the power method, confirming our intuition.
144
+
145
+ The description of the second and third phase is more elaborate and technical in nature and we defer to the supplementary for a more detailed and intuitive explanation. However, to give a brief description, in these two phases we will decompose the iterates $U _ { t }$ into the sum of two matrices, a "signal" matrix of rank $r _ { \star }$ and a "noise" matrix of rank at most $r - r _ { \star }$ . In Phase (II) we will prove that the smallest singular value of the signal term, which is approximately the same as $\sigma _ { r _ { \star } }$ $\left( U _ { t } \right)$ grows, whereas the spectral norm of the noise matrix grows at a much slower rate. We will also show that in this phase the columns of the signal term stay approximately aligned with the span of the matrix $X$ . As soon as the smallest singular value of the signal term of $U _ { t }$ is approximately at the same order than the smallest singular value of $X$ we enter Phase (III). In that Phase we provide a local convergence argument, which shows that the signal term of $U _ { t }$ converges towards $X$ (up to a rotation), whereas the noise term stays small.
146
+
147
+ ![](images/1bd5cd3f84f3b10d56dfbc66dd9d4cf467ad43f5bf6f2cea7b25b7f27b08514f.jpg)
148
+ Figure 2: (a) Depiction of the three phases of convergence. This figure demonstrates that the convergence analysis can be divided into three phases: (I) spectral/alignment phase; (II) saddle avoidance phase and (III) the refinement phase. We see that in the first phase the first $r _ { \star }$ eigenvectors of $U _ { t } U _ { t } ^ { T }$ rapidly learn the subspace corresponding to the first $r _ { \star }$ eigenvectors of $\mathcal { A } ^ { \ast } \mathcal { A } \left( X X ^ { T } \right)$ , i.e. the angle $\| V _ { L ^ { \bot } } ^ { T } V _ { L _ { t } } \|$ becomes small. The $r _ { \star }$ th largest singular value of $U _ { t }$ is still small in this phase and the (normalized) test error $\| U _ { t } U _ { t } - X X ^ { T } \| _ { F } ^ { 2 } / \| X X ^ { T } \| _ { F } ^ { 2 }$ has not decreased yet. In Phase (II), however, we see that $\sigma _ { r _ { \star } }$ $\left( U _ { t } \right)$ is growing, whereas the loss begins to decrease in this phase and the subspaces stay aligned. In Phase (III) we see that the test error is converging towards 0 rapidly, meaning that $U _ { t } U _ { t } ^ { T }$ converges to $X X ^ { T }$ . Consequently, $\sigma _ { r _ { \star } } \left( U _ { t } \right) / \sigma _ { r _ { \star } } \left( X \right)$ converges to 1 (red curve). We also see that in this phase the angle $\| V _ { L ^ { \bot } } ^ { T } V _ { L _ { t } } \|$ grows again, until it reaches a certain threshold. This is because in this phase the top $r _ { \star }$ eigenvalues of $U _ { t } U _ { t } ^ { T }$ become aligned with the eigenvectors of $X X ^ { T }$ . (b) Depiction of the spectral alignment phase: in the first few iterations, gradient descent with small initialization behaves like a power method. Denote by ${ \tilde { L } } _ { t }$ the subspace spanned by the eigenvectors corresponding to the $r _ { \star }$ largest eigenvalues of the matrix $\widetilde { U _ { t } } \widetilde { U _ { t } } ^ { T }$ . Analogously as before denote by $V _ { \tilde { L } _ { t } }$ an orthonormal matrix, whose columns span the subspace ${ \tilde { L } } _ { t }$ . In this figure, we observe that in the first iterations $U _ { t }$ and $\widetilde { U } _ { t }$ learn the subspace $L$ at almost exactly the same rate.
149
+
150
+ # 5 Numerical experiments
151
+
152
+ In this section, we perform several numerical experiments to corroborate our theoretical results.
153
+
154
+ Experimental setup. For the experiments we set the ground truth matrix $X \in \mathbb { R } ^ { n \times r _ { \star } }$ to be a random orthogonal matrix with $n = 2 0 0$ and $r _ { \star } = 5$ . Moreover, we use $m = 1 0 n { r _ { \star } } = 5 0 n$ random Gaussian measurements. The initialization $U$ is chosen as in Theorem 3.3 and we use a step size of $\mu = 1 / 4$ which is consistent with these theorems. We note that while all experimental depictions are based on a single trial, in line with the NeurIPS guidelines we have drawn these curves multiple times (not depicted) and the behavior of the plots do not change.
155
+
156
+ Depiction of the three phases and the role of overparameterization. In our first experiment, we want to examine how increasing the number of parameters via increasing the number of the columns $r$ of the matrix $U _ { t } \in \mathbb { R } ^ { n \times r }$ , affects the spectral phase. To this aim we set the scale of initialization to $\alpha = 1 / \left( 7 0 n ^ { 2 } \right)$ . Let $L$ denote the subspace spanned by the eigenvectors corresponding to the leading $r _ { \star }$ singular values of $\mathcal { A } ^ { \ast } \mathcal { A } ( X X ^ { T } )$ and $L _ { t }$ denotes the subspace spanned by the left-singular vectors corresponding to the largest $r _ { \star }$ singular values of $U _ { t }$ .
157
+
158
+ ![](images/665e23a4f08b841b53ae6d28270bed70053f954399ac8df02b5f30441b348f05.jpg)
159
+ Figure 3: Impact of different levels of overparameterization on (a) the angle $\| V _ { L ^ { \bot } } ^ { T } V _ { L _ { t } } \|$ and (b) the $r _ { \star }$ th largest singular value, (c) the trajectory of the (normalized) test error $\| U _ { t } U _ { t } ^ { T } - X X ^ { T } \| _ { F } / \| X X ^ { T } \| _ { F }$ .
160
+
161
+ Spectral phase and alignment under different levels of overparameterization. First, we examine how the angle between these two subspaces (i.e. $\| V _ { L ^ { \perp } } ^ { T } V _ { L _ { t } } \| ,$ ) changes in the first few iterations. We depict the results for different $r$ in Figure 3a. We see that in the first few iterations, i.e. in the spectral phase, this angle converges towards zero. This confirms the main conclusion of this paper that the first few iterations of gradient descent from small random initialization indeed behaves akin to running power method for spectral initialization. This experiment also shows that changing the number of columns $r$ of $U _ { t }$ has an interesting effect on the spectral phase. In particular, increasing $r$ allows the gradient descent algorithm to learn the subspace $L$ with fewer iterations, i.e. $\| V _ { L ^ { \bot } } ^ { T } V _ { L _ { t } } \|$ becomes small with fewer iterations. This is in accordance with our theory for $r _ { \star } \le r \le n$ (see, for example, the first summand on the right-hand side of equation (6)), where we show that more overparameterization allows gradient descent to leave the spectral phase earlier. Interestingly, this improvement continues to hold even when increasing $r$ beyond $n$ allowing for even faster convergence of $\| V _ { L ^ { \bot } } ^ { T } V _ { L _ { t } } \|$ . This holds even though in this case the rank of $U _ { 0 }$ is still not larger than $n$ . One potential explanation for this phenomenon might be that for such a choice of $r$ the matrix $U _ { 0 }$ is better conditioned.
162
+
163
+ Growth of $\sigma _ { r _ { \star } } \left( U _ { t } \right)$ and saddle avoidance. In Figure 3b we depict how $\sigma _ { r _ { \star } } \left( U _ { t } \right)$ grows during the training for different choices of $r$ . We see that the curves look similar, although for smaller $r$ the growth phase sets in at a slightly later time. This is due to the fact that for smaller $r$ , as we have seen in Figure 3a, Phase I, the spectral phase takes longer to complete.
164
+
165
+ Evolution of the test error and the refinement phase. Similarly, in Figure 3c we depict how the (normalized) test error $\| U _ { t } U _ { t } ^ { T } - X X ^ { T } \| _ { F } / \| X X ^ { T } \| _ { F }$ evolves during the training for different choices of $r$ . We observe that for smaller $r$ the third phase sets in slightly later. Again, this is due to the fact that for smaller $r$ the spectral phase takes slightly longer to complete (see inequality (6)).
166
+
167
+ Test error under different scales of initialization. In the next experiment, we focus on understanding how the scale of initialization $\alpha$ affects the generalization error $\| U _ { t } U _ { t } ^ { T } - X X ^ { T } \| _ { F } ^ { 2 }$
168
+
169
+ ![](images/f37264bb67eb12df04f997c4ce59e16a703a16cebf79bcfc5db995012edcdb80.jpg)
170
+ Figure 4: Relative test erro r ∥UtUTt −XXT ∥FT for different scales of initialization α .
171
+
172
+ ![](images/064c23755d50858b141e0a12e3b8fb4f590d169b4eaadbef14b71d65606dd375.jpg)
173
+ Figure 5: Change of test error $\| U _ { t } U _ { t } ^ { T } - X X ^ { T } \| _ { F } ^ { 2 }$ and train error $f \left( U _ { t } \right)$ for (a) small and (b) large $\alpha$ during training.
174
+
175
+ For that, we set $r = 1 8 0$ and run gradient descent with for different choices of $\alpha$ . We stop as soon as the training error becomes small $\dot { ( } f \left( U _ { t } \right) \le 0 . 5 \cdot 1 0 ^ { - 9 } )$ . We depict the results in Figure 4. We see that the test error decreases as $\alpha$ decreases. In particular, this figure indicates that the test error depends polynomially on the scale of initialization $\alpha$ . This is in line with our theory, where we also show that the test error decreases at least with the rate $\alpha ^ { 2 1 / 1 6 }$ (see inequality (5) in Theorem 3.3).
176
+
177
+ Change of test and train error during training. In the next experiment, we set $r = 1 8 0$ and examine how the test error $\| U _ { t } U _ { t } ^ { T } - X X ^ { T } \| _ { F } ^ { 2 }$ and the train error $f \left( U _ { t } \right)$ changes throughout training and, in particular, how this depends on the scale of initialization. To this aim, we run gradient descent with $\mathrm { \dot { 4 } \cdot 1 0 ^ { 5 } }$ iterations. We see that for a small scale of initialization, $\alpha = 1 0 ^ { - 3 }$ , which is the scenario studied in this paper, both test error and train error decrease throughout training.
178
+
179
+ We observe that in the beginning, as described our theory, both test and train error decrease rapidly. After that the decrease of both test and train error slows down significantly. Moreover, the train error converges towards zero, in contrast to the test error. One reason for the slow convergence in this phase might be that $U _ { t }$ is ill-conditioned in the sense that $\sigma _ { r _ { \star } }$ $( U _ { t } W _ { t } )$ is much larger than $\Vert U _ { t } W _ { t , \bot } \Vert$ ⋆It is an interesting future research direction to extend our theory to this part of the training.
180
+
181
+ For large scale of initialization $\alpha = 0 . 5$ , we observe a very different behaviour. We see that the train error converges with linear rate until machine precision is reached. However, the test error barely changes throughout the training. This scale of initialization corresponds to the lazy training regime [34], where the parameters stay close to the initialization during the training. We depict the results in Figure 5.
182
+
183
+ Number of iterations until convergence: In the last experiment, we set $\alpha = 1 0 ^ { - 3 }$ and examine how many iterations are needed until the test error $\| U _ { t } U _ { t } ^ { T } - X X ^ { T } \| _ { F } ^ { 2 }$ falls below a certain threshold of $1 0 ^ { - 4 }$ for different values of $r$ obeying $5 \leq r \leq 3 0$ . For each choice of $r$ we run the experiment ten times and then average the number of iterations for each choice of $r$ . The results are depicted in Figure 6. We observe that increasing the number of columns $r$ from 5 to 10, i.e., a small amount of overparameterization, decreases the number of iterations needed. After that the number of iterations needed stays roughly constant. This observation is in line with Figure 3, where we have seen that overparameterization leads to fast decrease of the test error in the spectral phase (with diminishing speedup as $r$ becomes larger and larger) without affecting the other two phases.
184
+
185
+ ![](images/708720b79c80fa2eb96e1f8e6541f2b603ed1c1fcec3c248b501d23e83e1bffe.jpg)
186
+ Figure 6: Number of iterations required for the test error to fall below $1 0 ^ { - 4 }$ for different levels of overparameterization.
187
+
188
+ # 6 Conclusion and Broader Impact
189
+
190
+ In this paper we focused on demystifying the role of initialization when training overparameterized models by showing that small random initialization followed by a few iterations of gradient descent behaves akin to popular spectral methods. We also show that this implicit spectral bias from small random initialization, which is provably more prominent for overparameterized models, also puts the gradient descent iterations on a particular trajectory towards solutions that are not only globally optimal but also generalize well.
191
+
192
+ We think that our results give rise to a number of interesting future research directions. For example, one could extend our results to scenarios where the measurement matrices are more structured such as in matrix completion [43] or in blind deconvolution [44]. Moreover, while our main results, e.g. Theorem 3.3 do require early stopping, our simulations (e.g. Figure 5a) indicate that early stopping is not needed. It would be interesting to examine whether we can remove the early stopping requirement. It is also an interesting future avenue to examine whether the quadratic dependence of the sample complexity $m$ on $r _ { \star }$ in our results is really needed.
193
+
194
+ Moreover, while in this paper our main focus was on low-rank matrix reconstruction, we believe that our analysis holds more generally for a variety of contemporary overparameterized machine learning and signal estimation tasks including neural network training. This is a tantalizing future research direction.
195
+
196
+ Despite being theoretical/foundational in nature our results have potential for broader practical impact. In particular, low rank reconstruction problems are an important component of many recommender engines and our insights may guide better algorithm and systems designs for such engines. More broadly, training overparameterized models using stochastic GD starting from small random initialization is the work-horse of modern learning ncluding deep learning and our insights may in the long term help enable more efficient/reliable training with a smaller carbon footprint and improved test accuracy. As with other technologies such insights may potentially also be used nefariously.
197
+
198
+ # Acknowledgments and Disclosure of Funding
199
+
200
+ M.S. is supported by the Packard Fellowship in Science and Engineering, a Sloan Research Fellowship in Mathematics, an NSF-CAREER under award #1846369, the Air Force Office of Scientific Research Young Investigator Program (AFOSR-YIP) under award #FA9550-18-1-0078, DARPA Learning with Less Labels (LwLL) and FastNICS programs, and NSF-CIF awards #1813877 and #2008443.
201
+
202
+ References
203
+ [1] Blake Woodworth, Suriya Gunasekar, Jason D. Lee, Edward Moroshko, Pedro Savarese, Itay Golan, Daniel Soudry, and Nathan Srebro. Kernel and rich regimes in overparametrized models. In Jacob Abernethy and Shivani Agarwal, editors, Proceedings of Thirty Third Conference on Learning Theory, volume 125 of Proceedings of Machine Learning Research, pages 3635–3673. PMLR, 09–12 Jul 2020.
204
+ [2] Behrooz Ghorbani, Song Mei, Theodor Misiakiewicz, and Andrea Montanari. When do neural networks outperform kernel methods? arXiv preprint arXiv:2006.13409, 2020.
205
+ [3] Emmanuel J. Candès, Xiaodong Li, and Mahdi Soltanolkotabi. Phase retrieval via Wirtinger flow: theory and algorithms. IEEE Trans. Inf. Theory, 61(4):1985–2007, 2015.
206
+ [4] Yuxin Chen and Emmanuel J. Candès. Solving random quadratic systems of equations is nearly as easy as solving linear systems. Commun. Pure Appl. Math., 70(5):822–883, 2017.
207
+ [5] Cong Ma, Kaizheng Wang, Yuejie Chi, and Yuxin Chen. Implicit regularization in nonconvex statistical estimation: gradient descent converges linearly for phase retrieval, matrix completion, and blind deconvolution. Found. Comput. Math., 20(3):451–632, 2020.
208
+ [6] S. Tu, R. Boczar, M. Simchowitz, M. Soltanolkotabi, and B. Recht. Low-rank solutions of linear matrix equations via procrustes flow. In Proceedings of the 33rd International Conference on International Conference on Machine Learning (ICML), volume 48, pages 964–973. Journal of Machine Learning Research, 2016.
209
+ [7] Xiaodong Li, Shuyang Ling, Thomas Strohmer, and Ke Wei. Rapid, robust, and reliable blind deconvolution via nonconvex optimization. Appl. Comput. Harmon. Anal., 47(3):893–934, 2019.
210
+ [8] Shuyang Ling and Thomas Strohmer. Regularized gradient descent: a non-convex recipe for fast joint blind deconvolution and demixing. Inf. Inference, 8(1):1–49, 2019.
211
+ [9] Praneeth Netrapalli, Prateek Jain, and Sujay Sanghavi. Phase retrieval using alternating minimization. IEEE Trans. Signal Process., 63(18):4814–4826, 2015.
212
+ [10] Irène Waldspurger. Phase retrieval with random Gaussian sensing vectors by alternating projections. IEEE Trans. Inf. Theory, 64(5):3301–3312, 2018.
213
+ [11] Ju Sun, Qing Qu, and John Wright. When are nonconvex problems not scary? arXiv preprint arXiv:1510.06096, 2015.
214
+ [12] Yurii Nesterov and Boris T. Polyak. Cubic regularization of Newton method and its global performance. Math. Program., 108(1 (A)):177–205, 2006.
215
+ [13] Jorge Nocedal and Stephen J. Wright. Trust-region methods. Numerical Optimization, pages 66–100, 2006.
216
+ [14] Chi Jin, Rong Ge, Praneeth Netrapalli, Sham M. Kakade, and Michael I. Jordan. How to escape saddle points efficiently. page 1724–1732, 2017.
217
+ [15] 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.
218
+ [16] Maxim Raginsky, Alexander Rakhlin, and Matus Telgarsky. Non-convex learning via stochastic gradient langevin dynamics: a nonasymptotic analysis. pages 1674–1703, 2017.
219
+ [17] Yuchen Zhang, Percy Liang, and Moses Charikar. A hitting time analysis of stochastic gradient langevin dynamics. In Satyen Kale and Ohad Shamir, editors, Proceedings of the 2017 Conference on Learning Theory, volume 65 of Proceedings of Machine Learning Research, pages 1980–2022. PMLR, 07–10 Jul 2017.
220
+ [18] Jason D. Lee, Max Simchowitz, Michael I. Jordan, and Benjamin Recht. Gradient descent only converges to minimizers. In Vitaly Feldman, Alexander Rakhlin, and Ohad Shamir, editors, 29th Annual Conference on Learning Theory, volume 49 of Proceedings of Machine Learning Research, pages 1246–1257, Columbia University, New York, New York, USA, 23–26 Jun 2016. PMLR.
221
+ [19] Simon S Du, Chi Jin, Jason D Lee, Michael I Jordan, Aarti Singh, and Barnabas Poczos. Gradient descent can take exponential time to escape saddle points. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
222
+ [20] Sanjeev Arora, Nadav Cohen, Wei Hu, and Yuping Luo. Implicit regularization in deep matrix factorization. In Advances in Neural Information Processing Systems, pages 7413–7424, 2019.
223
+ [21] Yuxin Chen, Yuejie Chi, Jianqing Fan, and Cong Ma. Gradient descent with random initialization: fast global convergence for nonconvex phase retrieval. Math. Program., 176(1-2 (B)):5–37, 2019.
224
+ [22] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in neural information processing systems, pages 8571–8580, 2018.
225
+ [23] Samet Oymak and Mahdi Soltanolkotabi. Overparameterized nonlinear learning: Gradient descent takes the shortest path? In International Conference on Machine Learning, pages 4951–4960. PMLR, 2019.
226
+ [24] Samet Oymak and Mahdi Soltanolkotabi. Towards moderate overparameterization: global convergence guarantees for training shallow neural networks. IEEE Journal on Selected Areas in Information Theory, 2020.
227
+ [25] 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. PMLR, 2019.
228
+ [26] Sanjeev Arora, Simon S Du, Wei Hu, Zhiyuan Li, and Ruosong Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In 36th International Conference on Machine Learning, ICML 2019, pages 477–502. International Machine Learning Society (IMLS), 2019.
229
+ [27] Sam Buchanan, Dar Gilboa, and John Wright. Deep networks and the multiple manifold problem. In International Conference on Learning Representations, 2021.
230
+ [28] Zixiang Chen, Yuan Cao, Difan Zou, and Quanquan Gu. How much over-parameterization is sufficient to learn deep re{lu} networks? In International Conference on Learning Representations, 2021.
231
+ [29] Song Mei, Andrea Montanari, and Phan-Minh Nguyen. A mean field view of the landscape of two-layer neural networks. Proceedings of the National Academy of Sciences, 115(33):E7665– E7671, 2018.
232
+ [30] Lénaïc Chizat and Francis Bach. On the global convergence of gradient descent for overparameterized models using optimal transport. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31, pages 3036–3046. Curran Associates, Inc., 2018.
233
+ [31] Song Mei, Theodor Misiakiewicz, and Andrea Montanari. Mean-field theory of two-layers neural networks: dimension-free bounds and kernel limit. In Conference on Learning Theory, pages 2388–2464. PMLR, 2019.
234
+ [32] Adel Javanmard, Marco Mondelli, Andrea Montanari, et al. Analysis of a two-layer neural network via displacement convexity. Ann. Statist., 48(6):3619–3642, 2020.
235
+ [33] Justin Sirignano and Konstantinos Spiliopoulos. Mean field analysis of neural networks: a central limit theorem. Stochastic Processes Appl., 130(3):1820–1852, 2020.
236
+ [34] Lénaïc Chizat, Edouard Oyallon, and Francis Bach. On lazy training in differentiable programming. Advances in Neural Information Processing Systems, 32:2937–2947, 2019.
237
+ [35] Gene Golub and Charles F. Van Loan. Matrix computations. Baltimore, MD: The Johns Hopkins Univ. Press, 1996.
238
+ [36] Mark A Davenport and Justin Romberg. An overview of low-rank matrix recovery from incomplete observations. IEEE Journal of Selected Topics in Signal Processing, 10(4):608–622, 2016.
239
+ [37] Emmanuel J. Candès and Yaniv Plan. Tight oracle inequalities for low-rank matrix recovery from a minimal number of noisy random measurements. IEEE Trans. Inf. Theory, 57(4):2342–2359, 2011.
240
+ [38] Yuanzhi Li, Tengyu Ma, and Hongyang Zhang. Algorithmic regularization in over-parameterized matrix sensing and neural networks with quadratic activations. volume 75 of Proceedings of Machine Learning Research, pages 2–47. PMLR, 06–09 Jul 2018.
241
+ [39] Martin Slawski, Ping Li, and Matthias Hein. Regularization-free estimation in trace regression with symmetric positive semidefinite matrices. Advances in Neural Information Processing Systems, 28:2782–2790, 2015.
242
+ [40] Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018.
243
+ [41] Srinadh Bhojanapalli, Behnam Neyshabur, and Nati Srebro. Global optimality of local search for low rank matrix recovery. 29, 2016.
244
+ [42] Ji Chen, Dekai Liu, and Xiaodong Li. Nonconvex rectangular matrix completion via gradient descent without $\ell _ { 2 } , \infty$ regularization. IEEE Trans. Inf. Theory, 66(9):5806–5841, 2020.
245
+ [43] Emmanuel J. Candès and Benjamin Recht. Exact matrix completion via convex optimization. Found. Comput. Math., 9(6):717–772, 2009.
246
+ [44] Ali Ahmed, Benjamin Recht, and Justin Romberg. Blind deconvolution using convex programming. IEEE Trans. Inf. Theory, 60(3):1711–1732, 2014.
md/train/rsf1z-JSj87/rsf1z-JSj87.md ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # END-TO-END ADVERSARIAL TEXT-TO-SPEECH
2
+
3
+ Jeff Donahue∗, Sander Dieleman∗, Mikołaj Binkowski, Erich Elsen, Karen Simonyan ´ ∗ DeepMind {jeffdonahue,sedielem,binek,eriche,simonyan}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ Modern text-to-speech synthesis pipelines typically involve multiple processing stages, each of which is designed or learnt independently from the rest. In this work, we take on the challenging task of learning to synthesise speech from normalised text or phonemes in an end-to-end manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs. Our proposed generator is feed-forward and thus efficient for both training and inference, using a differentiable alignment scheme based on token length prediction. It learns to produce high fidelity audio through a combination of adversarial feedback and prediction losses constraining the generated audio to roughly match the ground truth in terms of its total duration and mel-spectrogram. To allow the model to capture temporal variation in the generated audio, we employ soft dynamic time warping in the spectrogram-based prediction loss. The resulting model achieves a mean opinion score exceeding 4 on a 5 point scale, which is comparable to the state-of-the-art models relying on multi-stage training and additional supervision.1
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A text-to-speech (TTS) system processes natural language text inputs to produce synthetic human-like speech outputs. Typical TTS pipelines consist of a number of stages trained or designed independently – e.g. text normalisation, aligned linguistic featurisation, mel-spectrogram synthesis, and raw audio waveform synthesis (Taylor, 2009). Although these pipelines have proven capable of realistic and high-fidelity speech synthesis and enjoy wide real-world use today, these modular approaches come with a number of drawbacks. They often require supervision at each stage, in some cases necessitating expensive “ground truth” annotations to guide the outputs of each stage, and sequential training of the stages. Further, they are unable to reap the full potential rewards of data-driven “end-to-end" learning widely observed in a number of prediction and synthesis task domains across machine learning.
12
+
13
+ In this work, we aim to simplify the TTS pipeline and take on the challenging task of synthesising speech from text or phonemes in an end-to-end manner. We propose EATS – End-to-end Adversarial Text-to-Speech – generative models for TTS trained adversarially (Goodfellow et al., 2014) that operate on either pure text or raw (temporally unaligned) phoneme input sequences, and produce raw speech waveforms as output. These models eliminate the typical intermediate bottlenecks present in most state-of-the-art TTS engines by maintaining learnt intermediate feature representations throughout the network.
14
+
15
+ Our speech synthesis models are composed of two high-level submodules, detailed in Section 2. An aligner processes the raw input sequence and produces relatively low-frequency $( 2 0 0 \ : \mathrm { H z } )$ aligned features in its own learnt, abstract feature space. The features output by the aligner may be thought of as taking the place of the earlier stages of typical TTS pipelines – e.g., temporally aligned melspectrograms or linguistic features. These features are then input to the decoder which upsamples the features from the aligner by 1D convolutions to produce $2 4 \mathrm { k H z }$ audio waveforms.
16
+
17
+ By carefully designing the aligner and guiding training by a combination of adversarial feedback and domain-specific loss functions, we demonstrate that a TTS system can be learnt nearly end-to-end, resulting in high-fidelity natural-sounding speech approaching the state-of-the-art TTS systems. Our main contributions include:
18
+
19
+ • A fully differentiable and efficient feed-forward aligner architecture that predicts the duration of each input token and produces an audio-aligned representation.
20
+ • The use of flexible dynamic time warping-based prediction losses to enforce alignment with input conditioning while allowing the model to capture the variability of timing in human speech.
21
+ • An overall system achieving a mean opinion score of 4.083, approaching the state of the art from models trained using richer supervisory signals.
22
+
23
+ # 2 METHOD
24
+
25
+ Our goal is to learn a neural network (the generator) which maps an input sequence of characters or phonemes to raw audio at $2 4 \mathrm { k H z }$ . Beyond the vastly different lengths of the input and output signals, this task is also challenging because the input and output are not aligned, i.e. it is not known beforehand which output tokens each input token will correspond to. To address these challenges, we divide the generator into two blocks: (i) the aligner, which maps the unaligned input sequence to a representation which is aligned with the output, but has a lower sample rate of $2 0 0 \mathrm { H z }$ ; and (ii) the decoder, which upsamples the aligner’s output to the full audio frequency. The entire generator architecture is differentiable, and is trained end to end. Importantly, it is also a feed-forward convolutional network, which makes it well-suited for applications where fast batched inference is important: our EATS implementation generates speech at a speed of $2 0 0 \times$ realtime on a single NVIDIA V100 GPU (see Appendix A and Table 3 for details). It is illustrated in Figure 1.
26
+
27
+ The generator is inspired by GAN-TTS (Binkowski et al., 2020), a text-to-speech generative ad- ´ versarial network operating on aligned linguistic features. We employ the GAN-TTS generator as the decoder in our model, but instead of upsampling pre-computed linguistic features, its input comes from the aligner block. We make it speaker-conditional by feeding in a speaker embedding s alongside the latent vector $\mathbf { z }$ , to enable training on a larger dataset with recordings from multiple speakers. We also adopt the multiple random window discriminators (RWDs) from GAN-TTS, which have been proven effective for adversarial raw waveform modelling, and we preprocess real audio input by applying a simple $\mu$ -law transform. Hence, the generator is trained to produce audio in the $\mu$ -law domain and we apply the inverse transformation to its outputs when sampling.
28
+
29
+ The loss function we use to train the generator is as follows:
30
+
31
+ $$
32
+ \mathcal { L } _ { G } = \mathcal { L } _ { G , \mathrm { a d v } } + \lambda _ { \mathrm { p r e d } } \cdot \mathcal { L } _ { \mathrm { p r e d } } ^ { \prime \prime } + \lambda _ { \mathrm { l e n g t h } } \cdot \mathcal { L } _ { \mathrm { l e n g t h } } ,
33
+ $$
34
+
35
+ where $\mathcal { L } _ { G , \mathrm { a d v } }$ is the adversarial loss, linear in the discriminators’ outputs, paired with the hinge loss (Lim & Ye, 2017; Tran et al., 2017) used as the discriminators’ objective, as used in GANTTS (Binkowski et al., 2020). The use of an adversarial (Goodfellow et al., 2014) loss is an advantage ´ of our approach, as this setup allows for efficient feed-forward training and inference, and such losses tend to be mode-seeking in practice, a useful behaviour in a strongly conditioned setting where realism is an important design goal, as in the case of text-to-speech. In the remainder of this section, we describe the aligner network and the auxiliary predictiondetail, and recap the components which were adopted from G $( \mathcal { L } _ { \mathrm { { p r e d } } } ^ { \prime \prime } )$ and lengthS. $( \mathcal { L } _ { \mathrm { l e n g t h } } )$ losses in
36
+
37
+ # 2.1 ALIGNER
38
+
39
+ Given a token sequence ${ \bf x } = ( x _ { 1 } , \dots , x _ { N } )$ of length $N$ , we first compute token representations ${ \bf h } = f ( { \bf x } , { \bf z } , { \bf s } )$ , where $f$ is a stack of dilated convolutions (van den Oord et al., 2016) interspersed with batch normalisation (Ioffe & Szegedy, 2015) and ReLU activations. The latents $\mathbf { z }$ and speaker embedding s modulate the scale and shift parameters of the batch normalisation layers (Dumoulin et al., 2017; De Vries et al., 2017). We then predict the length for each input token individually: $l _ { n } = g ( h _ { n } , \mathbf { z } , \mathbf { s } )$ , where $g$ is an MLP. We use a ReLU nonlinearity at the output to ensure that the predicted lengths are non-sum of the token lengths: $\begin{array} { r } { e _ { n } = \sum _ { m = 1 } ^ { n } l _ { m } } \end{array}$ then find the predicted token end p, and the token centre positions as $\begin{array} { r } { c _ { n } = e _ { n } - \frac { 1 } { 2 } l _ { n } } \end{array}$ mulative. Based on these predicted positions, we can interpolate the token representations into an audio-aligned representation at $2 0 0 \mathrm { H z }$ , $\mathbf { a } = ( a _ { 1 } , \ldots , a _ { S } )$ , where $S = \lceil e _ { N } \rceil$ is the total number of output time steps. To compute $a _ { t }$ , we obtain interpolation weights for the token representations $h _ { n }$ using a softmax over the squared distance between $t$ and $c _ { n }$ , scaled by a temperature parameter $\sigma ^ { 2 }$ , which we set to 10.0 (i.e. a Gaussian kernel):
40
+
41
+ $$
42
+ w _ { t } ^ { n } = \frac { \exp { \left( - \sigma ^ { - 2 } ( t - c _ { n } ) ^ { 2 } \right) } } { \sum _ { m = 1 } ^ { N } \exp { \left( - \sigma ^ { - 2 } ( t - c _ { m } ) ^ { 2 } \right) } } .
43
+ $$
44
+
45
+ Using these weights, we can then compute $\begin{array} { r } { a _ { t } \ = \ \sum _ { n = 1 } ^ { N } w _ { t } ^ { n } h _ { n } } \end{array}$ , which amounts to non-uniform interpolation. By predicting token lengths and obtaining positions using cumulative summation, instead of predicting positions directly, we implicitly enforce monotonicity of the alignment. Note that tokens which have a non-monotonic effect on prosody, such as punctuation, can still affect the entire utterance thanks to the stack of dilated convolutions $f$ , whose receptive field is large enough to allow for propagation of information across the entire token sequence. The convolutions also ensure generalisation across different sequence lengths. Appendix B includes pseudocode for the aligner.
46
+
47
+ # 2.2 WINDOWED GENERATOR TRAINING
48
+
49
+ Training examples vary widely in length, from about 1 to 20 seconds. We cannot pad all sequences to a maximal length during training, as this would be wasteful and prohibitively expensive: 20 seconds of audio at $2 4 \mathrm { k H z }$ correspond to 480,000 timesteps, which results in high memory requirements. Instead, we randomly extract a 2 second window from each example, which we will refer to as a training window, by uniformly sampling a random offset $\eta$ . The aligner produces a $2 0 0 \mathrm { H z }$ audio-aligned representation for this window, which is then fed to the decoder (see Figure 1). Note that we only need to compute $a _ { t }$ for time steps $t$ that fall within the sampled window, but we do have to compute the predicted token lengths $l _ { n }$ for the entire input sequence. During evaluation, we simply produce the audio-aligned representation for the full utterance and run the decoder on it, which is possible because it is fully convolutional.
50
+
51
+ # 2.3 ADVERSARIAL DISCRIMINATORS
52
+
53
+ ![](images/e8346596cd53edabed8d93e517d344c6bdce1b87d2b7209f1d540d66775d362c.jpg)
54
+ Figure 1: A diagram of the generator, including the monotonic interpolation-based aligner. $z$ and ch denote the latent Gaussian vector and the number of output channels, respectively. During training, audio windows have a fixed length of 2 seconds and are generated from the conditioning text using random offsets $\eta$ and predicted phoneme lengths; the shaded areas in the logits grid and waveform are not synthesised. For inference (sampling), we set $\eta = 0$ . In the No Phonemes ablation, the phonemizer is skipped and the character sequence is fed directly into the aligner.
55
+
56
+ Random window discriminators. We use an ensemble of random window discriminators (RWDs) adopted from GAN-TTS. Each RWD operates on audio fragments of different lengths, randomly sampled from the training window. We use five RWDs with window sizes 240, 480, 960, 1920 and 3600. This enables each RWD to operate at a different resolution. Note that 3600 samples at $2 4 ~ \mathrm { k H z }$ corresponds to $1 5 0 ~ \mathrm { m s }$ of audio, so all RWDs operate on short timescales. All RWDs in our model are unconditional with respect to text: they cannot access the text sequence or the aligner output. (GAN-TTS uses 10 RWDs, including 5 conditioned on linguistic features which we omit.) They are, however, conditioned on the speaker, via projection embedding (Miyato & Koyama, 2018).
57
+
58
+ Spectrogram discriminator. We use an additional discriminator which operates on the full training window in the spectrogram domain. We extract log-scaled mel-spectrograms from the audio signals and use the BigGAN-deep architecture (Brock et al., 2018), essentially treating the spectrograms as
59
+
60
+ images. The spectrogram discriminator also uses speaker identity through projection embedding.
61
+ Details on the spectrogram discriminator architecture are included in Appendix C.
62
+
63
+ # 2.4 SPECTROGRAM PREDICTION LOSS
64
+
65
+ In preliminary experiments, we discovered that adversarial feedback is insufficient to learn alignment. At the start of training, the aligner does not produce an accurate alignment, so the information in the input tokens is incorrectly temporally distributed. This encourages the decoder to ignore the aligner output. The unconditional discriminators provide no useful learning signal to correct this. If we want to use conditional discriminators instead, we face a different problem: we do not have aligned ground truth. Conditional discriminators also need an aligner module, which cannot function correctly at the start of training, effectively turning them into unconditional discriminators. Although it should be possible in theory to train the discriminators’ aligner modules adversarially, we find that this does not work in practice, and training gets stuck.
66
+
67
+ Instead, we propose to guide learning by using an explicit prediction loss in the spectrogram domain: we minimise the $L _ { 1 }$ loss between the log-scaled mel-spectrograms of the generator output, and the corresponding ground truth training window. This helps training to take off, and renders conditional discriminators unnecessary, simplifying the model. Let $S _ { \mathrm { g e n } }$ be the spectrogram of the generated audio, $S _ { \mathrm { g t } }$ the spectrogram of the corresponding ground truth, and $S [ t , f ]$ the log-scaled magnitude at time step $t$ and mel-frequency bin $f$ . Then the prediction loss is:
68
+
69
+ $$
70
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { p r e d } } = \frac { 1 } { F } \sum _ { t = 1 } ^ { T } \sum _ { f = 1 } ^ { F } | S _ { \mathrm { g e n } } [ t , f ] - S _ { \mathrm { g t } } [ t , f ] | . } \end{array}
71
+ $$
72
+
73
+ $T$ and $F$ are the total number of time steps and mel-frequency bins respectively. Computing the prediction loss in the spectrogram domain, rather than the time domain, has the advantage of increased invariance to phase differences between the generated and ground truth signals, which are not perceptually salient. Seeing as the spectrogram extraction operation has several hyperparameters and its implementation is not standardised, we provide the code we used for this in Appendix D. We applied a small amount of jitter (by up to $\pm 6 0$ samples at $2 4 \mathrm { k H z }$ ) to the ground truth waveform before computing $S _ { \mathrm { g t } }$ , which helped to reduce artifacts in the generated audio.
74
+
75
+ The inability to learn alignment from adversarial feedback alone is worth expanding on: likelihoodbased autoregressive models have no issues learning alignment, because they are able to benefit from teacher forcing (Williams & Zipser, 1989) during training: the model is trained to perform next step prediction on each sequence step, given the preceding ground truth, and it is expected to infer alignment only one step at a time. This is not compatible with feed-forward adversarial models however, so the prediction loss is necessary to bootstrap alignment learning for our model.
76
+
77
+ Note that although we make use of mel-spectrograms for training in $\mathcal { L } _ { \mathrm { p r e d } }$ (and to compute the inputs for the spectrogram discriminator, Section 2.3), the generator itself does not produce spectrograms as part of the generation process. Rather, its outputs are raw waveforms, and we convert these waveforms to spectrograms only for training (backpropagating gradients through the waveform to mel-spectrogram conversion operation).
78
+
79
+ # 2.5 DYNAMIC TIME WARPING
80
+
81
+ The spectrogram prediction loss incorrectly assumes that token lengths are deterministic. We can relax the requirement that the generated and ground truth spectrograms are exactly aligned, by incorporating dynamic time warping (DTW) (Sakoe, 1971; Sakoe & Chiba, 1978). We calculate the prediction loss by iteratively finding a minimal-cost alignment path $p$ between the generated and target spectrograms, $S _ { \mathrm { g e n } }$ and $S _ { \mathrm { g t } }$ . We start at the first time step in both spectrograms: $p _ { \mathrm { g e n , 1 } } = p _ { \mathrm { g t , 1 } } = 1$ At each iteration $k$ , we take one of three possible actions:
82
+
83
+ 1. go to the next time step in both $S _ { \mathrm { g e n } } , S _ { \mathrm { g t } } \colon p _ { \mathrm { g e n } , k + 1 } = p _ { \mathrm { g e n } , k } + 1 , p _ { \mathrm { g t } , k + 1 } = p _ { \mathrm { g t } , k } + 1 ;$
84
+ 2. go to the next time step in $S _ { \mathrm { g t } }$ only: $p _ { \mathrm { g e n } , k + 1 } = p _ { \mathrm { g e n } , k } , p _ { \mathrm { g t } , k + 1 } = p _ { \mathrm { g t } , k } + 1$ ;
85
+ 3. go to the next time step in $S _ { \mathrm { g e n } }$ only: $p _ { \mathrm { g e n } , k + 1 } = p _ { \mathrm { g e n } , k } + 1$ , pgt,k+1 = pgt,k.
86
+
87
+ The resulting path is $p = \langle ( p _ { \mathrm { g e n } , 1 } , p _ { \mathrm { g t } , 1 } ) , \dots , ( p _ { \mathrm { g e n } , K _ { p } } , p _ { \mathrm { g t } , K _ { p } } ) \rangle$ , where $K _ { p }$ is the length. Each action is assigned a cost based on the $L _ { 1 }$ distance between $S _ { \mathrm { g e n } } [ p _ { \mathrm { g e n } , k } ]$ and $\mathrm { \dot { \cal S } } _ { \mathrm { g t } } [ p _ { \mathrm { g t } , k } ]$ , and a warp penalty $w$ which is incurred if we choose not to advance both spectrograms in lockstep (i.e. we are warping the spectrogram by taking action 2 or 3; we use $w = 1 . 0$ ). The warp penalty thus encourages alignment paths that do not deviate too far from the identity alignment. Let $\delta _ { k }$ be an indicator which is 1 for iterations where warping occurs, and 0 otherwise. Then the total path cost $c _ { p }$ is:
88
+
89
+ $$
90
+ \begin{array} { r } { c _ { p } = \sum _ { k = 1 } ^ { K _ { p } } \Big ( \boldsymbol { w } \cdot \boldsymbol { \delta _ { k } } + \frac { 1 } { F } \sum _ { f = 1 } ^ { F } | S _ { \mathrm { g e n } } [ p _ { \mathrm { g e n } , k } , f ] - S _ { \mathrm { g t } } [ p _ { \mathrm { g t } , k } , f ] | \Big ) . } \end{array}
91
+ $$
92
+
93
+ depends on the degree of warping $( T \leq K _ { p } \leq 2 T - 1 )$ . The DTW prediction loss is then:
94
+
95
+ $$
96
+ \mathcal { L } _ { \mathrm { p r e d } } ^ { \prime } = \operatorname* { m i n } _ { p \in \mathcal { P } } c _ { p } ,
97
+ $$
98
+
99
+ where $\mathcal { P }$ is the set of all valid paths. $p \in \mathcal P$ only when $p _ { \mathrm { g e n , 1 } } = p _ { \mathrm { g t , 1 } } = 1$ and $p _ { \mathrm { g e n } , K _ { p } } = p _ { \mathrm { g t } , K _ { p } } = T$ i.e. the first and last timesteps of the spectrograms are aligned. To find the minimum, we use dynamic programming. Figure 2 shows a diagram of an optimal alignment path between two sequences.
100
+
101
+ DTW is differentiable, but the minimum across all paths makes optimisation difficult, because the gradient is propagated only through the minimal path. We use a soft version of DTW instead (Cuturi & Blondel, 2017), which replaces the minimum with the soft minimum:
102
+
103
+ $$
104
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { p r e d } } ^ { \prime \prime } = - \tau \cdot \log \sum _ { p \in \mathcal { P } } \exp \left( - \frac { c _ { p } } { \tau } \right) , } \end{array}
105
+ $$
106
+
107
+ where $\tau = 0 . 0 1$ is a temperature parameter and the loss scale factor $\lambda _ { \mathrm { p r e d } } = 1 . 0$ . Note that the minimum operation is recovered by letting $\tau 0$ . The resulting loss is a weighted aggregated cost across all paths, enabling gradient propagation through all feasible paths. This creates a trade-off: a higher $\tau$ makes optimisation easier, but the resulting loss less accurately reflects the minimal path cost. Pseudocode for the soft DTW procedure is provided in Appendix E.
108
+
109
+ By relaxing alignment in the prediction loss, the generator can produce waveforms that are not exactly aligned, without being heavily penalised for it. This creates a synergy with the adversarial loss: instead of working against each other because of the rigidity of the prediction loss, the losses now cooperate to reward realistic audio generation with stochastic alignment. Note that the prediction loss is computed on a training window, and not on full length utterances, so we still assume that the start and end points of the windows are exactly aligned. While this might be incorrect, it does not seem to be much of a problem in practice.
110
+
111
+ ![](images/3ec946c31ee94122d585bbdb325279673d19931189642e35e802f93e8666c4d4.jpg)
112
+ Figure 2: Dynamic time warping between two sequences finds a minimal-cost alignment path. Positions where warping occurs are marked with a border.
113
+
114
+ # 2.6 ALIGNER LENGTH LOSS
115
+
116
+ To ensure that the model produces realistic token length predictions, we add a loss which encourages the predicted utterance length to be close to the ground truth length. This length is found by summing all token length predictions. Let $L$ be the the number of time steps in the training utterance at $2 0 0 \mathrm { H z }$ , $l _ { n }$ the predicted length of the $n$ th token, and $N$ the number of tokens, then the length loss is:
117
+
118
+ $$
119
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { l e n g t h } } = \frac { 1 } { 2 } \left( L - \sum _ { n = 1 } ^ { N } l _ { n } \right) ^ { 2 } . } \end{array}
120
+ $$
121
+
122
+ We use a scale factor $\lambda _ { \mathrm { l e n g t h } } = 0 . 1$ . Note that we cannot match the predicted lengths $l _ { n }$ to the ground truth lengths individually, because the latter are not available.
123
+
124
+ # 2.7 TEXT PRE-PROCESSING
125
+
126
+ Although our model works well with character input, we find that sample quality improves significantly using phoneme input instead. This is not too surprising, given the heterogeneous way in which spellings map to phonemes, particularly in the English language. Many character sequences also have special pronunciations, such as numbers, dates, units of measurement and website domains, and a very large training dataset would be required for the model to learn to pronounce these correctly. Text normalisation (Zhang et al., 2019) can be applied beforehand to spell out these sequences as they are typically pronounced (e.g., 1976 could become nineteen seventy six), potentially followed by conversion to phonemes. We use an open source tool, phonemizer (Bernard, 2020), which performs partial normalisation and phonemisation (see Appendix F). Finally, whether we train on text or phoneme input sequences, we pre- and post-pad the sequence with a special silence token (for training and inference), to allow the aligner to account for silence at the beginning and end of each utterance.
127
+
128
+ # 3 RELATED WORK
129
+
130
+ Speech generation saw significant quality improvements once treating it as a generative modelling problem became the norm (Zen et al., 2009; van den Oord et al., 2016). Likelihood-based approaches dominate, but generative adversarial networks (GANs) (Goodfellow et al., 2014) have been making significant inroads recently. A common thread through most of the literature is a separation of the speech generation process into multiple stages: coarse-grained temporally aligned intermediate representations, such as mel-spectrograms, are used to divide the task into more manageable subproblems. Many works focus exclusively on either spectrogram generation or vocoding (generating a waveform from a spectrogram). Our work is different in this respect, and we will point out which stages of the generation process are addressed by each model. In Appendix J, Table 6 we compare these methods in terms of the inputs and outputs to each stage of their pipelines.
131
+
132
+ Initially, most likelihood-based models for TTS were autoregressive (van den Oord et al., 2016; Mehri et al., 2017; Arik et al., 2017), which means that there is a sequential dependency between subsequent time steps of the produced output signal. That makes these models impractical for real-time use, although this can be addressed with careful engineering (Kalchbrenner et al., 2018; Valin & Skoglund, 2019). More recently, flow-based models (Papamakarios et al., 2019) have been explored as a feed-forward alternative that enables fast inference (without sequential dependencies). These can either be trained directly using maximum likelihood (Prenger et al., 2019; Kim et al., 2019; Ping et al., 2019b), or through distillation from an autoregressive model (van den Oord et al., 2018; Ping et al., 2019a). All of these models produce waveforms conditioned on an intermediate representation: either spectrograms or “linguistic features”, which contain temporally-aligned high-level information about the speech signal. Spectrogram-conditioned waveform models are often referred to as vocoders.
133
+
134
+ A growing body of work has applied GAN (Goodfellow et al., 2014) variants to speech synthesis (Donahue et al., 2019). An important advantage of adversarial losses for TTS is a focus on realism over diversity; the latter is less important in this setting. This enables a more efficient use of capacity compared to models trained with maximum likelihood. MelGAN (Kumar et al., 2019) and Parallel WaveGAN (Yamamoto et al., 2020) are adversarial vocoders, producing raw waveforms from mel-spectrograms. Neekhara et al. (2019) predict magnitude spectrograms from mel-spectrograms. Most directly related to our work is GAN-TTS (Binkowski et al., 2020), which produces waveforms ´ conditioned on aligned linguistic features, and we build upon that work.
135
+
136
+ Another important line of work covers spectrogram generation from text. Such models rely on a vocoder to convert the spectrograms into waveforms (for which one of the previously mentioned models could be used, or a traditional spectrogram inversion technique (Griffin & Lim, 1984)). Tacotron 1 & 2 (Wang et al., 2017; Shen et al., 2018), Deep Voice 2 & 3 (Gibiansky et al., 2017; Ping et al., 2018), TransformerTTS (Li et al., 2019), Flowtron (Valle et al., 2020), and VoiceLoop (Taigman et al., 2017) are autoregressive models that generate spectrograms or vocoder features frame by frame. Guo et al. (2019) suggest using an adversarial loss to reduce exposure bias (Bengio et al., 2015; Ranzato et al., 2016) in such models. MelNet (Vasquez & Lewis, 2019) is autoregressive over both time and frequency. ParaNet (Peng et al., 2019) and FastSpeech (Ren et al., 2019) are nonautoregressive, but they require distillation (Hinton et al., 2015) from an autoregressive model. Recent flow-based approaches Flow-TTS (Miao et al., 2020) and Glow-TTS (Kim et al., 2020) are feedforward without requiring distillation. Most spectrogram generation models require training of a custom vocoder model on generated spectrograms, because their predictions are imperfect and the vocoder needs to be able to compensate for this2. Note that some of these works also propose new vocoder architectures in tandem with spectrogram generation models.
137
+
138
+ Unlike all of the aforementioned methods, as highlighted in Appendix J, Table 6, our model is a single feed-forward neural network, trained end-to-end in a single stage, which produces waveforms given character or phoneme sequences, and learns to align without additional supervision from auxiliary sources (e.g. temporally aligned linguistic features from an external model) or teacher forcing. This simplifies the training process considerably. Char2wav (Sotelo et al., 2017) is finetuned end-to-end in the same fashion, but requires a pre-training stage with vocoder features used for intermediate supervision.
139
+
140
+ Spectrogram prediction losses have been used extensively for feed-forward audio prediction models (Yamamoto et al., 2019; 2020; Yang et al., 2020; Arık et al., 2018; Engel et al., 2020; Wang et al.,
141
+
142
+ 2019; Défossez et al., 2018). We note that the $L _ { 1 }$ loss we use (along with (Défossez et al., 2018)), is comparatively simple, as spectrogram losses in the literature tend to have separate terms penalising magnitudes, log-magnitudes and phase components, each with their own scaling factors, and often across multiple resolutions. Dynamic time warping on spectrograms is a component of many speech recognition systems (Sakoe, 1971; Sakoe & Chiba, 1978), and has also been used for evaluation of TTS systems (Sailor & Patil, 2014; Chevelu et al., 2015). Cuturi & Blondel (2017) proposed the soft version of DTW we use in this work as a differentiable loss function for time series models. Kim et al. (2020) propose Monotonic Alignment Search (MAS), which relates to DTW in that both use dynamic programming to implicitly align sequences for TTS. However, they have different goals: MAS finds the optimal alignment between the text and a latent representation, whereas we use DTW to relax the constraints imposed by our spectrogram prediction loss term. Several mechanisms have been proposed to exploit monotonicity in tasks that require sequence alignment, including attention mechanisms (Graves, 2013; Zhang et al., 2018; Vasquez & Lewis, 2019; He et al., 2019; Raffel et al., 2017; Chiu & Raffel, 2018), loss functions (Graves et al., 2006; Graves, 2012) and search-based approaches (Kim et al., 2020). For TTS, incorporating this constraint has been found to help generalisation to long sequences (Battenberg et al., 2020). We incorporate monotonicity by using an interpolation mechanism, which is cheap to compute because it is not recurrent (unlike many monotonic attention mechanisms).
143
+
144
+ # 4 EVALUATION
145
+
146
+ In this section we discuss the setup and results of our empirical evaluation, describing the hyperparameter settings used for training and validating the architectural decisions and loss function components detailed in Section 2. Our primary metric used to evaluate speech quality is the Mean Opinion Score (MOS) given by human raters, computed by taking the mean of 1-5 naturalness ratings given across 1000 held-out conditioning sequences. In Appendix I we also report the Fréchet DeepSpeech Distance (FDSD), proposed by Binkowski et al. (2020) as a speech synthesis quality metric. Appendix A ´ reports training and evaluation hyperparameters we used for all experiments.
147
+
148
+ # 4.1 MULTI-SPEAKER DATASET
149
+
150
+ We train all models on a private dataset that consists of high-quality recordings of human speech performed by professional voice actors, and corresponding text. The voice pool consists of 69 female and male voices of North American English speakers, while the audio clips contain full sentences of lengths varying from less than 1 to 20 seconds at $2 4 \mathrm { k H z }$ frequency. Individual voices are unevenly distributed, accounting for from 15 minutes to over 51 hours of recorded speech, totalling 260.49 hours. At training time, we sample 2 second windows from the individual clips, post-padding those shorter than 2 seconds with silence. For evaluation, we focus on the single most prolific speaker in our dataset, with all our main MOS results reported with the model conditioned on that speaker ID, but also report MOS results for each of the top four speakers using our main multi-speaker model.
151
+
152
+ # 4.2 RESULTS
153
+
154
+ In Table 1 we present quantitative results for our EATS model described in Section 2, as well as several ablations of the different model and learning signal components. The architecture and training setup of each ablation is identical to our base EATS model except in terms of the differences described by the columns in Table 1. Each ablation is “subtractive”, representing the full EATS system minus one particular feature. Our main result achieved by the base multi-speaker model is a mean opinion score (MOS) of 4.083. Although it is difficult to compare directly with prior results from the literature due to dataset differences, we nonetheless include MOS results from prior works (Binkowski et al., ´ 2020; van den Oord et al., 2016; 2018), with MOS in the 4.2 to $4 . 4 +$ range. Compared to these prior models, which rely on aligned linguistic features, EATS uses substantially less supervision.
155
+
156
+ The No RWDs, No MelSpecD, and No Discriminators ablations all achieved substantially worse MOS results than our proposed model, demonstrating the importance of adversarial feedback. In particular, the No RWDs ablation, with an MOS of 2.526, demonstrates the importance of the raw audio feedback, and removing RWDs significantly degrades the high frequency components. No MelSpecD causes intermittent artifacts and distortion, and removing all discriminators results in audio that sounds robotic and distorted throughout. The No $\mathcal { L } _ { \mathrm { l e n g t h } }$ and No $\mathcal { L } _ { \mathrm { p r e d } }$ ablations result in a model that does not train at all. Comparing our model with No DTW (MOS 3.559), the temporal flexibility provided by dynamic time warping significantly improves fidelity: removing it causes warbling and unnatural phoneme lengths. No Phonemes is trained with raw character inputs and attains MOS 3.423, due to occasional mispronunciations and unusual stress patterns. No Mon. Int. uses an aligner with a transformer-based attention mechanism (described in Appendix G) in place of our monotonic interpolation architecture, which turns out to generalise poorly to long utterances (yielding MOS 3.551). Finally, comparing against training with only a Single Speaker (MOS 3.829) shows that our EATS model benefits from a much larger multi-speaker dataset, even though MOS is evaluated only on this same single speaker on which the ablation was solely trained. Samples from each ablation are available at https://deepmind.com/research/publications/ End-to-End-Adversarial-Text-to-Speech.
157
+
158
+ Table 1: Mean Opinion Scores (MOS) for our final EATS model and the ablations described in Section 4, sorted by MOS. The middle columns indicate which components of our final model are enabled or ablated. Data describes the training set as Multispeaker (MS) or Single Speaker (SS). Inputs describes the inputs as raw characters (Ch) or phonemes $\mathrm { ( P h ) }$ produced by Phonemizer. RWD (Random Window Discriminators), $M S D$ (Mel-spectrogram Discriminator), and $\mathcal { L } _ { \mathrm { l e n g t h } }$ (length prediction loss) indicate the presence $( \checkmark )$ or absence $( \times )$ of each of these training components described in Section 2. $\mathcal { L } _ { \mathrm { p r e d } }$ indicates which spectrogram prediction loss was used: with DTW $( \mathcal { L } _ { \mathrm { p r e d } } ^ { \prime \prime }$ , Eq. 6), without DTW $\scriptstyle \sum _ { \mathrm { p r e d } }$ , Eq. 3), or absent $( \times )$ . Align describes the architecture of the aligner as monotonic interpolation (MI) or attention-based (Attn). We also compare against recent state-of-the-art approaches from the literature which are trained on aligned linguistic features (unlike our models). Our MOS evaluation set matches that of GAN-TTS (Binkowski et al., 2020) (and our ´ “Single Speaker” training subset matches the GAN-TTS training set); the other approaches are not directly comparable due to dataset differences.
159
+
160
+ <table><tr><td>Model</td><td>Data Inputs</td><td>RWD</td><td></td><td>MSD</td><td>Llength</td><td>Lpred Align</td><td>MOS</td></tr><tr><td>Natural Speech</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4.55 ± 0.075</td></tr><tr><td>GAN-TTS (Binkowski et al., 2020)</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4.213 ± 0.046</td></tr><tr><td>WaveNet (van den Oord et al.,2016)</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4.41 ± 0.069</td></tr><tr><td>Par: WaveNet (van den Oord et al.,2018)</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4.41 ± 0.078</td></tr><tr><td>Tacotron 2 (Shen et al.,2018)</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4.526 ±0.066</td></tr><tr><td>No Llength</td><td>MS</td><td>Ph</td><td>&gt;&gt;×</td><td></td><td></td><td>MI</td><td>[does not train]</td></tr><tr><td>NoLpred</td><td>MS</td><td>Ph</td><td></td><td>×</td><td>×</td><td>MI</td><td>[does not train]</td></tr><tr><td>No Discriminators</td><td>MS</td><td>Ph</td><td>&lt;&gt;×</td><td></td><td></td><td>MI</td><td>1.407 ± 0.040</td></tr><tr><td>No RWDs</td><td>MS</td><td>Ph</td><td></td><td></td><td></td><td>MI</td><td>2.526 ± 0.060</td></tr><tr><td>No Phonemes</td><td>MS</td><td>Ch</td><td></td><td></td><td></td><td>MI</td><td>3.423 ± 0.073</td></tr><tr><td>No MelSpecD</td><td>MS</td><td>Ph</td><td></td><td></td><td></td><td>MI</td><td>3.525 ± 0.057</td></tr><tr><td>No Mon. Int.</td><td>MS</td><td>Ph</td><td>√ √</td><td></td><td></td><td>Attn</td><td>3.551 ± 0.073</td></tr><tr><td>No DTW</td><td>MS</td><td>Ph</td><td>√</td><td></td><td></td><td>MI</td><td>3.559 ± 0.065</td></tr><tr><td>Single Speaker</td><td>SS</td><td>Ph</td><td>√</td><td>&lt;&gt;&gt;×&lt;&gt;&gt;</td><td></td><td>MI</td><td>3.829 ± 0.055</td></tr><tr><td>EATS (Ours)</td><td>MS</td><td>Ph</td><td>√</td><td>√</td><td>√</td><td>Lpred MI</td><td>4.083±0.049</td></tr></table>
161
+
162
+ Table 2: Mean Opinion Scores (MOS) for the top four speakers with the most data in our training set. All evaluations are done using our single multi-speaker EATS model.
163
+
164
+ <table><tr><td>Speaker</td><td>#1</td><td>#2</td><td>#3</td><td>#4</td></tr><tr><td>Speaking Time (Hours)</td><td>51.68</td><td>31.21</td><td>20.68</td><td>10.32</td></tr><tr><td>MOS</td><td>4.083 ± 0.049</td><td>3.828 ± 0.051</td><td>4.149 ± 0.045</td><td>3.761 ± 0.052</td></tr></table>
165
+
166
+ We demonstrate that the aligner learns to use the latent vector z to vary the predicted token lengths in Appendix H. In Table 2 we present additional MOS results from our main multi-speaker EATS model for the four most prolific speakers in our training data3. MOS generally improves with more training data, although the correlation is imperfect (e.g., Speaker #3 achieves the highest MOS with only the third most training data).
167
+
168
+ # 5 DISCUSSION
169
+
170
+ We have presented an adversarial approach to text-to-speech synthesis which can learn from a relatively weak supervisory signal – normalised text or phonemes paired with corresponding speech audio. The speech generated by our proposed model matches the given conditioning texts and generalises to unobserved texts, with naturalness judged by human raters approaching state-of-the-art systems with multi-stage training pipelines or additional supervision. The proposed system described in Section 2 is efficient in both training and inference. In particular, it does not rely on autoregressive sampling or teacher forcing, avoiding issues like exposure bias (Bengio et al., 2015; Ranzato et al., 2016) and reduced parallelism at inference time, or the complexities introduced by distillation to a more efficient feed-forward model after the fact (van den Oord et al., 2018; Ping et al., 2019a).
171
+
172
+ While there remains a gap between the fidelity of the speech produced by our method and the stateof-the-art systems, we nonetheless believe that the end-to-end problem setup is a promising avenue for future advancements and research in text-to-speech. End-to-end learning enables the system as a whole to benefit from large amounts of training data, freeing models to optimise their intermediate representations for the task at hand, rather than constraining them to work with the typical bottlenecks (e.g., mel-spectrograms, aligned linguistic features) imposed by most TTS pipelines today. We see some evidence of this occurring in the comparison between our main result, trained using data from 69 speakers, against the Single Speaker ablation: the former is trained using roughly four times the data and synthesises more natural speech in the single voice on which the latter is trained.
173
+
174
+ Notably, our current approach does not attempt to address the text normalisation and phonemisation problems, relying on a separate, fixed system for these aspects, while a fully end-to-end TTS system could operate on unnormalised raw text. We believe that a fully data-driven approach could ultimately prevail even in this setup given sufficient training data and model capacity.
175
+
176
+ # ACKNOWLEDGMENTS
177
+
178
+ The authors would like to thank Norman Casagrande, Yutian Chen, Aidan Clark, Kazuya Kawakami, Pauline Luc, and many other colleagues at DeepMind for valuable discussions and input.
179
+
180
+ # REFERENCES
181
+
182
+ 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. arXiv:1603.04467, 2015.
183
+
184
+ Sercan Ö Arik, Mike Chrzanowski, Adam Coates, Gregory Diamos, Andrew Gibiansky, Yongguo Kang, Xian Li, John Miller, Andrew $\mathrm { N g }$ , Jonathan Raiman, Shubho Sengupta, and Mohammad Shoeybi. Deep Voice: Real-time neural text-to-speech. In ICML, 2017.
185
+
186
+ Sercan Ö Arık, Heewoo Jun, and Gregory Diamos. Fast spectrogram inversion using multi-head convolutional neural networks. IEEE Signal Processing Letters, 2018.
187
+
188
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. arXiv:1607.06450, 2016.
189
+
190
+ Eric Battenberg, RJ Skerry-Ryan, Soroosh Mariooryad, Daisy Stanton, David Kao, Matt Shannon, and Tom Bagby. Location-relative attention mechanisms for robust long-form speech synthesis. In ICASSP, 2020.
191
+
192
+ Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In NeurIPS, 2015.
193
+
194
+ Mathieu Bernard. Phonemizer. https://github.com/bootphon/phonemizer, 2020.
195
+
196
+ Mikołaj Binkowski, Jeff Donahue, Sander Dieleman, Aidan Clark, Erich Elsen, Norman Casagrande,´ Luis C. Cobo, and Karen Simonyan. High fidelity speech synthesis with adversarial networks. In ICLR, 2020.
197
+
198
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In ICLR, 2018.
199
+
200
+ Peter Buchlovsky, David Budden, Dominik Grewe, Chris Jones, John Aslanides, Frederic Besse, Andy Brock, Aidan Clark, Sergio Gómez Colmenarejo, Aedan Pope, Fabio Viola, and Dan Belov. TF-Replicator: Distributed machine learning for researchers. arXiv preprint arXiv:1902.00465, 2019.
201
+
202
+ Jonathan Chevelu, Damien Lolive, Sébastien Le Maguer, and David Guennec. How to compare TTS systems: A new subjective evaluation methodology focused on differences. In International Speech Communication Association, 2015.
203
+
204
+ Chung-Cheng Chiu and Colin Raffel. Monotonic chunkwise attention. In ICLR, 2018.
205
+
206
+ Marco Cuturi and Mathieu Blondel. Soft-DTW: a differentiable loss function for time-series. In ICML, 2017.
207
+
208
+ Harm De Vries, Florian Strub, Jérémie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron C Courville. Modulating early visual processing by language. In NeurIPS, 2017.
209
+
210
+ Alexandre Défossez, Neil Zeghidour, Nicolas Usunier, Léon Bottou, and Francis Bach. SING: Symbol-to-instrument neural generator. In NeurIPS, 2018.
211
+
212
+ Chris Donahue, Julian McAuley, and Miller Puckette. Adversarial audio synthesis. In ICLR, 2019.
213
+
214
+ Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. In ICLR, 2017.
215
+
216
+ Jesse Engel, Lamtharn (Hanoi) Hantrakul, Chenjie Gu, and Adam Roberts. DDSP: Differentiable digital signal processing. In ICLR, 2020.
217
+
218
+ Andrew Gibiansky, Sercan Arik, Gregory Diamos, John Miller, Kainan Peng, Wei Ping, Jonathan Raiman, and Yanqi Zhou. Deep Voice 2: Multi-speaker neural text-to-speech. In NeurIPS, 2017.
219
+
220
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NeurIPS, 2014.
221
+
222
+ Alex Graves. Sequence transduction with recurrent neural networks. arXiv:1211.3711, 2012.
223
+
224
+ Alex Graves. Generating sequences with recurrent neural networks. arXiv:1308.0850, 2013.
225
+
226
+ Alex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. In ICML, 2006.
227
+
228
+ Daniel Griffin and Jae Lim. Signal estimation from modified short-time Fourier transform. IEEE Transactions on Acoustics, Speech, and Signal Processing, 1984.
229
+
230
+ Haohan Guo, Frank K Soong, Lei He, and Lei Xie. A new GAN-based end-to-end TTS training algorithm. In Interspeech, 2019.
231
+
232
+ Mutian He, Yan Deng, and Lei He. Robust sequence-to-sequence acoustic modeling with stepwise monotonic attention for neural TTS. In Interspeech, 2019.
233
+
234
+ 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 NeurIPS, 2017.
235
+
236
+ Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NeurIPS Deep Learning and Representation Learning Workshop, 2015.
237
+
238
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
239
+
240
+ Fumitada Itakura. Minimum prediction residual principle applied to speech recognition. IEEE Transactions on Acoustics, Speech, and Signal Processing, 1975.
241
+
242
+ Nal Kalchbrenner, Erich Elsen, Karen Simonyan, Seb Noury, Norman Casagrande, Edward Lockhart, Florian Stimberg, Aäron van den Oord, Sander Dieleman, and Koray Kavukcuoglu. Efficient neural audio synthesis. In ICML, 2018.
243
+
244
+ Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-TTS: A generative flow for text-to-speech via monotonic alignment search. arXiv:2005.11129, 2020.
245
+
246
+ Sungwon Kim, Sang-Gil Lee, Jongyoon Song, Jaehyeon Kim, and Sungroh Yoon. FloWaveNet: A generative flow for raw audio. In ICML, 2019.
247
+
248
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
249
+
250
+ Kundan Kumar, Rithesh Kumar, Thibault de Boissiere, Lucas Gestin, Wei Zhen Teoh, Jose Sotelo, Alexandre de Brebisson, Yoshua Bengio, and Aaron Courville. MelGAN: Generative adversarial networks for conditional waveform synthesis. In NeurIPS, 2019.
251
+
252
+ Karol Kurach, Mario Luciˇ c, Xiaohua Zhai, Marcin Michalski, and Sylvain Gelly. A large-scale study ´ on regularization and normalization in GANs. In ICML, 2019.
253
+
254
+ Naihan Li, Shujie Liu, Yanqing Liu, Sheng Zhao, and Ming Liu. Neural speech synthesis with transformer network. In AAAI, 2019.
255
+
256
+ Jae Hyun Lim and Jong Chul Ye. Geometric GAN. arXiv:1705.02894, 2017.
257
+
258
+ Ilya Loshchilov and Frank Hutter. SGDR: Stochastic gradient descent with warm restarts. In ICLR, 2017.
259
+
260
+ Soroush Mehri, Kundan Kumar, Ishaan Gulrajani, Rithesh Kumar, Shubham Jain, Jose Sotelo, Aaron Courville, and Yoshua Bengio. SampleRNN: An unconditional end-to-end neural audio generation model. In ICLR, 2017.
261
+
262
+ Chenfeng Miao, Shuang Liang, Minchuan Chen, Jun Ma, Shaojun Wang, and Jing Xiao. Flow-TTS: A non-autoregressive network for text to speech based on flow. In ICASSP, 2020.
263
+
264
+ Takeru Miyato and Masanori Koyama. cGANs with projection discriminator. In ICLR, 2018.
265
+
266
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018.
267
+
268
+ Masanori Morise, Fumiya Yokomori, and Kenji Ozawa. WORLD: A vocoder-based high-quality speech synthesis system for real-time applications. IEICE Transactions on Information and Systems, 2016.
269
+
270
+ Paarth Neekhara, Chris Donahue, Miller Puckette, Shlomo Dubnov, and Julian McAuley. Expediting TTS synthesis with adversarial vocoding. In Interspeech, 2019.
271
+
272
+ George Papamakarios, Eric Nalisnick, Danilo Jimenez Rezende, Shakir Mohamed, and Balaji Lakshminarayanan. Normalizing flows for probabilistic modeling and inference. arXiv:1912.02762, 2019.
273
+
274
+ Kainan Peng, Wei Ping, Zhao Song, and Kexin Zhao. Parallel neural text-to-speech. arXiv:1905.08459, 2019.
275
+
276
+ Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan O. Arik, Ajay Kannan, Sharan Narang, Jonathan Raiman, and John Miller. Deep Voice 3: 2000-speaker neural text-to-speech. In ICLR, 2018.
277
+
278
+ Wei Ping, Kainan Peng, and Jitong Chen. ClariNet: Parallel wave generation in end-to-end text-tospeech. In ICLR, 2019a.
279
+
280
+ Wei Ping, Kainan Peng, Kexin Zhao, and Zhao Song. WaveFlow: A compact flow-based model for raw audio. arXiv:1912.01219, 2019b.
281
+
282
+ Ryan Prenger, Rafael Valle, and Bryan Catanzaro. WaveGlow: A flow-based generative network for speech synthesis. In ICASSP, 2019.
283
+
284
+ Colin Raffel, Minh-Thang Luong, Peter J Liu, Ron J Weiss, and Douglas Eck. Online and linear-time attention by enforcing monotonic alignments. In ICML, 2017.
285
+
286
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. In ICLR, 2016.
287
+
288
+ Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech: Fast, robust and controllable text to speech. In NeurIPS, 2019.
289
+
290
+ Malcolm Reynolds, Gabriel Barth-Maron, Frederic Besse, Diego de Las Casas, Andreas Fidjeland, Tim Green, Adrià Puigdomènech, Sébastien Racanière, Jack Rae, and Fabio Viola. Open sourcing Sonnet - a new library for constructing neural networks. https://deepmind.com/blog/ open-sourcing-sonnet/, 2017.
291
+
292
+ Hardik B Sailor and Hemant A Patil. Fusion of magnitude and phase-based features for objective evaluation of TTS voice. In International Symposium on Chinese Spoken Language Processing, 2014.
293
+
294
+ Hiroaki Sakoe. Dynamic-programming approach to continuous speech recognition. In International Congress of Acoustics, 1971.
295
+
296
+ Hiroaki Sakoe and Seibi Chiba. Dynamic programming algorithm optimization for spoken word recognition. IEEE Transactions on Acoustics, Speech, and Signal Processing, 1978.
297
+
298
+ Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, RJ Skerrv-Ryan, Rif A. Saurous, Yannis Agiomyrgiannakis, and Yonghui Wu. Natural TTS synthesis by conditioning WaveNet on Mel spectrogram predictions. In ICASSP, 2018.
299
+
300
+ Jose Sotelo, Soroush Mehri, Kundan Kumar, Joao Felipe Santos, Kyle Kastner, Aaron Courville, and Yoshua Bengio. Char2Wav: End-to-end speech synthesis. In ICLR, 2017.
301
+
302
+ Yaniv Taigman, Lior Wolf, Adam Polyak, and Eliya Nachmani. VoiceLoop: Voice fitting and synthesis via a phonological loop. arXiv:1705.03122, 2017.
303
+
304
+ Paul Taylor. Text-to-speech synthesis. Cambridge University Press, 2009.
305
+
306
+ Dustin Tran, Rajesh Ranganath, and David M. Blei. Hierarchical implicit models and likelihood-free variational inference. In NeurIPS, 2017.
307
+
308
+ Jean-Marc Valin and Jan Skoglund. LPCNet: Improving neural speech synthesis through linear prediction. In ICASSP, 2019.
309
+
310
+ Rafael Valle, Kevin Shih, Ryan Prenger, and Bryan Catanzaro. Flowtron: an autoregressive flow-based generative network for text-to-speech synthesis. arXiv:2005.05957, 2020.
311
+
312
+ Aäron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew W. Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. arXiv:1609.03499, 2016.
313
+
314
+ Aäron van den Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray Kavukcuoglu, George Driessche, Edward Lockhart, Luis Cobo, Florian Stimberg, Norman Casagrande, Dominik Grewe, Seb Noury, Sander Dieleman, Erich Elsen, Nal Kalchbrenner, Heiga Zen, Alex Graves, Helen King, Tom Walters, Dan Belov, and Demis Hassabis. Parallel WaveNet: Fast high-fidelity speech synthesis. In ICML, 2018.
315
+
316
+ Sean Vasquez and Mike Lewis. MelNet: A generative model for audio in the frequency domain. arXiv:1906.01083, 2019.
317
+
318
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
319
+
320
+ Xin Wang, Shinji Takaki, and Junichi Yamagishi. Neural source-filter-based waveform model for statistical parametric speech synthesis. In ICASSP, 2019.
321
+
322
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, Quoc Le, Yannis Agiomyrgiannakis, Rob Clark, and Rif A. Saurous. Tacotron: Towards end-to-end speech synthesis. In Interspeech, 2017.
323
+
324
+ Ronald J. Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural Computation, 1989.
325
+
326
+ Ryuichi Yamamoto, Eunwoo Song, and Jae-Min Kim. Probability density distillation with generative adversarial networks for high-quality parallel waveform generation. In Interspeech, 2019.
327
+
328
+ Ryuichi Yamamoto, Eunwoo Song, and Jae-Min Kim. Parallel WaveGAN: A fast waveform generation model based on generative adversarial networks with multi-resolution spectrogram. In ICASSP, 2020.
329
+
330
+ Geng Yang, Shan Yang, Kai Liu, Peng Fang, Wei Chen, and Lei Xie. Multi-band MelGAN: Faster waveform generation for high-quality text-to-speech. arXiv:2005.05106, 2020.
331
+
332
+ Heiga Zen, Keiichi Tokuda, and Alan W Black. Statistical parametric speech synthesis. Speech Communication, 2009.
333
+
334
+ Hao Zhang, Richard Sproat, Axel H Ng, Felix Stahlberg, Xiaochang Peng, Kyle Gorman, and Brian Roark. Neural models of text normalization for speech applications. Computational Linguistics, 2019.
335
+
336
+ Jing-Xuan Zhang, Zhen-Hua Ling, and Li-Rong Dai. Forward attention in sequence-to-sequence acoustic modeling for speech synthesis. In ICASSP, 2018.
337
+
338
+ Table 3: EATS batched inference benchmarks, timing inference (speech generation) on a Google Cloud TPU v3 (1 chip with 2 cores), a single NVIDIA V100 GPU, or an Intel Xeon E5-1650 v4 CPU at $3 . 6 0 \ : \mathrm { G H z }$ (6 physical cores). We use a batch size of 2, 8, or 16 utterances (Utt.), each 30 seconds long (input length of 600 phoneme tokens, padded if necessary). One “run” consists of 10 consecutive forward passes at the given batch size. We perform 101 such runs and report the median run time (Med. Run Time (s)) and the resulting Realtime Factor, the ratio of the total duration of the generated speech (Length / Run (s)) to the run time. (Note: GPU benchmarking is done using single precision (IEEE FP32) floating point; switching to half precision (IEEE FP16) could yield further speedups.)
339
+
340
+ <table><tr><td>Hardware</td><td>#Utt./ Batch</td><td># Batch / Run</td><td># Utt. / Run</td><td>Length / Utt. (s)</td><td>Length / Run (s)</td><td>Med. Run Time (s)</td><td>Realtime Factor</td></tr><tr><td>TPU v3 (1 chip)</td><td>16</td><td>10</td><td>160</td><td>30</td><td>4800</td><td>30.53</td><td>157.2×</td></tr><tr><td>V100 GPU (1)</td><td>8</td><td>10</td><td>80</td><td>30</td><td>2400</td><td>11.60</td><td>206.8×</td></tr><tr><td>Xeon CPU (6 cores)</td><td>2</td><td>10</td><td>20</td><td>30</td><td>600</td><td>70.42</td><td>8.520×</td></tr></table>
341
+
342
+ # A HYPERPARAMETERS AND OTHER DETAILS
343
+
344
+ Our models are trained for $5 \cdot 1 0 ^ { 5 }$ steps, where a single step consists of one discriminator update followed by one generator update, each using a minibatch size of 1024, with batches sampled independently in each of these two updates. Both updates are computed using the Adam optimizer (Kingma & Ba, 2015) with $\beta _ { 1 } = 0$ and $\beta _ { 2 } = 0 . 9 9 9$ , and a learning rate of $1 0 ^ { - 3 }$ with a cosine decay (Loshchilov & Hutter, 2017) schedule used such that the learning rate is 0 at step 500K. We apply spectral normalisation (Miyato et al., 2018) to the weights of the generator’s decoder module and to the discriminators (but not to the generator’s aligner module). Parameters are initialised orthogonally and off-diagonal orthogonal regularisation with weight $1 0 ^ { - 4 }$ is applied to the generator, following BigGAN (Brock et al., 2018). Minibatches are split over 64 or 128 cores (32 or 64 chips) of Google Cloud TPU v3 Pods, which allows training of a single model within up to 58 hours. We use crossreplica BatchNorm (Ioffe & Szegedy, 2015) to compute batch statistics aggregated across all devices. Like in GAN-TTS (Binkowski et al., 2020), our trained generator requires computation of ´ standing statistics before sampling; i.e., accumulating batch norm statistics from 200 forward passes. As in GAN-TTS (Binkowski et al., 2020) and BigGAN (Brock et al., 2018), we use an exponential moving ´ average of the generator weights for inference, with a decay of 0.9999. Although GANs are known to exhibit stability issues sometimes, we found that EATS model training consistently converges.
345
+
346
+ Models were implemented using TensorFlow (Abadi et al., 2015) v1 framework and the Sonnet (Reynolds et al., 2017) neural network library. We used the TF-Replicator (Buchlovsky et al., 2019) library for data parallel training over TPUs.
347
+
348
+ Inference speed. In Table 3 we report benchmarks for EATS batched inference on two modern hardware platforms (Google Cloud TPU v3, NVIDIA V100 GPU, Intel Xeon E5-1650 CPU). We find that EATS can generate speech two orders of magnitude faster than realtime on a GPU or TPU, demonstrating the efficiency of our feed-forward model. On the GPU, generating 2400 seconds (40 minutes) of speech (80 utterances of 30 seconds each) takes 11.60 seconds on average (median), for a realtime factor of $2 0 6 . 8 \times$ . On TPU we observe a realtime factor of $1 5 7 . 2 \times$ per chip (2 cores), or $7 8 . 6 \times$ per core. On a CPU, inference runs at $8 . 5 2 \times$ realtime.
349
+
350
+ # B ALIGNER PSEUDOCODE
351
+
352
+ In Figure 3 we present pseudocode for the EATS aligner described in Section 2.1.
353
+
354
+ # C SPECTROGRAM DISCRIMINATOR ARCHITECTURE
355
+
356
+ In this Appendix we present details of the architecture of the spectrogram discriminator (Section 2.3). The discriminator’s inputs are $4 7 \times 8 0 \times 1$ images, produced by adding a channel dimension to the $4 7 \times 8 0$ output of the mel-spectrogram computation (Appendix D) from the length 48000 input waveforms (2 seconds of audio at $2 4 \mathrm { k H z }$ ).
357
+
358
+ Then, the architecture is like that of the BigGAN-deep (Brock et al., 2018) discriminator for $1 2 8 \times 1 2 8$ images (listed in BigGAN (Brock et al., 2018) Appendix B, Table 7 (b)), but removing the first two “ResBlocks” and the “Non-Local Block” (self-attention) – rows 2-4 in the architecture table (keeping row 1, the input convolution, and rows $^ { 5 + }$ afterwards, as is). This removes one $2 \times 2$ downsampling step as the resolution of the spectrogram inputs is smaller than the $1 2 8 \times 1 2 8$ images for which the BigGAN-deep architecture was designed. We set the channel width multiplier referenced in the table to $c h = 6 4$ .
359
+
360
+ def EATSAligner(token_sequences, token_vocab_size, lengths, speaker_ids, num_speakers, noise, out_offset, out_sequence_length=6000, sigma2=10.): """Returns audio-aligned features and lengths for the given input sequences. "N" denotes the batch size throughout the comments. Args: token_sequences: batch of token sequences indicating the ID of each token, padded to a fixed maximum sequence length (400 for training, 600 for sampling). Tokens may either correspond to raw characters or phonemes (as output by Phonemizer). Each sequence should begin and end with a special silence token (assumed to have already been added to the inputs). (dtype=int, shape=[N, in_sequence_length=600]) token_vocab_size: scalar int indicating the number of tokens. (All values in token_sequences should be in [0, token_vocab_size).) lengths: indicates the true length $< =$ in_sequence_length=600 of each sequence in token_sequences before padding was added. (dtype=int, shape=[N]) speaker_ids: ints indicating the speaker ID. (dtype=int, shape=[N]) num_speakers: scalar int indicating the number of speakers. (All values in speaker_ids should be in [0, num_speakers).) noise: 128D noise sampled from a standard isotropic Gaussian (N(0,1)). (dtype=float, shape=[N, 128]) out_offset: first timestep to output. Randomly sampled for training, 0 for sampling. (dtype=int, shape=[N]) out_sequence_length: scalar int length of the output sequence at 200 Hz. 400 for training (2 seconds), 6000 for sampling (30 seconds). sigma2: scalar float temperature (sigma\*\*2) for the softmax.
361
+
362
+ Returns:
363
+
364
+ aligned_features: audio-aligned features to be fed into the decoder. (dtype=float, shape=[N, out_sequence_length, 256]) aligned_lengths: the predicted audio-aligned lengths. (dtype=float, shape=[N])
365
+
366
+ $\#$ Learn embeddings of the input tokens and speaker IDs.
367
+ embedded_tokens $=$ Embed(input_vocab_size=token_vocab_size, $\begin{array} { r l } { \# } & { { } - > \quad [ N , } \end{array}$ 600, 256] output_dim=256)(token_sequences)
368
+ embedded_speaker_ids = Embed(input_vocab_size=num_speakers, $\begin{array} { r l } { \# } & { { } - > \quad [ N , } \end{array}$ 128] output_dim=128)(speaker_ids)
369
+
370
+ # Make the "class-conditioning" inputs for class-conditional batch norm (CCBN) # using the embedded speaker IDs and the noise. ccbn_condition $=$ Concat([embedded_speaker_ids, noise], axis=1) $\begin{array} { l l l } { { \# } } & { { - > } } & { { [ N , } } \end{array}$ 256] $\#$ Add a dummy sequence axis to ccbn_condition for broadcasting. ccbn_condition = ccbn_condition[:, None, :] $\begin{array} { r l } { \# } & { { } - > \quad [ N , } \end{array}$ 1, 256]
371
+
372
+ # Use \`lengths\` to make a mask indicating valid entries of token_sequences. sequence_length = token_sequences.shape[1] # = 600 mask $=$ Range(sequence_length)[None, :] < lengths[:, None] $\begin{array} { r l } { \# } & { { } - > \quad [ N , } \end{array}$ 600]
373
+
374
+ # $\#$ Dilated 1D convolution stack.
375
+
376
+ # # 10 blocks \* 6 convs per block = 60 convolutions total.
377
+
378
+ $\textrm { \scriptsize x } =$ embedded_tokens
379
+
380
+ conv_mask $=$ mask[:, :, None] $\# \quad - > \quad [ N ,$ 600, 1]; dummy axis for broadcast. for _ in range(10):
381
+
382
+ for a, b in [(1, 2), (4, 8), (16, 32)]: block_inputs = x $\textrm { \textbf { x } } =$ ReLU(ClassConditionalBatchNorm(x, ccbn_condition)) $\textrm { \textbf { x } } =$ MaskedConv1D(output_channels=256, kernel_size=3, dilation=a)( x, conv_mask) $\textrm { \textbf { x } } =$ ReLU(ClassConditionalBatchNorm(x, ccbn_condition)) x = MaskedConv1D(output_channels=256, kernel_size=3, dilation=b)( x, conv_mask) $\begin{array} { r l } { \mathrm { ~ x ~ } } & { { } + = } \end{array}$ block_inputs $\# \mathrm { ~ ~ { ~ - > ~ } ~ } [ N ,$ 600, 256]
383
+
384
+ # Save dilated conv stack outputs as unaligned_features. unaligned_features $= \times$ # [N, 600, 256]
385
+
386
+ $\#$ Map to predicted token lengths.
387
+
388
+ $\textrm { \scriptsize x } =$ ReLU(ClassConditionalBatchNorm(x, ccbn_condition)) $\textrm { \scriptsize x } =$ Conv1D(output_channels=256, kernel_size=1)(x) $\textrm { \scriptsize x } =$ ReLU(ClassConditionalBatchNorm(x, ccbn_condition)) x = Conv1D(output_channels=1, kernel_size=1)(x) $\# \mathrm { ~ ~ { ~ - > ~ } ~ } [ N ,$ 600, 1] token_lengths $=$ ReLU(x[:, :, 0]) # -> [N, 600] token_ends = CumSum(token_lengths, axis=1) # -> [N, 600] token_centres $=$ token_ends (token_lengths / 2.) # -> [N, 600] $\#$ Compute predicted length as the last valid entry of token_ends. -> [N] aligned_lengths $=$ [end[length-1] for end, length in zip(token_ends, lengths)] $\#$ Compute output grid $\begin{array} { r l } { - > } & { { } [ N , } \end{array}$ out_sequence_length=6000] out_pos $=$ Range(out_sequence_length)[None, :] $^ +$ out_offset[:, None] out_pos $=$ Cast(out_pos[:, :, None], float) # -> [N, 6000, 1] diff = token_centres[:, None, :] - out_pos # -> [N, 6000, 600] logits $=$ -(diff\*\*2 / sigma2) # -> [N, 6000, 600] $\#$ Mask out invalid input locations (flip 0/1 to 1/0); add dummy output axis. logits_inv_mask $\ c = ~ 1$ . - Cast(mask[:, None, :], float) # -> [N, 1, 600] masked_logits $=$ logits - 1e9 \* logits_inv_mask # -> [N, 6000, 600] weights $=$ Softmax(masked_logits, axis=2) # -> [N, 6000, 600] # Do a batch matmul (written as an einsum) to compute the aligned features. # aligned_features -> [N, 6000, 256] aligned_features $=$ Einsum('noi,nid->nod', weights, unaligned_features)
389
+
390
+ return aligned_features, aligned_lengths
391
+
392
+ # import tensorflow.compat.v1 as tf
393
+
394
+ def get_mel_spectrogram(waveforms, invert_mu_law $=$ True, mu=255., jitter=False, max_jitter_steps $\scriptscriptstyle = 6 0$ ): """Computes mel-spectrograms for the given waveforms. Args: waveforms: a tf.Tensor corresponding to a batch of waveforms sampled at 24 kHz. (dtype $=$ tf.float32, shape=[N, sequence_length]) invert_mu_law: whether to apply mu-law inversion to the input waveforms. In EATS both the real data and generator outputs are mu-law'ed, so this is always set to True. mu: The mu value used if invert_mu_law $=$ True (ignored otherwise). jitter: whether to apply random jitter to the input waveforms before computing spectrograms. Set to True only for GT spectrograms input to the prediction loss. max_jitter_steps: maximum number of steps by which the input waveforms are randomly jittered if jitte $\gamma =$ True (ignored otherwise). Returns: A 3D tensor with spectrograms for the corresponding input waveforms.
395
+
396
+ (dtype $=$ tf.float32, shape=[N, num_frames=ceil(sequence_length/1024), num_bin $\scriptstyle 3 = 8 0 ]$ )
397
+
398
+ waveforms.shape.assert_has_rank(2) t $=$ waveforms
399
+
400
+ if jitter:
401
+
402
+ assert max_jitter_steps $\scriptstyle > = 0$ crop_shape $=$ [t.shape[1]] t $=$ tf.pad(t, [[0, 0], [max_jitter_steps, max_jitter_steps]]) # Jitter independently for each batch item. t $=$ tf.map_fn(lambda ti: tf.image.random_crop(ti, crop_shape), t)
403
+ if invert_mu_law: t $=$ tf.sign(t) / mu $\star$ ( $( \mathrm { ~ 1 ~ ~ { ~ + ~ } ~ } \mathrm { m u }$ ) $\star \star$ tf.abs(t) - 1)
404
+ t $=$ tf.signal.stft(t, frame_length $= 2 0 4 8$ , frame_step $^ { 1 = }$ 1024, pad_end $=$ True)
405
+ $\qquad \pm \quad =$ tf.abs(t)
406
+ mel_weight_matrix $=$ tf.signal.linear_to_mel_weight_matrix( num_mel_bins $= 8 0$ , num_spectrogram_bins $= \pm$ .shape[-1], sample_rate $^ { = 2 }$ 4000., lower_edge_hert $z = 8 0$ ., upper_edge_hert $z = 7$ 600.)
407
+ t $=$ tf.tensordot(t, mel_weight_matrix, axes $= 1$ )
408
+ t = tf.log(1. $^ +$ 10000.\*t)
409
+ return t
410
+ en_spectrograms_for_pred_loss $=$ get_mel_spectrogram(gen_waveforms, jitter=False)
411
+ eal_spectrograms_for_pred_loss $=$ get_mel_spectrogram(real_waveforms, jitter $: =$ True)
412
+
413
+ # D MEL-SPECTROGRAM COMPUTATION
414
+
415
+ In Figure 4 we include the TensorFlow (Abadi et al., 2015) code used to compute the mel-spectrograms fed into the spectrogram discriminator (Section 2.3) and the spectrogram prediction loss (Section 2.4). Note that for use in the prediction lfor real spectrograms and jitter ses Fa $\mathcal { L } _ { \mathrm { p r e d } }$ or or $\mathcal { L } _ { \mathrm { p r e d } } ^ { \prime \prime }$ , we call this function with jitterted spectrograms. When used for t $=$ True spec$=$
416
+ trogram discriminator inputs, we do not apply jitter to either real or generated spectrograms, setting jitter $=$ False in both cases.
417
+
418
+ def soft_minimum(values, temperature): """Compute the soft minimum with the given temperature.""" return -temperature $\star$ log(sum(exp(-values / temperature)))
419
+
420
+ def skew_matrix(x): """Skew a matrix so that the diagonals become the rows.""" height, width $= \times$ .shape $\begin{array} { r l } { \mathrm { y } } & { { } = } \end{array}$ zeros(height $^ +$ width - 1, width) for i in range(height $^ +$ width - 1): for j in range(width): # Shift each column j down by j steps. y[i, j] $=$ x[clip(i - j, 0, height - 1), j] return y
421
+
422
+ def spectrogram_dtw_error(spec_a, spec_b, warp_penalty $= 1$ .0, temperature ${ } = 0$ .01): """Compute DTW error given a pair of spectrograms.""" # Compute cost matrix. diffs $=$ abs(spec_a[None, :, :] - spec_b[:, None, :]) costs $=$ mean(diffs, axis $\ c = - 1$ ) # pairwise L1 cost, square the diffs for L2. size $=$ cost.shape[-1]
423
+
424
+ # # Initialise path costs.
425
+
426
+ path_cost $=$ INFINITY $\star$ ones(size + 1) path_cost_prev $=$ INFINITY $\star$ ones(size + 1) path_cost_prev[0] $\mathrm { ~ ~ { ~ \ b ~ = ~ } ~ 0 ~ . ~ 0 ~ }$
427
+
428
+ # E DYNAMIC TIME WARPING PSEUDOCODE
429
+
430
+ In Figure 5 we present pseudocode for the soft dynamic time warping (DTW) procedure we use in the spectrogram prediction loss $\mathcal { L } _ { \mathrm { p r e d } } ^ { \prime \prime }$ .
431
+
432
+ Note that the complexity of this implementation is quadratic. It could be made more efficient using Itakura or Sakoe-Chiba bands (Itakura, 1975; Sakoe & Chiba, 1978), but we found that enabling or disabling DTW for the prediction loss did not meaningfully affect training time, so this optimisation is not necessary in practice.
433
+
434
+ <table><tr><td>Outputsymbol|x4i;-ir~</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>&quot;</td></tr><tr><td>Substitute symbol|kk</td><td></td><td></td><td></td><td></td><td>1j··</td><td></td><td></td><td></td><td></td><td></td></tr></table>
435
+
436
+ Table 4: The symbols in this table are replaced or removed when they appear in phonemizer’s output.
437
+
438
+ # F TEXT PREPROCESSING
439
+
440
+ We use phonemizer (Bernard, 2020) (version 2.2) to perform partial normalisation and phonemisation of the input text (for all our results except for the No Phonemes ablation, where we use character sequences as input directly). We used the espeak backend (with espeak-ng version 1.50), which produces phoneme sequences using the International Phonetic Alphabet (IPA). We enabled the following options that phonemizer provides:
441
+
442
+ • with_stress, which includes primary and secondary stress marks in the output;
443
+ • strip, which removes spurious whitespace;
444
+ • preserve_punctuation, which ensures that punctuation is left unchanged. This is important because punctuation can meaningfully affect prosody.
445
+
446
+ The phoneme sequences produced by phonemizer contain some rare symbols (usually in non-English words), which we replace with more frequent symbols. The substitutions we perform are listed in Table 4. This results in a set of 51 distinct symbols. The character sequence
447
+
448
+ Modern text-to-speech synthesis pipelines typically involve multiple processing stages.
449
+
450
+ becomes
451
+
452
+ m"A:dÄn t"Ekstt@sp"i:tS s"InT@s­Is p"aIplaInz t"IpIkli Inv"A:lv m­2ltIp@l p��"A:sEsIN st"eIdZ1z.
453
+
454
+ # G TRANSFORMER-BASED ATTENTION ALIGNER BASELINE
455
+
456
+ In this Appendix we describe our transformer-based attention aligner baseline, used in Section 4 to compare against our monotonic interpolation-based aligner described in Section 2.1. We use transformer attention (Vaswani et al., 2017) with output positional features as the queries, and a sum of input positional features and encoder output as the keys. The encoder outputs are from the same dilated convolution stack as used in our EATS model, normalised using Layer Normalization (Ba et al., 2016) before input into the transformer. We omit the fully-connected output layer following the attention mechanism. Both sets of positional features use the sinusoidal encodings from Vaswani et al. (2017). We use 4 heads with key and value dimensions of 64 per head. Its outputs are taken as the audio-aligned feature representations, after which we apply Batch Normalisation and ReLU non-linearity before upsampling via the decoder.
457
+
458
+ ![](images/3ef521790c4d80c0df2016f80038681a2a2fc8745a9a4e169bfc645b29a69160.jpg)
459
+ Figure 6: Positions of the tokens over time for 128 utterances generated from the same text, with different latent vectors z. Close-ups of the start and end of the sequence show the variability of the predicted lengths.
460
+
461
+ ![](images/4615de26fe49bebc4e39539846b680faf596421869fab4e1492d981b39e84a56.jpg)
462
+ Figure 7: Histogram of lengths for 128 utterances generated from the same text, with different latent vectors $\mathbf { z }$ .
463
+
464
+ # H VARIATION IN ALIGNMENT
465
+
466
+ To demonstrate that the aligner module makes use of the latent vector z to account for variations in token lengths, we generated 128 different renditions of the second sentence from the abstract: “In this work, we take on the challenging task of learning to synthesise speech from normalised text or phonemes in an end-to-end manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs.”. Figure 6 shows the positions of the tokens over time, with close-ups of the start and end of the sequence, to make the subtle variations in length more visible. Figure 7 shows a histogram of the lengths of the generated utterances. The variation is subtle (less than $2 \%$ for this utterance), but noticeable. Given that the training data consists of high-quality recordings of human speech performed by professional voice actors, only a modest degree of variation is to be expected.
467
+
468
+ Table 5: Mean Opinion Scores (MOS) and Fréchet DeepSpeech Distances (FDSD) for our final EATS model and the ablations described in Section 4, sorted by MOS. FDSD scores presented here were computed on held-out validation multi-speaker set and therefore could not be obtained for the Single Speaker ablation. Due to dataset differences, these are also not comparable with the FDSD values reported for GAN-TTS by Binkowski et al. (2020). ´
469
+
470
+ <table><tr><td>Model</td><td>MOS</td><td>FDSD</td></tr><tr><td>Natural Speech</td><td>4.55 ± 0.075</td><td>0.682</td></tr><tr><td>No Discriminators</td><td>1.407 ± 0.040</td><td>1.594</td></tr><tr><td>No RWDs</td><td>2.526 ± 0.060</td><td>0.757</td></tr><tr><td>No Phonemes</td><td>3.423 ± 0.073</td><td>0.688</td></tr><tr><td>No MelSpecD</td><td>3.525 ± 0.057</td><td>0.849</td></tr><tr><td>No Mon. Int.</td><td>3.551 ± 0.073</td><td>0.724</td></tr><tr><td>No DTW</td><td>3.559 ± 0.065</td><td>0.694</td></tr><tr><td>EATS</td><td>4.083 ± 0.049</td><td>0.702</td></tr></table>
471
+
472
+ # I EVALUATION WITH FRÉCHET DEEPSPEECH DISTANCE
473
+
474
+ We found Fréchet DeepSpeech Distances (Binkowski et al., 2020), both conditional and unconditional, ´ unreliable in our setting. Although they provided useful guidance at the early stages of model iteration – i.e., were able to clearly distinguish the models that do and do not train – FDSD scores of the models of reasonable quality were not in line with their Mean Opinion Scores, as shown for our ablations in Table 5.
475
+
476
+ A possible reason for FDSD working less well in our setting is the fact that our models rely on features extracted from spectrograms similar to those computed at the DeepSpeech preprocessing stage. As our models combine losses computed on raw audio and mel-spectrograms, it might be the case that the speech generated by some model is of lower quality, yet has convincing spectrograms. Comparison of two of our ablations seems to affirm this hypothesis: the No MelSpecD model achieves much higher MOS $( \approx 3 . 5 )$ than the No RWDs ablation $( \approx 2 . 5 )$ which is optimised only against spectrogram-based losses. Their FDSDs, however, suggest the opposite ranking of these models.
477
+
478
+ Another potential cause for the discrepancy between MOS and FDSD is the difference in samples for which these scores were established. While FDSD was computed on samples randomly held out from the training set, the MOS was computed on more challenging, often longer utterances. As we did not have ground truth audio for the latter, we could not compute FDSD for these samples. The sample sizes commonly used for the metrics based on Fréchet distance, e.g. (Heusel et al., 2017; Kurach et al., 2019; Binkowski et al., 2020), are also usually larger than the ones used for MOS ´ testing (van den Oord et al., 2016; Binkowski et al., 2020); we used 5,120 samples for FDSD and ´ 1,000 for MOS.
479
+
480
+ We also note that conditional FDSD is not immediately applicable in our setting, as it requires fixed length (two second) samples with aligned conditionings, while in our case there is no fixed alignment between the ground truth characters and audio.
481
+
482
+ We hope that future research will revisit the challenge of automatic quantitative evaluation of text-tospeech models and produce a reliable quality metric for models operating in our current regime.
483
+
484
+ Table 6: A comparison of TTS methods. The model stages described in each paper are shown by linking together the inputs, outputs and intermediate representations that are used: characters $\mathbf { \Pi } ( \mathbf { C h } )$ , phonemes $\mathbf { ( P h ) }$ , mel-spectrograms (MelS), magnitude spectrograms (MagS), cepstral features (Cep), linguistic features (Ling, such as phoneme durations and fundamental frequencies, or WORLD (Morise et al., 2016) features for Char2wav (Sotelo et al., 2017) and VoiceLoop (Taigman et al., 2017)), and audio $\mathbf { \Pi } ( \mathbf { A u } )$ . Arrows with various superscripts describe model components: autoregressive (AR), feed-forward (FF), or feed-forward requiring distillation $( \mathbf { F } \mathbf { F } ^ { * } )$ . Arrows without a superscript indicate components that do not require learning. 1 Stage means the model is trained in a single stage to map from unaligned text/phonemes to audio (without, e.g., distillation or separate vocoder training). EATS is the only feed-forward model that fulfills this requirement.
485
+
486
+ <table><tr><td></td><td>Stages</td><td>1 Stage</td><td>Notes</td></tr><tr><td>WaveNet (van den Oord et al.,2016)</td><td>AAu Ling</td><td>×</td><td></td></tr><tr><td>SampleRNN (Mehri et al., 2017)</td><td>AAu</td><td>×</td><td>not a TTS model</td></tr><tr><td>Deep Voice (Arik et al.,2017)</td><td>Ch APhLing ARAu</td><td>×</td><td>uses segmentation model</td></tr><tr><td>WaveRNN (Kalchbrenner etal.,2018)</td><td>Ling AR ARAu</td><td>×</td><td></td></tr><tr><td>LPCNet (Valin &amp; Skoglund,2019)</td><td>ARAu Cep</td><td>×</td><td></td></tr><tr><td>WaveGlow (Prenger et al.,2019)</td><td>MelS FF Au</td><td>×</td><td></td></tr><tr><td>FloWaveNet (Kim et al.,2019)</td><td>FAu MelS</td><td>×</td><td></td></tr><tr><td>WaveFlow (Ping et al.,2019b)</td><td>ARAu MelS</td><td>×</td><td>partially autoregressive</td></tr><tr><td>Par: WaveNet (van den Oord et al.,2018)</td><td>Ling FF* →Au</td><td>×</td><td>distillation</td></tr><tr><td>ClariNet (Ping et al.,2019a), teacher</td><td>ARAu Ch/Ph</td><td>√</td><td></td></tr><tr><td>ClariNet (Ping etal.,2019a),student</td><td>Au Ch/Ph</td><td>×</td><td>distillation</td></tr><tr><td>WaveGAN(Donahue et al.,2019)</td><td>Au</td><td>×</td><td>not a TTS model</td></tr><tr><td>MelGAN (Kumar etal., 2019)</td><td>MelsAu</td><td>×</td><td></td></tr><tr><td>Par: WaveGAN(Yamamoto et al.,2020)</td><td>Ph AMels FAu</td><td>×</td><td></td></tr><tr><td>AdVoc (Neekhara et al.,2019)</td><td>MelsMagS</td><td>×</td><td></td></tr><tr><td>GAN-TTS (Binkowski etal., 2020)</td><td>Ling FAu FF</td><td>×</td><td></td></tr><tr><td>Tacotron (Wang et al.,2017)</td><td>ChAMels MagS→Au</td><td>×</td><td>uses Griffin &amp; Lim (1984)</td></tr><tr><td>Tacotron 2 (Shen et al.,2018)</td><td>AMelSAAu Ch</td><td>×</td><td></td></tr><tr><td>Deep Voice 2(Gibiansky et al.,2017)</td><td></td><td>×</td><td>uses segmentation model</td></tr><tr><td>DV2 Tacotron (Gibiansky et al.,2017)</td><td>ChAMagS AAu</td><td>×</td><td></td></tr><tr><td>Deep Voice 3 (Ping et al.,2018)</td><td>Ch AMelS AAu</td><td>×</td><td>several alternative vocoders</td></tr><tr><td>TransformerTTS(Li etal.,2019)</td><td>Ch→Ph AMelS AAu</td><td>×</td><td></td></tr><tr><td>Flowtron (Valle et al.,2020)</td><td>Ch AMelsAu</td><td>×</td><td></td></tr><tr><td>VoiceLoop (Taigman etal.,2017)</td><td>Ph ALing → Au</td><td>×</td><td></td></tr><tr><td>GAN Exposure (Guo et al.,2019)</td><td>Ph A MelS A Au</td><td>×</td><td></td></tr><tr><td>MelNet (Vasquez &amp; Lewis,2019)</td><td>AMelS→Au Ch-</td><td>×</td><td></td></tr><tr><td>ParaNet (Peng et al.,2019)</td><td>FF* MelsAu Ch/Ph</td><td>×</td><td>distillation</td></tr><tr><td>FastSpeech (Ren et al.,2019)</td><td>FAu Ph FF* MelS</td><td>×</td><td>distillation</td></tr><tr><td>Flow-TTS (Miao et al.,2020)</td><td>Mels Au Ch</td><td></td><td></td></tr><tr><td>Glow-TTS(Kim et al.,2020)</td><td>PhMels Au</td><td>× ×</td><td></td></tr><tr><td>Char2wav (Sotelo et al.,2017)</td><td>ChALing ARAu</td><td>×</td><td>end-to-end finetuning</td></tr><tr><td>EATS (Ours)</td><td>Ch/Ph → Au</td><td>√</td><td></td></tr></table>
487
+
488
+ # J COMPARISON OF TTS METHODS
489
+
490
+ In Table 6 we compare recent TTS approaches in terms of the inputs and outputs to each stage of the pipeline, and whether they are learnt in a single stage or multiple stages. Differentiating EATS from each prior approach is the fact that it learns a feed-forward mapping from text/phonemes to audio end-to-end in a single stage, without requiring distillation or separate vocoder training. The ClariNet teacher model (Ping et al., 2019a) is also trained in a single stage, but it uses teacher forcing to achieve this, requiring the model to be autoregressive. A separate distillation stage is necessary to obtain a feed-forward model in this case.
md/train/ryfMLoCqtQ/ryfMLoCqtQ.md ADDED
@@ -0,0 +1,476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AN ANALYTIC THEORY OF GENERALIZATION DYNAMICS AND TRANSFER LEARNING IN DEEP LINEAR NETWORKS
2
+
3
+ Andrew K. Lampinen Department of Psychology Stanford University lampinen@stanford.edu
4
+
5
+ Surya Ganguli
6
+ Department of Applied Physics
7
+ Stanford University
8
+ and
9
+ Google Brain
10
+ sganguli@stanford.edu
11
+
12
+ # ABSTRACT
13
+
14
+ Much attention has been devoted recently to the generalization puzzle in deep learning: large, deep networks can generalize well, but existing theories bounding generalization error are exceedingly loose, and thus cannot explain this striking performance. Furthermore, a major hope is that knowledge may transfer across tasks, so that multi-task learning can improve generalization on individual tasks. However we lack analytic theories that can quantitatively predict how the degree of knowledge transfer depends on the relationship between the tasks. We develop an analytic theory of the nonlinear dynamics of generalization in deep linear networks, both within and across tasks. In particular, our theory provides analytic solutions to the training and testing error of deep networks as a function of training time, number of examples, network size and initialization, and the task structure and SNR. Our theory reveals that deep networks progressively learn the most important task structure first, so that generalization error at the early stopping time primarily depends on task structure and is independent of network size. This suggests any tight bound on generalization error must take into account task structure, and explains observations about real data being learned faster than random data. Intriguingly our theory also reveals the existence of a learning algorithm that proveably out-performs neural network training through gradient descent. Finally, for transfer learning, our theory reveals that knowledge transfer depends sensitively, but computably, on the SNRs and input feature alignments of pairs of tasks.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Many deep learning practitioners closely monitor both training and test errors, hoping to achieve both a small training error and a small generalization error, or gap between testing and training errors. Training is usually stopped early, before overfitting sets in and increases the test error. This procedure often results in large networks that generalize well on structured tasks, raising an important generalization puzzle (Zhang et al., 2016): many existing theories that upper bound generalization error (Bartlett & Mendelson, 2002; Neyshabur et al., 2015; Dziugaite & Roy, 2017; Golowich et al., 2017; Neyshabur et al., 2017; Bartlett et al., 2017; Arora et al., 2018, e.g) in terms of various measures of network complexity yield very loose bounds. Therefore they cannot explain the impressive generalization capabilities of deep nets.
19
+
20
+ In the absence of any such tight and computable theory of deep network generalization error, we develop an analytic theory of generalization error for deep linear networks. Such networks exhibit highly nonlinear learning dynamics (Saxe et al., 2013a;b) including many prominent phenomena like learning plateaus, saddle points, and sudden drops in training error. Moreover, theory developed for the learning dynamics of deep linear networks directly inspired better initialization schemes for nonlinear networks (Schoenholz et al., 2016; Pennington et al., 2017; 2018). Here we show that deep linear networks also provide a good theoretical model for generalization dynamics. In particular we develop an analytic theory for both the training and test error of a deep linear network as a function of training time, number of training examples, network architecture, initialization, and task structure and SNR. Our theory matches simulations and reveals that deep networks with small weight initialization learn the most important aspects of a task first. Thus the optimal test error at the early stopping time depends largely on task structure and SNR, and not on network architecture, as long as the architecture is expressive enough to attain small training error. Thus our exact analysis of generalization dynamics reveals the important lesson that any theory that seeks to upper bound generalization error based only on network architecture, and not on task structure, is likely to yield exceedingly loose upper bounds. Intriguingly our theory also reveals a non-gradient-descent learning algorithm that proveably out-performs neural network training through gradient descent.
21
+
22
+ We also apply our theory to multi-task learning, which enables knowledge transfer from one task to another, thereby further lowering generalization error (Dong et al., 2015; Rusu et al., 2015; Luong et al., 2016, e.g.). Moreover, knowledge transfer across tasks may be key to human generalization capabilities (Hansen et al., 2017; Lampinen et al., 2017). We provide an analytic theory for how much knowledge is transferred between pairs of tasks, and we find that it displays a sensitive but computable dependence on the relationship between pairs of tasks, in particular, their SNRs and feature space alignments.
23
+
24
+ We note that a related prior work (Advani & Saxe, 2017) studied generalization in shallow and deep linear networks, but that work was limited to networks with a single output, thereby precluding the possibility of addressing the issue of transfer learning. Moreover, analyzing networks with a single output also precludes the possibility of addressing interesting tasks that require higher dimensional outputs, for example in language (Dong et al., 2015, e.g.), generative models (Goodfellow et al., 2014, e.g), and reinforcement learning (Mnih et al., 2015; Silver et al., 2016, e.g).
25
+
26
+ # 2 THEORETICAL FRAMEWORK
27
+
28
+ We work in a student-teacher scenario in which we consider an ensemble of low rank, noisy teacher networks that generate training data for a potentially more complex student network, and define the training and test errors whose dynamics we wish to understand.
29
+
30
+ # 2.1 AN ENSEMBLE OF LOW-RANK NOISY TEACHERS
31
+
32
+ We first consider an ensemble of 3-layer linear teacher networks with $\overline { { N } } _ { i }$ units in layer $i$ , and weight matrices $\overline { { \mathbf { W } } } ^ { 2 1 } \in \mathbb { R } ^ { \overline { { N _ { 2 } } } \times \overline { { N } } _ { 1 } }$ and $\overline { { \mathbf { W } } } ^ { 3 2 } \in \mathbb { R } ^ { \overline { { N _ { 3 } } } \times \overline { { N _ { 2 } } } }$ between the input to hidden, and hidden to output layers, respectively. The teacher network thus computes the composite map $\overline { { \mathbf { y } } } = \overline { { \mathbf { W } } } \mathbf { x }$ , where $\dot { \overline { { \mathbf { W } } } } \equiv \overline { { \mathbf { W } } } ^ { 3 \bar { 2 } } \overline { { \mathbf { W } } } ^ { 2 1 }$ . Of critical importance is the singular value decomposition (SVD) of $\overline { { \mathbf { W } } }$ :
33
+
34
+ $$
35
+ \overline { { \mathbf { W } } } = \overline { { \mathbf { U } } } \overline { { \mathbf { S } } } \overline { { \mathbf { V } } } ^ { T } = \sum _ { \alpha = 1 } ^ { \overline { { N _ { 2 } } } } \overline { { s } } ^ { \alpha } \overline { { \mathbf { u } } } ^ { \alpha } \overline { { \mathbf { v } } } ^ { \alpha T } ,
36
+ $$
37
+
38
+ Where $\overline { { \mathbf { U } } } \in \mathbb { R } ^ { \overline { { N _ { 3 } } } \times \overline { { N } } _ { 2 } }$ and $\overline { { \mathbf { V } } } \in \mathbb { R } ^ { \overline { { N _ { 1 } } } \times \overline { { N } } _ { 2 } }$ are both matrices with orthonormal columns and $\overline { \mathbf { S } }$ is an $\overline { { N _ { 2 } } } \times \overline { { N _ { 2 } } }$ diagonal matrix. We construct a random teacher by picking $\overline { { \mathbf { U } } }$ and $\overline { { \mathbf { V } } }$ to be random matrices with orthonormal columns and choosing $O ( 1 )$ values for the diagonal elements of $\overline { { \mathbf { S } } }$ . We work in the limit $\overline { { N _ { 1 } } } , \overline { { N _ { 3 } } } \infty$ with an $O ( 1 )$ aspect ratio $\mathcal { A } = \overline { { N _ { 3 } } } / \overline { { N _ { 1 } } } \in ( 0 , 1 ]$ so that the teacher has fewer outputs than inputs. Also, we hold $\overline { { N } } _ { 2 } \sim O ( 1 )$ , so the teacher has a low, finite rank, and we study generalization performance as a function of the $\overline { { N } } _ { 2 }$ teacher singular values.
39
+
40
+ We further assume the teacher generates noisy outputs from a set of $\overline { { N } } _ { 1 }$ orthonormal inputs:
41
+
42
+ $$
43
+ \hat { { \bf y } } ^ { \mu } = \overline { { { \bf W } } } \hat { \bf x } ^ { \mu } + { \bf z } ^ { \mu } \qquad \mathrm { f o r } \quad \mu = { \bf 1 } , \ldots , \overline { { { \bf N } } } _ { \bf 1 } .
44
+ $$
45
+
46
+ This training set yields important second-order training statistics that will guide student learning:
47
+
48
+ $$
49
+ \begin{array} { r } { \pmb { \Sigma } ^ { 1 1 } \equiv \overset { \overline { { \boldsymbol { N } } } _ { 1 } } { \mu = 1 } \hat { \mathbf { x } } ^ { \mu } \hat { \mathbf { x } } ^ { \mu T } = \mathbf { I } , \qquad \pmb { \Sigma } ^ { 3 1 } \equiv \overset { \overline { { \boldsymbol { N } } } _ { 1 } } { \mu = 1 } \hat { \mathbf { y } } ^ { \mu } \hat { \mathbf { x } } ^ { \mu T } = \overline { { \mathbf { W } } } + \mathbf { Z } \hat { \mathbf { X } } ^ { T } . } \end{array}
50
+ $$
51
+
52
+ Here the input covariance $\pmb { \Sigma } ^ { 1 1 }$ is assumed to be white (a common pre-processing step), the inputoutput covariance $\pmb { \Sigma } ^ { 3 1 }$ is simplified using (2), and $\mathbf { Z } \in \mathbb { R } ^ { \overline { { N } } _ { 3 } \times \overline { { N } } _ { 1 } }$ is the noise matrix, whose $\mu$ ’th column is $\mathbf { z } ^ { \mu }$ . Its matrix elements $z _ { i } ^ { \mu }$ are drawn iid. from a Gaussian with zero mean and variance $\sigma _ { z } ^ { 2 } / \overline { { N } } _ { 1 }$ . The noise scaling is chosen so the singular values of the teacher $\overline { { \mathbf { W } } }$ and the noise $\mathbf { Z }$ are both $O ( 1 )$ , leading to non-trivial generalization effects. As generalization performance will depend on the ratio of teacher singular values to the noise variance parameter $\sigma _ { z } ^ { 2 }$ , we simply set $\sigma _ { z } = 1$ in the following. Thus we can think of teacher singular values as signal to noise ratios (SNRs).
53
+
54
+ Finally, we note that while we focus for ease of exposition in the main paper on the case of one hidden layer networks and a full orthonormal basis of $P = { \overline { { N _ { 1 } } } }$ training inputs in the main paper, neither of these assumptions are essential to our theory. Indeed in Section 3.4 and App. A we extend our theory to networks of arbitrary depth, and in App. G we extend our theory to the case of white inputs with $P \neq \overline { { N } } _ { 1 }$ , obtaining a good match between theory and experiment in both cases.
55
+
56
+ # 2.2 STUDENT TRAINING AND TEST ERROR
57
+
58
+ Now consider a student network with $N _ { i }$ units in each layer. We assume the first and last layers match the teacher (i.e. $N _ { 1 } = \overline { { N _ { 1 } } }$ and $N _ { 3 } = \overline { { N _ { 3 } } }$ ) but $N _ { 2 } \geq \overline { { N _ { 2 } } }$ , allowing the student to have more hidden units than the teacher. We also consider deeper students (see below and App. A). Now consider any student whose input-output map is given by $\mathbf { \dot { y } } = \mathbf { W } ^ { 3 2 } \mathbf { W } ^ { 2 1 } \equiv \mathbf { W } \mathbf { x }$ . Its training error on the teacher dataset in (2) and its test error over a distribution of new inputs are given by
59
+
60
+ $$
61
+ \varepsilon _ { \mathrm { t r a i n } } \equiv \frac { \sum _ { \mu = 1 } ^ { \overline { { N _ { 1 } } } } | | \mathbf { W } \hat { \mathbf { x } } ^ { \mu } - \hat { \mathbf { y } } ^ { \mu } | | _ { 2 } ^ { 2 } } { \sum _ { \mu = 1 } ^ { \overline { { N _ { 1 } } } } | | \hat { \mathbf { y } } ^ { \mu } | | _ { 2 } ^ { 2 } } , \varepsilon _ { \mathrm { t e s t } } \equiv \frac { \langle | | \mathbf { W } \overline { { \mathbf { x } } } - \overline { { \mathbf { y } } } | | _ { 2 } ^ { 2 } \rangle } { \langle | | \overline { { \mathbf { y } } } | | _ { 2 } ^ { 2 } \rangle } ,
62
+ $$
63
+
64
+ respectively. Here $\hat { \mathbf { x } } ^ { \mu }$ and ${ \hat { \mathbf { y } } } ^ { \mu }$ are the noisy training set inputs and outputs in (2), whereas $\overline { { \mathbf { x } } }$ denotes a random test input drawn from zero mean Gaussian with identity covariance, $\overline { { \mathbf { y } } } ^ { \mu } = \overline { { \mathbf { W } } } \overline { { \mathbf { x } } } ^ { \mu }$ is noise free teacher output, and $\langle \cdot \rangle$ denotes an average w.r.t the distribution of the test input $\overline { { \mathbf { x } } }$ . Due to the orthonormality of the training and isotropy of the test inputs, both $\varepsilon _ { \mathrm { t r a i n } }$ and ${ \varepsilon } _ { \mathrm { t e s t } }$ can be expressed as
65
+
66
+ $$
67
+ \mathrm { ~ \xi ~ } _ { \mathrm { t r a i n } } = \frac { \mathrm { T } \mathbf { F } \mathbf { W } ^ { T } \mathbf { W } - 2 \mathrm { T r } \mathbf { W } ^ { T } { \boldsymbol { \Sigma } } ^ { 3 1 } + \mathrm { T r } { \boldsymbol { \Sigma } } ^ { 3 1 T } { \boldsymbol { \Sigma } } ^ { 3 1 } } { \mathrm { T r } \boldsymbol { \Sigma } ^ { 3 1 T } \boldsymbol { \Sigma } ^ { 3 1 } } , \mathrm { ~ \xi ~ } _ { \mathrm { f e s t } } = \frac { \mathrm { T r } \mathbf { W } ^ { T } \mathbf { W } - 2 \mathrm { T r } \mathbf { W } ^ { T } \overline { { \mathbf { W } } } + \mathrm { T r } \overline { { \mathbf { W } } } ^ { T } \overline { { \mathbf { W } } } } { \mathrm { T r } \overline { { \mathbf { W } } } ^ { T } \overline { { \mathbf { W } } } } .
68
+ $$
69
+
70
+ Both $\varepsilon _ { \mathrm { t r a i n } }$ and $\varepsilon _ { \mathrm { t e s t } }$ can be further expressed in terms of the student, training data and teacher SVDs, which we denote by $\mathbf { W } = \mathbf { U } \mathbf { S } \mathbf { V } ^ { T }$ , $\begin{array} { r } { \pmb { \Sigma } ^ { 3 1 } = \hat { \mathbf { U } } \hat { \mathbf { S } } \hat { \mathbf { V } } ^ { T } } \end{array}$ , and $\overline { { \mathbf { W } } } = \overline { { \mathbf { U } } } \overline { { \mathbf { S } } } \overline { { \mathbf { V } } } ^ { T }$ respectively. Specifically,
71
+
72
+ $$
73
+ \begin{array} { r l } & { \varepsilon _ { \mathrm { t r a i n } } = \left[ \overbrace { \sum _ { \beta = 1 } ^ { N _ { 3 } } } ^ { \overline { { S } } _ { 3 } } \hat { s } _ { \beta } ^ { 2 } \right] ^ { - 1 } \left[ \underset { \alpha = 1 } { \overset { N _ { 2 } } { \sum _ { \alpha } } } s _ { \alpha } ^ { 2 } + \underset { \beta = 1 } { \overset { \overline { { N } } _ { 3 } } { \sum _ { \beta } } } \hat { s } _ { \beta } ^ { 2 } - 2 \underset { \alpha = 1 } { \overset { N _ { 2 } } { \sum _ { \beta = 1 } } } \sum _ { \beta = 1 } ^ { \overline { { N _ { 3 } } } } s _ { \alpha } \hat { s } _ { \beta } \left( \mathbf { u } ^ { \alpha } \cdot \hat { \mathbf { u } } ^ { \beta } \right) \left( \mathbf { v } ^ { \alpha } \cdot \hat { \mathbf { v } } ^ { \beta } \right) \right] , } \\ & { \varepsilon _ { \mathrm { t e s t } } = \left[ \underset { \beta = 1 } { \overset { \overline { { N } } _ { 2 } } { \sum _ { \beta } } } \overline { { s } } _ { \beta } ^ { 2 } \right] ^ { - 1 } \left[ \underset { \alpha = 1 } { \overset { N _ { 2 } } { \sum _ { \alpha } } } s _ { \alpha } ^ { 2 } + \underset { \beta = 1 } { \overset { \overline { { N } } _ { 2 } } { \sum _ { \beta } } } \frac { 1 } { s _ { \beta } ^ { 2 } } - 2 \underset { \alpha = 1 } { \overset { N _ { 2 } } { \sum _ { \alpha } } } \sum _ { \beta = 1 } ^ { \overline { { N _ { 2 } } } } s _ { \alpha } \overline { { s } } _ { \beta } \left( \mathbf { u } ^ { \alpha } \cdot \overline { { \mathbf { u } } } ^ { \beta } \right) \left( \mathbf { v } ^ { \alpha } \cdot \overline { { \mathbf { v } } } ^ { \beta } \right) \right] . } \end{array}
74
+ $$
75
+
76
+ Thus as the student learns, its training and test error dynamics depends on the alignment of the time-evolving student singular modes $\{ s ^ { \alpha } , \mathbf { u } ^ { \alpha } , \mathbf { v } ^ { \alpha } \}$ with the fixed training data $\{ \hat { s } ^ { \alpha } , \hat { \mathbf { u } } ^ { \alpha } , \hat { \mathbf { v } } ^ { \alpha } \}$ and teacher $\{ \overline { { s } } ^ { \alpha } , \bar { \overline { { \mathbf { u } } } } ^ { \alpha } , \overline { { \mathbf { v } } } ^ { \alpha } \}$ singular modes respectively.
77
+
78
+ # 3 SINGLE TASK GENERALIZATION DYNAMICS: THEORY AND EXPERIMENT
79
+
80
+ Here we derive and numerically test analytic formulas for both the training and test errors of a student network as it learns from training data generated from a teacher network. We explore the dependence of these quantitites on the student network size, student initialization, teacher SNR, and training time.
81
+
82
+ # 3.1 STUDENT TRAINING DYNAMICS AND TRAINING-ALIGNED (TA) NETWORKS
83
+
84
+ We assume the student weights undergo batch gradient descent with learning rate $\lambda$ on the training error $\begin{array} { r } { \sum _ { \mu } | | \hat { \mathbf { y } } ^ { \mu } - \mathbf { W } ^ { 3 2 } \mathbf { W } ^ { 2 1 } \bar { \hat { \mathbf { x } } ^ { \mu } } | | _ { 2 } ^ { 2 } } \end{array}$ , which for small $\lambda$ is well approximated by the differential equations:
85
+
86
+ ![](images/df635d5402308d3a9a9f10644ccaa9227749fea9232affb61828b212aa929642.jpg)
87
+ Figure 1: Learning dynamics as a function of singular dimension strength. (a) shows how modes of different singular value are learned, (b) shows that there is a wave of learning that picks up singular dimensions with smaller and smaller singular values as $t \to \infty$ .
88
+
89
+ $$
90
+ \tau \frac { d } { d t } \mathbf { W } ^ { 2 1 } = \mathbf { W } ^ { 3 2 ^ { T } } \left( \boldsymbol { \Sigma } ^ { 3 1 } - \mathbf { W } ^ { 3 2 } \mathbf { W } ^ { 2 1 } \boldsymbol { \Sigma } ^ { 1 1 } \right) , \qquad \tau \frac { d } { d t } \mathbf { W } ^ { 3 2 } = \left( \boldsymbol { \Sigma } ^ { 3 1 } - \mathbf { W } ^ { 3 2 } \mathbf { W } ^ { 2 1 } \boldsymbol { \Sigma } ^ { 1 1 } \right) \mathbf { W } ^ { 2 1 ^ { T } } ,
91
+ $$
92
+
93
+ (where $\tau \equiv 1 / \lambda$ ), which must be solved from an initial set of student weights at time $t = 0$ (Saxe et al., 2013a). We consider two classes of student initializations. The first initialization corresponds to a random student where the weights $\mathbf { W } ^ { 2 1 }$ and $\mathbf { W ^ { 3 2 } }$ are chosen such that the composite map $\mathbf { W } = \mathbf { W ^ { 3 2 } W ^ { 2 1 } }$ has an SVD $\mathbf { W } = \epsilon \mathbf { U } \mathbf { V } ^ { \mathbf { T } }$ , where $\mathbf { U }$ and $\mathbf { V }$ are random singular vector matrices and all student singular vala time dependent evolution $\epsilon$ te map undergoes. For white inputs, $\begin{array} { r } { \mathbf { W } ( t ) = \mathbf { U } ( t ) \mathbf { S } ( t ) \mathbf { V } ( t ) ^ { T } = \sum _ { \alpha = 1 } ^ { N _ { 2 } } \mathbf { s } _ { \alpha } ( t ) \mathbf { u } ^ { \alpha } ( t ) \mathbf { v } ^ { \alpha } ( t ) ^ { T } . } \end{array}$ as , , and so the time-dependent student singular modes $\{ s ^ { \alpha } ( t ) , \mathbf { u } ^ { \alpha } ( \mathbf { t } ) , \mathbf { v } ^ { ( } \mathbf { t } ) \}$ converge to the training data singular modes $\{ \hat { s } ^ { \alpha } , \hat { \mathbf { u } } ^ { \alpha } , \hat { \mathbf { v } } ^ { \alpha } \}$ . However, the explicit dynamics of the student singular modes can be difficult to obtain analytically from random initial conditions.
94
+
95
+ Thus we also consider a special class of training aligned (TA) initial conditions in which $\mathbf { W ^ { 2 1 } }$ and $\mathbf { W ^ { 3 2 } }$ are chosen such that the composite map $\mathbf { W } = \mathbf { W ^ { 3 2 } W ^ { 2 1 } }$ has an SVD $\mathbf { W } = \epsilon \hat { \mathbf { U } } \hat { \mathbf { V } } ^ { \mathbf { T } }$ . That is, the TA network (henceforth referred to simply as the TA) has the same singular vectors as the training data covariance $\boldsymbol { \Sigma } ^ { 3 1 }$ , but has all singular values equal to $\epsilon$ . As shown in (Saxe et al., 2013a), as the TA learns according to (8), the singular vectors of its composite map W remain unchanged, while the singular values evolve as $s ^ { \alpha } ( t ) \stackrel { \textstyle - } { = } s ( t , { \hat { s } } ^ { \alpha } )$ , where the learning curve function $s ( t , { \hat { s } } )$ as well as its functional inverse $t ( s , { \hat { s } } )$ is given by
96
+
97
+ $$
98
+ s ( t , \hat { s } ) = \frac { \hat { s } e ^ { 2 \hat { s } t / \tau } } { e ^ { 2 \hat { s } t / \tau } - 1 + \hat { s } / \epsilon } , \qquad t ( s , \hat { s } ) = \frac { \tau } { 2 \hat { s } } \ln \frac { \hat { s } / \epsilon - 1 } { \hat { s } / s - 1 } .
99
+ $$
100
+
101
+ Here the function $s ( t , { \hat { s } } )$ describes analytically how each training set singular value $\hat { s }$ drives the dynamics of the corresponding TA singular value $s$ , and for notational simplicity, we have suppressed the dependence of $s ( t , { \hat { s } } )$ on $\tau$ and the initial condition $\epsilon$ . As shown in Fig. 1A, for each $\hat { s }$ , $s ( t , { \hat { s } } )$ is a sigmoidal learning curve that undergoes aat which it rises from its small initial value of haat sition around time to its asymptotic v $\begin{array} { r } { t / \tau = \frac { 1 } { 2 \hat { s } } \ln { \left( \hat { s } / \epsilon - \mathrm { 1 } \right) } } \end{array}$ $\epsilon$ $t = 0$ $\hat { s }$ $t / \tau \to \infty$ Alternatively, we can plot $s ( t , { \hat { s } } ) / { \hat { s } }$ as a function of $\hat { s }$ for different training times $t / \tau$ , as in Fig. 1B. This shows that TA learning corresponds to a singular mode detection wave which progressively sweeps from large to small singular values. At any given training time $t$ , training data modes with singular values $\hat { s } > t / \tau$ have been learned, while those with singular values $\hat { s } < t / \tau$ have not.
102
+
103
+ While the TA is more sophisticated than the random student, since it already knows the singular vectors of the training data before learning, we will see that the analytic solution for the TA learning dynamics provides a good approximation to the student learning dynamics, not only for the training error, as shown in (Saxe et al., 2013a), but also for the generalization error as shown below.
104
+
105
+ The results in this section assume a single hidden layer, but Saxe et al. (2013a) derived $t ( s , { \hat { s } } )$ for networks of arbitrary depth and we apply our theory to some deeper networks. The general differential equation and derivations for deeper networks can be found in Appendix A.
106
+
107
+ # 3.2 HOW THE TEACHER IS BURIED IN THE TRAINING DATA: A RANDOM MATRIX ANALYSIS
108
+
109
+ In the previous section, we reviewed an exact analytic solution for the composite map of a TA network, namely that its singular modes are related to those of the training data through the relation
110
+
111
+ $$
112
+ \begin{array} { r } { s _ { \alpha } ( t ) = s ( t , \hat { s } _ { \alpha } ) , \qquad { \bf u } ^ { \alpha } ( t ) = \hat { \bf u } ^ { \alpha } , \qquad { \bf v } ^ { \alpha } ( t ) = \hat { \bf v } ^ { \alpha } . } \end{array}
113
+ $$
114
+
115
+ However, computation of the generalization error through (5) then requires understanding how the teacher singular modes of $\overline { { \mathbf { W } } }$ are buried within the noisy training data singular modes of $\pmb { \Sigma } ^ { 3 1 }$ through the relation (3). Since the input matrix $\hat { \mathbf X }$ is orthonormal, $\pmb { \Sigma } ^ { 3 1 }$ is simply a perturbation of the low rank teacher $\overline { { \mathbf { W } } }$ by a high dimensional noise matrix $\mathbf { Z }$ . The relation between the singular modes of a low rank matrix and its noise perturbed version has been studied extensively in Benaych-Georges $\&$ Nadakuditi (2012), in the high dimensional limit we are working in, namely $\overline { { N _ { 1 } } } , \overline { { N _ { 3 } } } \overline { { } } \infty$ with the aspect ratio $\mathcal { A } = \overline { { N _ { 3 } } } / \overline { { N _ { 1 } } } \in \overline { { ( 0 , 1 ] } }$ , and $\overline { { N } } _ { 2 } \sim O ( 1 )$ .
116
+
117
+ ![](images/74aa5b143963ba7d2cf4b03e7444309ed0f7fd59b33a147d86b619f88f63f9e7.jpg)
118
+ Figure 2: The teacher’s signal through the noise. Theoretical vs. empirical (a) histogram of singular values of noisy teacher $\hat { s }$ . (b) $\hat { s }$ as a function of $\overline { { s } }$ . (c) alignment of noisy teacher and noiseless teacher singular vectors as a function of $\overline { { s } }$ . ${ \widetilde { N _ { 1 } } } = { \overline { { N _ { 3 } } } } = 1 0 0 .$ )
119
+
120
+ In this limit, the top $\overline { { N } } _ { 2 }$ singular values and vectors of $\pmb { \Sigma } ^ { 3 1 }$ converge to $\hat { s } ( \overline { { s } } _ { \alpha } )$ , where the transfer function from a teacher singular value $\overline { { s } }$ to a training data singular value $\hat { s }$ is given by the function
121
+
122
+ $$
123
+ { \hat { s } } ( { \overline { { s } } } ) = { \left\{ \begin{array} { l l } { ( { \overline { { s } } } ) ^ { - 1 } { \sqrt { ( 1 + { \overline { { s } } } ^ { 2 } ) ( A + { \overline { { s } } } ^ { 2 } ) } } } & { { \mathrm { ~ i f ~ } } { \overline { { s } } } > A ^ { 1 / 4 } } \\ { 1 + { \sqrt { A } } } & { { \mathrm { ~ o t h e r w i s e . } } } \end{array} \right. }
124
+ $$
125
+
126
+ The associated top $\overline { { N } } _ { 2 }$ singular vectors of $\pmb { \Sigma } ^ { 3 1 }$ can also acquire a nontrivial overlap with the $\overline { { N } } _ { 2 }$ modes of the teacher through the relation $\left| \hat { \mathbf { u } } ^ { \alpha } \cdot \overline { { \mathbf { u } } } ^ { \alpha } \right| \left| \hat { \mathbf { v } } ^ { \alpha } \cdot \overline { { \mathbf { v } } } ^ { \alpha } \right| = \mathcal { O } ( \overline { { s } } _ { \alpha } )$ , where the singular vector overlap function is given by
127
+
128
+ $$
129
+ \begin{array} { r } { \mathcal { O } ( \overline { { s } } ) = \left\{ \begin{array} { l l } { \left[ 1 - \frac { \mathcal { A } ( 1 + \overline { { s } } ^ { 2 } ) } { \overline { { s } } ^ { 2 } ( A + \overline { { s } } ^ { 2 } ) } \right] ^ { 1 / 2 } \left[ 1 - \frac { ( \mathcal { A } + \overline { { s } } ^ { 2 } ) } { \overline { { s } } ^ { 2 } ( 1 + \overline { { s } } ^ { 2 } ) } \right] ^ { 1 / 2 } } & { \mathrm { i f } \overline { { s } } > \mathcal { A } ^ { 1 / 4 } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \end{array}
130
+ $$
131
+
132
+ The rest of the $N _ { 3 } - { \overline { { N _ { 2 } } } }$ singular vectors of $\pmb { \Sigma } ^ { 3 1 }$ are orthogonal to the top $\overline { { N } } _ { 2 }$ ones, and their singular values are distributed according to the the Marchenko-Pastur (MP) distribution:
133
+
134
+ $$
135
+ P ( \hat { s } ) = \left\{ \begin{array} { l l } { \frac { \sqrt { 4 A - ( \hat { s } ^ { 2 } - ( 1 + A ) ) ^ { 2 } } } { \pi A \hat { s } } } & { \hat { s } \in [ 1 - \sqrt { \mathcal { A } } , 1 + \sqrt { \mathcal { A } } ] } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
136
+ $$
137
+
138
+ Overall, these equations describe a singular vector phase transition in the training data, as illustrated in Fig. 2BC. For example in the case of no teacher, the training data is simply noise and the singular values of $\pmb { \Sigma } ^ { 3 1 }$ are distributed as an MP sea spread between $1 \pm { \sqrt { A } }$ . When one adds a teacher, how each teacher singular mode is imprinted on the training data depends crucially on the teacher singular value $\overline { { s } }$ , and the nature of this imprinting undergoes a phase transition at $\overline { { s } } = \mathcal { A } ^ { 1 / 4 }$ . For $\overline { { s } } \leq { \mathcal { A } } ^ { 1 / 4 }$ , the teacher mode SNR is too low and this mode is not imprinted in the noisy training data; the associated√ training data singular value $\hat { s }$ remains at the edge of the MP sea at $1 + { \sqrt { A } }$ , and the overlap $\mathcal { O } ( \overline { { s } } )$ between training and teacher singular vectors remains zero.
139
+
140
+ However, when $\overline { { s } } > \mathcal { A } ^ { 1 / 4 }$ , this teacher mode is imprinted in the training data; there is an associated training data singular value $\hat { s }$ that pops out of the MP sea (Fig. 2AB). However, the training data singular value emerges at a position $\hat { s } > \overline { { s } }$ that is inflated by the noise, though the inflation effect decreases at larger $\overline { { s } }$ , with the ratio $\hat { s } / \overline { { s } }$ approaching the unity line as $\overline { { s } }$ becomes large (Fig. 2B). Similarly, the corresponding training data singular vectors acquire a non-trivial overlap with the teacher singular vectors when $\overline { { s } } > \mathcal { A } ^ { 1 / 4 }$ , and the alignment approaches unity as $\overline { { s } }$ increases (Fig. 2C).
141
+
142
+ # 3.3 PUTTING IT ALL TOGETHER: AN ANALYTIC THEORY OF GENERALIZATION DYNAMICS
143
+
144
+ Based on an analytic understanding of how the singular mode structure $\{ \overline { { s } } ^ { \alpha } , \overline { { \mathbf { u } } } ^ { \alpha } , \overline { { \mathbf { v } } } ^ { \alpha } \}$ of the teacher $\overline { { \mathbf { W } } }$ is imprinted in the modes $\{ \hat { s } ^ { \alpha } , \hat { \mathbf { u } } ^ { \alpha } , \hat { \mathbf { v } } ^ { \alpha } \}$ of the training data covariance $\pmb { \Sigma } ^ { 3 1 }$ through (11), (12) and (13), and in turn how this training data singular structure drives the time evolving singular modes of a
145
+
146
+ ![](images/314c03e7d659a75d3bce2929de3fdf61f6a46155c699119ff46ac7743510ffe3.jpg)
147
+ Figure 3: Match between theory and experiment for rank 1 (row 1, a-d) and rank 3 (row 2, e-h) teachers with single-hidden-layer students: (a-b, e-f) log train and test error, respectively, showing very close match between theory and experiment for TA, and close match for the random student. (c,g) comparing TA and randomly initialized students minimum generalization errors, showing almost perfect match. (d,h) comparing TA and randomly initialized students optimal stopping times, showing small lag due to alignment. ( $N _ { 1 } = 1 0 0$ , $N _ { 2 } = 5 0$ , $N _ { 3 } = 5 0 .$ )
148
+
149
+ TA network $\{ s ^ { \alpha } ( t ) , \hat { \mathbf { u } } ^ { \alpha } , \hat { \mathbf { v } } ^ { \alpha } \}$ of through (9), we can now derive analytic expressions for $\varepsilon _ { \mathrm { t r a i n } }$ and $\varepsilon _ { \mathrm { t e s t } }$ in (6) and (7), for a TA network. We will also show that these learning curves closely approximate those of a random student with time-evolving singular vectors $\{ \mathbf { u } ^ { \alpha } ( t ) , \mathbf { \bar { v } } ^ { \alpha } ( t ) \}$ , and match on several key aspects. First, inserting the TA dynamics in (10) into $\varepsilon _ { \mathrm { t r a i n } }$ in (6), we obtain
150
+
151
+ $$
152
+ \mathfrak { c } _ { \mathrm { r e a i n } } ( t ) = \left[ \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 3 } } \hat { s } _ { \alpha } ^ { 2 } \right] ^ { - 1 } \left[ ( N _ { 3 } - N _ { 2 } ) \langle \hat { s } ^ { 2 } \rangle _ { \mathcal { R } _ { o u t } } + ( N _ { 2 } - \overline { { N } } _ { 2 } ) \langle ( s ( \hat { s } , t ) - \hat { s } ) ^ { 2 } \rangle _ { \mathcal { R } _ { i n } } + \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } \left[ s _ { \alpha } ( t ) - \hat { s } _ { \alpha } \right] ^ { 2 } \right]
153
+ $$
154
+
155
+ Here, $s _ { \alpha } ( t ) = s ( \hat { s } _ { \alpha } , t )$ as defined in (9) are the TA singular values, and $\hat { s } _ { \alpha } = \hat { s } ( \overline { { s } } _ { \alpha } )$ as defined in (11) are the training data singular values associated with the teacher singular values $\overline { { s } } _ { \alpha }$ . Also $\langle \cdot \rangle _ { \mathcal { R } }$ denotes an average with respect to the MP distribution in (13) over a region $\mathcal { R }$ . Two distinct regions contribute to training error. First $\mathcal { R } _ { i n }$ contains those top $N _ { 2 } - \overline { { N } } _ { 2 }$ training data singular values that do not correspond to the $\overline { { N } } _ { 2 }$ singular values of the teacher but will be learned by a rank $N _ { 2 }$ student. Second, $\mathcal { R } _ { o u t }$ corresponds to the remaining $N _ { 3 } - N _ { 2 }$ lowest training data singular values√ that cannot be learned by a rank √ $N _ { 2 }$ student. In terms of the MP distribution, $\mathcal { R } _ { o u t } = [ 1 - \sqrt { \mathcal { A } } , f ]$ and $\mathcal { R } _ { i n } = [ f , 1 + \sqrt { \mathcal { A } } ]$ , where $f$ is the point at which the MP density has $1 - N _ { 2 } / N _ { 3 }$ of its mass to the left and $N _ { 2 } / N _ { 3 }$ of its mass to the right. In the simple case of a full rank student, $f = 1 - \sqrt { \mathcal { A } }$ , and one need only integrate over $\mathcal { R } _ { i n }$ which is the entire range. Equation (14) for $\varepsilon _ { \mathrm { t r a i n } }$ makes it manifest that it will go to zero for a full rank student as its singular values approach those of the training data.
156
+
157
+ Of course the test error can behave very differently. Inserting the TA training dynamics in (10) into $\varepsilon _ { \mathrm { t e s t } }$ in (7), and using (11), (12) and (13) to relate training data to the teacher, we find
158
+
159
+ $$
160
+ \varepsilon _ { \mathrm { t e x t } } ( t ) = \left[ \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } \overline { { s } } _ { \alpha } ^ { 2 } \right] ^ { - 1 } \left[ ( N _ { 2 } - \overline { { N } } _ { 2 } ) \langle s ( \hat { s } , t ) ^ { 2 } \rangle _ { \mathcal { R } _ { i n } } + \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } \left[ ( s _ { \alpha } ( t ) - \overline { { s } } _ { \alpha } ) ^ { 2 } + 2 s _ { \alpha } ( t ) \overline { { s } } _ { \alpha } ( 1 - \mathcal { O } ( \overline { { s } } _ { \alpha } ) ) \right] \right]
161
+ $$
162
+
163
+ Together (14) and (15) constitute a complete theory of generalization dynamics in terms of the structure of the data distribution (i.e. the teacher rank $\overline { { N } } _ { 2 }$ , teacher SNRs $\left\{ \overline { { s } } _ { \alpha } \right\}$ , and the teacher aspect ratio $\mathcal { A } = \overline { { N } } _ { 3 } / \overline { { N } } _ { 1 } )$ , the architectural complexity of the student (i.e. its rank $N _ { 2 }$ , its number of layers $N _ { l }$ , and the norm $\epsilon$ of its initialization), and the training time $t$ . They yield considerable insight into the dynamics of good generalization early in learning and overfitting later, as we show below.
164
+
165
+ ![](images/be9716a9b1de318c5906d81cbfaaab3bf19f9183b7b3ce2f88ef2d6bf3ba7e80.jpg)
166
+ Figure 4: Our theory applies to deeper networks: match between theory and simulation for rank 1 (row 1, a-d) and rank 3 (row 2, e-h) teachers with $n _ { l } = 5$ students: (a-b, e-f) log train and test error, respectively, showing very close match between theory and experiment for TA. (c,g) comparing TA and randomly initialized students minimum generalization errors, showing almost perfect match. (d,h) comparing TA and randomly initialized students optimal stopping times, showing large lag due to slower alignment in deeper networks. $N _ { 1 } = 1 0 0$ , $N _ { 2 } = 5 0$ , $N _ { 3 } = 5 0 .$ .)
167
+
168
+ # 3.4 NUMERICAL TESTS OF THE THEORY OF NEURAL NETWORK GENERALIZATION DYNAMICS
169
+
170
+ Fig. 3 demonstrates an excellent match between the theory and simulations for the TA, and a close match for random students, for single-hidden-layer students and various teacher ranks $\overline { { N } } _ { 2 }$ . Intuitively, as time $t$ proceeds, learning corresponds to singular mode detection wave sweeping from large to small training data singular values (i.e. the wave in Fig. 1B sweeps across the training data spectrum in Fig 2A). Initially, strong singular values associated with large SNR teacher modes are learned and both $\varepsilon _ { \mathrm { t r a i n } }$ and $\varepsilon _ { \mathrm { t e s t } }$ drop. Fig. 3A-D are for a rank 1 teacher, and so in Fig 3AB we see a single sharp drop early on, if the teacher SNR is sufficiently high. By contrast, with a rank 3 teacher in Fig. 3E-H, there are several early drops as the three modes are picked up. However, as time progresses, the singular mode detection wave penetrates the MP sea, and the student picks up noise structure in the data, so $\varepsilon _ { \mathrm { t r a i n } }$ drops but $\varepsilon _ { \mathrm { t e s t } }$ rises, indicating the onset of overfitting.
171
+
172
+ The main difference between the random student and TA learning curves is that the random student learning is slightly delayed relative to the TA, especially late in training. This is understandable because the TA already knows the singular vectors of the training data, while the random student must learn them. Nevertheless, two of the most important aspects of learning, namely the optimal early stopping time $t _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } } \equiv \mathrm { a r g m i n } _ { t } \varepsilon _ { \mathrm { t e s t } } ( t )$ and the minimal test error achieved at this time $\varepsilon _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } } \equiv$ $\mathrm { m i n } _ { t } \varepsilon _ { \mathrm { t e s t } } ( t )$ , match well between TA and random student, as shown in Fig. 3CD. At low teacher SNRs, the student takes a little longer to learn than the TA, but their optimal test errors match.
173
+
174
+ Our theory can also be easily extended to describe the learning dynamics deeper networks. Saxe et al. (2013a) derived $t ( s , { \hat { s } } )$ for networks of arbitrary depth, so we only need to adjust this factor in our formulas, see App. A for details. In Fig. 4 we show that again there is an excellent match between TA networks and theory for student networks with $N _ { l } = 5$ layers (i.e. 3 hidden layers). Randomly-initialized networks show a much longer alignment lag for deeper networks (see App. B for details), but the curves are qualitatively similar and optimal stopping errors match. We also demonstrate extensions of our theory to different numbers of training examples (App. G).
175
+
176
+ Importantly, many of the phenomena we observe in linear networks are qualitatively replicated in nonlinear networks (Fig. 5), suggesting that our theory may help guide understanding of the nonlinear case. In particular, features such as stage-like initial learning, followed by a plateau if SNR is high, and finally followed by overfitting, are replicated. However, there are some discrepancies, in particular nonlinear networks (especially deeper ones) begin overfitting earlier than linear networks. This is likely because a mode in a non-linear network can be co-opted by an orthogonal mode, while in a linear network it cannot. Thus noise modes are able to “stow away” on the strong signal modes once they are learned. However, overall learning patterns are similar, and we show below that many interesting phenomena in nonlinear networks are understandable in the linear case, such as the (non-)effects of overparameterization, the dynamics of memorization, and the benefits of transfer.
177
+
178
+ ![](images/4c96fe2cc1b69b79f16e01bb40a77f5c5b9805452e0fd502c4194097a289ca0c.jpg)
179
+ Figure 5: Train (first row, A-D) and test (second row, E-H) error for nonlinear networks (leaky relu at all hidden layers) with one hidden layer (first two columns) or three hidden layers (last two columns) trained on the tasks above, with a rank 1 teacher (first and third columns) or a rank 3 teacher (second and fourth columns). Note that many of the qualitative phenomena observed in linear networks, such as stage-like improvement in the errors, followed by a plateau, followed by overfitting, also appear in nonlinear networks. Compare the first column to Fig. 3AB, the second column to Fig. 3EF, the third to Fig. 4AB, and the fourth to Fig. 4EF. ( $N _ { 1 } = 1 0 0$ , $N _ { 2 } = 5 0$ , $N _ { 3 } = 5 0 .$ )
180
+
181
+ # .5 RANDOMIZED DATA VS. REAL DATA: A LEARNING TIME PUZZLE
182
+
183
+ An intriguing observation that resurrected the generalization puzzle in deep learning was the observation by Zhang et al. (2016) that deep networks can memorize data with the labels randomly permuted. However, as Arpit et al. (2017) pointed out, the learning dynamics of training error for randomized labels can be slower than than for structured data. This phenomenon also arises in deep linear networks, and our theory yields an analytic explanation for why. We randomize data by choosing orthonormal inputs $\hat { \mathbf { x } } ^ { \mu }$ as in the structured case, but we choose the outputs ${ \hat { \mathbf { y } } } ^ { \mu }$ to be i.i.d. Gaussian with zero mean and the same diagonal variance as the structured training data generated by the teacher. For structured data generated by a low rank teacher with singular values $\overline { { s } } _ { \alpha }$ , the diagonal output variance is given by $\begin{array} { r } { \sigma _ { r } ^ { 2 } = \frac { 1 } { N _ { 3 } } \left[ \sum _ { i = \alpha } ^ { \overline { { N } } _ { 2 } } \bar { s } _ { \alpha } ^ { 2 } \right] + \frac { 1 } { \overline { { N } } _ { 1 } } \sigma _ { z } ^ { 2 } } \end{array}$ , where $\sigma _ { z }$ is the noise variance, as before. Since there is no relation between input and output, $\pmb { \Sigma } ^ { 3 1 }$ is now distributed as a MP distribution whose support is $[ ( \sigma _ { r } ( 1 - \sqrt { \mathcal { A } } ) , \sigma _ { r } ( 1 + \sqrt { \mathcal { A } } ) ]$ . Thus randomization essentially destroys the outlier signal singular values in $\pmb { \Sigma } ^ { 3 1 }$ reflecting the teacher, and distributes them across all randomized data modes, yielding this stretched MP distribution (compare 6A top and bottom). However, even on this stretched MP distribution, the right edge will be much smaller than the signal singular values, since the signal variance will be diluted by spreading it out over many more modes in the randomized data. Thus the randomized data will lead to slower initial training error drops relative to the structured data (Fig. 6B) since the singular mode detection wave encounters the first signal singular values in structured data earlier than it encounters the edge of the stretched MP sea in randomized data.
184
+
185
+ ![](images/214421209393a1f729207d74055cfc8b2447742fb08e8821164fae3a79d95a61.jpg)
186
+ Figure 6: Learning randomized data: Comparing (a) singular value distributions and (b) learning curves for data with a signal vs. random data that preserves basic statistics (mean, variance). Randomizing the data dilutes the signal singular values, spreading their variance out over many modes, hence randomly labelled data is learned more slowly. $N _ { 1 } = 1 0 0$ , $N _ { 2 } = 5 0$ , $N _ { 3 } = 5 0 .$ .)
187
+
188
+ ![](images/6f50ba8e93b7f0f0f5390f316c743f888d62c7d9566d1790b18925c63d2e3904.jpg)
189
+ Figure 7: Transfer setting– If two different tasks are combined, how well students of the combined teacher perform on each task depends on the alignment and SNRs of the teachers.
190
+
191
+ ![](images/0a5b9a9dbd5641d64b838b1df6081e9aedcd5fcf53c8a71c1f83e3bbc6d1722c.jpg)
192
+ Figure 8: Transfer benefit $\mathcal { T } ^ { A B } ( \overline { { s } } _ { A } , \overline { { s } } _ { B } , q )$ plotted at different values of ${ \overline { { s } } } _ { A }$ . (a) $\overline { { s } } _ { A } = 0 . 8 4 = \sqrt [ 4 ] { A }$ . Although this task is impossible to learn on its own, with support from another aligned task, especially one with high SNR, learning can occur. (b) ${ \overline { { s } } } _ { A } = 3$ . Tasks with modest signals will face interference from poorly aligned tasks, but benefits from well aligned tasks. These effects are amplified by SNR. (c) $\overline { { s } } _ { A } = 1 0 0$ . Tasks with very strong signals will show little effect from other tasks (note y-axis scales), but any impact will be negative unless the tasks are very well aligned. $N _ { 1 } = 1 0 0$ $\dot { \overline { { { N } } } } _ { 2 } ^ { A } = \overline { { { N } } } _ { 2 } ^ { B } = 1 .$ , $N _ { 2 } = 5 0$ , $N _ { 3 } = 5 0 .$ )
193
+
194
+ # 3.6 OUT-PERFORMING OPTIMAL EARLY STOPPING THROUGH A NON-GRADIENT ALGORITHM
195
+
196
+ For the case of a rank 1 teacher, it is straightforward to derive a good analytic approximation to the important quantities $\varepsilon _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } }$ and topt $t _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } }$ . We assume the teacher SNR is beyond the phase transition point so its unique singular value $\overline { { s } } _ { 1 } > A ^ { 1 / 4 }$ , yielding a separation between the training data singular value $\hat { s _ { 1 } }$ in (11) and the edge of the MP sea. In this scenario, optimal early stopping will occur at a time before the detection wave in Fig. 1B penetrates the MP sea, so to minimize test error, we can neglect the first term in (15). Then optimizing the second term yields the optimal student singular value $s _ { 1 } = \overline { { s } } _ { 1 } \mathcal { O } ( \overline { { s } } _ { 1 } )$ . Inserting this value into (15) yields εoptgradient = 1 − O(s1)2, and inserting it into (9) yields $t _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } }$ . Thus the optimal generalization error with a rank 1 teacher is very simply related to the alignment of the top training data singular vectors with the teacher singular vectors, and it decreases as this alignment increases. In App. E, we show this match in the rank 1 case.
197
+
198
+ With higher rank teachers, teacher modes with differen $\varepsilon _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } }$ and For must negotiate a more complex trade-off betweene, as the singular mode detection wave passes the top training data singular value, $s _ { 1 } ( t ) \to \hat { s } _ { 1 }$ which is greater than the optimal $s _ { 1 } = \overline { { s } } _ { 1 } \mathcal { O } ( \overline { { s } } _ { 1 } )$ for mode 1. Thus as learning progresses, the student overfits on the first mode but learns lower modes. However, this neural generalization dynamics suggests a superior non-gradient training algorithm that simply optimally sets each $s _ { \alpha }$ to $\overline { { s } } _ { \alpha } \mathcal { O } ( \overline { { s } } _ { \alpha } )$ in (15), yielding an optimal generalization error:
199
+
200
+ $$
201
+ \varepsilon _ { \mathrm { n o n - g r a d i e n t } } ^ { \mathrm { o p t } } = \left[ \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } \overline { { s } } _ { \alpha } ^ { 2 } \right] ^ { - 1 } \left[ \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } \overline { { s } } _ { \alpha } ^ { 2 } ( 1 - \mathcal { O } ( \overline { { s } } _ { \alpha } ) ^ { 2 } ) \right] .
202
+ $$
203
+
204
+ Standard gradient descent learning cannot achieve this low generalization error because it cannot independently adjust all student singular values. A simple algorithm that achieves $\varepsilon _ { \mathrm { n o n - g r a d i e n t } } ^ { \mathrm { o p t } }$ is as follows. From the training data covariance $\pmb { \Sigma } ^ { 3 1 }$ , extract the top singular values $\hat { s } _ { \alpha }$ that pop-out of the MP sea, use the functional inverse of (11) to compute $\overline { { s } } _ { a } ( \widehat { s } _ { \alpha } )$ , use (12) to compute the optimal $s _ { \alpha }$ , and then construct a matrix $\mathbf { W }$ with the same top singular vectors as $\pmb { \Sigma } ^ { 3 1 }$ , but with the outlier singular values shrunk from $\hat { s } _ { \alpha }$ to $s _ { \alpha }$ and the rest set to zero. This non-gradient singular value shrinkage algorithm provably outperforms neural network training with $\varepsilon _ { \mathrm { n o n - g r a d i e n t } } ^ { \mathrm { o p t } ^ { - } } \le \varepsilon _ { \mathrm { g r a d i e n t } } ^ { \mathrm { o p t } } .$ .
205
+
206
+ # 4 A THEORY FOR THE TRANSFER OF KNOWLEDGE ACROSS MULTIPLE TASKS
207
+
208
+ Consider two tasks $A$ and $B$ , described by $\overline { { N } } _ { 3 }$ by $\overline { { N } } _ { 1 }$ teacher maps $\overline { { \mathbf { W } } } ^ { A }$ and $\overline { { \mathbf { W } } } ^ { B }$ , of ranks $\overline { { N } } _ { 2 } ^ { A }$ and $\overline { { N } } _ { 2 } ^ { B }$ , respectively. Now two student networks can learn from the two teacher networks separately, each achieving optimal early stopping test errors composite teacher (and student) that concatenate $\varepsilon _ { A } ^ { \mathrm { { o p t } } }$ and hid $\varepsilon _ { B } ^ { \mathrm { { o p t } } }$ . Alternatively, one could construct a and output units, but shares the same $\overline { { N } } _ { 3 }$ ut units (Fig. 7). The composite student and teacher each have two heads, one for each tasneurons per head. Optimal early stopping on each head of the student yields test errors opt opt $\varepsilon _ { A B } ^ { \mathrm { o p t } }$ and . We define the transfer benefit that task B confers on task A to be $\mathcal { T } ^ { A B } \equiv \varepsilon _ { A } ^ { \mathrm { o p t } } - \varepsilon _ { A B } ^ { \mathrm { o p t } }$ A postive (negative) transfer benefit implies learning tasks A and B simultaneously yields a lower (higher) optimal test error on task A compared to just learning task A alone.
209
+
210
+ A foundational question is how the transfer benefit $\scriptstyle { \mathcal { T } } ^ { A B }$ depends on the two tasks defined by the teachers $\overline { { \mathbf { W } } } ^ { A }$ and $\overline { { \mathbf { W } } } ^ { B }$ . To answer this, consider the SVDs of each teacher alone: $\begin{array} { r } { \overline { { \mathbf { W } } } ^ { A } = } \end{array}$ $\overline { { \mathbf { U } } } ^ { A } \overline { { \mathbf { S } } } ^ { A } \overline { { \mathbf { V } } } ^ { A ^ { T } }$ and $\overline { { \mathbf { W } } } ^ { B } = \overline { { \mathbf { U } } } ^ { B } \overline { { \mathbf { S } } } ^ { B } \overline { { \mathbf { V } } } ^ { B ^ { T } }$ . From the above, we know that $\varepsilon _ { A } ^ { \mathrm { { o p t } } }$ depends on $\overline { { \mathbf { W } } } ^ { A }$ only through $\overline { { \mathbf { S } } } ^ { A }$ . In App. D we show that the transfer benefit depends on both $\overline { { \mathbf { W } } } ^ { A }$ and $\overline { { \mathbf { W } } } ^ { B }$ only through $\overline { { \mathbf { S } } } ^ { A } , \overline { { \mathbf { S } } } ^ { B }$ , and the $\overline { { N } } _ { 2 } ^ { A }$ by $\overline { { N } } _ { 2 } ^ { B }$ similarity matrix $\mathbf { \overline { { Q } } } = \mathbf { \overline { { V } } } ^ { A ^ { T } } \mathbf { \overline { { V } } } ^ { B }$ . If we think of the columns of each $\overline { { \mathbf { V } } }$ as spanning a low dimensional feature space in $\overline { { N } } _ { 1 }$ dimensional input space that is important for each task, then $\overline { { \mathbf { Q } } }$ reflects the input feature subspace similarity matrix. Interestingly, the transfer benefit is independent of output singular vectors $\bar { \mathbf { U } } ^ { A }$ and $\overline { { \mathbf { U } } } ^ { B }$ . What matters for knowledge transfer in this setting are the relevant input features, not how you must respond to them.
211
+
212
+ We describe the transfer benefit for the simple case of two rank one teachers. Then $\overline { { \mathbf { S } } } ^ { A } , \overline { { \mathbf { S } } } ^ { B }$ , and $\overline { { \mathbf { Q } } }$ are simply scalars $s _ { A } , s _ { B }$ and $q$ , and we explore the function $\mathcal { T } ^ { A B } ( \overline { { s } } _ { A } , \overline { { s } } _ { B } , q )$ in Fig. 5ABC, which reveals several interesting features. First, knowledge can be transferred from a high SNR task to a low SNR task (Fig. 5A) and the degree of transfer increases with task alignment $q$ . This can make it possible to capture signals from task $A$ which would otherwise sink into the MP sea by learning jointly with a related task, even if the tasks are only weakly aligned (Fig. 5A). However, if task $A$ already has a high SNR, task $B$ must be very well aligned to it for transfer to be beneficial – otherwise there will be interference. The degree of alignment required increases as the task $A$ SNR increases, but the quantity of benefit or interference decreases correspondingly (Fig. 5BC). In Appendix D we explain why our theory predicts these results. Furthermore, in Appendix F we demonstrate these phenomena are qualitatively recapitulated in nonlinear networks, which suggests that our theory may give insight into how to choose auxiliary tasks.
213
+
214
+ # 5 DISCUSSION
215
+
216
+ In summary, our analytic theory of generalization dynamics in deep linear networks reveals that many puzzling aspects of generalization in deep learning already arise in the simple linear setting, where the puzzles can be understood analytically. In particular, deep linear networks learn more important structure in data first, leading to generalization errors that depend on task structure much more than network size. Our theory explains why deep linear networks learn randomized data more slowly than structured data, and provides a non-gradient based learning method that out-performs gradient descent learning in the linear case. Finally, we provide an analytic theory of how knowledge is transferred from one task to another, demonstrating that the degree of alignment of input features important for each task, but not how one must respond to these features, is critical for facilitating knowledge transfer. We think these analytic results provide useful insight into the similar generalization and transfer phenomena observed in the nonlinear case. Among other things, we hope our work will motivate and enable: (1) the search for tighter upper bounds on generalization error that take into account task structure; (2) the design of non gradient based training algorithms that outperform gradient-based learning; and (3) the theory-driven selection of auxiliary tasks that maximize knowledge transfer.
217
+
218
+ # REFERENCES
219
+
220
+ Madhu S. Advani and Andrew M. Saxe. High-dimensional dynamics of generalization error in neural networks. arXiv, pp. 1–32, 2017.
221
+
222
+ Sanjeev Arora, Rong Ge, Behnam Neyshabur, and Yi Zhang. Stronger generalization bounds for deep nets via a compression approach. arXiv preprint, pp. 1–39, 2018. URL http://arxiv. org/abs/1802.05296.
223
+
224
+ Devansh Arpit, Stanisław Jastrze¸bski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, and Simon Lacoste-Julien. A Closer Look at Memorization in Deep Networks. arXiv preprint, 2017. ISSN 1938-7228. URL http://arxiv.org/abs/1706.05394.
225
+
226
+ Peter Bartlett, Dylan J. Foster, and Matus Telgarsky. Spectrally-normalized margin bounds for neural networks. arXiv preprint, pp. 1–24, 2017. URL http://arxiv.org/abs/1706.08498.
227
+
228
+ Peter L Bartlett and Shahar Mendelson. Rademacher and Gaussian Complexities $:$ Risk Bounds and Structural Results. Journal of Machine Learning Research, 3:463–482, 2002.
229
+
230
+ Florent Benaych-Georges and Raj Rao Nadakuditi. The singular values and vectors of low rank perturbations of large rectangular random matrices. Journal of Multivariate Analysis, 111:120–135, 2012. ISSN 0047259X. doi: 10.1016/j.jmva.2012.04.019.
231
+
232
+ Daxiang Dong, Hua Wu, Wei He, Dianhai Yu, and Haifeng Wang. Multi-Task Learning for Multiple Language Translation. Acl, pp. 1723–1732, 2015.
233
+
234
+ Gintare Karolina Dziugaite and Daniel M. Roy. Computing Nonvacuous Generalization Bounds for Deep (Stochastic) Neural Networks with Many More Parameters than Training Data. arXiv preprint, 2017. URL http://arxiv.org/abs/1703.11008.
235
+
236
+ Noah Golowich, Alexander Rakhlin, and Ohad Shamir. Size-Independent Sample Complexity of Neural Networks. arXiv preprint, (1):1–26, 2017. URL http://arxiv.org/abs/1712. 06541.
237
+
238
+ I.J. Goodfellow, J Pouget-Abadie, and Mehdi Mirza. Generative Adversarial Networks. arXiv preprint, pp. 1–9, 2014. ISSN 10495258. doi: 10.1001/jamainternmed.2016.8245.
239
+
240
+ Steven S. Hansen, Andrew Lampinen, Gaurav Suri, and James L. McClelland. Building on prior knowledge without building it in. Behavioral and Brain Sciences, 40, 2017.
241
+
242
+ Andrew Lampinen, Shaw Hsu, and James L Mcclelland. Analogies Emerge from Learning Dyamics in Neural Networks. Proceedings of the 39th Annual Conference of the Cognitive Science Society, pp. 2512–2517, 2017.
243
+
244
+ Minh-Thang Luong, Quoc V. Le, Ilya Sutskever, Oriol Vinyals, and Lukasz Kaiser. Multi-task Sequence to Sequence Learning. Iclr, pp. 1–9, 2016.
245
+
246
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei a Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. ISSN 0028-0836. doi: 10.1038/nature14236.
247
+
248
+ Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. Norm-based capacity control in neural networks. Conference on Learning Theory (COLT), pp. 1376–1401, 2015. ISSN 15337928. URL http://arxiv.org/abs/1503.00036.
249
+
250
+ Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A PAC-Bayesian Approach to Spectrally-Normalized Margin Bounds for Neural Networks. arXiv preprint, (2017):1–9, 2017. URL http://arxiv.org/abs/1707.09564.
251
+
252
+ Jeffrey Pennington, Samuel S. Schoenholz, and Surya Ganguli. Resurrecting the sigmoid in deep learning through dynamical isometry: theory and practice. Advances in Neural Information Processing Systems 30, (Nips):1–11, 2017. URL http://arxiv.org/abs/1711.04735.
253
+
254
+ Jeffrey Pennington, Samuel S. Schoenholz, and Surya Ganguli. The Emergence of Spectral Universality in Deep Networks. In AISTATS 2018, 2018. URL http://arxiv.org/abs/1802. 09979.
255
+
256
+ Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy Distillation. arXiv, pp. 1–12, 2015. ISSN 0028-0836. doi: 10.1038/nature14236.
257
+
258
+ Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. Advances in Neural Information Processing Systems, pp. 1–9, 2013a.
259
+
260
+ Andrew M Saxe, James L Mcclelland, and Surya Ganguli. Learning hierarchical category structure in deep neural networks. Proceedings of the 35th annual meeting of the Cognitive Science Society, pp. 1271–1276, 2013b.
261
+
262
+ Samuel S. Schoenholz, Justin Gilmer, Surya Ganguli, and Jascha Sohl-Dickstein. Deep Information Propagation. In International Conference on Learning Representations (ICLR),, number 2016, pp. 1–18, 2016. URL http://arxiv.org/abs/1611.01232.
263
+
264
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, and Koray Kavukcuoglu. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7585):484–489, 2016. ISSN 0028-0836. doi: 10.1038/nature16961. URL http://dx.doi.org/10.1038/nature16961.
265
+
266
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint, 2016. ISSN 10414347. doi: 10.1109/TKDE.2015.2507132. URL http://arxiv.org/abs/1611.03530.
267
+
268
+ # A LEARNING DYNAMICS FOR DEEPER NETWORKS
269
+
270
+ In the main text, we described the dynamics of how a single-hidden-layer network converges toward the training data singular modes $\{ \hat { s } ^ { \alpha } , \hat { \mathbf { u } } ^ { \alpha } , \hat { \mathbf { v } } ^ { \alpha } \}$ , which were originally derived in Saxe et al. (2013a). There it was also proven that for a network with $N _ { l }$ layers (i.e. $N _ { l } - 2$ hidden layers), the strength of the mode obeys the differential equation:
271
+
272
+ $$
273
+ \tau { \frac { d } { d t } } u = ( N _ { l } - 1 ) u ^ { 2 - 2 / ( N _ { l } - 1 ) } ( s - u )
274
+ $$
275
+
276
+ This equation is separable and can be integrated for any integer number of layers. In particular, we consider the case of 5 layers (3 hidden), in which case:
277
+
278
+ $$
279
+ t ( s , \hat { s } ) = \frac { \tau } { 2 } \left[ \frac { \operatorname { t a n h } ^ { - 1 } \left( \sqrt { \frac { u } { \hat { s } } } \right) } { \hat { s } ^ { 3 / 2 } } - \frac { 1 } { \hat { s } \sqrt { u } } \right] _ { \epsilon } ^ { s }
280
+ $$
281
+
282
+ This expression cannot be analytically inverted to find $s ( t , { \hat { s } } )$ , so we numerically invert it where necessary.
283
+
284
+ # B ALIGNMENT LAG IN RANDOMLY INITIALIZED NETWORKS
285
+
286
+ As noted in the main text, the randomly-initialized networks behave quite similarly to the TA networks, except that the randomly-initialized networks show a lag due to the time it takes for the network’s modes to align with the data modes. In fig. 9 we explore this lag by plotting the alignment of the modes and the increase in the singular value for several randomly initialized networks.
287
+
288
+ Notice that stronger modes align more quickly. Furthermore, the mode alignment is relatively independent – whether the teacher is rank 1 or rank 3, the alignment of the modes is similar for the mode of singular value 2. Most importantly, note how the deeper networks show substantially slower mode alignment, with alignment not completed until around when the singular value increases. This explains why deeper networks show a larger lag between randomly-initialized and TA networks – the alignment process is much slower for deeper networks.
289
+
290
+ # C TRAIN AND TEST ERRORS AFTER A PROJECTION
291
+
292
+ In the case of transfer learning, or more generally when we want to evaluate a network’s loss on a subset of its outputs, we need to use a slight generalization of the train and test error formulas given in the main text. Suppose we are interested in the train and test errors after applying a projection operator $\mathbf { P }$ :
293
+
294
+ $$
295
+ \varepsilon _ { \mathrm { t r a i n } } \equiv \frac { \sum _ { \mu = 1 } ^ { \overline { { N _ { 1 } } } } | | \mathbf { P } \mathbf { W } \hat { \mathbf { x } } ^ { \mu } - \mathbf { P } \hat { \mathbf { y } } ^ { \mu } | | _ { 2 } ^ { 2 } } { \sum _ { \mu = 1 } ^ { \overline { { N _ { 1 } } } } | | \mathbf { P } \hat { \mathbf { y } } ^ { \mu } | | _ { 2 } ^ { 2 } } , \varepsilon _ { \mathrm { t e s t } } \equiv \frac { \sum _ { \mu = 1 } ^ { \overline { { N _ { 1 } } } } | | \mathbf { P } \mathbf { W } \overline { { \mathbf { x } } } ^ { \mu } - \mathbf { P } \overline { { \mathbf { y } } } ^ { \mu } | | _ { 2 } ^ { 2 } } { \sum _ { \mu = 1 } ^ { \overline { { N _ { 1 } } } } | | \mathbf { P } \overline { { \mathbf { y } } } ^ { \mu } | | _ { 2 } ^ { 2 } } ,
296
+ $$
297
+
298
+ respectively. As in the main text, we can rexpress these as:
299
+
300
+ $$
301
+ \varepsilon _ { \mathrm { t r a i n } } = \frac { \mathrm { T r } { \mathbf { W } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } { \mathbf { W } } - 2 \mathrm { T r } { \mathbf { W } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } \Sigma ^ { 3 1 } + \mathrm { T r } { \Sigma ^ { 3 1 } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } \Sigma ^ { 3 1 } } { \mathrm { T r } \Sigma ^ { 3 1 } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } \Sigma ^ { 3 1 } } ,
302
+ $$
303
+
304
+ $$
305
+ \varepsilon _ { \mathrm { t e s t } } = \frac { \mathrm { T r } { \mathbf { W } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } { \mathbf { W } } - 2 \mathrm { T r } { \mathbf { W } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } \overline { { { \mathbf { W } } } } + \mathrm { T r } \overline { { { \mathbf { W } } } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } \overline { { { \mathbf { W } } } } } { \mathrm { T r } \overline { { { \mathbf { W } } } } ^ { T } { \mathbf { P } } ^ { T } { \mathbf { P } } \overline { { { \mathbf { W } } } } } .
306
+ $$
307
+
308
+ Using the cyclic property of the trace, we can modify these to get:
309
+
310
+ $$
311
+ \varepsilon _ { \mathrm { t r a i n } } = \frac { \mathrm { T r } { \bf P } { \bf W } { \bf W } ^ { T } { \bf P } ^ { T } - 2 \mathrm { T r } { \bf P } \Sigma ^ { 3 1 } { \bf W } ^ { T } { \bf P } ^ { T } + \mathrm { T r } { \bf P } \Sigma ^ { 3 1 } \Sigma ^ { 3 1 ^ { T } } { \bf P } ^ { T } } { \mathrm { T r } { \bf P } \Sigma ^ { 3 1 } \Sigma ^ { 3 1 ^ { T } } { \bf P } ^ { T } } ,
312
+ $$
313
+
314
+ $$
315
+ \varepsilon _ { \mathrm { t e s t } } = \frac { \mathrm { T r } \mathbf { P } \mathbf { W } \mathbf { W } ^ { T } \mathbf { P } ^ { T } - 2 \mathrm { T r } \mathbf { P } \overline { { \mathbf { W } } } \mathbf { W } ^ { T } \mathbf { P } ^ { T } + \mathrm { T r } \mathbf { P } \overline { { \mathbf { W } } } \mathbf { W } ^ { T } \mathbf { P } ^ { T } } { \mathrm { T r } \mathbf { P } \overline { { \mathbf { W } } } \mathbf { W } ^ { T } \mathbf { P } ^ { T } } .
316
+ $$
317
+
318
+ As before, we express these in terms of the student, training data and teacher SVDs, $\mathbf { W } = \mathbf { U } \mathbf { S } \mathbf { V } ^ { T }$ $\begin{array} { r } { \pmb { \Sigma } ^ { 3 1 } = \hat { \mathbf { U } } \hat { \mathbf { S } } \hat { \mathbf { V } } ^ { T } } \end{array}$ , and $\overline { { \mathbf { W } } } = \overline { { \mathbf { U } } } \overline { { \mathbf { S } } } \overline { { \mathbf { V } } } ^ { T }$ respectively. Specifically,
319
+
320
+ $$
321
+ \begin{array} { r } { \operatorname { t r a i n } = \Big [ \sum _ { \beta = 1 } ^ { \mathbb { N } _ { 3 } } \hat { s } _ { \beta } ^ { 2 } \vert \vert { \mathbf { P } } \hat { \mathbf { a } } ^ { \alpha } \vert \vert _ { 2 } ^ { 2 } \Big ] ^ { - 1 } \Big [ \sum _ { \alpha = 1 } ^ { N _ { 2 } } s _ { \alpha } ^ { 2 } \vert \vert { \mathbf { P } } \mathbf { u } ^ { \alpha } \vert \vert _ { 2 } ^ { 2 } + \sum _ { \beta = 1 } ^ { \mathbb { N } _ { 3 } } \hat { s } _ { \beta } ^ { 2 } \vert \vert { \mathbf { P } } \hat { \mathbf { a } } ^ { \alpha } \vert \vert _ { 2 } ^ { 2 } - 2 \sum _ { \alpha = 1 } ^ { N _ { 2 } } \sum _ { \beta = 1 } ^ { \mathbb { N } _ { 3 } } s _ { \alpha } \hat { s } _ { \beta } \big ( { \mathbf { P } } \mathbf { u } ^ { \alpha } \cdot { \mathbf { P } } \hat { \mathbf { u } } ^ { \beta } \big ) \big ( { \mathbf { v } } ^ { \alpha } \cdot { \mathbf { \hat { v } } } ^ { \beta } \big ) \Big ] , } \end{array}
322
+ $$
323
+
324
+ $$
325
+ \begin{array} { r } { \varepsilon _ { \mathrm { t e s t } } = \Big [ \sum _ { \beta = 1 } ^ { \mathbb { N } _ { 2 } } \bar { s } _ { \beta } ^ { 2 } \big | \big | { \bf P } \bar { \bf u } ^ { \alpha } \big | \big | _ { 2 } ^ { 2 } \Big ] ^ { - 1 } \Big [ \sum _ { \alpha = 1 } ^ { N _ { 2 } } s _ { \alpha } ^ { 2 } \big | \big | { \bf P } { \bf u } ^ { \alpha } \big | \big | _ { 2 } ^ { 2 } + \sum _ { \beta = 1 } ^ { \mathbb { N } _ { 2 } } \bar { s } _ { \beta } ^ { 2 } \big | \big | { \bf P } \bar { \bf u } ^ { \alpha } \big | \big | _ { 2 } ^ { 2 } - 2 \sum _ { \alpha = 1 } ^ { N _ { 2 } } \sum _ { \beta = 1 } ^ { \mathbb { N } _ { 2 } } s _ { \alpha } \bar { s } _ { \beta } \big ( { \bf P } { \bf u } ^ { \alpha } \cdot { \bf P } { \bf { \bar { u } } } ^ { \beta } \big ) \big ( { \bf v } ^ { \alpha } \cdot { \bf \bar { v } } ^ { \beta } \big ) \Big ] . } \end{array}
326
+ $$
327
+
328
+ # D TRANSFER LEARNING DERIVATIONS & DETAILS
329
+
330
+ Thm 1 (Transfer theorem) The transfer benefit $\scriptstyle { \mathcal { T } } ^ { A B }$ :
331
+
332
+ • Is unaffected by the $\overline { { \mathbf { U } } } ^ { A }$ and $\overline { { \mathbf { U } } } ^ { B }$ .
333
+ • Is completely determined by only $\sigma _ { z } ^ { 2 }$ $, \overline { { \mathbf { S } } } ^ { A } , \overline { { \mathbf { S } } } ^ { B }$ , and the $\overline { { N } } _ { 2 } ^ { A }$ by $\overline { { N } } _ { 2 } ^ { B }$ similarity matrix $\overline { { \mathbf { Q } } } =$ $\overline { { \mathbf { V } } } ^ { A T } \overline { { \mathbf { V } } } ^ { B }$ .
334
+
335
+ ![](images/f7d69e78559f4561bf6dde026948060bf03ae8cb1ead40ce9131543b8df1331b.jpg)
336
+ Figure 9: Alignment of randomly-initialized network modes to data modes and growth of singular values, plotted for 1 hidden layer (first two rows, a-d) and 3 hidden layers (last two rows, e-h), and for a rank 1 teacher (first and third rows, a & e), or a rank 3 teacher (second and fourth rows, b-d & f-h). The columns are the different modes, with respective singular values of 6, 4, and 2. $\sigma _ { z }$ was set to 1. The deeper networks show substantially slower mode alignment, with alignment not completed until around when the singular value increases.
337
+
338
+ Proof: We define
339
+
340
+ $$
341
+ \begin{array} { l l } { { { \overline { { { \cal { \bf { U } } } } } } ^ { A B } = \begin{array} { c } { { { \overline { { { \cal { N } } } } } _ { 3 } } } \\ { { { \overline { { { \cal { N } } } } } _ { 3 } } } \\ { { { \overline { { { \cal { N } } } } } _ { 3 } } } \end{array} } } & { { { \overline { { { \cal { N } } } } } _ { 3 } ^ { A } \begin{array} { c } { { { \overline { { { \cal { N } } } } } _ { 2 } ^ { B } } } \\ { { \left| \begin{array} { c } { { { \bf { \overline { { { \bf { U } } } } } } ^ { A } } } \end{array} \right| } } } \\ { { { \overline { { { \bf { U } } } } } ^ { B } } } \end{array} } & { { { \overline { { { \bf { S } } } } } ^ { A B } = \begin{array} { c } { { { \overline { { { \cal { N } } } } } _ { 2 } ^ { A } } } \\ { { { \overline { { { \cal { N } } } } } _ { 2 } ^ { B } } } \end{array} } } \\ { { { \overline { { { \cal { N } } } } } _ { 2 } ^ { A B } = \begin{array} { c } { { { \overline { { { \cal { N } } } } } _ { 3 } ^ { A } } } \end{array} } } & { { { \overline { { { \bf { U } } } } } _ { 2 } ^ { B } } } \end{array}
342
+ $$
343
+
344
+ $$
345
+ \mathbf { \overline { { W } } } ^ { A + B } = [ \frac { \mathbf { \overline { { U } } } ^ { A } } { \mathbf { 0 } } | \begin{array} { c } { \mathbf { 0 } } \\ { \mathbf { \overline { { U } } } ^ { B } } \end{array} ] [ \frac { \mathbf { \overline { { S } } } ^ { A } } { \mathbf { 0 } } | \begin{array} { c } { \mathbf { 0 } } \\ { \mathbf { \overline { { S } } } ^ { B } } \end{array} ] [ \frac { \mathbf { \overline { { V } } } ^ { A ^ { T } } } { \mathbf { \overline { { V } } } ^ { B ^ { T } } } ]
346
+ $$
347
+
348
+ Because of the 0 blocks in UAB, the vectors in blocks corresponding to task $A$ and task $B$ are completely orthogonal, so UAB remains orthonormal. Thus the relationship between the $\overline { { \mathbf { U } } } ^ { A }$ and $\overline { { \mathbf { U } } } ^ { A }$ is irrelevant to the transfer. (In our simulations we use arbitrary orthonormal matrices for $\overline { { \mathbf { U } } } ^ { A }$ and $\overline { { \mathbf { U } } } ^ { B }$ .) Therefore the transfer effects will be entirely driven by the relationship between the matrices $\overline { { \mathbf { V } } } ^ { A }$ and $\overline { { \mathbf { V } } } ^ { B }$ and the singular values.
349
+
350
+ We define $\overline { { N } } _ { 2 } ^ { A }$ by $\overline { { N } } _ { 2 } ^ { B }$ similarity matrix $\mathbf { \overline { { Q } } } = \mathbf { \overline { { V } } } ^ { A ^ { T } } \mathbf { \overline { { V } } } ^ { B }$ . If we think of the columns of each $\overline { { \mathbf { V } } }$ as spanning a low dimensional feature space in $\overline { { N } } _ { 1 }$ dimensional input space that is important for each task, then $\overline { { \mathbf { Q } } }$ reflects the input feature subspace similarity matrix. We can now calculate the singular values of WA+ B. First, note that the input singular modes of WA+B a re eigenvectors of $\overline { { \mathbf { W } } } ^ { A + B ^ { T } } \overline { { \mathbf { W } } } ^ { A + B }$ B, and the associated singular values are square roots of the eigenvalues of WA+B. Now
351
+
352
+ $$
353
+ \begin{array} { r } { \overline { { \mathbf { W } } } ^ { A + B ^ { T } } \overline { { \mathbf { W } } } ^ { A + B } = \overline { { \mathbf { V } } } ^ { A B } \overline { { \mathbf { S } } } ^ { A B } \overline { { \mathbf { U } } } ^ { A B ^ { T } } \overline { { \mathbf { U } } } ^ { A B } \overline { { \mathbf { S } } } ^ { A B } \overline { { \mathbf { V } } } ^ { A B ^ { T } } = \overline { { \mathbf { V } } } ^ { A B } \overline { { \mathbf { S } } } ^ { A B ^ { 2 } } \overline { { \mathbf { V } } } ^ { A B ^ { T } } } \end{array}
354
+ $$
355
+
356
+ Now if $\vec { c }$ is an eigenvector of this matrix:
357
+
358
+ $$
359
+ \overline { { { \bf V } } } ^ { A B } \overline { { { \bf S } } } ^ { A B ^ { 2 } } \overline { { { \bf V } } } ^ { A B ^ { T } } \vec { c } = \lambda \vec { c }
360
+ $$
361
+
362
+ This implies that
363
+
364
+ $$
365
+ \mathbf { \overline { { { V } } } } ^ { A B ^ { T } } \mathbf { \overline { { { V } } } } ^ { A B } \mathbf { \overline { { { S } } } } ^ { A B ^ { 2 } } \mathbf { \overline { { { V } } } } ^ { A B ^ { T } } { \vec { c } } = \lambda \mathbf { \overline { { { V } } } } ^ { A B ^ { T } } { \vec { c } }
366
+ $$
367
+
368
+ Hence eigenvalues of VABSAB2V T are also eigenvalues of VABT V $\overline { { { \bf V } } } ^ { A B ^ { T } } \overline { { { \bf V } } } ^ { A B } \overline { { { \bf S } } } ^ { A B ^ { 2 } }$ , with the mapping between the eigenvectors given by $\overline { { \mathbf { V } } } ^ { A B }$ . Furthermore, this mapping must be a bijection for eigenvectors with non-zero eigenvalues, since the matrices have the same rank (the rank of $\overline { { \mathbf { V } } } ^ { A B }$ ). To see this, note that SAB 2 i s full rank. From this, it is clear that
369
+
370
+ $$
371
+ \mathrm { r a n k } \overline { { { \mathbf { V } } } } ^ { A B ^ { T } } \overline { { { \mathbf { V } } } } ^ { A B } \overline { { { \mathbf { S } } } } ^ { A B ^ { 2 } } = \mathrm { r a n k } \overline { { { \mathbf { V } } } } ^ { A B ^ { T } } \overline { { { \mathbf { V } } } } ^ { A B } = \mathrm { r a n k } \overline { { { \mathbf { V } } } } ^ { A B } .
372
+ $$
373
+
374
+ Furthermore, SAB2 is positive definite, so
375
+
376
+ $$
377
+ \operatorname { r a n k } { \overline { { \mathbf { V } } } } ^ { A B } { \overline { { \mathbf { S } } } } ^ { A B ^ { 2 } } { \overline { { \mathbf { V } } } } ^ { A B ^ { T } } = \operatorname { r a n k } { \overline { { \mathbf { V } } } } ^ { A B } .
378
+ $$
379
+
380
+ Now that we know the eigenvectors of these matrices are in bijection, note that:
381
+
382
+ $$
383
+ \begin{array}{c} \overline { { \mathbf { V } } } ^ { A B ^ { T } } \overline { { \mathbf { V } } } ^ { A B } \overline { { \mathbf { S } } } ^ { A B ^ { 2 } } = [ \frac { \overline { { \mathbf { V } } } ^ { A ^ { T } } } { \overline { { \mathbf { V } } } ^ { B ^ { T } } } ] [ \begin{array} { c } { \overline { { \mathbf { V } } } ^ { A } \begin{array} { c } { \overline { { \mathbf { V } } } ^ { B } } \end{array} } \end{array} ] [ \frac { \overline { { \mathbf { S } } } ^ { A ^ { 2 } } } { \mathbf { 0 } } \end{array} ] \frac { \mathbf { 0 } } { \overline { { \mathbf { S } } } ^ { B ^ { 2 } } } ] = [ \begin{array} { c c } { \mathbf { I } } & { \mathbf { Q } } \\ { \mathbf { Q } ^ { \mathbf { T } } } & { \mathbf { I } } \end{array} ] [ \frac { \overline { { \mathbf { S } } } ^ { A ^ { 2 } } } { \mathbf { 0 } } \begin{array} { c } { \mathbf { [ \begin{array} { c } { \mathbf { 0 } } \\ { \overline { { \mathbf { S } } } ^ { B ^ { 2 } } } \end{array} ] } \overline { { \mathbf { S } } } ^ { B ^ { 2 } } } \end{array} ]
384
+ $$
385
+
386
+ Because the output modes don’t matter (as noted above), the alignment between the eigenvectors of VABSAB2V ABT and $\overline { { \mathbf { V } } } ^ { A }$ , weighted by their respective eigenvalues, gives the transfer benefit.
387
+
388
+ For any given tasks, the transfer benefit can be calculated using our theory. However, in certain special cases, we can give exact answers. For example, in the rank one case with equal singular values between the tasks $\mathit { \Pi } _ { \overline { { { s } } } _ { A } } ^ { \prime } = \mathit { \Pi } _ { \overline { { { s } } } _ { B } } ^ { \prime } = \mathit { \Pi } _ { \overline { { { s } } } } ^ { \prime }$ ), the matrix
389
+
390
+ $$
391
+ \left[ \begin{array} { l l } { \mathbf { I } } & { \mathbf { Q } } \\ { \mathbf { Q } ^ { \mathbf { T } } } & { \mathbf { I } } \end{array} \right] \left[ \frac { \mathbf { \overline { { S } } } ^ { A ^ { 2 } } \mathbf { \Phi } } { \mathbf { 0 } } \right] \mathbf { \overline { { S } } } ^ { B ^ { 2 } } \mathbf { \Phi } ]
392
+ $$
393
+
394
+ reduces to
395
+
396
+ $$
397
+ \left[ \begin{array} { l l } { 1 } & { q } \\ { q } & { 1 } \end{array} \right] \overline { { s } } ^ { 2 }
398
+ $$
399
+
400
+ with eigenvalues $s \sqrt { 1 \pm q }$ and eigenvectors
401
+
402
+ $$
403
+ \left[ \begin{array} { c c } { 1 } & { 1 } \\ { 1 } & { - 1 } \end{array} \right]
404
+ $$
405
+
406
+ Corresponding to the shared structure between the tasks and the differences between them. We note that the sign of the alignment $q$ is irrelevant as a special case of the fact (noted above) that any orthogonal transformation on the output modes does not affect transfer.
407
+
408
+ # D.1 MISALIGNMENT AND INTERFERENCE
409
+
410
+ Why is there interference between tasks which are not well aligned? In the rank one case, we are effectively changing the (input) singular dimensions of $\overline { { \mathbf { Y } } } _ { A }$ from $\overline { { \mathbf { V } } } ^ { A }$ to $\overline { { \mathbf { V } } } ^ { A B }$ . The two singular modes of VAB correspond to the shared structure between the tasks (weighted by the relative signal strengths), and the differences between them, respectively. Although we may be improving our estimates of the shared mode if $q > 0$ (by increasing its singular value relative to ${ \overline { { s } } } _ { A }$ ), we are actually decreasing its alignment with $\overline { { \mathbf { V } } } ^ { A }$ unless $q = 1$ . This misalignment is captured by the second mode of $\overline { { \mathbf { V } } } ^ { A B }$ , but the increase in the singular value of the first mode must come at the cost of a decrease in the singular value of the second mode. See Fig. 10 for a conceptual illustration of this. This means that the multi-task setting allows the distinctions between the tasks to sink towards the sea of noise, while pulling out the common structure. In other words, transferring knowledge from one task always comes at the cost of ignoring differences between the tasks. Furthermore, incorporating a task $B$ allows its noise to seep into the task $A$ signal. Together, these two effects help to explain why transfer can be sometimes beneficial but sometimes detrimental.
411
+
412
+ ![](images/2ff9eeb17e34a1c5c018c10339262e9b2643717551b0503ce8da75485a108ec8.jpg)
413
+ Figure 10: Conceptual cartoon of how $\mathcal { T } ^ { A B }$ , the transfer benefit (or cost) arises from alignment between the task’s input modes.
414
+
415
+ # E NON-GRADIENT TRAINING ALGORITHM
416
+
417
+ In Fig. 11 we show the match between the error achieved by training the student by gradient descent and the optimal stopping error predicted by the non-gradient shrinkage algorithm in the case of a rank-1 teacher.
418
+
419
+ ![](images/8fe699450a90e0a1da920afb212efc64c0b70cce8fa419ef6569d47e281026cc.jpg)
420
+ Figure 11: Match between optimal stopping error prediction from non-gradient training algorithm and empirical optimal stopping error for a rank-1 teacher.
421
+
422
+ # F TRANSFER RESULTS GENERALIZE TO NON-LINEAR NETWORKS
423
+
424
+ Since most deep learning practitioners do not train linear networks, it is important that our theoretical insights generalize beyond this simple case. In this section we show that the transfer patterns qualitatively generalize to non-linear networks.
425
+
426
+ Here, we show results from teacher networks with $\overline { { N } } _ { 1 } = 1 0 0 \overline { { N } } _ { 3 } = 5 0$ , $\overline { { N } } _ { 2 } = 4$ (thus the task is higher rank) and leaky relu non-linearities at the hidden and output layers. We train a student with leaky relu units and $N _ { 2 } = N _ { 3 }$ to solve this task. Results qualitatively look quite similar to those in Fig 5. of the main text for rank one linear teachers, see below. Thus our insights into transfer may help to understand multi-task benefits in more complicated architectures.
427
+
428
+ ![](images/3aa21b341a46731773f7366f14f4c4df08b4e4ea25985a881fa5ca23d11fc270.jpg)
429
+ Figure 12: Transfer benefit $\mathcal { T } ^ { A B } ( \overline { { s } } _ { A } , \overline { { s } } _ { B } , q )$ for non-linear teachers and students, plotted at different values of ${ \overline { { s } } } _ { A }$ . (a) $\overline { { s } } _ { A } = 0 . 8 4 = \sqrt [ 4 ] { A }$ . With support from another aligned task, especially one with moderately higher SNR, performance on a low SNR task will improve. (b) ${ \overline { { s } } } _ { A } = 3$ . Tasks with modest signals will face interference from poorly aligned tasks, but benefits from well aligned tasks. These effects are amplified by SNR. (c) $\overline { { s } } _ { A } = 1 0 0$ . Tasks with very strong signals will show little effect from other tasks (note y-axis scale), but any impact will be negative unless the tasks are very well aligned.
430
+
431
+ # G VARYING THE NUMBER OF TRAINING EXAMPLES
432
+
433
+ In the main text, we focused on the test error dynamics in the case in which the number of examples equalled the number of inputs. Here we show how the formula for test error curves is modified as the number of training examples $P$ is varied. For simplicity, when $P \neq N _ { 1 }$ , we focus on the case of a full rank student with aspect ratio $A = 1$ (so that $N _ { 1 } = N _ { 2 } = N _ { 3 }$ ). The more general case of lower rank students with non-unity aspect ratios can be easily found from this case, but with some additional bookkeeping.
434
+
435
+ As before, we assume the teacher generates noisy outputs from a set of $P$ inputs:
436
+
437
+ $$
438
+ \hat { \mathbf { y } } ^ { \mu } = \overline { { \mathbf { W } } } \hat { \mathbf { x } } ^ { \mu } + \mathbf { z } ^ { \mu } \qquad \mathrm { f o r } \quad \mu = 1 , \ldots , \mathbf { P } .
439
+ $$
440
+
441
+ ![](images/cdfbc5d1756ec978413726647b732f78c395fed4934518082d5a82318c0a50f6.jpg)
442
+ Figure 13: The effects of varying the number of training examples $P$ . (a) Test error for a student learning from a rank-1 teacher with an SNR of 3, with different numbers of inputs. (b,c) Minimum generalization error plotted against $\sqrt { P / N _ { 1 } }$ and SNR · $\sqrt { P / N _ { 1 } }$ , respectively, at different SNRs. When $P \geq N _ { 1 }$ , the minimum generalization error is simply determined by $\mathrm { S N R } \sqrt { P / N _ { 1 } }$ , so all curves converge to a single asymptotic line in (c) as $P$ increases. When $P < N _ { 1 }$ , however, the curves for different SNRs separate because the projection and noise effects depend on initial SNR. (d) Optimal stopping error for gaussian vs. orthogonal inputs, showing a strong correlation. Thus our use of orthogonal inputs in the theory also yields insight into the more general case of approximately unit norm Gaussian inputs. (For all panels $N _ { 1 } = N _ { 2 } = N _ { 3 } = 1 0 0$ , ${ \overline { { N } } } _ { 2 } ^ { - } = 1 .$ )
443
+
444
+ This training set yields important second-order training statistics that will guide student learning:
445
+
446
+ $$
447
+ \begin{array} { r } { \pmb { \Sigma } ^ { 1 1 } \equiv \hat { \mathbf { X } } \hat { \mathbf { X } } ^ { T } \qquad \pmb { \Sigma } ^ { 3 1 } \equiv \hat { \mathbf { Y } } \hat { \mathbf { X } } ^ { T } = \overline { { \mathbf { W } } } \hat { \mathbf { X } } \hat { \mathbf { X } } ^ { T } + \mathbf { Z } \hat { \mathbf { X } } ^ { T } . } \end{array}
448
+ $$
449
+
450
+ Here $\hat { \mathbf { X } } , \hat { \mathbf { Y } }$ , and $\mathbf { Z }$ are each $\overline { { N } } _ { 1 }$ by $P$ , $\overline { { N } } _ { 3 }$ by $P$ , and $\overline { { N } } _ { 3 }$ by $P$ matrices respectively, whose $\mu ^ { \mathrm { i } }$ ’th columns are $\hat { \mathbf { x } } ^ { \mu } , \hat { \mathbf { y } } ^ { \mu }$ , and $\hat { \mathbf { z } } ^ { \mu }$ , respectively. $\dot { \mathbf { \Sigma } } ^ { 1 \mathrm { 1 } }$ is an $\overline { { N } } _ { 1 }$ by $\overline { { N } } _ { 1 }$ input correlation matrix, and $\pmb { \Sigma } ^ { 3 1 }$ is an $\overline { { N } } _ { 3 }$ by $\overline { { N } } _ { 1 }$ the input-output correlation matrix. We choose the matrix elements $z _ { i } ^ { \mu }$ of the noise matrix $\mathbf { Z }$ to be drawn iid from a Gaussian with zero mean and variance $\sigma _ { z } ^ { 2 } / \overline { { N } } _ { 1 }$ . The noise scaling is chosen so the singular values of the teacher $\overline { { \mathbf { W } } }$ and the noise $\mathbf { Z }$ are both $O ( 1 )$ , leading to non-trivial generalization effects. Furthermore, we chose training inputs to be close to unit-norm, and make the input covariance matrix $\pmb { \Sigma } ^ { 1 1 }$ as white as possible (whitening is a common pre-processing step for inputs). When $P > \overline { { N } } _ { 1 }$ , this can be done by choosing the rows of $\hat { \bf X }$ to be orthonormal and then scaling up by $\sqrt { P / \overline { { N } } _ { 1 } }$ , so the columns are approximately unit norm. Then $\Sigma ^ { 1 1 } = P / \overline { { N } } _ { 1 } \mathbf { I }$ is proportional to the identity. On the otherhand, if $P < \overline { { N } } _ { 1 }$ , we choose the columns of $\hat { \bf X }$ to be orthonormal, so that $\pmb { \Sigma } ^ { 1 1 } = \pmb { \mathcal { P } } ^ { | | }$ , where $\mathcal { P } ^ { | | }$ is a projection operator onto the $P$ dimensional column space of $\hat { \mathbf X }$ spanned by the input examples. Both these choices are intended to approximate the situation in which the columns of $\hat { \bf X }$ are chosen to be iid unit-norm vectors. Finally, as generalization performance will depend on the ratio of teacher singular values to the noise variance parameter $\sigma _ { z } ^ { 2 }$ we simply set $\sigma _ { z } = 1$ as in the main text. Thus, given the unit-norm inputs, we can think of the teacher singular values as signal to noise ratios (SNRs). We now examine how the dynamics of the test error evolves as we vary the number of training examples $P$ . We split our analyses into two distinct regimes: (1) the oversampled regime in which the data density $\bar { \mathcal { D } } \equiv P / N _ { 1 } > \mathrm { ~ \bar { ~ } { ~ 1 ~ } ~ }$ , and (2) the undersampled regime in which $\mathcal { D } < 1$ .
451
+
452
+ # G.1 THE OVERSAMPLED REGIME
453
+
454
+ The oversampled regime $\mathcal { D } > 1 \vert$ ) is relatively simple. First $\pmb { \Sigma } ^ { 1 1 }$ is scaled up by a factor of $\mathcal { D }$ . And in the input-output covariance matrix, ${ \boldsymbol { \Sigma } } ^ { 3 1 } = \overline { { \mathbf { W } } } \hat { \mathbf { X } } \hat { \mathbf { X } } ^ { T } + \mathbf { Z } \hat { \mathbf { X } } ^ { T }$ , the signal component, $\overline { { \mathbf { W } } } \hat { \mathbf { X } } \hat { \mathbf { X } } ^ { T }$ is scaled up by a factor of $\mathcal { D }$ while the noise component √ $\mathbf { Z } \hat { \mathbf { X } } ^ { T }$ has the same singular value spectrum as the $\mathcal { D } = 1$ case, up to an overall scaling by √ $\sqrt { \mathcal { D } }$ (since the rows of $\hat { \mathbf X }$ are orthogonal and all its√ singular values are equal to $\sqrt { \mathcal { D } }$ ). This leads to an increase in the effective SNR by a factor of $\sqrt { \mathcal { D } }$ . Thus overall, the test error curves for the case of $\mathcal { D } > 1$ can be simply obtained from the theory of the test error curves for $\mathcal { D } = 1$ through two modifications: (1) a boost in the SNR for the $\mathcal { D } = 1$ case by a multiplicative factor of $\sqrt { \mathcal { D } }$ , and (2) and an overall speed up in the learning time by a multiplicative factor of $\mathcal { D }$ .
455
+
456
+ # G.2 THE UNDERSAMPLED REGIME
457
+
458
+ For the undersampled regime $\mathcal { D } < 1 \dot { }$ ), we must account for the fact that the $P$ training inputs do not span the full $N _ { 1 }$ dimensional space of all inputs. Thus the projection operator $\mathcal { P } ^ { | | }$ onto the $P$ dimensional column space of $\hat { \mathbf X }$ plays a crucial role. Indeed the input-correlation $\pmb { \Sigma } ^ { 1 1 } = \pmb { \mathcal { P } } ^ { | | }$ . And ${ \boldsymbol { \Sigma } } ^ { 3 1 } = \overline { { \mathbf { W } } } \mathbf { \mathcal { P } } ^ { | | } + \mathbf { Z } \hat { \mathbf { X } } ^ { T }$ . This implies that the learning dynamics only transforms the composite student map W from the $P$ dimensional subspace spanned by the inputs to the $N _ { 3 }$ dimensional output space. In contrast, the student map from the $N _ { 1 } - P$ dimensional subspace orthogonal to the image of $\mathcal { P } ^ { | | }$ remains frozen. Tracing through the equations of the main paper and accounting for the projection operator $\mathcal { P } ^ { | | }$ , we find the effective aspect ratio for this undersampled learning problem (when $N _ { 3 } = N _ { 2 } = N _ { 1 } ;$ is no longer $\mathcal { A } = N _ { 3 } / \bar { N _ { 1 } }$ but rather $\mathcal { D } = P / N _ { 1 }$ . Furthermore, in the limit $\overline { { N } } _ { 3 } , \overline { { N } } _ { 1 } \infty$ while $\overline { { N } } _ { 2 }$ remains √ $O ( 1 )$ , the singular values of the signal component $\overline { { \mathbf { W } } } \mathcal { P } ^ { | | }$ of $\pmb { \Sigma } ^ { 3 1 }$ are attenuated by a factor of $\sqrt { \mathcal { D } }$ , making the associated singular vectors more susceptible to noise. Again tracing through the equations of the main paper, with all of these modifications, we find the final formula for test error curves in the undersampled measurement regime:
459
+
460
+ $$
461
+ \varepsilon _ { \mathsf { t e s t } } ( t ) = { \frac { \left[ ( N _ { 3 } - P ) \epsilon ^ { 2 } + ( P - { \overline { { N } } } _ { 2 } ) \langle s ( { \hat { s } } , t ) ^ { 2 } \rangle + \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } \left[ ( s _ { \alpha } ( t ) - { \overline { { s } } } _ { \alpha } ) ^ { 2 } + 2 s _ { \alpha } ( t ) { \overline { { s } } } _ { \alpha } ( 1 - { \mathcal { O } } ( { \sqrt { \overline { { D } } } } { \overline { { s } } } _ { \alpha } ) ) \right] \right] } { \left[ \sum _ { \alpha = 1 } ^ { \overline { { N } } _ { 2 } } { \overline { { s } } } _ { \alpha } ^ { 2 } \right] } }
462
+ $$
463
+
464
+ This equation has several modifications compared to the case $P = N _ { 1 }$ in (15). First the term in the numerator involving $N _ { 3 } - P$ reflects generalization error due to the $N _ { 3 } - P$ dimensional frozen subspace, and the initial weight variance $\epsilon ^ { 2 }$ contributes to this generalization error. The second term in the numerator involves all the $P - { \overline { { N } } } _ { 2 }$ training modes which cannot be correlated with the teacher, and the average $\langle \cdot \rangle$ is over a Marcenko-Pasteur distribution of singular values (see (13)) except with the aspect ratio $\mathcal { A }$ replaced by $\mathcal { D }$ . The third term accounts for learned correlations between the student and teacher. It involves the transformation from teacher singular values $\overline { { s } }$ to training data singular values $\hat { s }$ through the formula (11) except with the aspect ratio replacement √ $A \mathcal { D }$ , and the effective teacher singular value attenuation $\overline { { s } } \sqrt { D } \overline { { s } }$ . Similarly, the computation of the singular vector overlap is done through (12) also with the replacements $A \mathcal { D }$ and $\overline { { s } } \sqrt { D } \overline { { s } }$ .
465
+
466
+ # G.3 COMPARISON OF THEORY AND EXPERIMENT FOR UNDER AND OVER SAMPLED MEASUREMENT REGIMES
467
+
468
+ In Fig. 13, we show an excellent match between our theory and empirical simulations for varying values of $P$ , both in the oversampled and undersampled measurement regimes. There are a number of interesting features to note. First, although the minimum generalization error improves monotonically with $P$ , the asymptotic $t \to \infty$ ) generalization error does not, because of a frozen subspace (Advani & Saxe, 2017) of the modes that are not overfit when $P < N _ { 1 }$ , because the training data rank is $\le P$ . Second, when $P \geq N _ { 1 }$ , the minimum generalization error is simply determined by $\mathbf { S N R } \sqrt { P / N _ { 1 } }$ , so all curves converge to a single asymptotic line as $P$ increases. When $P < N _ { 1 }$ , however, the curves for different SNRs separate because the projection and noise effects depend on initial SNR. Finally, in Fig. 13D we show that approximately unit norm i.i.d. gaussian inputs yield similar results to the orthogonalized data matrices we employed in the theory, although the gaussian inputs do result in slightly higher optimal stopping error.
469
+
470
+ # H LESS THAN FULL RANK STUDENTS
471
+
472
+ Although we generally assumed students were full rank in the main text to simplify the calculations, our theory remains exact for TA networks of any rank. Furthermore, as shown in Fig. 14, the TA and random networks again show very similar optimal stopping generalization error, but with the optimal stopping time of the random networks lagging behind that of the TA networks. Furthermore, this lag increases as the rank of the random network decreases (because a low rank network will have less initial projection onto the random modes, there is is more alignment to be done). However, reducing the student rank does not change the optimal stopping error (as long as it is still greater than the teacher rank).
473
+
474
+ ![](images/6f1091544ee918b4ed7b6456f495e4dd5c10e618ea9cc7217b0d7c4d68a60fb8.jpg)
475
+ (c) Optimal generalization error vs. optimal(d) Optimal generalization error vs. optimal stopping time for stopping time for randomly initialized networksinitially aligned networks
476
+ Figure 14: Empirical verification that the simplifying assumptions of our theory are approximately valid in the regime we are considering at different student ranks. Initializations with random initial weights (random init.) and initializations with initial weight aligned to the noisy data SVD (aligned init.) are compared across varying student ranks. (a) The minimum generalization errors are almost identical between the different initializations and different student ranks. (b) The optimal stopping time in the randomly initialized networks consistently lags behind the aligned networks, because it takes time for the alignment to occur. This lag increases as the students rank decreases. (c) Randomly initialized networks of varying ranks obey qualitatively similar trends of increase in optimal stopping error and optimal stopping time as SNR decreases. (d) The theory predicts the aligned networks trends of increase in optimal stopping error and optimal stopping time with decreasing SNR almost perfectly. (All plots are made with a rank 1 teacher and $N _ { 1 } = N _ { 3 } = 1 0 0 \rangle$ )
md/train/ryiAv2xAZ/ryiAv2xAZ.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRAINING CONFIDENCE-CALIBRATED CLASSIFIERS FOR DETECTING OUT-OF-DISTRIBUTION SAMPLES
2
+
3
+ Kimin Lee∗ Honglak Lee§ ,† Kibok Lee† Jinwoo Shin∗ ∗Korea Advanced Institute of Science and Technology, Daejeon, Korea †University of Michigan, Ann Arbor, MI 48109 §Google Brain, Mountain View, CA 94043
4
+
5
+ # ABSTRACT
6
+
7
+ The problem of detecting whether a test sample is from in-distribution (i.e., training distribution by a classifier) or out-of-distribution sufficiently different from it arises in many real-world machine learning applications. However, the state-of-art deep neural networks are known to be highly overconfident in their predictions, i.e., do not distinguish in- and out-of-distributions. Recently, to handle this issue, several threshold-based detectors have been proposed given pre-trained neural classifiers. However, the performance of prior works highly depends on how to train the classifiers since they only focus on improving inference procedures. In this paper, we develop a novel training method for classifiers so that such inference algorithms can work better. In particular, we suggest two additional terms added to the original loss (e.g., cross entropy). The first one forces samples from out-of-distribution less confident by the classifier and the second one is for (implicitly) generating most effective training samples for the first one. In essence, our method jointly trains both classification and generative neural networks for out-of-distribution. We demonstrate its effectiveness using deep convolutional neural networks on various popular image datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks (DNNs) have demonstrated state-of-the-art performance on many classification tasks, e.g., speech recognition (Hannun et al., 2014), image classification (Girshick, 2015), video prediction (Villegas et al., 2017) and medical diagnosis (Caruana et al., 2015). Even though DNNs achieve high accuracy, it has been addressed (Lakshminarayanan et al., 2017; Guo et al., 2017) that they are typically overconfident in their predictions. For example, DNNs trained to classify MNIST images often produce high confident probability $9 1 \%$ even for random noise (see the work of (Hendrycks & Gimpel, 2016)). Since evaluating the quality of their predictive uncertainty is hard, deploying them in real-world systems raises serious concerns in AI Safety (Amodei et al., 2016), e.g., one can easily break a secure authentication system that can be unlocked by detecting the gaze and iris of eyes using DNNs (Shrivastava et al., 2017).
12
+
13
+ The overconfidence issue of DNNs is highly related to the problem of detecting out-of-distribution: detect whether a test sample is from in-distribution (i.e., training distribution by a classifier) or outof-distribution sufficiently different from it. Formally, it can be formulated as a binary classification problem. Let an input $\mathbf { x } \in \mathcal { X }$ and a label $y \in { \mathcal { Y } } = \mathbf { \bar { \rho } } \qquad $ be random variables that follow a joint data distribution $P _ { \mathrm { i n } } \left( \mathbf { x } , y \right) = P _ { \mathrm { i n } } \left( y | \mathbf { x } \right) P _ { \mathrm { i n } } \left( \mathbf { x } \right)$ . We assume that a classifier $P _ { \boldsymbol { \theta } } \left( y | \mathbf { x } \right)$ is trained on a dataset drawn from $P _ { \mathrm { i n } } \left( \mathbf { x } , y \right)$ , where $\theta$ denotes the model parameter. We let $P _ { \mathrm { o u t } }$ $\mathbf { \tau } ( \mathbf { x } )$ denote an out-of-distribution which is ‘far away’ from in-distribution $P _ { \mathrm { i n } } \left( \mathbf { x } \right)$ . Our problem of interest is determining if input $\mathbf { x }$ is from $P _ { \mathrm { i n } }$ or $P _ { \mathrm { o u t } }$ , possibly utilizing a well calibrated classifier $P _ { \boldsymbol { \theta } } \left( y | \mathbf { x } \right)$ . In other words, we aim to build a detector, $g ( \mathbf { x } ) : \mathcal { X } \{ 0 , 1 \}$ , which assigns label 1 if data is from in-distribution, and label 0 otherwise.
14
+
15
+ There have been recent efforts toward developing efficient detection methods where they mostly have studied simple threshold-based detectors (Hendrycks & Gimpel, 2016; Liang et al., 2017) utilizing a pre-trained classifier. For each input $\mathbf { x }$ , it measures some confidence score $q ( \mathbf { x } )$ based on a pre-trained classifier, and compares the score to some threshold $\delta > 0$ . Then, the detector assigns label 1 if the confidence score $q ( \mathbf { x } )$ is above $\delta$ , and label 0, otherwise. Specifically, (Hendrycks & Gimpel, 2016) defined the confidence score as a maximum value of the predictive distribution, and (Liang et al., 2017) further improved the performance by using temperature scaling (Guo et al., 2017) and adding small controlled perturbations to the input data. Although such inference methods are computationally simple, their performances highly depend on the pre-trained classifier. Namely, they fail to work if the classifier does not separate the maximum value of predictive distribution well enough with respect to $P _ { \mathrm { i n } }$ and $P _ { \mathrm { o u t } }$ . Ideally, a classifier should be trained to separate all class-dependent in-distributions as well as out-of-distribution in the output space. As another line of research, Bayesian probabilistic models (Li & Gal, 2017; Louizos & Welling, 2017) and ensembles of classifiers (Lakshminarayanan et al., 2017) were also investigated. However, training or inferring those models are computationally more expensive. This motivates our approach of developing a new training method for the more plausible simple classifiers. Our direction is orthogonal to the Bayesian and ensemble approaches, where one can also combine them for even better performance.
16
+
17
+ Contribution. In this paper, we develop such a training method for detecting out-of-distribution $P _ { \mathrm { o u t } }$ better without losing its original classification accuracy. First, we consider a new loss function, called confidence loss. Our key idea on the proposed loss is to additionally minimize the KullbackLeibler (KL) divergence from the predictive distribution on out-of-distribution samples to the uniform one in order to give less confident predictions on them. Then, in- and out-of-distributions are expected to be more separable. However, optimizing the confidence loss requires training samples from out-of-distribution, which are often hard to sample: a priori knowledge on out-of-distribution is not available or its underlying space is too huge to cover. To handle the issue, we consider a new generative adversarial network (GAN) (Goodfellow et al., 2014) for generating most effective samples from $P _ { \mathrm { o u t } }$ . Unlike the original GAN, the proposed GAN generates ‘boundary’ samples in the low-density area of $P _ { \mathrm { i n } }$ . Finally, we design a joint training scheme minimizing the classifier’s loss and new GAN loss alternatively, i.e., the confident classifier improves the GAN, and vice versa, as training proceeds. Here, we emphasize that the proposed GAN does not need to generate explicit samples under our scheme, and instead it implicitly encourages training a more confident classifier.
18
+
19
+ We demonstrate the effectiveness of the proposed method using deep convolutional neural networks such as AlexNet (Krizhevsky, 2014) and VGGNet (Szegedy et al., 2015) for image classification tasks on CIFAR (Krizhevsky & Hinton, 2009), SVHN (Netzer et al., 2011), ImageNet (Deng et al., 2009), and LSUN (Yu et al., 2015) datasets. The classifier trained by our proposed method drastically improves the detection performance of all threshold-based detectors (Hendrycks & Gimpel, 2016; Liang et al., 2017) in all experiments. In particular, VGGNet with 13 layers trained by our method improves the true negative rate (TNR), i.e., the fraction of detected out-of-distribution (LSUN) samples, compared to the baseline: $1 4 . 0 \% 3 9 . 1 \%$ and $4 6 . 3 \% 9 8 . 9 \%$ on CIFAR-10 and SVHN, respectively, when $9 5 \%$ of in-distribution samples are correctly detected. We also provide visual understandings on the proposed method using the image datasets. We believe that our method can be a strong guideline when other researchers will pursue these tasks in the future.
20
+
21
+ # 2 TRAINING CONFIDENT NEURAL CLASSIFIERS
22
+
23
+ In this section, we propose a novel training method for classifiers in order to improve the performance of prior threshold-based detectors (Hendrycks & Gimpel, 2016; Liang et al., 2017) (see Appendix A for more details). Our motivation is that such inference algorithms can work better if the classifiers are trained so that they map the samples from in- and out-of-distributions into the output space separately. Namely, we primarily focus on training an improved classifier, and then use prior detectors under the trained model to measure its performance.
24
+
25
+ # 2.1 CONFIDENT CLASSIFIER FOR OUT-OF-DISTRIBUTION
26
+
27
+ Without loss of generality, suppose that the cross entropy loss is used for training. Then, we propose the following new loss function, termed confidence loss:
28
+
29
+ $$
30
+ \operatorname* { m i n } _ { \theta } \mathbb { E } _ { P _ { \mathrm { i n } } ( \widehat { \mathbf { x } } , \widehat { y } ) } \big [ - \log P _ { \theta } \left( y = \widehat { y } | \widehat { \mathbf { x } } \right) \big ] + \beta \mathbb { E } _ { P _ { \mathrm { o u t } } ( \mathbf { x } ) } \big [ K L \left( \mathcal { U } \left( y \right) \mid \mid P _ { \theta } \left( y | \mathbf { x } \right) \right) \big ] ,
31
+ $$
32
+
33
+ where $K L$ denotes the Kullback-Leibler (KL) divergence, $\mathcal { U } \left( y \right)$ is the uniform distribution and $\beta > 0$ is a penalty parameter. It is highly intuitive as the new loss forces the predictive distribution on out-of-distribution samples to be closer to the uniform one, i.e., zero confidence, while that for samples from in-distribution still follows the label-dependent probability. In other words, the proposed loss is designed for assigning higher maximum prediction values, i.e., $\operatorname* { m a x } _ { y } P _ { \theta } \left( y | \mathbf { x } \right)$ , to in-distribution samples than out-of-distribution ones. Here, a caveat is that adding the KL divergence term might degrade the classification performance. However, we found that it is not the case due to the high expressive power of deep neural networks, while in- and out-of-distributions become more separable with respect to the maximum prediction value by optimizing the confidence loss (see Section 3.1 for supporting experimental results).
34
+
35
+ ![](images/30ab0a6c3ac8a37d7cbd9bd3d2b7465e59b564853612866bbddd064ad62f4900.jpg)
36
+ Figure 1: Illustrating the behavior of classifier under different out-of-distribution training datasets. We generate the out-of-distribution samples from (a) 2D box $[ - 5 0 , 5 0 ] ^ { 2 }$ , and show (b) the corresponding decision boundary of classifier. We also generate the out-of-distribution samples from (c) 2D box $[ - 2 0 , 2 0 ] ^ { 2 }$ , and show (d) the corresponding decision boundary of classifier.
37
+
38
+ We remark that minimizing a similar KL loss was studied recently for different purposes (Lee et al., 2017; Pereyra et al., 2017). Training samples for minimizing the KL divergence term is explicitly given in their settings while we might not. Ideally, one has to sample all (almost infinite) types of outof-distribution to minimize the KL term in (1), or require some prior information on testing out-ofdistribution for efficient sampling. However, this is often infeasible and fragile. To address the issue, we suggest to sample out-of-distribution close to in-distribution, which could be more effective in improving the detection performance, without any assumption on testing out-of-distribution.
39
+
40
+ In order to explain our intuition in details, we consider a binary classification task on a simple example, where each class data is drawn from a Gaussian distribution and entire data space is bounded by 2D box $[ - 5 0 , 5 0 ] ^ { 2 }$ for visualization. We apply the confidence loss to simple fully-connected neural networks (2 hidden layers and 500 hidden units for each layer) using different types of outof-distribution training samples. First, as shown in Figure 1(a), we construct an out-of-distribution training dataset of 100 (green) points using rejection sampling on the entire data space $[ - 5 0 , 5 0 ] ^ { 2 }$ . Figure 1(b) shows the decision boundary of classifier optimizing the confidence loss on the corresponding dataset. One can observe that a classifier still shows overconfident predictions (red and blue regions) near the labeled in-distribution region. On the other hand, if we construct a training out-of-distribution dataset of 100 points from $[ - 2 0 , 2 0 ] ^ { 2 }$ , i.e., closer to target, in-distribution space (see Figure 1(c)), a classifier produces confident predictions only on the labeled region and zero confidence on the remaining in the entire data space $[ - 5 0 , 5 0 ] ^ { 2 }$ as shown in Figure 1(d). If one increases the number of training out-of-distribution samples which are generated from the entire space, i.e., $[ - 5 0 , 5 0 ] ^ { 2 }$ , Figure 1(b) is expected to be similar to Figure 1(d). In other words, one need more samples in order to train a confident classifier if samples are generated from the entire space. However, this might be impossible and not efficient since the number of out-of-distribution training samples might be almost infinite to cover its entire, huge actual data space. This implies that training out-of-distribution samples nearby the in-distribution region could be more effective in improving the detection performance. Our underlying intuition is that the effect of boundary of in-distribution region might propagate to the entire out-of-distribution space. Our experimental results in Section 3.1 also support this: realistic images are more useful as training out-of-distribution than synthetic datasets (e.g., Gaussian noise) for improving the detection performance when we consider an image classification task. This motivates us to develop a new generative adversarial network (GAN) for generating such effective out-of-distribution samples.
41
+
42
+ # 2.2 ADVERSARIAL GENERATOR FOR OUT-OF-DISTRIBUTION
43
+
44
+ In this section, we introduce a new training method for learning a generator of out-of-distribution inspired by generative adversarial network (GAN) (Goodfellow et al., 2014). We will first assume that the classifier for in-distribution is fixed, and also describe the joint learning framework in the next section.
45
+
46
+ The GAN framework consists of two main components: discriminator $D$ and generator $G$ . The generator maps a latent variable $\mathbf { z }$ from a prior distribution $P _ { \mathrm { p r i } } \left( \mathbf { z } \right)$ to generated outputs $G \left( \mathbf { z } \right)$ , and discriminator $D : \mathcal { X } [ 0 , 1 ]$ represents a probability that sample $\mathbf { x }$ is from a target distribution. Suppose that we want to recover the in-distribution $P _ { \mathrm { i n } } ( x )$ using the generator $G$ . Then, one can optimize the following min-max objective for forcing $P _ { G } \approx P _ { \mathrm { i n } }$ :
47
+
48
+ $$
49
+ \operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } ~ \mathbb { E } _ { P _ { \mathrm { i n } } ( \mathbf { x } ) } \big [ \log D \left( \mathbf { x } \right) \big ] + \mathbb { E } _ { P _ { \mathrm { p r i } } ( \mathbf { z } ) } \big [ \log \left( 1 - D \left( G \left( \mathbf { z } \right) \right) \right) \big ] .
50
+ $$
51
+
52
+ However, unlike the original GAN, we want to make the generator recover an effective out-ofdistribution $P _ { \mathrm { o u t } }$ instead of $P _ { \mathrm { i n } }$ . To this end, we propose the following new GAN loss:
53
+
54
+ $$
55
+ \begin{array} { r l } { \underset { G } { \mathop { \operatorname* { m i n } } } \underset { D } { \mathop { \operatorname* { m a x } } } } & { \beta \underbrace { { \mathbb { E } } _ { P _ { G } ( \mathbf { x } ) } \left[ K L \left( \mathcal { U } \left( y \right) \mid P _ { \theta } \left( y | \mathbf { x } \right) \right) \right] } _ { \mathrm { ( a ) } } } \\ & { + \underbrace { { \mathbb { E } } _ { P _ { \mathrm { i n } } \left( \mathbf { x } \right) } \left[ \log D \left( \mathbf { x } \right) \right] + { \mathbb { E } } _ { P _ { G } ( \mathbf { x } ) } \left[ \log \left( 1 - D \left( \mathbf { x } \right) \right) \right] } _ { \mathrm { ( b ) } } , } \end{array}
56
+ $$
57
+
58
+ where $\theta$ is the model parameter of a classifier trained on in-distribution. The above objective can be interpreted as follows: the first term (a) corresponds to a replacement of the out-of-distribution $P _ { \mathrm { o u t } }$ in (1)’s KL loss with the generator distribution $P _ { G }$ . One can note that this forces the generator to generate low-density samples since it can be interpreted as minimizing the log negative likelihood of in-distribution using the classifier, i.e., $P _ { \mathrm { i n } } ( \mathbf { x } ) \approx \exp \left( K L \left( \mathcal { U } \left( y \right) \parallel P _ { \theta } \left( y | \mathbf { x } \right) \right) \right)$ . We remark that this approximation is also closely related to the inception score (Salimans et al., 2016) which is popularly used as a quantitative measure of visual fidelity of the samples. The second term (b) corresponds to the original GAN loss since we would like to have out-of-distribution samples close to in-distribution, as mentioned in Section 2.1. Suppose that the model parameter of classifier $\theta$ is set appropriately such that the classifier produces the uniform distribution for out of distribution samples. Then, the KL divergence term (a) in (3) is approximately 0 no matter what out-of-distribution samples are generated. However, if the samples are far away from boundary, the GAN loss (b) in (3) should be high, i.e., the GAN loss forces having samples being not too far from the in-distribution space. Therefore, one can expect that proposed loss can encourage the generator to produce the samples which are on the low-density boundary of the in-distribution space. We also provide its experimental evidences in Section 3.2.
59
+
60
+ We also remark that (Dai et al., 2017) consider a similar GAN generating samples from out-ofdistribution for the purpose of semi-supervised learning. The authors assume the existence of a pretrained density estimation model such as $\mathrm { P i x e l C N N + + }$ (Salimans et al., 2017) for in-distribution, but such a model might not exist and be expensive to train in general. Instead, we use much simpler confident classifiers for approximating the density. Hence, under our fully-supervised setting, our GAN is much easier to train and more suitable.
61
+
62
+ # 2.3 JOINT TRAINING METHOD OF CONFIDENT CLASSIFIER AND ADVERSARIAL GENERATOR
63
+
64
+ In the previous section, we suggest training the proposed GAN using a pre-trained confident classifier. We remind that the converse is also possible, i.e., the motivation of having such a GAN is for training a better classifier. Hence, two models can be used for improving each other. This naturally suggests a joint training scheme where the confident classifier improves the proposed GAN, and vice versa, as training proceeds. Specifically, we suggest the following joint objective function:
65
+
66
+ $$
67
+ \begin{array} { r l } { \underset { G } { \mathop { \operatorname* { m i n } } } \underset { D } { \mathop { \operatorname* { m a x } } } \underset { \theta } { \mathop { \operatorname* { m i n } } } } & { \underbrace { { \mathbb { E } } _ { P _ { \mathrm { i n } } ( \widehat { \mathbf { x } } , \widehat { y } ) } { [ - \log P _ { \theta } ( y = \widehat { y } | \widehat { \mathbf { x } } ) ] } } _ { \mathrm { ( c ) } } + \beta \underbrace { { \mathbb { E } } _ { P _ { G } ( \mathbf { x } ) } { [ K L ( \mathcal { U } ( y ) \mid | P _ { \theta } ( y | \mathbf { x } ) ) ] } } _ { \mathrm { ( d ) } } } \\ & { \underbrace { + { \mathbb { E } } _ { P _ { \mathrm { i n } } ( \widehat { \mathbf { x } } ) } { [ \log D ( \widehat { \mathbf { x } } ) ] } + { \mathbb { E } } _ { P _ { G } ( \mathbf { x } ) } { [ \log ( 1 - D ( \mathbf { x } ) ) ] } . } _ { } } \end{array}
68
+ $$
69
+
70
+ The classifier’s confidence loss corresponds to ( ${ \vartriangle } \cosh + ( \mathrm { d } )$ , and the proposed GAN loss corresponds to $\mathrm { ( d ) + }$ (e), i.e., they share the KL divergence term (d) under joint training. To optimize the above objective efficiently, we propose an alternating algorithm, which optimizes model parameters $\{ \theta \}$ of classifier and GAN models $\{ G , D \}$ alternatively as shown in Algorithm 1. Since the algorithm monotonically decreases the objective function, it is guaranteed to converge.
71
+
72
+ Algorithm 1 Alternating minimization for detecting and generating out-of-distribution.
73
+
74
+ # repeat
75
+
76
+ /∗ Update proposed $\mathrm { G A N * } /$
77
+
78
+ Sample $\left\{ \mathbf { z } _ { 1 } , \hdots , \mathbf { z } _ { M } \right\}$ and $\left\{ \mathbf { x } _ { 1 } , \hdots , \mathbf { x } _ { M } \right\}$ from prior $P _ { \mathrm { p r i } } \left( \mathbf { z } \right)$ and and in-distribution $P _ { \mathrm { i n } } \left( \mathbf { x } \right)$ respectively, and update the discriminator $D$ by ascending its stochastic gradient of
79
+
80
+ $$
81
+ \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \left[ \log D \left( \mathbf { x } _ { i } \right) + \log \left( 1 - D \left( G \left( \mathbf { z } _ { i } \right) \right) \right) \right] .
82
+ $$
83
+
84
+ Sample $\left\{ \mathbf { z } _ { 1 } , \hdots , \mathbf { z } _ { M } \right\}$ from prior $P _ { \mathrm { p r i } } \left( \mathbf { z } \right)$ , and update the generator $G$ by descending its stochastic gradient of
85
+
86
+ $$
87
+ \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \Big [ \log \big ( 1 - D \left( G \left( \mathbf { z } _ { i } \right) \right) \big ) \Big ] + \frac { \beta } { M } \sum _ { i = 1 } ^ { M } \Big [ K L \left( \mathcal { U } \left( y \right) \| P _ { \theta } \left( y | G \left( \mathbf { z } _ { i } \right) \right) \right) \Big ] .
88
+ $$
89
+
90
+ $/ *$ Update confident classifier $^ { * / }$
91
+
92
+ Sample $\left\{ \mathbf { z } _ { 1 } , \hdots , \mathbf { z } _ { M } \right\}$ and $\left\{ \left( \mathbf { x } _ { 1 } , y _ { 1 } \right) , \ldots , \left( \mathbf { x } _ { M } , y _ { M } \right) \right\}$ from prior $P _ { \mathrm { p r i } } \left( \mathbf { z } \right)$ and in-distribution $P _ { \mathrm { i n } } \left( \mathbf { x } , y \right)$ , respectively, and update the classifier $\theta$ by descending its stochastic gradient of
93
+
94
+ $$
95
+ \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \Big [ - \log P _ { \theta } \left( y = y _ { i } | \mathbf { x } _ { i } \right) + \beta K L \left( \mathcal { U } \left( y \right) \parallel P _ { \theta } \left( y | G \left( \mathbf { z } _ { i } \right) \right) \right) \Big ] .
96
+ $$
97
+
98
+ until convergence
99
+
100
+ # 3 EXPERIMENTAL RESULTS
101
+
102
+ We demonstrate the effectiveness of our proposed method using various datasets: CIFAR (Krizhevsky & Hinton, 2009), SVHN (Netzer et al., 2011), ImageNet (Deng et al., 2009), LSUN (Yu et al., 2015) and synthetic (Gaussian) noise distribution. We train convolutional neural networks (CNNs) including VGGNet (Szegedy et al., 2015) and AlexNet (Krizhevsky, 2014) for classifying CIFAR-10 and SVHN datasets. The corresponding test dataset is used as the in-distribution (positive) samples to measure the performance. We use realistic images and synthetic noises as the out-of-distribution (negative) samples. For evaluation, we measure the following metrics using the threshold-based detectors (Hendrycks & Gimpel, 2016; Liang et al., 2017): the true negative rate (TNR) at $9 5 \%$ true positive rate (TPR), the area under the receiver operating characteristic curve (AUROC), the area under the precision-recall curve (AUPR), and the detection accuracy, where larger values of all metrics indicate better detection performances. Due to the space limitation, more explanations about datasets, metrics and network architectures are given in Appendix B.1
103
+
104
+ <table><tr><td rowspan="2">In-dist</td><td rowspan="2">Out-of-dist</td><td>Classification accuracy</td><td>TNR at TPR 95%</td><td>AUROC</td><td>Detection accuracy</td><td>AUPR in</td><td>AUPR out</td></tr><tr><td colspan="6">Cross entropy loss /Confidence loss</td></tr><tr><td rowspan="3">SVHN</td><td>CIFAR-10 (seen) TinyImageNet (unseen)</td><td rowspan="3">93.82 /94.23</td><td>47.4 /99.9</td><td>62.6 /99.9</td><td>78.6 /99.9</td><td>71.6 /99.9</td><td>91.2/99.4</td></tr><tr><td></td><td>49.0 /100.0</td><td>64.6 /100.0</td><td>79.6 /100.0</td><td>72.7 /100.0</td><td>91.6 /99.4</td></tr><tr><td>LSUN (unseen) Gaussian (unseen)</td><td>46.3/100.0 56.1/100.0</td><td>61.8/100.0 72.0 /100.0</td><td>78.2 /100.0 83.4/100.0</td><td>71.1/100.0 77.2/100.0</td><td>90.8 /99.4 92.8 /99.4</td></tr><tr><td rowspan="3">CIFAR-10</td><td>SVHN (seen)</td><td rowspan="3">80.14 /80.56</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>13.7 / 99.8 13.6 /9.9</td><td>46.6 /99.9</td><td>66.6 /99.8 62.6 /58.6</td><td>61.4 /99.9 58.3 /55.3</td><td>73.5 /99.8 71.0 / 66.1</td></tr><tr><td>TinyImageNet (unseen)</td><td></td><td>39.6 /31.8</td><td></td><td></td><td></td></tr><tr><td rowspan="3"></td><td>LSUN (unseen) Gaussian (unseen)</td><td rowspan="3"></td><td>14.0 / 10.5</td><td>40.7 /34.8</td><td>63.2 / 60.2</td><td>58.7 /56.4</td><td>71.5 /68.0</td></tr><tr><td></td><td>2.8 / 3.3</td><td>10.2 /14.1</td><td>50.0/50.0</td><td>48.1 /49.4</td><td>39.9 /47.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
105
+
106
+ Table 1: Performance of the baseline detector (Hendrycks & Gimpel, 2016) using VGGNet. All values are percentages and boldface values indicate relative the better results. For each in-distribution, we minimize the KL divergence term in (1) using training samples from an out-of-distribution dataset denoted by “seen”, where other “unseen” out-of-distributions were only used for testing.
107
+
108
+ ![](images/82eec49fdb49b288decb05d89feef7881d949c90c40d7146f2041eba0c997d44.jpg)
109
+ Figure 2: For all experiments in (a), (b) and (c), we commonly use the SVHN dataset for indistribution. Fraction of the maximum prediction value in softmax scores trained by (a) cross entropy loss and (b) confidence loss: the $\mathbf { X }$ -axis and y-axis represent the maximum prediction value and the fraction of images receiving the corresponding score, respectively. The receiver operating characteristic (ROC) curves under different losses are reported in (c): the red curve corresponds to the ROC curve of a model trained by optimizing the naive cross entropy loss, whereas other ones correspond to the ROC curves of models trained by optimizing the confidence loss. The KL divergence term in the confidence loss is optimized using explicit out-of-distribution datasets indicated in the parentheses, e.g., Confident loss (LSUN) means that we use the LSUN dataset for optimizing the KL divergence term.
110
+
111
+ # 3.1 EFFECTS OF CONFIDENCE LOSS
112
+
113
+ We first verify the effect of confidence loss in (1) trained by some explicit, say seen, out-ofdistribution datasets. First, we compare the quality of confidence level by applying various training losses. Specifically, the softmax classifier is used and simple CNNs (two convolutional layers followed by three fully-connected layers) are trained by minimizing the standard cross entropy loss on SVHN dataset. We also apply the confidence loss to the models by additionally optimizing the KL divergence term using CIFAR-10 dataset (as training out-of-distribution). In Figure 2(a) and 2(b), we report distributions of the maximum prediction value in softmax scores to evaluate the separation quality between in-distribution (i.e., SVHN) and out-of-distributions. It is clear that there exists a better separation between the SVHN test set (red bar) and other ones when the model is trained by the confidence loss. Here, we emphasize that the maximum prediction value is also low on even untrained (unseen) out-of-distributions, e.g., TinyImageNet, LSUN and synthetic datasets. Therefore, it is expected that one can distinguish in- and out-of-distributions more easily when a classifier is trained by optimizing the confidence loss. To verify that, we obtain the ROC curve using the baseline detector (Hendrycks & Gimpel, 2016) that computes the maximum value of predictive distribution on a test sample and classifies it as positive (i.e., in-distribution) if the confidence score is above some threshold. Figure 2(c) shows the ROC curves when we optimize the KL divergence term on various datasets. One can observe that realistic images such as TinyImageNet (aqua line) and LSUN (green line) are more useful than synthetic datasets (orange line) for improving the detection performance. This supports our intuition that out-of-distribution samples close to in-distribution could be more effective in improving the detection performance as we discussed in Section 2.1.
114
+
115
+ We indeed evaluate the performance of the baseline detector for out-of-distribution using largescale CNNs, i.e., VGGNets with 13 layers, under various training scenarios, where more results on AlexNet and ODIN detector (Liang et al., 2017) can be found in Appendix C (the overall trends of results are similar). For optimizing the confidence loss in (1), SVHN and CIFAR-10 training datasets are used for optimizing the KL divergence term for the cases when the in-distribution is CIFAR-10 and SVHN, respectively. Table 1 shows the detection performance for each in- and out-of-distribution pair. When the in-distribution is SVHN, the classifier trained by our method drastically improves the detection performance across all out-of-distributions without hurting its original classification performance. However, when the in-distribution is CIFAR-10, the confidence loss does not improve the detection performance in overall, where we expect that this is because the trained/seen SVHN out-of-distribution does not effectively cover all tested out-of-distributions. Our joint confidence loss in (4), which was designed under the intuition, resolves the issue of the CIFAR-10 (in-distribution) classification case in Table 1 (see Figure 4(b)).
116
+
117
+ ![](images/e9f90921b82f9cee01a46da1fa1cfd34180f47111c99ee992c262ad48b241d9c.jpg)
118
+ Figure 3: The generated samples from original GAN (a)/(c) and proposed GAN (b)/(d). In (a)/(b), the grey area is the 2D histogram of training in-distribution samples drawn from a mixture of two Gaussian distributions and red points indicate generated samples by GANs.
119
+
120
+ ![](images/7c77a46a2cf9c6a821a4ce5593a77d3e597cc6179d1deaee26e3d473df7e41a5.jpg)
121
+ Figure 4: Performances of the baseline detector (Hendrycks & Gimpel, 2016) under various training losses. For training models by the confidence loss, the KL divergence term is optimized using samples indicated in the parentheses. For fair comparisons, we only plot the performances for unseen out-of-distributions, where those for seen out-of-distributions (used for minimizing the KL divergence term in (1)) can be found in Table 1.
122
+
123
+ # 3.2 EFFECTS OF ADVERSARIAL GENERATOR AND JOINT CONFIDENCE LOSS
124
+
125
+ In this section, we verify the effect of the proposed GAN in Section 2.2 and evaluate the detection performance of the joint confidence loss in (4). To verify that the proposed GAN can produce the samples nearby the low-density boundary of the in-distribution space, we first compare the generated samples by original GAN and proposed GAN on a simple example where the target distribution is a mixture of two Gaussian distributions. For both the generator and discriminator, we use fullyconnected neural networks with 2 hidden layers. For our method, we use a pre-trained classifier which minimizes the cross entropy on target distribution samples and the KL divergence on out-ofdistribution samples generated by rejection sampling on a bounded 2D box. As shown in Figure 3(a), the samples of original GAN cover the high-density area of the target distribution while those of proposed GAN does its boundary one (see Figure 3(b)). We also compare the generated samples of original and proposed GANs on MNIST dataset (LeCun et al., 1998), which consists of handwritten digits. For this experiment, we use deep convolutional GANs (DCGANs) (Radford et al., 2015). In this case, we use a pre-trained classifier which minimizes the cross entropy on MNIST training samples and the KL divergence on synthetic Gaussian noises. As shown in Figure 3(c) and 3(d), samples of original GAN looks more like digits than those of proposed GAN. Somewhat interestingly, the proposed GAN still generates some new digit-like images.
126
+
127
+ ![](images/d41db38747ca1efcc752cd0ff7ae1de2ed89e22acec41b351615403610c3ccf6.jpg)
128
+ Figure 5: Guided gradient (sensitivity) maps of the top-1 predicted class with respect to the input image under various training losses.
129
+
130
+ We indeed evaluate the performance of our joint confidence loss in (4) utilizing the proposed GAN. To this end, we use VGGNets (as classifiers) and DCGANs (as GANs). We also test a variant of confidence loss which optimizes the KL divergence term on samples from a pre-trained original GAN (implicitly) modeling the in-distribution. One can expect that samples from the original GAN can be also useful for improving the detection performance since it may have bad generalization properties (Arora et al., 2017) and generate a few samples on the low-density boundary as like the proposed GAN. Figure 4 shows the performance of the baseline detector for each in- and out-of-distribution pair. First, observe that the joint confidence loss (blue bar) outperforms the confidence loss with some explicit out-of-distribution datasets (green bar). This is quite remarkable since the former is trained only using in-distribution datasets, while the latter utilizes additional out-of-distribution datasets. We also remark that our methods significantly outperform the baseline cross entropy loss (red bar) in all cases without harming its original classification performances (see Table 2 in Appendix C). Interestingly, the confidence loss with the original GAN (orange bar) is often (but not always) useful for improving the detection performance, whereas that with the proposed GAN (blue bar) still outperforms it in all cases.
131
+
132
+ Finally, we also provide visual interpretations of models using the guided gradient maps (Springenberg et al., 2014). Here, the gradient can be interpreted as an importance value of each pixel which influences on the classification decision. As shown in Figure 5, the model trained by the cross entropy loss shows sharp gradient maps for both samples from in- and out-of-distributions, whereas models trained by the confidence losses do only on samples from in-distribution. For the case of SVHN in-distribution, all confidence losses gave almost zero gradients, which matches to the results in Figure 4(a): their detection performances are almost perfect. For the case of CIFAR10 distribution, one can now observe that there exists some connection between gradient maps and detection performances. This is intuitive because for detecting samples from out-of-distributions better, the classifier should look at more pixels as similar importance and the KL divergence term forces it. We think that our visualization results might give some ideas in future works for developing better inference methods for detecting out-of-distribution under our models.
133
+
134
+ # 4 CONCLUSION
135
+
136
+ In this paper, we aim to develop a training method for neural classification networks for detecting out-of-distribution better without losing its original classification accuracy. In essence, our method jointly trains two models for detecting and generating out-of-distribution by minimizing their losses alternatively. Although we primarily focus on image classification in our experiments, our method can be used for any classification tasks using deep neural networks. It is also interesting future directions applying our methods for other related tasks: regression (Malinin et al., 2017), network calibration (Guo et al., 2017), Bayesian probabilistic models (Li & Gal, 2017; Louizos & Welling, 2017), ensemble (Lakshminarayanan et al., 2017) and semi-supervised learning (Dai et al., 2017).
137
+
138
+ # ACKNOWLEDGEMENTS
139
+
140
+ This work was supported in part by the Institute for Information & communications Technology Promotion(IITP) grant funded by the Korea government(MSIT) (No.2017-0-01778, Development of Explainable Human-level Deep Machine Learning Inference Framework), the ICT R&D program of MSIP/IITP [R-20161130-004520, Research on Adaptive Machine Learning Technology Development for Intelligent Autonomous Digital Companion], DARPA Explainable AI (XAI) program #313498 and Sloan Research Fellowship.
141
+
142
+ # REFERENCES
143
+
144
+ Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mane. Con- ´ crete problems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
145
+
146
+ Sanjeev Arora, Rong Ge, Yingyu Liang, Tengyu Ma, and Yi Zhang. Generalization and equilibrium in generative adversarial nets (gans). In International Conference on Machine Learning (ICML), 2017.
147
+
148
+ Rich Caruana, Yin Lou, Johannes Gehrke, Paul Koch, Marc Sturm, and Noemie Elhadad. Intelligible models for healthcare: Predicting pneumonia risk and hospital 30-day readmission. In ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2015.
149
+
150
+ Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan Salakhutdinov. Good semisupervised learning that requires a bad gan. In Advances in neural information processing systems (NIPS), 2017.
151
+
152
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition (CVPR), 2009.
153
+
154
+ Ross Girshick. Fast r-cnn. In International Conference on Computer Vision (ICCV), 2015.
155
+
156
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems (NIPS), 2014.
157
+
158
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International Conference on Machine Learning (ICML), 2017.
159
+
160
+ Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deep speech: Scaling up end-to-end speech recognition. arXiv preprint arXiv:1412.5567, 2014.
161
+
162
+ Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations (ICLR), 2016.
163
+
164
+ Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
165
+
166
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning (ICML), 2015.
167
+
168
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2014.
169
+
170
+ Alex Krizhevsky. One weird trick for parallelizing convolutional neural networks. arXiv preprint arXiv:1404.5997, 2014.
171
+
172
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
173
+
174
+ Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in neural information processing systems (NIPS), 2017.
175
+
176
+ 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.
177
+
178
+ Kimin Lee, Changho Hwang, KyoungSoo Park, and Jinwoo Shin. Confident multiple choice learning. In International Conference on Machine Learning (ICML), 2017.
179
+
180
+ Yingzhen Li and Yarin Gal. Dropout inference in bayesian neural networks with alpha-divergences. In International Conference on Machine Learning (ICML), 2017.
181
+
182
+ Shiyu Liang, Yixuan Li, and R Srikant. Principled detection of out-of-distribution examples in neural networks. arXiv preprint arXiv:1706.02690, 2017.
183
+
184
+ Christos Louizos and Max Welling. Multiplicative normalizing flows for variational bayesian neural networks. In International Conference on Machine Learning (ICML), 2017.
185
+
186
+ Andrey Malinin, Anton Ragni, Kate Knill, and Mark Gales. Incorporating uncertainty into deep learning for spoken language assessment. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), volume 2, pp. 45–50, 2017.
187
+
188
+ Mahdi Pakdaman Naeini, Gregory F Cooper, and Milos Hauskrecht. Obtaining well calibrated probabilities using bayesian binning. In AAAI, 2015.
189
+
190
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, volume 2011, pp. 5, 2011.
191
+
192
+ Gabriel Pereyra, George Tucker, Jan Chorowski, Łukasz Kaiser, and Geoffrey Hinton. Regularizing neural networks by penalizing confident output distributions. arXiv preprint arXiv:1701.06548, 2017.
193
+
194
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In International Conference on Learning Representations (ICLR), 2015.
195
+
196
+ 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 (NIPS), 2016.
197
+
198
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. In International Conference on Learning Representations (ICLR), 2017.
199
+
200
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Josh Susskind, Wenda Wang, and Russ Webb. Learning from simulated and unsupervised images through adversarial training. In Computer Vision and Pattern Recognition (CVPR), 2017.
201
+
202
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
203
+
204
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Computer Vision and Pattern Recognition (CVPR), 2015.
205
+
206
+ Ruben Villegas, Jimei Yang, Yuliang Zou, Sungryull Sohn, Xunyu Lin, and Honglak Lee. Learning to generate long-term future via hierarchical prediction. In International Conference on Machine Learning (ICML), 2017.
207
+
208
+ 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.
209
+
210
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. In International Conference on Learning Representations (ICLR), 2017.
211
+
212
+ # A THRESHOLD-BASED DETECTORS
213
+
214
+ In this section, we formally describe the detection procedure of threshold-based detectors (Hendrycks & Gimpel, 2016; Liang et al., 2017). For each data $\mathbf { x }$ , it measures some confidence score $q ( \mathbf { x } )$ by feeding the data into a pre-trained classifier. Here, (Hendrycks & Gimpel, 2016) defined the confidence score as a maximum value of the predictive distribution, and (Liang et al., 2017) further improved the performance by processing the predictive distribution (see Appendix C.3 for more details). Then, the detector, $g ( \mathbf { x } ) : \mathcal { X } \{ 0 , 1 \}$ , assigns label 1 if the confidence score $q ( \mathbf { x } )$ is above some threshold $\delta$ , and label 0, otherwise:
215
+
216
+ $$
217
+ g \left( \mathbf { x } \right) = \left\{ \begin{array} { l l } { \begin{array} { r l } { 1 } & { \mathrm { i f } q ( \mathbf { x } ) \geq \delta , } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} } \end{array} \right.
218
+ $$
219
+
220
+ For this detector, we have to find a score threshold so that some positive examples are classified correctly, but this depends upon the trade-off between false negatives and false positives. To handle this issue, we use threshold-independent evaluation metrics such as area under the receiver operating characteristic curve (AUORC) and detection accuracy (see Appendix B).
221
+
222
+ # B EXPERIMENTAL SETUPS IN SECTION 3
223
+
224
+ Datasets. We train deep models such as VGGNet (Szegedy et al., 2015) and AlexNet (Krizhevsky, 2014) for classifying CIFAR-10 and SVHN datasets: the former consists of 50,000 training and 10,000 test images with 10 image classes, and the latter consists of 73,257 training and 26,032 test images with 10 digits.2 The corresponding test dataset are used as the in-distribution (positive) samples to measure the performance. We use realistic images and synthetic noises as the out-ofdistribution (negative) samples: the TinyImageNet consists of 10,000 test images with 200 image classes from a subset of ImageNet images. The LSUN consists of 10,000 test images of 10 different scenes. We downsample each image of TinyImageNet and LSUN to size $3 2 \times 3 2$ . The Gaussian noise is independently and identically sampled from a Gaussian distribution with mean 0.5 and variance 1. We clip each pixel value into the range $[ 0 , 1 ]$ .
225
+
226
+ Detailed CNN structure and training. The simple CNN that we use for evaluation shown in Figure 2 consists of two convolutional layers followed by three fully-connected layers. Convolutional layers have 128 and 256 filters, respectively. Each convolutional layer has a $5 \times 5$ receptive field applied with a stride of 1 pixel each followed by max pooling layer which pools $2 \times 2$ regions at strides of 2 pixels. AlexNet (Krizhevsky, 2014) consists of five convolutitonal layers followed by three fullyconnected layers. Convolutional layers have 64, 192, 384, 256 and 256 filters, respectively. First and second convolutional layers have a $5 \times 5$ receptive field applied with a stride of 1 pixel each followed by max pooling layer which pools $3 \times 3$ regions at strides of 2 pixels. Other convolutional layers have a $3 \times 3$ receptive field applied with a stride of 1 pixel followed by max pooling layer which pools $2 \times 2$ regions at strides of 2 pixels. Fully-connected layers have 2048, 1024 and 10 hidden units, respectively. Dropout (Hinton et al., 2012) was applied to only fully-connected layers of the network with the probability of retaining the unit being 0.5. All hidden units are ReLUs. Figure 6 shows the detailed structure of VGGNet (Szegedy et al., 2015) with three fully-connected layers and 10 convolutional layers. Each ConvReLU box in the figure indicates a $3 \times 3$ convolutional layer followed by ReLU activation. Also, all max pooling layers have $2 \times 2$ receptive fields with stride 2. Dropout was applied to only fully-connected layers of the network with the probability of retaining the unit being 0.5. For all experiments, the softmax classifier is used, and each model is trained by optimizing the objective function using Adam learning rule (Kingma & Ba, 2014). For each out-ofdistribution dataset, we randomly select 1,000 images for tuning the penalty parameter $\beta$ , mini-batch size and learning rate. The penalty parameter is chosen from $\beta \in \{ 0 , 0 . 1 , . . . 1 . 9 , 2 \}$ , the mini-batch size is chosen from $\{ 6 4 , 1 \bar { 2 } 8 \}$ and the learning rate is chosen from $\{ 0 . 0 0 1 , 0 . 0 0 0 5 , 0 . 0 0 0 2 \}$ . The optimal parameters are chosen to minimize the detection error on the validation set. We drop the learning rate by 0.1 at 60 epoch and models are trained for total 100 epochs. The best test result is reported for each method.
227
+
228
+ Performance metrics. We measure the following metrics using threshold-based detectors:
229
+
230
+ • True negative rate (TNR) at $95 \%$ true positive rate (TPR). Let TP, TN, FP, and FN denote true positive, true negative, false positive and false negative, respectively. We measure $\mathrm { T N R } = \mathrm { T N } / \left( \mathrm { F P + T N } \right)$ , when $\mathrm { T P R } = \mathrm { T P } .$ / $( \mathrm { T P + F N } )$ is $9 5 \%$ .
231
+
232
+ • Area under the receiver operating characteristic curve (AUROC). The ROC curve is a graph plotting TPR against the false positive rate $= \mathrm { F P }$ / $\mathrm { \ F P { + } T N ) }$ by varying a threshold.
233
+
234
+ • Area under the precision-recall curve (AUPR). The PR curve is a graph plotting the precision $=$ TP / $( \mathrm { T P + F P } )$ against recal $\mathrm { \Lambda } = \mathrm { T P } / \left( \mathrm { T P + F N } \right)$ by varying a threshold. AUPR-IN (or -OUT) is AUPR where in- (or out-of-) distribution samples are specified as positive.
235
+
236
+ • Detection accuracy. This metric corresponds to the maximum classification probability over all possible thresholds $\delta$ : $1 \ \dot { - } \ \operatorname* { m i n } _ { \delta } \left\{ P _ { \mathrm { i n } } \left( q \left( \mathbf x \right) \leq \delta \right) P \left( \mathbf x \right) \right.$ is from $P _ { \mathrm { i n } }$ ) $^ +$ $P _ { \mathrm { o u t } }$ $\dot { \mathbf { \eta } } _ { q } \left( \mathbf { x } \right) > \delta ) \mathbf { \eta } _ { P }$ ( $\mathbf { x }$ is from $P _ { \mathrm { o u t } }$ ) $\}$ , where $q ( \mathbf { x } )$ is a confident score such as a maximum value of softmax. We assume that both positive and negative examples have equal probability of appearing in the test set, i.e., $P$ (x is from $P _ { \mathrm { i n } } ) \stackrel { - } { = } P$ ( $\mathbf { x }$ is from $P _ { \mathrm { o u t } } ) = \bar { 0 } . 5$ .
237
+
238
+ Note that AUROC, AUPR and detection accuracy are threshold-independent evaluation metrics.
239
+
240
+ ![](images/cefa79cfd18994ae4d493f52482b99594b0c93029794a4fe28f238c72ccca960.jpg)
241
+ Figure 6: Detailed structure of VGGNet with 13 layers.
242
+
243
+ Generating samples on a simple example. As shown in Figure 3(a) and Figure 3(b), we compare the generated samples by original GAN and proposed GAN on a simple example where the target distribution is a mixture of two Gaussian distributions. For both the generator and discriminator, we use fully-connected neural networks with 2 hidden layers and 500 hidden units for each layer. For all layers, we use ReLU activation function. We use a 100-dimensional Gaussian prior for the latent variable z. For our method, we pre-train the simple fully-connected neural networks (2 hidden layers and 500 ReLU units for each layer) by minimizing the cross entropy on target distribution samples and the KL divergence on out-of-distribution samples generated by rejection sampling on bounded 2D box $[ - 1 0 , 1 0 ] ^ { \frac { \ d } { 2 } }$ . The penalty parameter $\beta$ is set to 1. We use ADAM learning rule (Kingma & Ba, 2014) with a mini-batch size of 400. The initial learning rate is set to 0.002, and we train for total 100 epochs.
244
+
245
+ Generating samples on MNIST. As shown in Figure 3(c) and Figure 3(d), we compare the generated samples of original and proposed GANs on MNIST dataset, which consists of greyscale images, each containing a digit 0 to 9 with 60,000 training and 10,000 test images. We expand each image to size $3 \times 3 2 \times 3 2$ . For both the generator and discriminator, we use deep convolutional GANs (DCGANs) (Radford et al., 2015). The discriminator and generator consist of four convolutional and deconvolutional layers, respectively. Convolutional layers have 128, 256, 512 and 1 filters, respectively. Each convolutional layer has a $4 \times 4$ receptive field applied with a stride of 2 pixel. The second and third convolutional layers are followed by batch normalization (Ioffe & Szegedy, 2015). For all layers, we use LeakyReLU activation function. Deconvolutional layers have 512, 256, 128 and 1 filters, respectively. Each deconvolutional layer has a $4 \times 4$ receptive field applied with a stride of 2 pixel followed by batch normalization (Ioffe & Szegedy, 2015) and ReLU activation. For our method, we use a pre-trained simple CNNs (two convolutional layers followed by three fully-connected layers) by minimizing the cross entropy on MNIST training samples and the KL divergence on synthetic Gaussian noise. Convolutional layers have 128 and 256 filters, respectively. Each convolutional layer has a $5 \times 5$ receptive field applied with a stride of 1 pixel each followed by max pooling layer which pools $2 \times 2$ regions at strides of 2 pixels. The penalty parameter $\beta$ is set to 1. We use ADAM learning rule (Kingma & Ba, 2014) with a mini-batch size of 128. The initial learning rate is set to 0.0002, and we train for total 50 epochs.
246
+
247
+ # C MORE EXPERIMENTAL RESULTS
248
+
249
+ # C.1 CLASSIFICATION PERFORMANCES
250
+
251
+ Table 2 reports the classification accuracy of VGGNets on CIFAR-10 and SVHN datasets under various training losses shown in Figure 4. One can note that all methods do not degrade the original classification performance, where the differences in classification errors of across all tested single models are at most $1 \%$ in our experiments.
252
+ Table 2: Classification test set accuracy of VGGNets on CIFAR-10 and SVHN datasets under various training losses.
253
+
254
+ <table><tr><td>In-distribution</td><td>Cross entropy</td><td>Confidence loss with original GAN</td><td>Joint confidence loss</td><td>Confidence loss with explicit out-of-distribution samples</td></tr><tr><td>CIFAR-10</td><td>80.14</td><td>80.27</td><td>81.39</td><td>80.56</td></tr><tr><td>SVHN</td><td>93.82</td><td>94.08</td><td>93.81</td><td>94.23</td></tr></table>
255
+
256
+ # C.2 CALIBRATION EFFECTS OF CONFIDENCE LOSS
257
+
258
+ We also verify the calibration effects (Guo et al., 2017) of our methods: whether a classifier trained by our method can indicate when they are likely to be incorrect for test samples from the indistribution. In order to evaluate the calibration effects, we measure the expected calibration error (ECE) (Naeini et al., 2015). Given test data $\left\{ \left( x _ { 1 } , y _ { 1 } \right) , \ldots , \left( x _ { n } , y _ { n } \right) \right\}$ , we group the predictions into $M$ interval bins (each of size nfidence falls into the interv $1 / M )$ $B _ { m }$ be the set of indien, the accuracy of of samples whose predictionis defined as follows: $\textstyle { \bigl ( } { \frac { m - 1 } { M } } , { \frac { m } { M } } { \bigr ] }$ $B _ { m }$
259
+
260
+ $$
261
+ \operatorname { a c c } ( B _ { m } ) = \frac { 1 } { | B _ { m } | } \sum _ { i \in B _ { m } } 1 _ { \{ y _ { i } = \arg \operatorname* { m a x } _ { y } P _ { \theta } ( y | \mathbf { x } _ { i } ) \} } ,
262
+ $$
263
+
264
+ where $\theta$ is the model parameters of a classifier and $1 _ { A } \in \{ 0 , 1 \}$ is the indicator function for event $A$ . We also define the confidence of $B _ { m }$ as follows:
265
+
266
+ $$
267
+ \operatorname { c o n f } ( B _ { m } ) = { \frac { 1 } { \left| B _ { m } \right| } } \sum _ { i \in B _ { m } } q ( \mathbf { x } _ { i } ) ,
268
+ $$
269
+
270
+ where $q ( \mathbf { x } _ { i } )$ is the confidence of data $i$ . Using these notations, we measure the expected calibration error (ECE) as follows:
271
+
272
+ $$
273
+ \mathrm { E C E } = \sum _ { m = 1 } ^ { M } \frac { | B _ { m } | } { n } | \mathrm { a c c } ( B _ { m } ) - \mathrm { c o n f } ( B _ { m } ) | .
274
+ $$
275
+
276
+ One can note that ECE is zero if the confidence score can represent the true distribution. Table 3 shows the calibration effects of confidence loss when we define the confidence score $q$ as the maximum predictive distribution of a classifier. We found that the ECE of a classifier trained by our methods is lower than that of a classifier trained by the standard cross entropy loss. This implies that our proposed method is effective at calibrating predictions. We also remark that the temperature scaling (Guo et al., 2017) provides further improvements under a classifier trained by our joint confidence loss.
277
+
278
+ Table 3: Expected calibration error (ECE) of VGGNets on CIFAR-10 and SVHN datasets under various training losses. The number of bins $M$ is set to 20. All values are percentages and boldface values indicate relative the better results.
279
+
280
+ <table><tr><td>In-distribution</td><td colspan="2">Without temperature scaling Cross entropy loss Joint confidence loss</td><td colspan="2">With temperature scaling Cross entropy loss Joint confidence loss</td></tr><tr><td>CIFAR-10</td><td>18.45</td><td>14.62</td><td>7.07</td><td>6.19</td></tr><tr><td>SVHN</td><td>5.30</td><td>5.13</td><td>2.80</td><td>1.39</td></tr></table>
281
+
282
+ # C.3 EXPERIMENTAL RESULTS USING ODIN DETECTOR
283
+
284
+ In this section, we verify the effects of confidence loss using ODIN detector (Liang et al., 2017) which is an advanced threshold-based detector using temperature scaling (Guo et al., 2017) and input perturbation. The key idea of ODIN is the temperature scaling which is defined as follows:
285
+
286
+ $$
287
+ P _ { \theta } ( y = \widehat { y } | \mathbf { x } ; T ) = \frac { \exp { ( f _ { \widehat { y } } ( \mathbf { x } ) / T ) } } { \sum _ { y } \exp { ( f _ { y } ( \mathbf { x } ) / T ) } } ,
288
+ $$
289
+
290
+ where $T > 0$ is the temperature scaling parameter and $\mathbf { f } = \left( f _ { 1 } , \ldots , f _ { K } \right)$ is final feature vector of neural networks. For each data $\mathbf { x }$ , ODIN first calculates the pre-processed image $\widehat { \mathbf { x } }$ by adding the small perturbations as follows:
291
+
292
+ $$
293
+ \mathbf { x } ^ { \prime } = \mathbf { x } - \varepsilon \mathrm { s i g n } \left( - \bigtriangledown _ { \mathbf { x } } \log P _ { \theta } ( y = \widehat { y } | \mathbf { x } ; T ) \right) ,
294
+ $$
295
+
296
+ where $\varepsilon$ is a magnitude of noise and $\widehat { y }$ is the predicted label. Next, ODIN feeds the prebprocessed data into the classifier, computes the maximum value of scaled predictive distribution, i.e., $\begin{array} { r } { \operatorname* { m a x } _ { y } P _ { \theta } ( y | \mathbf { x } ^ { \prime } ; T ) } \end{array}$ , and classifies it as positive (i.e., in-distribution) if the confidence score is above some threshold $\delta$ .
297
+
298
+ For ODIN detector, the perturbation noise $\varepsilon$ is chosen from $\{ 0 , 0 . 0 0 0 1 , 0 . 0 0 1 , 0 . 0 1 \}$ , and the temperature $T$ is chosen from $\{ 1 , 1 0 , 1 0 0 , 5 0 0 , 1 0 0 0 \}$ . The optimal parameters are chosen to minimize the detection error on the validation set. Figure 7 shows the performance of the OIDN and baseline detector for each in- and out-of-distribution pair. First, we remark that the baseline detector using classifiers trained by our joint confidence loss (blue bar) typically outperforms the ODIN detector using classifiers trained by the cross entropy loss (orange bar). This means that our classifier can map in- and out-of-distributions more separately without pre-processing methods such as temperature scaling. The ODIN detector provides further improvements if one uses it with our joint confidence loss (green bar). In other words, our proposed training method can improve all prior detection methods.
299
+
300
+ ![](images/1380ade19cbcf946e7ad048c487ea59780f88d50e2289a37c6e92a096d1dc661.jpg)
301
+ Figure 7: Performances of the baseline detector (Hendrycks & Gimpel, 2016) and ODIN detector (Liang et al., 2017) under various training losses.
302
+
303
+ # C.4 EXPERIMENTAL RESULTS ON ALEXNET
304
+
305
+ Table 4 shows the detection performance for each in- and out-of-distribution pair when the classifier is AlexNet (Krizhevsky, 2014), which is one of popular CNN architectures. We remark that they show similar trends.
306
+
307
+ Table 4: Performance of the baseline detector (Hendrycks & Gimpel, 2016) and ODIN detector (Liang et al., 2017) using AlexNet. All values are percentages and boldface values indicate relative the better results. For each in-distribution, we minimize the KL divergence term in (1) using training samples from an out-of-distribution dataset denoted by “seen”, where other “unseen” outof-distributions were also used for testing.
308
+
309
+ <table><tr><td rowspan="2">In-dist</td><td rowspan="2">Out-of-dist</td><td>Classification accuracy</td><td>TNR at TPR 95%</td><td>AUROC</td><td>Detection accuracy</td><td>AUPR in</td><td>AUPR out</td></tr><tr><td colspan="6">Cross entropy loss /Confidence loss</td></tr><tr><td>Baseline (SVHN)</td><td>CIFAR-10 (seen) TinyImageNet (unseen) LSUN (unseen) Gaussian (unseen)</td><td>92.14 / 93.77</td><td>42.0 / 99.9 45.6 /99.9 44.6/100.0 58.6/100.0</td><td>88.0/100.0 89.4/100.0 89.8/100.0 94.2/100.0</td><td>83.4/99.8 84.3/99.9 84.5 /99.9 88.8/100.0</td><td>88.7 /99.9 90.2/100.0 90.8/100.0 95.5/100.0</td><td>87.3/99.3 88.6/99.3 88.4/99.3 92.5 / 99.3</td></tr><tr><td>Baseline (CIFAR-10)</td><td>SVHN (seen) TinyImageNet (unseen) LSUN (unseen) Gaussian (unseen)</td><td>76.58 /76.18</td><td>12.8 / 99.6 10.3/10.1 10.7 /8.1 6.7 /1.0</td><td>71.0 /99.9 59.2/52.1 56.3 / 51.5 49.6/13.5</td><td>73.2/99.6 64.2/62.0 64.3/61.8 61.3 / 50.0</td><td>74.3 /99.9 63.6/59.8 62.3/ 59.5 58.5 /43.7</td><td>70.7 /99.6 64.4/62.3 65.3/ 61.6 59.5/32.0</td></tr><tr><td rowspan="2">ODIN (SVHN)</td><td>CIFAR-10 (seen) TinyImageNet (unseen) LSUN (unseen) Gaussian (unseen)</td><td>92.14 /93.77</td><td>55.5/99.9 59.5 /99.9 61.5 /100.0 82.6/100.0</td><td>89.1/99.2 90.5 /99.3 91.8 /99.3</td><td>82.4/99.8 83.8 /99.9 84.8 /99.9</td><td>85.9 /100.0 87.5 /100.0 90.5/100.0</td><td>89.0 /99.2 90.4 /99.3 91.3/99.3</td></tr><tr><td></td><td></td><td>37.1/99.6</td><td>97.0 /99.3 86.7 /99.6</td><td>91.6/100.0 79.3 /99.6 64.4/ 61.8</td><td>97.4/100.0 88.1/99.9</td><td>96.4 /99.3 84.2/99.6</td></tr><tr><td>ODIN (CIFAR-10)</td><td>SVHN (seen) TinyImageNet (unseen) LSUN (unseen) Gaussian (unseen)</td><td>76.58 / 76.18</td><td>11.4 /8.4 13.3 / 7.1 3.8/ 0.0</td><td>69.1/ 65.6 71.9 /67.1 70.9/57.2</td><td>75.3/63.7 69.3 /40.4</td><td>71.4 /68.6 67.2/72.0 78.1/56.1</td><td>64.6/60.7 65.3/60.5 60.7 /40.7</td></tr></table>
310
+
311
+ # D MAXIMIZING ENTROPY
312
+
313
+ One might expect that the entropy of out-of-distribution is expected to be much higher compared to that of in-distribution since the out-of-distribution is typically on a much larger space than the indistribution. Therefore, one can add maximizing the entropy of generator distribution to new GAN loss in (3) and joint confidence loss in (4). However, maximizing the entropy of generator distribution is technically challenging since a GAN does not model the generator distribution explicitly. To handle the issue, one can leverage the pull-away term (PT) (Zhao et al., 2017):
314
+
315
+ $$
316
+ - \mathcal { H } \left( P _ { G } \left( \mathbf { x } \right) \right) \backsimeq \mathcal { P T } \left( P _ { G } \left( \mathbf { x } \right) \right) = \frac { 1 } { M ( M - 1 ) } \sum _ { i = 1 } ^ { M } \sum _ { j \neq i } \left( \frac { G \left( \mathbf { z } _ { i } \right) ^ { \top } G \left( \mathbf { z } _ { j } \right) } { \| G \left( \mathbf { z } _ { i } \right) \| \| G \left( \mathbf { z } _ { j } \right) \| } \right) ^ { 2 } ,
317
+ $$
318
+
319
+ where $\mathcal { H } \left( \cdot \right)$ denotes the entropy, $\mathbf { z } _ { i } , \mathbf { z } _ { j } \sim P _ { \mathrm { p r i } } \left( \mathbf { z } \right)$ and $M$ is the number of samples. Intuitively, one can expect the effect of increasing the entropy by minimizing PT since it corresponds to the squared cosine similarity of generated samples. We note that (Dai et al., 2017) also used PT to maximize the entropy. Similarly as in Section 3.2, we verify the effects of PT using VGGNet. Table 5 shows the performance of the baseline detector for each in- and out-of-distribution pair. We found that joint confidence loss with PT tends to (but not always) improve the detection performance. However, since PT increases the training complexity and the gains from PT are relatively marginal (or controversial), we leave it as an auxiliary option for improving the performance.
320
+
321
+ Table 5: Performance of the baseline detector (Hendrycks & Gimpel, 2016) using VGGNets trained by joint confidence loss with and without pull-away term (PT). All values are percentages and boldface values indicate relative the better results.
322
+
323
+ <table><tr><td>In-dist</td><td>Out-of-dist</td><td>Classification accuracy</td><td>TNR at TPR 95%</td><td>AUROC</td><td>Detection accuracy</td><td>AUPR in</td><td>AUPR out</td></tr><tr><td>CIFAR-10</td><td colspan="7">Joint confidence loss without PT/with PT</td></tr><tr><td>SVHN</td><td>TinyImageNet LSUN</td><td>93.81 /94.05</td><td>90.1 /92.3 99.0 / 99.9 98.9 /100.0</td><td>97.6 /98.1 99.6 /100.0 99.6 /100.0</td><td>93.6 /94.6 97.6 /99.7 97.5 / 99.9</td><td>97.7 /98.2 99.7 /100.0 99.7 /100.0</td><td>97.9 /98.7 94.5 /100.0 95.5 /100.0</td></tr><tr><td>CIFAR-10</td><td>SVHN TinyImageNet LSUN</td><td>81.39 / 80.60</td><td>25.4 / 13.2 35.0 /44.8 39.1 /49.1</td><td>66.8 / 69.5 72.0 / 78.4 75.1 /80.7</td><td>74.2 / 75.1 76.4 / 77.6 77.8 / 78.7</td><td>71.3 / 73.5 74.7 / 79.4 77.1 / 81.3</td><td>78.3 / 72.0 82.2 /84.4 83.6 /85.8</td></tr></table>
324
+
325
+ # E ADDING OUT-OF-DISTRIBUTION CLASS
326
+
327
+ Instead of forcing the predictive distribution on out-of-distribution samples to be closer to the uniform one, one can simply add an additional “out-of-distribution” class to a classifier as follows:
328
+
329
+ $$
330
+ \operatorname* { m i n } _ { \theta } \mathbb { E } _ { P _ { \mathrm { i n } } ( \widehat { \mathbf { x } } , \widehat { y } ) } \big [ - \log P _ { \theta } \left( y = \widehat { y } | \widehat { \mathbf { x } } \right) \big ] + \mathbb { E } _ { P _ { \mathrm { o u t } } ( \mathbf { x } ) } \big [ - \log P _ { \theta } \left( y = K + 1 | \mathbf { x } \right) \big ] ,
331
+ $$
332
+
333
+ where $\theta$ is a model parameter. Similarly as in Section 3.1, we compare the performance of the confidence loss with that of above loss in (5) using VGGNets with for image classification on SVHN dataset. To optimize the KL divergence term in confidence loss and the second term of (5), CIFAR10 training datasets are used. In order to compare the detection performance, we define the the confidence score of input $\mathbf { x }$ as $1 - P _ { \theta }$ $\begin{array} { r } { \mathbf { \boldsymbol { y } } = K + 1 | \mathbf { \boldsymbol { x } } ) } \end{array}$ in case of (5). Table 6 shows the detection performance for out-of-distribution. First, the classifier trained by our method often significantly outperforms the alternative adding the new class label. This is because modeling explicitly out-ofdistribution can incur overfitting to trained out-of-distribution dataset.
334
+
335
+ Table 6: Performance of the baseline detector (Hendrycks & Gimpel, 2016) and ODIN detector (Liang et al., 2017) using VGGNet. All values are percentages and boldface values indicate relative the better results.
336
+
337
+ <table><tr><td>Detector</td><td>Out-of-dist</td><td>Classification accuracy</td><td>TNR at TPR 95%</td><td>AUROC</td><td>Detection accuracy</td><td>AUPR in</td><td>AUPR out</td></tr><tr><td>SVHN (seen)</td><td>99.6 /99.8</td><td>K+1 class loss in (5)/Confidence loss</td><td>99.8 /99.9</td><td></td><td>99.7 /99.8</td><td>99.8 /99.9</td><td>99.9 /99.8</td></tr><tr><td rowspan="2">Baseline detector</td><td>TinyImageNet (unseen)</td><td rowspan="2">79.61 /80.56</td><td>0.0 /9.9</td><td>5.2 /31.8</td><td>51.3 /58.6</td><td>50.7 /55.3</td><td>64.3 / 66.1</td></tr><tr><td>LSUN (unseen) Gaussian (unseen)</td><td>0.0 /10.5</td><td>5.6 /34.8</td><td>51.5 /60.2</td><td>50.8/56.4</td><td>71.5 / 68.0</td></tr><tr><td rowspan="2">ODIN</td><td>SVHN (seen)</td><td rowspan="2"></td><td>0.0 /3.3</td><td>0.1/ 14.1</td><td>50.0 /50.0 99.1 /99.8</td><td>49.3 /49.4</td><td>12.2 /47.0</td></tr><tr><td>TinyImageNet (unseen)</td><td>99.6 /99.8</td><td>99.9 /99.8</td><td>55.12/65.7</td><td>99.9 /99.9</td><td>99.9 /99.8</td></tr><tr><td rowspan="2">detector</td><td>LSUN (unseen)</td><td rowspan="2">79.61 /80.56</td><td>0.3 /12.2</td><td>47.3 /70.6</td><td></td><td>56.6 /72.7</td><td>44.3 / 65.6</td></tr><tr><td>Gaussian (unseen)</td><td>0.1 /13.7 0.0 /8.2</td><td>48.3 /73.1 28.3 /68.3</td><td>55.9 / 67.9 54.4 / 65.4</td><td>57.5 /75.2 47.8 /74.1</td><td>44.7 / 67.8 36.8 / 61.5</td></tr></table>
md/train/wRXzOa2z5T/wRXzOa2z5T.md ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Self-Attention Between Datapoints: Going Beyond Individual Input-Output Pairs in Deep Learning
2
+
3
+ Jannik Kossen1∗
4
+
5
+ Neil Band1∗
6
+
7
+ # Clare Lyle1 Aidan N. Gomez1,3 Tom Rainforth2 Yarin Gal1
8
+
9
+ 1 OATML, Department of Computer Science, University of Oxford 2 Department of Statistics, University of Oxford 3 Cohere
10
+
11
+ # Abstract
12
+
13
+ We challenge a common assumption underlying most supervised deep learning: that a model makes a prediction depending only on its parameters and the features of a single input. To this end, we introduce a general-purpose deep learning architecture that takes as input the entire dataset instead of processing one datapoint at a time. Our approach uses self-attention to reason about relationships between datapoints explicitly, which can be seen as realizing non-parametric models using parametric attention mechanisms. However, unlike conventional non-parametric models, we let the model learn end-to-end from the data how to make use of other datapoints for prediction. Empirically, our models solve cross-datapoint lookup and complex reasoning tasks unsolvable by traditional deep learning models. We show highly competitive results on tabular data, early results on CIFAR-10, and give insight into how the model makes use of the interactions between points.
14
+
15
+ # 1 Introduction
16
+
17
+ From CNNs [57] to Transformers [90], most of supervised deep learning relies on parametric modeling: models learn parameters $\pmb \theta$ from a set of training data $\mathcal { D } _ { \mathrm { t r a i n } } = \{ ( \pmb { x } _ { 1 } , \pmb { y } _ { 1 } ) , \dots , ( \pmb { x } _ { n } , \pmb { y } _ { n } ) \}$ to maximize training likelihoods $p ( \pmb { y } \mid \pmb { x } ; \pmb { \theta } )$ mapping from features $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ to target values $\mathbf { \boldsymbol { y } } \in \mathcal { V }$ . At test time, they then make a prediction $p ( \boldsymbol { \dot { y } } ^ { * } \mid \boldsymbol { x } ^ { * } ; \boldsymbol { \theta } )$ that depends only on those parameters $\pmb { \theta }$ and the test input $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } } ^ { * }$ . That is, parametric models do not consider direct dependencies between datapoints.
18
+
19
+ This paper challenges parametric modeling as the dominant paradigm in deep learning. Based on the same end-to-end learning motivations that underpin deep learning itself, we consider giving models the additional flexibility of using training data directly when making predictions $p ( \pmb { y } ^ { * } \mid \pmb { x } ^ { * } , \mathcal { D } _ { \mathrm { t r a i n } } ; \pmb { \theta } )$ .
20
+
21
+ Concretely, we introduce Non-Parametric Transformers (NPTs): a general deep learning architecture that takes the entire dataset as input and predicts by explicitly learning interactions between datapoints (Fig. 1). NPTs leverage both parametric and non-parametric predictive mechanisms, with the use of end-to-end training allowing the model to naturally learn from the data how to balance the two. Namely, instead of just learning predictive functions from the features to the targets of independent datapoints, NPTs can also learn to reason about general relationships between inputs. We use multi-head self-attention [4, 59, 90] to model relationships between datapoints and construct a training objective for NPTs with a stochastic masking mechanism inspired by self-supervised reconstruction tasks in natural language processing [24]. We show that these models learn to look up information from other datapoints and capture the causal mechanism generating the data in semi-synthetic settings. However, unlike conventional non-parametric models, NPTs are not forced to only make predictions in this way: they can also use the power of ordinary parametric deep learning.
22
+
23
+ ![](images/f8a977a5225075d738ae1abb568dcd63cc52a2320bac0d0366636e73b7caaca9.jpg)
24
+ Figure 1: NPTs learn direct interactions between datapoints. (a) Input data: predict masked target entry [?] for datapoint $X _ { i }$ . (b) Notation from $\ S 2$ . (c) Parametric models predict only from the features of the given input. (d) NPTs predict by modeling relationships between all points in the dataset.
25
+
26
+ Background. While questioning parametric modeling assumptions is unconventional in deep learning, in statistics, so-called non-parametric models are a well-known and long-established field of study. Non-parametric models make predictions in explicit dependence of the training data $p ( \mathbf { { y } } ^ { * } \mid \mathbf { \bar { x } } ^ { * } , { \mathcal { D } } _ { \mathrm { t r a i n } } )$ . The most popular example of such models in the machine learning community are perhaps Gaussian Processes [74]. Non-parametric models typically do not require any training of parameters, and instead often directly interpolate between training points according to a fixed procedure, e.g., [74, p.17]. The interactions between inputs are fully defined by architectural choices and a small set of hyperparameters that must be carefully chosen. Conventional non-parametric models cannot learn – in the sense familiar to deep learning practitioners – interactions from the data, limiting the flexibility these models have in adapting to the data at hand. Approaches such as Deep Gaussian Processes [22], Deep Kernel Learning [95], and Neural Processes [36, 37, 49] have all sought to apply ideas from deep neural networks to non-parametrics. Compared to NPTs, these approaches rely heavily on motivations from stochastic processes. This leads to them being either less flexible than NPTs or requiring strong assumptions on the data, making them inapplicable to the practical scenarios considered in this paper (cf. §3). Unlike previous work, NPTs explicitly learn to predict from interactions between datapoints, and they can be applied to general supervised machine learning tasks. We refer to $\ S 3$ for an overview of these and other related approaches.
27
+
28
+ A key contribution of this paper is opening the door to a more general treatment of how deep learning models can make use of dependencies between datapoints for predictions. Our results demonstrate that NPTs make use of interactions between datapoints in practice, and we show highly competitive performance on several established tabular datasets as well as early image classification results. Additionally, we show that NPTs can solve complex reasoning tasks by combining representation learning and cross-datapoint lookup; something that is impossible for conventional deep learning or non-parametric models due to their inability to learn relations between datapoints.
29
+
30
+ We next discuss the specifics of our model (§2), before moving on to related work (§3), empirical results (§4), and finally, limitations, future work, and conclusions (§5).
31
+
32
+ # 2 Non-Parametric Transformers
33
+
34
+ Non-Parametric Transformers (NPTs) explicitly learn relationships between datapoints to improve predictions. To accomplish this, they rely on three main ingredients: (1) We provide the model with the entire dataset – all datapoints – as input. We approximate this with minibatches where necessary for large data. At test time, both training and test data are input to the model; during training, the model learns to predict targets from the training data (§2.6). (2) We use self-attention between datapoints to explicitly model relationships between datapoints. For example, at test time, the attention mechanism models relationships amongst training points, amongst test points, and between the two. (3) NPT’s training objective is to reconstruct a corrupted version of the input dataset. Similar to BERT [24], we apply stochastic masking to inputs and minimize a loss on predictions at entries masked out in the input. Next, we introduce the three components in detail.
35
+
36
+ ![](images/917ed1a8a2296a7e8a6bb374d4f3e2fdf5836dcf165d7630f6ca173dc5b6a563.jpg)
37
+ Figure 2: Overview of the Non-Parametric Transformer. (a) The input dataset and mask matrix are stacked and (b) linearly embedded for all datapoints independently. NPT then applies (c) Attention Between Datapoints (ABD, $\ S 2 . 4 )$ across all $n$ samples of hidden dimension $h = d \cdot e$ . (d) Attention Between Attributes (ABA, $\ S 2 . 5 )$ then attends between the attributes for each datapoint independently. We repeat steps (c) and (d) and obtain a final prediction from a separate linear projection (not shown).
38
+
39
+ # 2.1 Datasets as Inputs
40
+
41
+ NPTs take as input the entire dataset $\ b { X } \in \mathbb { R } ^ { n \times d }$ . The datapoints are stacked as the rows of this matrix $\{ X _ { i , : } \in \mathbb { R } ^ { d } \mid i \stackrel { \cdot } { \in } 1 \ldots n \}$ , and we refer to the columns as attributes $\{ X _ { : , j } \in \mathbb { R } ^ { n } \mid j \in 1 \ldots d \}$ . Each attribute is assumed to share a semantic meaning among all datapoints. In single-target classification and regression, we assume that the targets (labels) are the final attribute $X _ { : , d }$ , and the other attributes $\{ X _ { : , j } \ \bar { | } \ j \neq d \}$ are input features, e.g., the pixels of an image. Each $X _ { i , j }$ is an entry or value. In addition to tabular data, many modalities such as images, graphs, or timeseries can be reshaped to fit this format. Note that this is a departure from common notation for supervised learning as introduced in $\ S 1$ , as the input $\boldsymbol { X }$ now includes both features and targets (collectively, attributes).
42
+
43
+ In masked language modeling [24], mask tokens denote which words in a sentence are unknown and where, at training time, model predictions will have a loss backpropagated. Analogously, we use a binary matrix $\breve { M } \in \mathbb { R } ^ { n \times d }$ to specify which entries are masked in the input $\boldsymbol { X }$ . This matrix is also passed to NPT as input. The task is to predict the masked values $\pmb { X } ^ { M } \overset { - } { = } \{ \pmb { X } _ { i , j } \ \lvert \ \pmb { M } _ { i , j } = 1 \}$ from the observed values $\pmb { X } ^ { O } = \{ \pmb { X } _ { i , j } \ | \ M _ { i , j } = 0 \}$ , i.e., to predict $p ( { \cal X } ^ { M } \mid { \cal X } ^ { O } )$ .
44
+
45
+ In summary, NPT takes as input the entire dataset and masking matrix $( X , M )$ , and makes predictions $\hat { \pmb X } \in \mathbb { R } ^ { n \times \breve { d } }$ for values masked at input. This general setup accommodates many machine learning settings simply by adjusting the placement of the binary masks in $M$ . We focus on single-target classification and regression – corresponding to a masking matrix $M$ with 1s at all entries of the label column $X _ { : , d }$ – but outline multi-target settings, imputation, self-supervision using input features, and semi-supervision in Appendix C.4. Next, we describe the NPT architecture.
46
+
47
+ # 2.2 NPT Architecture
48
+
49
+ An overview of the Non-Parametric Transformer (NPT) is depicted in Fig. 2. NPT receives the dataset and masking matrix $( X , M )$ as input (Fig. 2a). We stack these and apply an identical linear embedding to each of $n$ datapoints, obtaining an input representation $\pmb { H } ^ { ( 0 ) } \in \mathbb { R } ^ { n \times d \times e }$ (Fig. 2b). Next, we apply a sequence of multi-head self-attention layers [4, 24, 90]. Crucially, we alternatingly apply attention between datapoints and attention between attributes of individual datapoints (Figs. 2c-d).
50
+
51
+ These operations allow our model to learn both relationships between datapoints as well as transformations of individual datapoints. Finally, an output embedding gives the prediction $\hat { \boldsymbol X } \in \mathbb R ^ { n \times d }$ which now has predicted values at entries that were masked at input. We refer to Appendix C.3 for details, such as treatment of categorical and continuous variables. Importantly:
52
+
53
+ Property 1. NPTs are equivariant to a permutation of the datapoints. (cf. Appendix A for proof.)
54
+
55
+ In other words, if the set of input datapoints is shuffled, NPTs produce the same prediction but shuffled in an analogous manner. This explicitly encodes the assumption that the learned relations between datapoints should not depend on their ordering. At a high level, permutation-equivariance holds because all components of NPTs are permutation-equivariant, and the composition of permutationequivariant functions is itself permutation-equivariant. We now briefly recap multi-head self-attention which plays an important role throughout the NPT architecture.
56
+
57
+ # 2.3 Multi-Head Self-Attention
58
+
59
+ Multi-head self-attention (MHSA) is a powerful mechanism for learning complex interactions between elements in an input sequence. Popularized in natural language processing [4, 24, 90], MHSA-based models have since been successfully applied to many areas of machine learning (cf. $\ S 3$ ).
60
+
61
+ Dot-product attention computes attention weights by comparing queries $\{ Q _ { i } \in \mathbb { R } ^ { 1 \times h _ { k } } \ | \ i \in 1 \dots n \}$ with keys $\{ K _ { i } \in \mathbb { R } ^ { 1 \times h _ { k } } \mid i \in 1 \ldots m \}$ , ultimately updating the representation of the queries by aggregating over values $\{ V _ { i } \in \mathbb { R } ^ { 1 \times h _ { v } } \mid i \in 1 \ldots m \}$ via the attention weights. We stack the queries, keys, and values into matrices $Q \in \mathbb { R } ^ { n \times h _ { k } }$ , $\pmb { K } \in \mathrm { \bar { \mathbb { R } } } ^ { m \times h _ { k } }$ , and $V \in \mathbb { R } ^ { m \times h _ { v } }$ and, as is commonly done for convenience, assume $h _ { k } = h _ { v } = h$ . Then, we compute dot-product attention as
62
+
63
+ $$
64
+ \mathrm { A t t } ( Q , K , V ) = \operatorname { s o f t m a x } ( Q K ^ { T } / \sqrt { h } ) V .
65
+ $$
66
+
67
+ Multi-head dot-product attention concatenates a series of $k$ independent attention heads
68
+
69
+ $$
70
+ \operatorname { M H A t t } ( Q , K , V ) = \operatorname { c o n c a t } ( O _ { 1 } , . . . , O _ { k } ) W ^ { O } , { \mathrm { ~ w h e r e } }
71
+ $$
72
+
73
+ $$
74
+ O _ { j } = \mathrm { A t t } ( Q W _ { j } ^ { Q } , K W _ { j } ^ { K } , V W _ { j } ^ { V } ) .
75
+ $$
76
+
77
+ We learn embedding matrices ${ \cal W } _ { j } ^ { Q } , { \cal W } _ { j } ^ { K } , { \cal W } _ { j } ^ { V } \in \mathbb { R } ^ { h \times h / k } , j \in \{ 1 , \dots , k \}$ for each head $j$ , and $W ^ { O } \in \mathbb { R } ^ { h \times h }$ mixes outputs from different heads. Here, we focus on multi-head self -attention, ${ \mathrm { M H S e l f A t t } } ( H ) = { \mathrm { M H A t t } } ( Q = H , K = H , V = H )$ , which uses the same inputs for queries, keys, and values. Following Transformer best practices to improve performance [16, 24, 59, 66, 90], we first add a residual branch and apply Layer Normalization (LN) [3] followed by MHSelfAtt $( \cdot )$ ,
78
+
79
+ $$
80
+ \mathrm { R e s } ( { H } ) = H { W } ^ { \mathrm { r e s } } + \mathrm { M H S e l f A t t } ( \mathrm { L N } ( { H } ) ) ,
81
+ $$
82
+
83
+ with learnable weight matrix $W ^ { \mathrm { r e s } } \in \mathbb { R } ^ { h \times h }$ . Then, we add another residual branch with LN and a row-wise feed-forward network (rFF), finally giving the full multi-head self-attention layer as
84
+
85
+ $$
86
+ \operatorname { M H S A } ( H ) = \operatorname { R e s } ( H ) + \operatorname { r F F } ( \operatorname { L N } ( \operatorname { R e s } ( H ) ) \in \mathbb { R } ^ { n \times h } .
87
+ $$
88
+
89
+ # 2.4 Attention Between Datapoints (ABD)
90
+
91
+ The Attention Between Datapoints (ABD) layer is a key operation for NPT. It explicitly transforms data by reasoning about pairwise relationships between all datapoints, see Fig. 2c. As input to ABD, we flatten the output of the previous layer $\pmb { H } ^ { ( \ell ) }$ from $\mathbb { R } ^ { n \times d \times e }$ to $\mathbb { R } ^ { n \times h }$ with $h = d \cdot e$ . Then, we apply $\mathrm { \mathbf { M H S A } } ( \cdot )$ between the intermediate datapoint representations $\{ \pmb { H } _ { i } ^ { ( \ell ) } \in \mathbb { R } ^ { 1 \times h } \mid i \in 1 \ldots n \}$ as
92
+
93
+ $$
94
+ \mathrm { A B D } ( \pmb { H } ^ { ( \ell ) } ) = \mathrm { M H S A } ( \pmb { H } ^ { ( \ell ) } ) = \pmb { H } ^ { ( \ell + 1 ) } \in \mathbb { R } ^ { n \times h } .
95
+ $$
96
+
97
+ At the first ABD layer, we input $\pmb { H } ^ { ( 0 ) } \in \mathbb { R } ^ { n \times d \times e }$ , the linearly embedded input data. After applying ABD, we reshape the output again, from $\mathbb { R } ^ { n \times h }$ to $\mathbb { R } ^ { n \times d \times e }$ . Here, the rFF of each ABD layer is an MLP that is applied independently to each of the $n$ datapoints.
98
+
99
+ Note that this is distinct from how $\mathrm { \mathbf { M H S A } } ( \cdot )$ is usually applied in the literature, as we compute attention between different datapoints and not between the features of a single datapoint [24, 25, 46, 90]. For example, in natural language processing, attention is usually applied between the tokens (attributes) of a sentence (datapoint) but not between different sentences. For example, NPT could learn to attend between two datapoints with indices $i$ and $i ^ { \prime }$ by embedding $Q _ { i }$ and $\pmb { K } _ { i ^ { \prime } }$ in close proximity. Following (1), datapoint $i$ will then attend more closely to $i ^ { \prime }$ because $Q _ { i } K _ { i ^ { \prime } } ^ { T }$ will be large. By stacking many ABD layers, NPT can learn higher-order interactions between datapoints [24, 90].
100
+
101
+ # 2.5 Attention Between Attributes (ABA)
102
+
103
+ We now introduce Attention Between Attributes (ABA), which we by default perform after each ABD layer. ABA layers can help the model learn better per-datapoint representations for the between-datapoint interactions, see Fig. 2d. For ABA, we apply MHSA $( \cdot )$ independently to each row (corresponding to a single datapoint) in the input $H _ { i } ^ { ( \ell ) } \in \mathbb { R } ^ { d \times e }$ , $i \in \{ 1 , \ldots , n \}$ , giving
104
+
105
+ $$
106
+ \mathrm { A B A } ( H ^ { ( \ell ) } ) = \operatorname { s t a c k } _ { \mathrm { a v i s e } } ( \mathrm { M H S A } ( H _ { 1 } ^ { ( \ell ) } ) , \ldots , \mathrm { M H S A } ( H _ { n } ^ { ( \ell ) } ) ) = H ^ { ( \ell + 1 ) } \in \mathbb { R } ^ { n \times d \times e } .
107
+ $$
108
+
109
+ Just like in standard Transformers [24, 25, 46, 90], ABA is used to transform attribute representations of single datapoints independently. We batch over the $n$ dimension to compute ABA efficiently. By alternating between attention between datapoints (ABD) and attributes (ABA), NPTs can model both complex dependencies between points as well as learn suitable transformations of datapoints individually. Next, we describe the use of masking mechanisms during NPT training and evaluation.
110
+
111
+ # 2.6 Masking and Optimization
112
+
113
+ Masking. Much like in masked language modeling [24], we use masks to indicate which values NPT is expected to predict, and to prevent the model from accessing ground truth values. Recall that NPT needs to predict $p ( \boldsymbol { X } ^ { M } \mid \boldsymbol { X } ^ { \dot { O } } )$ , with masked values ${ \cal { X } } ^ { M } = \bar { \{ } { \bar { X } _ { i , j } \ | \ M _ { i , j } = 1 \} }$ and observed values $\pmb { X } ^ { O } = \{ \pmb { X } _ { i , j } \ | \ M _ { i , j } = 0 \}$ . Masked values can be either features or targets. Canonically, masked language modeling is used to perform self-supervised learning on a sequence of tokens in a sentence [24]. We use such stochastic feature masking to mask feature values $\boldsymbol { X } _ { i , j } , j \neq d$ , with probability $p _ { \mathrm { f e a t u r e } }$ during training. We also apply stochastic masking to the targets of the training set $X _ { : , d }$ with probability $p _ { \mathrm { t a r g e t } }$ . We call this stochastic target masking. Note that we take great care to avoid test set leakage and never reveal targets of the test set to NPT. We refer to Appendix C.4 for full details of our masking procedure in a variety of settings.
114
+
115
+ NPT Objective. During training, we compute the negative log-likelihood loss at training targets $\mathcal { L } ^ { \mathrm { T a r g e t s } }$ as well as the auxiliary loss from masked-out features $\mathcal { L } ^ { \mathrm { F e a t u r e s } }$ . We write the NPT training objective as $\begin{array} { r } { \mathcal { L } ^ { \mathrm { N P T } } = ( 1 - \lambda ) \dot { \mathcal { L } } ^ { \mathrm { T a r g e t s } } + \lambda \mathcal { L } ^ { \mathrm { F e a t u r e s } } } \end{array}$ , where $\lambda$ is a hyperparameter. At test time, we only mask and compute a loss over the targets of test points. See Appendix C.5 for optimization details.
116
+
117
+ This objective has a few notable elements. Feature masking requires NPTs to make predictions over all attributes, encouraging the models to learn a representation of the entire dataset. This increases the difficulty of the task and adds more supervision, which we find tends to have a beneficial regularizing effect. Interestingly, stochastic target masking means that many training targets are unmasked to the model at training time. This allows NPTs to learn to predict the masked targets of certain training datapoints using the targets of other training datapoints in addition to all input features.2 NPTs no longer have to memorize a mapping between training inputs and outputs in their parameters $\pmb { \theta }$ , and can instead use their representational capacity to learn functions using other training features and targets as input. For example, NPTs could learn to assign test datapoints to clusters of training datapoints, and predict on those points using interpolation of the training targets in their respective cluster. We explore the ability of NPTs to solve such tasks in $\ S 4 . 2$ . Further, we study more complex extensions to these tasks, which cannot be solved by simple interpolative models, in Appendix B.1.2.
118
+
119
+ Handling Large Datasets. Due to the poor $\mathcal { O } ( n ^ { 2 } )$ time and space complexity of self-attention, we resort to approximations once the data grows too large. For example, we reach 24 GB of GPU memory for standard NPT model sizes at about 8000 datapoints. We find that processing the data in random subsets for model training and prediction, i.e., minibatching, is a simple and effective solution. We construct minibatches such that, at test time, training and test data are both present in the same batch, to allow NPTs to attend to training datapoints. In $\ S 4 . 3$ , we show that NPTs make use of attention between datapoints with minibatching enabled. See $\ S 5$ for further discussion and ideas for future work.
120
+
121
+ # 3 Related Work
122
+
123
+ Deep Non-Parametric Models. Deep Gaussian Processes [22] and Deep Kernel Learning (DKL) [95] extend ideas from Gaussian Processes [74] to representation learning. Deep GPs stack standard GPs with the aim to learn more expressive relationships between input points, sharing motivation with NPTs. However, unlike NPTs, deep GPs are difficult to work with in practice, requiring complex approximate inference schemes [13, 21, 77]. DKL applies a neural network to each datapoint independently before passing points on to a standard Gaussian Process, making predictions based directly on similarity in embedding space instead of learning the interactions themselves.
124
+
125
+ Neural Processes. Similar to GPs, Neural Processes (NPs) [36, 37] define a distribution over functions. They use a latent variable model parametrized by neural networks, fulfilling specific architectural constraints to approximately preserve consistency of finite-dimensional marginals. Attentive Neural Processes (ANPs) [49] extend Neural Processes to allow for direct attention between a context set and targets. However, as the authors themselves stress, “NPs and GPs have different training regimes” [49]. While a GP can be trained on a single dataset, $( A ) N P s$ require multiple realizations of the dataset. The authors further note that “a direct comparison between the two is usually not plausible” [49], which is why we cannot compare (A)NPs to NPTs on our standard tasks.
126
+
127
+ Attention. NPTs are part of a line of recent work that explores the use of Transformer-based architectures outside of natural language processing, e.g., Transformers in computer vision [25, 46, 67] or architectures exploiting desirable invariances or equivariances [33, 44, 59, 61]. Like NPTs, Set Transformer [59] attends to a set of input points. However, unlike NPTs, Set Transformer relies on the existence of multiple independent sets for training and makes only a single prediction for each set. Like NPTs, Axial Transformers [42] and MSA Transformers [73] attend to multiple dimensions of matrix-shaped input. However, Axial Transformers process single images as input, i.e., no attention across datapoints is performed. MSA Transformers use attention within individual protein sequences and across an aligned protein family for contact prediction, but do not consider a more general setting. Recent works have improved neural network performance on tabular data using attention. AutoInt [80] is a direct application of multi-head attention to tabular data, and TabNet [2] sequentially attends to sparse subsets of the features inspired by tree-based models. Both approaches do not reason about interactions between datapoints, a key contribution that we introduce with NPT in this work.
128
+
129
+ Few-Shot Learning, Meta-Learning, and Prompting. In $\ S 4 . 2$ , we apply NPTs to tasks that require learning of relational structure between datapoints on training data to achieve good generalization performance on novel test inputs. This setup shares motivations with meta-learning [6, 8, 29, 56], in which a model is pre-trained on a variety of tasks, such that it can then learn new tasks using only a small number of additional training points from the new task. However, we consider evaluation without any additional gradient updates, unlike recent meta-learning methods [29, 97] which are therefore inapplicable to this setting. Recent works on few-shot learning with text prompting [12, 72] provide a trained Transformer-based language model with a few examples of a novel relationship in a prompt at prediction time, where they observe strong generalization on the task. Similarly, we consider attention between a “context” of datapoints. While ground-truth input-output pairs are provided for prompting, we consider settings in which no ground-truth is given at prediction time (cf. Appendix B.1.2), but the model can solve the task if it has learned the underlying relational structure.
130
+
131
+ Semi-Supervised Learning and Graph Neural Networks. NPTs relate to work on semi-supervised learning [15, 27, 51] and transductive learning [89], which both make use of unlabeled inputs during training. NPTs natively support this by simply including any unlabeled datapoints with masked-out targets in the input matrix at training time. This body of related work includes semi-supervised and transductive learning on graphs using graph neural networks (GNNs), e.g., [34, 52, 53, 91, 96]. NPTs can be seen as a generalization of GNNs in which a set of dependencies (edges) between datapoints is not known a priori and is instead learned from data using self-attention. Like NPTs, Neural Relational Inference (NRI) [53] attempts to discover relations amongst datapoints. However, NRI lacks scalability because it requires that embeddings be stored for each potential graph edge.
132
+
133
+ Metric Learning. (Deep) Metric Learning aims to learn distance functions such that the (semantic) similarity and dissimilarity between input points is meaningfully captured, e.g., [65, 76, 79, 92–94]. Similarly, retrieval models in NLP learn to look up relevant training instances for prediction [38, 39, 41]. The attention between datapoints in NPTs can be seen as implicitly learning exactly such (dis-)similarity. Usually, metric learning embeds inputs by applying the same embedding function independently to each datapoint. This is in contrast to NPTs, which leverage a learned self-attention mechanism between test inputs and training datapoints (including their labels) at prediction time.
134
+
135
+ # 4 Experiments
136
+
137
+ We seek to answer the following set of questions in our evaluation3 of NPTs: (Q1) How do NPTs perform on standard benchmarks for supervised machine learning? (Q2) Can NPTs successfully model interactions between datapoints in idealized settings? (Q3) Do NPTs actually learn to rely on interactions between datapoints for prediction on real-world datasets? (Q4) If so, what is the nature of these interactions, e.g., which other datapoints are relevant for prediction?
138
+
139
+ Table 1: Average rank order of various methods ( $\pm$ standard error) on UCI benchmarks, across binary classification, multi-class classification, and regression tasks. We determine rank using the test area under the receiver operating characteristic (AUROC) curve on binary classification (4 of 10 datasets), accuracy on multi-class classification (2 of 10), and root mean squared error (RMSE) on regression (4 of 10), and sort methods by ascending rank for each metric. See Appendix B.7 for the full results.
140
+
141
+ <table><tr><td>Method</td><td>AUROC</td></tr><tr><td>NPT</td><td>2.50 ± 0.87</td></tr><tr><td>CatBoost LightGBM</td><td>2.75 ± 0.85 3.50 ± 1.55</td></tr><tr><td>XGBoost Gradient Boosting</td><td>4.75 ± 1.25 5.00 ± 0.71</td></tr><tr><td>MLP Random Forest</td><td>5.75 ± 1.49 6.00 ± 0.71</td></tr><tr><td>TabNet</td><td>6.50 ±1.32</td></tr><tr><td>k-NN</td><td>8.25 ± 0.48</td></tr></table>
142
+
143
+ <table><tr><td>Method</td><td>Accuracy</td></tr><tr><td>NPT</td><td>2.50 ± 0.50</td></tr><tr><td>XGBoost</td><td>2.50 ± 1.50</td></tr><tr><td>MLP</td><td>3.00 ± 2.00</td></tr><tr><td>CatBoost</td><td>3.50 ± 0.50</td></tr><tr><td>Gradient Boosting</td><td>3.50 ±1.50</td></tr><tr><td>Random Forest</td><td>6.50 ± 0.50</td></tr><tr><td>TabNet</td><td>7.50 ± 0.50</td></tr><tr><td>LightGBM</td><td>7.50 ± 1.50</td></tr><tr><td>k-NN</td><td>8.50 ± 0.50</td></tr></table>
144
+
145
+ <table><tr><td>Method</td><td>RMSE</td></tr><tr><td>CatBoost XGBoost</td><td>3.00 ± 0.91 3.25 ± 0.63</td></tr><tr><td>NPT</td><td>3.25 ± 1.31</td></tr><tr><td>Gradient Boosting Random Forest</td><td>4.00 ± 1.08 4.50 ± 0.87</td></tr><tr><td>MLP</td><td>5.00 ±1.22</td></tr><tr><td>LightGBM</td><td>6.50 ± 1.55</td></tr><tr><td>TabNet</td><td>6.75 ± 0.95</td></tr><tr><td>k-NN</td><td>8.75 ± 0.25</td></tr></table>
146
+
147
+ # 4.1 NPTs Perform Competitively on Established Benchmarks
148
+
149
+ To answer (Q1), we evaluate NPTs on tabular data from the UCI Repository [26] as well as the CIFAR-10 [55] and MNIST [58] image classification datasets. Tabular data is ubiquitous in real-world machine learning [20] but notoriously challenging for general purpose deep neural networks, which are rarely used in practice here because they are consistently outperformed by boosting models [78].4
150
+
151
+ Tabular Datasets, Setup, and Baselines. We evaluate NPTs over 10 datasets varying across the number of datapoints, number of features, composition (categorical or continuous) of features, and task. 4 of the 10 are binary classification, 2 are multi-class classification, and 4 are regression. We compare NPT against a wide set of standard or state-of-the-art baselines: Random Forests [10], Gradient Boosting Trees [32], XGBoost [17], CatBoost [71], LightGBM [48], MLPs, $\mathbf { k }$ -NN [1, 30], and TabNet [2]. For additional background on tree-based models, see Appendix D.1. We tune the parameters of all models on validation sets and use 10-fold cross-validation whenever computationally feasible. Note that while we perform an extensive grid search for the baselines, we only search over a small set of configurations for NPTs. We refer the reader to Appendix E for further details on the setup for datasets and baselines, and Appendix C.1 for NPT hyperparameters.
152
+
153
+ Tabular Data Results. We report the average rank order for NPT and various tree-based and deep learning baselines in Table 1. NPT achieves the highest average ranking on binary and multi-class classification tasks, outperforming CatBoost and XGBoost, two popular state-of-the-art boosting methods designed specifically for tabular data. On regression tasks, NPT ties in average rank with XGBoost, and is outperformed only by CatBoost. In addition to its strong rank-wise performance, NPT achieves best performance on 4 of the 10 benchmark datasets – more than any other method. We find that these are remarkable results for a general purpose model that does not include tabular-specific design, supporting our hypothesis that attention between datapoints is a useful architectural inductive bias for prediction. For all metrics across all datasets, i.e., NLL for classification, AUROC/accuracy for binary/multi-class classification, and (R)MSE for regression, we refer the reader to Appendix B.7. In the appendix, we present ablations which suggest that the performance of NPT is robust across a wide range of hyperparameter choices (Appendix B.4) and that both the introduction of the ABA layer and the stochastic feature masking contribute positively to the performance of NPTs (Appendix B.5).
154
+
155
+ Image Data Results. On CIFAR-10, we replace our linear encoder with a CNN followed by ABD layers on the CNN encodings, achieving a test accuracy of $9 3 . 7 \%$ . We achieve $9 8 . 3 \%$ accuracy on MNIST using linear patching [25]. Crucially, we show in $\ S 4 . 3$ that NPTs learn to make use of interactions between images on both the CIFAR-10 and MNIST datasets, supporting the claim that attention between datapoints is useful beyond tabular data. We also explore linear patching on CIFAR-10. See Appendix B.8 for these results along with setup details and further discussion.
156
+
157
+ ![](images/656b8452bd36e7d728298926044508f3042eb789ccc1d0dac878691e7b09e2bc.jpg)
158
+ Figure 3: Demonstrating NPT’s ability to predict from Attention Between Datapoints (ABD). (a) We append to the original data with masked targets [?] a copy of the same data with all masked values revealed, such that perfect prediction via lookup is possible. (b) Attention weights indicate that the ideal lookup behavior is learned by NPT. Shown are actual values learned by NPT at head 0 and depth 4 for the first 3 datapoints. (c) NPT predictions closely match the ideal values. (d) Additionally, we intervene on the values of individual targets, (e) finding that NPT predictions adjust accordingly.
159
+
160
+ # 4.2 NPTs Can Learn to Predict Using Attention Between Datapoints
161
+
162
+ To determine if NPTs can successfully learn to exploit interactions between datapoints (Q2), we introduce a task with strong input correlations for which we know ground-truth interactions. Concretely, we use the UCI Protein regression dataset (cf. $\ S 4 . 1 \dot { }$ ) to construct the following semi-synthetic task: for each batch, we input the original data with masked target values as well as a copy of the original data where all target values have been revealed, i.e., no masking is applied (Fig. 3a). NPTs can use attention between datapoints to achieve arbitrarily good performance by learning to look up the target values in the matching duplicate row. At test time, we input novel semi-synthetic test data to ensure that NPT has learned the correct relational mechanism and not just memorized target values.
163
+
164
+ NPTs successfully learn to perform this lookup between original and duplicate datapoints. The ABD attention weights, visualized for the first three datapoints in Fig. 3b, clearly show the model correctly attending to the duplicates. As a result, NPT predictions are Pearson-correlated with the duplicate targets at $r = 9 9 . 9 \%$ (Fig. 3c). This equals an RMSE of only 0.44, about a magnitude lower than the error on the original Protein dataset (Table 11). We conclude that NPTs learn to predict by looking up the target values from matching points. Further discussion and attention maps are in Appendix B.1.1.
165
+
166
+ Purely parametric models cannot exploit information from other datapoints, limiting their performance. For example, MLPs achieve an RMSE of 3.62 on this task. Non-parametric approaches also cannot solve this task in its original form, because unlike NPTs they must be told which datapoints are the originals (training data) and which the duplicates (test data) as well as which columns contain features and which target values. We demonstrate in Appendix B.1.2 that even when we make these concessions, we can easily adapt the task such that both $\mathbf { k }$ -Nearest Neighbors and Deep Kernel Learning fail to solve it. In fact, we are not aware of any other model that can solve the adapted task.
167
+
168
+ Additionally, we perform an interventional experiment to investigate the extent to which NPTs have actually learned the causal mechanism underlying the lookup task. As illustrated in Fig. 3d, we now intervene on individual duplicate datapoints at test time by varying their target value across a wide range. We stress that we perform these experiments without retraining the model, using exactly the same NPT from Figs. 3a-c. The model is now confronted with target values associated with features that are highly unlikely under the training data. This label distribution shift [35] is a challenging setting for neural networks. However, NPT predictions follow the intervened target values with near-perfect correlation, Fig. 3e, continuing to predict by correctly looking up targets.
169
+
170
+ Table 2: Drop in NPT performance after destroying information from other datapoints. Shown are changes in test set performance, where negative values indicate worse performance after corruption.
171
+
172
+ <table><tr><td>△ Accuracy</td><td>CIFAR-10</td><td>Poker</td><td>Income</td><td>Higgs</td><td>MNIST</td><td>Forest</td><td>Kick</td><td>Breast Cancer</td></tr><tr><td></td><td>-1.2</td><td>-1.1</td><td>-1.1</td><td>-0.5</td><td>-0.4</td><td>-0.1</td><td>-0.1</td><td>0.0</td></tr><tr><td>△RMSE/RMSE (%)</td><td>Yacht</td><td>Protein</td><td>Boston</td><td>Concrete</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>-52%</td><td>-21%</td><td>-20%</td><td>-7%</td><td></td><td></td><td></td><td></td></tr></table>
173
+
174
+ We now confidently conclude that NPTs robustly learn the causal data-generating mechanism underlying the semi-synthetic dataset. This requires NPTs to learn a non-trivial sequence of compuational steps. They must learn to match rows based on similarity of relevant features; to look up the target value of the duplicated datapoint; and, to copy that value into the target of the masked datapoint.
175
+
176
+ # 4.3 NPTs Learn to Use Attention Between Datapoints on Real Data
177
+
178
+ We next consider (Q3): do NPTs actually learn to use attention between datapoints for prediction on real data? We design a test that allows us to quantify the extent to which the predictions of an NPT trained in standard fashion on one of our benchmark datasets depend on relationships between datapoints at test time. Concretely, for each target value in the input we randomize the data for all other datapoints by independently shuffling each of their attributes across the rows. We then evaluate the loss on the prediction at the target entry and repeat this procedure for all test datapoints. This completely corrupts the information from all datapoints except the one for which we evaluate. Hence, a model that relies meaningfully on attention between datapoints will show deteriorating performance. We give an algorithm for the corruption procedure as well as further discussion in Appendix B.2.1.
179
+
180
+ We report the resulting change in performance after corruption in Table 2 for all datasets from $\ S 4 . 1$ . We find that for most datasets, the corruption of other rows at test time significantly decreases the performance of the trained NPT models. This indicates that the NPTs have successfully learned to make predictions supported by attention between datapoints. For some datasets, the corruption experiment deteriorates performance completely. For example, for the Protein regression dataset NPT achieves state-of-the-art performance, but corrupting the input at test time leads to NPT performing worse than all of the baselines considered in $\ S 4 . 1$ . We note that minor differences in performance are often still significant, as differences between competing models in $\ S 4 . 1$ are often likewise small.
181
+
182
+ Interestingly, on certain datasets such as Forest Cover, Kick, and Breast Cancer, corrupted inputs do not significantly affect performance. It appears that when NPTs do not find it advantageous to rely on attention between datapoints during training, they can learn to completely ignore other inputs, essentially collapsing into a standard parametric model. This supports our earlier claims that NPTs can learn end-to-end from data the extent to which they rely on other datapoints for prediction. We think this is extremely interesting behavior and are unaware of prior work reporting similar results. However, we stress that these results reflect inductive biases of the NPT architecture and do not lend themselves to general statements about the performance of parametric versus non-parametric models.
183
+
184
+ # 4.4 NPTs Rely on Similar Datapoints for Predictions on Real Data
185
+
186
+ So far, we have presented convincing evidence that NPTs (sometimes strongly) depend on attention between datapoints. However, we do not know what kind of interactions are learned in practice on real data (Q4). As an initial step towards understanding this, we now present two experiments investigating to which other datapoints NPT attends.
187
+
188
+ Qualitative Evidence. Figure 4 shows an attention map for attention between datapoints (ABD) of NPT on a batch of the Protein regression dataset. We sort the input data with respect to their input space distance such that similar datapoints are now close to each other. The diagonal pattern
189
+
190
+ in Fig. 4 indicates that NPT attends more strongly to datapoints that are similar in feature space.
191
+ Appendix B.3.1 discusses this further and gives additional attention maps.
192
+
193
+ Quantitative Evidence. Seeking a quantitative measure for this hypothesis, the data deletion experiment repeats the following procedure for all test set points: iteratively delete other datapoints from the input if they do not significantly affect the prediction. We stop if less than $2 \%$ of the original datapoints remain, or if the total change in prediction for the target (relative to the original prediction with all data) exceeds $1 0 \%$ . We investigate the average input feature space distances between the test point and the kept datapoints, as well as the distances between the test point and the deleted datapoints. “Input features” here refer to all attributes of the input datapoints that are not labels.
194
+
195
+ ![](images/cc97b83698ce0a3fa9b67d1ba24539ca644973a7fdddeb75ac9f929184edfccf.jpg)
196
+ Fig. 4: Attention weights.
197
+
198
+ We find that kept datapoints have a significantly lower average feature space distance to the test point than those deleted. This indicates that two datapoints $i , i ^ { \prime }$ that are similar in input feature space, such that $\begin{array} { r } { \sum _ { j < d } ( X _ { i , j } - X _ { i ^ { \prime } , j } ) ^ { 2 } } \end{array}$ is low, have a larger effect on the predictions of one another. A Wilcoxon signed-rank test is significant at $p \approx 8 . 7 7 \cdot 1 0 ^ { - 1 3 0 }$ . We give full details on this in Appendix B.3.2.
199
+
200
+ Both experiments support the hypothesis that NPTs rely on similar datapoints for prediction in real data settings. One possible explanation is that similar datapoints might have different realizations of observation noise which NPTs could learn to average out. Altogether, we conclude that NPTs can and do learn representations which rely on interactions between datapoints for prediction.
201
+
202
+ # 5 Limitations, Future Work, and Conclusions
203
+
204
+ Limitations. NPTs share scaling limitations with all naïvely non-parametric approaches [74] and GNNs [52]. We demonstrate this in a preliminary analysis of the computational cost of NPTs and the baseline methods – including training time and CPU/GPU memory requirements – in Appendix B.6. While we have seen success with random minibatching (§2.6), future work might consider applying principled attention approximations, such as learning representative input points [59], kernelization [19, 47], or other sparsity-inducing methods [5, 18, 84], to improve the scalability of NPTs.
205
+
206
+ Future Work. We believe that the unique predictive mechanism of NPTs makes them an interesting object of study for other tasks including continual learning, multi-task learning, few-shot generalization, and domain adaptation. For example, when predicting under distribution shift, general relations between datapoints and attributes may remain valid and allow NPTs to accommodate such scenarios better. Additionally, future work could explore the connections to stochastic processes, e.g., by extending NPTs to be approximately consistent, similar to Neural Processes [36, 37, 49].
207
+
208
+ Conclusions. We have introduced Non-Parametric Transformers (NPTs), a novel deep learning architecture that takes the entire dataset as input and uses self-attention to model complex relationships between datapoints. NPTs challenge and naturally extend parametric modeling as the dominant paradigm of deep learning. They have the additional flexibility to learn to predict by directly attending to other datapoints. Notably, NPTs learn this end-to-end from the data at hand. Empirically, NPTs achieve highly competitive performance on a variety of benchmarks, and additional experiments demonstrate their ability to solve complex reasoning tasks over datapoints. Further, we show that on real data, NPTs learn to rely on attention between datapoints for prediction. We believe that the characteristics of NPTs will make them an exciting object of further study.
209
+
210
+ # Acknowledgments and Disclosure of Funding
211
+
212
+ We acknowledge funding from the New College Yeotown Scholarship (JK), the Rhodes Trust (NB), and the Open Philanthropy AI Fellowship (CL). We thank Lewis Smith, Pascal Notin, Uri Shalit, Joost van Amersfoort, Sören Mindermann, Lood van Niekerk, and the anonymous reviewers for helpful feedback and interesting discussions that have led to numerous improvements of the paper.
213
+
214
+ References
215
+ [1] Naomi S Altman. An introduction to kernel and nearest-neighbor nonparametric regression. The American Statistician, 46, 1992.
216
+ [2] Sercan O Arik and Tomas Pfister. Tabnet: Attentive interpretable tabular learning. arXiv:1908.07442, 2019.
217
+ [3] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv:1607.06450, 2016.
218
+ [4] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, 2015.
219
+ [5] Iz Beltagy, Matthew E. Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv:2004.05150, 2020.
220
+ [6] Y. Bengio, S. Bengio, and J. Cloutier. Learning a synaptic learning rule. In International Joint Conference on Neural Networks, volume 2, 1991.
221
+ [7] J. L. Bentley. Multidimensional binary search trees used for associative searching. In Communications of the ACM, volume 18, 1975.
222
+ [8] John B Biggs. The role of metalearning in study processes. British journal of educational psychology, 55, 1985.
223
+ [9] Leo Breiman. Bagging predictors. Machine learning, 24, 1996.
224
+ [10] Leo Breiman. Random forests. Machine learning, 45, 2001.
225
+ [11] Leo Breiman, Jerome Friedman, Charles J Stone, and Richard A Olshen. Classification and regression trees. CRC press, 1984.
226
+ [12] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv:2005.14165, 2020.
227
+ [13] Thang Bui, Daniel Hernández-Lobato, Jose Hernandez-Lobato, Yingzhen Li, and Richard Turner. Deep gaussian processes for regression using approximate expectation propagation. In International Conference on Machine Learning, 2016.
228
+ [14] Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. arXiv:2012.07805, 2020.
229
+ [15] Olivier Chapelle, Bernhard Scholkopf, and Alexander Zien. Semi-supervised learning. IEEE Transactions on Neural Networks, 20(3):542–542, 2009.
230
+ [16] Mia Xu Chen, Orhan Firat, Ankur Bapna, Melvin Johnson, Wolfgang Macherey, George Foster, Llion Jones, Mike Schuster, Noam Shazeer, Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Zhifeng Chen, Yonghui Wu, and Macduff Hughes. The best of both worlds: Combining recent advances in neural machine translation. In Annual Meeting of the Association for Computational Linguistics, volume 56, 2018.
231
+ [17] Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In Knowledge Discovery and Data Mining, volume 22, 2016.
232
+ [18] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv:1904.10509, 2019.
233
+ [19] 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 International Conference on Learning Representations, 2021.
234
+ [20] Michael Chui, James Manyika, Mehdi Miremadi, Nicolaus Henke, Rita Chung, Pieter Nel, and Sankalp Malhotra. Notes from the AI frontier: Insights from hundreds of use cases, 2018.
235
+ [21] Zhenwen Dai, Andreas Damianou, Javier González, and Neil Lawrence. Variational auto-encoded deep gaussian processes. In International Conference on Learning Representations, 2016.
236
+ [22] Andreas Damianou and Neil D Lawrence. Deep gaussian processes. In International Conference on Artificial Intelligence and Statistics, volume 16, 2013.
237
+ [23] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Conference on Computer Vision and Pattern Recognition, 2009.
238
+ [24] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv:1810.04805, 2018.
239
+ [25] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021.
240
+ [26] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive.ics.uci. edu/ml.
241
+ [27] Dumitru Erhan, Aaron Courville, Yoshua Bengio, and Pascal Vincent. Why does unsupervised pre-training help deep learning? In International Conference on Artificial Intelligence and Statistics, volume 13, pages 201–208, 2010.
242
+ [28] Angelos Filos, Sebastian Farquhar, Aidan N Gomez, Tim GJ Rudner, Zachary Kenton, Lewis Smith, Milad Alizadeh, Arnoud De Kroon, and Yarin Gal. A systematic comparison of bayesian deep learning robustness in diabetic retinopathy tasks. In NeurIPS Workshop on Bayesian Deep Learning, 2019.
243
+ [29] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, volume 34, 2017.
244
+ [30] Evelyn Fix. Discriminatory analysis: nonparametric discrimination, consistency properties, volume 1. USAF school of Aviation Medicine, 1985.
245
+ [31] 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, 1997.
246
+ [32] Jerome H Friedman. Greedy function approximation: a gradient boosting machine. Annals of statistics, 2001.
247
+ [33] Fabian Fuchs, Daniel Worrall, Volker Fischer, and Max Welling. Se(3)-transformers: 3d roto-translation equivariant attention networks. In Advances in Neural Information Processing Systems, volume 33, 2020.
248
+ [34] Victor Garcia and Joan Bruna. Few-shot learning with graph neural networks. In International Conference on Learning Representations, 2018.
249
+ [35] Saurabh Garg, Yifan Wu, Sivaraman Balakrishnan, and Zachary Lipton. A unified view of label shift estimation. In Advances in Neural Information Processing Systems, volume 33, 2020.
250
+ [36] 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 International Conference on Machine Learning, volume 35, 2018.
251
+ [37] Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J Rezende, SM Eslami, and Yee Whye Teh. Neural processes. arXiv:1807.01622, 2018.
252
+ [38] Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. Generating sentences by editing prototypes. Transactions of the Association for Computational Linguistics, 6:437–450, 2018.
253
+ [39] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv:2002.08909, 2020.
254
+ [40] Charles R. Harris, K. Jarrod Millman, Stéfan J. van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, Robert Kern, Matti Picus, Stephan Hoyer, Marten H. van Kerkwijk, Matthew Brett, Allan Haldane, Jaime Fernández del Río, Mark Wiebe, Pearu Peterson, Pierre Gérard-Marchant, Kevin Sheppard, Tyler Reddy, Warren Weckesser, Hameer Abbasi, Christoph Gohlke, and Travis E. Oliphant. Array programming with NumPy. Nature, 585, 2020.
255
+ [41] Tatsunori B Hashimoto, Kelvin Guu, Yonatan Oren, and Percy Liang. A retrieve-and-edit framework for predicting structured outputs. In Advances in neural information processing systems, 2018.
256
+ [42] Jonathan Ho, Nal Kalchbrenner, Dirk Weissenborn, and Tim Salimans. Axial attention in multidimensional transformers. arXiv:1912.12180, 2019.
257
+ [43] James Honaker and Gary King. What to do about missing values in time series cross-section data. American Journal of Political Science, 2010.
258
+ [44] Michael Hutchinson, Charline Le Lan, Sheheryar Zaidi, Emilien Dupont, Yee Whye Teh, and Hyunjik Kim. Lietransformer: Equivariant self-attention for lie groups. arXiv:2012.10885, 2020.
259
+ [45] Google Inc. Kaggle. https://www.kaggle.com/, 2021.
260
+ [46] Andrew Jaegle, Felix Gimeno, Andrew Brock, Andrew Zisserman, Oriol Vinyals, and Joao Carreira. Perceiver: General perception with iterative attention. arXiv:2103.03206, 2021.
261
+ [47] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are RNNs: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, volume 37, 2020.
262
+ [48] Guolin Ke, Qi Meng, Thomas Finley, Taifeng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie-Yan Liu. Lightgbm: A highly efficient gradient boosting decision tree. In Advances in neural information processing systems, volume 30, 2017.
263
+ [49] Hyunjik Kim, Andriy Mnih, Jonathan Schwarz, Marta Garnelo, Ali Eslami, Dan Rosenbaum, Oriol Vinyals, and Yee Whye Teh. Attentive neural processes. In International Conference on Learning Representations, 2019.
264
+ [50] Gary King, James Honaker, Anne Joseph, and Kenneth Scheve. Analyzing incomplete political science data: An alternative algorithm for multiple imputation. American Political Science Review, 2001.
265
+ [51] Diederik P Kingma, Danilo J Rezende, Shakir Mohamed, and Max Welling. Semi-supervised learning with deep generative models. arXiv:1406.5298, 2014.
266
+ [52] Thomas Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
267
+ [53] Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems. In International Conference on Machine Learning, volume 35, 2018.
268
+ [54] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In European Conference on Computer Vision, 2020.
269
+ [55] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images, 2009.
270
+ [56] Brenden M. Lake, Ruslan Salakhutdinov, and Joshua B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350, 2015.
271
+ [57] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86, 1998.
272
+ [58] Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. ATT Labs [Online], 2, 2010.
273
+ [59] 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 International Conference on Machine Learning, volume 36, 2019.
274
+ [60] T. Liu, A. Moore, and A. Gray. New algorithms for efficient high-dimensional nonparametric classification. In Journal of Machine Learning Research, volume 7, 2006.
275
+ [61] Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. In Advances in Neural Information Processing Systems, volume 33, 2020.
276
+ [62] Wei-Yin Loh. Fifty years of classification and regression trees. International Statistical Review, 82, 2014.
277
+ [63] Rhiannon Michelmore, Marta Kwiatkowska, and Yarin Gal. Evaluating uncertainty quantification in end-to-end autonomous driving control. arXiv:1811.06817, 2018.
278
+ [64] James N Morgan and John A Sonquist. Problems in the analysis of survey data, and a proposal. Journal of the American statistical association, 58, 1963.
279
+
280
+ [65] Yair Movshovitz-Attias, Alexander Toshev, Thomas K Leung, Sergey Ioffe, and Saurabh Singh. No fuss distance metric learning using proxies. In International Conference on Computer Vision, pages 360–368, 2017.
281
+
282
+ [66] Sharan Narang, Hyung Won Chung, Yi Tay, William Fedus, Thibault Févry, Michael Matena, Karishma Malkan, Noah Fiedel, Noam Shazeer, Zhenzhong Lan, Yanqi Zhou, Wei Li, Nan Ding, Jake Marcus, Adam Roberts, and Colin Raffel. Do transformer modifications transfer across implementations and applications? arXiv:2102.11972, 2021.
283
+
284
+ [67] Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, volume 35, 2018.
285
+
286
+ [68] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32, 2019.
287
+
288
+ [69] Fabian Pedregosa, Gaël 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, 2011.
289
+
290
+ [70] Google Cloud AI Platform. Getting started with the built-in tabnet algorithm, 2021. URL cloud.google. com/ai-platform/training/docs/algorithms/tab-net-start.
291
+
292
+ [71] Liudmila Prokhorenkova, Gleb Gusev, Aleksandr Vorobev, Anna Veronika Dorogush, and Andrey Gulin. Catboost: unbiased boosting with categorical features. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31, 2018.
293
+
294
+ [72] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 2019.
295
+
296
+ [73] Roshan Rao, Jason Liu, Robert Verkuil, Joshua Meier, John F Canny, Pieter Abbeel, Tom Sercu, and Alexander Rives. Msa transformer. bioRxiv, 2021.
297
+
298
+ [74] Carl Edward Rasmussen. Gaussian processes in machine learning. In Summer school on machine learning, 2003.
299
+
300
+ [75] Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. arXiv:2104.10972, 2021.
301
+
302
+ [76] Sam Roweis, Geoffrey Hinton, and Ruslan Salakhutdinov. Neighbourhood component analysis. In Advances in Neural Information Processing Systems, volume 17, page 4, 2004.
303
+
304
+ [77] Hugh Salimbeni and Marc Deisenroth. Doubly stochastic variational inference for deep gaussian processes. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30, 2017.
305
+
306
+ [78] Robert E Schapire. The strength of weak learnability. Machine learning, 5, 1990.
307
+
308
+ [79] Jenny Seidenschwarz, Ismail Elezi, and Laura Leal-Taixé. Learning intra-batch connections for deep metric learning. In International Conference on Machine Learning, 2021.
309
+
310
+ [80] Weiping Song, Chence Shi, Zhiping Xiao, Zhijian Duan, Yewen Xu, Ming Zhang, and Jian Tang. Autoint: Automatic feature interaction learning via self-attentive neural networks. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, 2019.
311
+
312
+ [81] D.J. Stekhoven and P. Buehlmann. Missforest - nonparametric missing value imputation for mixed-type data. Bioinformatics, 2012.
313
+
314
+ [82] Yu-Sung Su, Andrew E. Gelman, Jennifer Hill, and Masanao Yajima. Multiple imputation with diagnostics (mi) in R: Opening windows into the black box. Journal of Statistical Software, 2012.
315
+
316
+ [83] C. Sun, A. Shrivastava, S. Singh, and A. Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In 2017 IEEE International Conference on Computer Vision (ICCV), 2017.
317
+
318
+ [84] Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. arXiv:2009.06732, 2020.
319
+ [85] Hugo Touvron, Andrea Vedaldi, Matthijs Douze, and Herve Jegou. Fixing the train-test resolution discrepancy. In Advances in Neural Information Processing Systems, volume 32, 2019.
320
+ [86] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv:2012.12877, 2020.
321
+ [87] Betty Van Aken, Julian Risch, Ralf Krestel, and Alexander Löser. Challenges for toxic comment classification: An in-depth error analysis. arXiv preprint arXiv:1809.07572, 2018.
322
+ [88] Stef van Buuren and Karin Groothuis-Oudshoorn. mice: Multivariate imputation by chained equations in r. Journal of Statistical Software, 2011.
323
+ [89] Vladimir Vapnik. Estimation of dependences based on empirical data. Springer Science & Business Media, 2006.
324
+ [90] 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, volume 30, 2017.
325
+ [91] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. ´ Graph attention networks. In International Conference on Learning Representations, 2018.
326
+ [92] Sethu Vijayakumar and Stefan Schaal. Local dimensionality reduction for locally weighted learning. In International Symposium on Computational Intelligence in Robotics and Automation, pages 220–225. IEEE, 1997.
327
+ [93] Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in neural information processing systems, volume 29, pages 3630–3638, 2016.
328
+ [94] Xinshao Wang, Yang Hua, Elyor Kodirov, Guosheng Hu, Romain Garnier, and Neil M Robertson. Ranked list loss for deep metric learning. In Conference on Computer Vision and Pattern Recognition, pages 5207–5216, 2019.
329
+ [95] Andrew Gordon Wilson, Zhiting Hu, Ruslan Salakhutdinov, and Eric P. Xing. Deep kernel learning. In International Conference on Artificial Intelligence and Statistics, volume 19, 2016.
330
+ [96] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019.
331
+ [97] Jaesik Yoon, Taesup Kim, Ousmane Dia, Sungwoong Kim, Yoshua Bengio, and Sungjin Ahn. Bayesian model-agnostic meta-learning. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31, 2018.
332
+ [98] Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large batch optimization for deep learning: Training bert in 76 minutes. In International Conference on Learning Representations, 2020.
333
+ [99] Michael Zhang, James Lucas, Jimmy Ba, and Geoffrey E Hinton. Lookahead optimizer: k steps forward, 1 step back. In Advances in Neural Information Processing Systems, volume 32, 2019.
md/train/wpSWuz_hyqA/wpSWuz_hyqA.md ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GROUNDED LANGUAGE LEARNING FAST AND SLOW
2
+
3
+ Felix Hill, Olivier Tieleman, Tamara von Glehn, Nathaniel Wong, Hamza Merzic,
4
+ Stephen Clark
5
+ DeepMind
6
+ London, UK
7
+ {felixhill, tieleman, tamaravg, nathanielwong, hamzamerzic,
8
+ clarkstephen}@google.com
9
+
10
+ # ABSTRACT
11
+
12
+ Recent work has shown that large text-based neural language models acquire a surprising propensity for one-shot learning. Here, we show that an agent situated in a simulated 3D world, and endowed with a novel dual-coding external memory, can exhibit similar one-shot word learning when trained with conventional RL algorithms. After a single introduction to a novel object via visual perception and language (“This is a dax”), the agent can manipulate the object as instructed (“Put the dax on the bed”), combining short-term, within-episode knowledge of the nonsense word with long-term lexical and motor knowledge. We find that, under certain training conditions and with a particular memory writing mechanism, the agent’s one-shot word-object binding generalizes to novel exemplars within the same ShapeNet category, and is effective in settings with unfamiliar numbers of objects. We further show how dual-coding memory can be exploited as a signal for intrinsic motivation, stimulating the agent to seek names for objects that may be useful later. Together, the results demonstrate that deep neural networks can exploit meta-learning, episodic memory and an explicitly multi-modal environment to account for fast-mapping, a fundamental pillar of human cognitive development and a potentially transformative capacity for artificial agents.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Language models that exhibit one- or few-shot learning are of growing interest in machine learning applications because they can adapt their knowledge to new information (Brown et al., 2020; Yin, 2020). One-shot language learning in the physical world is also of interest to developmental psychologists; fast-mapping, the ability to bind a new word to an unfamiliar object after a single exposure, is a much studied facet of child language learning (Carey & Bartlett, 1978). Our goal is to enable an embodied learning system to perform fast-mapping, and we take a step towards this goal by developing an embodied agent situated in a 3D game environment that can learn the names of entirely unfamiliar objects in a single exposure, and immediately apply this knowledge to carry out instructions based on those objects. The agent observes the world via active perception of raw pixels, and learns to respond to linguistic stimuli by executing sequences of motor actions. It is trained by a combination of conventional RL and predictive (semi-supervised) learning.
17
+
18
+ We find that an agent architecture consisting of standard neural network components is sufficient to follow language instructions whose meaning is preserved across episodes. However, learning to fast-map novel names to novel objects in a single episode relies on semi-supervised prediction mechanisms and a novel form of external memory, inspired by the dual-coding theory of knowledge representation (Paivio, 1969). With these components, an agent can exhibit both slow word learning and fast-mapping. Moreover, the agent exhibits an emergent propensity to integrate both fast-mapped and slowly acquired word meanings in a single episode, successfully executing instructions such as “put the dax in the box” that depend on both slow-learned (“put”, “box”) and fast-mapped (“dax”) word meanings.
19
+
20
+ Via controlled generalization experiments, we find that the agent is reasonably robust to a degree of variation in the number of objects involved in a given fast-mapping task at test time. The agent also exhibits above-chance success when presented with the name for a particular object in the ShapeNet taxonomy (Chang et al., 2015) and then instructed (using that name) to interact with a different exemplar from the same object class, and this propensity can be further enhanced by specific metatraining. We find that both the number of unique objects observed by the agent during training and the temporal aspect of its perceptual experience of those objects contribute critically to its ability to generalize, particularly its ability to execute fast-mapping with entirely novel objects. Finally, we show that a dual-coding memory schema can provide a more effective basis to derive a signal for intrinsic motivation than a more conventional (unimodal) memory.
21
+
22
+ ![](images/4ee4e3aa58759c6af9de0a33cbf59547d262197b5d9142a5e8f2f1f739527e49.jpg)
23
+ Figure 1: Top: The two phases of a fast-mapping episode. Bottom: Screenshots of the task from the agent’s perspective at important moments (including the contents of the language channel).
24
+
25
+ # 2 AN ENVIRONMENT FOR FAST WORD LEARNING
26
+
27
+ We conduct experiments in a 3D room built with the Unity game engine. In a typical episode, the room contains a pre-specified number $N$ of everyday 3D rendered objects from a global set $G$ . In all training and evaluation episodes, the initial positions of the objects and agent are randomized. The objects include everyday household items such as kitchenware (cup, glass), toys (teddy bear, football), homeware (cushion, vase), and so on.
28
+
29
+ Episodes consist of two phases: a discovery phase, followed by an instruction phase (see Figure 1).1 In the discovery phase, the agent must explore the room and fixate on each of the objects in turn. When it fixates on an object, the environment returns a string with the name of the object (which is a nonsense word), for example “This is a dax” or “This is a blicket”. Once the environment has returned the name of each of the objects (or if a time limit of 30s is reached), the positions of all the objects and the agent are re-randomized and the instruction phase begins. The environment then emits an instruction, for example “Pick up a dax” or “Pick up a blicket”. To succeed, the agent must then lift up the specified object and hold it above $0 . 2 5 \mathrm { m }$ for 3 consecutive timesteps, at which point the episode ends, and a new episode begins with a discovery phase and a fresh sample of objects from the global set $G$ . If the agent first lifts up an incorrect object, the episode also ends (so it is not possible to pick up more than one object in the instruction phase). To provide a signal for the agent to learn from, it receives a scalar reward of 1.0 if it picks up the correct object in the instruction phase. In the default training setting, to encourage the necessary information-seeking behaviour, a smaller shaping reward of 0.1 is provided for visiting each of the objects in the discovery phase.
30
+
31
+ Given this two-phase episode structure, two distinct learning challenges can be posed to the agent. In a slow-learning regime, the environment can assign the permanent name (e.g. “cup”, “chair”) to objects in the environment whenever they are sampled. By contrast, in the fast-mapping regime, which is the principal focus of this work, the environment assigns a unique nonsense word to each of the objects in the room at random on a per-episode basis. The only way to consistently solve the task is to record the connections between words and objects in the discovery phase, and apply this (episode-specific) knowledge in the instruction phase to determine which object to pick up.
32
+
33
+ # 3 MEMORY ARCHITECTURES FOR AGENTS WITH VISION AND LANGUAGE
34
+
35
+ The agents that we consider build on a standard architecture for reinforcement learning in multimodal (vision $^ +$ language) environments (see e.g. (Chaplot et al., 2018; Hermann et al., 2017; Hill et al., 2020)). The visual input (raw pixels) is processed at every timestep by a convolutional network with residual connections (a ResNet). The language input is passed through an embedding lookup layer plus self-attention layer for processing. Finally, a core memory integrates the information from the two input sources over time. A fully-connected plus softmax layer maps the state of this core memory to a distribution over 46 actions, which are discretizations of a 9-DoF continuous agent avatar. A separate layer predicts a value function for computing a baseline for optimization according to the IMPALA algorithm (Espeholt et al., 2018).
36
+
37
+ We replicated previous studies by verifying that a baseline architecture with LSTM core memory (Hochreiter & Schmidhuber, 1997) could learn to follow language instructions when trained in the slow-learning regime. However, the failure of this architecture to reliably learn to perform abovechance in the fast-learning regime motivated investigation of architectures involving explicit external memory modules. Given the two observation channels from language and vision, there are various ways in which observations can be represented and retrieved in external memory.
38
+
39
+ Differentiable Neural Computer (DNC) In the DNC (Wayne et al., 2018), at each timestep $t$ a latent vector $\mathbf { e } _ { t } = w ( \mathbf { h } _ { t - 1 } , \mathbf { r } _ { t - 1 } , \mathbf { x } _ { t } )$ , computed from the previous hidden state $\mathbf { h } _ { t - 1 }$ of the agent’s core memory LSTM, the previous memory read-out $\mathbf { r } _ { t - 1 }$ , and the current inputs $\mathbf { x } _ { t }$ , is written to a slot-based external memory. In our setting, the input $\mathbf { x } _ { t }$ is a simple concatenation $[ \mathbf { v } _ { t } , \mathbf { l } _ { t } ]$ of the output of the vision network and the embedding returned by the language network. Before writing to memory, the latent vector $\mathbf { e } _ { t }$ is also passed to the core memory LSTM to produce the current state $\mathbf { h } _ { t }$ . The agent reads from memory by producing a query vector $q ( \mathbf { h } _ { t } )$ and read strength $\beta ( \mathbf { h } _ { t } )$ , and computing the cosine similarity between the query and all embeddings currently stored in memory $\mathbf { e } _ { i }$ $( i ~ < ~ t )$ . The external memory returns only the $k$ most similar entries in the memory (where $k$ is a hyperparameter), and corresponding scalar similarities. The returned embeddings are then aggregated into a single vector $\hat { \mathbf { r } } _ { t }$ by normalizing the similarities and taking a weighted average of the embeddings. This reading procedure is performed simultaneously by $n$ independent read heads, and the results $[ \hat { \mathbf { r } } _ { t } ^ { 1 } , \ldots , \hat { \mathbf { r } } _ { t } ^ { n } ]$ are concatenated to form the current memory read-out $\mathbf { r } _ { t }$ . The vectors $\mathbf { e } _ { t }$ and $\mathbf { h } _ { t }$ are output to the policy and value networks.
40
+
41
+ Dual-coding Episodic Memory (DCEM) We propose an alternative external key-value memory architecture inspired by the Dual-Coding theory of human memory (Paivio, 1969). The key idea is to allow different modalities (language and vision) to determine either the keys (and queries) or the values. In the present work, because of the structure of the tasks we consider, we align the keys and queries with language and the values with vision. However, for different problems (such as those requiring language production) the converse alignment could be made, or a single memory system could implement both alignments.
42
+
43
+ In our implementation, at each timestep the agent writes the current linguistic observation embeddings ${ \bf l } _ { t }$ to the keys of the memory and the current visual embedding $\mathbf { v } _ { t }$ to its values. To read from the memory, a query $q ( \mathbf { v } _ { t } , \mathbf { l } _ { t } , \mathbf { h } _ { t - 1 } )$ is computed and compared to the keys by cosine similarity. The $k$ values whose keys are most similar to the query, $[ \mathbf m ^ { j } ] _ { j \leq k }$ , are returned together with similarities $[ s ^ { j } ] _ { j \leq k }$ . To aggregate the returned memories into a single vector $\mathbf { r } _ { t }$ , the similarities are first normalized into a distribution $\{ \hat { s } ^ { j } \}$ and then applied to weight the memories $\hat { \mathbf { m } } ^ { j } = \hat { s } ^ { j } \mathbf { m } ^ { j }$ . These $k$ weighted memories are then passed through a self-attention layer and summed elementwise to produce $\mathbf { r } _ { t }$ . As before this is repeated for $n$ read heads, and the results concatenated to form the current memory read-out $\mathbf { r } _ { t }$ . $\mathbf { r } _ { t }$ is then concatenated with $\mathbf { h } _ { t - 1 }$ and new inputs $\mathbf { x } _ { t }$ to compute a latent vector $\mathbf { e } _ { t } = w ( \mathbf { h } _ { t - 1 } , \mathbf { r } _ { t } , \mathbf { x } _ { t } )$ , which is passed to the core memory LSTM to produce the subsequent state $\mathbf { h } _ { t }$ , and finally $\mathbf { e } _ { t }$ and $\mathbf { h } _ { t }$ are output to the policy and value networks.
44
+
45
+ ![](images/4f816676ebf76b328c037e91136cf88dac00ae766dbfc34c28f777d152f4154c.jpg)
46
+
47
+ Table 1: Left: Performance when training on a three-object fast-mapping task with $| G | = 3 0$ . mem: size of memory buffer/window $R$ : with reconstruction loss. Right: Learning curves, each showing mean $\pm \ : \mathrm { S . D }$ . over 5 random seeds.
48
+
49
+ <table><tr><td>Mean (S.D) accuracy Architecture le9 training steps</td></tr><tr><td>LSTM 0.33 (0.05)</td></tr><tr><td>LSTM+R 0.61 (0.27)</td></tr><tr><td>DNC mem=1024 0.34 (0.01)</td></tr><tr><td>DNC mem=1024+R 0.64 (0.27)</td></tr><tr><td>TransformerXL mem=1024 0.32 (0.02)</td></tr><tr><td>TransformerXL mem=1024+R 0.98 (0.01)</td></tr><tr><td>DCEM mem=1024 0.33 (0.02)</td></tr><tr><td>DCEM mem=1024+R 0.98 (0.01)</td></tr><tr><td>TransformerXL mem=100+R 0.73 (0.35)</td></tr><tr><td>DCEM mem=100 +R 0.98 (0.01)</td></tr><tr><td>Random object selection 0.33</td></tr></table>
50
+
51
+ Gated Transformer $\mathbf { \Pi } ( \mathbf { X L } )$ We also consider an architecture where the agent’s core memory is a Transformer (Vaswani et al., 2017), including the gating mechanism from Parisotto et al. (2019). The only difference from Parisotto et al. (2019) is that we consider a multi-modal environment, where the observations $\mathbf { x } _ { t }$ passed to the core memory are the concatenation of visual and language embeddings. We use a 4-layer Transformer with a principal embedding size of 256 (8 parallel heads with query, key and value size of 32 per layer). These parameters are chosen to give a comparable number of total learnable parameters to the DCEM architecture.
52
+
53
+ Policy learning The agent’s policy is trained by minimizing the standard V-trace off-policy actorcritic loss (Espeholt et al., 2018). Gradients flow through the policy layer and the core LSTM to the memory’s query network and the embedding ResNet and self-attention language encoder. We also use a policy entropy loss as in (Mnih et al., 2016; Espeholt et al., 2018) to encourage random-action exploration. For more details and hyperparameters see Appendix A.4.
54
+
55
+ Observation reconstruction In order to provide a stronger representation-shaping signal, we make use of a reconstruction loss in addition to the standard V-trace setup. The latent vector $\mathbf { e } _ { t }$ is passed to a ResNet $g$ that is the transpose of the image encoder, and outputs a reconstruction of the image input $\mathbf { d } _ { t } ^ { \mathrm { i m } } = g ( \mathbf { e } _ { t } )$ . The image reconstruction loss is the cross entropy between the input and reconstructed images: $l _ { t } ^ { \mathrm { i m } } = - \mathbf { x } _ { t } ^ { \mathrm { i m } } \log \mathbf { d } _ { t } ^ { \mathrm { i m } } - ( 1 - \mathbf { x } _ { t } ^ { \mathrm { i m } } ) \log ( 1 - \mathbf { d } _ { t } ^ { \mathrm { i m } } )$ . The language decoder is a simple LSTM, which also takes the latent vector $\mathbf { e } _ { t }$ as input and produces a sequence of output vectors that are projected and softmaxed into classifications over the vocabulary ${ \bf d } _ { t } ^ { \mathrm { l a n g } }$ . The loss is the cross entropy between the classification produced and the one-hot vocabulary indices of the input words: $l _ { t } ^ { \mathrm { l a n g } } = - \mathbf { x } _ { t } ^ { \mathrm { l a n g } } \log \mathbf { d } _ { t } ^ { \mathrm { l a n g } } - ( 1 - \mathbf { x } _ { t } ^ { \mathrm { l a n g } } ) \log ( 1 - \mathbf { d } _ { t } ^ { \mathrm { l a n g } } )$ . For more details regarding the flow of information and gradients see Appendix A.4.
56
+
57
+ # 4 EXPERIMENTS
58
+
59
+ We compared the different memory architectures with and without semi-supervised reconstruction loss on a version of the fast-mapping task involving three objects $N = 3$ ) sampled from a global set of 30 $| G | = 3 0 ,$ ). As shown in Table 1, only the DCEM and Transformer architectures reliably solve the task after $1 \times 1 0 ^ { 9 }$ timesteps of training.
60
+
61
+ DCEM vs. TransformerXL Importantly, the Transformer and DCEM are the two architectures that can exploit the principle of dual-coding. Since the inputs to the Transformer are the concatenation of visual and language codes, this model can recover the dual-coding aspect of the DCEM by learning self-attention weights $\mathbf { W } _ { k }$ and $\mathbf { W } _ { q }$ that project the language code to keys and queries, and weights $\mathbf { W } _ { v }$ to project the visual code to values. Learning in the DCEM was marginally more sample-efficient, but this is perhaps expected given it was designed with fast-mapping tasks in mind. In light of this, is it really worth pursing memory systems with explicit episodic memories?
62
+
63
+ ![](images/eb6284c7f9f9e22a4e65e427e7dfe197dd4a46a81c3042ae834b130764324011.jpg)
64
+ Figure 2: Accuracy of agents trained on probe trials involving a different number of total objects for agents meta-trained with different numbers of total objects.
65
+
66
+ To show one clear justification for external memory architectures, we conducted an additional comparison in which the memory windows of both the DCEM and the Transformer agents were limited to 100 timesteps (from 1024 in the original experiment), approximately the length of an episode if an agent is well-trained to the optimal policy. With a memory span of 100, the Transformer is forced to use the XL window-recurrence mechanism to pass information across context windows (Dai et al., 2019), while any capacity to retain episodic information beyond 100 timesteps in the DCEM must be managed by by the LSTM controller. In this setting we observed that the DCEM was substantially more effective (Table 1, left, bottom). While this imposed memory constraint may seem arbitrary, in real-world tasks working memory will always be at a premium. These results suggest that DCEM is more ‘working-memory-efficient’ than the Transformer agent. Indeed, by employing a simple heuristic by which the agent only writes to its external memory when the language observation changes from one timestep to the next, the DCEM agent with only 20 memory slots could solve the task with similar efficiency to a Transformer agent with a 1024-slot memory. See Appendix A.1 for these results and details of the selective writing heuristic.
67
+
68
+ # 4.1 GENERALIZATION
69
+
70
+ To explore the generalization capabilities of our agents, we subjected trained agents to various behavioural probes, and measured performance across thousands of episodes without updating their weights. Unless stated otherwise, all experiments in this section involve the DCEM $^ +$ Recons agent.
71
+
72
+ Number of objects We first probed the robustness of the agent to fast-mapping episodes with different numbers of objects. In all conditions, the same objects appear in both the discovery and instruction phases of the episode, and the objects are sampled from the same global set $G$ $| G | = 3 0 ,$ ). As shown in Figures 2(b) and (c) (red curves), with the (default) meta-training setting involving three objects in each episode, performance on episodes involving five objects is approximately $70 \%$ , and with eight objects around $50 \%$ . This sub-optimal performance suggests that, with this metatraining regime, the agent does tend to overfit, to some degree, to the “three-ness” of its experience. Figure 2(b) shows, however, that the overfitting of the agent can be alleviated by increasing the number of objects during meta-training. Finally, Figure 2(a) confirms, perhaps unsurprisingly, that the agent has no problem generalizing to episodes with fewer objects than it was trained on.
73
+
74
+ Novel objects To probe the ability of the agents to quickly learn about any arbitrary new object, we instrumented trials with objects sampled from a global test set of novel objects $H : H \cap G =$ $\emptyset , | H | = 1 0$ . As shown in Figure 3, we found that an agent meta-trained on 20 objects (i.e. $| G | = 2 0 ,$ ) was almost perfectly robust to novel objects. As may be expected, this robustness degraded to some degree with decreasing $| G |$ , which is symptomatic of the agent specializing (and overfitting) to the particular features and distinctions of the objects in its environment. However, we only observed a substantial reduction in robustness to new objects when $| G |$ was reduced as low as three – i.e. a metatraining experience in which all episodes contain the same three objects (the first three elements of $G$ alphabetically, i.e. a boat, a book and a bottle).
75
+
76
+ ![](images/b57073217ff33f52ce3d9c7a2e087f307b3548971a7bc5fc3bfed0036270f674.jpg)
77
+ Figure 3: Accuracy during training and evaluation trials involving unfamiliar objects, for different sizes of global training set $G$ . Curves show mean $\pm \ : \mathrm { S . E }$ . over 3 agent seeds in each condition.
78
+
79
+ ![](images/c787f301fba44450b8e54f48ebf1349b58d610469fc4b47f39236ee9d9e53cdd.jpg)
80
+ Figure 4: Accuracy of agents in fast-mapping trials requiring the extension of ShapeNet categories from a single exemplar. Curves show the mean $\pm \ : \mathrm { S . E }$ . over three agent seeds in each condition.
81
+
82
+ Fast category extension Children aged between three and four can acquire in one shot not only bindings between new words and specific unfamiliar objects, but also bindings between new words and categories (Behrend et al., 2001; Waxman & Booth, 2000; Vlach & Sandhofer, 2012). We conducted an analogous experiment by exploiting the category structure in ShapeNet (Chang et al., 2015). In a test trial, in the discovery phase the agent is presented with exemplars from three novel (held-out) ShapeNet categories (together with nonsense names). In the instruction phase, the agent must then pick up a different and unseen exemplar from one of these three new categories as instructed. As shown in Figure 4, when trained as described previously, the agent achieves around $5 5 \%$ accuracy on test trials, which is above chance $( 3 3 \% )$ but still a substantial error rate. However, this performance can be improved by requiring the agent to extend the training object categories as it learns. In this regime, three ShapeNet exemplars from distinct classes are encountered by the agent in the discovery phase of training episodes, and the instruction phase involves different exemplars from the same three classes. When trained in this way (which share similarities with matching networks (Vinyals et al., 2016)), performance on extending novel categories increases to $8 8 \%$ .
83
+
84
+ Role of temporal aspect Through ablations we found that both novel objects generalization and category extension relied on the agent reading multiple values from memory for each query. See A.2 for a discussion of these results, which suggest that the temporal aspect of the agent’s experience (and learning from multiple views of the same object) is an important driver of generalization.
85
+
86
+ # 4.2 INTRINSIC MOTIVATION
87
+
88
+ The default version of the fast-mapping task includes a shaping reward to encourage the agent to visit all objects in the room. Without this reward, the credit assignment problem of a fast-mapping episode is too challenging. However, we found that the DCEM agent was able to solve the task without shaping rewards by employing a memory-based algorithm for intrinsic motivation (NGU; Badia et al. (2020)). NGU computes a ‘surprise’ score for observations by computing its distance to other observations in the episodic memory, as described in Appendix A.4.3. The surprise score is applied as a reward signal $r ^ { \mathrm { { N G U } } }$ which is added to the environment reward to encourage the agent to seek new experiences. We compared the effect of doing this in the DNC and the DCEM agents. For DCEM, the NGU computation can be applied to the memory’s keys (language) column, its values (vision) column, or both. In the former case, the agent seeks novelty in the language space rNGUlang , and in the latter, in the visual space. The final reward is r = rext + λlangrNGUlang . As shown in Figure 5, we found that the DCEM agent (with $\lambda _ { \mathrm { l a n g } } = 1 0 ^ { - 3 }$ and $\lambda _ { \mathrm { i m } } = 3 \times 1 0 ^ { - 5 } .$ ) was able to solve the fast-mapping tasks without any shaping reward. This was not the case for the DNC agent, presumably because the required signal for ‘language-novelty’ is not approximated as well by the surprise score of the merged visual-language codes in the episodic memory.
89
+
90
+ ![](images/0af91cb678592b399ab13520c74e252985017599bded233cfca9698f6d54436c.jpg)
91
+ Figure 5: Accuracy of agents trained without shaping reward on the 3-object fast-mapping task with $| G | = 3 0$ . Curves show mean $\pm \ : \mathrm { S . E }$ . across three seeds in each condition.
92
+
93
+ # 4.3 INTEGRATING FAST AND SLOW LEARNING
94
+
95
+ To test whether our agents can integrate new information with existing lexical (and perceptual and motor) knowledge, we combined a fast-mapping task with a more conventional instruction-following task. In the discovery phase, the agent must explore to find the names of three unfamiliar objects, but in this case the room also contains a large box and a large bed, both of which are immovable. The positions of all objects and the agent are then re-randomized as before. In the instruction phase, the agent is then instructed to put one of the three movable objects (chosen at random) on either the bed or in the box (again chosen at random). As shown in Figure 6, if the training regime consisted of conventional lifting and putting tasks, together with a fast-mapping lifting task and a fast-mapping putting task, the agent learned to execute the evaluation trials with near-perfect accuracy. Notably, we also found that substantially-above-chance performance could be achieved on the evaluation trials without needing to train the agent on the evaluation task in any form. If we trained the agent on conventional lifting and putting tasks, and a fast-mapping task involving lifting only, the agent could recombine the knowledge acquired during this training to resolve the evaluation trials as a novel (zero-shot) task with less-than-perfect but substantially-above-chance accuracy.
96
+
97
+ # 4.4 RESULTS WITH ANOTHER ENVIRONMENT
98
+
99
+ To verify that the observed effects hold beyond our specific Unity environment, we added a new task to the DeepMind Lab suite (Beattie et al., 2016). Results for this task are given in Appendix A.3.
100
+
101
+ # 5 RELATED WORK
102
+
103
+ Meta-learning, of the sort observed in our agent, has been applied to train matching networks: image classifiers that can assign the correct label to a novel image, given a small support set of (image, label) pairs that includes the correct target label (Vinyals et al., 2016). Our work is also inspired by
104
+
105
+ ![](images/9ae82fe68eadfe13d4ffef90afbc33a91247c3e8e2c4c79916579b145a9472ea.jpg)
106
+ Figure 6: Right: The accuracy of the agent (accuracy $\pm S . E .$ .) on evaluation trials when exposed to different training regimes. Left: Schematic of the most impoverished training regime.
107
+
108
+ Snell et al. (2017), who propose a more efficient way to integrate a small support set of experience into a coherent space of image ‘concepts’ for improved fast learning, and Santoro et al. (2016), who show that the successful meta-training of image classifiers can benefit substantially from external memory architectures such as Memory Networks (Weston et al., 2014) or DNC (Graves et al., 2016).
109
+
110
+ In NLP, meta-learning has been used to train few-shot classifiers for various tasks (see Yin (2020) for a recent survey). Meta-learning has also previously been observed in reinforcement learning agents trained with conventional policy-gradient algorithms (Duan et al., 2016; Wang et al., 2019). In Model-Agnostic Meta Learning (Finn et al., 2017), models are (meta) trained to be easily tunable (by any gradient algorithm) given a small number of novel data points. When combined with policygradient algorithms, this technique yields fast learning on both 2D navigation and 3D locomotion tasks. In cognitive tasks where fast learning is not explicitly required, external memories have proven to help goal-directed agents (Fortunato et al., 2019), and can be particularly powerful when combined with an observation reconstruction loss (Wayne et al., 2018).
111
+
112
+ Recent work at the intersection of psychology and machine learning is also relevant in that it shows how the noisy, first-person perspective of a child can support the acquisition of robust visual categories in artificial neural networks (Bambach et al., 2018). When deep networks are trained on data recorded from children’s head cameras, unsupervised or semi-supervised learning objectives can substantially improve the quality of the resulting representations (Orhan et al., 2020).
113
+
114
+ # 6 CONCLUSION
115
+
116
+ Our experiments have highlighted various benefits of having an explicitly multi-modal episodic memory system. First, mechanisms that allow the agent to query its memory in a modality-specific way (either within or across modalities) can better allow them to rapidly infer and exploit connections between perceptual experience and words, and therefore to realize fast-mapping, a notable aspect of human learning. Second, external (read-write) memories can achieve better performance for the same number of memory ‘slots’ than Transformer-based memories. This greater ‘memoryefficiency’ may be increasingly important as agents are applied to real-world tasks with very long episodic horizons. Third, in cases where it is useful to estimate the degree of novelty or “surprise” in the current state of the environment (for instance to derive a signal for intrinsic motivation), a more informative signal may be obtained by separately estimating novelty based on each modality and aggregating the result. Finally, an episodic memory system may ultimately be essential for fast knowledge consolidation. The potential for memory buffers and offline learning processes such as experience replay to support knowledge consolidation is not a new idea (McClelland et al., 1995; Mnih et al., 2016; Lillicrap et al., 2016; McClelland et al., 2020). For language learning agents, the need to both rapidly acquire and retain multi-modal knowledge may further motivate explicit external memories. Retaining in memory visual experiences together with aligned (and hopefully pertinent) language (i.e. a dual-coding schema) may facilitate something akin to offline ‘supervised’ language learning. We leave this possibility for future investigations, which we will facilitate by releasing publicly the environments and tasks described in this paper.
117
+
118
+ # REFERENCES
119
+
120
+ Adria Puigdom \` enech Badia, P. Sprechmann, Alex Vitvitskyi, Daniel Guo, B. Piot, Steven Kaptur- \` owski, O. Tieleman, Mart´ın Arjovsky, A. Pritzel, Andew Bolt, and Charles Blundell. Never give up: Learning directed exploration strategies. ArXiv, abs/2002.06038, 2020.
121
+
122
+ Sven Bambach, David Crandall, Linda Smith, and Chen Yu. Toddler-inspired visual object learning. In Advances in neural information processing systems, pp. 1201–1210, 2018.
123
+
124
+ Charles Beattie, Joel Z. Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, ¨ Andrew Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, Julian Schrittwieser, Keith Ander- ´ son, Sarah York, Max Cant, Adam Cain, Adrian Bolton, Stephen Gaffney, Helen King, Demis Hassabis, Shane Legg, and Stig Petersen. Deepmind lab. CoRR, abs/1612.03801, 2016. URL http://arxiv.org/abs/1612.03801.
125
+
126
+ Douglas A Behrend, Jason Scofield, and Erica E Kleinknecht. Beyond fast mapping: Young children’s extensions of novel words and novel facts. Developmental Psychology, 37(5):698, 2001.
127
+
128
+ Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
129
+
130
+ Susan Carey and Elsa Bartlett. Acquiring a single new word. Papers and Reports on Child Language Development, 1978.
131
+
132
+ Angel X Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, et al. Shapenet: An information-rich 3D model repository. arXiv preprint arXiv:1512.03012, 2015.
133
+
134
+ Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-attention architectures for task-oriented language grounding. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
135
+
136
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2978–2988, 2019.
137
+
138
+ 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.
139
+
140
+ 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.
141
+
142
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
143
+
144
+ Meire Fortunato, Melissa Tan, Ryan Faulkner, Steven Hansen, Adria Puigdom \` enech Badia, Gavin \` Buttimore, Charles Deck, Joel Z Leibo, and Charles Blundell. Generalization of reinforcement learners with working and episodic memory. In Advances in Neural Information Processing Systems, pp. 12469–12478, 2019.
145
+
146
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016.
147
+
148
+ Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojciech Marian Czarnecki, Max Jaderberg, Denis Teplyashin, et al. Grounded language learning in a simulated 3D world. arXiv preprint arXiv:1706.06551, 2017.
149
+
150
+ Felix Hill, Stephen Clark, Karl Moritz Hermann, and Phil Blunsom. Understanding early word learning in situated artificial agents. Proceedings of CogSci, 2020.
151
+
152
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
153
+
154
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. In ICLR (Poster), 2016.
155
+
156
+ James L McClelland, Bruce L McNaughton, and Randall C O’Reilly. Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419, 1995.
157
+
158
+ James L. McClelland, Felix Hill, Maja Rudolph, Jason Baldridge, and Hinrich Schutze. Extending ¨ machine language models toward human-level language understanding. PNAS (to appear), 2020.
159
+
160
+ 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.
161
+
162
+ A. Emin Orhan, Vaibhav V. Gupta, and Brenden M. Lake. Self-supervised learning through the eyes of a child, 2020.
163
+
164
+ Allan Paivio. Mental imagery in associative learning and memory. Psychological review, 76(3):241, 1969.
165
+
166
+ 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, 2019.
167
+
168
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International conference on machine learning, pp. 1842–1850, 2016.
169
+
170
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 4077–4087. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 6996-prototypical-networks-for-few-shot-learning.pdf.
171
+
172
+ 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.
173
+
174
+ Oriol Vinyals, Charles Blundell, Timothy 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 (eds.), Advances in Neural Information Processing Systems 29, pp. 3630–3638. Curran Associates, Inc., 2016. URL http://papers.nips.cc/paper/ 6385-matching-networks-for-one-shot-learning.pdf.
175
+
176
+ Haley Vlach and Catherine M Sandhofer. Fast mapping across time: Memory processes support children’s retention of learned words. Frontiers in psychology, 3:46, 2012.
177
+
178
+ Xin Wang, Qiuyuan Huang, Asli Celikyilmaz, Jianfeng Gao, Dinghan Shen, Yuan-Fang Wang, William Yang Wang, and Lei Zhang. Reinforced cross-modal matching and self-supervised imitation learning for vision-language navigation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6629–6638, 2019.
179
+
180
+ Sandra R Waxman and Amy E Booth. Principles that are invoked in the acquisition of words, but not facts. Cognition, 77(2):B33–B43, 2000.
181
+
182
+ Greg Wayne, Chia-Chun Hung, David Amos, Mehdi Mirza, Arun Ahuja, Agnieszka GrabskaBarwinska, Jack Rae, Piotr Mirowski, Joel Z Leibo, Adam Santoro, et al. Unsupervised predictive memory in a goal-directed agent. arXiv preprint arXiv:1803.10760, 2018.
183
+
184
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
185
+
186
+ # A APPENDICES
187
+
188
+ # A.1 COMPARING TRANSFORMERXL TO DCEM WHEN MEMORY IS LIMITED
189
+
190
+ Both the TransformerXL and DCEM/DNC agents have a hyperparameter that determines the effective size of their explicit working memory. In a vanilla Transformer it determines the size of the window of timesteps that the network can be applied to for each forward (and backward) pass. To give models some chance of passing information beyond this hard constraint, TransformerXL architecture conditions each forward pass also on representations computed in the previous window, which establishes a form of recurrence over time from window to window. In our original experiments, this mechanism was not tested, because we set the window size to 1024 timesteps, which is longer than most episodes of the fast-mapping task, which are typically 80-120 timesteps for a well-trained agent.
191
+
192
+ To examine the performance of the TransformerXL in cases where it is required to pass information across context windows, we reduced the size of the window. For a fair comparison, we similarly reduced the equivalent parameter (the capacity in rows in the FIFO external memory) for the DCEM agent. As shown in Figure 7, for cases where the memory window size (or buffer) is reduced to (100) or below (50, 20) the normal episode length, the DCEM performs better than the TransformerXL agent. This suggests that the TransformerXL has difficulty making the necessary (visual and linguistic) information available to policy head when that information must be passed between context windows. Surprisingly, the DCEM was able to learn the tasks efficiently with a memory size of 50, which suggests that it must exploit its LSTM controller to retain sufficient information when its external memory begins to overflow. Both architectures fail when the memory size is reduced to 20, but in that case a DCEM agent can in fact learn the optimal policy if a simple heuristic for selective writing, described below, is employed. This highlights an advantage of explicitly read-write external memories; information can be managed via the reading or the writing process. It is not immediately obvious how the same strategy could be applied with a window-based memory architectecture like TransformerXL.
193
+
194
+ ![](images/d4f39a93bd14a257250d699619b0107a4fd0fdb97da242bd68867cf0cb7788e1.jpg)
195
+ Figure 7: Training success comparison between DCEM, DCEM with selective writing and TransformerXL for different sizes of memory-buffer (DCEM) or window (TransformerXL).
196
+
197
+ # A.1.1 SELECTIVE WRITING HEURISTIC
198
+
199
+ One advantage of explicit external (read-write) memories is that the flow of information to the agent’s policy can be influenced by the writing process as well as the reading function. To verify this fact, we implemented a simple non-parametric heuristic writing condition in the DCEM architecture, whereby observations are written to the external memory when there is a change to the observation in the language channel. This heuristic aligns with the principle of dual-coding exploited elsewhere in the paper: while visual observations change continuously every timestep, changes to observed language are rare events that might signal some important change in the environment.
200
+
201
+ More formally, our heuristic relies on a window size parameter $w$ that we set to 3 in all cases. For observation $\dot { x _ { t } } = \{ v _ { t } , l _ { t } \}$ , a language change indicator $I _ { t } \in \mathbb { N }$ is set as $I _ { 0 } = 0$
202
+
203
+ ![](images/2a87c1d96a40eb759977b49f2f21ed9b9378408a25a093285030ac013df414ee.jpg)
204
+ Figure 8: Training and test accuracy on two types of generalization tasks for agents that read different numbers of frames from their memory per query.
205
+
206
+ $$
207
+ I _ { t } = \left\{ { \begin{array} { l l } { t , } & { { \mathrm { i f ~ } } l _ { t } = l _ { t - 1 } } \\ { I _ { t - 1 } , } & { { \mathrm { o t h e r w i s e . } } } \end{array} } \right.
208
+ $$
209
+
210
+ Then, the content $\mathbf { c } _ { t }$ written to memory at $t$ is
211
+
212
+ $$
213
+ \mathbf { c } _ { t } = { \left\{ \begin{array} { l l } { \left\{ \mathbf { v } _ { t } , \mathbf { l } _ { t } \right\} , } & { { \mathrm { i f ~ } } t - I _ { t } < w } \\ { \varnothing , } & { { \mathrm { o t h e r w i s e } } , } \end{array} \right. }
214
+ $$
215
+
216
+ where, as before, $\mathbf { v } _ { t } , \mathbf { l } _ { t }$ are the agent embeddings of the visual and linguistic observations. Thus, memories are written for $w$ timesteps proceeding a change in the language observation.
217
+
218
+ # A.2 ROLE OF TEMPORAL ASPECT IN GENERALIZATION
219
+
220
+ In seeking to understand the mechanisms that support the generalization effects reported in the main paper, we found that the parameter $k$ was an important factor, where the top- $k$ memories are returned to the agent policy head per memory read. As the agent explores during the discovery phase of episodes, it writes multiple perspectives of the same object to memory. As shown in Figure 8, both its robustness to entirely novel objects (left) and its ability to extend categories from novel exemplars (right), as well as its ability to solve the training task, are enhanced when $k > 1$ ; i.e. when it determines which object to visit in the instruction phase based on memories written from more than one view of each object.
221
+
222
+ # A.3 VERIFICATION IN DEEPMIND LAB
223
+
224
+ At a high level, the design of an episode is very similar to the default fast-mapping task in the Unity environment. The agent must move down a corridor, bumping into (and collecting) three distinct objects. When an agent collects an object it is immediately presented with the (episode-specific) name for that object. After passing three objects, the corridor opens into a room containing two of the three objects found in the corridor. Upon entering the room, the agent is presented with the name corresponding to one of the two objects, and must bump into that object in order to receive a reward of 1. As before, a shaping reward of 0.1 is given as the agent collects each object in the corridor. Compared with the Unity environment, the DeepMind Lab action space is smaller (8 vs. 46 actions), the objects are larger, and the agent has no substantive way to interact with the objects (they disappear the moment the agent collides with them). Note also that the agent must choose between 2 (rather than 3) objects in the instruction phase, so an agent selecting objects at random would achieve $50 \%$ accuracy.
225
+
226
+ To provide some sense of the robustness and generality of the effects observed thus far, we applied the various agent architectures directly to this environment with no environment-specific tuning. As shown in Table 2, without any further tuning of the agent, we observe a similar pattern of results
227
+
228
+ <table><tr><td>Architecture</td><td>Train. accuracy</td><td>Test (novel objects)</td></tr><tr><td>LSTM+R</td><td>0.50 (0.02)</td><td>0.40 (0.06)</td></tr><tr><td>DNC+R</td><td>0.48 (0.04)</td><td>0.30 (0.15)</td></tr><tr><td>TransformerXL mem=100 +R</td><td>0.70 (0.28)</td><td>0.55 (0.29)</td></tr><tr><td>DCEM mem=100 +R</td><td>0.80 (0.26)</td><td>0.65 (0.32)</td></tr><tr><td>Random object selection</td><td>0.5</td><td>0.5</td></tr></table>
229
+
230
+ ![](images/3dabc33fe7af7e71b6d6cad7de051ef5a96683c183459da92f5f0168844f1ff0.jpg)
231
+
232
+ Table 2: Left: Architectures compared on DeepMind Lab after 5e8 timesteps of training. Data show mean accuracy (S.D) across 5 seeds in each condition. mem: the agent’s memory buffer size. $R$ : with reconstruction loss. Right: Schematic of episode structure in the DeepMind Lab fast-binding tasks.
233
+
234
+ in DeepMind Lab as in the Unity room. As in that case, the Transformer and DCEM architectures performed best, with three and two seeds out of five (respectively) mastering the training task. As in the Unity environment, we also observed above-chance ability to apply fast-mapping knowledge zero-shot to unseen objects at test time.
235
+
236
+ # A.4 AGENT ARCHITECTURE DETAILS
237
+
238
+ ![](images/9ba29684988857ffcc3b9a0b622490c61b2197345c7b93168681dafd05ce7034.jpg)
239
+ A.4.1 ARCHITECTURE DIAGRAMS
240
+ Figure 9: Agent architecture. See figure 10 for details of the dual coding episodic memory component. Dashed lines correspond to connections across timesteps.
241
+
242
+ ![](images/7d7ff8dde796bb619cdf61b2322b23ad7a62979550e75dd6bbcd14abde979d31.jpg)
243
+ Figure 10: DCEM architecture. This corresponds to the ‘memory’ component in the agent architecture, Figure 9. NB: the similarity computation and selection of nearest neighbours is replicated for each read head, but not depicted here to avoid clutter. Dashed lines correspond to connections across timesteps.
244
+
245
+ # A.4.2 HYPERPARAMETERS
246
+
247
+ Table 3: Agent hyperparameters (independent of specific architecture). The return cost (not discussed in the main text) is used to weight the baseline estimate term in the $\mathrm { V } .$ -trace loss.
248
+
249
+ <table><tr><td rowspan=1 colspan=1>image width</td><td rowspan=1 colspan=1>96</td></tr><tr><td rowspan=1 colspan=1>image height</td><td rowspan=1 colspan=1>72</td></tr><tr><td rowspan=1 colspan=1>ResNetkernel size</td><td rowspan=1 colspan=1>3×3</td></tr><tr><td rowspan=1 colspan=1>convolutional layers per ResNet block</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>ResNet blocks</td><td rowspan=1 colspan=1>2,2,2</td></tr><tr><td rowspan=1 colspan=1>ResNet strides between blocks</td><td rowspan=1 colspan=1>2,2,2</td></tr><tr><td rowspan=1 colspan=1>ResNetnumberofchannels</td><td rowspan=1 colspan=1>16,32,32</td></tr><tr><td rowspan=1 colspan=1>post-ResNet layer output size (visual embedding)</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>language encoder embedding size</td><td rowspan=1 colspan=1>32</td></tr><tr><td rowspan=1 colspan=1>language encoder self-attention key / query size</td><td rowspan=1 colspan=1>16</td></tr><tr><td rowspan=1 colspan=1>language encoder self-attention value size</td><td rowspan=1 colspan=1>16</td></tr><tr><td rowspan=1 colspan=1>language encoder output size (instruction embedding)</td><td rowspan=1 colspan=1>32</td></tr><tr><td rowspan=1 colspan=1>language decoderhidden size</td><td rowspan=1 colspan=1>32</td></tr><tr><td rowspan=1 colspan=1>numberof memoryread heads</td><td rowspan=1 colspan=1>3</td></tr><tr><td rowspan=1 colspan=1>memory aggregation self-attention key / query size</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>memory aggregation self-attention value size</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>latent representation size</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>core LSTM hidden size</td><td rowspan=1 colspan=1>512</td></tr><tr><td rowspan=1 colspan=1>policy latent size</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>value latent size</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>policy cost</td><td rowspan=1 colspan=1>0.1</td></tr><tr><td rowspan=1 colspan=1>entropy cost</td><td rowspan=1 colspan=1>10-4</td></tr><tr><td rowspan=1 colspan=1>reconstruction cost</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>return cost</td><td rowspan=1 colspan=1>0.5</td></tr><tr><td rowspan=1 colspan=1>discount factor</td><td rowspan=1 colspan=1>0.95</td></tr><tr><td rowspan=1 colspan=1>unroll length</td><td rowspan=1 colspan=1>128</td></tr><tr><td rowspan=1 colspan=1>batch size</td><td rowspan=1 colspan=1>64</td></tr><tr><td rowspan=1 colspan=1>Adam learning rate</td><td rowspan=1 colspan=1>10-4</td></tr><tr><td rowspan=1 colspan=1>Adam β1</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>Adam β2</td><td rowspan=1 colspan=1>0.95</td></tr><tr><td rowspan=1 colspan=1>Adam e</td><td rowspan=1 colspan=1>5×10-8</td></tr></table>
250
+
251
+ # A.4.3 INTRINSIC MOTIVATION ALGORITHM
252
+
253
+ The intrinsic reward is based on the similarity (Euclidean distance) between the new embedding e and the nearest neighbors already present in memory $\{ \mathbf { e } _ { i } \}$ . The average distance $\bar { \rho }$ used below is a lifetime average of all $\rho _ { i }$ that is updated with every computation.
254
+
255
+ $$
256
+ \begin{array} { l } { \displaystyle { \rho _ { i } = \frac { | \mathbf { e } - \mathbf { e } _ { i } | ^ { 2 } } { \bar { \rho } + c } } } \\ { \displaystyle { k _ { i } = \frac { \epsilon } { \operatorname* { m a x } ( \rho _ { i } - \rho _ { \mathrm { m i n } } , 0 ) + \epsilon } } } \\ { \displaystyle { s = \left( \sum _ { i } k _ { i } \right) ^ { 1 / 2 } + c } } \\ { \displaystyle { r _ { \mathrm { N G U } } = \left\{ 1 / s \ N \left. \begin{array} { l l } { 1 / s < s _ { \mathrm { m a x } } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right. \right. } } \end{array}
257
+ $$
258
+
259
+ The computation introduces the constants $c$ , , $\rho _ { \mathrm { m i n } }$ , and $s _ { \mathrm { m a x } }$ , and the number of neighbours $| \{ { \bf e } _ { i } \} |$ used for the similarity estimate. Table 4 lists the values we used.
260
+
261
+ Table 4: Hyperparameters for NGU.
262
+
263
+ <table><tr><td rowspan=1 colspan=1>number of nearest neighbours</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Hei</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>smoothing constant for inverse distance / surprise</td><td rowspan=1 colspan=2>C</td><td rowspan=1 colspan=1>10-3</td></tr><tr><td rowspan=1 colspan=1>similarity kernel smoothing constant</td><td rowspan=1 colspan=2>E</td><td rowspan=1 colspan=1>10-4</td></tr><tr><td rowspan=1 colspan=1>cluster distance cut-off</td><td rowspan=1 colspan=2>pmin</td><td rowspan=1 colspan=1>8×10-3</td></tr><tr><td rowspan=1 colspan=1>maximal similaritycut-off</td><td rowspan=1 colspan=2>Smax</td><td rowspan=1 colspan=1>2.0</td></tr></table>
264
+
265
+ # A.5 ENVIRONMENT DETAILS
266
+
267
+ # A.5.1 UNITY ACTION SPACE
268
+
269
+ The following discrete actions (and strengths) are available to the agent in all experiments except for those in DeepMind Lab. The scalar strengths are translated into force and torque (for rotations) by the environment engine.
270
+
271
+ <table><tr><td>Movement without grip</td><td>Fine grained movements without grip</td><td>Movement with grip</td></tr><tr><td>NOOP,</td><td>MOVE_RIGHT(0.05),</td><td>GRAB,</td></tr><tr><td>MOVE_FORWARD(1),</td><td>MOVE_RIGHT(-0.05),</td><td>GRAB+MOVE_FORWARD(1),</td></tr><tr><td>MOVE_FORWARD(-1),</td><td>LOOK_DOWN(0.03),</td><td>GRAB +MOVE_FORWARD(-1),</td></tr><tr><td>MOVE_RIGHT(1),</td><td>LOOK_DOWN(-0.03),</td><td>GRAB + MOVE_RIGHT(1),</td></tr><tr><td>MOVE_RIGHT(-1),</td><td>LOOK_RIGHT(0.2),</td><td>GRAB + MOVE_RIGHT(-1),</td></tr><tr><td>LOOK_RIGHT(1),</td><td>LOOK_RIGHT(-0.2),</td><td>GRAB + LOOK_RIGHT(1),</td></tr><tr><td>LOOK_RIGHT(-1),</td><td>LOOK_RIGHT(0.05),</td><td>GRAB + LOOK_RIGHT(-1),</td></tr><tr><td>LOOK_DOWN(1),</td><td>LOOK_RIGHT(-0.05),</td><td>GRAB + LOOK_DOWN(1),</td></tr><tr><td>LOOK_DOWN(-1),</td><td></td><td>GRAB + LOOK_DOWN(-1),</td></tr></table>
272
+
273
+ <table><tr><td>Fine grained movments with grip</td><td>Object manipulation</td><td>Fine grained object manipulation</td></tr><tr><td>GRAB + MOVE_RIGHT(0.05),</td><td>GRAB + SPIN_RIGHT(1),</td><td>GRAB + PULL(0.5),</td></tr><tr><td>GRAB + MOVE_RIGHT(-0.05),</td><td>GRAB + SPIN_RIGHT(-1),</td><td>GRAB + PULL(-0.5),</td></tr><tr><td>GRAB +LOOK_DOWN(0.03),</td><td>GRAB + SPIN_UP(1),</td><td>PULL(0.5),</td></tr><tr><td>GRAB + LOOK_DOWN(-0.03),</td><td>GRAB + SPIN_UP(-1),</td><td>PULL(-0.5),</td></tr><tr><td>GRAB + LOOK_RIGHT(0.2),</td><td>GRAB + SPIN_FORWARD(1),</td><td></td></tr><tr><td>GRAB + LOOK_RIGHT(-0.2),</td><td>GRAB + SPIN_FORWARD(-1),</td><td></td></tr><tr><td>GRAB + LOOK_RIGHT(0.05),</td><td>GRAB + PULL(1),</td><td></td></tr><tr><td>GRAB +LOOK_RIGHT(-0.05),</td><td>GRAB + PULL(-1),</td><td></td></tr></table>
274
+
275
+ # A.5.2 SHAPENET
276
+
277
+ ShapeNet contains 3D models of objects with a wide range of complexity and quality. To guarantee that the models are recognizable and of a high quality, we manually filtered the ShapeNet Sem dataset, selecting a subset of everyday semantic classes, ensuring that the selected models had a reasonable number of vertices, and reasonable size and weight dimensions. The selected classes (number of models in each class) were as follows, with a total of 1,437 models across 31 different classes:
278
+
279
+ armoire (31), bag (11), bed (65), book (47), bookcase (13), bottle (26), box (37), bunk bed (9), chair (150), chest of drawers (133), coffee table (43), computer (6), floor lamp (68), glass (11), hammer (15), keyboard (5), lamp (100), loudspeaker (37), microwave (16), monitor (58), mug (12), piano (11), plant (31), printer (22), rug (36), soda can (20), sofa (145), stool (25), table (181), vase (66), wine bottle (7).