ZHANGYUXUAN-zR commited on
Commit
3fcc23b
·
verified ·
1 Parent(s): d70b2b2

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/0oabwyZbOu/0oabwyZbOu.md +341 -0
  2. md/train/B1gabhRcYX/B1gabhRcYX.md +391 -0
  3. md/train/BBIbj9w8Lvj8F/BBIbj9w8Lvj8F.md +198 -0
  4. md/train/BJ8vJebC-/BJ8vJebC-.md +316 -0
  5. md/train/BJC_jUqxe/BJC_jUqxe.md +338 -0
  6. md/train/BkwHObbRZ/BkwHObbRZ.md +0 -0
  7. md/train/Db4yerZTYkz/Db4yerZTYkz.md +244 -0
  8. md/train/FPpZrRfz6Ss/FPpZrRfz6Ss.md +278 -0
  9. md/train/H1g8p1BYvS/H1g8p1BYvS.md +282 -0
  10. md/train/HJMHpjC9Ym/HJMHpjC9Ym.md +402 -0
  11. md/train/HJPmdP9le/HJPmdP9le.md +299 -0
  12. md/train/HJfwJ2A5KX/HJfwJ2A5KX.md +0 -0
  13. md/train/HJr4QJ26W/HJr4QJ26W.md +291 -0
  14. md/train/HJy_5Mcll/HJy_5Mcll.md +213 -0
  15. md/train/HkG3e205K7/HkG3e205K7.md +405 -0
  16. md/train/HkYhZDqxg/HkYhZDqxg.md +314 -0
  17. md/train/HyPpD0g0Z/HyPpD0g0Z.md +518 -0
  18. md/train/KYPz4YsCPj/KYPz4YsCPj.md +537 -0
  19. md/train/MJIve1zgR_/MJIve1zgR_.md +328 -0
  20. md/train/M_lkFOwVdYc/M_lkFOwVdYc.md +260 -0
  21. md/train/MbM_gvIB3Y4/MbM_gvIB3Y4.md +459 -0
  22. md/train/NzTU59SYbNq/NzTU59SYbNq.md +282 -0
  23. md/train/P5MtdcVdFZ4/P5MtdcVdFZ4.md +313 -0
  24. md/train/S1EwLkW0W/S1EwLkW0W.md +593 -0
  25. md/train/SkeK3s0qKQ/SkeK3s0qKQ.md +389 -0
  26. md/train/SnONpXZ_uQ_/SnONpXZ_uQ_.md +215 -0
  27. md/train/SyZipzbCb/SyZipzbCb.md +351 -0
  28. md/train/Syee1pVtDS/Syee1pVtDS.md +0 -0
  29. md/train/SyfIfnC5Ym/SyfIfnC5Ym.md +361 -0
  30. md/train/VzuIzbRDrum/VzuIzbRDrum.md +333 -0
  31. md/train/ZD7Ll4pAw7C/ZD7Ll4pAw7C.md +0 -0
  32. md/train/_0kaDkv3dVf/_0kaDkv3dVf.md +351 -0
  33. md/train/_mQp5cr_iNy/_mQp5cr_iNy.md +423 -0
  34. md/train/kgVJBBThdSZ/kgVJBBThdSZ.md +259 -0
  35. md/train/np96ge7gz0j/np96ge7gz0j.md +488 -0
  36. md/train/r1TA9ZbA-/r1TA9ZbA-.md +345 -0
  37. md/train/r1f78iAcFm/r1f78iAcFm.md +544 -0
  38. md/train/r1ledo0ctX/r1ledo0ctX.md +372 -0
  39. md/train/rk5UYassf/rk5UYassf.md +160 -0
  40. md/train/rk5upnsxe/rk5upnsxe.md +327 -0
  41. md/train/rkTBjG-AZ/rkTBjG-AZ.md +371 -0
  42. md/train/rkesVkHtDr/rkesVkHtDr.md +470 -0
  43. md/train/rkezdaEtvH/rkezdaEtvH.md +617 -0
  44. md/train/ryHlUtqge/ryHlUtqge.md +260 -0
  45. md/train/rygunsAqYQ/rygunsAqYQ.md +0 -0
  46. md/train/sMEpviTLi1h/sMEpviTLi1h.md +0 -0
  47. md/train/uY-XMIbyXec/uY-XMIbyXec.md +295 -0
  48. md/train/vllRjSTWcLs/vllRjSTWcLs.md +316 -0
  49. md/train/yT7-k6Q6gda/yT7-k6Q6gda.md +460 -0
  50. md/train/zQvxc8ul2rR/zQvxc8ul2rR.md +256 -0
md/train/0oabwyZbOu/0oabwyZbOu.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MASTERING ATARI WITH DISCRETE WORLD MODELS
2
+
3
+ Danijar Hafner ∗ Google Research
4
+
5
+ Timothy Lillicrap DeepMind
6
+
7
+ Mohammad Norouzi Google Research
8
+
9
+ Jimmy Ba University of Toronto
10
+
11
+ # ABSTRACT
12
+
13
+ Intelligent agents need to generalize from past experience to achieve goals in complex environments. World models facilitate such generalization and allow learning behaviors from imagined outcomes to increase sample-efficiency. While learning world models from image inputs has recently become feasible for some tasks, modeling Atari games accurately enough to derive successful behaviors has remained an open challenge for many years. We introduce DreamerV2, a reinforcement learning agent that learns behaviors purely from predictions in the compact latent space of a powerful world model. The world model uses discrete representations and is trained separately from the policy. DreamerV2 constitutes the first agent that achieves human-level performance on the Atari benchmark of 55 tasks by learning behaviors inside a separately trained world model. With the same computational budget and wall-clock time, Dreamer V2 reaches 200M frames and surpasses the final performance of the top single-GPU agents IQN and Rainbow. DreamerV2 is also applicable to tasks with continuous actions, where it learns an accurate world model of a complex humanoid robot and solves stand-up and walking from only pixel inputs.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ To successfully operate in unknown environments, reinforcement learning agents need to learn about their environments over time. World models are an explicit way to represent an agent’s knowledge about its environment. Compared to model-free reinforcement learning that learns through trial and error, world models facilitate generalization and can predict the outcomes of potential actions to enable planning (Sutton, 1991). Capturing general aspects of the environment, world models have been shown to be effective for transfer to novel tasks (Byravan et al., 2019), directed exploration (Sekar et al., 2020), and generalization from offline datasets (Yu et al., 2020). When the inputs are high-dimensional images, latent dynamics models predict ahead in an abstract latent space (Watter et al., 2015; Ha and Schmidhuber, 2018; Hafner et al., 2018; Zhang et al., 2019). Predicting compact representations instead of images has been hypothesized to reduce accumulating errors and their small memory footprint enables thousands of parallel predictions on a single GPU (Hafner et al., 2018; 2019). Leveraging this approach, the recent Dreamer agent (Hafner et al., 2019) has solved a wide range of continuous control tasks from image inputs.
18
+
19
+ Despite their intriguing properties, world models have so far not been accurate enough to compete with the stateof-the-art model-free algorithms on the most competitive benchmarks. The well-established Atari benchmark (Bellemare et al., 2013) historically required model-free algorithms to achieve human-level performance, such as DQN (Mnih et al., 2015), A3C (Mnih et al., 2016), or Rainbow (Hessel et al., 2018). Several attempts at learning accurate world models of Atari games have been made, without achieving competitive performance (Oh et al., 2015; Chiappa et al., 2017; Kaiser et al., 2019). On the other hand, the recently proposed MuZero agent (Schrittwieser et al., 2019) shows that planning can achieve impressive performance on board games and deterministic Atari games given extensive engineering effort and a vast computational budget. However, its implementation is not available to the public and it would require over 2 months of computation to train even one agent on a GPU, rendering it impractical for most research groups.
20
+
21
+ ![](images/5f701f096c04ee2c7aeae32384ce0edf4485cc7d50cdc51ba2bb18d7dc904d22.jpg)
22
+ Figure 1: Gamer normalized median score on the Atari benchmark of 55 games with sticky actions at 200M steps. DreamerV2 is the first agent that learns purely within a world model to achieve human-level Atari performance, demonstrating the high accuracy of its learned world model. DreamerV2 further outperforms the top single-GPU agents Rainbow and IQN, whose scores are provided by Dopamine (Castro et al., 2018). According to its authors, SimPLe (Kaiser et al., 2019) was only evaluated on an easier subset of 36 games and trained for fewer steps and additional training does not further increase its performance.
23
+
24
+ In this paper, we introduce DreamerV2, the first reinforcement learning agent that achieves humanlevel performance on the Atari benchmark by learning behaviors purely within a separately trained world model, as shown in Figure 1. Learning successful behaviors purely within the world model demonstrates that the world model learns to accurately represent the environment. To achieve this, we apply small modifications to the Dreamer agent (Hafner et al., 2019), such as using discrete latents and balancing terms within the KL loss. Using a single GPU and a single environment instance, DreamerV2 outperforms top single-GPU Atari agents Rainbow (Hessel et al., 2018) and IQN (Dabney et al., 2018), which rest upon years of model-free reinforcement learning research (Van Hasselt et al., 2015; Schaul et al., 2015; Wang et al., 2016; Bellemare et al., 2017; Fortunato et al., 2017). Moreover, aspects of these algorithms are complementary to our world model and could be integrated into the Dreamer framework in the future. To rigorously compare the algorithms, we report scores normalized by both a human gamer (Mnih et al., 2015) and the human world record (Toromanoff et al., 2019) and make a suggestion for reporting scores going forward.
25
+
26
+ # 2 DREAMERV2
27
+
28
+ We present DreamerV2, an evolution of the Dreamer agent (Hafner et al., 2019). We refer to the original Dreamer agent as DreamerV1 throughout this paper. This section describes the complete DreamerV2 algorithm, consisting of the three typical components of a model-based agent (Sutton, 1991). We learn the world model from a dataset of past experience, learn an actor and critic from imagined sequences of compact model states, and execute the actor in the environment to grow the experience dataset. In Appendix C, we include a list of changes that we applied to DreamerV1 and which of them we found to increase empirical performance.
29
+
30
+ # 2.1 WORLD MODEL LEARNING
31
+
32
+ World models summarize an agent’s experience into a predictive model that can be used in place of the environment to learn behaviors. When inputs are high-dimensional images, it is beneficial to learn compact state representations of the inputs to predict ahead in this learned latent space (Watter et al., 2015; Karl et al., 2016; Ha and Schmidhuber, 2018). These models are called latent dynamics models. Predicting ahead in latent space not only facilitates long-term predictions, it also allows to efficiently predict thousands of compact state sequences in parallel in a single batch, without having to generate images. DreamerV2 builds upon the world model that was introduced by PlaNet (Hafner et al., 2018) and used in DreamerV1, by replacing its Gaussian latents with categorical variables.
33
+
34
+ Experience dataset The world model is trained from the agent’s growing dataset of past experience that contains sequences of images $x _ { 1 : T }$ , actions $a _ { 1 : T }$ , rewards $r _ { 1 : T }$ , and discount factors $\gamma _ { 1 : T }$ . The discount factors equal a fixed hyper parameter $\gamma = 0 . 9 9 9$ for time steps within an episode and are set to zero for terminal time steps. For training, we use batches of $B = 5 0$ sequences of fixed length $L = 5 0$ that are sampled randomly within the stored episodes. To observe enough episode ends during training, we sample the start index of each training sequence uniformly within the episode and then clip it to not exceed the episode length minus the training sequence length.
35
+
36
+ Model components The world model consists of an image encoder, a Recurrent State-Space Model (RSSM; Hafner et al., 2018) to learn the dynamics, and predictors for the image, reward, and discount factor. The world model is summarized in Figure 2. The RSSM uses a sequence of deterministic recurrent states $h _ { t }$ , from which it computes two distributions over stochastic states at each step. The posterior state $z _ { t }$ incorporates information about the current image $x _ { t }$ , while the prior state $\hat { z } _ { t }$ aims to predict the posterior without access to the current image. The concatenation of deterministic and stochastic states forms the compact model state. From the posterior model state, we reconstruct the current image $x _ { t }$ and predict the reward $r _ { t }$ and discount factor $\gamma _ { t }$ . The model components are:
37
+
38
+ ![](images/ec4c3eb25c02808098897026bc569eaa929806513fc94aec9e86a7f3e30285e2.jpg)
39
+ Figure 2: World Model Learning. The training sequence of images $x _ { t }$ is encoded using the CNN. The RSSM uses a sequence of deterministic recurrent states $h _ { t }$ . At each step, it computes a posterior stochastic state $z _ { t }$ that incorporates information about the current image $x _ { t }$ , as well as a prior stochastic state $\hat { z } _ { t }$ that tries to predict the posterior without access to the current image. Unlike in PlaNet and DreamerV1, the stochastic state of DreamerV2 is a vector of multiple categorical variables. The learned prior is used for imagination, as shown in Figure 3. The KL loss both trains the prior and regularizes how much information the posterior incorporates from the image. The regularization increases robustness to novel inputs. It also encourages reusing existing information from past steps to predict rewards and reconstruct images, thus learning long-term dependencies.
40
+
41
+ Recurrent model: $\begin{array} { l } { h _ { t } = f _ { \phi } ( h _ { t - 1 } , z _ { t - 1 } , a _ { t - 1 } ) } \\ { z _ { t } \sim q _ { \phi } ( z _ { t } \mid h _ { t } , x _ { t } ) } \\ { \hat { z } _ { t } \sim p _ { \phi } ( \hat { z } _ { t } \mid h _ { t } ) } \\ { \hat { x } _ { t } \sim p _ { \phi } ( \hat { x } _ { t } \mid h _ { t } , z _ { t } ) } \\ { \hat { r } _ { t } \sim p _ { \phi } ( \hat { r } _ { t } \mid h _ { t } , z _ { t } ) } \\ { \hat { \gamma } _ { t } \sim p _ { \phi } ( \hat { \gamma } _ { t } \mid h _ { t } , z _ { t } ) . } \end{array}$ RSSM Representation model: Transition predictor: Image predictor: Reward predictor: Discount predictor:
42
+
43
+ All components are implemented as neural networks and $\phi$ describes their combined parameter vector. The transition predictor guesses the next model state only from the current model state and the action but without using the next image, so that we can later learn behaviors by predicting sequences of model states without having to observe or generate images. The discount predictor lets us estimate the probability of an episode ending when learning behaviors from model predictions.
44
+
45
+ Neural networks The representation model is implemented as a Convolutional Neural Network (CNN; LeCun et al., 1989) followed by a Multi-Layer Perceptron (MLP) that receives the image embedding and the deterministic recurrent state. The RSSM uses a Gated Recurrent Unit (GRU; Cho et al., 2014) to compute the deterministic recurrent states. The model state is the concatenation of deterministic GRU state and a sample of the stochastic state. The image predictor is a transposed CNN and the transition, reward, and discount predictors are MLPs. We down-scale the $8 4 \times 8 4$ grayscale images to $6 4 \times 6 4$ pixels so that we can apply the convolutional architecture of DreamerV1.
46
+
47
+ <table><tr><td colspan="3">Algorithm 1: Straight-Through Gradients with Automatic Differentiation</td></tr><tr><td>sample = one_hot(draw(logits))</td><td></td><td># sample has no gradient</td></tr><tr><td>probs = softmax(logits)</td><td></td><td> # want gradient of this</td></tr><tr><td>sample = sample + probs - stop_grad(probs)</td><td></td><td>)# has gradient of probs</td></tr></table>
48
+
49
+ We use the ELU activation function for all components of the model (Clevert et al., 2015). The world model uses a total of 20M trainable parameters.
50
+
51
+ Distributions The image predictor outputs the mean of a diagonal Gaussian likelihood with unit variance, the reward predictor outputs a univariate Gaussian with unit variance, and the discount predictor outputs a Bernoulli likelihood. In prior work, the latent variable in the model state was a diagonal Gaussian that used reparameterization gradients during backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). In DreamerV2, we instead use a vector of several categorical variables and optimize them using straight-through gradients (Bengio et al., 2013), which are easy to implement using automatic differentiation as shown in Algorithm 1. We discuss possible benefits of categorical over Gaussian latents in the experiments section.
52
+
53
+ Loss function All components of the world model are optimized jointly. The distributions produced by the image predictor, reward predictor, discount predictor, and transition predictor are trained to maximize the log-likelihood of their corresponding targets. The representation model is trained to produce model states that facilitates these prediction tasks, through the expectation below. Moreover, it is regularized to produce model states with high entropy, such that the model becomes robust to many different model states during training. The loss function for learning the world model is:
54
+
55
+ $$
56
+ \begin{array} { r } { \mathcal { L } ( \phi ) \doteq \mathrm { E } _ { q _ { \phi } ( z _ { 1 : T } \mid a _ { 1 : T } , x _ { 1 : T } ) } \Big [ \sum _ { t = 1 } ^ { T } \underbrace { - \ln p _ { \phi } ( x _ { t } \mid h _ { t } , z _ { t } ) } _ { \mathrm { i n a g e l o g l o s s } } \frac { - \ln p _ { \phi } ( r _ { t } \mid h _ { t } , z _ { t } ) } { \mathrm { r e w a r d l o g l o s s } } \frac { - \ln p _ { \phi } ( \gamma _ { t } \mid h _ { t } , z _ { t } ) } { \mathrm { d i s c o u n t l o g l o s s } } } \\ { \underbrace { + \beta \operatorname { K L } \big [ q _ { \phi } ( z _ { t } \mid h _ { t } , x _ { t } ) \big \rvert \big \lvert p _ { \phi } ( z _ { t } \mid h _ { t } ) \big ] \Big ] } _ { \mathrm { K L I o s s } } . } \end{array}
57
+ $$
58
+
59
+ We jointly minimize the loss function with respect to the vector $\phi$ that contains all parameters of the world model using the Adam optimizer (Kingma and Ba, 2014). We scale the KL loss by $\beta = 0 . 1$ for Atari and by $\beta = 1 . 0$ for continuous control (Higgins et al., 2016).
60
+
61
+ KL balancing The world model loss function in Equation 2 is the ELBO or variational free energy of a hidden Markov model that is conditioned on the action sequence. The world model can thus be interpreted as a sequential VAE, where the representation model is the approximate posterior and the transition predictor is the temporal prior. In the ELBO objective, the KL loss serves two purposes: it trains the prior toward the representations, and it regularizes the representations toward the prior. However, learning the transition function is difficult and we want to avoid regularizing the representations toward a poorly trained prior. To solve this problem, we minimize the KL loss faster with respect to the prior than the representations by using different learning rates, $\alpha = 0 . 8$ for the prior and $1 - \alpha$ for the approximate posterior. We implement this technique as shown in Algorithm 2 and refer to it as KL balancing. KL balancing encourages learning an accurate prior over increasing posterior entropy, so that the prior better approximates the aggregate posterior. KL balancing is different from and orthogonal to beta-VAEs (Higgins et al., 2016).
62
+
63
+ # 2.2 BEHAVIOR LEARNING
64
+
65
+ DreamerV2 learns long-horizon behaviors purely within its world model using an actor and a critic. The actor chooses actions for predicting imagined sequences of compact model states. The critic accumulates the future predicted rewards to take into account rewards beyond the planning horizon. Both the actor and critic operate on top of the learned model states and thus benefit from the representations learned by the world model. The world model is fixed during behavior learning, so the actor and value gradients do not affect its representations. Not predicting images during behavior learning lets us efficiently simulate 2500 latent trajectories in parallel on a single GPU.
66
+
67
+ Imagination MDP To learn behaviors within the latent space of the world model, we define the imagination MPD as follows. The distribution of initial states $\hat { z } _ { 0 }$ in the imagination MDP is the distribution of compact model states encountered during world model training. From there, the transition predictor $\hat { p } _ { \phi } ( \hat { z } _ { t } \mid \hat { z } _ { t - 1 } , \hat { a } _ { t - 1 } )$ outputs sequences $\hat { z } _ { 1 : H }$ of compact model states up to the imagination horizon $H = 1 5$ . The mean of the reward predictor $p _ { \phi } ( \hat { \boldsymbol { r } } _ { t } \mid \hat { \boldsymbol { z } } _ { t } )$ is used as reward sequence $\hat { r } _ { 1 : H }$ . The discount predictor $p _ { \phi } ( \hat { \gamma } _ { t } \mid \hat { z } _ { t } )$ outputs the discount sequence $\hat { \gamma } _ { 1 : H }$ that is used to down-weight rewards. Moreover, we weigh the loss terms of the actor and critic by the cumulative predicted discount factors to softly account for the possibility of episode ends.
68
+
69
+ <table><tr><td colspan="4">Algorithm 2: KL Balancing with Automatic Differentiation</td></tr><tr><td></td><td></td><td></td><td>kl_loss = alpha * compute_kl(stop_grad(approx_posterior), prior)</td></tr><tr><td></td><td></td><td></td><td> + (l - alpha) * compute_kl(approx_posterior, stop_grad(prior))</td></tr></table>
70
+
71
+ ![](images/e6d11abeab0d4119ebf62d594df7d6c73ef556f7ecab9414b852dd4fdd8b4a4e.jpg)
72
+ Figure 3: Actor Critic Learning. The world model learned in Figure 2 is used for learning a policy from trajectories imagined in the compact latent space. The trajectories start from posterior states computed during model training and predict forward by sampling actions from the actor network. The critic network predicts the expected sum of future rewards for each state. The critic uses temporal difference learning on the imagined rewards. The actor is trained to maximize the critic prediction, via reinforce gradients, straight-through gradients of the world model, or a combination of them.
73
+
74
+ Model components To learn long-horizon behaviors in the imagination MDP, we leverage a stochastic actor that chooses actions and a deterministic critic. The actor and critic are trained cooperatively, where the actor aims to output actions that lead to states that maximize the critic output, while the critic aims to accurately estimate the sum of future rewards achieved by the actor from each imagined state. The actor and critic use the parameter vectors $\psi$ and $\xi$ , respectively:
75
+
76
+ $$
77
+ \begin{array} { r l } { \mathrm { A c t o r : } \quad } & { \hat { a } _ { t } \sim p _ { \psi } ( \hat { a } _ { t } \mid \hat { z } _ { t } ) } \\ { \mathrm { C r i t i c : } \quad } & { v _ { \xi } ( \hat { z } _ { t } ) \approx \mathrm { E } _ { p _ { \phi } , p _ { \psi } } \Big [ \sum _ { \tau \geq t } \hat { \gamma } ^ { \tau - t } \hat { r } _ { \tau } \Big ] . } \end{array}
78
+ $$
79
+
80
+ In contrast to the actual environment, the latent state sequence is Markovian, so that there is no need for the actor and critic to condition on more than the current model state. The actor and critic are both MLPs with ELU activations (Clevert et al., 2015) and use 1M trainable parameters each. The actor outputs a categorical distribution over actions and the critic has a deterministic output. The two components are trained from the same imagined trajectories but optimize separate loss functions.
81
+
82
+ Critic loss function The critic aims to predict the discounted sum of future rewards that the actor achieves in a given model state, known as the state value. For this, we leverage temporal-difference learning, where the critic is trained toward a value target that is constructed from intermediate rewards and critic outputs for later states. A common choice is the 1-step target that sums the current reward and the critic output for the following state. However, the imagination MDP lets us generate on-policy trajectories of multiple steps, suggesting the use of n-step targets that incorporate reward information into the critic more quickly. We follow DreamerV1 in using the more general $\lambda$ -target (Sutton and Barto, 2018; Schulman et al., 2015) that is defined recursively as follows:
83
+
84
+ $$
85
+ V _ { t } ^ { \lambda } \doteq \hat { r } _ { t } + \hat { \gamma } _ { t } \left\{ { ( 1 - \lambda ) v _ { \xi } ( \hat { z } _ { t + 1 } ) + \lambda V _ { t + 1 } ^ { \lambda } \quad \mathrm { i f } \quad t < H } , \right. \kern - delimiterspace \chi _ { t } \in \ c U ,
86
+ $$
87
+
88
+ Intuitively, the $\lambda$ -target is a weighted average of n-step returns for different horizons, where longer horizons are weighted exponentially less. We set $\lambda = 0 . 9 5$ in practice, to focus more on long horizon
89
+
90
+ targets than on short horizon targets. Given a trajectory of model states, rewards, and discount factors, we train the critic to regress the $\lambda$ -return using a squared loss:
91
+
92
+ $$
93
+ \begin{array} { r } { \mathcal { L } ( \xi ) \doteq \mathrm { E } _ { p _ { \phi } , p _ { \psi } } \left[ \sum _ { t = 1 } ^ { H - 1 } \frac { 1 } { 2 } \big ( v _ { \xi } \big ( \hat { z } _ { t } \big ) - \mathrm { s g } ( V _ { t } ^ { \lambda } ) \big ) ^ { 2 } \right] . } \end{array}
94
+ $$
95
+
96
+ We optimize the critic loss with respect to the critic parameters $\xi$ using the Adam optimizer. There is no loss term for the last time step because the target equals the critic at that step. We stop the gradients around the targets, denoted by the $\operatorname { s g } ( \cdot )$ function, as typical in the literature. We stabilize value learning using a target network (Mnih et al., 2015), namely, we compute the targets using a copy of the critic that is updated every 100 gradient steps.
97
+
98
+ Actor loss function The actor aims to output actions that maximize the prediction of long-term future rewards made by the critic. To incorporate intermediate rewards more directly, we train the actor to maximize the same $\lambda$ -return that was computed for training the critic. There are different gradient estimators for maximizing the targets with respect to the actor parameters. DreamerV2 combines unbiased but high-variance Reinforce gradients with biased but low-variance straightthrough gradients. Moreover, we regularize the entropy of the actor to encourage exploration where feasible while allowing the actor to choose precise actions when necessary.
99
+
100
+ Learning by Reinforce (Williams, 1992) maximizes the actor’s probability of its own sampled actions weighted by the values of those actions. The variance of this estimator can be reduced by subtracting the state value as baseline, which does not depend on the current action. Intuitively, subtracting the baseline centers the weights and leads to faster learning. The benefit of Reinforce is that it produced unbiased gradients and the downside is that it can have high variance, even with baseline.
101
+
102
+ DreamerV1 relied entirely on reparameterization gradients (Kingma and Welling, 2013; Rezende et al., 2014) to train the actor directly by backpropagating value gradients through the sequence of sampled model states and actions. DreamerV2 uses both discrete latents and discrete actions. To backpropagate through the sampled actions and state sequences, we leverage straight-through gradients (Bengio et al., 2013). This results in a biased gradient estimate with low variance. The combined actor loss function is:
103
+
104
+ $$
105
+ \begin{array} { r } { \mathcal { L } ( \psi ) \doteq \mathrm { E } _ { p _ { \phi } , p _ { \psi } } \left[ \sum _ { t = 1 } ^ { H - 1 } \big ( \underbrace { - \rho \ln p _ { \psi } ( \hat { a } _ { t } \mid \hat { z } _ { t } ) \mathrm { s g } ( V _ { t } ^ { \lambda } - v _ { \xi } ( \hat { z } _ { t } ) ) } _ { \mathrm { r e i n f o r c e } } \underbrace { - ( 1 - \rho ) V _ { t } ^ { \lambda } } _ { \mathrm { d y n a m i c s } } \underbrace { - \eta \mathrm { H } [ a _ { t } | \hat { z } _ { t } ] } _ { \mathrm { e n t r o p y ~ r e g u l a r i z e r } } \big ) \right] . } \end{array}
106
+ $$
107
+
108
+ We optimize the actor loss with respect to the actor parameters $\psi$ using the Adam optimizer. We consider both Reinforce gradients and straight-through gradients, which backpropagate directly through the learned dynamics. Intuitively, the low-variance but biased dynamics backpropagation could learn faster initially and the unbiased but high-variance could to converge to a better solution. For Atari, we find Reinforce gradients to work substantially better and use $\rho = 1$ and $\eta = 1 0 ^ { - 3 }$ . For continuous control, we find dynamics backpropagation to work substantially better and use $\rho = 0$ and $\eta = 1 0 ^ { - 4 }$ . Annealing these hyper parameters can improve performance slightly but to avoid the added complexity we report the scores without annealing.
109
+
110
+ # 3 EXPERIMENTS
111
+
112
+ We evaluate DreamerV2 on the well-established Atari benchmark with sticky actions, comparing to four strong model-free algorithms. DreamerV2 outperforms the four model-free algorithms in all scenarios. For an extensive comparison, we report four scores according to four aggregation protocols and give a recommendation for meaningfully aggregating scores across games going forward. We also ablate the importance of discrete representations in the world model. Our implementation of DreamerV2 reaches 200M environment steps in under 10 days, while using only a single NVIDIA V100 GPU and a single environment instance. During the 200M environment steps, DreamerV2 learns its policy from 468B compact states imagined under the model, which is $1 0 { , } 0 0 0 \times$ more than the 50M inputs received from the real environment after action repeat. Refer to the project website for videos, the source code, and training curves in JSON format.
113
+
114
+ ![](images/fd68526c0da3d5c87d80d6bf999d8e68d9a2978cc0508816fc3de67e0ac059e9.jpg)
115
+ Figure 4: Atari performance over 200M steps. See Table 1 for numeric scores. The standards in the literature to aggregate over tasks are shown in the left two plots. These normalize scores by a professional gamer and compute the median or mean over tasks (Mnih et al., 2015; 2016). In Section 3, we point out limitations of this methodology. As a robust measure of performance, we recommend the metric in the right-most plot. We normalize scores by the human world record (Toromanoff et al., 2019) and then clip them, such that exceeding the record does not further increase the score, before averaging over tasks.
116
+
117
+ Experimental setup We select the 55 games that prior works in the literature from different research labs tend to agree on (Mnih et al., 2016; Brockman et al., 2016; Hessel et al., 2018; Castro et al., 2018; Badia et al., 2020) and recommend this set of games for evaluation going forward. We follow the evaluation protocol of Machado et al. (2018) with 200M environment steps, action repeat of 4, a time limit of 108,000 steps per episode that correspond to 30 minutes of game play, no access to life information, full action space, and sticky actions. Because the world model integrates information over time, DreamerV2 does not use frame stacking. The experiments use a single-task setup where a separate agent is trained for each game. Moreover, each agent uses only a single environment instance. We compare the algorithms based on both human gamer and human world record normalization (Toromanoff et al., 2019).
118
+
119
+ Model-free baselines We compare the learning curves and final scores of DreamerV2 to four model-free algorithms, IQN (Dabney et al., 2018), Rainbow (Hessel et al., 2018), C51 (Bellemare et al., 2017), and DQN (Mnih et al., 2015). We use the scores of these agents provided by the Dopamine framework (Castro et al., 2018) that use sticky actions. These may differ from the reported results in the papers that introduce these algorithms in the deterministic Atari setup. The training time of Rainbow was reported at 10 days on a single GPU and using one environment instance.
120
+
121
+ # 3.1 ATARI PERFORMANCE
122
+
123
+ The performance curves of DreamerV2 and four standard model-free algorithms are visualized in Figure 4. The final scores at 200M environment steps are shown in Table 1 and the scores on individual games are included in Table K1. There are different approaches for aggregating the scores across the 55 games and we show that this choice can have a substantial impact on the relative performance between algorithms. To extensively compare DreamerV2 to the model-free algorithms, we consider the following four aggregation approaches:
124
+
125
+ <table><tr><td>Agent</td><td>Gamer Median</td><td>Gamer Mean</td><td>Record Mean</td><td>Clipped Record Mean</td></tr><tr><td>DreamerV2</td><td>2.15</td><td>42.26</td><td>0.44</td><td>0.28</td></tr><tr><td>DreamerV2 (schedules)</td><td>2.64</td><td>31.71</td><td>0.43</td><td>0.28</td></tr><tr><td>IMPALA</td><td>1.92</td><td>16.72</td><td>0.34</td><td>0.23</td></tr><tr><td>IQN</td><td>1.29</td><td>11.27</td><td>0.21</td><td>0.21</td></tr><tr><td>Rainbow</td><td>1.47</td><td>9.95</td><td>0.17</td><td>0.17</td></tr><tr><td>C51</td><td>1.09</td><td>8.25</td><td>0.15</td><td>0.15</td></tr><tr><td>DQN</td><td>0.65</td><td>3.28</td><td>0.12</td><td>0.12</td></tr></table>
126
+
127
+ Table 1: Atari performance at 200M steps. The scores of the 55 games are aggregated using the four different protocols described in Section 3. To overcome limitations of the previous metrics, we recommend the task mean of clipped record normalized scores as a robust measure of algorithm performance, shown in the right-most column. DreamerV2 outperforms previous single-GPU agents across all metrics. The baseline scores are taken from Dopamine Baselines (Castro et al., 2018).
128
+
129
+ ![](images/6948f199b359db699eeba25553e78c4aa4338c59b83125f354d5ad139cbf37fe.jpg)
130
+ Figure 5: Clipped record normalized scores of various ablations of the DreamerV2 agent. This experiment uses a slightly earlier version of DreamerV2. The score curves for individual tasks are shown in Figure H1. The ablations highlight the benefit of using categorical over Gaussian latent variables and of using KL balancing. Moreover, they show that the world model relies on image gradients for learning its representations. Stopping reward gradients even improves performance on some tasks, suggesting that representations that are not specifically trained to predict previously experienced rewards may generalize better to new situations.
131
+
132
+ • Gamer Median Atari scores are commonly normalized based on a random policy and a professional gamer, averaged over seeds, and the median over tasks is reported (Mnih et al., 2015; 2016). However, if almost half of the scores would be zero, the median would not be affected. Thus, we argue that median scores are not reflective of the robustness of an algorithm and results in wasted computational resources for games that will not affect the score.
133
+
134
+ • Gamer Mean Compared to the task median, the task mean considers all tasks. However, the gamer performed poorly on a small number of games, such as Crazy Climber, James Bond, and Video Pinball. This makes it easy for algorithms to achieve a high normalized score on these few games, which then dominate the task mean so it is not informative of overall performance.
135
+
136
+ • Record Mean Instead of normalizing based on the professional gamer, Toromanoff et al. (2019) suggest to normalize based on the registered human world record of each game. This partially addresses the outlier problem but the mean is still dominated by games where the algorithms easily achieve superhuman performance.
137
+
138
+ • Clipped Record Mean To overcome these limitations, we recommend normalizing by the human world record and then clipping the scores to not exceed a value of 1, so that performance above the record does not further increase the score. The result is a robust measure of algorithm performance on the Atari suite that considers performance across all games.
139
+
140
+ From Figure 4 and Table 1, we see that the different aggregation approaches let us examine agent performance from different angles. Interestingly, Rainbow clearly outperforms IQN in the first aggregation method but IQN clearly outperforms Rainbow in the remaining setups. DreamerV2 outperforms the model-free agents in all four metrics, with the largest margin in record normalized mean performance. Despite this, we recommend clipped record normalized mean as the most meaningful aggregation method, as it considers all tasks to a similar degree without being dominated by a small number of outlier scores. In Table 1, we also include DreamerV2 with schedules that anneal the actor entropy loss scale and actor gradient mixing over the course of training, which further increases the gamer median score of DreamerV2.
141
+
142
+ Individual games The scores on individual Atari games at 200M environment steps are included in Table K1, alongside the model-free algorithms and the baselines of random play, human gamer, and human world record. We filled in reasonable values for the 2 out of 55 games that have no registered world record. Figure E1 compares the score differences between DreamerV2 and each model-free algorithm for the individual games. DreamerV2 achieves comparable or higher performance on most games except for Video Pinball. We hypothesize that the reconstruction loss of the world model does not encourage learning a meaningful latent representation because the most important object in the game, the ball, occupies only a single pixel. One the other hand, DreamerV2 achieves the strongest improvements over the model-free agents on the games James Bond, Up N Down, and Assault.
143
+
144
+ <table><tr><td>Agent</td><td>Gamer Median</td><td>Gamer Mean</td><td>RecordMean</td><td>Clipped Record Mean</td></tr><tr><td>DreamerV2</td><td>1.64</td><td>13.39</td><td>0.36</td><td>0.25</td></tr><tr><td>No Layer Norm</td><td>1.66</td><td>11.29</td><td>0.38</td><td>0.25</td></tr><tr><td>No Reward Gradients</td><td>1.68</td><td>14.29</td><td>0.37</td><td>0.24</td></tr><tr><td>No Discrete Latents</td><td>0.85</td><td>3.96</td><td>0.24</td><td>0.19</td></tr><tr><td>No KL Balancing</td><td>0.87</td><td>4.25</td><td>0.19</td><td>0.16</td></tr><tr><td>No Policy Reinforce</td><td>0.72</td><td>5.10</td><td>0.16</td><td>0.15</td></tr><tr><td>No Image Gradients</td><td>0.05</td><td>0.37</td><td>0.01</td><td>0.01</td></tr></table>
145
+
146
+ Table 2: Ablations to DreamerV2 measured by their Atari performance at 200M frames, sorted by the last column. The this experiment uses a slightly earlier version of DreamerV2 compared to Table 1. Each ablation only removes one part of the DreamerV2 agent. Discrete latent variables and KL balancing substantially contribute to the success of DreamerV2. Moreover, the world model relies on image gradients to learn general representations that lead to successful behaviors, even if the representations are not specifically learned for predicting past rewards.
147
+
148
+ # 3.2 ABLATION STUDY
149
+
150
+ To understand which ingredients of DreamerV2 are responsible for its success, we conduct an extensive ablation study. We compare equipping the world model with categorical latents, as in DreamerV2, to Gaussian latents, as in DreamerV1. Moreover, we study the importance of KL balancing. Finally, we investigate the importance of gradients from image reconstruction and reward prediction for learning the model representations, by stopping one of the two gradient signals before entering the model states. The results of the ablation study are summarized in Figure 5 and Table 2. Refer to the appendix for the score curves of the individual tasks.
151
+
152
+ Categorical latents Categorical latent variables outperform than Gaussian latent variables on 42 tasks, achieve lower performance on 8 tasks, and are tied on 5 tasks. We define a tie as being within $5 \%$ of another. While we do not know the reason why the categorical variables are beneficial, we state several hypotheses that can be investigated in future work:
153
+
154
+ • A categorical prior can perfectly fit the aggregate posterior, because a mixture of categoricals is again a categorical. In contrast, a Gaussian prior cannot match a mixture of Gaussian posteriors, which could make it difficult to predict multi-modal changes between one image and the next.
155
+ • The level of sparsity enforced by a vector of categorical latent variables could be beneficial for generalization. Flattening the sample from the 32 categorical with 32 classes each results in a sparse binary vector of length 1024 with 32 active bits.
156
+ • Despite common intuition, categorical variables may be easier to optimize than Gaussian variables, possibly because the straight-through gradient estimator ignores a term that would otherwise scale the gradient. This could reduce exploding and vanishing gradients.
157
+ • Categorical variables could be a better inductive bias than unimodal continuous latent variables for modeling the non-smooth aspects of Atari games, such as when entering a new room, or when collected items or defeated enemies disappear from the image.
158
+
159
+ KL balancing KL balancing outperforms the standard KL regularizer on 44 tasks, achieves lower performance on 6 tasks, and is tied on 5 tasks. Learning accurate prior dynamics of the world model is critical because it is used for imagining latent state trajectories using policy optimization. By scaling up the prior cross entropy relative to the posterior entropy, the world model is encouraged to minimize the KL by improving its prior dynamics toward the more informed posteriors, as opposed to reducing the KL by increasing the posterior entropy. KL balancing may also be beneficial for probabilistic models with learned priors beyond world models.
160
+
161
+ Model gradients Stopping the image gradients increases performance on 3 tasks, decreases performance on 51 tasks, and is tied on 1 task. The world model of DreamerV2 thus heavily relies on the learning signal provided by the high-dimensional images. Stopping the reward gradients increases performance on 15 tasks, decreases performance on 22 tasks, and is tied on 18 tasks. Figure H1 further shows that the difference in scores is small. In contrast to MuZero, DreamerV2 thus learns general representations of the environment state from image information alone. Stopping reward gradients improved performance on a number of tasks, suggesting that the representations that are not specific to previously experienced rewards may generalize better to unseen situations.
162
+
163
+ <table><tr><td>Algorithm</td><td>Reward Modeling</td><td>Image Modeling</td><td>Latent Transitions</td><td>Single GPU</td><td>Trainable Parameters</td><td>Atari Frames</td><td>Accelerator Days</td></tr><tr><td>DreamerV2</td><td></td><td></td><td></td><td></td><td>22M</td><td>200M</td><td>10</td></tr><tr><td>SimPLe</td><td></td><td></td><td>×</td><td>√</td><td>74M</td><td>4M</td><td>40</td></tr><tr><td>MuZero</td><td></td><td>X</td><td></td><td>×</td><td>40M</td><td>20B</td><td>80</td></tr><tr><td>MuZero Reanalyze</td><td></td><td>×</td><td></td><td>×</td><td>40M</td><td>200M</td><td>80</td></tr></table>
164
+
165
+ Table 3: Conceptual comparison of recent RL algorithms that leverage planning with a learned model. DreamerV2 and SimPLe learn complete models of the environment by leveraging the learning signal provided by the image inputs, while MuZero learns its model through value gradients that are specific to an individual task. The Monte-Carlo tree search used by MuZero is effective but adds complexity and is challenging to parallelize. This component is orthogonal to the world model proposed here.
166
+
167
+ Policy gradients Using only Reinforce gradients to optimize the policy increases performance on 18 tasks, decreases performance on 24 tasks, and is tied on 13 tasks. This shows that DreamerV2 relies mostly on Reinforce gradients to learn the policy. However, mixing Reinforce and straight-through gradients yields a substantial improvement on James Bond and Seaquest, leading to a higher gamer normalized task mean score. Using only straight-through gradients to optimize the policy increases performance on 5 tasks, decreases performance on 44 tasks, and is tied on 6 tasks. We conjecture that straight-through gradients alone are not well suited for policy optimization because of their bias.
168
+
169
+ # 4 RELATED WORK
170
+
171
+ Model-free Atari The majority of agents applied to the Atari benchmark have been trained using model-free algorithms. DQN (Mnih et al., 2015) showed that deep neural network policies can be trained using Q-learning by incorporating experience replay and target networks. Several works have extended DQN to incorporate bias correction as in DDQN (Van Hasselt et al., 2015), prioritized experience replay (Schaul et al., 2015), architectural improvements (Wang et al., 2016), and distributional value learning (Bellemare et al., 2017; Dabney et al., 2017; 2018). Besides value learning, agents based on policy gradients have targeted the Atari benchmark, such as ACER (Schulman et al., 2017a), PPO (Schulman et al., 2017a), ACKTR (Wu et al., 2017), and Reactor (Gruslys et al., 2017). Another line of work has focused on improving performance by distributing data collection, often while increasing the budget of environment steps beyond 200M (Mnih et al., 2016; Schulman et al., 2017b; Horgan et al., 2018; Kapturowski et al., 2018; Badia et al., 2020).
172
+
173
+ World models Several model-based agents focus on proprioceptive inputs (Watter et al., 2015; Gal et al., 2016; Higuera et al., 2018; Henaff et al., 2018; Chua et al., 2018; Wang et al., 2019; Wang and Ba, 2019), model images without using them for planning (Oh et al., 2015; Krishnan et al., 2015; Karl et al., 2016; Chiappa et al., 2017; Babaeizadeh et al., 2017; Gemici et al., 2017; Denton and Fergus, 2018; Buesing et al., 2018; Doerr et al., 2018; Gregor and Besse, 2018), or combine the benefits of model-based and model-free approaches (Kalweit and Boedecker, 2017; Nagabandi et al., 2017; Weber et al., 2017; Kurutach et al., 2018; Buckman et al., 2018; Ha and Schmidhuber, 2018; Wayne et al., 2018; Igl et al., 2018; Srinivas et al., 2018; Lee et al., 2019). Risi and Stanley (2019) optimize discrete latents using evolutionary search. Parmas et al. (2019) combine reinforce and reparameterization gradients. Most world model agents with image inputs have thus far been limited to relatively simple control tasks (Watter et al., 2015; Ebert et al., 2017; Ha and Schmidhuber, 2018; Hafner et al., 2018; Zhang et al., 2019; Hafner et al., 2019). We explain the two model-based approaches that were applied to Atari in detail below.
174
+
175
+ SimPLe The SimPLe agent (Kaiser et al., 2019) learns a video prediction model in pixel-space and uses its predictions to train a PPO agent (Schulman et al., 2017a), as shown in Table 3. The model directly predicts each frame from the previous four frames and receives an additional discrete latent variable as input. The authors evaluate SimPLe on a subset of Atari games for 400k and 2M environment steps, after which they report diminishing returns. Some recent model-free methods have followed the comparison at $4 0 0 \mathrm { k }$ steps (Srinivas et al., 2020; Kostrikov et al., 2020). However, the highest performance achieved in this data-efficient regime is a gamer normalized median score of 0.28 (Kostrikov et al., 2020) that is far from human-level performance. Instead, we focus on the well-established and competitive evaluation after 200M frames, where many successful model-free algorithms are available for comparison.
176
+
177
+ MuZero The MuZero agent (Schrittwieser et al., 2019) learns a sequence model of rewards and values (Oh et al., 2017) to solve reinforcement learning tasks via Monte-Carlo Tree Search (MCTS; Coulom, 2006; Silver et al., 2017). The sequence model is trained purely by predicting task-specific information and does not incorporate explicit representation learning using the images, as shown in Table 3. MuZero shows that with significant engineering effort and a vast computational budget, planning can achieve impressive performance on several board games and deterministic Atari games. However, MuZero is not publicly available, and it would require over 2 months to train an Atari agent on one GPU. By comparison, DreamerV2 is a simple algorithm that achieves human-level performance on Atari on a single GPU in 10 days, making it reproducible for many researchers. Moreover, the advanced planning components of MuZero are complementary and could be applied to the accurate world models learned by DreamerV2. DreamerV2 leverages the additional learning signal provided by the input images, analogous to recent successes by semi-supervised image classification (Chen et al., 2020; He et al., 2020; Grill et al., 2020).
178
+
179
+ # 5 DISCUSSION
180
+
181
+ We present DreamerV2, a model-based agent that achieves human-level performance on the Atari 200M benchmark by learning behaviors purely from the latent-space predictions of a separately trained world model. Using a single GPU and a single environment instance, DreamerV2 outperforms top model-free single-GPU agents Rainbow and IQN using the same computational budget and training time. To develop DreamerV2, we apply several small modifications to the Dreamer agent (Hafner et al., 2019). We confirm experimentally that learning a categorical latent space and using KL balancing improves the performance of the agent. Moreover, we find the DreamerV2 relies on image information for learning generally useful representations — its performance is not impacted by whether the representations are especially learned for predicting rewards.
182
+
183
+ DreamerV2 serves as proof of concept, showing that model-based RL can outperform top model-free algorithms on the most competitive RL benchmarks, despite the years of research and engineering effort that modern model-free agents rest upon. Beyond achieving strong performance on individual tasks, world models open avenues for efficient transfer and multi-task learning, sample-efficient learning on physical robots, and global exploration based on uncertainty estimates.
184
+
185
+ Acknowledgements We thank our anonymous reviewers for their feedback and Nick Rhinehart for an insightful discussion about the potential benefits of categorical latent variables.
186
+
187
+ REFERENCES
188
+ M Babaeizadeh, C Finn, D Erhan, RH Campbell, S Levine. Stochastic Variational Video Prediction. ArXiv Preprint ArXiv:1710.11252, 2017.
189
+ AP Badia, B Piot, S Kapturowski, P Sprechmann, A Vitvitskyi, D Guo, C Blundell. Agent57: Outperforming the Atari Human Benchmark. ArXiv Preprint ArXiv:2003.13350, 2020.
190
+ MG Bellemare, Y Naddaf, J Veness, M Bowling. The Arcade Learning Environment: An Evaluation Platform for General Agents. Journal of Artificial Intelligence Research, 47, 2013.
191
+ MG Bellemare, W Dabney, R Munos. A Distributional Perspective on Reinforcement Learning. ArXiv Preprint ArXiv:1707.06887, 2017.
192
+ Y Bengio, N Léonard, A Courville. Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation. ArXiv Preprint ArXiv:1308.3432, 2013.
193
+ G Brockman, V Cheung, L Pettersson, J Schneider, J Schulman, J Tang, W Zaremba. Openai Gym, 2016.
194
+ J Buckman, D Hafner, G Tucker, E Brevdo, H Lee. Sample-Efficient Reinforcement Learning With Stochastic Ensemble Value Expansion. Advances in Neural Information Processing Systems, 2018.
195
+ L Buesing, T Weber, S Racaniere, S Eslami, D Rezende, DP 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.
196
+ A Byravan, JT Springenberg, A Abdolmaleki, R Hafner, M Neunert, T Lampe, N Siegel, N Heess, M Riedmiller. Imagined Value Gradients: Model-Based Policy Optimization With Transferable Latent Dynamics Models. ArXiv Preprint ArXiv:1910.04142, 2019.
197
+ PS Castro, S Moitra, C Gelada, S Kumar, MG Bellemare. Dopamine: A Research Framework for Deep Reinforcement Learning. ArXiv Preprint ArXiv:1812.06110, 2018.
198
+ T Chen, S Kornblith, M Norouzi, G Hinton. A Simple Framework for Contrastive Learning of Visual Representations. ArXiv Preprint ArXiv:2002.05709, 2020.
199
+ S Chiappa, S Racaniere, D Wierstra, S Mohamed. Recurrent Environment Simulators. ArXiv Preprint ArXiv:1704.02254, 2017.
200
+ K Cho, B Van Merriënboer, C Gulcehre, D Bahdanau, F Bougares, H Schwenk, Y Bengio. Learning Phrase Representations Using Rnn Encoder-Decoder for Statistical Machine Translation. ArXiv Preprint ArXiv:1406.1078, 2014.
201
+ K Chua, R Calandra, R McAllister, S Levine. Deep Reinforcement Learning in a Handful of Trials Using Probabilistic Dynamics Models. Advances in Neural Information Processing Systems, 2018.
202
+ DA Clevert, T Unterthiner, S Hochreiter. Fast and Accurate Deep Network Learning by Exponential Linear Units (Elus). ArXiv Preprint ArXiv:1511.07289, 2015.
203
+ R Coulom. Efficient Selectivity and Backup Operators in Monte-Carlo Tree Search. International Conference on Computers and Games. Springer, 2006.
204
+ W Dabney, M Rowland, MG Bellemare, R Munos. Distributional Reinforcement Learning With Quantile Regression. ArXiv Preprint ArXiv:1710.10044, 2017.
205
+ W Dabney, G Ostrovski, D Silver, R Munos. Implicit Quantile Networks for Distributional Reinforcement Learning. ArXiv Preprint ArXiv:1806.06923, 2018.
206
+ E Denton R Fergus. Stochastic Video Generation With a Learned Prior. ArXiv Preprint ArXiv:1802.07687, 2018.
207
+ A Doerr, C Daniel, M Schiegg, D Nguyen-Tuong, S Schaal, M Toussaint, S Trimpe. Probabilistic Recurrent State-Space Models. ArXiv Preprint ArXiv:1801.10395, 2018.
208
+ F Ebert, C Finn, AX Lee, S Levine. Self-Supervised Visual Planning With Temporal Skip Connections. ArXiv Preprint ArXiv:1710.05268, 2017.
209
+ M Fortunato, MG Azar, B Piot, J Menick, I Osband, A Graves, V Mnih, R Munos, D Hassabis, O Pietquin, et al. Noisy Networks for Exploration. ArXiv Preprint ArXiv:1706.10295, 2017.
210
+ Y Gal, R McAllister, CE Rasmussen. Improving Pilco With Bayesian Neural Network Dynamics Models. Data-Efficient Machine Learning Workshop, ICML, 2016.
211
+ M Gemici, CC Hung, A Santoro, G Wayne, S Mohamed, DJ Rezende, D Amos, T Lillicrap. Generative Temporal Models With Memory. ArXiv Preprint ArXiv:1702.04649, 2017.
212
+ K Gregor F Besse. Temporal Difference Variational Auto-Encoder. ArXiv Preprint ArXiv:1806.03107, 2018.
213
+ JB Grill, F Strub, F Altché, C Tallec, PH Richemond, E Buchatskaya, C Doersch, BA Pires, ZD Guo, MG Azar, et al. Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning. ArXiv Preprint ArXiv:2006.07733, 2020.
214
+ A Gruslys, W Dabney, MG Azar, B Piot, M Bellemare, R Munos. The Reactor: A Fast and SampleEfficient Actor-Critic Agent for Reinforcement Learning. ArXiv Preprint ArXiv:1704.04651, 2017.
215
+ D Ha J Schmidhuber. World Models. ArXiv Preprint ArXiv:1803.10122, 2018.
216
+ D Hafner, T Lillicrap, I Fischer, R Villegas, D Ha, H Lee, J Davidson. Learning Latent Dynamics for Planning From Pixels. ArXiv Preprint ArXiv:1811.04551, 2018.
217
+ D Hafner, T Lillicrap, J Ba, M Norouzi. Dream to Control: Learning Behaviors by Latent Imagination. ArXiv Preprint ArXiv:1912.01603, 2019.
218
+ K He, H Fan, Y Wu, S Xie, R Girshick. Momentum Contrast for Unsupervised Visual Representation Learning. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
219
+ M Henaff, WF Whitney, Y LeCun. Model-Based Planning With Discrete and Continuous Actions. ArXiv Preprint ArXiv:1705.07177, 2018.
220
+ M Hessel, J Modayil, H Van Hasselt, T Schaul, G Ostrovski, W Dabney, D Horgan, B Piot, M Azar, D Silver. Rainbow: Combining Improvements in Deep Reinforcement Learning. Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
221
+ I Higgins, L Matthey, A Pal, C Burgess, X Glorot, M Botvinick, S Mohamed, A Lerchner. BetaVae: Learning Basic Visual Concepts With a Constrained Variational Framework. International Conference on Learning Representations, 2016.
222
+ JCG Higuera, D Meger, G Dudek. Synthesizing Neural Network Controllers With Probabilistic Model Based Reinforcement Learning. ArXiv Preprint ArXiv:1803.02291, 2018.
223
+ D Horgan, J Quan, D Budden, G Barth-Maron, M Hessel, H Van Hasselt, D Silver. Distributed Prioritized Experience Replay. ArXiv Preprint ArXiv:1803.00933, 2018.
224
+ M Igl, L Zintgraf, TA Le, F Wood, S Whiteson. Deep Variational Reinforcement Learning for Pomdps. ArXiv Preprint ArXiv:1806.02426, 2018.
225
+ L Kaiser, M Babaeizadeh, P Milos, B Osinski, RH Campbell, K Czechowski, D Erhan, C Finn, P Kozakowski, S Levine, et al. Model-Based Reinforcement Learning for Atari. ArXiv Preprint ArXiv:1903.00374, 2019.
226
+ G Kalweit J Boedecker. Uncertainty-Driven Imagination for Continuous Deep Reinforcement Learning. Conference on Robot Learning, 2017.
227
+ S Kapturowski, G Ostrovski, J Quan, R Munos, W Dabney. Recurrent Experience Replay in Distributed Reinforcement Learning. International Conference on Learning Representations, 2018.
228
+ M Karl, M Soelch, J Bayer, P van der Smagt. Deep Variational Bayes Filters: Unsupervised Learning of State Space Models From Raw Data. ArXiv Preprint ArXiv:1605.06432, 2016.
229
+ DP Kingma J Ba. Adam: A Method for Stochastic Optimization. ArXiv Preprint ArXiv:1412.6980, 2014.
230
+ DP Kingma M Welling. Auto-Encoding Variational Bayes. ArXiv Preprint ArXiv:1312.6114, 2013.
231
+ I Kostrikov, D Yarats, R Fergus. Image Augmentation Is All You Need: Regularizing Deep Reinforcement Learning From Pixels. ArXiv Preprint ArXiv:2004.13649, 2020.
232
+ RG Krishnan, U Shalit, D Sontag. Deep Kalman Filters. ArXiv Preprint ArXiv:1511.05121, 2015.
233
+ T Kurutach, I Clavera, Y Duan, A Tamar, P Abbeel. Model-Ensemble Trust-Region Policy Optimization. ArXiv Preprint ArXiv:1802.10592, 2018.
234
+ Y LeCun, B Boser, JS Denker, D Henderson, RE Howard, W Hubbard, LD Jackel. Backpropagation Applied to Handwritten Zip Code Recognition. Neural Computation, 1(4), 1989.
235
+ AX Lee, A Nagabandi, P Abbeel, S Levine. Stochastic Latent Actor-Critic: Deep Reinforcement Learning With a Latent Variable Model. ArXiv Preprint ArXiv:1907.00953, 2019.
236
+ MC Machado, MG Bellemare, E Talvitie, J Veness, M Hausknecht, M Bowling. Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents. Journal of Artificial Intelligence Research, 61, 2018.
237
+ V Mnih, K Kavukcuoglu, D Silver, AA Rusu, J Veness, MG Bellemare, A Graves, M Riedmiller, AK Fidjeland, G Ostrovski, et al. Human-Level Control Through Deep Reinforcement Learning. Nature, 518(7540), 2015.
238
+ V Mnih, AP Badia, M Mirza, A Graves, T Lillicrap, T Harley, D Silver, K Kavukcuoglu. Asynchronous Methods for Deep Reinforcement Learning. International Conference on Machine Learning, 2016.
239
+ A Nagabandi, G Kahn, RS Fearing, S Levine. Neural Network Dynamics for Model-Based Deep Reinforcement Learning With Model-Free Fine-Tuning. ArXiv Preprint ArXiv:1708.02596, 2017.
240
+ J Oh, X Guo, H Lee, RL Lewis, S Singh. Action-Conditional Video Prediction Using Deep Networks in Atari Games. Advances in Neural Information Processing Systems, 2015.
241
+ J Oh, S Singh, H Lee. Value Prediction Network. Advances in Neural Information Processing Systems, 2017.
242
+ P Parmas, CE Rasmussen, J Peters, K Doya. Pipps: Flexible Model-Based Policy Search Robust to the Curse of Chaos. ArXiv Preprint ArXiv:1902.01240, 2019.
243
+ D Pathak, P Agrawal, AA Efros, T Darrell. Curiosity-Driven Exploration by Self-Supervised Prediction. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, 2017.
244
+ DJ Rezende, S Mohamed, D Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. ArXiv Preprint ArXiv:1401.4082, 2014.
245
+ S Risi KO Stanley. Deep Neuroevolution of Recurrent and Discrete World Models. Proceedings of the Genetic and Evolutionary Computation Conference, 2019.
246
+ T Schaul, J Quan, I Antonoglou, D Silver. Prioritized Experience Replay. ArXiv Preprint ArXiv:1511.05952, 2015.
247
+ J Schrittwieser, I Antonoglou, T Hubert, K Simonyan, L Sifre, S Schmitt, A Guez, E Lockhart, D Hassabis, T Graepel, et al. Mastering Atari, Go, Chess and Shogi by Planning With a Learned Model. ArXiv Preprint ArXiv:1911.08265, 2019.
248
+ J Schulman, P Moritz, S Levine, M Jordan, P Abbeel. High-Dimensional Continuous Control Using Generalized Advantage Estimation. ArXiv Preprint ArXiv:1506.02438, 2015.
249
+ J Schulman, F Wolski, P Dhariwal, A Radford, O Klimov. Proximal Policy Optimization Algorithms. ArXiv Preprint ArXiv:1707.06347, 2017a.
250
+ J Schulman, F Wolski, P Dhariwal, A Radford, O Klimov. Proximal Policy Optimization Algorithms. ArXiv Preprint ArXiv:1707.06347, 2017b.
251
+ R Sekar, O Rybkin, K Daniilidis, P Abbeel, D Hafner, D Pathak. Planning to Explore via SelfSupervised World Models. ArXiv Preprint ArXiv:2005.05960, 2020.
252
+ D Silver, J Schrittwieser, K Simonyan, I Antonoglou, A Huang, A Guez, T Hubert, L Baker, M Lai, A Bolton, et al. Mastering the Game of Go Without Human Knowledge. Nature, 550(7676), 2017.
253
+ A Srinivas, A Jabri, P Abbeel, S Levine, C Finn. Universal Planning Networks. ArXiv Preprint ArXiv:1804.00645, 2018.
254
+ A Srinivas, M Laskin, P Abbeel. Curl: Contrastive Unsupervised Representations for Reinforcement Learning. ArXiv Preprint ArXiv:2004.04136, 2020.
255
+ RS Sutton. Dyna, an Integrated Architecture for Learning, Planning, and Reacting. ACM SIGART Bulletin, 2(4), 1991.
256
+ RS Sutton AG Barto. Reinforcement Learning: An Introduction. MIT press, 2018.
257
+ AA Taiga, W Fedus, MC Machado, A Courville, MG Bellemare. On Bonus Based Exploration Methods in the Arcade Learning Environment. International Conference on Learning Representations, 2019.
258
+ M Toromanoff, E Wirbel, F Moutarde. Is Deep Reinforcement Learning Really Superhuman on Atari? Leveling the Playing Field. ArXiv Preprint ArXiv:1908.04683, 2019.
259
+ H Van Hasselt, A Guez, D Silver. Deep Reinforcement Learning With Double Q-Learning. ArXiv Preprint ArXiv:1509.06461, 2015.
260
+ T Wang J Ba. Exploring Model-Based Planning With Policy Networks. ArXiv Preprint ArXiv:1906.08649, 2019.
261
+ T Wang, X Bao, I Clavera, J Hoang, Y Wen, E Langlois, S Zhang, G Zhang, P Abbeel, J Ba. Benchmarking Model-Based Reinforcement Learning. CoRR, abs/1907.02057, 2019.
262
+ Z Wang, T Schaul, M Hessel, H Hasselt, M Lanctot, N Freitas. Dueling Network Architectures for Deep Reinforcement Learning. International Conference on Machine Learning, 2016.
263
+ M Watter, J Springenberg, J Boedecker, M Riedmiller. Embed to Control: A Locally Linear Latent Dynamics Model for Control From Raw Images. Advances in Neural Information Processing Systems, 2015.
264
+ G Wayne, CC Hung, D Amos, M Mirza, A Ahuja, A Grabska-Barwinska, J Rae, P Mirowski, JZ Leibo, A Santoro, et al. Unsupervised Predictive Memory in a Goal-Directed Agent. ArXiv Preprint ArXiv:1803.10760, 2018.
265
+ T Weber, S Racanière, DP Reichert, L Buesing, A Guez, DJ Rezende, AP Badia, O Vinyals, N Heess, Y Li, et al. Imagination-Augmented Agents for Deep Reinforcement Learning. ArXiv Preprint ArXiv:1707.06203, 2017.
266
+ RJ Williams. Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning. Machine Learning, 8(3-4), 1992.
267
+ Y Wu, E Mansimov, RB Grosse, S Liao, J Ba. Scalable Trust-Region Method for Deep Reinforcement Learning Using Kronecker-Factored Approximation. Advances in Neural Information Processing Systems, 2017.
268
+ T Yu, G Thomas, L Yu, S Ermon, J Zou, S Levine, C Finn, T Ma. Mopo: Model-Based Offline Policy Optimization. ArXiv Preprint ArXiv:2005.13239, 2020.
269
+ M Zhang, S Vikram, L Smith, P Abbeel, M Johnson, S Levine. Solar: Deep Structured Representations for Model-Based Reinforcement Learning. International Conference on Machine Learning, 2019.
270
+
271
+ # A HUMANOID FROM PIXELS
272
+
273
+ ![](images/bc32d1cbcd0659936feccbe1b4b19ff3bdb8dc7b88387c80e5a755a3f2a1fc15.jpg)
274
+ Figure A1: Behavior learned by DreamerV2 on the Humanoid Walk task from pixel inputs only. The task is provided by the DeepMind Control Suite and uses a continuous action space with 21 dimensions. The frames show the agent inputs.
275
+
276
+ While the main experiments of this paper focus on the Atari benchmark with discrete actions, DreamerV2 is also applicable to control tasks with continuous actions. For this, we the actor outputs a truncated normal distribution instead of a categorical distribution. To demonstrate the abilities of DreamerV2 for continuous control, we choose the challenging humanoid environment with only image inputs, shown in Figure A1. We find that for continuous control tasks, dynamics backpropagation substantially outperforms reinforce gradients and thus set $\rho = 0$ . We also set $\eta = 1 0 ^ { - 5 }$ and $\beta = 2$ and leave all other hyper parameters at their defaults. We find that DreamerV2 reliably solves both the stand-up motion required at the beginning of the episode and the subsequent walking. The score is shown in Figure A2. To the best of our knowledge, this constitutes the first published result of solving the humanoid environment from only pixel inputs.
277
+
278
+ ![](images/0bf2ee3035c8920e73f8c5b324d734387450736fe0a5b877d68595407b21dc56.jpg)
279
+ Figure A2: Performance on the humanoid walking task from only pixel inputs.
280
+
281
+ # B MONTEZUMA’S REVENGE
282
+
283
+ ![](images/e6a13f2e99bee24ebd28c60df77a96ac2c6cf01412caa499f882c669a39921d6.jpg)
284
+ Figure B1: Behavior learned by DreamerV2 on the Atari game Montezuma’s Revenge, that poses a hard exploration challenge. Without any explicit exploration mechanism, DreamerV2 reaches about the same performance as the exploration method ICM.
285
+
286
+ While our main experiments use the same hyper parameters across all tasks, we find that DreamerV2 achieves higher performance on Montezuma’s Revenge by using a lower discount factor of $\gamma = 0 . 9 9$ , possibly to stabilize value learning under sparse rewards. Figure B2 shows the resulting performance, with all other hyper parameters left at their defaults. DreamerV2 outperforms existing modelfree approaches on the hard-exploration game Montezuma’s Revenge and matches the performance of the explicit exploration algorithm ICM (Pathak et al., 2017) that was applied on top of Rainbow by Taiga et al. (2019). This suggests that the world model may help with solving sparse reward tasks, for example due to improved generalization, efficient policy optimization in the compact latent space enabling more actor critic updates, or because the reward predictor generalizes and thus smooths out the sparse rewards.
287
+
288
+ ![](images/05f3223a1030ab1e287d71467d39db47d9ec8b8c2405d903daa77293d658f380.jpg)
289
+ Figure B2: Performance on the Atari game Montezuma’s Revenge.
290
+
291
+ # C SUMMARY OF MODIFICATIONS
292
+
293
+ To develop DreamerV2, we used the Dreamer agent (Hafner et al., 2019) as a starting point. This subsection describes the changes that we applied to the agent to achieve high performance on the Atari benchmark, as well as the changes that were tried but not found to increase performance and thus were not not included in DreamerV2.
294
+
295
+ Summary of changes that were tried and were found to help:
296
+
297
+ • Categorical latents Using categorical latent states using straight-through gradients in the world model instead of Gaussian latents with reparameterized gradients. • KL balancing Separately scaling the prior cross entropy and the posterior entropy in the KL loss to encourage learning an accurate temporal prior, instead of using free nats. • Reinforce only Reinforce gradients worked substantially better for Atari than dynamics backpropagation. For continuous control, dynamics backpropagation worked substantially better. • Model size Increasing the number of units or feature maps per layer of all model components, resulting in a change from 13M parameters to 22M parameters. • Policy entropy Regularizing the policy entropy for exploration both in imagination and during data collection, instead of using external action noise during data collection.
298
+
299
+ Summary of changes that were tried but were found to not help substantially:
300
+
301
+ • Binary latents Using a larger number of binary latents for the world model instead of categorical latents, which could have encouraged a more disentangled representation, was worse. • Long-term entropy Including the policy entropy into temporal-difference loss of the value function, so that the actor seeks out states with high action entropy beyond the planning horizon. • Mixed actor gradients Combining Reinforce and dynamics backpropagation gradients for learning the actor instead of Reinforce provided marginal or no benefits. • Scheduling Scheduling the learning rates, KL scale, actor entropy loss scale, and actor gradient mixing (from 0.1 to 0) provided marginal or no benefits. • Layer norm Using layer normalization in the GRU that is used as part of the RSSM latent transition model, instead of no normalization, provided no or marginal benefits.
302
+
303
+ Due to the large computational requirements, a comprehensive ablation study on this list of all changes is unfortunately infeasible for us. This would require 55 tasks times 5 seeds for 10 days per change to run, resulting in over 60,000 GPU hours per change. However, we include ablations for the most important design choices in the main text of the paper.
304
+
305
+ # D HYPER PARAMETERS
306
+
307
+ <table><tr><td>Name</td><td>Symbol</td><td>Value</td></tr><tr><td>World Model</td><td></td><td></td></tr><tr><td>Dataset size (FIFO)</td><td></td><td>2·106</td></tr><tr><td>Batch size</td><td>B</td><td>50</td></tr><tr><td>Sequence length</td><td>L</td><td>50</td></tr><tr><td>Discrete latent dimensions</td><td>一</td><td>32</td></tr><tr><td>Discrete latent classes</td><td></td><td>32</td></tr><tr><td>RSSM number of units</td><td></td><td>600</td></tr><tr><td>KL loss scale</td><td>β</td><td>0.1</td></tr><tr><td>KL balancing</td><td>α</td><td>0.8</td></tr><tr><td>World model learning rate</td><td></td><td>2·10-4</td></tr><tr><td>Reward transformation</td><td></td><td>tanh</td></tr><tr><td>Behavior</td><td></td><td></td></tr><tr><td>Imagination horizon</td><td>H</td><td>15</td></tr><tr><td>Discount</td><td>Y</td><td>0.995</td></tr><tr><td>X-target parameter</td><td>入</td><td>0.95</td></tr><tr><td>Actor gradient mixing</td><td>p</td><td>1</td></tr><tr><td>Actor entropy loss scale</td><td>m</td><td>1.10-3</td></tr><tr><td>Actor learning rate</td><td>一</td><td>4·10-5</td></tr><tr><td>Critic learning rate</td><td></td><td>1·10-4</td></tr><tr><td>Slow critic update interval</td><td></td><td>100</td></tr><tr><td>Common</td><td></td><td></td></tr><tr><td>Environment steps per update</td><td></td><td>4</td></tr><tr><td>MPL number of layers</td><td></td><td>4</td></tr><tr><td>MPL number of units</td><td></td><td>400</td></tr><tr><td>Gradient clipping</td><td></td><td>100</td></tr><tr><td>Adam epsilon</td><td>E</td><td>10-5</td></tr><tr><td>Weight decay (decoupled)</td><td></td><td>10-6</td></tr></table>
308
+
309
+ Table D1: Atari hyper parameters of DreamerV2. When tuning the agent for a new task, we recommend searching over the KL loss scale $\beta \in \{ 0 . 1 , 0 . 3 , 1 , 3 \bar { \} }$ , actor entropy loss scale $\eta \in$ $\{ 3 \cdot 1 0 ^ { - 5 } , 1 0 ^ { - 4 } , 3 \cdot 1 \bar { 0 } ^ { - 4 } , 1 0 ^ { - 3 } \}$ , and the discount factor $\gamma \in \{ 0 . 9 9 , 0 . 9 9 9 \}$ . The training frequency update should be increased when aiming for higher data-efficiency.
310
+
311
+ # E AGENT COMPARISON
312
+
313
+ ![](images/fc3b8c73568e1a7b086627d9746bcee5500174bcddb9315ffd7b96af68036171.jpg)
314
+ Figure E1: Atari agent comparison. The bars show the difference in gamer normalized scores at 200M steps. DreamerV2 outperforms the four model-free algorithms IQN, Rainbow, C51, and DQN while learning behaviors purely by planning within a separately learned world model. DreamerV2 achieves higher or similar performance on all tasks besides Video Pinball, where we hypothesize that the reconstruction loss does not focus on the ball that makes up only one pixel on the screen.
315
+
316
+ # F MODEL-FREE COMPARISON
317
+
318
+ ![](images/e679a24243b7da6f2e951a41ebdcb9aafeb1469e13576d463b51e9680d103e47.jpg)
319
+ Figure F1: Comparison of DreamerV2 to the top model-free RL methods IQN and Rainbow. The DreamerV2 IQN Rainbow curves show mean and standard deviation over 5 seeds. IQN and Rainbow additionally average each point over 10 evaluation episodes, explaining the smoother curves. DreamerV2 outperforms IQN and Rainbow in all four aggregated scores. While IQN and Rainbow tend to succeed on the same tasks, DreamerV2 shows a different performance profile.
320
+
321
+ ![](images/eed0b0ae6d2b45de124cd919bfef252716709e661c978099fe2cf5ce203c65cc.jpg)
322
+ DreamerV2 Gaussian Latents No KL Balance Figure G1: Comparison of DreamerV2, Gaussian instead of categorical latent variables, and no KL balancing. The ablation experiments use a slightly earlier version of the agent. The curves show mean and standard deviation across two seeds. Categorical latent variables and KL balancing both substantially improve performance across many of the tasks. The importance of the two techniques is reflected in all four aggregated scores.
323
+
324
+ # H REPRESENTATION LEARNING ABLATIONS
325
+
326
+ ![](images/1716341150b25e3d0b368c8a1ec95ad4758b7b94ed3d6e5eb9dcaad4fd794463.jpg)
327
+ DreamerV2 No Reward Gradients No Image Gradients Figure H1: Comparison of leveraging image prediction, reward prediction, or both for learning the model representations. While image gradients are crucial, reward gradients are not necessary for our world model to succeed and their gradients can be stopped. Representations learned purely from images are not biased toward previously encountered rewards and outperform reward-specific representations on a number of tasks, suggesting that they may generalize better to unseen situations.
328
+
329
+ # I POLICY LEARNING ABLATIONS
330
+
331
+ ![](images/41c9359f8f79627244b10d8837e0be1ccb1dad738025504462e1b0551c1d0e9e.jpg)
332
+ Figure I1: Comparison of leveraging Reinforce gradients, straight-through gradients, or both forDreamerV2 No Straight-Through No Reinforce training the actor. While Reinforce gradients are crucial, straight-through gradients are not important for most of the tasks. Nonetheless, combining both gradients yields substantial improvements on a small number of games, most notably on Seaquest. We conjecture that straight-through gradients have low variance and thus help the agent start learning, whereas Reinforce gradients are unbiased and help converging to a better solution.
333
+
334
+ ![](images/2570f9ee70cd656d96643d86b22e1451b02016d20928abc622b191d46f2bf382.jpg)
335
+ DreamerV2 No Layer Norm Random DataFigure J1: Comparison of DreamerV2 to a version without layer norm in the GRU and to training from experience collected over time by a uniform random policy. We find that the benefit of layer norm depends on the task at hand, increasing and decreasing performance on a roughly equal number of tasks. The comparison to random data collection highlights which of the tasks require non-trivial exploration, which can help guide future work on directed exploration using world models.
336
+
337
+ K ATARI TASK SCORES
338
+
339
+ <table><tr><td rowspan="2"></td><td colspan="3">Baselines</td><td colspan="3"></td></tr><tr><td>Random</td><td>Gamer</td><td>Record</td><td>Rainbow</td><td>Algorithms IQN</td><td>DreamerV2</td></tr><tr><td>Task</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Alien</td><td>229 6</td><td>7128 1720</td><td>251916 104159</td><td>3457 2529</td><td>4961 2393</td><td>3967 2577</td></tr><tr><td>Amidar</td><td></td><td></td><td></td><td>3229</td><td>4885</td><td>23625</td></tr><tr><td>Assault</td><td>222</td><td>742</td><td>8647</td><td></td><td></td><td></td></tr><tr><td>Asterix</td><td>210</td><td>8503</td><td>1000000</td><td>18367</td><td>10374</td><td>72311</td></tr><tr><td>Asteroids</td><td>719</td><td>47389 29028</td><td>10506650</td><td>1484</td><td>1585 890214</td><td>41526</td></tr><tr><td>Atlantis Bank Heist</td><td>12850</td><td>753</td><td>10604840 82058</td><td>802548 1075</td><td>1052</td><td>978778</td></tr><tr><td>Battle Zone</td><td>14</td><td>37188</td><td>801000</td><td></td><td>40953</td><td>1126</td></tr><tr><td>Beam Rider</td><td>2360 364</td><td>16926</td><td>999999</td><td>40061</td><td>7130</td><td>40325 18646</td></tr><tr><td>Berzerk</td><td></td><td>2630</td><td>1057940</td><td>6290</td><td>648</td><td></td></tr><tr><td>Bowling</td><td>124</td><td>161</td><td></td><td>833 43</td><td>39</td><td>810</td></tr><tr><td>Boxing</td><td>23</td><td>12</td><td>300</td><td>99</td><td></td><td>49</td></tr><tr><td>Breakout</td><td>0</td><td>30</td><td>100 864</td><td>120</td><td>98 79</td><td>92</td></tr><tr><td>Centipede</td><td>2</td><td>12017</td><td>1301709</td><td>6510</td><td>3728</td><td>312</td></tr><tr><td></td><td>2091</td><td>7388</td><td>999999</td><td>12338</td><td>9282</td><td>11883</td></tr><tr><td>Chopper Command</td><td>811</td><td>35829</td><td>219900</td><td>145389</td><td>132738</td><td>2861 161839</td></tr><tr><td>Crazy Climber Demon Attack</td><td>10780</td><td>1971</td><td>1556345</td><td>17071</td><td>15350</td><td>82263</td></tr><tr><td>Double Dunk</td><td>152</td><td>-16</td><td>22</td><td>22</td><td>21</td><td>17</td></tr><tr><td>Enduro</td><td>-19 0</td><td>860</td><td>9500</td><td>2200</td><td>2203</td><td>1656</td></tr><tr><td>Fishing Derby</td><td>-92</td><td>-39</td><td>71</td><td>42</td><td>45</td><td>65</td></tr><tr><td>Freeway</td><td>0</td><td>30</td><td>38</td><td>34</td><td>34</td><td>33</td></tr><tr><td>Frostbite</td><td>65</td><td>4335</td><td>454830</td><td>8208</td><td>7812</td><td>11384</td></tr><tr><td>Gopher</td><td>258</td><td>2412</td><td>355040</td><td>10641</td><td>12108</td><td>92282</td></tr><tr><td>Gravitar</td><td>173</td><td>3351</td><td>162850</td><td>1272</td><td>1347</td><td>3789</td></tr><tr><td>Hero</td><td>1027</td><td>30826</td><td>1000000</td><td>46675</td><td>36058</td><td>21868</td></tr><tr><td>Ice Hockey</td><td>-11</td><td></td><td>36</td><td>0</td><td>-5</td><td>26</td></tr><tr><td>James Bond</td><td>7</td><td>29</td><td>45550</td><td>1097</td><td>3166</td><td>40445</td></tr><tr><td>Kangaroo</td><td>52</td><td>3035</td><td>1424600</td><td>12748</td><td>12602</td><td>14064</td></tr><tr><td>Krull</td><td>1598</td><td>2666</td><td>104100</td><td>4066</td><td>8844</td><td>50061</td></tr><tr><td>Kung Fu Master</td><td>258</td><td>22736</td><td>1000000</td><td>26475</td><td>31653</td><td>62741</td></tr><tr><td>Montezuma Revenge</td><td>0</td><td>4753</td><td>1219200</td><td>500</td><td>500</td><td>81</td></tr><tr><td>Ms Pacman</td><td>307</td><td>6952</td><td>290090</td><td>3861</td><td>5218</td><td>5652</td></tr><tr><td>Name This Game</td><td>2292</td><td>8049</td><td>25220</td><td>9026</td><td>6639</td><td>14649</td></tr><tr><td>Phoenix</td><td>761</td><td>7243</td><td>4014440</td><td>8545</td><td>5102</td><td>49375</td></tr><tr><td>Pitfall</td><td>-229</td><td>6464</td><td>114000</td><td>-20</td><td>-13</td><td>0</td></tr><tr><td>Pong</td><td>-21</td><td>15</td><td>21</td><td>20</td><td>20</td><td>20</td></tr><tr><td>Private Eye</td><td>25</td><td>69571</td><td>101800</td><td>21334</td><td>4181</td><td>2198</td></tr><tr><td>Qbert</td><td>164</td><td>13455</td><td>2400000</td><td>17383</td><td>16730</td><td>94688</td></tr><tr><td>Riverraid</td><td>1338</td><td>17118</td><td>1000000</td><td>20756</td><td>15183</td><td>16351</td></tr><tr><td>Road Runner</td><td></td><td>7845</td><td>2038100</td><td>54662</td><td>58966</td><td>203576</td></tr><tr><td>Robotank</td><td>12</td><td></td><td>76</td><td></td><td>66</td><td>78</td></tr><tr><td>Seaquest</td><td>2 68</td><td>12 42055</td><td></td><td>66 9903</td><td>17039</td><td>7480</td></tr><tr><td>Skiing</td><td>-17098</td><td>-4337</td><td>999999 -3272</td><td>-28708</td><td>-11162</td><td>-9299</td></tr><tr><td>Solaris</td><td>1236</td><td></td><td></td><td></td><td>1684</td><td>922</td></tr><tr><td></td><td></td><td>12327</td><td>111420</td><td>1583</td><td></td><td></td></tr><tr><td>Space Invaders</td><td>148</td><td>1669</td><td>621535</td><td>4131</td><td>4530</td><td>2474</td></tr><tr><td>Star Gunner</td><td>664</td><td>10250</td><td>77400</td><td>57909</td><td>80003</td><td>7800</td></tr><tr><td>Tennis</td><td>-24</td><td>-8</td><td>21</td><td>0</td><td>23</td><td>14</td></tr><tr><td>Time Pilot</td><td>3568</td><td>5229</td><td>65300</td><td>12051</td><td>11666</td><td>37945</td></tr><tr><td>Tutankham</td><td>11</td><td>168</td><td>5384</td><td>239</td><td>251</td><td>264</td></tr><tr><td>Up N Down</td><td>533</td><td>11693</td><td>82840</td><td>34888</td><td>59944</td><td>653662</td></tr><tr><td>Venture</td><td>0</td><td>1188</td><td>38900</td><td>1529</td><td>1313</td><td>2</td></tr><tr><td>Video Pinball Wizard Of Wor</td><td>16257 564</td><td>17668 4756</td><td>89218328 395300</td><td>466895 7879</td><td>415833 5671</td><td>41860 12851</td></table>
340
+
341
+ Table K1: Atari individual scores. We select the 55 games that are common among most papers in the literature. We compare the algorithms DreamerV2, IQN, and Rainbow to the baselines of random actions, DeepMind’s human gamer, and the human world record. Algorithm scores are highlighted in bold when they fall within $5 \%$ of the best algorithm. Note that these scores are already averaged across seeds, whereas any aggregated scores must be computed before averaging across seeds.
md/train/B1gabhRcYX/B1gabhRcYX.md ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BA-NET: DENSE BUNDLE ADJUSTMENT NETWORKS
2
+
3
+ Chengzhou Tang School of Computer Science Simon Fraser University chengzhou_tang@sfu.ca
4
+
5
+ Ping Tan School of Computer Science Simon Fraser University pingtan@sfu.ca
6
+
7
+ # ABSTRACT
8
+
9
+ This paper introduces a network architecture to solve the structure-from-motion (SfM) problem via feature-metric bundle adjustment (BA), which explicitly enforces multi-view geometry constraints in the form of feature-metric error. The whole pipeline is differentiable, so that the network can learn suitable features that make the BA problem more tractable. Furthermore, this work introduces a novel depth parameterization to recover dense per-pixel depth. The network first generates several basis depth maps according to the input image, and optimizes the final depth as a linear combination of these basis depth maps via feature-metric BA. The basis depth maps generator is also learned via end-to-end training. The whole system nicely combines domain knowledge (i.e. hard-coded multi-view geometry constraints) and deep learning (i.e. feature learning and basis depth maps learning) to address the challenging dense SfM problem. Experiments on large scale real data prove the success of the proposed method.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The Structure-from-Motion (SfM) problem has been extensively studied in the past a few decades. Almost all conventional SfM algorithms (Agarwal et al., 2011; Wu et al., 2011; Schönberger & Frahm, 2016; Engel et al., 2018; Delaunoy & Pollefeys, 2014) jointly optimize scene structures and camera motion via the Bundle-Adjustment (BA) algorithm (Triggs et al., 2000; Agarwal et al., 2010), which minimizes the geometric (Agarwal et al., 2011; Wu et al., 2011; Schönberger & Frahm, 2016) or photometric (Engel et al., 2014; 2018; Delaunoy & Pollefeys, 2014) error through the Levenberg-Marquardt (LM) algorithm (Nocedal & Wright, 2006). Some recent works (Ummenhofer et al., 2017; Zhou et al., 2017; Wang et al., 2018) attempt to solve SfM using deep learning techniques, but most of them do not enforce the geometric constraints between 3D structures and camera motion in their networks. For example, in the recent work DeMoN (Ummenhofer et al., 2017), the scene depths and the camera motion are estimated by two individual sub-network branches.
14
+
15
+ This paper formulates BA as a differentiable layer, the BA-Layer, to bridge the gap between classic methods and recent deep learning based approaches. To this end, we learn a feed-forward multilayer perceptron (MLP) to predict the damping factor in the LM algorithm, which makes all involved computation differentiable. Furthermore, unlike conventional BA that minimizes geometric or photometric error, our BA-layer minimizes the distance between aligned CNN feature maps. Our novel feature-metric BA takes CNN features of multiple images as inputs and optimizes for the scene structures and camera motion. This feature-metric BA is desirable, because it has been observed by Engel et al. (2014; 2018) that the geometric BA does not exploit all image information, while the photometric BA is sensitive to moving objects, exposure or white balance changes, etc. Most importantly, our BA-Layer can back-propagate loss from scene structures and camera motion to learn appropriate features that are most suitable for structure-from-motion and bundle adjustment. In this way, our network hard-codes the multi-view geometry constraints in the BA-Layer and learns suitable feature representations from training data.
16
+
17
+ We strive to estimate a dense per-pixel depth, because dense depth is critical for many tasks such as object detection and robot navigation. A major challenge in solving dense per-pixel depth is to find a compact parameterization. Direct per-pixel depth is computational expensive, which makes the network training intractable. So we train a network to generate a set of basis depth maps for an arbitrary input image and represent the result depth map as a linear combination of these basis depth maps. The combination coefficients will be optimized in the BA-Layer together with camera motion. This novel parameterization guarantees a smooth depth map with good consistency with object boundaries. It also reduces the number of unknowns and makes dense BA possible in networks.
18
+
19
+ Similar depth parameterization is introduced in a recent work, CodeSLAM (Bloesch et al., 2018). The major difference is that our method learns the basis depth map generator through the gradients back-propagated from the BA-Layer, while CodeSLAM learns the generator separately and uses its results for a standalone optimization component. Thus, our basis depth map generator has the chance to be better trained for the SfM problem. Furthermore, we use a different network structure to generate basis depth maps. CodeSLAM employs a variational auto-encoder (VAE), while we use a standard encoder-decoder. This design enables us to use the same backbone network for both feature learning and basis depth map learning, making joint training of the whole network possible.
20
+
21
+ To demonstrate the effectiveness of our method, we evaluate on the ScanNet (Dai et al., 2017a) and KITTI (Geiger et al., 2012) dataset. Our method outperforms DeMoN (Ummenhofer et al., 2017), LS-Net (Clark et al., 2018), as well as several conventional baselines. Due to page limit, we move the ablation studies, evaluation on DeMoN’s dataset, multi-view SfM (up to 5 views), and comparison with CodeSLAM on the EuroC dataset (Burri et al., 2016) to the appendix.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Monocular Depth Estimation Networks Estimating depth from a monocular image is an ill-posed problem because an infinite number of possible scenes may have produced the same image. Before the raise of deep learning based methods, some works predict depth from a single image based on MRF (Saxena et al., 2005; 2009), semantic segmentation (Ladický et al., 2014), or manually designed features (Hoiem et al., 2005). Eigen et al. (2014) propose a multi-scale approach for depth prediction with two CNNs, where a coarse-scale network first predicts the scene depth at the global level and then a fine-scale network will refine the local regions. This approach was extended in Eigen & Fergus (2015) to handle semantic segmentation and surface normal estimation as well. Recently, Laina et al. (2016) propose to use ResNet (He et al., 2016) based structure to predict depth, and Xu et al. (2017) construct multi-scale CRFs for depth prediction. In comparison, we exploit monocular image depth estimation network for depth parameterization, which only produces a set of basis depth maps and the final result will be further improved through optimization.
26
+
27
+ Structure-from-Motion Networks Recently, some works exploit CNNs to resolve the SfM problem. Handa et al. (2016) solve the camera motion by a network from a pair of images with known depth. Zhou et al. (2017) employ two CNNs for depth and camera motion estimation respectively, where both CNNs are trained jointly by minimizing the photometric loss in an unsupervised manner. Wang et al. (2018) implement the direct method (Steinbruecker et al., 2011) as a differentiable component to compute camera motion after scene depth is estimated by the method in Zhou et al. (2017). In Ummenhofer et al. (2017), the scene depth and the camera motion are predicted from optical flow features, which help to make it generalizing better to unseen data. However, the scene depth and the camera motion are solved by two separate network branches, multi-view geometry constraints between depth and motion are not enforced. Recently, Clark et al. (2018) propose to solve nonlinear least squares in two-view SfM using a LSTM-RNN (Hochreiter et al., 2001) as the optimizer.
28
+
29
+ Our method belongs to this category. Unlike all previous works, we propose the BA-Layer to simultaneously predict the scene depth and the camera motion from CNN features, which explicitly enforces multi-view geometry constraints. The hard-coded multi-view geometry constraints enable our method to reconstruct more than two images, while most deep learning methods can only handle two images. Furthermore, we propose to minimize a feature-metric error instead of the photometric error in (Zhou et al., 2017; Wang et al., 2018; Clark et al., 2018) to enhance robustness.
30
+
31
+ # 3 BUNDLE ADJUSTMENT REVISITED
32
+
33
+ Before introducing our BA-Net architecture, we revisit the classic BA to have a better understanding about where the difficulties are and why feature-metric BA and feature learning are desirable. We only introduce the most relevant content and refer the readers to Triggs et al. (2000) and Agarwal et al. (2010) for a comprehensive introduction. Given images $\mathbb { I } = \{ I _ { i } | i = 1 \cdot \cdot \cdot N _ { i } \}$ , the geometric
34
+
35
+ BA (Triggs et al., 2000; Agarwal et al., 2010) jointly optimizes camera poses $\mathbb { T } = \{ \pmb { T } _ { i } | i = 1 \cdots N _ { i } \}$ and 3D scene point coordinates $\mathbb { P } = \{ \pmb { p } _ { j } | j = 1 \cdots N _ { j } \}$ by minimizing the re-projection error:
36
+
37
+ $$
38
+ \mathcal { X } = \mathop { \mathrm { a r g m i n } } \sum _ { i = 1 } ^ { N _ { i } } \sum _ { j = 1 } ^ { N _ { j } } \| e _ { i , j } ^ { g } ( \mathcal { X } ) \| ,
39
+ $$
40
+
41
+ where the geometric distance
42
+
43
+ $$
44
+ e _ { i , j } ^ { g } ( \mathcal { X } ) = \pi ( \pmb { T } _ { i } , \pmb { p } _ { j } ) - \pmb { q } _ { i , j }
45
+ $$
46
+
47
+ measures the difference between a projected scene point and its corresponding feature point. The function $\pi$ projects scene points to image space, $\mathbf { \mathscr { q } } _ { i , j } = [ x _ { i , j } , y _ { i , j } , 1 ]$ is the normalized homogeneous pixel coordinate, and $\mathcal { X } = [ \pmb { T } _ { 1 } , \pmb { T } _ { 2 } \cdot \cdot \cdot \pmb { T } _ { N _ { i } } , \pmb { p } _ { 1 } , \pmb { p } _ { 2 } \cdot \cdot \cdot \pmb { p } _ { N _ { j } } ] ^ { \top }$ contains all the points’ and the cameras’ parameters. The general strategy to minimize Equation (1) is the Levenberg-Marquardt (LM) (Nocedal & Wright, 2006; Lourakis & Argyros, 2005) algorithm. At each iteration, the LM algorithm solves for an optimal update $\Delta \mathcal { X } ^ { * }$ to the solution by minimizing:
48
+
49
+ $$
50
+ \Delta \mathcal { X } ^ { * } = \mathrm { a r g m i n } \| J ( \mathcal { X } ) \Delta \mathcal { X } + E ( \mathcal { X } ) \| + \lambda \| D ( \mathcal { X } ) \Delta \mathcal { X } \| .
51
+ $$
52
+
53
+ Here, $E ( \mathcal { X } ) = [ e _ { 1 , 1 } ^ { g } ( \mathcal { X } ) , e _ { 1 , 2 } ^ { g } ( \mathcal { X } ) \cdot \cdot \cdot e _ { N _ { i } , N _ { j } } ^ { g } ( \mathcal { X } ) ]$ , and $J ( \mathcal { X } )$ is the Jacobian matrix of $E ( \mathcal { X } )$ respect to $\mathcal { X }$ , $D ( \mathcal { X } )$ is a non-negative diagonal matrix, typically the square root of the diagonal of the approximated Hessian $J ( \mathcal { X } ) ^ { \top } J ( \mathcal { X } )$ . The non-negative value $\lambda$ controls the regularization strength. The special structure of $J ( \mathcal { X } ) ^ { \top } J ( \mathcal { X } )$ motivates the use of Schur-Complement (Brown, 1958).
54
+
55
+ This geometric BA with re-projection error is the golden standard for structure-from-motion in the last two decades, but with two main drawbacks:
56
+
57
+ • Only image information conforming to the respective feature types, typically image corners, blobs, or line segments, is utilized. Features have to be matched to each other, which often result in a lot of outliers. Outlier rejection like RANSAC is necessary, which still cannot guarantee correct result.
58
+
59
+ These two difficulties motivate the recent development of direct methods (Engel et al., 2014; 2018; Delaunoy & Pollefeys, 2014) which propose the photometric BA algorithm to eliminate feature matching and directly minimizes the photometric error (pixel intensity difference) of aligned pixels. The photometric error is defined as:
60
+
61
+ $$
62
+ e _ { i , j } ^ { p } ( \mathcal { X } ) = I _ { i } ( \pi ( T _ { i } , d _ { j } \cdot \pmb { q } _ { j } ) ) - I _ { 1 } ( \pmb { q } _ { j } ) ,
63
+ $$
64
+
65
+ where $d _ { j } ~ \in ~ \mathbb { D } ~ = ~ \{ d _ { j } | j ~ = ~ 1 \cdot \cdot \cdot N _ { j } \}$ is the depth of a pixel $\mathbf { \Delta } \mathbf { q } _ { j }$ at the image $I _ { 1 }$ , and $d _ { j } \cdot \mathbf { \vec { q } } _ { j }$ upgrade the pixel $\mathbf { \Delta } \mathbf { q } _ { j }$ to its 3D coordinate. Thus, the optimization parameter is $\mathcal { X } =$ $[ { \pmb T } _ { 1 } , { \pmb T } _ { 2 } \cdot \cdot \cdot { \pmb T } _ { N _ { i } } , d _ { 1 } , d _ { 2 } \cdot \cdot \cdot d _ { N _ { j } } ] ^ { \top }$ . The direct methods have the advantages of using all pixels with sufficient gradient magnitude. They have demonstrated superior performance, especially at less textured scenes. However, these methods also have some drawbacks:
66
+
67
+ • They are sensitive to initialization as demonstrated in (Mur-Artal et al., 2015) and (Tang et al., 2017) because the photometric error increases the non-convexity (Engel et al., 2018).
68
+ • They are sensitive to camera exposure and white balance changes. An automatic photometric calibration is required (Engel et al., 2018; 2016).
69
+ • They are more sensitive to outliers such as moving objects.
70
+
71
+ # 4 THE BA-NET ARCHITECTURE
72
+
73
+ To deal with the above challenges, we propose a feature-metric BA algorithm which estimates the same scene depth and camera motion parameters $\mathcal { X }$ as in photometric BA, but minimizes the feature-metric difference of aligned pixels:
74
+
75
+ $$
76
+ e _ { i , j } ^ { f } ( \mathcal { X } ) = F _ { i } ( \pi ( \boldsymbol { T } _ { i } , d _ { j } \cdot \boldsymbol { q } _ { j } ) ) - F _ { 1 } ( \boldsymbol { q } _ { j } ) ,
77
+ $$
78
+
79
+ where $\mathbb { F } = \{ F _ { i } | i = 1 \cdot \cdot \cdot N _ { i } \}$ are feature pyramids of images $\mathbb { I } = \{ I _ { i } | i = 1 \cdot \cdot \cdot N _ { i } \}$ . Similar to the photometric BA, our feature-metric BA considers more pixels than corners or blobs. It has the potential to learn more suitable features for SfM to deal with exposure changes, moving objects, etc.
80
+
81
+ ![](images/51445b39ea111c0debdf69e8cec249cfec148f0981237baaf39f3d3499de2fef.jpg)
82
+ Figure 1: Overview of our BA-Net structure, which consists of a DRN-54 (Yu et al., 2017) as the backbone network, a Basis Depth Maps Generator that generates a set of basis depth maps, a Feature Pyramid Constructor that constructs multi-scale feature maps, and a BA-Layer that optimizes both the depth map and the camera poses through a novel differentiable LM algorithm.
83
+
84
+ We learn features suitable for SfM via back-propagation, instead of using pre-trained CNN features for image classification (Czarnowski et al., 2017). Therefore, it is crucial to design a differentiable optimization layer, our BA-Layer, to solve the optimization problem, so that the loss information can be back-propagated. The BA-Layer predicts the camera poses $\mathbb { T }$ and the dense depth map $\mathbb { D }$ during forward pass and back-propagates the loss from $\mathbb { T }$ and $\mathbb { D }$ to the feature pyramids $\mathbb { F }$ for training.
85
+
86
+ # 4.1 OVERVIEW
87
+
88
+ As illustrated in Figure 1, our BA-Net receives multiple images and then feed them to the backbone DRN-54. We use DRN-54 (Yu et al., 2017) because it replaces max-pooling with convolution layers and generates smoother feature maps, which is desirable for BA optimization. Note the original DRN is memory inefficient due to the high resolution feature maps after dilation convolutions. We replace the dilation convolution with ordinary convolution with strides to address this issue. After DRN-54, a feature pyramid is then constructed for each input image, which are the inputs for the BA-Layer.
89
+
90
+ At the same time, the basis depth maps generator generates multiple basis depth maps for the image $I _ { 1 }$ , and the final depth map is represented as a linear combination of these basis depth maps.
91
+
92
+ Finally, the BA-Layer optimizes for the camera poses and the dense depth map jointly by minimizing the feature-metric error defined in Equation (4), which makes the whole pipeline end-to-end trainable.
93
+
94
+ # 4.2 FEATURE PYRAMID
95
+
96
+ The feature pyramid learns suitable features for the BA-Layer. Similar to the feature pyramid networks (FPN) for object detection (Lin et al., 2017), we exploit the inherent multi-scale hierarchy of deep convolutional networks to construct feature pyramids. A top-down architecture with lateral connections is applied to propagate richer context information from coarser scales to finer scales. Thus, our feature-metric BA will have a larger convergence radius.
97
+
98
+ As shown in Figure 2(a), we construct a feature pyramid from the backbone DRN-54. We denote the last residual blocks of conv1, conv2, conv3, conv4 in DRN-54 as $\{ C ^ { 1 } , C ^ { 2 } , C ^ { 3 } , C ^ { 4 } \}$ , with strides $\{ 1 , 2 , 4 , 8 \}$ respectively. We upsample a feature map $C ^ { k + 1 }$ by a factor of 2 with bilinear interpolation and concatenate the upsampled feature map with $C ^ { \bar { k } }$ in the next level. This procedure is iterated until the finest level. Finally, we apply a $3 \times 3$ convolution on the concatenated feature maps to reduce its dimensionality to 128 to balance the expressiveness and computational complexity, which leads to the final feature pyramid $F _ { i } = [ F _ { i } ^ { 1 } , F _ { i } ^ { 2 } , F _ { i } ^ { 3 } ]$ for image $I _ { i }$ .
99
+
100
+ We visualize some typical channels from the raw image $I$ (i.e. the RGB channels), the pre-trained DRN-54 $C ^ { 3 }$ and our learned $F ^ { 3 }$ in Figure 2(b). It is evident that, after training with our BA-Layer, the feature pyramid becomes smoother and each channel correspondences to different regions in the image. Note that our feature pyramids have higher resolution than FPN to facilitate precise alignment.
101
+
102
+ To have a better intuition about how much the BA optimization benefits from our learned features, we visualize different distances in Figure 3. We evaluate the distance between a pixel marked by a yellow cross in the top image in Figure 3 (a) and all pixels in a neighbourhood of its corresponding point in the bottom image of Figure 3 (a). The distances evaluated from raw RGB values, pretrained feature $C ^ { 3 }$ , and our learned feature $F ^ { 3 }$ are visualized in (b), (c), and (d) respectively. All distances are normalized to $[ 0 , 1 ]$ and visualized as heat maps. The $x$ -axis and $y$ -axis are the offsets to the ground-truth corresponding point. The RGB distance in (b) (i.e. $e ^ { p }$ in Equation (3)) has no clear global minimum, which makes the photometric BA sensitive to initialization (Engel et al., 2014; 2018). The distance measured by the pretrained feature $C ^ { 3 }$ has both global and local minimums. Finally, the distance measured by our learned feature $F ^ { 3 }$ has a clear global minimum and smooth basin, which is helpful in gradient based optimization such as the LM algorithm.
103
+
104
+ # 4.3 BUNDLE ADJUSTMENT LAYER
105
+
106
+ After building feature pyramids for all images, we optimize camera poses and a dense depth map by minimizing the feature-metric error in Equation (4). Following the conventional Bundle Adjustment principle, we optimize Equation (4) using the Levenberg-Marquardt (LM) algorithm. However, the original LM algorithm is non-differentiable because of two difficulties:
107
+
108
+ • The iterative computation terminates when a specified convergence threshold is reached. This if-else based termination strategy makes the output solution $\mathcal { X }$ non-differentiable with respect to the input $\mathbb { F }$ (Domke, 2012). In each iteration, it updates the damping factor $\lambda$ based on the current value of the objective function. It raises $\lambda$ if a step fails to reduce the objective; otherwise it reduces $\lambda$ . This if-else decision also makes $\mathcal { X }$ non-differentiable with respect to $\mathbb { F }$ .
109
+
110
+ When the solution $\mathcal { X }$ is non-differentiable with respect to $\mathbb { F }$ , feature learning by back-propagation becomes impossible. The first difficulty has been studied in Domke (2012) and the author proposes to fix the number of iterations, which is refered as ‘incomplete optimization’. Besides making the optimization differentiable, this ‘incomplete optimization’ technique also reduces memory consumption because the number of iterations is usually fixed at a small value.
111
+
112
+ The second difficulty has never been studied. Previous works mainly focus on gradient descent (Domke, 2012) or quadratic minimization (Amos & Kolter, 2017; Schmidt & Roth, 2014). In this section, we propose a simple yet effective approach to soften the if-else decision and yields a differentiable LM algorithm. We send the current objective value to a MLP network to predict $\lambda$ . This technique not only makes the optimization differentiable, but also learns to predict a better damping factor $\lambda$ , which helps the optimization to reach a better solution within limited iterations.
113
+
114
+ To start with, we illustrate a single iteration of the LM optimization as a diagram in Figure 4 by interpreting intermediate variables as network nodes. During the forward pass, we compute the solution update $\Delta \mathcal { X }$ from feature pyramids $\mathbb { F }$ and current solution $\mathcal { X }$ as the following steps:
115
+
116
+ • We compute the feature-metric error $E ( \mathcal { X } ) = [ e _ { 1 , 1 } ^ { f } ( \mathcal { X } ) , e _ { 1 , 2 } ^ { f } ( \mathcal { X } ) \cdots e _ { N _ { i } , N _ { j } } ^ { f } ( \mathcal { X } ) ]$ with Equation (4) on all $N _ { i }$ images and $N _ { j }$ pixels, where $\mathcal { X }$ is the solution from the previous iteration;
117
+
118
+ ![](images/9ce7ecb0fb83ecb8cf36b97f25a52a284e907bea6b12aeddf555810fd438bf08.jpg)
119
+ Figure 2: A feature pyramid and some typical channels from different feature maps.
120
+
121
+ ![](images/48453c521d73985079a9080b5b287ceadaf6a72242a2d461cc5cbe8fc1db9897.jpg)
122
+
123
+ Figure 3: Feature distance maps defined over raw RGB values, pretrained CNN features $C ^ { 3 }$ , or our learned features $F ^ { 3 }$ . Our features produce smoother objective function to facilitate optimization.
124
+
125
+ ![](images/a458f2275f9f354daff70a3dc2b34e82b0d61aeb9488bd43a7479be3730985de.jpg)
126
+ Figure 4: A single iteration of the differentiable LM.
127
+
128
+ • We then compute the Jacobian matrix $J ( \mathcal { X } )$ , the Hessian matrix $J ( \mathcal { X } ) ^ { \top } J ( \mathcal { X } )$ and its diagonal matrix $D ( \mathcal { X } )$ ;
129
+
130
+ • To predict the damping factor $\lambda$ , we use global average pooling to aggregate the aboslute value of $E ( \mathcal { X } )$ over all pixels for each feature channel, and get a 128D feature vector. We then send it to a MLP sub-network to predict $\lambda$ ;
131
+
132
+ • Finally, the update $\Delta \mathcal { X }$ to the current solution is computed as a standard LM step:
133
+
134
+ $$
135
+ \Delta \mathcal { X } = ( J ( \mathcal { X } ) ^ { \top } J ( \mathcal { X } ) + \lambda D ( \mathcal { X } ) ) ^ { - 1 } J ( \mathcal { X } ) ^ { \top } E ( \mathcal { X } ) .
136
+ $$
137
+
138
+ In this way, we can consider $\lambda$ as an intermediate variable and denote each LM step as a function $g$ about features pyramids $\mathbb { F }$ and the solution $\mathcal { X }$ from the previous iteration. In other words, $\Delta \mathcal { X } =$ $g ( \mathcal { X } ; \mathbb { F } )$ . Therefore, the solution after the $k$ -th iteration is:
139
+
140
+ $$
141
+ \begin{array} { r } { \mathcal { X } _ { k } = g ( \mathcal { X } _ { k - 1 } ; \mathbb { F } ) \circ \mathcal { X } _ { k - 1 } . } \end{array}
142
+ $$
143
+
144
+ Here, $\circ$ denotes parameters updating, which is addition for depth and SE(3) exponential mapping for camera poses. Equation (6) is differentiable with respect to the feature pyramids $\mathbb { F }$ , which makes back-propagation possible through the whole pipeline for feature learning. The MLP that predicts $\lambda$ is also shown in Figure 4. We stack four fully-connected layers to predict $\lambda$ from the input 128D vector. We use ReLU as the activation function to guarantee $\lambda$ is non-negative. Following the photometric BA (Engel et al., 2014; 2018), we solve our feature-metric BA using a coarse-to-fine strategy with feature map warping at each iteration. We apply the differentiable LM algorithm for 5 iterations at each pyramid level, leading to 15 iterations in total. All the camera poses are initialized with identity rotation and zero translation, and the initialization of depth map will be introduced in Section 4.4.
145
+
146
+ # 4.4 BASIS DEPTH MAPS GENERATION
147
+
148
+ Parameterizing a dense depth map by a per-pixel depth value is impractical under our formulation. Firstly, it introduces too many parameters for optimization. For example, an image of $3 2 0 \times 2 4 0$ pixels results in $7 6 . 8 \mathrm { k }$ parameters. Secondly, in the beginning of training, many pixels will become invisible in the other views because of the poorly predicted depth or motion. So little information can be back-propagated to improve the network, which makes training difficult.
149
+
150
+ To deal with these problems, we use the convolutional network for monocular image depth estimation as a compact parameterization, rather than using it as an initialization as in Tateno et al. (2017) and Yang et al. (2018). We use a standard encoder-decoder architecture for monocular depth learning as in Laina et al. (2016). We use DRN-54 as the encoder to share the same backbone features with our feature pyramids. For the decoder, we modify the last convolutional feature maps of Laina et al. (2016) to 128 channels and use these feature maps as the basis depth maps for optimization. The final depth map is generated as the linear combination of these basis depth maps, which is:
151
+
152
+ $$
153
+ \mathbb { D } = \operatorname { R e L U } ( \pmb { w } ^ { \top } \pmb { B } ) .
154
+ $$
155
+
156
+ Here, $\mathbb { D }$ is the $h \cdot w$ depth map that contains depth values for all pixels, $\textbf { { B } }$ is a $1 2 8 \times h \cdot w$ matrix, representing 128 basis depth maps generated from network, $\pmb { w }$ is the linear combination weights of these basis depth maps. The $\pmb { w }$ will be optimized in our BA-Layer. The ReLU activation function guarantees the final depth is non-negative. Once $\textbf { { B } }$ is generated from the network, we fix $\textbf { { B } }$ and use $\pmb { w }$ as a compact depth parameterization in BA optimization, and the feature-metric distance becomes:
157
+
158
+ $$
159
+ \begin{array} { r } { e _ { i , j } ^ { f } ( \mathcal { X } ) = F _ { i } ( \pi ( \pmb { T } _ { i } , \mathrm { R e L U } ( \pmb { w } ^ { \top } \pmb { B } [ j ] ) \cdot \pmb { q } _ { j } ) ) - F _ { 1 } ( \pmb { q } _ { j } ) , } \end{array}
160
+ $$
161
+
162
+ where $B [ j ]$ is the $j$ -th column of $\textbf { { B } }$ , and $\mathrm { R e L U } ( { \pmb w } ^ { \top } { \pmb B } [ j ] )$ is the corresponding depth of $\pmb q _ { j }$ . To further speedup convergence, we learn the initial weight $\pmb { w } _ { 0 }$ as a 1D convolution filter for an arbitrary image, i.e. $\begin{array} { r } { \mathbb { D } _ { 0 } = \mathrm { R e L } \check { \mathrm { U } } ( { \pmb w } _ { 0 } ^ { \top } B ) } \end{array}$ . The $\textbf { { B } }$ of various images are visualized in the appendix.
163
+
164
+ # 4.5 TRAINING
165
+
166
+ The BA-Net learns the feature pyramid, the damping factor predictor, and the basis depth maps generator in a supervised manner. We apply the following commonly used loss for training, though more sophisticated ones might be designed.
167
+
168
+ Camera Pose Loss The camera rotation loss is the distance between rotation quaternion vectors $\mathcal { L } _ { r o t a t i o n } = \| \pmb { q } - \pmb { q } ^ { * } \|$ . Similarly, translation loss is the Euclidean distance between prediction and groundtruth in metric scale, $\mathcal { L } _ { t r a n s l a t i o n } = \| \pmb { t - t ^ { * } } \|$ .
169
+
170
+ Depth Map Loss For each dense depth map we applies the berHu Loss (Zwald & Lambert-Lacroix, 2012) as in Laina et al. (2016).
171
+
172
+ We initialize the back-bone network from DRN-54 (Yu et al., 2017), and the other components are trained with ADAM (Kingma & Ba, 2015) from scratch with initial learning rate 0.001, and the learning rate is divided by two when we observe plateaus from the Tensorboard interface.
173
+
174
+ # 5 EVALUATION
175
+
176
+ # 5.1 DATASET
177
+
178
+ ScanNet ScanNet (Dai et al., 2017a) is a large-scale indoor dataset with 1,513 sequences in 706 different scenes. Camera poses and depth maps are not perfect, because they are estimated via BundleFusion (Dai et al., 2017b). The metric scale is known in all data from ScanNet, because the data are recorded with a depth camera which returns absolute depth values.
179
+
180
+ To sample image pairs for training, we apply a simple filtering process. We first filter out pairs with a large photo-consistency error, to avoid image pairs with large pose or depth error. We also filter out image pairs, if less than $50 \%$ of the pixels from one image are visible in the other image. In addition, we also discard a pair if their roundness score (Beder & Steffen, 2006) is less than 0.001, which avoids pairs with too narrow baselines.
181
+
182
+ We split the whole dataset into the training and the testing sets. The training set contains the first 1,413 sequences and the testing set contains the rest 100 sequences. We sample 547,991 training pairs and 2,000 testing pairs from the training and testing sequences respectively.
183
+
184
+ KITTI KITTI (Geiger et al., 2012) is a widely used benchmark dataset collected by car-mounted cameras and a LIDAR sensor on streets. It contains 61 scenes belonging to the "city", "residential", or "road" categories. Eigen et al. (2014) select 28 scenes for testing and 28 scenes from the remaining for training. We use the same data split, to make a fair comparison with previous methods. Since ground truth pose is unavailable from the raw KITTI dataset, we compute camera poses by LibVISO2 (Geiger et al., 2011) and take them as ground truth after discarding poses with large errors.
185
+
186
+ # 5.2 COMPARISONS WITH OTHER METHODS
187
+
188
+ ScanNet To evaluate the results’ quality, we use the depth error metrics suggested in Eigen & Fergus (2015), where RMSE (linear, log, and log, scale inv.) measure the RMSE of the raw, the logarithmical, and aligned logarithmical depth values, while the other two metrics measure the mean of the ratios that divide the absolute and square error by groundtruth depth.. The errors in camera poses are measured by the rotation error (the angle between the ground truth and the estimated camera rotations), the translation direction error (the angle between the ground truth and estimated camera translation directions) and the absolute position error (the distance between the ground truth and the estimated camera translation vectors).
189
+
190
+ <table><tr><td></td><td>Ours</td><td>Ours*</td><td>DeMoN*</td><td>Photometric BA</td><td>GeometricBA</td></tr><tr><td rowspan="3">Rotation (degree) Translation (cm) Translation (degree)</td><td>1.018</td><td>1.587</td><td>3.791</td><td>4.409</td><td>8.56</td></tr><tr><td>3.39</td><td>10.81</td><td>15.5</td><td>21.40</td><td>36.995</td></tr><tr><td>20.577</td><td>31.005</td><td>31.626</td><td>34.36</td><td>39.392</td></tr><tr><td rowspan="3">absrelative difference sqr relative difference</td><td>0.161</td><td>0.238</td><td>0.231</td><td>0.268</td><td>0.382</td></tr><tr><td>0.092</td><td>0.176</td><td>0.520</td><td>0.427</td><td>1.163</td></tr><tr><td>0.346</td><td>0.488</td><td>0.761</td><td>0.788</td><td>0.876</td></tr><tr><td>RMSE (linear) RMSE (log)</td><td>0.214</td><td>0.279</td><td>0.289</td><td>0.330</td><td>0.366</td></tr><tr><td>RMSE (log, scale inv.)</td><td>0.184</td><td>0.276</td><td>0.284</td><td>0.323</td><td>0.357</td></tr></table>
191
+
192
+ Table 1: Quantitative comparisons with DeMoN and classic BA. The superindex ∗ denotes that the model is trained on the trainning set described in Ummenhofer et al. (2017).
193
+
194
+ In Table 1, we compare our method with DeMoN (Ummenhofer et al., 2017) and the conventional photometric and geometric BA. Note that we cannot get DeMoN trained on the ScanNet. For fair comparison, we train our network on the same training data as DeMoN and test both networks on our testing data1. We also show the results of our network trained on ScanNet. Our BA-Net consistently performs better than DeMoN no matter which training data is used. Since DeMoN does not recover the absolute scale, we align its depth map with the groundtruth to recover its metric scale for evaluation. We further compare with conventional geometric (Nister, 2004; Agarwal et al.) and photometric (Engel et al., 2014) BA. Again, our method produces better results. The geometric BA works poorly here, because feature matching is difficult in indoor scenes. Even the RANSAC process cannot get rid of all outliers. While for photometirc BA, the highly non-convex objective function is difficult to optimize as described in Section 3.
195
+
196
+ KITTI We use the same metrics as the comparisons on ScanNet for depth evaluation. To evaluate the camera poses, we follow (Zhou et al., 2017; Wang et al., 2018) to use the Absolute Trajectory Error (ATE), which measures the Euclidean differences between two trajectories (Steinbruecker et al., 2011), on the 9th and 10th sequences from the KITTI odometry data. In this experiment, we create short sequences of 5 frames by first computing 5 two-view reconstructions from our BA-Net and then align the two-view reconstructions in the coordinate system anchored at the first frame. minimize the photometric error.
197
+
198
+ <table><tr><td></td><td>Ours</td><td></td><td></td><td>Wang et al. (2018) Zhou et al. (2017) Godard et al. (2017)</td><td>Eigen et al. (2014)</td></tr><tr><td>ATE(km)</td><td>0.019</td><td>0.045</td><td>0.021</td><td>N/A</td><td>N/A</td></tr><tr><td>absrel</td><td>0.083</td><td>0.151</td><td>0.208</td><td>0.148</td><td>0.203</td></tr><tr><td>sqr rel</td><td>0.025</td><td>1.257</td><td>1.768</td><td>1.344</td><td>1.548</td></tr><tr><td>RMSE(linear)</td><td>3.640</td><td>5.583</td><td>6.856</td><td>5.927</td><td>6.307</td></tr><tr><td>RMSE(log)</td><td>0.134</td><td>0.228</td><td>0.283</td><td>0.247</td><td>0.282</td></tr></table>
199
+
200
+ Table 2: Quantitative comparisons on KITTI with supervised (Eigen et al., 2014) and unsupervised (Wang et al., 2018; Zhou et al., 2017; Godard et al., 2017) methods.
201
+
202
+ Table 2 summarizes our results on KITTI. Our method outperforms the supervised methods (Eigen et al., 2014) as well as recent unsupervised methods (Zhou et al., 2017; Wang et al., 2018; Godard et al., 2017). Our method also achieves more accurate camera trajectories than Zhou et al. (2017) and Wang et al. (2018). We believe this is due to our feature-metric BA with features learned specifically for SfM problem, which makes the objective function closer to convex and easier to optimize as discussed in Section 4.2. In comparison, Zhou et al. (2017) and Wang et al. (2018) minimize the photometric error.
203
+
204
+ More comparison with DeMoN, ablation studies, and multi-view SfM (up to 5 views) are reported in the appendix due to page limit.
205
+
206
+ # 6 CONCLUSIONS AND FUTURE WORKS
207
+
208
+ This paper presents the BA-Net, a network that explicitly enforces multi-view geometry constraints in terms of feature-metric error. It optimizes scene depths and camera motion jointly via feature-metric bundle adjustment. The whole pipeline is differentiable and thus end-to-end trainable, such that the features are learned from data to facilitate structure-from-motion. The dense depth is parameterized as a linear combination of several basis depth maps generated from the network. Our BA-Net nicely combines domain knowledge (hard-coded multi-view geometry constraint) with deep learning (learned feature representation and basis depth maps generator). It outperforms conventional BA and recent deep learning based methods.
209
+
210
+ Acknowledgement This work is supported by the NSERC discovery grant 611664 and a project funding from Alibaba.
211
+
212
+ # REFERENCES
213
+
214
+ Sameer Agarwal, Keir Mierle, and Others. Ceres solver. http://ceres-solver.org.
215
+
216
+ Sameer Agarwal, Noah Snavely, Steven M. Seitz, and Richard Szeliski. Bundle adjustment in the large. In European Conference on Computer Vision (ECCV), pp. 29–42, 2010.
217
+
218
+ Sameer Agarwal, Yasutaka Furukawa, Noah Snavely, Ian Simon, Brian Curless, Steven M. Seitz, and Richard Szeliski. Building rome in a day. Commun. ACM, 54:105–112, 2011.
219
+
220
+ Brandon Amos and J. Zico Kolter. OptNet: Differentiable optimization as a layer in neural networks. In International Conference on Machine Learning (ICML), volume 70, pp. 136–145, 2017.
221
+
222
+ Christian Beder and Richard Steffen. Determining an initial image pair for fixing the scale of a 3d reconstruction from an image sequence. In Pattern Recognition, pp. 657–666, 2006.
223
+
224
+ Michael Bloesch, Jan Czarnowski, Ronald Clark, Stefan Leutenegger, and Andrew J. Davison. Codeslam — learning a compact, optimisable representation for dense visual slam. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
225
+
226
+ D.C. Brown. A Solution to the General Problem of Multiple Station Analytical Stereo triangulation. D. Brown Associates, Incorporated, 1958.
227
+
228
+ Michael Burri, Janosch Nikolic, Pascal Gohl, Thomas Schneider, Joern Rehder, Sammy Omari, Markus W Achtelik, and Roland Siegwart. Euroc micro aerial vehicle datasets. International Journal of Robotics Research, 35, 2016.
229
+
230
+ Angel X. Chang, Thomas A. Funkhouser, Leonidas J. Guibas, Pat Hanrahan, Qi-Xing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, Jianxiong Xiao, Li Yi, and Fisher Yu. Shapenet: An information-rich 3d model repository. CoRR, abs/1512.03012, 2015.
231
+
232
+ Ronald Clark, Michael Bloesch, Jan Czarnowski, Stefan Leutenegger, and Andrew J. Davison. Learning to solve nonlinear least squares for monocular stereo. In European Conference on Computer Vision (ECCV), 2018.
233
+
234
+ J. Czarnowski, S. Leutenegger, and A. J. Davison. Semantic texture for robust dense tracking. In IEEE International Conference on Computer Vision Workshops (ICCVW), pp. 851–859, 2017.
235
+
236
+ A. Dai, A. X. Chang, M. Savva, M. Halber, T. Funkhouser, and M. Nießner. Scannet: Richlyannotated 3d reconstructions of indoor scenes. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2432–2443, 2017a.
237
+
238
+ Angela Dai, Matthias Niessner, Michael Zollhöfer, Shahram Izadi, and Christian Theobalt. Bundlefusion: Real-time globally consistent 3d reconstruction using on-the-fly surface reintegration. ACM Transactions on Graphics, 36, 2017b.
239
+
240
+ A. Delaunoy and M. Pollefeys. Photometric bundle adjustment for dense multi-view 3d modeling. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1486–1493, 2014.
241
+
242
+ Justin Domke. Generic methods for optimization-based modeling. In AISTATS, 2012.
243
+
244
+ D. Eigen and R. Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In IEEE International Conference on Computer Vision (ICCV), pp. 2650–2658, 2015.
245
+
246
+ David Eigen, Christian Puhrsch, and Rob Fergus. Depth map prediction from a single image using a multi-scale deep network. In International Conference on Neural Information Processing Systems (NIPS), pp. 2366–2374, 2014.
247
+
248
+ J. Engel, V. Koltun, and D. Cremers. Direct sparse odometry. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40:611–625, 2018.
249
+
250
+ Jakob Engel, Thomas Schöps, and Daniel Cremers. Lsd-slam: Large-scale direct monocular slam. In European Conference on Computer Vision (ECCV), 2014.
251
+
252
+ Jakob Engel, Vladyslav C. Usenko, and Daniel Cremers. A photometrically calibrated benchmark for monocular visual odometry. CoRR, abs/1607.02555, 2016.
253
+
254
+ Andreas Geiger, Julius Ziegler, and Christoph Stiller. Stereoscan: Dense 3d reconstruction in real-time. In Intelligent Vehicles Symposium (IV), 2011.
255
+
256
+ Andreas Geiger, Philip Lenz, and Raquel Urtasun. Are we ready for autonomous driving? the kitti vision benchmark suite. In Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3354–3361, 2012.
257
+
258
+ Clément Godard, Oisin Mac Aodha, and Gabriel J. Brostow. Unsupervised monocular depth estimation with left-right consistency. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
259
+
260
+ Ankur Handa, Michael Bloesch, Viorica Patr ˘ aucean, Simon Stent, John McCormac, and Andrew ˘ Davison. gvnn: Neural network library for geometric computer vision. In European Conference on Computer Vision Workshop (ECCVW), pp. 67–82, 2016.
261
+
262
+ R. I. Hartley. In defense of the eight-point algorithm. IEEE Transactions on Pattern Analysis and Machine Intelligence, 19:580–593, 1997.
263
+
264
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.
265
+
266
+ H. Hirschmuller. Accurate and efficient stereo processing by semi-global matching and mutual information. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), volume 2, pp. 807–814, 2005.
267
+
268
+ Sepp Hochreiter, A. Steven Younger, and Peter R. Conwell. Learning to learn using gradient descent. In International Conference on Artificial Neural Networks (ICANN), pp. 87–94, 2001.
269
+
270
+ Derek Hoiem, Alexei A. Efros, and Martial Hebert. Automatic photo pop-up. In ACM SIGGRAPH, pp. 577–584, 2005.
271
+
272
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
273
+
274
+ L’ubor Ladický, Jianbo Shi, and Marc Pollefeys. Pulling things out of perspective. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 89–96, 2014.
275
+
276
+ I. Laina, C. Rupprecht, V. Belagiannis, F. Tombari, and N. Navab. Deeper depth prediction with fully convolutional residual networks. In International Conference on 3D Vision (3DV), pp. 239–248, 2016.
277
+
278
+ T. Y. Lin, P. Dollár, R. Girshick, K. He, B. Hariharan, and S. Belongie. Feature pyramid networks for object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 936–944, 2017.
279
+
280
+ M. L. A. Lourakis and A. A. Argyros. Is levenberg-marquardt the most efficient optimization algorithm for implementing bundle adjustment? In IEEE International Conference on Computer Vision (ICCV), volume 2, pp. 1526–1531, 2005.
281
+ Raúl Mur-Artal, J. M. M. Montiel, and Juan D. Tardós. Orb-slam: a versatile and accurate monocular slam system. IEEE Transactions on Robotics, 31:1147–1163, 2015.
282
+ D. Nister. An efficient solution to the five-point relative pose problem. IEEE Transactions on Pattern Analysis and Machine Intelligence, 26:756–770, 2004.
283
+ J. Nocedal and S. J. Wright. Numerical Optimization. Springer, second edition, 2006.
284
+ A. Saxena, M. Sun, and A. Y. Ng. Make3d: Learning 3d scene structure from a single still image. IEEE Transactions on Pattern Analysis and Machine Intelligence, 31:824–840, 2009.
285
+ Ashutosh Saxena, Sung H. Chung, and Andrew Y. Ng. Learning depth from single monocular images. In International Conference on Neural Information Processing Systems (NIPS), pp. 1161–1168, 2005.
286
+ U. Schmidt and S. Roth. Shrinkage fields for effective image restoration. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2774–2781, 2014.
287
+ Johannes Lutz Schönberger and Jan-Michael Frahm. Structure-from-motion revisited. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4104–4113, 2016.
288
+ F. Steinbruecker, J. Sturm, and D. Cremers. Real-time visual odometry from dense rgb-d images. In International Conference on Computer Vision Workshop on Live Dense Reconstruction with Moving Cameras(ICCVW), 2011.
289
+ C. Tang, O. Wang, and P. Tan. Gslam: Initialization-robust monocular visual slam via global structure-from-motion. In International Conference on 3D Vision (3DV), pp. 239–248, 2017.
290
+ K. Tateno, F. Tombari, I. Laina, and N. Navab. Cnn-slam: Real-time dense monocular slam with learned depth prediction. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6565–6574, 2017.
291
+ Bill Triggs, Philip F. McLauchlan, Richard I. Hartley, and Andrew W. Fitzgibbon. Bundle adjustment - a modern synthesis. In Vision Algorithms: Theory and Practice, pp. 298–372, 2000.
292
+ Benjamin Ummenhofer, Huizhong Zhou, Jonas Uhrig, Nikolaus Mayer, Eddy Ilg, Alexey Dosovitskiy, and Thomas Brox. Demon: Depth and motion network for learning monocular stereo. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5622–5631, 2017.
293
+ Chaoyang Wang, Buenaposada, Miguel Jose, Rui Zhu, , and Simon Lucey. Learning depth from monocular videos using direct methods. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 851–859, 2018.
294
+ C. Wu, S. Agarwal, B. Curless, and S. M. Seitz. Multicore bundle adjustment. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3057–3064, 2011.
295
+ D. Xu, E. Ricci, W. Ouyang, X. Wang, and N. Sebe. Multi-scale continuous crfs as sequential deep networks for monocular depth estimation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 161–169, 2017.
296
+ Nan Yang, Rui Wang, Jorg Stuckler, and Daniel Cremers. Deep virtual stereo odometry: Leveraging deep depth prediction for monocular direct sparse odometry. In European Conference on Computer Vision (ECCV), 2018.
297
+ F. Yu, V. Koltun, and T. Funkhouser. Dilated residual networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 636–644, 2017.
298
+ Tinghui Zhou, Matthew Brown, Noah Snavely, and David G. Lowe. Unsupervised learning of depth and ego-motion from video. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6612–6619, 2017.
299
+ L. Zwald and S. Lambert-Lacroix. The berhu penalty and the grouped effect. CoRR, abs/1207.6868, 2012.
300
+
301
+ ![](images/13df0af9a2a1f698d62a684f351663ff999163586b209241ce52dcdd498bd25f.jpg)
302
+ Figure 5: Network details for the (a) the DRN-54 backbone and (b) the basis depth generator.
303
+
304
+ Network Architecture Details Figure 5 illustrates the detailed network architectures for the backbone DRN-54 and the depth basis generator. The architecture of the feature pyramid has been provided in Figure 2(a). We modify the dilated convolution of the original DRN-54 to convolution with strides and discard the conv7 and conv8 as shown in Figure 5(a). $C ^ { 1 }$ to $C ^ { 6 }$ are layers with {1,2,4,8,16,32} strides and {16,32,256,512,1024,2048} channels, where $C ^ { 1 }$ and $C ^ { 2 }$ are basic convolution layers, while $C ^ { 3 }$ to $C ^ { 6 }$ are standerd bottleneck blocks as in ResNet (He et al., 2016).
305
+
306
+ Figure 5(b) visualizes our depth basis generator which adopts the up-projection structure proposed in Laina et al. (2016). The depth basis generator is a stander decoder that takes the output of $\dot { C } ^ { 6 }$ as input and stacks five up-projection blocks to generate 128 basis depth maps, and each of the basis depth maps is half the resolution of the input image. The up-projection block is shown on the right of Figure 5(b) which upsample the input by $2 \times$ and then apply convolutions with projection connection.
307
+
308
+ Evaluation Time To evaluate the running time of our method, we use the Tensorflow profiler tool to retrieve the time in ms for all network nodes and then summarize the results corresponding to each component in our pipeline. As shown in Table 3, our method takes $9 5 . 2 1 \ \mathrm { m s }$ to reconstruct two $3 2 0 \times 2 4 0$ images, which is slightly faster than DeMoN that takes $1 1 0 \mathrm { m s }$ for two $2 5 6 \times 1 9 2$ images.
309
+
310
+ The current computation bottleneck is the BA-Layer which contains a large amount of matrix operations and can be further speeded up by direct CUDA implementation. Since we explicitly hard-code the multi-view geometry constraints in the BA-Layer, it is possible to share the backbone DRN-54 with other high-level vision tasks, such as semantic segmentation and object detection, to maximize reuse of network structures and minimize extra computation cost.
311
+
312
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Backbone(DRN-54)</td><td rowspan=1 colspan=1>FeaturePyramid</td><td rowspan=1 colspan=1>Basis DepthGenerator</td><td rowspan=1 colspan=1>BA-LayerOptimization</td><td rowspan=1 colspan=1>Total</td></tr><tr><td rowspan=1 colspan=1>Time (ms)</td><td rowspan=1 colspan=1>15.04</td><td rowspan=1 colspan=1>5.87</td><td rowspan=1 colspan=1>9.81</td><td rowspan=1 colspan=1>67.22</td><td rowspan=1 colspan=1>95.21</td></tr></table>
313
+
314
+ Table 3: Evaluation time for each component, which is summarized using Tensorflow profiler.
315
+
316
+ # APPENDIX B: ABLATION STUDIES
317
+
318
+ Learned Features vs Pre-trained Features Our learned feature pyramid improves the convexity of the objective function to facilitate the optimization. We compare our learned features with features
319
+
320
+ Table 4: Ablation Study Comparisons by Disabling Different Components of BA-Net
321
+
322
+ <table><tr><td></td><td>Ours (Full)</td><td>w/o Feature Learning</td><td>w/o Joint Optimization</td><td>w/o入</td></tr><tr><td>Rotation (degree)</td><td>1.018</td><td>2.667</td><td>1.036</td><td>7.202</td></tr><tr><td>Translation (cm)</td><td>3.39</td><td>10.8</td><td>3.91</td><td>22.38</td></tr><tr><td>Translation (degree)</td><td>20.577</td><td>31.493</td><td>26.779</td><td>59.81</td></tr><tr><td>absrelative difference</td><td>0.161</td><td>0.267</td><td>0.217</td><td>0.630</td></tr><tr><td>sqr relative difference</td><td>0.092</td><td>0.242</td><td>0.145</td><td>0.549</td></tr><tr><td>RMSE (linear)</td><td>0.346</td><td>0.481</td><td>0.428</td><td>0.763</td></tr><tr><td>RMSE (log)</td><td>0.214</td><td>0.303</td><td>0.270</td><td>0.513</td></tr><tr><td>RMSE (log, scale inv.)</td><td>0.184</td><td>0.226</td><td>0.205</td><td>0.437</td></tr></table>
323
+
324
+ pre-trained on ImageNet for classification tasks. As shown in Table 4, the pre-trained features (i.e.
325
+ w/o Feature Learning) produce larger error. This proves the discussion in Section 4.2.
326
+
327
+ Bundle Adjustment Optimization vs SE(3) Pose Estimation Our BA-Layer optimizes depth and camera poses jointly. We compare it to the SE(3) camera pose estimation with fixed depth map (e.g. the initialized depth $\mathbb { D } _ { 0 }$ in Section 4.4), and similar strategy is adopted in Wang et al. (2018). To make a fair comparison, we also use our learned feature pyramids for the SE(3) camera pose estimation. As shown in Table 4, without BA optimization (i.e. w/o Joint Optimization), both the depth maps and camera poses are worse, because the errors in the depth estimation will degrades the camera pose estimation.
328
+
329
+ Differentiable Levenberg-Marquardt vs Gauss-Newton To make the whole pipeline end-to-end trainable, we makes the Levenberg-Marquardt algorithm differentiable by learning the damping factor from the network. We first compare our method against vanilla Gauss-Newton without damping factor $\lambda$ (i.e. $\lambda = 0$ ). Since the objective function of feature-metric BA is non-convex, the Hessian matrix $J ( \mathcal { X } ) ^ { \top } J ( \mathcal { X } )$ might not be positive definite, which makes the matrix inversion by Cholesky decomposition fail.
330
+
331
+ To deal with this problem, we use QR decomposition instead for training with Gauss-Newton. As shown in Table 4, the Gauss-Newton algorithm (i.e. w/o $\lambda$ ) generates much larger error, because the BA optimization is non-convex and the Gauss-Newton algorithm has no guaranteed convergence unless the initial solution is sufficiently close to the optimal (Nocedal & Wright, 2006). This comparison reveals that, similar to conventional BA, our differnetiable Levenberg-Marquardt algorithm is superior than the Gauss-Newton algorithm for feature-metric BA.
332
+
333
+ ![](images/9115916d7d58f5641ac10d6fc46f29dae3da88fc63917d5a8cc31bf6d3c24ee9.jpg)
334
+ Figure 6: The camera pose and the depth errors correspond to different constant $\lambda$ values.
335
+
336
+ Predicted vs Constant $\lambda$ Another way to make the Levenberg-Marquardt algorithm differentiable is to fix the $\lambda$ during the iterations. We compare with this strategy. As shown in Figure 6(a), increasing $\lambda$ makes the both rotation and translation error decreases, until $\lambda = 0 . 5$ , and then increases. The reason is that a small $\lambda$ makes the algorithm close to the Gauss-Newton algorithm, which has convergence issues. A large $\lambda$ leads to a small update at each iteration, which makes it difficult to reach a good solution within limited iterations.
337
+
338
+ While in Figure 6(b), increasing $\lambda$ always makes depth errors decrease, probably because a larger $\lambda$ leads to a small update and makes the final depth close to the initialed depth, which is better than the optimized one with small constant $\lambda$ .
339
+
340
+ Using constant $\lambda$ value consistently generates worse results than using a predicted $\lambda$ from the MLP network, because there is no optimal $\lambda$ for all data and it should be adapted to different data and different iterations. We draw the errors of our method in Figure 6(a) and Figure 6(b) as the flat dash lines for a reference.
341
+
342
+ # APPENDIX C: EVALUATION ON DEMON DATASET
343
+
344
+ Table 5 summarizes our results on the DeMoN dataset. For a comparison, we also cite the results from DeMoN (Ummenhofer et al., 2017) and the most recent work LS-Net (Clark et al., 2018). We further cite the results from some conventional approaches as reported in DeMoN, indicated as Oracle, SIFT, FF, and Matlab respectively. Here, Oracle uses ground truth camera poses to solve the multi-view stereo by SGM (Hirschmuller, 2005), while SIFT, FF, and Matlab further use sparse features, optical flow, and KLT tracking respectively for feature correspondence to solve camera poses by the 8-pt algorithm (Hartley, 1997).
345
+
346
+ Table 5: Quantitative comparisons on the DeMoN dataset.
347
+
348
+ <table><tr><td></td><td></td><td></td><td>Depth</td><td></td><td>Motion</td><td></td><td></td><td></td><td></td><td>Depth</td><td></td><td>Motion</td><td></td></tr><tr><td></td><td>Method</td><td>L1-inv</td><td>sc-inv</td><td>L1-rel</td><td>Rotation</td><td>Translation</td><td></td><td>Method</td><td>L1-inv</td><td>sc-inv</td><td>L1-rel</td><td>Rotation</td><td>Translation</td></tr><tr><td rowspan="8"></td><td>Oracle</td><td>0.019</td><td>0.197</td><td>0.105</td><td>0</td><td>0</td><td></td><td>Oracle</td><td>0.023</td><td>0.618</td><td>0.349</td><td>0</td><td>0</td></tr><tr><td>SIFT</td><td>0.056</td><td>0.309</td><td>0.361</td><td>21.180</td><td>60.516</td><td></td><td>SIFT</td><td>0.051</td><td>0.900</td><td>1.027</td><td>6.179</td><td>56.650</td></tr><tr><td>FF</td><td>0.055</td><td>0.308</td><td>0.322</td><td>4.834</td><td>17.252</td><td></td><td>FF</td><td>0.038</td><td>0.793</td><td>0.776</td><td>1.309</td><td>19.425</td></tr><tr><td>Matlab</td><td></td><td></td><td></td><td>10.843</td><td>32.736</td><td>Sseeeesr</td><td>Matlab</td><td></td><td></td><td></td><td>0.917</td><td>14.639</td></tr><tr><td>DeMoN</td><td>0.047</td><td>0.202</td><td>0.305</td><td>5.156</td><td>14.447</td><td></td><td>DeMoN</td><td>0.019</td><td>0.315</td><td>0.248</td><td>0.809</td><td>8.918</td></tr><tr><td>LS-Net</td><td>0.051</td><td>0.221</td><td>0.311</td><td>4.653</td><td>11.221</td><td></td><td>LS-Net</td><td>0.010</td><td>0.410</td><td>0.210</td><td>0.910</td><td>8.21</td></tr><tr><td>Ours</td><td>0.03</td><td>0.15</td><td>0.08</td><td>3.499</td><td>11.238</td><td></td><td>Ours</td><td>0.08</td><td>0.21</td><td>0.13</td><td>1.298</td><td>10.37</td></tr><tr><td colspan="2"></td><td colspan="2">Depth</td><td colspan="2">Motion</td><td></td><td></td><td></td><td colspan="2">Depth</td><td colspan="2">Motion</td></tr><tr><td></td><td>Method</td><td>L1-inv</td><td>sc-inv</td><td>L1-rel</td><td>Rotation</td><td>Translation</td><td></td><td>Method</td><td>L1-inv</td><td>sc-inv</td><td>L1-rel</td><td>Rotation</td><td>Translation</td></tr><tr><td rowspan="8">RRRPR</td><td>Oracle</td><td>0.026</td><td>0.398</td><td>0.336</td><td>0</td><td>0</td><td></td><td>Oracle</td><td>0.020</td><td>0.241</td><td>0.220</td><td>0</td><td>0</td></tr><tr><td>SIFT</td><td>0.050</td><td>0.577</td><td>0.703</td><td>12.010</td><td>56.021</td><td></td><td>SIFT</td><td>0.029</td><td>0.290</td><td>0.286</td><td>7.702</td><td>41.825</td></tr><tr><td>FF</td><td>0.045</td><td>0.548</td><td>0.613</td><td>4.709</td><td>46.058</td><td>gsun2</td><td>FF</td><td>0.029</td><td>0.284</td><td>0.297</td><td>3.681</td><td>33.301</td></tr><tr><td>Matlab</td><td></td><td></td><td></td><td>12.831</td><td>49.612</td><td></td><td>Matlab</td><td></td><td></td><td></td><td>5.920</td><td>32.298</td></tr><tr><td>DeMoN</td><td>0.028</td><td>0.130</td><td>0.212</td><td>2.641</td><td>20.585</td><td></td><td>DeMoN</td><td>0.019</td><td>0.114</td><td>0.172</td><td>1.801</td><td>18.811</td></tr><tr><td>LS-Net</td><td>0.019</td><td>0.09</td><td>0.301</td><td>1.01</td><td>22.1</td><td></td><td>LS-Net</td><td>0.015</td><td>0.189</td><td>0.650</td><td>1.521</td><td>14.347</td></tr><tr><td>Ours</td><td>0.008</td><td>0.087</td><td>0.05</td><td>2.459</td><td>14.90</td><td></td><td>Ours</td><td>0.015</td><td>0.11</td><td>0.06</td><td>1.729</td><td>13.26</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></tr></table>
349
+
350
+ Our method consistently outperforms DeMoN (Ummenhofer et al., 2017) at both camera motion and scene depth, except on the ‘Scenes11’ data, because we enforce multi-view geometry constraint in the BA-Layer. Our results are poorer on the ‘Scene11’ dataset, because the images there are synthesized with random objects from the ShapeNet (Chang et al., 2015) without physically correct scale. This setting is inconsistent with real data and makes it harder for our method to learn the basis depth map generator.
351
+
352
+ When compared with LS-Net Clark et al. (2018), our method achieves similar accuracy on camera poses but better scene depth. It proves our feature-metric BA with learned feature is superior than the photometric BA in the LS-Net.
353
+
354
+ # APPENDIX D: MULTI-VIEW STRUCTURE-FROM-MOTION
355
+
356
+ Our method can be easily extended to reconstruct multiple images. We evaluate our method in the multi-view setting on the ScanNet (Dai et al., 2017a) dataset. To sample multi-view images for training, we randomly select two-view image pairs that shares a common image to construct $N$ -view sequences. Due to the limited GPU memory (12G), we limit $N$ to 5.
357
+
358
+ As shown in the Table 6, the accuracy is consistently improved when more views are included, which demonstrates the strength of the multi-view geometry constraints. Instead, most existing deep learning approaches can only handle two views at a time, which is sub-optimal as known in structure-from-motion literature.
359
+
360
+ <table><tr><td></td><td>Ours(2-views)</td><td>Ours(3-views)</td><td>Ours(5-views)</td></tr><tr><td rowspan="3">Rotation (degree) Translation (cm) Translation (degree)</td><td>1.018</td><td>1.013</td><td>1.009</td></tr><tr><td>3.391</td><td>2.852</td><td>2.365</td></tr><tr><td>20.577</td><td>16.423</td><td>14.626</td></tr><tr><td rowspan="4">absrelative difference sqr relative difference RMSE (linear) RMSE (log)</td><td>0.161</td><td>0.111</td><td>0.091</td></tr><tr><td>0.092</td><td>0.087</td><td>0.068</td></tr><tr><td>0.346</td><td>0.288</td><td>0.223</td></tr><tr><td>0.214</td><td>0.179</td><td>0.147</td></tr><tr><td>RMSE (log, scale inv.)</td><td>0.184</td><td>0.168</td><td>0.137</td></tr></table>
361
+
362
+ Table 6: Quantitative comparisons on multi-view reconstruction on ScanNet.
363
+
364
+ # APPENDIX E: QUANTITATIVE COMPARISONS WITH CODESLAM
365
+
366
+ We compare our method with CodeSLAM (Bloesch et al., 2018) which adopts similar idea for depth parameterization. But the difference is that CodeSLAM learns the conditioned depth auto-encoder separately and uses the depth codes in a standalone photometric BA component, while our method learns the feature pyramid and basis depth maps generator through feature-metric BA end-to-end. Since there is no public code for CodeSLAM, we directly cite the results from their paper.2 To get the trajectory on the EuroC MH02 sequence of our method, we select one frame every four frames and concatenate the reconstructed groups that contains every five selected frames. Then we use the same evaluation metrics as in CodeSLAM, which measures the translation errors correspond to different traveled distances.
367
+
368
+ ![](images/da802cb4214926197154a330f9eeb5f1719fd306ae5857fe5460701cf562f196.jpg)
369
+ Figure 7: Quantitative Comparisons with CodeSLAM (Bloesch et al., 2018) on EuroC MH02. The 0.50.5error bars represent the maximum and the minimum errors. The orange and the blue boxes represent the median errors for CodeSLAM and our method.
370
+
371
+ As shown in Figure 7, our method outperforms CodeSLAM. Our median error is less than the half of CodeSLAM’s error, i.e. CodeSLAM exhibits an error of roughly $1 \textrm { m }$ for a traveled distance of $9 \mathrm { m }$ , while our method’s error is about $0 . 4 \mathrm { m }$ . This comparison demonstrates the superiority of end-to-end learning with feature pyramid and feature-metric BA over learning depth parameterization only.
372
+
373
+ # APPENDIX F: VISUALIZATION OF BASIS DEPTH MAPS
374
+
375
+ In Figure 8, we visualize four typical basis depth maps as heat maps for each of the four images. An interesting observation is that one basis depth map has higher responses on close objects while another oppositely has higher responses to the far background. Some other basis depth maps have smoothly varying responses and correspond to the layouts of scenes. This observation reveals that our learned basis depth maps have captured the latent structures of scenes.
376
+
377
+ ![](images/0ca718d2adfbdb13f4a7196bbbedb0fd4b939b2adfb383d14592868a15728473.jpg)
378
+ Figure 8: Visualization of different basis depth maps.
379
+
380
+ # APPENDIX G: QUALITATIVE COMPARISONS WITH OTHER METHODS
381
+
382
+ Finally, we show some qualitative comparison with the previous methods. Figure 9 shows the recovered depth map by our method and DeMoN Ummenhofer et al. (2017) on the ScanNet data. As we can see from the regions highlighted with a red circle, our method recovers more shape details. This is consistent with the quantitative results in Table 1. Figure 11 shows the recovered depth maps by our method, Wang et al. (2018), and Godard et al. (2017) respectively. Similarly, we observe more shape details in our results, as reflected in the quantitative results in Table 2.
383
+
384
+ ![](images/b780d371c7ded7238a9b56c8ef9685c37eb1bb3b0a22bb9f09302f2916aea4cd.jpg)
385
+ Figure 9: Qualitative Comparisons with DeMoN (Ummenhofer et al., 2017) on ScanNet.
386
+
387
+ ![](images/bd53ca282836205f3f5e4d0394e1f831c885a8970627f8da70ae49c269da1f6b.jpg)
388
+ Figure 10: Qualitative Comparisons with DeMoN (Ummenhofer et al., 2017) on its dataset.
389
+
390
+ ![](images/4ea8a34be6470d158b277e4510a8d80e1b0a71f53c537acb646ba983c9ba2d9e.jpg)
391
+ Figure 11: Qualitative Comparisons with Wang et al. (2018) and Godard et al. (2017).
md/train/BBIbj9w8Lvj8F/BBIbj9w8Lvj8F.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Efficient Learning of Domain-invariant Image Representations
2
+
3
+ Judy Hoffman UCB EECS & ICSI jhoffman@eecs.berkeley.edu
4
+
5
+ Erik Rodner UCB EECS & ICSI erik.rodner@gmail.com
6
+
7
+ Jeff Donahue UCB EECS & ICSI jdonahue@eecs.berkeley.edu
8
+
9
+ Trevor Darrell UCB EECS & ICSI trevor@eecs.berkeley.edu
10
+
11
+ Kate Saenko University of Massachusetts, Lowell saenko@cs.uml.edu
12
+
13
+ # Abstract
14
+
15
+ We present an algorithm that learns representations which explicitly compensate for domain mismatch and which can be efficiently realized as linear classifiers. Specifically, we form a linear transformation that maps features from the target (test) domain to the source (training) domain as part of training the classifier. We optimize both the transformation and classifier parameters jointly, and introduce an efficient cost function based on misclassification loss. Our method combines several features previously unavailable in a single algorithm: multi-class adaptation through representation learning, ability to map across heterogeneous feature spaces, and scalability to large datasets. We present experiments on several image datasets that demonstrate improved accuracy and computational advantages compared to previous approaches.
16
+
17
+ # 1 Introduction
18
+
19
+ We address the problem of learning domain-invariant image representations for multi-class classifiers. The ideal image representation often depends not just on the task but also on the domain. Recent studies have demonstrated a significant degradation in the performance of state-of-the-art image classifiers when input feature distributions change due to different image sensors and noise conditions [1], pose changes [2], a shift from commercial to consumer video [3, 4], and, more generally, training datasets biased by the way in which they were collected [5]. Learning adaptive representations for linear classifiers is particularly interesting as they are efficient and prevalent in vision applications, with fast linear SVMs forming the core of some of the most popular object detection methods [6, 7].
20
+
21
+ Previous work proposed to adapt linear SVMs [8, 9, 10], learning a perturbation of the source hyperplane by minimizing the classification error on labeled target examples for each binary task. These perturbations can be thought of as new feature representations that correct for the domain change. The recent HFA method [11] learns both the perturbed classifier and a latent domain-invariant feature representation, allowing domains to have heterogeneous features with different dimensionalities. However, existing SVM-based methods are limited to learning a separate representation for each binary problem and cannot transfer a common, class-independent component of the shift (such as global lighting change) to unlabeled categories, as illustrated in Figure 1. Additionally, the HFA algorithm cannot be solved in linear space and therefore scales poorly to large datasets.
22
+
23
+ ![](images/fbb65d7b613e8da86d648bbe90f75335c1f72c297d368a695cf4601c719c82c1.jpg)
24
+ Figure 1: (a) Linear classifiers (shown as decision boundaries) learned for a four-class problem on a fully labeled source domain. (b) Problem: classifiers learned on the source domain do not fit the target domain points shown here due to a change in feature distribution. (c) Existing SVM-based methods only adapt the features of classes with labels (crosses and triangles). (d) Our method adapts all points, including those from classes without labels, by transforming all target features to a new domain-invariant representation.
25
+
26
+ Recently proposed feature adaptation methods [1, 2, 12, 13, 14, 15] offer a solution by learning a category-independent feature transform that maps target features into the source, pooling all training labels across categories. This enables multi-class adaptation, i.e. transferring the categoryindependent component of the domain-invariant representation to unlabeled categories. For example, a map learned on the labeled “triangle” class in Figure 1 can also be used to map the unlabeled “star” class to the source domain. An additional advantage of the asymmetric transform method ARC-t [12] over metric learning [1] or the recently proposed Geodesic Flow Kernel (GFK) [15], is that, like HFA [11], ARC-t can map between heterogeneous feature spaces. However, ARC-t has two major limitations: First, the feature learning does not optimize the objective function of a strong, discriminative classifier directly; rather, it maximizes some notion of similarity between the transformed target points and points in the source. Second, it does not scale well to domains with large numbers of points due to the high number of constraints, which is proportional to the product of the number of labeled data points in the source and target.
27
+
28
+ In this paper, we present a novel technique that combines the desirable aspects of recent methods in a single algorithm, which we call Max-Margin Domain Transforms, or MMDT for short. MMDT uses an asymmetric (non-square) transform $W$ to map target features $x$ to a new representation $W x$ maximally aligned with the source, learning the transform jointly on all categories for which target labels are available (Figure 1(d)). MMDT provides a way to adapt max-margin classifiers in a multi-class manner, by learning a shared component of the domain shift as captured by the feature transformation $W$ . Additionally, MMDT can be optimized quickly in linear space, making it a feasible solution for problem settings with a large amount of training data.
29
+
30
+ The key idea behind our approach is to simultaneously learn both the projection of the target features into the source domain and the classifier parameters themselves, using the same classification loss to jointly optimize both.
31
+
32
+ Thus our method learns a feature representation that combines the strengths of max-margin learning with the flexibility of the feature transform. Because it operates over the input features, it can generalize the learned shift in a way that parameter-based methods cannot. On the other hand, it overcomes the two flaws of the ARC-t method: by optimizing the classification loss directly in the transform learning framework, it can achieve higher accuracy; furthermore, replacing similarity constraints with more efficient hyperplane constraints significantly reduces the training time of the algorithm and learning a transformation directly from target to source allows optimization in linear space.
33
+
34
+ The main contributions of our paper can be summarized as follows (also see Table 1):
35
+
36
+ • Experiments show that MMDT in linear feature space outperforms competing methods in terms of multi-class accuracy even compared to previous kernelized methods. • MMDT learns a representation via an asymmetric category independent transform. Therefore, it can adapt features even when the target domain does not have any labeled examples for some categories and when the target and source features are not equivalent.
37
+
38
+ <table><tr><td></td><td>ARC-t [12]</td><td>HFA[11]</td><td>GFK[15]</td><td>MMDT (ours)</td></tr><tr><td>multi-class</td><td>yes</td><td>no</td><td>yes</td><td>yes</td></tr><tr><td>large datasets</td><td>no</td><td>no</td><td>yes</td><td>yes</td></tr><tr><td>heterogeneous features</td><td>yes</td><td>yes</td><td>no</td><td>yes</td></tr><tr><td>optimize max-margin objective</td><td>no</td><td>yes</td><td>no</td><td>yes</td></tr></table>
39
+
40
+ Table 1: Unlike previous methods, our approach is able to simultaneously learn muti-class representations that can transfer to novel classes, scale to large training datasets, and handle different feature dimensionalities.
41
+
42
+ • The optimization of MMDT is scalable to large datasets because the number of constraints to optimize is linear in the number of training data points and because it can be optimized in linear feature space.
43
+
44
+ • Our final iterative solution can be solved using standard QP packages, making MMDT easy to implement.
45
+
46
+ # 2 Related Work
47
+
48
+ Domain adaptation, or covariate shift, is a fundamental problem in machine learning, and has attracted a lot of attention in the machine learning and natural language community, e.g. [16, 17, 18, 19] (see [20] for a comprehensive overview). It is related to multi-task learning but differs from it in the following way: in domain adaptation problems, the distribution over the features $\mathrm { p } ( X )$ varies across domains while the output labels $Y$ remain the same; in multi-task learning or knowledge transfer, $\mathrm { p } ( X )$ stays the same (single domain) while the output labels vary (see [20] for more details). In this paper, we perform multi-task learning across domains, i.e. both $\mathrm { p } ( X )$ and the output labels $Y$ can change between domains.
49
+
50
+ Domain adaptation has been gaining considerable attention in the vision community. Several SVMbased approaches have been proposed for image domain adaptation, including: weighted combination of source and target SVMs and transductive SVMs applied to adaptation in [21]; the feature replication method of [17]; Adaptive SVM [8, 9], where the source model parameters are adapted by adding a perturbation function, and its successor PMT-SVM [10]; Domain Transfer SVM [3], which learns a target decision function while reducing the mismatch in the domain distributions; and a related method [4] based on multiple kernel learning. In the linear case, feature replication [17] can be shown to decompose the learned parameter into $\theta = \widehat { \theta } + \theta ^ { \prime }$ , where $\hat { \theta }$ is shared by all domains [22], in a similar fashion to adaptive SVMs.
51
+
52
+ Several authors considered learning feature representations for unsupervised and transfer learning [23], and for domain adaptation [18, 24]. For visual domain adaptation, transform-based adaptation methods [1, 12, 13, 2, 14, 11] have recently been proposed. These methods attempt to learn a perturbation over the feature space rather than a class-specific perturbation over the model parameters, typically in the form of a transformation matrix/kernel. The most closely related are the ARC-t method [12], which learns a transformation that maximizes similarity constraints between points in the source and those projected from the target domain, and the recent HFA method [11], which learns a transformation both from the source and target into a common latent space, as well as the classifier parameters. Another related method is the recently proposed GFK [15], which computes a symmetric kernel between source and target points based on geodesic flow along a latent manifold. We will present a detailed comparison to these three methods in the next section.
53
+
54
+ # 3 Max-Margin Domain Transforms
55
+
56
+ We propose a novel method for multi-task domain adaptation of linear SVMs by learning a target feature representation. Denote the normal to the affine hyperplane associated with the $k$ ’th binary SVM as $\theta _ { k }$ , $k = 1 , . . . , K$ , and the offset of that hyperplane from the origin as $b _ { k }$ . Intuitively, we would like to learn a new target feature representation that is shared across multiple categories. transformation W T of the source hyperplane parameters θk. Let xs1, . . . , xsnS of the input features, or, equivalently, a denote the training points in the source domain $( \mathcal { D } _ { S } )$ , with labels $y _ { 1 } ^ { s } , \ldots , y _ { n _ { S } } ^ { s }$ . Let $x _ { 1 } ^ { t } , \ldots , x _ { n _ { T } } ^ { t }$ denote the labeled points in the target domain $( \mathcal { D } _ { T } )$ , with labels $y _ { 1 } ^ { t } , \ldots , y _ { n _ { T } } ^ { t }$ . Thus our goal is to jointly learn 1) affine hyperplanes that separate the classes in the common domain consisting of the source domain and target points projected to the source and 2) the new feature representation of the target domain determined by the transformation $W$ mapping points from the target domain into the source domain. The transformation should have the property that it projects the target points onto the correct side of each source hyperplane.
57
+
58
+ For simplicity of presentation, we first show the optimization problem for a binary problem (dropping $k$ ) with no slack variables. Our objective is as follows:
59
+
60
+ $$
61
+ \begin{array} { r l } { \underset { W , \theta , b } { \mathrm { m i n } } \quad } & { \frac { 1 } { 2 } | | W | | _ { F } ^ { 2 } + \frac { 1 } { 2 } | | \theta | | _ { 2 } ^ { 2 } } \\ { \mathrm { s . t . } \quad } & { y _ { i } ^ { s } \left( \left[ x _ { 1 } ^ { s } \right] ^ { T } \left[ \theta \right] \right) \geq 1 \quad \quad \forall i \in \mathcal { D } _ { S } } \\ & { y _ { i } ^ { t } \left( \left[ x _ { 1 } ^ { t } \right] ^ { T } W ^ { T } \left[ \theta \right] \right) \geq 1 \quad \forall i \in \mathcal { D } _ { T } } \end{array}
62
+ $$
63
+
64
+ Note that this can be easily extended to the multi-class case by simply adding a sum over the regularizers on all $\theta _ { k }$ parameters and pooling the constraints for all categories. The objective function, written as in Equations (1)-(3), is not a convex problem and so is both hard to optimize and is not guaranteed to have a global solution. Therefore, a standard way to solve this problem is to do alternating minimization on the parameters, in our case $W$ and $( \theta , b )$ . We can effectively do this because when each parameter vector is fixed, the resulting optimization problem is convex.
65
+
66
+ We begin by re-writing Equations (1)-(3) for the more general problem with soft constraints and $K$ categories. Let us denote the hinge loss as: $\mathcal { L } ( y , x , \theta ) \overset { \cdot } { = } \operatorname* { m a x } \{ 0 , 1 - \delta ( y , k ) \cdot x ^ { T } \theta \}$ . We define a cost function
67
+
68
+ $$
69
+ \begin{array} { l c l } { { { \cal J } ( W , \theta _ { k } , b _ { k } ) } } & { { = } } & { { \displaystyle { \frac { 1 } { 2 } | | W | | _ { F } ^ { 2 } + \sum _ { k = 1 } ^ { K } \left[ \frac { 1 } { 2 } | | \theta _ { k } | | _ { 2 } ^ { 2 } \right. } } } \\ { { } } & { { } } & { { \displaystyle { \left. + C _ { S } \sum _ { i = 1 } ^ { n _ { S } } { \mathcal { L } \left( y _ { i } ^ { s } , \left[ \boldsymbol { \boldsymbol { \chi } } _ { i } ^ { s } \right] { } , \left[ \boldsymbol { \theta } _ { k } \right] { } \right) } + C _ { T } \sum _ { i = 1 } ^ { n _ { T } } { \mathcal { L } \left( y _ { i } ^ { t } , W \cdot \left[ \boldsymbol { \chi } _ { i } ^ { t } \right] , \left[ \boldsymbol { \theta } _ { k } \right] { } \right) } \right] } } } \end{array}
70
+ $$
71
+
72
+ where the constant $C _ { S }$ penalizes the source classification error and $C _ { T }$ penalizes the target adaptation error. Finally, we define our objective function with soft constraints as follows:
73
+
74
+ $$
75
+ \operatorname* { m i n } _ { W , \theta _ { k } , b _ { k } } J ( W , \theta _ { k } , b _ { k } )
76
+ $$
77
+
78
+ To solve the above optimization problem we perform coordinate descent on $W$ and $( \theta , b )$ .
79
+
80
+ 1. Set iteration $j = 0$ , $W ^ { ( j ) } = 0$ .
81
+
82
+ 2. Solve the sub-proble m (θ(j+1)k , b $\begin{array} { r } { ( \theta _ { k } ^ { ( j + 1 ) } , b _ { k } ^ { ( j + 1 ) } ) = \arg \operatorname* { m i n } _ { \theta _ { k } , b _ { k } } J ( W ^ { ( j ) } , \theta _ { k } , b _ { k } ) } \end{array}$
83
+
84
+ $$
85
+ \operatorname* { m i n } _ { \theta , b } \sum _ { k = 1 } ^ { K } \left[ \frac { 1 } { 2 } | | \theta _ { k } | | _ { 2 } ^ { 2 } + C _ { S } \sum _ { i = 1 } ^ { n _ { S } } \mathcal { L } \left( y _ { i } ^ { s } , \left[ \underline { { x } } _ { i } ^ { s } \right] , \left[ \underline { { \theta } } _ { k } ; \right] \right) + C _ { T } \sum _ { i = 1 } ^ { n _ { T } } \mathcal { L } \left( y _ { i } ^ { t } , W ^ { ( j ) } \cdot \left[ \underline { { x } } _ { i } ^ { t } \right] , \left[ \underline { { \theta } } _ { k } \right] \right) \right]
86
+ $$
87
+
88
+ Notice, this corresponds to the standard SVM objective function, except that the target points are first projected into the source using $W ^ { ( j ) }$ . Therefore, we can solve this intermediate problem using a standard SVM solver package.
89
+
90
+ 3. Solve the subproblem $W ^ { ( j + 1 ) } = \arg \operatorname* { m i n } _ { W } J ( W , \theta ^ { ( j + 1 ) } , b ^ { ( j + 1 ) } )$ by solving
91
+
92
+ $$
93
+ \operatorname* { m i n } _ { W } \qquad \frac { 1 } { 2 } | | W | | _ { F } ^ { 2 } + C _ { T } \sum _ { k = 1 } ^ { K } \sum _ { i = 1 } ^ { n _ { T } } \mathcal { L } \left( y _ { i } ^ { t } , W \cdot \left[ x _ { i } ^ { t } \right] , \left[ \theta _ { k } ^ { ( j + 1 ) } \right] \right)
94
+ $$
95
+
96
+ and increment $j$ . This optimization sub-problem is convex and is in a form that a standard QP optimization package can solve.
97
+
98
+ 4. Iterate steps 2 & 3 until convergence.
99
+
100
+ It is straightforward to show that both stages (2) and (3) cannot increase the global cost function $J ( W , \theta , b )$ . Therefore, this algorithm is guaranteed to converge to a local optimum. A proof is included in the supplemental material.
101
+
102
+ It is important to note that since both steps of our iterative algorithm can be solved using standard QP solvers, the algorithm can be easily implemented. Additionally, since the constraints in our algorithm grow linearly with the number of training points and it can be solved in linear feature space, the optimization can be solved efficiently even as the number of training points grows.
103
+
104
+ Relation to existing work: We now analyze the proposed algorithm in the context of the previous feature transform methods ARC-t [12], HFA [11] and GFK [15]. ARC-t introduced similarity-based constraints to learn a mapping similar to that in step 3 in our algorithm. This approach creates a constraint for each labeled point $x _ { i } ^ { s }$ in the source and labeled point $\boldsymbol { x } _ { i } ^ { t }$ in the target, and then learns a transformation $W$ that satisfies constraints of the form $( x _ { i } ^ { s } ) ^ { T } W x _ { i } ^ { t } > u$ if the labels of $\boldsymbol { x } _ { i } ^ { s }$ and $\ v x _ { i } ^ { t }$ are the same, and $( x _ { i } ^ { s } ) ^ { T } W x _ { i } ^ { t } < l$ if the labels are different, for some constants $u , l$ .
105
+
106
+ The ARC-t formulation has two distinct limitations that our method overcomes. First, it must solve $n _ { S } \cdot n _ { T }$ constraints, whereas our formulation only needs to solve $K \cdot n _ { T }$ constraints, for a $K$ category problem. In general, our method scales to much larger source domains than with ARC-t. The second benefit of our max-margin transformation learning approach is that the transformation learned using the max-margin constraints is learned jointly with the classifier, and explicitly seeks to optimize the final SVM classifier objective. While ARC-t’s similarity-based constraints seek to map points of the same category arbitrarily close to one another, followed by a separate classifier learning step, we seek simply to project the target points onto the correct side of the learned hyperplane, leading to better classification performance.
107
+
108
+ The HFA formulation also takes advantage of the max-margin framework to directly optimize the classification objective while learning transformations. HFA learns the classifier and transformations to a common latent feature representation between the source and target. However, HFA is formulated to solve a binary problem so a new feature transformation must be learned for each category. Therefore, unlike MMDT, HFA cannot learn a representation that generalizes to novel target categories. Additionally, due to the difficulty of defining the dimension of the latent feature representation directly, the authors optimize with respect to a larger combined transformation matrix and a relaxed constraint. This transformation matrix becomes too large when the feature dimensions in source and target are large so the HFA must usually be solved in kernel space. This can make the method slow and cause it to scale poorly with the number of training examples. In contrast, our method can be efficiently solved in linear feature space which makes it fast and potentially more scalable.
109
+
110
+ Finally, GFK [15] formulates a kernelized representation of the data that is equivalent to computing the dot product in infinitely many subspaces along the geodesic flow between the source and target domain subspaces. The kernel is defined by the authors to be symmetric and so can not handle source and target domains of different initial dimension. Additionally, GFK does not directly optimize a classification objective. In contrast, our method, MMDT, can handle source and target domains of different feature dimensions via an asymmetric $W$ , as well as directly optimizes the classification objective.
111
+
112
+ # 4 Experiments on Image Datasets
113
+
114
+ We now present experiments using the Office [1], Caltech256 [25] and Bing [21] datasets to evaluate our algorithm according to the following four criteria. 1) Using a subset of the Office and Caltech256 datasets we evaluate multi-class accuracy performance in a standard supervised domain adaptation setting, where all categories have a small number of labeled examples in the target. 2) Using the full Office dataset we evaluate multi-class accuracy for the supervised domain adaptation setting where the source and target have different feature dimensions. 3) Using the full Office dataset we evaluate multi-class accuracy in the multi-task domain adaptation setting with novel target categories at test time. 4) Using the Bing dataset we assess the ability to scale to larger datasets by analyzing timing performance.
115
+
116
+ Table 2: Multi-class accuracy for the standard supervised domain adaptation setting: All results are from our implementation. When averaged across all domain shifts the reported average value for gfk was 51.65 while our implementation had an average of $5 1 . 0 \pm 0 . 7$ . Therefore, the result difference is within the standard deviation over data splits. Red indicates the best result for each domain split. Blue indicates the group of results that are close to the best performing result. The domain names are shortened for space: a: amazon, w: webcam, d: dslr, c: Caltech256
117
+
118
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>svms</td><td rowspan=1 colspan=1>svmt</td><td rowspan=1 colspan=1>arct[12]</td><td rowspan=1 colspan=1>hfa[11]</td><td rowspan=1 colspan=1>gfk[15]</td><td rowspan=1 colspan=1>mmdt (ours)</td></tr><tr><td rowspan=1 colspan=1>a→w</td><td rowspan=1 colspan=1>33.9 ± 0.7</td><td rowspan=1 colspan=1>62.4 ± 0.9</td><td rowspan=1 colspan=1>55.7 ± 0.9</td><td rowspan=1 colspan=1>61.8 ± 1.1</td><td rowspan=1 colspan=1>58.6 ± 1.0</td><td rowspan=1 colspan=1>64.6 ± 1.2</td></tr><tr><td rowspan=1 colspan=1>a→d</td><td rowspan=1 colspan=1>35.0 ±0.8</td><td rowspan=1 colspan=1>55.9 ± 0.8</td><td rowspan=1 colspan=1>50.2 ± 0.7</td><td rowspan=1 colspan=1>52.7 ± 0.9</td><td rowspan=1 colspan=1>50.7 ±0.8</td><td rowspan=1 colspan=1>56.7 ± 1.3</td></tr><tr><td rowspan=1 colspan=1>w→a</td><td rowspan=1 colspan=1>35.7 ± 0.4</td><td rowspan=1 colspan=1>45.6± 0.7</td><td rowspan=1 colspan=1>43.4 ± 0.5</td><td rowspan=1 colspan=1>45.9 ± 0.7</td><td rowspan=1 colspan=1>44.1 ± 0.4</td><td rowspan=1 colspan=1>47.7 ± 0.9</td></tr><tr><td rowspan=1 colspan=1>w→d</td><td rowspan=1 colspan=1>66.6 ± 0.7</td><td rowspan=1 colspan=1>55.1 ± 0.8</td><td rowspan=1 colspan=1>71.3 ± 0.8</td><td rowspan=1 colspan=1>51.7 ± 1.0</td><td rowspan=1 colspan=1>70.5 ± 0.7</td><td rowspan=1 colspan=1>67.0 ± 1.1</td></tr><tr><td rowspan=1 colspan=1>d→a</td><td rowspan=1 colspan=1>34.0 ± 0.3</td><td rowspan=1 colspan=1>45.7 ± 0.9</td><td rowspan=1 colspan=1>42.5 ± 0.5</td><td rowspan=1 colspan=1>45.8 ± 0.9</td><td rowspan=1 colspan=1>45.7 ± 0.6</td><td rowspan=1 colspan=1>46.9 ± 1.0</td></tr><tr><td rowspan=1 colspan=1>d→w</td><td rowspan=1 colspan=1>74.3 ± 0.5</td><td rowspan=1 colspan=1>62.1 ± 0.8</td><td rowspan=1 colspan=1>78.3 ± 0.5</td><td rowspan=1 colspan=1>62.1 ± 0.7</td><td rowspan=1 colspan=1>76.5 ± 0.5</td><td rowspan=1 colspan=1>74.1 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>a→c</td><td rowspan=1 colspan=1>35.1 ± 0.3</td><td rowspan=1 colspan=1>32.0 ±0.8</td><td rowspan=1 colspan=1>37.0 ± 0.4</td><td rowspan=1 colspan=1>31.1 ± 0.6</td><td rowspan=1 colspan=1>36.0 ± 0.5</td><td rowspan=1 colspan=1>36.4 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>w→c</td><td rowspan=1 colspan=1>31.3 ± 0.4</td><td rowspan=1 colspan=1>30.4 ± 0.7</td><td rowspan=1 colspan=1>31.9 ± 0.5</td><td rowspan=1 colspan=1>29.4 ± 0.6</td><td rowspan=1 colspan=1>31.1 ± 0.6</td><td rowspan=1 colspan=1>32.2 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>d→c</td><td rowspan=1 colspan=1>31.4 ± 0.3</td><td rowspan=1 colspan=1>31.7 ± 0.6</td><td rowspan=1 colspan=1>33.5 ± 0.4</td><td rowspan=1 colspan=1>31.0 ± 0.5</td><td rowspan=1 colspan=1>32.9 ± 0.5</td><td rowspan=1 colspan=1>34.1 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>c→a</td><td rowspan=1 colspan=1>35.9 ± 0.4</td><td rowspan=1 colspan=1>45.3 ± 0.9</td><td rowspan=1 colspan=1>44.1 ± 0.6</td><td rowspan=1 colspan=1>45.5 ± 0.9</td><td rowspan=1 colspan=1>44.7 ± 0.8</td><td rowspan=1 colspan=1>49.4 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>c→w</td><td rowspan=1 colspan=1>30.8 ± 1.1</td><td rowspan=1 colspan=1>60.3 ± 1.0</td><td rowspan=1 colspan=1>55.9 ± 1.0</td><td rowspan=1 colspan=1>60.5 ± 0.9</td><td rowspan=1 colspan=1>63.7 ± 0.8</td><td rowspan=1 colspan=1>63.8 ± 1.1</td></tr><tr><td rowspan=1 colspan=1>c→d</td><td rowspan=1 colspan=1>35.6±0.7</td><td rowspan=1 colspan=1>55.8 ± 0.9</td><td rowspan=1 colspan=1>50.6± 0.8</td><td rowspan=1 colspan=1>51.9 ± 1.1</td><td rowspan=1 colspan=1>57.7 ± 1.1</td><td rowspan=1 colspan=1>56.5 ± 0.9</td></tr><tr><td rowspan=1 colspan=1>mean</td><td rowspan=1 colspan=1>40.0±0.6</td><td rowspan=1 colspan=1>48.5± 0.8</td><td rowspan=1 colspan=1>49.5 ± 0.6</td><td rowspan=1 colspan=1>47.4 ± 0.8</td><td rowspan=1 colspan=1>51.0 ± 0.7</td><td rowspan=1 colspan=1>52.5 ± 1.0</td></tr></table>
119
+
120
+ Office Dataset The Office dataset is a collection of images that provides three distinct domains: amazon, webcam, and dslr. The dataset has 31 categories consisting of common office objects such as chairs, backpacks and keyboards. The amazon domain contains product images (from amazon.com) containing a single object, centered, and usually on a white background. The webcam and ${ \tt d s l r }$ domains contain images taken in“the wild” using a webcam or a dslr camera, respectively. They are taken in an office setting and so have different lighting variation and background changes (see Figure 1 for some examples.) We use the SURF-BoW image features provided by the authors [1]. More details on how these features were computed can be found in [1]. The available features are vector quantized to 800 dimensions for all domains and additionally for the dslr domain there are 600 dimensional features available (we denote this as $\mathsf { d s } 1 \mathtt { r } - 6 0 0 \ r { \ r { \ r { \ r { \ r { \ r { \ll } } } } } }$ ).
121
+
122
+ Office $^ +$ Caltech256 Dataset This dataset consists of the 10 common categories shared by the Office and Caltech256 datasets. To better compare to previously reported performance, we use the features provided by [15], which are also SURF-BoW 800 dimensional features.
123
+
124
+ Bing Dataset To demonstrate the effect that constraint set size has on run-time performance, we use the Bing dataset from [21], which has a larger number of images in each domain than Office. The source domain has images from the Bing search engine and the target domain is from the Caltech256 benchmark. We run experiments using the first 20 categories and set the number of source examples per category to be 50. We use the train/test split from [21] and then vary the number of labeled target examples available from 5 to 25.
125
+
126
+ Baselines We use the following baselines as a comparison in the experiments where applicable.1
127
+
128
+ • $\mathbf { s v m } _ { s }$ : A support vector machine using source training data.
129
+ • $\mathbf { s v m } _ { t }$ : A support vector machine using target training data.
130
+ • arc-t: A category general feature transform method proposed by [12]. We implement the transform learning and then apply both a KNN classifier (as originally proposed) and an SVM classifier.
131
+ • hfa: A max-margin transform approach that learns a latent common space between source and target as well as a classifier that can be applied to points in that common space [11].
132
+ • gfk: The geodesic flow kernel [15] applied to all source and target data (including test data). Following [15], we use a 1-nearest neighbor classifier with the kernel.
133
+
134
+ <table><tr><td rowspan=1 colspan=1>source</td><td rowspan=1 colspan=1>target</td><td rowspan=1 colspan=1>svmt</td><td rowspan=1 colspan=1>arc-t</td><td rowspan=1 colspan=1>hfa</td><td rowspan=1 colspan=1>mmdt</td></tr><tr><td rowspan=1 colspan=1>amazon</td><td rowspan=1 colspan=1>dslr-600</td><td rowspan=1 colspan=1>52.9 ± 0.7</td><td rowspan=1 colspan=1>58.2 ± 0.6</td><td rowspan=1 colspan=1>57.8 ± 0.6</td><td rowspan=1 colspan=1>62.3 ± 0.8</td></tr><tr><td rowspan=1 colspan=1>webcam</td><td rowspan=1 colspan=1>dslr-600</td><td rowspan=1 colspan=1>51.8 ± 0.6</td><td rowspan=1 colspan=1>58.2 ± 0.7</td><td rowspan=1 colspan=1>60.0± 0.6</td><td rowspan=1 colspan=1>63.3 ± 0.5</td></tr></table>
135
+
136
+ Table 3: Multiclass accuracy results on the standard supervised domain adaptation task with different feature dimensions in the source and target. The target domain is dslr for both cases.
137
+
138
+ <table><tr><td rowspan=1 colspan=1>source</td><td rowspan=1 colspan=1>svms</td><td rowspan=1 colspan=1>arc-t</td><td rowspan=1 colspan=1>gfk</td><td rowspan=1 colspan=1>mmdt</td></tr><tr><td rowspan=1 colspan=1>amazon</td><td rowspan=1 colspan=1>10.3 ± 0.6</td><td rowspan=1 colspan=1>41.4 ± 0.3</td><td rowspan=1 colspan=1>38.9± 0.4</td><td rowspan=1 colspan=1>44.6 ± 0.3</td></tr><tr><td rowspan=1 colspan=1>webcam</td><td rowspan=1 colspan=1>51.6 ± 0.5</td><td rowspan=1 colspan=1>59.4 ± 0.4</td><td rowspan=1 colspan=1>62.9 ± 0.5</td><td rowspan=1 colspan=1>58.3 ± 0.5</td></tr></table>
139
+
140
+ Table 4: Multiclass accuracy results on the Office dataset for the domain shift of webcam dslr for target test categories not seen in at training time. Following the experimental setup of [12]. We compare against pmt-svm [10] and ARC-t [12] using both knn and svm classification.
141
+
142
+ Standard Domain Adaptation Experiment For our first experiment, we use the Office+Caltech256 domain adaptation benchmark dataset to evaluate multi-class accuracy in the standard domain adaptation setting where a few labeled examples are available for all categories in the target domain. We follow the setup of [1] and [15]: 20 training examples for amazon source (8 for all other domains as source) and 3 labeled examples per category for the target domain. We created 20 random train/test splits and averaged results across them.
143
+
144
+ The multi-class accuracy for each domain pair is shown in Table 2. Our method produced the highest multi-class accuracy for 9 out of 12 of the domain shifts and competitively on the other 3 shifts. This experiment demonstrates that our method achieves a high recognition performance and is able to outperform the most recent domain adaptation algorithms. Our method especially stands out in the settings where the domains are initially very different. The most similar domains in this dataset are webcam and ${ \tt d s l r }$ and we see that our algorithm does not perform as well on those two shifts as gfk. This fits with our intuition since gfk is a 1-nearest neighbor approach and so is more suitable when the domains are initially similar.
145
+
146
+ Additionally, an important observation is that our linear method on average outperforms all the baselines, even though they each learn a non-linear transformation.
147
+
148
+ Asymmetric Transform Experiment Next, we analyze the effectiveness of our asymmetric transform learning by experimenting with the source and target having different feature dimensions. We use the same experimental setup as previously, but use the Office dataset and the alternate representation for the ${ \tt d s l r }$ domain that is 600-dimensional (denoted as $\mathsf { d s } \mathtt { l r } - 6 0 0 \rrangle$ ). We compare against $\mathbf { s v m } _ { t }$ , arc-t and hfa, the baselines that can handle this scenario. The results are shown in Table 3. Again, we find that our method can effectively learn a feature representation for the target domain that optimizes the final classification objective.
149
+
150
+ Generalizing to Novel Categories Experiment We next consider the setting of practical importance where labeled target examples are not available for all objects. Recall that this is a setting that many category specific adaptation methods cannot generalize to, including hfa [11]. Therefore, we compare our results for this setting to the arc-t [12] method which learns a category independent feature transform and the gfk [15] method which learns a category independent kernel to compare the domains. Following the experimental setup of [12], we use the full Office dataset and allow 20 labeled examples per category in the source for amazon and 10 labeled examples for the first 15 object categories in the target (dslr). For the webcam dslr shift, we use 8 labeled examples per category in the source for webcam and 4 labeled examples for the first 15 object categories in the target dslr.
151
+
152
+ The experimental results for the domain shift of webcam dslr are evaluated and shown in Table 4; MMDT outperforms the baselines for the amazon dslr shift and offers adaptive benefit over $\mathbf { s v m } _ { s }$ for the shift from webcam to dslr. As in the first experiment, both arc-t and gfk use nearest neighbor classifiers on a learned kernel are more suitable to the shift between webcam and dslr, which are initially very similar.
153
+
154
+ Scaling to Larger Datasets Experiment With our last experiment we show that our method not only offers high accuracy performance it also scales well with an increasing dataset size. Specifically, the number of constraints our algorithm optimizes scales linearly with the number of training 45points. Conversely, the number of constraints that need to be optimized for the arc-t baseline is quadratic in the number of training points.
155
+
156
+ ![](images/40f89b388e5f8e9ec417c11fb5cdaa170ec5e747a42163d1e90ac8534d3dcdcd.jpg)
157
+ Figure 2: Left: multiclass accuracy on the Bing dataset using 50 training examples in the source and 55varying the number of available labeled examples in the target. Right: training time comparison.
158
+
159
+ To demonstrate the effect that constraint set size has on run-time performance, we use the Bing [21] 35dataset, which has a larger number of images in each domain than Office. The source domain has images from the Bing search engine and the target domain is from the Caltech256 benchmark. We 30run experiments using the first 20 categories and set the number of source examples per category to be 50. We use the train/test split from [21] and then vary the number of labeled target examples Number of Labeled Target Examplesavailable from 5 to 20. The left-hand plot in Figure 2 presents multi-class accuracy for this setup. Additionally, the training time of our method (run to convergence) and that of the baselines is shown on the right-hand plot.
160
+
161
+ Our mmdt method provides a considerable improvement over all the baselines in terms of multiclass accuracy. It is also considerably faster than all but the gfk method. An important point to note is that both our method and arc-t scale approximately linearly with the number of target training points which is empirical verification for our claims. Note that hfa and gfk do not vary significantly as the number of target training points increases. However, for hfa the main bottleneck time is consumed by a distance computation between each pair of training points. Therefore, since there are many more source training points than target, adding a few more target points does not significantly increase the overall time spent for this experiment, but would present a problem as the size of the dataset grew in general.
162
+
163
+ # 5 Conclusion
164
+
165
+ In this paper, we presented a feature learning technique for domain adaptation that combines the ability of feature transform-based methods to perform multi-task adaptation with the performance benefits of directly adapting classifier parameters.
166
+
167
+ We validated the computational efficiency and effectiveness of our method using two standard benchmarks used for image domain adaptation. Our experiments show that 1) our method is a competitive domain adaptation algorithm able to outperform previous methods, 2) is successfully able to generalize to novel target categories at test time, and 3) can learn asymmetric transformations. In addition, these benefits are offered through a framework that is scalable to larger datasets and achieves higher classification accuracy than previous approaches.
168
+
169
+ So far we have focused on linear transforms because of its speed and scalability; however, our method can also be kernelized to include nonlinear transforms. In future work, we would like to explore the kernelized version of our algorithm and especially experiment with the geodesic flow kernel as input to our algorithm.
170
+
171
+ Acknowledgements: This work was supported by NSF grants IIS-1116411 and IIS-1212798, DARPA, and the Toyota Corporation.
172
+
173
+ # References
174
+
175
+ ECCV, 2010.
176
+ [2] A. Farhadi and M. K. Tabrizi. Learning to recognize activities from the wrong view point. In Proc. ECCV, 2008. [3] L. Duan, I. W. Tsang, D. Xu, and S. J. Maybank. Domain transfer svm for video concept detection. In CVPR, 2009.
177
+ [4] L. Duan, D. Xu, I. Tsang, and J. Luo. Visual event recognition in videos by learning from web data. In Proc. CVPR, 2010. [5] A. Torralba and A. Efros. Unbiased look at dataset bias. In Proc. CVPR, 2011.
178
+ [6] D. McAllester P. Felzenszwalb, R. Girshick and D. Ramanan. Object detection with discriminatively trained part based models. IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(9), 2010.
179
+ [7] Lubomir Bourdev and Jitendra Malik. Poselets: Body part detectors trained using 3d human pose annotations. In Proc. ICCV, 2009. [8] J. Yang, R. Yan, and A. Hauptmann. Adapting svm classifiers to data with shifted distributions. In ICDM Workshops, 2007.
180
+ [9] X. Li. Regularized adaptation: Theory, algorithms and applications. In PhD thesis, University of Washington, USA, 2007.
181
+ [10] Y. Aytar and A. Zisserman. Tabula rasa: Model transfer for object category detection. In Proc. ICCV, 2011.
182
+ [11] Lixin Duan, Dong Xu, and Ivor W. Tsang. Learning with augmented features for heterogeneous domain adaptation. In Proc. ICML, 2012.
183
+ [12] B. Kulis, K. Saenko, and T. Darrell. What you saw is not what you get: Domain adaptation using asymmetric kernel transforms. In Proc. CVPR, 2011.
184
+ [13] R. Gopalan, R. Li, and R. Chellappa. Domain adaptation for object recognition: An unsupervised approach. In Proc. ICCV, 2011.
185
+ [14] W. Dai, Y. Chen, G. Xue, Q. Yang, and Y. Yu. Translated learning: Transfer learning across different feature spaces. In Proc. NIPS, 2008.
186
+ [15] B. Gong, Y. Shi, F. Sha, and K. Grauman. Geodesic flow kernel for unsupervised domain adaptation. In Proc. CVPR, 2012.
187
+ [16] J. Blitzer, M. Dredze, and F. Pereira. Biographies, bollywood, boom-boxes and blenders: Domain adaptation for sentiment classification. 2007.
188
+ [17] H. Daume III. Frustratingly easy domain adaptation. In Proc. ACL, 2007.
189
+ [18] S. Ben-david, J. Blitzer, K. Crammer, and O. Pereira. Analysis of representations for domain adaptation. In In NIPS. MIT Press, 2007.
190
+ [19] J. Jiang and C. X. Zhai. Instance weighting for domain adaptation in nlp. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pages 264–271, 2007.
191
+ [20] J. Jiang. A literature survey on domain adaptation of statistical classifiers. http://sifaka.cs. uiuc.edu/jiang4/domain_adaptation/survey/.
192
+ [21] A. Bergamo and L. Torresani. Exploiting weakly-labeled web images to improve object classification: a domain adaptation approach. In Proc. NIPS, 2010.
193
+ [22] W. Jiang, E. Zavesky, S. Chang, and A. Loui. Cross-domain learning methods for high-level visual concept classification. In ICIP, 2008.
194
+ [23] Yoshua Bengio. Deep learning of representations for unsupervised and transfer learning. Journal of Machine Learning Research - Proceedings Track, 27:17–36, 2012.
195
+ [24] John Blitzer, Ryan McDonald, and Fernando Pereira. Domain adaptation with structural correspondence learning. In Proceedings of the 2006 Conference on Empirical Methods in Natural Language Processing, EMNLP ’06, pages 120–128, 2006.
196
+ [25] G. Griffin, A. Holub, and P. Perona. Caltech-256 object category dataset. Technical Report 7694, California Institute of Technology, 2007.
197
+ [26] Chih-Chung Chang and Chih-Jen Lin. LIBSVM: A library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1–27:27, 2011. Software available at http: //www.csie.ntu.edu.tw/˜cjlin/libsvm.
198
+ [27] Rong-En Fan, Kai-Wei Chang, Cho-Jui Hsieh, Xiang-Rui Wang, and Chih-Jen Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.
md/train/BJ8vJebC-/BJ8vJebC-.md ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SYNTHETIC AND NATURAL NOISE BOTH BREAK NEURAL MACHINE TRANSLATION
2
+
3
+ Yonatan Belinkov∗
4
+
5
+ # Yonatan Bisk∗
6
+
7
+ Computer Science and
8
+ Artificial Intelligence Laboratory,
9
+ Massachusetts Institute of Technology
10
+ belinkov@mit.edu
11
+
12
+ Paul G. Allen School of Computer Science & Engineering, University of Washington ybisk@cs.washington.edu
13
+
14
+ # ABSTRACT
15
+
16
+ Character-based neural machine translation (NMT) models alleviate out-ofvocabulary issues, learn morphology, and move us closer to completely end-toend translation systems. Unfortunately, they are also very brittle and easily falter when presented with noisy data. In this paper, we confront NMT models with synthetic and natural sources of noise. We find that state-of-the-art models fail to translate even moderately noisy texts that humans have no trouble comprehending. We explore two approaches to increase model robustness: structure-invariant word representations and robust training on noisy texts. We find that a model based on a character convolutional neural network is able to simultaneously learn representations robust to multiple kinds of noise.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ Humans have surprisingly robust language processing systems that can easily overcome typos, misspellings, and the complete omission of letters when reading (Rawlinson, 1976). A particularly extreme and comical exploitation of our robustness came years ago in the form of a popular meme:
21
+
22
+ “Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn’t mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae.”
23
+
24
+ A person’s ability to read this text comes as no surprise to the psychology literature. Saberi & Perrott (1999) found that this robustness extends to audio as well. They experimented with playing parts of audio transcripts backwards and found that it did not affect comprehension. Rayner et al. (2006) found that in noisier settings reading comprehension only slowed by $11 \%$ . McCusker et al. (1981) found that the common case of swapping letters could often go unnoticed by the reader. The exact mechanisms and limitations of our understanding system are unknown. There is some evidence that we rely on word shape (Mayall et al., 1997), that we can switch between whole word recognition and piecing together words from letters (Reicher, 1969; Pelli et al., 2003), and there appears to be no evidence that the first and last letter positions are required to stay constant for comprehension.1
25
+
26
+ In stark contrast, neural machine translation (NMT) systems, despite their pervasive use, are immensely brittle. For instance, Google Translate produces the following unintelligible translation for a German version of the above meme:2
27
+
28
+ “After being stubbornly defiant, it is clear to kenie Rlloe in which Reiehnfogle is advancing the boulders in a Wrot that is integral to Sahce, as the utterance and the lukewarm boorstbaen stmimt.”
29
+
30
+ While typos and noise are not new to NLP, our systems are rarely trained to explicitly address them, as we instead hope that the relevant noise will occur in the training data.
31
+
32
+ Despite these weaknesses, the move to character-based NMT is important. It helps us tackle the long tailed distribution of out-of-vocabulary words in natural language, as well as reduce computation
33
+
34
+ load of dealing with large word embedding matrices. NMT models based on characters and other0 34.22 0 34.22 0 34.22 40
35
+ sub-word units are able to extract stem and morphological information to generalize to unseen words 15.3 21.77 10.4 25.59 7.6 28.52
36
+ and conjugations. They perform very well in practice on a range of languages (Sennrich et al.,23.2 15.73 15.3 21.56 11.4 25.42 30
37
+ 2016a; Wu et al., 2016). In many cases, these models actually discover an impressive amount of30.8 11.45 20.6 17.91 15.2 22.60
38
+ morphological information about a language (Belinkov et al., 2017a). Unfortunately, training (and46.3 5.28 30.3 12.22 22.6 17.62
39
+ testing) on clean data makes models brittle and, arguably, unfit for broad deployment.53.6 3.19 35.8 9.49 26.2 16.52
40
+
41
+ Figure 1 shows how the performance of two state-of-the-art NMT systems degrades when translating69.1 0.84 45.7 5.36 34.0 12.02 10 German to English as a function of the percent of German words modified. Here we show three types76.7 0.29 51.1 3.39 37.8 10.68 of noise: 1) Random permutation of the word, 2) Swapping a pair of adjacent letters, and 3) Natural0 human errors. We discuss these types of noise and others in depth in section 4.2. The important thing to note is that even small amounts of noise lead to substantial drops in performance.Random Swap Natural
42
+
43
+ ![](images/a0eaf407647ec50ed9174c02e7a537177a58014aa3549a2a542b4922c39bd813.jpg)
44
+ Random Swap NaturalChar2Char Char2CharFigure 1: Degradation of Nematus (Sennrich et al., 2017) and char2char (Lee et al., 2017) 40 Nematusperformance as noise increases.
45
+
46
+ 30 52.5x+68.2To address these trends and investigate the effects of noise on NMT, we explore two simple strategies
47
+ 0 68.2 0 68.2 0 68.2 0 68.2for increasing model robustness: using structure-invariant representations and robust training on
48
+ 20 35.015.3 55.8 10.4 59.9 7.6 62.7 20 54.56noisy data, a form of adversarial training (Szegedy et al., 2014; Goodfellow et al., 2015). We find
49
+ 23.2 49.6 15.3 55.7 11.4 59.6 30 47.74that a character CNN representation trained on an ensemble of noise types is robust to all kinds of
50
+ 38.0 38.5 25.9 48.8 18.8 53.6 50 34.1noise. We shed some light on the model ability to learn robust representations to multiple types of
51
+ 46.3 33.0 30.3 45.6 22.6 51.3 60 27.28noise, and point to remaining difficulties in handling natural noise. Our goal is two fold: 1) initiate
52
+ 53.6 27.4 35.8 41.6 26.2 49.3 70 20.46a conversation on robust training and modeling techniques in NMT, and 2) promote the creation of
53
+ 0 20 40 60 80 069.1 17.7 45.7 34.3 34.0 43.5 90 6.82better and more linguistically accurate artificial noise to be applied to new languages and tasks.
54
+
55
+ # 2 ADVERSARIAL EXAMPLES
56
+
57
+ char2charThe growing literature on adversarial examples has demonstrated how dangerous it can be to use y = Random Swap Natural Linear y = (-66/100brittle machine learning systems so pervasively in the real world (Biggio et al., 2012; Szegedy et al., x+68.2 )x + 662014; Goodfellow et al., 2015; Mei & Zhu, 2015). Small changes to the input can lead to dramatic 0 68.2 7.7 60.6 5.2 63.3 3.7 64.2 10 59.4failures of deep learning models (Szegedy et al., 2014; Goodfellow et al., 2015). In the machine 20 54.56 15.3 55.3 10.4 60.2 7.6 62.4 20 52.8vision field, changes to the input image that are indistinguishable by humans can lead to misclas30 47.74 23.2 49.5 15.3 57.3 11.4 60.3 30 46.230.8 43.6 20.6 54.2 15.2 58.0 40 39.6sification. This leads to potential for malicious attacks using adversarial examples. An important 40 40.9250 34.1 38.0 38.3 25.9 51.5 18.8 56.7 50 33distinction is often drawn between white-box attacks, where adversarial examples are generated with 60 27.28 46.3 33.3 30.3 48.3 22.6 54.7 60 26.4access to the model parameters, and black-box attacks, where examples are generated without such 70 20.46 61.5 23.2 40.9 42.2 30.1 50.7 80 13.2access (Papernot et al., 2016a; 2017; Narodytska & Kasiviswanathan, 2017; Liu et al., 2017).
58
+
59
+ 90 6.82 76.7 14.1 51.1 35.8 37.8 46.3 100 0While more common in the vision domain, recent work has started exploring adversarial examples for NLP. A few white-box attacks have employed the fast gradient sign method (Goodfellow et al., 2015) or other techniques to find important text edit operations (Papernot et al., 2016b; Samanta & Mehta, 2017; Liang et al., 2017; Ebrahimi et al., 2017). Others have considered black-box adversarar y = ial examples for text classification (Gao et al., 2018) or NLP evaluation (Jia & Liang, 2017). Heigold )x + 66et al. (2017) evaluated character-based models on several types of noise in morphological tagging 0 66and MT, and observed similar trends to our findings. Finally, Sakaguchi et al. (2017) designed a 20 52.8character-level recurrent neural network that can better handle the particular kind of noise present 30 46.2in the meme mentioned above by modeling spelling correction. Here we devise simple methods 40 39.650 33for generating adversarial examples for NMT. We do not assume any access to the NMT models’ 60 26.4gradients, instead relying on synthetic and naturally occurring language errors to generate noise.
60
+
61
+ The other side of the coin is to improve models’ robustness to adversarial examples (Globerson & Roweis, 2006; Cretu et al., 2008; Rubinstein et al., 2009; Chan et al., 2017). Adversarial training – including adversarial examples in the training data – can improve a model’s ability to cope with such examples at test time (Szegedy et al., 2014; Goodfellow et al., 2015). This kind of defense is sensitive to the type of adversarial examples seen in training, but can be made more robust by ensemble adversarial training – training on examples transfered from multiple pre-trained models (Tramer\` et al., 2017). We explore ensemble training by combining multiple types of noise at training time, and observe similar increased robustness in the machine translation scenario.
62
+
63
+ Training on and for adversarial noise is an important extension of earlier work on creating robustness in neural networks by incorporating noise to a network’s representations, data, or gradients. Training with noise can provide a form of regularization (Bishop, 1995) and ensure the model is exposed to samples outside the training distribution (Matsuoka, 1992).
64
+
65
+ # 3 MT SYSTEMS
66
+
67
+ The rise of end-to-end models in neural machine translation has led to recent interest in understanding how these models operate. Several studies investigated the ability of such models to learn linguistic properties at morphological (Vylomova et al., 2016; Belinkov et al., 2017a; Dalvi et al., 2017), syntactic (Shi et al., 2016; Sennrich, 2017), and semantic levels (Belinkov et al., 2017b). The use of characters or other sub-word units emerges as an important component in these models. Our work complements previous studies by presenting such NMT systems with noisy examples and exploring methods for increasing their robustness.
68
+
69
+ We experiment with three different NMT systems with access to character information at different levels. First, we use the fully character-level model of Lee et al. (2017). This is a sequence-tosequence model with attention (Sutskever et al., 2014; Bahdanau et al., 2014) that is trained on characters to characters (char2char). It has a complex encoder with convolutional, highway, and recurrent layers, and a standard recurrent decoder. See Lee et al. (2017) for architecture details. This model was shown to have excellent performance on the German English and Czech English language pairs. We use the pre-trained German/Czech English models.
70
+
71
+ Second, we use Nematus (Sennrich et al., 2017), a popular NMT toolkit that was used in topperforming contributions in shared MT tasks in WMT (Sennrich et al., 2016b) and IWSLT (JunczysDowmunt & Birch, 2016). It is another sequence-to-sequence model with several architecture modifications, especially operating on sub-word units using byte-pair encoding (BPE) (Sennrich et al., 2016a). We experimented with both their single best and ensemble BPE models, but saw no significant difference in their performance under noise, so we report results with their single best WMT models for German/Czech English.
72
+
73
+ Finally, we train an attentional sequence-to-sequence model with a word representation based on a character convolutional neural network (charCNN). This model retains the notion of a word but learns a character-dependent representation of words. It was shown to perform well on morphologically-rich languages (Kim et al., 2015; Belinkov & Glass, 2016; Costa-jussa & Fonol- \` losa, 2016; Sajjad et al., 2017), thanks to its ability to learn morphologically-informative representations (Belinkov et al., 2017a). The charCNN model has two long short-term memory (Hochreiter & Schmidhuber, 1997) layers in the encoder and decoder. A CNN over characters in each word replaces the word embeddings on the encoder side (for simplicity, the decoder is word-based). We use 1000 filters with a width of 6 characters. The character embedding size is set to 25. The convolutions are followed by Tanh and max-pooling over the length of the word (Kim et al., 2015). We train charCNN with the implementation in Kim (2016); all other settings are kept to default values.
74
+
75
+ # 4 DATA
76
+
77
+ # 4.1 MT DATA
78
+
79
+ We use the TED talks parallel corpus prepared for IWSLT 2016 (Cettolo et al., 2012) for testing all of the NMT systems, as well as for training the charCNN models. We follow the official training/development/test splits. All texts are tokenized with the Moses tokenizer. Table 1 summarizes statistics on the TED talks corpus.
80
+
81
+ Table 1: Statistics for the source-side of French/German/Czech English parallel corpora.
82
+
83
+ <table><tr><td></td><td colspan="3">French</td><td colspan="3">German</td><td colspan="3">Czech Test</td></tr><tr><td></td><td>Train</td><td>Dev</td><td>Test</td><td>Train</td><td>Dev</td><td>Test</td><td>Train</td><td>Dev</td></tr><tr><td>Sentences</td><td>235K</td><td>2.5K</td><td>0.8K</td><td>210K</td><td>2.5K</td><td>1.4K</td><td>122K</td><td>20K 1K</td></tr><tr><td>Words</td><td>5.2M</td><td>55K</td><td>16K</td><td>4M</td><td>50K</td><td>26K</td><td>2.1M 35K</td><td>15K</td></tr></table>
84
+
85
+ Table 2: Average number of available edits per word in natural noise datasets and the corresponding token recall of those edits on the training and test splits.
86
+
87
+ <table><tr><td colspan="3">French</td><td colspan="3">German</td><td colspan="3">Czech</td></tr><tr><td>Words</td><td>Errors Train</td><td>Test</td><td>Words</td><td>Errors</td><td>Train Test</td><td></td><td>Words Errors</td><td>Train Test</td></tr><tr><td>65,156</td><td>2.7</td><td>40% 41%</td><td>1,344</td><td>2.5</td><td>37%</td><td>40%</td><td>6.036 2.6</td><td>46% 51%</td></tr></table>
88
+
89
+ # 4.2 NOISE: NATURAL AND ARTIFICIAL
90
+
91
+ We insert noise into the source-side of the parallel MT data by utilizing naturally occurring errors and generating synthetic ones. In order to facilitate future work on noise in NMT, we release code and data for generating the noise used in our experiments.3
92
+
93
+ # 4.2.1 NATURAL NOISE
94
+
95
+ Since we do not have access to a parallel corpus with natural noise, we instead harvest naturally occurring errors (typos, misspellings, etc.) from available corpora of edits to build a look-up table of possible lexical replacements. In this work, we restrict ourselves to single word replacements, but several of the corpora below also provide access to phrase replacements.
96
+
97
+ French Max & Wisniewski (2010) collected Wikipedia edit histories to form the Wikipedia Correction and Paraphrase Corpus (WiCoPaCo). They found the bulk of edits were due to incorrect diacritics, choosing the wrong homophone, and incorrect grammatical conjugation.
98
+
99
+ German Our German data combines two projects: RWSE Wikipedia Revision Dataset (Zesch, 2012) and The MERLIN corpus of language learners (Wisniewski et al., 2013). These corpora were created to measure spelling difficulty and test models of contextual fitness. Unfortunately, the datasets are quite small so we have combined them here.
100
+
101
+ Czech Our Czech errors come from manually annotated essays written by non-native speakers (Sebesta et al. ˇ , 2017). Here, the authors found an incredibly diverse set of errors, and therefore phenomena of interest: capitalization, incorrectly replacing voiced and voiceless consonants (e.g. z/s, $\mathrm { g / k } )$ ), missing palatalization (matke/matce), error in valence, pronominal reference, inflection, collo- ˇ quial forms, and so forth. Their analysis gives us the best insight into how difficult it would be to synthetically generate truly natural errors. We found similarly rich errors in German (Section 7.2).
102
+
103
+ We insert these errors into the source-side of the parallel data by replacing every word in the corpus with an error if one exists in our dataset. When there is more than one possible replacement to choose we sample uniformly. Words for which there is no error are kept as is. Table 2 shows the number of words for which we were able to collect errors in each language, and the average number of errors per word. Despite the small size of the German and Czech datasets, we are able to replace up to half of the words in the corpus with errors. Due to the small size of the German and Czech datasets these percentages decrease for longer words $\cdot > 4$ characters) to $2 5 \%$ and $32 \%$ , respectively.
104
+
105
+ # 4.2.2 SYNTHETIC NOISE
106
+
107
+ In addition to naturally collected sources of error, we also experiment with four types of synthetic noise: Swap, Middle Random, Fully Random, and Keyboard Typo.
108
+
109
+ Table 3: The effect of Natural (Nat) and synthetic noise (Swap swap, Middle Random Mid, Fully Random Rand, and Keyboard Typo Key) on models trained on clean (Vanilla) texts.
110
+
111
+ <table><tr><td rowspan="2"></td><td colspan="6">Synthetic</td></tr><tr><td></td><td>Vanilla</td><td>Swap Mid</td><td>Rand</td><td>Key</td><td>Nat</td></tr><tr><td>French</td><td>charCNN</td><td>42.54</td><td>10.52</td><td>9.71</td><td>1.71 8.26</td><td>17.42</td></tr><tr><td rowspan="3">German</td><td>charCNN</td><td>34.79</td><td>9.25</td><td>8.37 1.02</td><td>6.40</td><td>14.02</td></tr><tr><td>char2char</td><td>29.97</td><td>5.68</td><td>5.46 0.28</td><td>2.96</td><td>12.68</td></tr><tr><td>Nematus</td><td>34.22</td><td>3.39</td><td>5.16</td><td>0.29 0.61</td><td>10.68</td></tr><tr><td rowspan="3">Czech</td><td>charCNN</td><td>25.99</td><td>6.56</td><td>6.67</td><td>1.50 7.13</td><td>10.20</td></tr><tr><td>char2char</td><td>25.71</td><td>3.90</td><td>4.24</td><td>0.25 2.88</td><td>11.42</td></tr><tr><td>Nematus</td><td>29.65</td><td>2.94</td><td>4.09</td><td>0.66 1.41</td><td>11.88</td></tr></table>
112
+
113
+ Table 4: An example noisy text with human and machine translations.
114
+
115
+ <table><tr><td>Input</td><td>Luat eienr Stduie der Cambrdige Unievrstit speilt es kenie Rlloe in welcehr Reiehnfogle die Buhcstbaen in eniem Wrot vorkmomen,die eingzie whctige Sahce ist,dsas der ertse und der lettze Buhcstbaen stmimt .</td></tr><tr><td>Human</td><td>According to a study from Cambridge university, it doesn&#x27;t matter which order letters in a word are,the only important thing is that the first and the last letter appear in their correct place. Cambridge Universtte is one of the most important features of the Cambridge Universttten ,</td></tr><tr><td>char2char Nematus</td><td>which is one of the most important features of the Cambridge Universttten . Luat eienr Stduie der Cambrant Unievrstilt splashed it kenie Rlloe in welcehr Reiehnfogle the</td></tr><tr><td>charCNN</td><td>Buhcstbaen in eniem Wred vorkmomen,die eingzie whcene Sahce ist,DSAs der ertse und der lettze Buhcstbaen stmimt . According to the &lt;unk&gt;of the Cambridge University,it &#x27;s a litle bit of crude oil in a little bit of recycling ,which is a little bit of acool cap,which is a little bit of a strong cap,that the</td></tr></table>
116
+
117
+ Swap : Swap The simplest source of noise is swapping two letters (e.g. noise nosie). This is common when typing quickly and is easily implemented. We perform one swap per word, but do not alter the first or last letters. For this reason, this noise is only applied to words of length $\geq 4$ .
118
+
119
+ Middle Random : Mid Following the claims of the previously discussed meme, we randomize the order of all the letters in a word except for the first and last (noise nisoe). Again, by necessity, this means we do not alter words shorter than four characters.
120
+
121
+ Fully Random : Rand As we are unaware of any strong results on the importance of the first and last letters we also include completely randomized words (noise iones). This is a particularly extreme case, but we include it for completeness. This type of noise is applied to all words.
122
+
123
+ Keyboard Typo : Key Finally, using the traditional keyboards for our languages, we randomly replace one letter in each word with an adjacent key (noise noide). This type of error should be much easier than the random settings as most of the word is left intact, but does introduce a completely new character which will often break the templates a system has learned to rely on.
124
+
125
+ # 5 FAILURES TO TRANSLATE NOISY TEXTS
126
+
127
+ Table 3 shows BLEU scores of models trained on clean (Vanilla) texts and tested on clean and noisy texts. All models suffer a significant drop in BLEU when evaluated on noisy texts. This is true for both natural noise and all kinds of synthetic noise. The more noise in the text, the worse the translation quality, with random scrambling producing the lowest BLEU scores.
128
+
129
+ The degradation in translation quality is especially severe in light of humans’ ability to understand noisy texts. To illustrate this, consider the noisy text in Table 4. Humans are quite good at understanding such scrambled texts in a variety of languages.4 We also verified this by obtaining a translation from a German native-speaker, unfamiliar with the meme. As shown in the table, the speaker had no trouble understanding and translating the sentence properly. In contrast, the state-ofthe-art systems (char2char and Nematus) fail on this text.
130
+
131
+ Table 5: Google Translate’s performance with natural errors and the gains from using spell checking.
132
+
133
+ <table><tr><td colspan="3">French</td><td colspan="3">German</td><td colspan="3">Czech</td></tr><tr><td>Vanilla</td><td>Nat</td><td>Spelling</td><td>Vanilla</td><td>Nat</td><td>Spelling</td><td>Vanilla</td><td>Nat</td><td>Spelling</td></tr><tr><td>43.3</td><td>16.7</td><td>21.4</td><td>38.7</td><td>18.6</td><td>25.0</td><td>26.5</td><td>12.3</td><td>11.2</td></tr></table>
134
+
135
+ Table 6: Results of meanChar models trained and tested on different noise conditions: Scrambled (Scr), Keyboard Typo (Key), and Natural (Nat).
136
+
137
+ <table><tr><td rowspan="2">Test Train</td><td colspan="3">French</td><td colspan="3">German</td><td colspan="3">Czech</td></tr><tr><td>Scr</td><td>Key</td><td>Nat</td><td>Scr</td><td>Key</td><td>Nat</td><td>Scr</td><td>Key</td><td>Nat</td></tr><tr><td>Vanilla</td><td>34.26</td><td>4.27</td><td>12.58</td><td>27.53</td><td>3.34</td><td>9.41</td><td>3.73</td><td>2.06</td><td>3.25</td></tr><tr><td>Key</td><td>31.88</td><td>29.75</td><td>13.16</td><td>10.04</td><td>8.84</td><td>4.45</td><td>2.03</td><td>1.9</td><td>1.42</td></tr><tr><td>Nat</td><td>26.94</td><td>5.30</td><td>27.49</td><td>15.65</td><td>3.06</td><td>26.26</td><td>1.66</td><td>1.52</td><td>1.58</td></tr><tr><td>Rand+Key</td><td>13.60</td><td>11.09</td><td>6.12</td><td>26.59</td><td>22.41</td><td>11.07</td><td>9.97</td><td>7.48</td><td>4.21</td></tr><tr><td>Rand+Nat</td><td>28.28</td><td>5.10</td><td>20.40</td><td>13.87</td><td>3.73</td><td>12.74</td><td>4.89</td><td>2.82</td><td>3.42</td></tr><tr><td>Key+Nat</td><td>31.30</td><td>26.94</td><td>24.24</td><td>6.62</td><td>5.41</td><td>5.75</td><td>1.62</td><td>1.68</td><td>1.58</td></tr><tr><td>Rand+Key+Nat</td><td>3.10</td><td>3.28</td><td>2.76</td><td>8.02</td><td>5.79</td><td>6.36</td><td>1.73</td><td>1.74</td><td>1.66</td></tr></table>
138
+
139
+ One natural question is if robust spell checkers trained on human errors are sufficient to address this performance gap. To test this, we ran texts with and without natural errors through Google Translate. We then used Google’s spell-checkers to correct the documents. We simply accepted the first suggestion for every detected mistake detected, and report results in Table 5.
140
+
141
+ We found that in French and German, there was often only a single predicted correction and this corresponds to roughly $+ 5$ or more in BLEU. In Czech, however, there was often a large list of possible conjugations and changes, likely indicating that a rich grammatical model would be necessary to predict the correction. It is also important to note the substantial drops from vanilla text even with spell check. This suggests that natural noise cannot be easily addressed by existing tools.
142
+
143
+ # 6 DEALING WITH NOISE
144
+
145
+ # 6.1 STRUCTURE INVARIANT REPRESENTATIONS
146
+
147
+ The three NMT models are all sensitive to word structure. The char2char and charCNN models both have convolutional layers on character sequences, designed to capture character n-grams. The model in Nematus is based on sub-word units obtained with BPE. It thus relies on character order within and across sub-word units. All these models are therefore sensitive to types of noise generated by character scrambling (Swap, Mid, and Rand). Can we improve model robustness by adding invariance to these kinds of noise? Perhaps the simplest such model is to take the average character embedding as a word representation. This model, referred to as meanChar, first generates a word representation by averaging character embeddings, and then proceeds with a word-level encoder similar to the charCNN model. The meanChar model is by definition insensitive to scrambling, although it is still sensitive to other kinds of noise (Key and Nat).
148
+
149
+ Table 6 (first row) shows the results of meanChar models trained on vanilla texts and tested on noisy texts (the results on vanilla texts are by definition equal to those on scrambled texts). Overall, the average character embedding proves to be a pretty good representation for translating scrambled texts: while performance drops by about 7 BLEU points below charCNN on vanilla French and German, it is much better than charCNN’s performance on scrambled texts (compare to Table 3). The results of meanChar on Czech are much worse, possibly due to its more complex morphology. However, the meanChar model performance degrades quickly on other kinds of noise as the model trained on vanilla texts was not designed to handle Nat and Key types of noise.
150
+
151
+ Table 7: Results of charCNN models trained and tested on different noise conditions.
152
+
153
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>TestTrain</td><td rowspan=1 colspan=1>Vanilla</td><td rowspan=1 colspan=1>Swap Mid Rand Key Nat</td><td rowspan=1 colspan=1>Ave</td></tr><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=2>Swap</td><td rowspan=1 colspan=1>39.01</td><td rowspan=1 colspan=1>42.56 33.64 2.72 4.85 16.43</td><td rowspan=1 colspan=1>23.20</td></tr><tr><td rowspan=1 colspan=2>Mid</td><td rowspan=1 colspan=1>42.46</td><td rowspan=1 colspan=1>42.19 42.17 3.36 6.20 18.22</td><td rowspan=1 colspan=1>25.77</td></tr><tr><td rowspan=7 colspan=1>French</td><td rowspan=2 colspan=2>RandKey</td><td rowspan=1 colspan=1>39.53</td><td rowspan=1 colspan=1>39.46 39.13 39.73 3.11 16.63</td><td rowspan=1 colspan=1>29.60</td></tr><tr><td rowspan=1 colspan=1>38.49</td><td rowspan=1 colspan=1>10.56 8.69 1.08 38.88 16.86</td><td rowspan=1 colspan=1>19.10</td></tr><tr><td rowspan=1 colspan=2>Nat</td><td rowspan=1 colspan=1>28.77</td><td rowspan=1 colspan=1>12.45 8.39 1.03 6.61 36.00</td><td rowspan=1 colspan=1>15.54</td></tr><tr><td rowspan=2 colspan=2>Rand +KeyRand+Nat</td><td rowspan=1 colspan=1>39.23</td><td rowspan=1 colspan=1>38.85 38.89 39.13 38.22 18.71</td><td rowspan=1 colspan=1>35.51</td></tr><tr><td rowspan=1 colspan=1>36.86</td><td rowspan=1 colspan=1>38.95 38.44 38.63 6.67 33.89</td><td rowspan=1 colspan=1>32.24</td></tr><tr><td rowspan=2 colspan=2>Key+NatRand+Key+Nat</td><td rowspan=2 colspan=1>38.4736.97</td><td rowspan=1 colspan=1>17.33 10.54 1.52 38.62 34.66</td><td rowspan=2 colspan=1>23.5235.70</td></tr><tr><td rowspan=1 colspan=1>36.92 36.65 36.64 35.25 31.77</td></tr><tr><td rowspan=7 colspan=1>German</td><td rowspan=3 colspan=2>SwapMidRand</td><td rowspan=1 colspan=1>32.66</td><td rowspan=1 colspan=1>34.76 29.03 2.19 4.78 13.37</td><td rowspan=1 colspan=1>19.47</td></tr><tr><td rowspan=3 colspan=2>MidRandKey</td><td rowspan=1 colspan=1>34.32</td><td rowspan=1 colspan=1>34.26 34.27 3.50 5.08 14.43</td><td rowspan=1 colspan=1>20.98</td></tr><tr><td rowspan=1 colspan=1>33.65</td><td rowspan=1 colspan=1>33.44 33.75 33.56 3.00 14.47</td><td rowspan=1 colspan=1>25.31</td></tr><tr><td rowspan=1 colspan=1>32.87</td><td rowspan=1 colspan=1>10.13 8.39 1.16 33.28 13.88</td><td rowspan=1 colspan=1>16.62</td></tr><tr><td rowspan=3 colspan=2>NatRand+KeyRand+NatKey +NatRand+Key+Nat</td><td rowspan=1 colspan=1>25.79</td><td rowspan=1 colspan=1>8.20 5.73 0.93 4.80 34.59</td><td rowspan=1 colspan=1>13.34</td></tr><tr><td rowspan=2 colspan=1>32.0332.3730.3931.29</td><td rowspan=1 colspan=1>31.57 31.32 31.58 31.23 15.5932.40 31.91 32.11 4.77 33.00</td><td rowspan=2 colspan=1>28.8927.7620.0230.70</td></tr><tr><td rowspan=1 colspan=1>13.51 8.99 1.53 32.23 33.4630.93 30.54 30.04 29.81 31.60</td></tr><tr><td rowspan=9 colspan=1>Czech</td><td rowspan=9 colspan=2>SwapMidRandKeyNatRand+KeyRand+NatKey+NatRand+Key+Nat</td><td rowspan=1 colspan=1>24.22</td><td rowspan=1 colspan=1>24.90 18.72 2.72 6.00 9.03</td><td rowspan=1 colspan=1>14.27</td></tr><tr><td rowspan=1 colspan=1>23.81</td><td rowspan=1 colspan=1>24.52 24.08 3.96 6.34 9.54</td><td rowspan=1 colspan=1>15.38</td></tr><tr><td rowspan=1 colspan=1>23.44</td><td rowspan=1 colspan=1>23.31 23.24 23.47 3.70 8.10</td><td rowspan=1 colspan=1>17.54</td></tr><tr><td rowspan=1 colspan=1>23.15</td><td rowspan=1 colspan=1>7.06 6.04 1.56 22.80 10.16</td><td rowspan=1 colspan=1>11.80</td></tr><tr><td rowspan=1 colspan=1>18.04</td><td rowspan=1 colspan=1>5.36 4.48 1.47 6.71 21.64</td><td rowspan=1 colspan=1>9.62</td></tr><tr><td rowspan=1 colspan=1>21.46</td><td rowspan=1 colspan=1>20.81 20.90 20.59 19.48 8.72</td><td rowspan=1 colspan=1>18.66</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>20.59</td><td rowspan=1 colspan=1>21.56 20.49 20.53 5.89 18.39</td><td rowspan=1 colspan=1>17.91</td></tr><tr><td rowspan=1 colspan=1>19.55</td><td rowspan=1 colspan=1>6.59 5.72 1.40 21.31 19.54</td><td rowspan=1 colspan=1>12.35</td></tr><tr><td rowspan=1 colspan=1>21.30</td><td rowspan=1 colspan=1>21.33 20.38 19.94 19.25 18.38</td><td rowspan=1 colspan=1>20.10</td></tr></table>
154
+
155
+ # 6.2 BLACK-BOX ADVERSARIAL TRAINING
156
+
157
+ To increase model robustness we follow a black-box adversarial training scenario, where the model is presented with adversarial examples that are generated without direct access to the model (Papernot et al., 2016a; 2017; Liu et al., 2017; Narodytska & Kasiviswanathan, 2017; Jia & Liang, 2017). We replace the original training set with a noisy training set, where noise is introduced according to the description in Section 4.2. The noisy training set has exactly the same number of sentences and words as the training set. We have one fixed noisy training set per each noise type.5
158
+
159
+ As shown in Table 6 (second block), training on noisy text can lead to improved performance. The meanChar models trained on Key perform well on Key in French, but not in the other languages. The models trained on Nat perform well in French and German, but not in Czech. Overall, training the meanChar model on noisy text does not appear to consistently increase its robustness to different kinds of noise. The meanChar model however was not expected to perform well on nonscrambling types of noise. Next we test whether the more complicated charCNN model is more robust to different kinds of noise, by training on noisy texts. The results are shown in Table 7.
160
+
161
+ In general, charCNN models that are trained on a specific kind of noise perform well on the same kind of noise at test time (results in bold). All models also maintain a fairly good quality on vanilla texts.The robust training is sensitive to the kind of noise. Among the scrambling methods (Swap/Mid/Rand), more noise helps in training: models trained on random noise can still translate Swap/Mid noise, but not vice versa. The three broad classes of noise (scrambling, Key, Nat)
162
+
163
+ ![](images/38b5ca4f366595dec304b147eaa23d2f595cb687cb7abe7b6e0838a1b0a860ea.jpg)
164
+ Figure 2: Variances of charCNN weights when trained on only Key, Natural, Random noise and on a mix of all three are shown in red, green, blue, and white, respectively
165
+
166
+ are not mutually-beneficial. Models trained on one do not perform well on the others. In particular, 1only models trained on natural noise can reasonably translate natural noise at test time. We find this result indicates an important difference between computational models and human performance, since humans can decipher random letter orderings without explicit training of this form.
167
+
168
+ Next, we test whether we can increase training robustness by exposing the model to multiple types of noise during training. Our motivation is to see if models can perform well on more than one kind of noise. We therefore mix up to three kinds of noise by sampling a noise method uniformly at random for each sentence. We then train a model on the mixed noisy training set and test it on both vanilla and (unmixed) noisy versions of the test set. We find that models trained on mixed noise are slightly worse than models trained on unmixed noise. However, the models trained on mixed noise are robust to the specific types of noise they were trained on. In particular, the model trained on a mix of Rand, $\operatorname { K e y }$ , and Nat noise is robust to all noise kinds. Even though it is not the best on any one kind of noise, it achieves the best result on average.
169
+
170
+ This model is also able to translate the scrambled meme reasonably well:
171
+
172
+ “According to a study of Cambridge University, it doesn’t matter which technology in a word is going to get the letters in a word that is the only important thing for the first and last letter.”
173
+
174
+ # 7 ANALYSIS
175
+
176
+ # 7.1 LEARNING MULTIPLE KINDS OF NOISE IN C H A RCNN
177
+
178
+ The charCNN model was able to perform well on all kinds of noise by training on a mix of noise types. In particular, it performed well on scrambled characters even though its convolutions should be sensitive to the character order, as opposed to meanChar which is by definition invariant to character order. How then can charCNN learn to be robust to multiple kinds of noise at the same time? We speculate that different convolutional filters learn to be robust to different kinds of noise. A convolutional filter can in principle capture a mean (or sum) operation by employing equal or close to equal weights.
179
+
180
+ To test this, we analyze the weights learned by charCNN models trained under four conditions: three models trained each on completely scrambled words (Rand), keyboard typos (Key), and natural human errors (Nat), as well as an ensemble model trained on a mix of Rand+Key+Nat kinds of noise. For each model, we compute the variance across the filter width (6 characters) for each one of the 1000 filters and for each one out of 25 character embedding dimensions. Intuitively, this variance captures how much a particular filter learns a uniform vs. non-uniform combination of characters. Then we average the variances across the 1000 filters. This yields 25 averaged variances, one for each character embedding dimension. Low average variance means that different filters tend to learn similar behaviors, while high average variance means that they learn different patterns.
181
+
182
+ Figure 2 shows a box plot of these averages for our three languages and four training conditions. Clearly, the variances of the weights learned by the Rand model are much smaller than those of the weights learned by any other setting. This makes sense as with random scrambling there are no patterns to detect in the data, so filters resort to close to uniform weights. In contrast, the Key and Nat settings introduce a large set of new patterns for the CNNs to try and learn, leading to high variances. Finally, the ensemble model trained on mixed noise appears to be in the middle as it tries to capture both the uniform relationships of Rand and the more diverse patterns of Nat $^ +$ Key.
183
+
184
+ Moreover, the variance of variances (size of the box) is smallest in the Rand setting, larger in the mixed noise model, and largest in Key and Nat. This indicates that filters for different character embedding dimensions are more different from one another in Key and Nat models. In contrast, in the Rand model, the variance of variances is close to zero, indicating that in all character embedding dimensions the learned weights are of small variance; they do similar things, that is, the model learned to reproduce a representation similar to the meanChar model. The ensemble model again seems to find a balance between Rand and Key/Nat.
185
+
186
+ # 7.2 RICHNESS OF NATURAL NOISE
187
+
188
+ Natural noise appears to be very different from synthetic noise. None of the models that were trained only on synthetic noise were able to perform well on natural noise. We manually analyzed a small sample ${ \sim } 4 0$ examples) of natural noise from the German dataset. We found that the most common sources of noise are phonetic or phonological phenomena in the language $( 3 4 \% )$ and character omissions $( 3 2 \% )$ . The rest are incorrect morphological conjugations of verbs, key swaps, character insertions, orthographic variants, and other errors. Table 8 shows examples of these kinds of noise.
189
+
190
+ The most common types of natural noise – phonological and omissions – are not directly captured by our synthetic noise generation, and demonstrate that good synthetic errors will likely require more explicit phonemic and linguistic knowledge. This discrepancy helps explain why the models trained on synthetic noise were not particularly successful in translating natural noise.
191
+
192
+ Table 8: Examples of natural noise from the German errors dataset.
193
+
194
+ <table><tr><td>Error type</td><td>Examples</td></tr><tr><td>Phonetic</td><td>Tut/Tud (devoicing of final stops),sieht/zieht (s = /z/ before vowel),Trotzdem/Trozdem (tz=/z/),gekriegt/gekrigt (vowel length),Naturlich/Naturlich/Näturlich (diacritics)</td></tr><tr><td>Omission</td><td>erfahren/erfaren,Babysitter/Babysiter, selbst/sebst,Hausschuhe/Hausschue</td></tr><tr><td>Morphological</td><td>wohnt/wonnen,fortsetzt/forzusetzen,wiinsche/winchen</td></tr><tr><td>Key swap</td><td>Eltern/Eltren,Deine/Diene,nichts/nichst, Bahn/Bhan</td></tr><tr><td>Other</td><td>Agglomerationen/Agromelationen (omission + letter swap),Hausaufgabe/Hausausgabe, Thema/Temer,Detailhandelsfachfrau/Deitellhandfachfrau</td></tr></table>
195
+
196
+ # 8 CONCLUSION
197
+
198
+ In this work, we have shown that character-based NMT models are extremely brittle and tend to break when presented with both natural and synthetic kinds of noise. We investigated methods for increasing their robustness by using a structure-invariant word representation and by ensemble training on adversarial examples of different kinds. We found that a character-based CNN can learn to address multiple types of errors that are seen in training. However, we observed rich characteristics of natural human errors that cannot be easily captured by existing models. Future work might investigate using phonetic and syntactic structure to generate more realistic synthetic noise.
199
+
200
+ We believe that more work is necessary in order to immune NMT models against natural noise. As corpora with natural noise are limited, another approach to future work is to design better NMT architectures that would be robust to noise without seeing it in the training data. New psychology results on how humans cope with natural noise might point to possible solutions to this problem.
201
+
202
+ # ACKNOWLEDGEMENTS
203
+
204
+ This work benefited from discussions with Frank Keller. This work was supported by the Qatar Computing Research Institute (QCRI) and Samsung Research.
205
+
206
+ # REFERENCES
207
+
208
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. arXiv preprint arXiv:1409.0473, 2014.
209
+
210
+ Yonatan Belinkov and James Glass. Large-Scale Machine Translation between Arabic and Hebrew: Available Corpora and Initial Results. In Proceedings of the Workshop on Semitic Machine Translation, pp. 7–12, Austin, Texas, November 2016. Association for Computational Linguistics.
211
+
212
+ Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. What do Neural Machine Translation Models Learn about Morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 861–872, Vancouver, Canada, July 2017a.
213
+
214
+ Yonatan Belinkov, Llu´ıs Marquez, Hassan Sajjad, Fahim Dalvi, Nadir Durrani, and James Glass. \` Evaluating Layers of Representation in Neural Machine Translation on Part-of-Speech and Semantic Tagging Tasks. In Proceedings of the 8th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), Taipei, Taiwan, November 2017b. Association for Computational Linguistics.
215
+
216
+ Battista Biggio, Blaine Nelson, and Pavel Laskov. Poisoning Attacks Against Support Vector Machines. In Proceedings of the 29th International Coference on International Conference on Machine Learning, ICML’12, pp. 1467–1474, USA, 2012. Omnipress. ISBN 978-1-4503-1285-1. URL http://dl.acm.org/citation.cfm?id=3042573.3042761.
217
+
218
+ Christopher Bishop. Training with noise is equivalent to Tikhonov regularization. Neural Computation, 7:108–116, January 1995.
219
+
220
+ Mauro Cettolo, Christian Girardi, and Marcello Federico. WIT3: Web Inventory of Transcribed and Translated Talks. In Proceedings of the $I 6 ^ { t h }$ Conference of the European Association for Machine Translation (EAMT), pp. 261–268, Trento, Italy, May 2012.
221
+
222
+ Patrick P. K. Chan, Zhi-Min He, Hongjiang Li, and Chien-Chang Hsu. Data sanitization against adversarial label contamination based on data complexity. International Journal of Machine Learning and Cybernetics, Jan 2017. ISSN 1868-808X. doi: 10.1007/s13042-016-0629-5. URL https://doi.org/10.1007/s13042-016-0629-5.
223
+
224
+ Marta R. Costa-jussa and Jos\` e A. R. Fonollosa. Character-based Neural Machine Translation. In´ Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 357–361, Berlin, Germany, August 2016. Association for Computational Linguistics. URL http://anthology.aclweb.org/P16-2058.
225
+
226
+ Gabriela F. Cretu, Angelos Stavrou, Michael E. Locasto, Salvatore J. Stolfo, and Angelos D. Keromytis. Casting out Demons: Sanitizing Training Data for Anomaly Sensors. In Proceedings of the 2008 IEEE Symposium on Security and Privacy, SP ’08, pp. 81–95, Washington, DC, USA, 2008. IEEE Computer Society. ISBN 978-0-7695-3168-7. doi: 10.1109/SP.2008.11. URL https://doi.org/10.1109/SP.2008.11.
227
+
228
+ Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, and Stephan Vogel. Understanding and Improving Morphological Learning in the Neural Machine Translation Decoder. In Proceedings of the 8th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), Taipei, Taiwan, November 2017. Association for Computational Linguistics.
229
+
230
+ Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. HotFlip: White-Box Adversarial Examples for NLP. arXiv preprint arXiv:1712.06751, 2017.
231
+
232
+ Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers. arXiv preprint arXiv:1801.04354, 2018.
233
+
234
+ Amir Globerson and Sam Roweis. Nightmare at Test Time: Robust Learning by Feature Deletion. In Proceedings of the 23rd International Conference on Machine Learning, ICML ’06, pp. 353– 360, New York, NY, USA, 2006. ACM. ISBN 1-59593-383-2. doi: 10.1145/1143844.1143889. URL http://doi.acm.org/10.1145/1143844.1143889.
235
+
236
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and Harnessing Adversarial Examples. In International Conference on Learning Representations (ICLR), 2015.
237
+
238
+ Georg Heigold, Gunter Neumann, and Josef van Genabith. How Robust Are Character-Based Word ¨ Embeddings in Tagging and MT Against Wrod Scramlbing or Randdm Nouse? arXiv preprint arXiv:1704.04441, 2017.
239
+
240
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
241
+
242
+ Robin Jia and Percy Liang. Adversarial Examples for Evaluating Reading Comprehension Systems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2011–2021, Copenhagen, Denmark, September 2017.
243
+
244
+ Marcin Junczys-Dowmunt and Alexandra Birch. The University of Edinburgh’s systems submission to the MT task at IWSLT. In Proceedings of the First Conference on Machine Translation, Seattle, USA, 2016.
245
+
246
+ Yoon Kim. Seq2seq-attn. https://github.com/harvardnlp/seq2seq-attn, 2016.
247
+
248
+ Yoon Kim, Yacine Jernite, David Sontag, and Alexander M Rush. Character-aware Neural Language Models. arXiv preprint arXiv:1508.06615, 2015.
249
+
250
+ Jason Lee, Kyunghyun Cho, and Thomas Hofmann. Fully Character-Level Neural Machine Translation without Explicit Segmentation. Transactions of the Association for Computational Linguistics (TACL), 2017.
251
+
252
+ Bin Liang, Hongcheng Li, Miaoqiang Su, Pan Bian, Xirong Li, and Wenchang Shi. Deep Text Classification Can be Fooled. arXiv preprint arXiv:1704.08006, 2017.
253
+
254
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into Transferable Adversarial Examples and Black-box Attacks. 2017.
255
+
256
+ K. Matsuoka. Noise injection into inputs in back-propagation learning. IEEE Transactions on Systems, Man, and Cybernetics, 22(3):436–440, May 1992.
257
+
258
+ Aurlien Max and Guillaume Wisniewski. Mining Naturally-occurring Corrections and Paraphrases from Wikipedias Revision History. In Proceedings of the Seventh conference on International Language Resources and Evaluation (LREC’10), Valletta, Malta, may 2010. European Language Resources Association (ELRA). ISBN 2-9517408-6-7. URL https://wicopaco.limsi. fr.
259
+
260
+ K. Mayall, G.W. Humphreys, and A. Olson. Disruption to word or letter processing? The origins of case-mixing effects. Journal of Experimental Psychology: Learning, Memory, & Cognition, 23: 1275 – 1286, 1997.
261
+
262
+ L. X. McCusker, P. B. Gough, and R. G. Bias. Word recognition inside out and outside in. Journal of Experimental Psychology: Human Perception and Performance, 7(3):538 – 551, 1981.
263
+
264
+ Shike Mei and Xiaojin Zhu. Using Machine Teaching to Identify Optimal Training-set Attacks on Machine Learners. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, AAAI’15, pp. 2871–2877. AAAI Press, 2015. ISBN 0-262-51129-0. URL http://dl.acm.org/citation.cfm?id=2886521.2886721.
265
+
266
+ N. Narodytska and S. Kasiviswanathan. Simple Black-Box Adversarial Attacks on Deep Neural Networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 1310–1318, July 2017. doi: 10.1109/CVPRW.2017.172.
267
+
268
+ Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in Machine Learning: from Phenomena to Black-Box Attacks using Adversarial Samples. arXiv preprint arXiv:1605.07277, 2016a.
269
+
270
+ Nicolas Papernot, Patrick McDaniel, Ananthram Swami, and Richard Harang. Crafting Adversarial Input Sequences for Recurrent Neural Networks. In Military Communications Conference, MILCOM 2016-2016 IEEE, pp. 49–54. IEEE, 2016b.
271
+
272
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical Black-Box Attacks Against Machine Learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, ASIA CCS ’17, pp. 506–519, New York, NY, USA, 2017. ACM. ISBN 978-1-4503-4944-4. doi: 10.1145/3052973.3053009. URL http://doi.acm.org/10.1145/3052973.3053009.
273
+
274
+ D. G. Pelli, B. Farell, and D.C. Moore. The remarkable inefficiency of word recognition. Nature, 423:752 – 756, 2003.
275
+
276
+ G. E. Rawlinson. The significance of letter position in word recognition. PhD thesis, 1976.
277
+
278
+ Keith Rayner, Sarah J. White, Rebecca L. Johnson, and Simon P. Liversedge. Raeding Wrods With Jubmled Lettres: There Is a Cost. Psychological Science, 17(3):192 – 193, 2006.
279
+
280
+ G. M. Reicher. Perceptual recognition as a function of meaningfulness of stimulus material. Journal of Experimental Psychology, 81(2):275 – 280, 1969.
281
+
282
+ Benjamin I.P. Rubinstein, Blaine Nelson, Ling Huang, Anthony D. Joseph, Shing-hon Lau, Satish Rao, Nina Taft, and J. D. Tygar. ANTIDOTE: Understanding and Defending Against Poisoning of Anomaly Detectors. In Proceedings of the 9th ACM SIGCOMM Conference on Internet Measurement, IMC ’09, pp. 1–14, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-771-4. doi: 10. 1145/1644893.1644895. URL http://doi.acm.org/10.1145/1644893.1644895.
283
+
284
+ Kourosh Saberi and David R. Perrott. Cognitive restoration of reversed speech. Nature, 398(760), April 1999.
285
+
286
+ Hassan Sajjad, Fahim Dalvi, Nadir Durrani, Ahmed Abdelali, Yonatan Belinkov, and Stephan Vogel. Challenging Language-Dependent Segmentation for Arabic: An Application to Machine Translation and Part-of-Speech Tagging. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, Vancouver, Canada, July 2017. Association for Computational Linguistics.
287
+
288
+ Keisuke Sakaguchi, Kevin Duh, Matt Post, and Benjamin Van Durme. Robsut Wrod Reocginiton via Semi-Character Recurrent Neural Network. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA., pp. 3281–3287. AAAI Press, 2017. URL http://aaai.org/ocs/index.php/AAAI/AAAI17/paper/ view/14332.
289
+
290
+ Suranjana Samanta and Sameep Mehta. Towards Crafting Text Adversarial Samples. arXiv preprint arXiv:1707.02812, 2017.
291
+
292
+ Karel Sebesta, Zuzanna Bed ˇ ˇrichova, Kate ´ ˇrina Sormov ˇ a, Barbora ´ Stindlov ˇ a, Milan Hrdli ´ cka, Tereza ˇ Hrdlickov ˇ a, Ji ´ ˇr´ı Hana, Vladim´ır Petkevic, Tom ˇ a´s Jel ˇ ´ınek, Svatava Skodov ˇ a, Petr Jane ´ s, Kate ˇ ˇrina Lundakov ´ a, Hana Skoumalov ´ a,´ Simon Sl ˇ adek, Piotr Pierscieniak, Dagmar Toufarov ´ a, Milan ´ Straka, Alexandr Rosen, Jakub Naplava, and Marie Pol ´ a´ckov ˇ a. CzeSL grammatical error cor- ´ rection dataset (CzeSL-GEC). Technical report, LINDAT/CLARIN digital library at the Institute of Formal and Applied Linguistics, Charles University, 2017. URL https://lindat.mff. cuni.cz/repository/xmlui/handle/11234/1-2143.
293
+
294
+ Rico Sennrich. How Grammatical is Character-level Neural Machine Translation? Assessing MT Quality with Contrastive Translation Pairs. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pp. 376–382. Association for Computational Linguistics, 2017. URL http://aclweb.org/ anthology/E17-2060.
295
+
296
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715–1725. Association for Computational Linguistics, 2016a. doi: 10.18653/v1/P16-1162. URL http://aclanthology.coli. uni-saarland.de/pdf/P/P16/P16-1162.pdf.
297
+
298
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Edinburgh Neural Machine Translation Systems for WMT 16. In Proceedings of the First Conference on Machine Translation, pp. 371–376, Berlin, Germany, August 2016b. Association for Computational Linguistics.
299
+
300
+ Rico Sennrich, Orhan Firat, Kyunghyun Cho, Alexandra Birch, Barry Haddow, Julian Hitschler, Marcin Junczys-Dowmunt, Samuel Laubli, Antonio Valerio Miceli Barone, Jozef Mokry, and ¨ Maria Nadejde. Nematus: a Toolkit for Neural Machine Translation. In Proceedings of the Software Demonstrations of the 15th Conference of the European Chapter of the Association for Computational Linguistics, pp. 65–68, Valencia, Spain, April 2017. Association for Computational Linguistics. URL http://aclweb.org/anthology/E17-3017.
301
+
302
+ Xing Shi, Inkit Padhi, and Kevin Knight. Does String-Based Neural MT Learn Source Syntax? In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1526–1534, Austin, Texas, November 2016. Association for Computational Linguistics. URL https://aclweb.org/anthology/D16-1159.
303
+
304
+ 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.
305
+
306
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014.
307
+
308
+ Florian Tramer, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick McDaniel. Ensemble \` Adversarial Training: Attacks and Defenses. arXiv preprint arXiv:1705.07204, 2017.
309
+
310
+ Ekaterina Vylomova, Trevor Cohn, Xuanli He, and Gholamreza Haffari. Word Representation Models for Morphologically Rich Languages in Neural Machine Translation. arXiv preprint arXiv:1606.04217, 2016.
311
+
312
+ Katrin Wisniewski, Karin Schne, Lionel Nicolas, Chiara Vettori, Adriane Boyd, Detmar Meurers, Andrea Abel, and Jirka Hana. MERLIN: An online trilingual learner corpus empirically grounding the European Reference Levels in authentic learner data, 10 2013. URL https://www. ukp.tu-darmstadt.de/data/spelling-correction/rwse-datasets.
313
+
314
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
315
+
316
+ Torsten Zesch. Measuring Contextual Fitness Using Error Contexts Extracted from the Wikipedia Revision History. In Proceedings of the 13th Conference of the European Chapter of the Association for Computational Linguistics, pp. 529–538, Avignon, France, April 2012. Association for Computational Linguistics.
md/train/BJC_jUqxe/BJC_jUqxe.md ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A STRUCTURED SELF-ATTENTIVE SENTENCE EMBEDDING
2
+
3
+ Zhouhan $\mathbf { L i n } ^ { \dagger \circ }$ ∗, Minwei Feng, Cicero Nogueira dos Santos, Mo $\mathbf { V } \mathbf { u } ^ { \circ }$ , Bing Xiang, Bowen Zhou & Yoshua Bengio‡†
4
+
5
+ IBM Watson
6
+ ‡Montreal Institute for Learning Algorithms (MILA), Universite de Montr ´ eal ´
7
+ †CIFAR Senior Fellow
8
+ lin.zhouhan@gmail.com
9
+ {mfeng, cicerons, yum, bingxia, zhou}@us.ibm.com
10
+
11
+ # ABSTRACT
12
+
13
+ This paper proposes a new model for extracting an interpretable sentence embedding by introducing self-attention. Instead of using a vector, we use a 2-D matrix to represent the embedding, with each row of the matrix attending on a different part of the sentence. We also propose a self-attention mechanism and a special regularization term for the model. As a side effect, the embedding comes with an easy way of visualizing what specific parts of the sentence are encoded into the embedding. We evaluate our model on 3 different tasks: author profiling, sentiment classification and textual entailment. Results show that our model yields a significant performance gain compared to other sentence embedding methods in all of the 3 tasks.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Much progress has been made in learning semantically meaningful distributed representations of individual words, also known as word embeddings (Bengio et al., 2001; Mikolov et al., 2013). On the other hand, much remains to be done to obtain satisfying representations of phrases and sentences. Those methods generally fall into two categories. The first consists of universal sentence embeddings usually trained by unsupervised learning (Hill et al., 2016). This includes SkipThought vectors (Kiros et al., 2015), ParagraphVector (Le & Mikolov, 2014), recursive auto-encoders (Socher et al., 2011; 2013), Sequential Denoising Autoencoders (SDAE), FastSent (Hill et al., 2016), etc.
18
+
19
+ The other category consists of models trained specifically for a certain task. They are usually combined with downstream applications and trained by supervised learning. One generally finds that specifically trained sentence embeddings perform better than generic ones, although generic ones can be used in a semi-supervised setting, exploiting large unlabeled corpora. Several models have been proposed along this line, by using recurrent networks (Hochreiter & Schmidhuber, 1997; Chung et al., 2014), recursive networks (Socher et al., 2013) and convolutional networks (Kalchbrenner et al., 2014; dos Santos & Gatti, 2014; Kim, 2014) as an intermediate step in creating sentence representations to solve a wide variety of tasks including classification and ranking (Yin & Schutze, ¨ 2015; Palangi et al., 2016; Tan et al., 2016; Feng et al., 2015). A common approach in previous methods consists in creating a simple vector representation by using the final hidden state of the RNN or the max (or average) pooling from either RNNs hidden states or convolved n-grams. Additional works have also been done in exploiting linguistic structures such as parse and dependence trees to improve sentence representations (Ma et al., 2015; Mou et al., 2015b; Tai et al., 2015).
20
+
21
+ For some tasks people propose to use attention mechanism on top of the CNN or LSTM model to introduce extra source of information to guide the extraction of sentence embedding (dos Santos et al., 2016). However, for some other tasks like sentiment classification, this is not directly applicable since there is no such extra information: the model is only given one single sentence as input. In those cases, the most common way is to add a max pooling or averaging step across all time steps (Lee & Dernoncourt, 2016), or just pick up the hidden representation at the last time step as the encoded embedding (Margarit & Subramaniam, 2016).
22
+
23
+ ![](images/60681ffc941822535da20ab69058a148910ef62a2ce6c2d7c0ce089c4d576168.jpg)
24
+ Figure 1: A sample model structure showing the sentence embedding model combined with a fully connected and softmax layer for sentiment analysis (a). The sentence embedding $M$ is computed as multiple weighted sums of hidden states from a bidirectional LSTM $( \mathbf { h _ { 1 } } , . . . , \mathbf { h _ { n } } )$ , where the summation weights $( A _ { i 1 } , . . . , A _ { i n } )$ are computed in a way illustrated in (b). Blue colored shapes stand for hidden representations, and red colored shapes stand for weights, annotations, or input/output.
25
+
26
+ A common approach in many of the aforementioned methods consists of creating a simple vector representation by using the final hidden state of the RNN or the max (or average) pooling from either RNNs hidden states or convolved n-grams. We hypothesize that carrying the semantics along all time steps of a recurrent model is relatively hard and not necessary. We propose a self-attention mechanism for these sequential models to replace the max pooling or averaging step. Different from previous approaches, the proposed self-attention mechanism allows extracting different aspects of the sentence into multiple vector representations. It is performed on top of an LSTM in our sentence embedding model. This enables attention to be used in those cases when there are no extra inputs. In addition, due to its direct access to hidden representations from previous time steps, it relieves some long-term memorization burden from LSTM. As a side effect coming together with our proposed self-attentive sentence embedding, interpreting the extracted embedding becomes very easy and explicit.
27
+
28
+ Section 2 details on our proposed self-attentive sentence embedding model, as well as a regularization term we proposed for this model, which is described in Section 2.2. We also provide a visualization method for this sentence embedding in section 2.3. We then evaluate our model in author profiling, sentiment classification and textual entailment tasks in Section 4.
29
+
30
+ # 2 APPROACH
31
+
32
+ # 2.1 MODEL
33
+
34
+ The proposed sentence embedding model consists of two parts. The first part is a bidirectional LSTM, and the second part is the self-attention mechanism, which provides a set of summation weight vectors for the LSTM hidden states. These set of summation weight vectors are dotted with the LSTM hidden states, and the resulting weighted LSTM hidden states are considered as an embedding for the sentence. It can be combined with, for example, a multilayer perceptron to be applied on a downstream application. Figure 1 shows an example when the proposed sentence embedding model is applied to sentiment analysis, combined with a fully connected layer and a softmax layer. Besides using a fully connected layer, we also proposes an approach that prunes weight connections by utilizing the 2-D structure of matrix sentence embedding, which is detailed in Appendix A. For this section, we will use Figure 1 to describe our model.
35
+
36
+ Suppose we have a sentence, which has $n$ tokens, represented in a sequence of word embeddings.
37
+
38
+ $$
39
+ S = \left( \mathbf { w _ { 1 } } , \mathbf { w _ { 2 } } , \cdot \cdot \cdot \mathbf { w _ { n } } \right)
40
+ $$
41
+
42
+ Here $w _ { i }$ is a vector standing for a $d$ dimentional word embedding for the $i$ -th word in the sentence. $S$ is thus a sequence represented as a 2-D matrix, which concatenates all the word embeddings together. $S$ should have the shape $n$ -by- $d$ .
43
+
44
+ Now each entry in the sequence $S$ are independent with each other. To gain some dependency between adjacent words within a single sentence, we use a bidirectional LSTM to process the sentence:
45
+
46
+ $$
47
+ \begin{array} { r } { \overrightarrow { h _ { t } } = \overrightarrow { L S T M } ( w _ { t } , \overrightarrow { h _ { t - 1 } } ) } \\ { \overleftarrow { h _ { t } } = \overleftarrow { L S T M } ( w _ { t } , \overbrace { h _ { t + 1 } } ) } \end{array}
48
+ $$
49
+
50
+ And we concatenate each $\overrightarrow { h _ { t } }$ with $\left\{ { { \overline { { h _ { t } } } } } \right.$ to obtain a hidden state $h _ { t }$ . Let the hidden unit number for each unidirectional LSTM be $u$ . For simplicity, we note all the n $h _ { t } \mathbf { s }$ as $H$ , who have the size $n$ -by- $_ { 2 u }$ .
51
+
52
+ $$
53
+ H = ( \mathbf { h _ { 1 } } , \mathbf { h _ { 2 } } , \cdot \cdot \cdot \mathbf { h _ { n } } )
54
+ $$
55
+
56
+ Our aim is to encode a variable length sentence into a fixed size embedding. We achieve that by choosing a linear combination of the $n$ LSTM hidden vectors in $H$ . Computing the linear combination requires the self-attention mechanism. The attention mechanism takes the whole LSTM hidden states $H$ as input, and outputs a vector of weights $\mathbf { a }$ :
57
+
58
+ $$
59
+ \mathbf { a } = s o f t m a x \left( \mathbf { w _ { s 2 } } t a n h \left( W _ { s 1 } H ^ { T } \right) \right)
60
+ $$
61
+
62
+ Here $W _ { s 1 }$ is a weight matrix with a shape of $d _ { a }$ -by- $_ { 2 u }$ . and ${ \bf w _ { s 2 } }$ is a vector of parameters with size $d _ { a }$ , where $d _ { a }$ is a hyperparameter we can set arbitrarily. Since $H$ is sized $n$ -by- $_ { 2 u }$ , the annotation vector $a$ will have a size $n$ . the $s o f t m a x ( )$ ensures all the computed weights sum up to 1. Then we sum up the LSTM hidden states $H$ according to the weight provided by a to get a vector representation $\mathbf { m }$ of the input sentence.
63
+
64
+ This vector representation usually focuses on a specific component of the sentence, like a special set of related words or phrases. So it is expected to reflect an aspect, or component of the semantics in a sentence. However, there can be multiple components in a sentence that together forms the overall semantics of the whole sentence, especially for long sentences. (For example, two clauses linked together by an ”and.”) Thus, to represent the overall semantics of the sentence, we need multiple m’s that focus on different parts of the sentence. Thus we need to perform multiple hops of attention. Say we want $r$ different parts to be extracted from the sentence, with regard to this, we extend the ${ \bf w _ { s 2 } }$ into a $r$ -by- $\cdot d _ { a }$ matrix, note it as $W _ { s 2 }$ , and the resulting annotation vector a becomes annotation matrix $A$ . Formally,
65
+
66
+ $$
67
+ A = s o f t m a x \left( W _ { s 2 } t a n h \left( W _ { s 1 } H ^ { T } \right) \right)
68
+ $$
69
+
70
+ Here the sof tmax $( )$ is performed along the second dimension of its input. We can deem Equation 6 as a 2-layer MLP without bias, whose hidden unit numbers is $d _ { a }$ , and parameters are $\{ W _ { s 2 } , \mathbf { \bar { W } } _ { s 1 } \}$ .
71
+
72
+ The embedding vector $m$ then becomes an $r$ -by- $_ { 2 u }$ embedding matrix $M$ . We compute the $r$ weighted sums by multiplying the annotation matrix $A$ and LSTM hidden states $H$ , the resulting matrix is the sentence embedding:
73
+
74
+ $$
75
+ M = A H
76
+ $$
77
+
78
+ # 2.2 PENALIZATION TERM
79
+
80
+ The embedding matrix $M$ can suffer from redundancy problems if the attention mechanism always provides similar summation weights for all the $r$ hops. Thus we need a penalization term to encourage the diversity of summation weight vectors across different hops of attention.
81
+
82
+ The best way to evaluate the diversity is definitely the Kullback Leibler divergence between any 2 of the summation weight vectors. However, we found that not very stable in our case. We conjecture it is because we are maximizing a set of KL divergence (instead of minimizing only one, which is the usual case), we are optimizing the annotation matrix A to have a lot of sufficiently small or even zero values at different softmax output units, and these vast amount of zeros is making the training unstable. There is another feature that KL doesn’t provide but we want, which is, we want each individual row to focus on a single aspect of semantics, so we want the probability mass in the annotation softmax output to be more focused. but with KL penalty we cant encourage that.
83
+
84
+ We hereby introduce a new penalization term which overcomes the aforementioned shortcomings. Compared to the KL divergence penalization, this term consumes only one third of the computation. We use the dot product of $A$ and its transpose, subtracted by an identity matrix, as a measure of redundancy.
85
+
86
+ $$
87
+ \boldsymbol { P } = \left\| \left( \boldsymbol { A } \boldsymbol { A } ^ { T } - \boldsymbol { I } \right) \right\| _ { F } ^ { 2 }
88
+ $$
89
+
90
+ Here $\| \bullet \| _ { F }$ stands for the Frobenius norm of a matrix. Similar to adding an L2 regularization term, this penalization term $P$ will be multiplied by a coefficient, and we minimize it together with the original loss, which is dependent on the downstream application.
91
+
92
+ Let’s consider two different summation vectors $\mathbf { a ^ { i } }$ and $\mathbf { a } ^ { \mathbf { j } }$ in $A$ . Because of the softmax, all entries within any summation vector in $A$ should sum up to 1. Thus they can be deemed as probability masses in a discrete probability distribution. For any non-diagonal elements $a _ { i j } ( i \neq j )$ in the $A A ^ { \check { T } }$ matrix, it corresponds to a summation over elementwise product of two distributions:
93
+
94
+ $$
95
+ 0 < a _ { i j } = \sum _ { k = 1 } ^ { n } a _ { k } ^ { i } a _ { k } ^ { j } < 1
96
+ $$
97
+
98
+ where $a _ { k } ^ { i }$ and $a _ { k } ^ { j }$ are the $k$ -th element in the $\mathbf { a } ^ { \mathbf { i } }$ and $\mathbf { a } ^ { \mathbf { j } }$ vectors, respectively. In the most extreme case, where there is no overlap between the two probability distributions $\mathbf { a } ^ { \mathbf { i } }$ and $\mathbf { a } ^ { \mathbf { j } }$ , the correspond $a _ { i j }$ will be 0. Otherwise, it will have a positive value. On the other extreme end, if the two distributions are identical and all concentrates on one single word, it will have a maximum value of 1. We subtract an identity matrix from $A A ^ { T }$ so that forces the elements on the diagonal of $A A ^ { T }$ to approximate 1, which encourages each summation vector $\mathbf { a } ^ { \mathbf { i } }$ to focus on as few number of words as possible, forcing each vector to be focused on a single aspect, and all other elements to 0, which punishes redundancy between different summation vectors.
99
+
100
+ # 2.3 VISUALIZATION
101
+
102
+ The interpretation of the sentence embedding is quite straight forward because of the existence of annotation matrix $A$ . For each row in the sentence embedding matrix $M$ , we have its corresponding annotation vector $\mathbf { a ^ { i } }$ . Each element in this vector corresponds to how much contribution the LSTM hidden state of a token on that position contributes to. We can thus draw a heat map for each row of the embedding matrix $M$ This way of visualization gives hints on what is encoded in each part of the embedding, adding an extra layer of interpretation. (See Figure 3a and 3b).
103
+
104
+ The second way of visualization can be achieved by summing up over all the annotation vectors, and then normalizing the resulting weight vector to sum up to 1. Since it sums up all aspects of semantics of a sentence, it yields a general view of what the embedding mostly focuses on. We can figure out which words the embedding takes into account a lot, and which ones are skipped by the embedding. See Figure 3c and 3d.
105
+
106
+ # 3 RELATED WORK
107
+
108
+ Various supervised and unsupervised sentence embedding models have been mentioned in Section 1. Different from those models, our proposed method uses a new self-attention mechanism that allows it to extract different aspects of the sentence into multiple vector-representations. The matrix structure together with the penalization term gives our model a greater capacity to disentangle the latent information from the input sentence. We also do not use linguistic structures to guide our sentence representation model. Additionally, using our method we can easily create visualizations that can help in the interpretation of the learned representations.
109
+
110
+ Some recent work have also proposed supervised methods that use intra/self-sentence attention. Ling et al. (2015) proposed an attention based model for word embedding, which calculates an attention weight for each word at each possible position in the context window. However this method cannot be extended to sentence level embeddings since one cannot exhaustively enumerate all possible sentences. Liu et al. (2016a) proposes a sentence level attention which has a similar motivation but done differently. They utilize the mean pooling over LSTM states as the attention source, and use that to re-weight the pooled vector representation of the sentence.
111
+
112
+ Apart from the previous 2 variants, we want to note that Li et al. (2016) proposed a same self attention mechanism for question encoding in their factoid QA model, which is concurrent to our work. The difference lies in that their encoding is still presented as a vector, but our attention produces a matrix representation instead, with a specially designed penalty term. We applied the model for sentiment anaysis and entailment, and their model is for factoid QA.
113
+
114
+ The LSTMN model (Cheng et al., 2016) also proposed a very successful intra-sentence level attention mechanism, which is later used by Parikh et al. (2016). We see our attention and theirs as having different granularities. LSTMN produces an attention vector for each of its hidden states during the recurrent iteration, which is sort of an ”online updating” attention. It’s more fine-grained, targeting at discovering lexical correlations between a certain word and its previous words. On the contrary, our attention mechanism is only performed once, focuses directly on the semantics that makes sense for discriminating the targets. It is less focused on relations between words, but more on the semantics of the whole sentence that each word contributes to. Computationally, our method also scales up with the sentence length better, since it doesn’t require the LSTM to compute an annotation vector over all of its previous words each time when the LSTMN computes its next step.
115
+
116
+ # 4 EXPERIMENTAL RESULTS
117
+
118
+ We first evaluate our sentence embedding model by applying it to 3 different datasets: the Age dataset, the Yelp dataset, and the Stanford Natural Language Inference (SNLI) Corpus. These 3 datasets fall into 3 different tasks, corresponding to author profiling, sentiment analysis, and textual entailment, respectively. Then we also perform a set of exploratory experiments to validate properties of various aspects for our sentence embedding model.
119
+
120
+ # 4.1 AUTHOR PROFILING
121
+
122
+ The Author Profiling dataset1 consists of Twitter tweets in English, Spanish, and Dutch. For some of the tweets, it also provides an age and gender of the user when writing the tweet. The age range are split into 5 classes: 18-24, 25-34, 35-49, 50-64, $6 5 +$ . We use English tweets as input, and use those tweets to predict the age range of the user. Since we are predicting the age of users, we refer to it as Age dataset in the rest of our paper. We randomly selected 68485 tweets as training set, 4000 for development set, and 4000 for test set. Performances are also chosen to be classification accuracy.
123
+
124
+ We compare our model with two baseline models: biLSTM and CNN. For the two baseline models. The biLSTM model uses a bidirectional LSTM with 300 dimensions in each direction, and use max pooling across all LSTM hidden states to get the sentence embedding vector, then use a 2-layer ReLU output MLP with 3000 hidden states to output the classification result. The CNN model uses the same scheme, but substituting biLSTM with 1 layer of 1-D convolutional network. During training we use 0.5 dropout on the MLP and 0.0001 L2 regularization. We use stochastic gradient descent as the optimizer, with a learning rate of 0.06, batch size 16. For biLSTM, we also clip the norm of gradients to be between -0.5 and 0.5. We searched hyperparameters in a wide range and find the aforementioned set of hyperparameters yields the highest accuracy.
125
+
126
+ For our model, we use the same settings as what we did in biLSTM. We also use a 2-layer ReLU output MLP, but with 2000 hidden units. In addition, our self-attention MLP has a hidden layer with 350 units (the $d _ { a }$ in Section 2), we choose the matrix embedding to have 30 rows (the $r$ ), and a coefficient of 1 for the penalization term.
127
+
128
+ Table 1: Performance Comparision of Different Models on Yelp and Age Dataset
129
+
130
+ <table><tr><td>Models</td><td>Yelp</td><td>Age</td></tr><tr><td>BiLSTM + Max Pooling + MLP</td><td>61.99%</td><td>77.40%</td></tr><tr><td>CNN+Max Pooling+MLP</td><td>62.05%</td><td>78.15%</td></tr><tr><td>Our Model</td><td>64.21%</td><td>80.45%</td></tr></table>
131
+
132
+ We train all the three models until convergence and select the corresponding test set performance according to the best development set performance. Our results show that the model outperforms both of the biLSTM and CNN baselines by a significant margin.
133
+
134
+ ![](images/f74f85ffe002204ab5a7ab119e1c1ee8e94e9f6456e7bc24df8dd1badc45d622.jpg)
135
+ Figure 2: Heatmap of Yelp reviews with the two extreme score.
136
+
137
+ # 4.2 SENTIMENT ANALYSIS
138
+
139
+ We choose the Yelp dataset2 for sentiment analysis task. It consists of 2.7M yelp reviews, we take the review as input and predict the number of stars the user who wrote that review assigned to the corresponding business store. We randomly select 500K review-star pairs as training set, and 2000 for development set, 2000 for test set. We tokenize the review texts by Stanford tokenizer. We use 100 dimensional word2vec as initialization for word embeddings, and tune the embedding during training across all of our experiments. The target number of stars is an integer number in the range of [1, 5], inclusive. We are treating the task as a classification task, i.e., classify a review text into one of the 5 classes. We use classification accuracy as a measurement.
140
+
141
+ For the two baseline models, we use the same setting as what we used for Author Profiling dataset, except that we are using a batch size of 32 instead. For our model, we are also using the same setting, except that we choose the hidden unit numbers in the output MLP to be 3000 instead. We also observe a significant performance gain comparining to the two baselines. (Table 1)
142
+
143
+ As an interpretation of the learned sentence embedding, we use the second way of visualization described in Section 2.3 to plot heat maps for some of the reviews in the dataset. We randomly select 5 examples of negative (1 star) and positive (5 stars) reviews from the test set, when the model has a high confidence $( > 0 . 8 )$ in predicting the label. As shown in Figure 2, we find that the model majorly learns to capture some key factors in the review that indicate strongly on the sentiment behind the sentence. For most of the short reviews, the model manages to capture all the key factors that contribute to an extreme score, but for longer reviews, the model is still not able to capture all related factors. For example, in the 3rd review in Figure 2b), it seems that a lot of focus is spent on one single factor, i.e., the ”so much fun”, and the model puts a little amount of attention on other key points like ”highly recommend”, ”amazing food”, etc.
144
+
145
+ # 4.3 TEXTUAL ENTAILMENT
146
+
147
+ We use the biggest dataset in textual entailment, the SNLI corpus (Bowman et al., 2015) for our evaluation on this task. SNLI is a collection of 570k human-written English sentence pairs manually labeled for balanced classification with the labels entailment, contradiction, and neutral. The model will be given a pair of sentences, called hypothesis and premise respectively, and asked to tell if the semantics in the two sentences are contradicting with each other or not. It is also a classification task, so we measure the performance by accuracy.
148
+
149
+ We process the hypothesis and premise independently, and then extract the relation between the two sentence embeddings by using multiplicative interactions proposed in Memisevic (2013) (see Appendix B for details), and use a 2-layer ReLU output MLP with 4000 hidden units to map the hidden representation into classification results. Parameters of biLSTM and attention MLP are shared across hypothesis and premise. The biLSTM is 300 dimension in each direction, the attention MLP has 150 hidden units instead, and both sentence embeddings for hypothesis and premise have 30 rows (the $r$ ). The penalization term coefficient is set to 0.3. We use 300 dimensional GloVe (Pennington et al., 2014) word embedding to initialize word embeddings. We use AdaGrad as the optimizer, with a learning rate of 0.01. We don’t use any extra regularization methods, like dropout or L2 normalization. Training converges after 4 epochs, which is relatively fast.
150
+
151
+ This task is a bit different from previous two tasks, in that it has 2 sentences as input. There are a bunch of ways to add inter-sentence level attention, and those attentions bring a lot of benefits. To make the comparison focused and fair, we only compare methods that fall into the sentence encoding-based models. i.e., there is no information exchanged between the hypothesis and premise before they are encoded into some distributed encoding.
152
+
153
+ Table 2: Test Set Performance Compared to other Sentence Encoding Based Methods in SNLI Datset
154
+
155
+ <table><tr><td>Model</td><td>Test Accuracy</td></tr><tr><td>300DLSTM encoders (Bowman et al., 2016)</td><td>80.6%</td></tr><tr><td>600D (300+300) BiLSTM encoders (Liu et al.,2016b)</td><td>83.3%</td></tr><tr><td> 300D Tree-based CNN encoders (Mou et al., 2015a)</td><td>82.1%</td></tr><tr><td>300D SPINN-PI encoders (Bowman et al., 2016)</td><td>83.2%</td></tr><tr><td>300D NTI-SLSTM-LSTM encoders (Munkhdalai &amp; Yu,2016a)</td><td>83.4%</td></tr><tr><td>1024D GRU encoders with SkipThoughts pre-training (Vendrov et al., 2015)</td><td>81.4%</td></tr><tr><td>300D NSE encoders (Munkhdalai &amp; Yu,2016b)</td><td>84.6%</td></tr><tr><td>Ourmethod</td><td>84.4%</td></tr></table>
156
+
157
+ We find that compared to other published approaches, our method shows a significant gain $( \geq 1 \% )$ to them, except for the 300D NSE encoders, which is the state-of-the-art in this category. However, the $0 . 2 \%$ different is relatively small compared to the differences between other methods.
158
+
159
+ # 4.4 EXPLORATORY EXPERIMENTS
160
+
161
+ In this subsection we are going to do a set of exploratory experiments to study the relative effect of each component in our model.
162
+
163
+ # 4.4.1 EFFECT OF PENALIZATION TERM
164
+
165
+ Since the purpose of introducing the penalization term $P$ is majorly to discourage the redundancy in the embedding, we first directly visualize the heat maps of each row when the model is presented with a sentence. We compare two identical models with the same size as detailed in Section 4.1 trained separately on Age dataset, one with this penalization term (where the penalization coefficient is set to 1.0) and the other with no penalty. We randomly select one tweet from the test set and compare the two models by plotting a heat map for each hop of attention on that single tweet. Since there are 30 hops of attention for each model, which makes plotting all of them quite redundant, we only plot 6 of them. These 6 hops already reflect the situation in all of the 30 hops.
166
+
167
+ ![](images/3063df46fa169ad74f2bf5325c236c0cb983c5420197166d28d806198fca0206.jpg)
168
+
169
+ Figure 3: Heat maps for 2 models trained on Age dataset. The left column is trained without the penalization term, and the right column is trained with 1.0 penalization. (a) and (b) shows detailed attentions taken by 6 out of 30 rows of the matrix embedding, while (c) and (d) shows the overall attention by summing up all 30 attention weight vectors.
170
+
171
+ ![](images/89bf44b778e1ce2a54bd5f742c83b4577b52f97c87756d6e14dd2bbfadeca00c.jpg)
172
+
173
+ Figure 4: Attention of sentence embedding on 3 different Yelp reviews. The left one is trained without penalization, and the right one is trained with 1.0 penalization.
174
+
175
+ Table 3: Performance comparision regarding the penalization term
176
+
177
+ <table><tr><td>Penalization coefficient</td><td>Yelp</td><td>Age</td></tr><tr><td>1.0</td><td>64.21%</td><td>80.45%</td></tr><tr><td>0.0</td><td>61.74%</td><td>79.27%</td></tr></table>
178
+
179
+ From the figure we can tell that the model trained without the penalization term have lots of redundancies between different hops of attention (Figure 3a), resulting in putting lot of focus on the word ”it” (Figure 3c), which is not so relevant to the age of the author. However in the right column, the model shows more variations between different hops, and as a result, the overall embedding focuses on ”mail-replies spam” instead. (Figure 3d)
180
+
181
+ For the Yelp dataset, we also observe a similar phenomenon. To make the experiments more explorative, we choose to plot heat maps of overall attention heat maps for more samples, instead of plotting detailed heat maps for a single sample again. Figure 4 shows overall focus of the sentence embedding on three different reviews. We observe that with the penalization term, the model tends to be more focused on important parts of the review. We think it is because that we are encouraging it to be focused, in the diagonals of matrix $A A ^ { T }$ (Equation 8).
182
+
183
+ To validate if these differences result in performance difference, we evaluate four models trained on Yelp and Age datasets, both with and without the penalization term. Results are shown in Table 3. Consistent with what expected, models trained with the penalization term outperforms their counterpart trained without.
184
+
185
+ In SNLI dataset, although we observe that introducing the penalization term still contributes to encouraging the diversity of different rows in the matrix sentence embedding, and forcing the network to be more focused on the sentences, the quantitative effect of this penalization term is not so obvious on SNLI dataset. Both models yield similar test set accuracies.
186
+
187
+ # 4.4.2 EFFECT OF MULTIPLE VECTORS
188
+
189
+ Having multiple rows in the sentence embedding is expected to provide more abundant information about the encoded content. It makes sence to evaluate how significant the improvement can be brought by $r$ . Taking the models we used for Age and SNLI dataset as an example, we vary $r$ from 1 to 30 for each task, and train the resulting 10 models independently (Figure 5). Note that when $r = 1$ , the sentence embedding reduces to a normal vector form.
190
+
191
+ From this figure we can find that, without having multiple rows, the model performs on-par with its competitiors which use other forms of vector sentence embeddings. But there is significant difference between having only one vector for the sentence embedding and multiple vectors. The models are also quite invariant with respect to $r$ , since in the two figures a wide range of values between 10 to 30 are all generating comparable curves.
192
+
193
+ ![](images/51b6ec69cc29def6c6745dec2737bece1e9dab0778bae6cf51d528dd609d0b63.jpg)
194
+ Figure 5: Effect of the number of rows $( r )$ in matrix sentence embedding. The vertical axes indicates test set accuracy and the horizontal axes indicates training epoches. Numbers in the legends stand for the corresponding values of $r$ . (a) is conducted in Age dataset and (b) is conducted in SNLI dataset.
195
+
196
+ # 5 CONCLUSION AND DISCUSSION
197
+
198
+ In this paper, we introduced a fixed size, matrix sentence embedding with a self-attention mechanism. Because of this attention mechanism, there is a way to interpret the sentence embedding in depth in our model. Experimental results over 3 different tasks show that the model outperforms other sentence embedding models by a significant margin.
199
+
200
+ Introducing attention mechanism allows the final sentence embedding to directly access previous LSTM hidden states via the attention summation. Thus the LSTM doesn’t need to carry every piece of information towards its last hidden state. Instead, each LSTM hidden state is only expected to provide shorter term context information around each word, while the higher level semantics, which requires longer term dependency, can be picked up directly by the attention mechanism. This setting reliefs the burden of LSTM to carry on long term dependencies. Our experiments also support that, as we observed that our model has a bigger advantage when the contents are longer. Further more, the notion of summing up elements in the attention mechanism is very primitive, it can be something more complex than that, which will allow more operations on the hidden states of LSTM.
201
+
202
+ The model is able to encode any sequence with variable length into a fixed size representation, without suffering from long-term dependency problems. This brings a lot of scalability to the model: without any modification, it can be applied directly to longer contents like paragraphs, articles, etc. Though this is beyond the focus of this paper, it remains an interesting direction to explore as a future work.
203
+
204
+ As a downside of our proposed model, the current training method heavily relies on downstream applications, thus we are not able to train it in an unsupervised way. The major obstacle towards enabling unsupervised learning in this model is that during decoding, we don’t know as prior how the different rows in the embedding should be divided and reorganized. Exploring all those possible divisions by using a neural network could easily end up with overfitting. Although we can still do unsupervised learning on the proposed model by using a sequential decoder on top of the sentence embedding, it merits more to find some other structures as a decoder.
205
+
206
+ # ACKNOWLEDGMENTS
207
+
208
+ The authors would like to acknowledge the developers of Theano (Theano Development Team, 2016) and Lasagne. The first author would also like to thank IBM Watson for providing resources, fundings and valuable discussions to make this project possible, and Caglar Gulcehre for helpful discussions.
209
+
210
+ # REFERENCES
211
+
212
+ Yoshua Bengio, Rejean Ducharme, and Pascal Vincent. A neural probabilistic language model. In ´ Advances in Neural Information Processing Systems, pp. 932–938, 2001.
213
+
214
+ Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
215
+
216
+ Samuel R Bowman, Jon Gauthier, Abhinav Rastogi, Raghav Gupta, Christopher D Manning, and Christopher Potts. A fast unified model for parsing and sentence understanding. arXiv preprint arXiv:1603.06021, 2016.
217
+
218
+ Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. In Conference on Empirical Methods in Natural Language Processing (EMNLP). Association for Computational Linguistics, 2016.
219
+
220
+ 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.
221
+
222
+ Cicero dos Santos and Maira Gatti. Deep convolutional neural networks for sentiment analysis of short texts. In Proceedings of COLING 2014, the 25th International Conference on Computational Linguistics: Technical Papers, pp. 69–78, 2014.
223
+
224
+ Cicero dos Santos, Ming Tan, Bing Xiang, and Bowen Zhou. Attentive pooling networks. arXiv preprint arXiv:1602.03609, 2016.
225
+
226
+ Minwei Feng, Bing Xiang, Michael R. Glass, Lidan Wang, and Bowen Zhou. Applying deep learning to answer selection: a study and an open task. In 2015 IEEE Workshop on Automatic Speech Recognition and Understanding, ASRU 2015, Scottsdale, AZ, USA, December 13-17, 2015, pp. 813–820, 2015.
227
+
228
+ 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.
229
+
230
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
231
+
232
+ Nal Kalchbrenner, Edward Grefenstette, and Phil Blunsom. A convolutional neural network for modelling sentences. arXiv preprint arXiv:1404.2188, 2014.
233
+
234
+ Yoon Kim. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882, 2014.
235
+
236
+ Ryan Kiros, Yukun Zhu, Ruslan R Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In Advances in neural information processing systems, pp. 3294–3302, 2015.
237
+
238
+ Quoc V Le and Tomas Mikolov. Distributed representations of sentences and documents. In ICML, volume 14, pp. 1188–1196, 2014.
239
+
240
+ Ji Young Lee and Franck Dernoncourt. Sequential short-text classification with recurrent and convolutional neural networks. arXiv preprint arXiv:1603.03827, 2016.
241
+
242
+ Peng Li, Wei Li, Zhengyan He, Xuguang Wang, Ying Cao, Jie Zhou, and Wei Xu. Dataset and neural recurrent sequence labeling model for open-domain factoid question answering. arXiv preprint arXiv:1607.06275, 2016.
243
+
244
+ Wang Ling, Lin Chu-Cheng, Yulia Tsvetkov, and Silvio Amir. Not all contexts are created equal: Better word representations with variable attention. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1367–1372, Lisbon, Portugal, September 2015. Association for Computational Linguistics.
245
+
246
+ Yang Liu, Chengjie Sun, Lei Lin, and Xiaolong Wang. Learning natural language inference using bidirectional LSTM model and inner-attention. CoRR, abs/1605.09090, 2016a.
247
+
248
+ Yang Liu, Chengjie Sun, Lei Lin, and Xiaolong Wang. Learning natural language inference using bidirectional lstm model and inner-attention. arXiv preprint arXiv:1605.09090, 2016b.
249
+
250
+ Mingbo Ma, Liang Huang, Bing Xiang, and Bowen Zhou. Dependency-based convolutional neural networks for sentence embedding. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, volume 2, pp. 174–179, 2015.
251
+
252
+ Horia Margarit and Raghav Subramaniam. A batch-normalized recurrent network for sentiment classification. In Advances in Neural Information Processing Systems, 2016.
253
+
254
+ Roland Memisevic. Learning to relate images. IEEE transactions on pattern analysis and machine intelligence, 35(8):1829–1846, 2013.
255
+
256
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
257
+
258
+ Lili Mou, Rui Men, Ge Li, Yan Xu, Lu Zhang, Rui Yan, and Zhi Jin. Natural language inference by tree-based convolution and heuristic matching. arXiv preprint arXiv:1512.08422, 2015a.
259
+
260
+ Lili Mou, Hao Peng, Ge Li, Yan Xu, Lu Zhang, and Zhi Jin. Discriminative neural sentence modeling by tree-based convolution. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 2315–2325, Lisbon, Portugal, September 2015b. Association for Computational Linguistics. URL http://aclweb.org/anthology/D15-1279.
261
+
262
+ Tsendsuren Munkhdalai and Hong Yu. Neural tree indexers for text understanding. arXiv preprint arXiv:1607.04492, 2016a.
263
+
264
+ Tsendsuren Munkhdalai and Hong Yu. Neural semantic encoders. arXiv preprint arXiv:1607.04315, 2016b.
265
+
266
+ Hamid Palangi, Li Deng, Yelong Shen, Jianfeng Gao, Xiaodong He, Jianshu Chen, Xinying Song, and Rabab Ward. Deep sentence embedding using long short-term memory networks: Analysis and application to information retrieval. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 24(4):694–707, 2016.
267
+
268
+ Ankur P. Parikh, Oscar Tackstrom, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model for natural language inference. In Proceedings of EMNLP, 2016.
269
+
270
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, volume 14, pp. 1532–43, 2014.
271
+
272
+ Richard Socher, Jeffrey Pennington, Eric H. Huang, Andrew Y. Ng, and Christopher D. Manning. Semi-supervised recursive autoencoders for predicting sentiment distributions. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pp. 151–161, Edinburgh, Scotland, UK., July 2011. Association for Computational Linguistics. URL http: //www.aclweb.org/anthology/D11-1014.
273
+
274
+ Richard Socher, Alex Perelygin, Jean Y Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { \Upsilon { Y 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.
275
+
276
+ Kai Sheng Tai, Richard Socher, and Christopher D. Manning. Improved semantic representations from tree-structured long short-term memory networks. In Proceedings of ACL, pp. 1556–1566, 2015.
277
+
278
+ Ming Tan, Cicero dos Santos, Bing Xiang, and Bowen Zhou. Improved representation learning for question answer matching. In Proceedings of ACL, pp. 464–473, Berlin, Germany, August 2016. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/ P16-1044.
279
+
280
+ Theano Development Team. Theano: A {Python} framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.0, 2016. URL http://arxiv.org/abs/1605. 02688.
281
+
282
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. arXiv preprint arXiv:1511.06361, 2015.
283
+
284
+ Wenpeng Yin and Hinrich Schutze. Convolutional neural network for paraphrase identification. ¨ In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 901–911, 2015.
285
+
286
+ # APPENDIX
287
+
288
+ # A PRUNED MLP FOR STRUCTURED MATRIX SENTENCE EMBEDDING
289
+
290
+ As a side effect of having multiple vectors to represent a sentence, the matrix sentence embedding is usually several times larger than vector sentence embeddings. This results in needing more parameters in the subsequent fully connected layer, which connects every hidden units to every units in the matrix sentence embedding. Actually in the example shown in Figure 1, this fully connected layer takes around $90 \%$ percent of the parameters. See Table 4. In this appendix we are going to introduce a weight pruning method which, by utilizing the 2D structure of matrix embedding, is able to drastically reduce the number of parameters in the fully connected hidden layer.
291
+
292
+ Inheriting the notation used in the main paper, let the matrix embedding $M$ has a shape of $r$ by $u$ , and let the fully connected hidden layer has $b$ units. The normal fully connected hidden layer will require each hidden unit to be connected to every unit in the matrix embedding, as shown in Figure 1. This ends up with $r \times u \times b$ parameters in total.
293
+
294
+ However there are 2-D structures in the matrix embedding, which we should make use of. Each row $\mathbf { \dot { \phi } } m _ { i }$ in Figure 1) in the matrix is computed from a weighted sum of LSTM hidden states, which means they share some similarities
295
+
296
+ To reflect these similarity in the fully connected layer, we split the hidden states into $r$ equally sized groups, with each group having $p$ units. The $i$ -th group is only fully connected to the $i$ -th row in the matrix representation. All connections that connects the $i$ -th group hidden units to other rows of the matrix are pruned away. In this way, Simillarity between different rows of matrix embedding are reflected as symmetry of connecting type in the hidden layer. As a result, the hidden layer can be interperated as also having a 2-D structute, with the number $( r )$ and size $( p )$ of groups as its two dimensions (The $M ^ { v }$ in Figure 6). When the total number of hidden units are the same (i.e., $r \times p = b ,$ ), this process prunes away $( r - 1 ) / r$ of weight values, which is a fairly large portion when $r$ is large.
297
+
298
+ ![](images/e429249761e9fa370a75158c97648271293e9bfbedb48b479ee3d18088cd066e.jpg)
299
+ Figure 6: Hidden layer with pruned weight connections. $M$ is the matrix sentence embedding, $M ^ { v }$ and $M ^ { h }$ are the structured hidden representation computed by pruned weights.
300
+
301
+ Table 4: Model Size Comparison Before and After Pruning
302
+
303
+ <table><tr><td></td><td>Hidden layer</td><td> Softmax</td><td>Other Parts</td><td>Total</td><td>Accuracy</td></tr><tr><td>Yelp, Original, b=3000</td><td>54M</td><td>15K</td><td>1.3M</td><td>55.3M</td><td>64.21%</td></tr><tr><td>Yelp,Pruned, p=150, q=10</td><td>2.7M</td><td>52.5K</td><td>1.3M</td><td>4.1M</td><td>63.86%</td></tr><tr><td>Age, Original, b=4000</td><td>72M</td><td>20K</td><td>1.3M</td><td>73.2M</td><td>80.45%</td></tr><tr><td>Age,Pruned, p=25, q=20</td><td>822K</td><td>63.75K</td><td>1.3M</td><td>2.1M</td><td>77.32%</td></tr><tr><td>SNLI, Original, b=4000 SNLI, Pruned, p=300, q=10</td><td>72M 5.6M</td><td>12K 45K</td><td>22.9M 22.9M</td><td>95.0M 28.6M</td><td>84.43% 83.16%</td></tr></table>
304
+
305
+ On the other dimension, another form of similarity exists too. For each vector representation $m _ { i }$ in $M$ , the $j$ -th element $m _ { i j }$ is a weighted sum of an LSTM hidden unit at different time steps. And for a certain $j$ -th element in all vector representations, they are summed up from a same LSTM hidden unit. We can also reflect this similarity into the symmetry of weight connections by using the same pruning method we did above. Thus we will have another 2-D structured hidden states sized $u$ -by- $q$ , noted as $M ^ { h }$ in Figure 6.
306
+
307
+ Table 4 takes the model we use for yelp dataset as a concrete example, and compared the number of parameters in each part of the model, both before and after pruning. We can see the above pruning method drastically reduces the model size. Note that the $p$ and $q$ in this structure can be adjusted freely as hyperparameters. Also, we can continue the corresponding pruning process on top of $M ^ { v }$ and ${ \dot { M } } ^ { h }$ over and over again, and end up with having a stack of structured hidden layers, just like stacking fully connected layers.
308
+
309
+ The subsequent softmax layer will be fully connected to both $M _ { v }$ and $M _ { h }$ , i.e., each unit in the softmax layer is connected to all units in $M _ { v }$ and $M _ { h }$ . This is not a problem since the speed of softmax is largely dependent of the number of softmax units, which is not changed.In addition, for applications like sentiment analysis and textural entailment, the softmax layer is so tiny that only contains several units.
310
+
311
+ Experimental results in the three datasets has shown that, this pruning mechanism lowers performances a bit, but still allows all three models to perform comparable or better than other models compared in the paper.
312
+
313
+ # B DETAILED STRUCTURE OF THE MODEL FOR SNLI DATASET
314
+
315
+ In Section 2 we tested our matrix sentence embedding model for the textual entailment task on the SNLI dataset. Different from the former two tasks, the textual entailment task consists of a pair of sentences as input. We propose to use a set of multiplicative interactions to combine the two matrix embeddings extracted for each sentence. The form of multiplicative interaction is inspired by Factored Gated Autoencoder (Memisevic, 2013).
316
+
317
+ ![](images/22b6eb1c3efb70e442f8931e24c4aef61dec1d1f63c6ed017e9593cfd00e10ca.jpg)
318
+ Figure 7: Model structure used for textual entailment task.
319
+
320
+ The overall structure of our model for SNLI is dipicted in Figure 7. For both hypothesis and premise, we extract their embeddings $M _ { h }$ and $M _ { p }$ in the figure) independently, with a same LSTM and attention mechanism. The parameters of this part of model are shared (rectangles with dashed orange line in the figure).
321
+
322
+ Comparing the two matrix embeddings corresponds to the green dashed rectangle part in the figure, which computes a single matrix embedding $( F _ { r } )$ as the factor of semantic relation between the two sentences. To represent the relation between $M _ { h }$ and $M _ { p }$ , $F _ { r }$ can be connected to $M _ { h }$ and $M _ { p }$ through a three-way multiplicative interaction. In a three-way multiplicative interaction, the value of anyone of $F _ { r }$ , $M _ { h }$ and $M _ { p }$ is a function of the product of the others. This type of connection is originally introduced to extract relation between images (Memisevic, 2013). Since here we are just computing the factor of relations $( F _ { r } )$ from $M _ { h }$ and $M _ { p }$ , it corresponds to the encoder part in the Factored Gated Autoencoder in Memisevic (2013). We call it Gated Encoder in Figure 7.
323
+
324
+ First we multiply each row in the matrix embedding by a different weight matrix. Repeating it over all rows, corresponds to a batched dot product between a 2-D matrix and a 3-D weight tensor. Inheriting the name in (Memisevic, 2013), we call the resulting matrix as factor. Doing the batched dot for both hypothesis embedding and premise embedding, we have $F _ { h }$ and $F _ { p }$ , respectively.
325
+
326
+ $$
327
+ \begin{array} { r } { F _ { h } = b a t c h e d d o t ( M _ { h } , W _ { f h } ) } \\ { F _ { p } = b a t c h e d d o t ( M _ { p } , W _ { f p } ) } \end{array}
328
+ $$
329
+
330
+ Here $W _ { f h }$ and $W _ { f p }$ are the two weight tensors for hypothesis embedding and premise embedding.
331
+
332
+ The factor of the relation $( F _ { r } )$ is just an element-wise product of $F _ { h }$ and $F _ { p }$ (the triangle in the middle of Figure 7):
333
+
334
+ $$
335
+ F _ { r } = F _ { h } \odot F _ { p }
336
+ $$
337
+
338
+ Here $\odot$ stands for element-wise product. After the $F _ { r }$ layer, we then use an MLP with softmax output to classify the relation into different categlories.
md/train/BkwHObbRZ/BkwHObbRZ.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/Db4yerZTYkz/Db4yerZTYkz.md ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SHAPE-TEXTURE DEBIASED NEURAL NETWORK TRAINING
2
+
3
+ Yingwei $\mathbf { L i } ^ { 1 }$ , Qihang $\mathbf { Y u } ^ { 1 }$ , Mingxing $\mathbf { T a n } ^ { 2 }$ , Jieru Mei1, Peng Tang1, Wei Shen3
4
+ Alan Yuille1 & Cihang Xie4
5
+ 1Johns Hopkins University 2Google Brain 3Shanghai Jiaotong University
6
+ 4University of California, Santa Cruz
7
+
8
+ # ABSTRACT
9
+
10
+ Shape and texture are two prominent and complementary cues for recognizing objects. Nonetheless, Convolutional Neural Networks are often biased towards either texture or shape, depending on the training dataset. Our ablation shows that such bias degenerates model performance. Motivated by this observation, we develop a simple algorithm for shape-texture debiased learning. To prevent models from exclusively attending on a single cue in representation learning, we augment training data with images with conflicting shape and texture information (e.g., an image of chimpanzee shape but with lemon texture) and, most importantly, provide the corresponding supervisions from shape and texture simultaneously.
11
+
12
+ Experiments show that our method successfully improves model performance on several image recognition benchmarks and adversarial robustness. For example, by training on ImageNet, it helps ResNet-152 achieve substantial improvements on ImageNet $( + 1 . 2 \% )$ , ImageNet-A $( + 5 . 2 \% )$ , ImageNet-C $( + 8 . 3 \% )$ and Stylized-ImageNet $( + 1 1 . 1 \% )$ , and on defending against FGSM adversarial attacker on ImageNet $( + 1 4 . 4 \% )$ . Our method also claims to be compatible to other advanced data augmentation strategies, e.g., Mixup and CutMix. The code is available here: https://github.com/LiYingwei/ ShapeTextureDebiasedTraining.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ It is known that both shape and texture serve as essential cues for object recognition. A decade ago, computer vision researchers had explicitly designed a variety of hand-crafted features, either based on shape (e.g., shape context (Belongie et al., 2002) and inner distance shape context (Ling & Jacobs, 2007)) or texture (e.g., textons (Malik et al., 2001)), for object recognition. Moreover, researchers found that properly combining shape and texture can further recognition performance (Shotton et al., 2009; Zheng et al., 2007), demonstrating the superiority of possessing both features.
17
+
18
+ Nowadays, as popularized by Convolutional Neural Networks (CNNs) (Krizhevsky et al., 2012), the features used for object recognition are automatically learned, rather than manually designed. This change not only eases human efforts on feature engineering, but also yields much better performance on a wide range of visual benchmarks (Simonyan & Zisserman, 2015; He et al., 2016; Girshick et al., 2014; Girshick, 2015; Ren et al., 2015; Long et al., 2015; Chen et al., 2015). But interestingly, as pointed by Geirhos et al. (2019), the features learned by CNNs tend to bias toward either shape or texture, depending on the training dataset.
19
+
20
+ We verify that such biased representation learning (towards either shape or texture) weakens CNNs’ performance.1 Nonetheless, surprisingly, we also find (1) the model with shape-biased representations and the model with texture-biased representations are highly complementary to each other, e.g., they focus on completely different cues for predictions (an example is provided in Figure 1); and (2) being biased towards either cue may inevitably limit model performance, e.g., models may not be able to tell the difference between a lemon and an orange without texture information. These observations altogether deliver a promising message—biased models (e.g., ImageNet trained (texturebiased) CNNs (Geirhos et al., 2019) or (shape-biased) CNNs (Shi et al., 2020)) are improvable.
21
+
22
+ ![](images/83235d307c0b6ec9fed007c2a255dfacb36f496a9e7ac9b8cefa396660526811.jpg)
23
+ Figure 1: Both shape and texture are essential cues for object recognition, and biasing towards either one degenerates model performance. As shown above, when classifying this fur coat image, the shape-biased model is confounded by the cloth-like shape therefore predict it as a poncho, and the texture-biased model confuses it as an Egyptian cat because of the misleading texture. Nonetheless, our debiased model can successfully recognize it as a fur coat by leveraging both shape and texture.
24
+
25
+ To this end, we hereby develop a shape-texture debiased neural network training framework to guide CNNs for learning better representations. Our method is a data-driven approach, which let CNNs automatically figure out how to avoid being biased towards either shape or texture from their training samples. Specifically, we apply style transfer to generate cue conflict images, which breaks the correlation between shape and texture, for augmenting the original training data. The most important recipe of training a successful shape-texture debiased model is that we need to provide supervision from both shape and texture on these generated cue conflict images, otherwise models will remain being biased.
26
+
27
+ Experiments show that our proposed shape-texture debiased neural network training significantly improves recognition models. For example, on the challenging ImageNet dataset (Russakovsky et al., 2015), our method helps ResNet-152 gain an absolute improvement of $1 . 2 \%$ , achieving $7 9 . 8 \%$ top-1 accuracy. Additionally, compared to its vanilla counterpart, this debiased ResNet-152 shows better generalization on ImageNet-A (Hendrycks et al., 2019) $( + 5 . 2 \% )$ , ImageNet-C (Hendrycks & Dietterich, 2019) $( + 8 . 3 \% )$ and Stylized ImageNet (Geirhos et al., 2019) $( + 1 1 . 1 \% )$ , and stronger robustness on defending against FGSM adversarial attacker on ImageNet $( + 1 4 . 4 \% )$ . Our shape-texture debiased neural network training is orthogonal to other advanced data augmentation strategies, e.g., it further boosts CutMix-ResNeXt-101 (Yun et al., 2019) by $0 . 7 \%$ on ImageNet, achieving $8 1 . 2 \%$ top-1 accuracy.
28
+
29
+ # 2 SHAPE/TEXTURE BIASED NEURAL NETWORKS
30
+
31
+ The biased feature representation of CNNs mainly stems from the training dataset, e.g., Geirhos et al. (2019) point out that models will be biased towards shape if trained on Stylized-ImageNet dataset. Following Geirhos et al. (2019), we hereby present a similar training pipeline to acquire shapebiased models or texture-biased models. By evaluating these two kinds of models, we observe the necessity of possessing both shape and texture representations for CNNs to better recognize objects.
32
+
33
+ # 2.1 MODEL ACQUISITION
34
+
35
+ Data generation. Similar to Geirhos et al. (2019), we apply images with conflicting shape and texture information as training samples to obtain shape-biased or texture-biased models. But different from Geirhos et al. (2019), an important change in our cue conflict image generation procedure is that we override the original texture information with the informative texture patterns from another randomly selected image, rather than with the uninformative style of randomly selected artistic paintings. That being said, to create a new training sample, we need to first select a pair of images from the training set uniformly at random, and then apply style transfer to blend their shape and texture information. Such a generated example is shown in Figure 2, i.e., the image of chimpanzee shape but with lemon texture.
36
+
37
+ ![](images/dec6f3cfa7570413769bd477e908d876c8ce5e7c56a24a017462103df59a15ae.jpg)
38
+ Figure 2: Illustration of the our training pipeline for acquiring (a) a shape-biased model, (b) a texture-biased model, and (c) a shape-texture debiased model. Specifically, these models share the same training samples, i.e. images with conflicting texture and shape information, generated by style transfer between two randomly selected images; but apply distinct labelling strategies: in (a) & (b), labels are determined by the images that provides shape (or texture) information in style transfer, for guiding models to learn more shape (or texture) representations; in (c), labels are jointly determined by the pair of images in style transfer, for avoiding bias in representation learning.
39
+
40
+ Label assignment. The way of assigning labels to cue conflict images controls the bias of learned models. Without loss of generality, we show the case of learning a texture-biased model. To guide the model to attend more on texture, the labels assigned to the cue conflict images here will be exclusively based on the texture information, e.g., the image of chimpanzee shape but with lemon texture will be labelled as lemon, shown in Figure 2(b). By this way, the texture information is highly related to the “ground-truth” while the shape information only serves as a nuisance factor during learning. Similarly, to learn a shape-biased model, the label assignment of cue conflict images will be based on shape only, e.g., the image of chimpanzee shape but with lemon texture now will be labelled as chimpanzee, shown in Figure 2(a).
41
+
42
+ # 2.2 EVALUATION AND OBSERVATION
43
+
44
+ To reduce the computational overhead in this ablation, all models are trained and evaluated on ImageNet-200, which is a 200 classes subset of the original ImageNet, including 100,000 images (500 images per class) for training and 10,000 images (50 images per class) for validation. Akin to Geirhos et al. (2019), we observe that the models with biased feature representations tend to have inferior accuracy than their vanilla counterparts. For example, our shape-biased ResNet-18 only achieves $7 3 . 9 \%$ top-5 ImageNet-200 accuracy, which is much lower than the vanilla ResNet-18 with $8 8 . 2 \%$ top-5 ImageNet-200 accuracy.
45
+
46
+ Though biased representations weaken the overall classification accuracy, surprisingly, we find they are highly complementary to each other. We first visualize the attended image regions of biased models, via Class Activation Mapping (Zhou et al., 2016), in Figure 3. As we can see here, the shape-biased model and the texture-biased model concentrate on different cues for predictions. For instance, on the leftmost tabby cat image, the shape-biased model mainly focuses on the cat head, while the texture-biased model mainly focuses on the lower body and the front legs of the cat. Such attention mechanisms are correlated to their learned representations—the shape-biased model extracts the shape of the cat head as an important signal for predictions, while the texture-biased model relies on the texture information of cat fur for predictions.
47
+
48
+ ![](images/46445119eee72fa07255beb2dc4195191637244b96b8d02509c096f6a55e6f06.jpg)
49
+ Figure 3: The shape-biased model and the texture-biased model attend on complementary cues for predictions. We use Class Activation Mapping to visualize which image regions are attended by models. Redder regions indicates more attentions are paid by models.
50
+
51
+ ![](images/896f20f3dc475d08249a0debfd12f702f8e65a4a9ce6afce1bc6ef0e1d66f59a.jpg)
52
+ Figure 4: The shape-biased model and the texture-biased model are good/bad at classifying different object categories. We sort these object categories according to the model’s corresponding top-1 accuracy, where the righter one indicates a lower accuracy achieved by the model.
53
+
54
+ As distinct cues are picked by shape-biased/texture-biased models, a more concrete observation is they are good/bad at classifying quite different object categories. As showed in Figure 4, the shapebiased model is good at recognizing objects with representative shape structure like obelisk, but is bad at recognizing objects whose shape is uninformative or almost indistinguishable from others like fur coat. Similarly, the texture-biased model can effectively recognize objects with unique texture patterns like brain coral but may fail to recognize objects with unpredictable texture like trolleybus (as its side body can be painted with different advertisements). Besides, biased models may inevitably perform poorly on certain categories as insufficient cues are applied. For examples, it is challenging to distinguish between a lemon and an orange if texture information cannot be utilized, or to distinguish between an lion and a tabby cat without shape information.
55
+
56
+ Given the analysis above, we can conclude that biased representations limit models’ recognition ability. But meanwhile, our ablation delivers a promising message—the features learned by biased models are highly complementary to each other. This observation indicates the current training framework is improvable (as the resulted models are biased towards texture (Geirhos et al., 2019) or shape (Shi et al., 2020)), and offers a potential direction for building a stronger one—we should train models to properly acquire both shape and texture feature representations. We will introduce a simple method for doing so next.
57
+
58
+ # 3 SHAPE-TEXTURE DEBIASED NEURAL NETWORK TRAINING
59
+
60
+ Recall that when obtaining a biased model, the strategy of label assignment is pivot—when the labels are exclusively determined by the images that provide shape (or texture) information in style transfer, we will obtain a shape-biased (or texture-biased) model. Therefore, to guide models for leveraging both shape and texture for predictions, we hereby propose a simple way, which is inspired by Mixup (Zhang et al., 2018), to softly construct labels during training. In other words, given the one-hot label of the shape-source image $y _ { s }$ and the one-hot label of the texture-source image $y _ { t }$ , the new label that we assigned to the cue conflict image is
61
+
62
+ $$
63
+ \widetilde { y } = \gamma * y _ { s } + ( 1 - \gamma ) * y _ { t } ,
64
+ $$
65
+
66
+ where $\gamma \in [ 0 , 1 ]$ is a manually selected hyperparameter to control the relative importance between shape and texture. By ranging the shape-texture coefficient $\gamma$ from 0 to 1, we obtain a path to evolve the model from being a texture-biased one (i.e., $\gamma = 0$ ) to being a shape-biased one (i.e., $\gamma = 1$ ). Although the two extreme ends lead to biased models with inferior performance, we empirically show that there exist a sweet point along this interpolation path, i.e., the learned models can properly acquires both shape and texture feature representations and achieve superior performance on a wide range of image recognition benchmarks.
67
+
68
+ We name this simple method as shape-texture debiased neural network training, and illustrate the training pipeline in Figure 2(c). It is worth to mention that, although Figure 2 only shows the procedure of applying our method to the image classification task, this training framework is general and has the potential to be extended to other computer vision tasks, e.g., a simple showcase on semantic segmentation is presented in Section 4.4.
69
+
70
+ # 4 EXPERIMENTS
71
+
72
+ # 4.1 EXPERIMENTS SETUP
73
+
74
+ Datasets. We evaluate models on ImageNet classification and PASCAL VOC semantic segmentation. ImageNet dataset (Russakovsky et al., 2015) consists of 1.2 million images for training, and 50,000 for validation, from 1,000 classes. PASCAL VOC 2012 segmentation dataset (Everingham et al., 2012) with extra annotated images from (Hariharan et al., 2011) involves 20 foreground object classes and one background class, including 10,582 training images and 1,449 validation images.
75
+
76
+ Going beyond the standard benchmarks, we further evaluate models’ generalization on ImageNetA, ImageNet-C and Stylized-ImageNet, and robustness by defending against FGSM adversarial attacker on ImageNet. ImageNet- $C$ (Hendrycks & Dietterich, 2019) is a benckmark dataset that measures models’ corruption robustness. It is constructed by applying 75 common visual corruptions to the ImageNet validation set. ImageNet-A (Hendrycks et al., 2019) includes 7,500 natural adversarial examples that successfully attacks unseen classifiers. These examples are much harder than original ImageNet validation images due to scene complications encountered in the long tail of scene configurations and by exploiting classifier blind spots (Hendrycks et al., 2019). StylizedImageNet (Geirhos et al., 2019) is a stylized version of ImageNet that constructed by re-rendering the original images by AdaIN stylizer (Huang & Belongie, 2017). The generated images keep the original global shape information but removes the local texture information. FGSM (Goodfellow et al., 2015) is a widely used adversarial attacker to evaluate model robustness. We set the maximum perturbation change per pixel $\epsilon = 1 6 / 2 5 5$ for FGSM.
77
+
78
+ Implementation details. We choose ResNet (He et al., 2016) as the default architecture. For image classification tasks, our implementation is based on the publicly available framework in PyTorch2. To generate cue conflict images, we follow Geirhos et al. (2019) to use Adaptive Instance Normalization (Huang & Belongie, 2017) in style transfer, and set stylization coefficient $\alpha = 0 . 5$ . Importantly, to increase the diversity of training samples, we generate these cue conflict images on-the-fly during training. We choose the shape-texture coefficient $\gamma = 0 . 8$ when assigning labels.
79
+
80
+ When training shape-biased, texture-biased and our shape-texture debiased models, we always apply the auxiliary batch normalization (BN) design (Xie et al., 2020; Xie & Yuille, 2020; Chen et al.,
81
+
82
+ Table 1: The performance of the vanilla training, the shape-biased (S-biased) training, the texturebiased (T-biased) training, and our shape-texture debiased training on ImageNet. For all ResNet models, our debiased training shows the best performance among others.
83
+
84
+ <table><tr><td></td><td>VANILLA</td><td>2×EPOCHS</td><td>S-BIASED</td><td>T-BIASED</td><td>DEBIASED</td></tr><tr><td>ResNet-50</td><td>76.4</td><td>76.4 (+0.0)</td><td>76.2 (-0.2)</td><td>75.3 (-1.1)</td><td>76.9 (+0.5)</td></tr><tr><td>ResNet-101</td><td>78.0</td><td>78.0 (+0.0)</td><td>78.0 (-0.0)</td><td>77.4 (-0.6)</td><td>78.9 (+0.9)</td></tr><tr><td>ResNet-152</td><td>78.6</td><td>79.1 (+0.5)</td><td>78.6 (-0.0)</td><td>78.1 (-0.5)</td><td>79.8 3(+1.2)</td></tr></table>
85
+
86
+ <table><tr><td></td><td>IN-A Acc. ↑</td><td>IN-C mCE↓</td><td>S-IN Acc. ↑</td><td>FGSM Acc.↑</td></tr><tr><td>ResNet-50 +Debiased</td><td>2.0 3.5 (+1.5)</td><td>75.0 67.5 (-7.5)</td><td>7.4 17.4 (+10.0)</td><td>17.1 27.4 (+10.3)</td></tr><tr><td>ResNet-101 +Debiased</td><td>5.6 9.1 1 (+3.5)</td><td>69.8 62.2 (-7.6)</td><td>9.9 22.0 (+12.1)</td><td>23.1 34.4 (+11.3)</td></tr><tr><td>ResNet-152 +Debiased</td><td>7.4 12.6 (+5.2)</td><td>67.2 58.9 (-8.3)</td><td>11.3 22.4 (+11.1)</td><td>25.2 39.6 (+14.4)</td></tr></table>
87
+
88
+ Table 2: The model robustness on ImageNet-A (IN-A), ImageNet-C (IN-C), Stylized-ImageNet (SIN), and on defending against FGSM adversarial attacker on ImageNet. Our shape-texture debiased neural network training significantly boosts the model robustness over the vanilla training baseline.
89
+
90
+ 2021) to bridge the domain gap between the original data and the augmented data, i.e., the main BN is exclusively running on original ImageNet images and the auxiliary BN is exclusively running on cue conflict images. We follow Xie et al. (2020) to always apply the main BN for performance evaluation. Besides, since our biased models and debiased models are all trained with both the original data and the augmented data (i.e., $2 \times$ data are used in training), we also consider a stronger baseline (i.e., $2 \times$ epochs training) which doubles the schedule of the vanilla training baseline, for the purpose of matching the total training cost.
91
+
92
+ # 4.2 RESULTS
93
+
94
+ Model accuracy. Table 1 shows the results on ImageNet. For all ResNet models, the proposed shape-texture debiased neural network training consistently outperforms the vanilla training baseline. For example, it helps ResNet-50 achieve $7 6 . 9 \%$ top-1 accuracy, beating its vanilla counterpart by $0 . 5 \%$ . Our method works better for larger models, e.g., it further improves the vanilla ResNet-152 by $1 . 2 \%$ , achieving $7 9 . 8 \%$ top-1 accuracy.
95
+
96
+ We then compare our shape-texture debiased training to the $2 \times$ epochs training baseline. We find that simply doubling the schedule of the vanilla training baseline cannot effectively lead to improvements like ours. For examples, compared to the vanilla ResNet-101, this $2 \times$ epochs training fails to provide additional improvements, while ours furthers the top-1 accuracy by $1 . 0 \%$ . This result suggests that it is non-trivial to improve performance even if more computational budgets are given.
97
+
98
+ Lastly, we compare ours to the biased training methods. Though the only difference between our method and the biased training methods is the strategy of label assignment (as shown in Figure 2), it imperatively affects model performance. For example, compared to the vanilla baseline, both the shape-biased training and the texture-biased training fail to improve (sometimes even slightly hurt) the model accuracy, while our shape-texture debiased neural network training successfully leads to consistent and substantial accuracy improvements.
99
+
100
+ Model robustness. Next, we evaluate models’ generalization on ImageNet-A, ImageNet-C and Stylized-ImageNet, and robustness on defending against FGSM on ImageNet. We note these tasks are much more challenging than the original ImageNet classification, e.g., the ImageNet trained ResNet-50 only achieves $2 . 0 \%$ accuracy on ImageNet-A, $7 5 . 0 \%$ mCE on ImageNet-C, $7 . 4 \%$ accuracy on Stylized-ImageNet, and $1 7 . 1 \%$ accuracy on defending against FGSM adversarial attacker. As shown in Table 2, our shape-texture debiased neural network training beats the vanilla training baseline by a large margin on all tasks for all ResNet models. For example, it substantially boosts ResNet-152’s performance on ImageNet-A $( + 5 . 2 \%$ , from $7 . 4 \%$ to $1 2 . 6 \%$ ), ImageNet-C $( - 8 . 3 \%$ , from $6 7 . 2 \%$ to $5 8 . 9 \%$ , the lower the better) and Stylized-ImageNet $( + 1 1 . 1 \%$ , from $1 1 . 3 \%$ to $2 2 . 4 \%$ ), and on defending against FGSM on ImageNet $+ 1 4 . 4 \%$ , from $2 5 . 2 \%$ to $3 9 . 6 \%$ ). These results altogether suggest that our shape-texture debiased neural network training is an effective way to mitigate the issue of shortcut learning (Geirhos et al., 2020).
101
+
102
+ <table><tr><td></td><td>IN Acc. 个</td><td>IN-A Acc.个</td><td>IN-C mCE↓</td><td>S-IN Acc. 个</td><td>FGSM Acc.个</td></tr><tr><td>ResNet-50</td><td>76.4</td><td>2.0</td><td>75.0</td><td>7.4</td><td>17.1</td></tr><tr><td>CutMix + MoEx (Li et al., 2021)</td><td>79.0</td><td>8.0</td><td>74.8</td><td>5.0</td><td>41.0</td></tr><tr><td>DeepAugment + AugMix (Hendrycks et al., 2020)</td><td>75.8</td><td>3.9</td><td>53.6</td><td>21.2</td><td>18.8</td></tr><tr><td>SIN (Geirhos et al., 2019)</td><td>60.2</td><td>2.4</td><td>77.3</td><td>56.2</td><td>5.6</td></tr><tr><td>Shape-Texture Debiased Training (ours)</td><td>76.9</td><td>3.5</td><td>67.5</td><td>17.4</td><td>27.4</td></tr></table>
103
+
104
+ Table 3: Compare with state-of-the-art methods using ResNet-50 on ImageNet (IN), ImageNet-A (IN-A), ImageNet-C (IN-C), Stylized-ImageNet (S-IN), and on defending against FGSM on ImageNet. We use green to denote significant improvement, red to denote performance drop, and gray to denote similar performance. We observe our shape-texture debiased training is the only method that successfully leads to improvements over the vanilla baseline on all benchmarks.
105
+
106
+ <table><tr><td>Datasets</td><td>VANILLA</td><td>S-BIASED</td><td>T-BIASED</td><td>DEBIASED</td></tr><tr><td>ImageNet-Sketch</td><td>23.8</td><td>27.9</td><td>24.3</td><td>28.4</td></tr><tr><td>ImageNet-R</td><td>36.2</td><td>40.6</td><td>36.7</td><td>40.8</td></tr><tr><td>Kylberg Texture</td><td>99.5</td><td>99.1</td><td>99.6</td><td>99.5</td></tr><tr><td>FlickerMaterial</td><td>74.6</td><td>73.3</td><td>79.2</td><td>75.8</td></tr></table>
107
+
108
+ Table 4: The performance comparison between Vanilla, Shape-biased, Texture-biased, and ShapeTexture Debiased models on ImageNet-Sketch, ImageNet-R, Kylberg Texture, and Flicker Material datasets. We note the shape-biased and the shape-texture debiased models perform better on shape datasets (ImageNet-Sketch and ImageNet-R); the texture-biased and the shape-texture debiased models perform better on texture datasets (Kylberg Texture and Flicker Material).
109
+
110
+ Comparing to SoTAs. We further compare our shape-texture debiased model with the SoTA on ImageNet and ImageNet-A (CutMix $^ +$ MoEx (Li et al., 2021)), the SoTA on ImageNet-C (DeepAugment $^ +$ AugMix (Hendrycks et al., 2020)), and the SoTA on Stylized-ImageNet (SIN (Geirhos et al., 2019)). Interestingly, we note the improvements of all these SoTAs are not consistent across different benchmarks. For example, as shown in Table 3, SIN significantly improves the results on Stylized-ImageNet, but at the cost of huge performance drop on ImageNet $( - 1 6 . 2 \% )$ and ImageNetC $( - 2 . 3 \% )$ . Our shape-texture debiased training stands as the only method that can improve the vanilla training baseline holistically.
111
+
112
+ # 4.3 ABLATIONS
113
+
114
+ Comparing to model ensembles. An alternative but na¨ıve way for obtaining the model with both shape and texture information is to ensemble a shape-biased model and a texture-biased model. We note this ensemble strategy yields a model of on-par performance with our shape-texture debiased model on ImageNet $7 7 . 2 \%$ vs. $7 6 . 9 \%$ ). Nonetheless, interestingly, when measuring model robustness, such model ensemble strategy is inferior than ours. For example, compared to our proposed debiased training, this ensemble strategy is $1 . 5 \%$ worse on ImageNet-A ( $2 . 0 \%$ vs. $3 . 5 \%$ ), $1 . 1 \%$ worse on ImageNet-C $6 8 . 6 ~ \mathrm { m C E }$ vs. $6 7 . 5 ~ \mathrm { m C E }$ ), $1 . 1 \%$ worse on Stylized-ImageNet ( $1 6 . 3 \%$ vs. $1 7 . 4 \%$ ), and $7 . 0 \%$ worse on defending against FGSM $2 0 . 4 \%$ vs. $2 7 . 4 \%$ ). Moreover, due to model ensemble, this strategy is $2 \times$ expensive at the inference stage. These evidences clearly demonstrate the effectiveness and efficiency of the proposed shape-texture debiased training.
115
+
116
+ Does our method help models to learn debiased shape-texture representations? Here we take a close look at whether our method indeed prevents models from being biased toward shape or texture during learning. We evaluate models in Section 4.2 on two kinds of datasets: (1) ImageNetSketch dataset (Wang et al., 2019) and ImageNet-R (Hendrycks et al., 2020) for examining how well models can capture shape; and (2) Kylberg Texture dataset (Kylberg, 2011) and Flicker Material dataset (Sharan et al., 2014) for examining how well models can capture texture. Specifically, since object categories from two texture datasets are not compatible to that from ImageNet dataset, we retrain the last fc-layer (while keeping all other layers untouched) of all models on Kylberg Texture dataset or Flicker Material dataset for 5 epochs. The results are shown in Table 4.
117
+
118
+ We first analyze results on ImageNet-Sketch dataset. We observe our shape-texture debiased models are as good as the shape-biased models, and significantly outperforms the texture-biased models and the vanilla training models. For instance, using ResNet-50, our shape-texture debiased training and shape-biased training achieve $2 8 . 4 \%$ top-1 accuracy and $2 7 . 9 \%$ top-1 accuracy, while texture-biased training and vanilla training only get $2 4 . 3 \%$ top-1 accuracy and $2 3 . 8 \%$ top-1 accuracy. A similar observation can be seen from ImageNet-R. These results support that our method helps models acquire stronger shape representations than the vanilla training.
119
+
120
+ ![](images/3b8f58c07b58608ea11407af951dddb69b2f963cbff7c4a52d31732da1be47c0.jpg)
121
+ Figure 5: Illustration of the data preparation pipeline of our shape-texture debiased neural network training on the semantic segmentation task.
122
+
123
+ We next analyze results on Kylberg Texture dataset. Similarly, we observe that our debiased model are comparable to the texture-biased model and the vanilla training model, and get better performance than the shape-biased model. On Flicker Material dataset, we observe that our debiased models are better than the vanilla training model and the shape-biased model. This phenomenon suggests texture information is effectively caught by our shape-texture debiased training. As a side note, it is expected that vanilla training are better than shape-biased training on these texture datasets, as Geirhos et al. (2019) point out that ImageNet trained models (i.e., vanilla training) also tend to be biased towards texture.
124
+
125
+ With the analysis above, we conclude that, compared to vanilla training, our shape-texture debiased training successfully helps networks effectively acquire both shape and texture representations.
126
+
127
+ Combining with other data augmentation methods. Our shape-texture debiased neural network training can be viewed as a data augmentation method, which trains models on cue conflict images. Nonetheless, our method specifically guides the model to learn debiased shape and texture representations, which could potentially serve as a complementary feature to other data augmentation methods. To validate this argument, we train models using a combination of our method and an existing data augmentation method (i.e., Mixup (Zhang et al., 2018) or CutMix (Yun et al., 2019)).
128
+
129
+ We choose ResNeXt-101 (Xie et al., 2017) as the backbone network, which reports the best top-1 ImageNet accuracy in both the Mixup paper, i.e., $7 9 . 9 \%$ , and the CutMix paper, i.e., $8 0 . 5 \%$ . Though building upon very strong baselines, our shape-texture debiased neural network training still leads to substantial improvements, e.g., it furthers ResNeXt-101-Mixup’s accuracy to $8 0 . 5 \%$ $( + 0 . 6 \% )$ , and ResNeXt-101-CutMix’s accuracy to $8 1 . 2 \%$ $( + 0 . 7 \% )$ . Meanwhile, models’ generalization also get greatly improved. For example, by combining CutMix and our method, ResNeXt-101 gets additional improvements on ImageNet-A $( + 1 . 4 \% )$ , ImageNet-C $( - 5 . 9 \%$ , the lower the better) and Stylized ImageNet $( + 7 . 5 \% )$ . These results support that our shape-texture debiased neural network training is compatible to existing data augmentation methods.
130
+
131
+ Shape-texture coefficient $\gamma$ . We set $\gamma = 0 . 8$ in our shape-texture debiased training. This value is found via the grid search over ImageNet-200 using ResNet-18. We now ablate its sensitivity on ImageNet using ResNet-50, where $\gamma$ is linearly interpolated between 0.0 and 1.0. By increasing the value of $\gamma$ , we observe that the corresponding accuracy on ImageNet first monotonically goes up, and then monotonically goes down. The sweet point can be reached by setting $\gamma = 0 . 7$ , where ResNet-50 achieves $7 7 . 0 \%$ top-1 ImageNet accuracy. Besides, we note that by setting $\gamma \in [ 0 . 5 , 0 . 9 ]$ can always lead to performance improvements over the vanilla baseline. These results demonstrate the robustness of our shape-texture debiased neural network training w.r.t. the coefficient $\gamma$ .
132
+
133
+ # 4.4 SEMANTIC SEGMENTATION RESULTS
134
+
135
+ We extend our shape-texture debiased neural network training to the segmentation task. We select DeepLabv3-ResNet-101 (Chen et al., 2017) as our backbone. To better incorporate our method with the segmentation task, the following changes are made when generating cue conflict images: (1) unlike in the classification task where the whole image is used as the texture source, we use a specific object (which can cropped from the background using the segmentation ground-truth) to provide texture information in style transfer; (2) when composing the soft label for the cue conflict image, we set the label mask from texture source as the full image (since the pattern from the texture source will fill the whole image after style transfer); and (3) we set stylization coefficient $\alpha = 0 . 2$ and shape-texture coefficient $\gamma = 0 . 9 5$ to prevent object boundaries from being overly blurred in style transfer. Figure 5 shows an illustration of our data preparation pipeline.
136
+
137
+ Results. Our shape-texture debiased training can also effectively improve segmentation models. For example, our method helps DeepLabv3-ResNet-101 achieve $7 7 . 6 \%$ mIOU, significantly beating its vanilla counterpart by $1 . 1 \%$ . Our method still shows advantages when compared to the $2 \times$ epochs training baseline. Doubling the learning schedule of the vanilla training can only lead to an improvement of $0 . 2 \%$ , which is still $0 . 9 \%$ worse than our shape-texture debiased training. These results demonstrate the potential of our methods in helping recognition tasks in general.
138
+
139
+ # 5 RELATED WORK
140
+
141
+ Data augmentation. Data augmentation is essential for the success of deep learning (LeCun et al., 1998; Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; Zhong et al., 2020; Cubuk et al., 2019; Lim et al., 2019; Cubuk et al., 2020). Our shape-texture debiased neural network training is related to a specific family of data augmentation, called Mixup (Zhang et al., 2018), which blends pairs of images and their labels in a convex manner, either at pixel-level (Zhang et al., 2018; Yun et al., 2019) or feature-level (Verma et al., 2019; Li et al., 2021). Our method can be interpreted as a special instantiation of Mixup which blends pairs of images at the abstraction level—images’ texture information and shape information are mixed. Our method successfully guides CNNs to learn better shape and texture representations, which is an important but missing piece in existing data argumentation methods.
142
+
143
+ Style transfer. Style transfer, closely related to texture synthesis and transfer, means generating a stylized image by combining a shape-source image and a texture-source image (Efros & Leung, 1999; Efros & Freeman, 2001; Elad & Milanfar, 2017). The seminal work (Gatys et al., 2016) demonstrate impressive style transfer results by matching feature statistics in convolutional layers of a CNN. Later follow-ups further improve the generation quality and speed (Huang & Belongie, 2017; Chen & Schmidt, 2016; Ghiasi et al., 2017; Li et al., 2017). In this work, we follow Geirhos et al. (2019) to use AdaIN (Huang & Belongie, 2017) to generate stylized images. Nonetheless, instead of applying style transfer between an image and an artistic paintings as in Geirhos et al. (2019), we directly apply style transfer on a pair of images to generate cue conflict images. This change is vital as it enables us to provide supervisions from both shape and texture during training.
144
+
145
+ # 6 CONCLUSION
146
+
147
+ There is a long-time debate about which cue dominates the object recognition. By carefully ablate the shape-biased model and the texture-biased model, we found though biased feature representations lead to performance degradation, they are complementary to each other and are both necessary for image recognition. To this end, we propose shape-texture debiased neural network training for guiding CNNs to learn better feature representations. The key in our method is that we should not only augment training set with cue conflict images, but also provide supervisions from both shape and texture. We empirically demonstrate the advantages of our shape-texture debiased neural network training on boosting both accuracy and robustness. Our method is conceptually simple and is generalizable to different image recognition tasks. We hope our work will shed light on understanding and improving convolutional neural networks.
148
+
149
+ # ACKNOWLEDGEMENT
150
+
151
+ This project is partially supported by ONR N00014-18-1-2119 and ONR N00014-20-1-2206. Cihang Xie is supported by the Facebook PhD Fellowship and a gift grant from Open Philanthropy. Yingwei Li thanks Zhiwen Wang for suggestions on figures.
152
+
153
+ # REFERENCES
154
+
155
+ Serge Belongie, Jitendra Malik, and Jan Puzicha. Shape matching and object recognition using shape contexts. TPAMI, 2002.
156
+
157
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Semantic image segmentation with deep convolutional nets and fully connected CRFs. In ICLR, 2015.
158
+
159
+ Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017.
160
+
161
+ Tian Qi Chen and Mark Schmidt. Fast patch-based style transfer of arbitrary style. NeurIPS Workshop, 2016.
162
+
163
+ Xiangning Chen, Cihang Xie, Mingxing Tan, Li Zhang, Cho-Jui Hsieh, and Boqing Gong. Robust and accurate object detection via adversarial learning. In CVPR, 2021.
164
+
165
+ Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation strategies from data. In CVPR, 2019.
166
+
167
+ Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In CVPR Workshops, 2020.
168
+
169
+ Alexei A Efros and William T Freeman. Image quilting for texture synthesis and transfer. In Proceedings of the 28th annual conference on Computer graphics and interactive techniques, 2001.
170
+
171
+ Alexei A Efros and Thomas K Leung. Texture synthesis by non-parametric sampling. In ICCV, 1999.
172
+
173
+ Michael Elad and Peyman Milanfar. Style transfer via texture synthesis. TIP, 2017.
174
+
175
+ M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The PASCAL Visual Object Classes Challenge 2012 (VOC2012) Results. http://www.pascalnetwork.org/challenges/VOC/voc2012/workshop/index.html, 2012.
176
+
177
+ Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In CVPR, 2016.
178
+
179
+ Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In ICLR, 2019.
180
+
181
+ Robert Geirhos, Jorn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, ¨ Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. arXiv preprint arXiv:2004.07780, 2020.
182
+
183
+ Golnaz Ghiasi, Honglak Lee, Manjunath Kudlur, Vincent Dumoulin, and Jonathon Shlens. Exploring the structure of a real-time, arbitrary neural artistic stylization network. In BMVC, 2017.
184
+
185
+ Ross Girshick. Fast R-CNN. In ICCV, 2015.
186
+
187
+ Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, 2014.
188
+
189
+ Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015.
190
+
191
+ Bharath Hariharan, Pablo Arbelaez, Lubomir Bourdev, Subhransu Maji, and Jitendra Malik. Semantic contours from inverse detectors. In ICCV, 2011.
192
+
193
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
194
+
195
+ Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR, 2019.
196
+
197
+ Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019.
198
+
199
+ Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020.
200
+
201
+ Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In ICCV, 2017.
202
+
203
+ Alex Krizhevsky, Ilya Sutskever, and Geoff Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012.
204
+
205
+ Gustaf Kylberg. Kylberg Texture Dataset v. 1.0. Centre for Image Analysis, Swedish University of Agricultural Sciences and Uppsala University, 2011.
206
+
207
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 1998.
208
+
209
+ Boyi Li, Felix Wu, Ser-Nam Lim, Serge Belongie, and Kilian Q Weinberger. On feature normalization and data augmentation. In CVPR, 2021.
210
+
211
+ Yijun Li, Chen Fang, Jimei Yang, Zhaowen Wang, Xin Lu, and Ming-Hsuan Yang. Universal style transfer via feature transforms. In NeurIPS, 2017.
212
+
213
+ Sungbin Lim, Ildoo Kim, Taesup Kim, Chiheon Kim, and Sungwoong Kim. Fast autoaugment. In NeurIPS, 2019.
214
+
215
+ Haibin Ling and David W Jacobs. Shape classification using the inner-distance. TPAMI, 2007.
216
+
217
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015.
218
+
219
+ Jitendra Malik, Serge J. Belongie, Thomas K. Leung, and Jianbo Shi. Contour and texture analysis for image segmentation. IJCV, 2001.
220
+
221
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. In NeurIPS, 2015.
222
+
223
+ 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. IJCV, 2015.
224
+
225
+ Lavanya Sharan, Ruth Rosenholtz, and Edward H. Adelson. Accuracy and speed of material categorization in real-world images. Journal of Vision, 14(10), 2014.
226
+
227
+ Baifeng Shi, Dinghuai Zhang, Qi Dai, Zhanxing Zhu, Yadong Mu, and Jingdong Wang. Informative dropout for robust representation learning: A shape-bias perspective. In ICML, 2020.
228
+
229
+ Jamie Shotton, John Winn, Carsten Rother, and Antonio Criminisi. Textonboost for image understanding: Multi-class object recognition and segmentation by jointly modeling texture, layout, and context. IJCV, 2009.
230
+
231
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
232
+
233
+ Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David LopezPaz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In ICML, 2019.
234
+
235
+ Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In NeurIPS, 2019.
236
+
237
+ Cihang Xie and Alan Yuille. Intriguing properties of adversarial training at scale. In ICLR, 2020.
238
+ Cihang Xie, Mingxing Tan, Boqing Gong, Jiang Wang, Alan Yuille, and Quoc V Le. Adversarial examples improve image recognition. In CVPR, 2020.
239
+ Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- ´ formations for deep neural networks. In CVPR, 2017.
240
+ Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In ICCV, 2019.
241
+ Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018.
242
+ Songfeng Zheng, Zhuowen Tu, and Alan L. Yuille. Detecting object boundaries using low-, mid-, and high-level information. In CVPR, 2007.
243
+ Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In AAAI, 2020.
244
+ Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In CVPR, 2016.
md/train/FPpZrRfz6Ss/FPpZrRfz6Ss.md ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TO LEARN EFFECTIVE FEATURES: UNDERSTANDING THE TASK-SPECIFIC ADAPTATION OF MAML
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Meta learning, an effective way for learning unseen tasks with few samples, is an important research area in machine learning. Model Agnostic MetaLearning (MAML) (Finn et al. (2017)) is one of the most well-known gradientbased meta learning algorithms, that learns the meta-initialization through the inner and outer optimization loop. The inner loop is to perform fast adaptation in several gradient update steps with the support datapoints, while the outer loop to generalize the updated model to the query datapoints. Recently, it has been argued that instead of rapid learning and adaptation, the learned meta-initialization through MAML has already absorbed the high-quality features prior, where the task-specific head at training facilitates the feature learning. In this work, we investigate the impact of the task-specific adaptation of MAML and discuss the general formula for other gradient-based and metric-based meta-learning approaches. From our analysis, we further devise the Random Decision Planes (RDP) algorithm to find a suitable linear classifier without any gradient descent step and the Meta Contrastive Learning (MCL) algorithm to exploit the inter-samples relationship instead of the expensive inner-loop adaptation. We conduct sufficient experiments on various datasets to explore our proposed algorithms.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Few-shot learning, aiming to learn from few labelled examples, is a great challenge for modern machine learning systems. Meta learning, an effective way for tracking this challenge, enables the model to learn general knowledge across a distribution of tasks. Various ideas of meta learning have been proposed to address the few-shot problems. Gradient-based meta learning (Finn et al. (2017); Nichol et al. (2018)) learns the meta-parameters that can be quickly adapted to new tasks by few gradient descent steps. Metric-based meta learning (Koch et al. (2015); Vinyals et al. (2016); Snell et al. (2017)) proposes to learn a metric space by comparing different datapoints. Memorybased meta learning (Santoro et al. (2016)) can rapidly assimilate new data and leverage the stored information to make predictions.
12
+
13
+ Model Agnostic Meta-Learning (MAML) (Finn et al. (2017)) is one of the most well-known gradient-based meta learning algorithms, that learns the meta-initialization parameters through the inner optimization loop and the outer optimization loop. For a given task, the inner loop is to perform fast adaptation in several gradient descent steps with the support datapoints, while the outer loop to generalize the updated model to the query datapoints. With the learned meta-initialization, the model can be quickly adapted to the unseen tasks with few labelled samples. Following the MAML algorithm, many significant variants (Finn et al. (2018); Rusu et al. (2018); Oreshkin et al. (2018); Bertinetto et al. (2018); Lee et al. (2019b)) are studied under the few-shot setting.
14
+
15
+ To understand how the MAML works, Raghu et al. (2019) conduct a series of experiments and claim that rather than rapid learning and adaptation, the learned meta-initialization has already absorbed the high-quality features prior, thus the representations after fine-tuning are almost the same for the coming unseen tasks. Also, the task specific head of MAML at training facilitates the learning of better features. In this paper, we further design more representative experiments and present a formal argument to explain the importance of the task specific adaptation. Actually, the multi-step taskspecific adaptation, making the body and head have similar classification capabilities, can provide better gradient descent direction for the features learning of body. We also notice that for both the gradient-based methods (e.g. MAML (Finn et al. (2017)), MetaOptNet (Lee et al. (2019b))) and metric-based methods (e.g. Prototypical Networks (Snell et al. (2017))) that attempt to learn a taskspecific head using the support datapoints, the adaptation is a common mode for features learning of body but varied in different methods.
16
+
17
+ Based on our analysis, we first propose a new training paradigm to find a decision plane (linear classifier) for guidance with no gradient descent step during the inner loop and get more supporting conclusions. Moreover, we devise another training paradigm that removes the inner loop and trains the model with only the query datapoints. Specifically, inspired by contrastive representation learning (Oord et al. (2018); Chen et al. (2020); He et al. (2020)), we exploit the inter-samples relationship of query set to find a guidance for the body across different tasks. This meta contrastive learning algorithm even achieves competitive results comparable to some state-of-the-art methods. In total, our contributions can be listed as follows:
18
+
19
+ 1. We present sufficient experiments and formal argument to explore the impact of the taskspecific adaptation for body features learning and discuss the general formula for other gradient-based and metric-based meta-learning approaches.
20
+ 2. We devise a training algorithm to obtain a decision plane with no gradient descent step during the inner loop, named as Random Decision Planes (RDP), and get more supporting conclusions.
21
+ 3. Unlike prior gradient-based methods, we propose the Meta Contrastive Learning (MCL) algorithm to exploit the inter-samples relations instead of training a task-specific head during the inner loop. Even without the task-specific adaptation for guidance, our algorithm still achieve better results with even less computation costs.
22
+ 4. We empirically shows the effectiveness of the proposed algorithm with different backbones on four benchmark datasets: miniImageNet (Vinyals et al. (2016)), tieredImageNet (Ren et al. (2018)), CIFAR-FS (Bertinetto et al. (2018)) and FC100 (Oreshkin et al. (2018)).
23
+
24
+ # 2 RELATED WORKS
25
+
26
+ MAML (Finn et al. (2017)) is a highly influential gradient-based meta learning algorithm for fewshot learning. The amazing experiment results on several public few-shot datasets have proved its effectiveness. Following the core idea of MAML, there are numerous works to handle the data insufficiency problem in few-shot learning. Some works (Oreshkin et al. (2018); Vuorio et al. (2019)) introduce the task-dependent representations via conditioning the feature extractor on the specific task to improve the performance. Sun et al. (2019) also employ the meta-learned scaling and shifting parameters for transferring from another large-scale dataset. Others (Grant et al. (2018); Finn et al. (2018); Lee et al. (2019a)) study this problem from the perspective of Bayesian approach. Unlike prior methods, we provide two training paradigms, one with no gradient descent step during the inner loop and another removing the inner loop and exploiting the inter-sample relations for training.
27
+
28
+ Recent works also explore the key factors that makes the meta-learned model perform better than others at few-shot tasks. Chen et al. (2019) discovers that a deeper backbone has a large effect on the success of meta learning algorithm, while Goldblum et al. (2020) finds that the meta learning tends to cluster object classes more tightly in feature space for those methods that fix the backbone during the inner loop (Bertinetto et al. (2018); Rusu et al. (2018)). A very recent work (Raghu et al. (2019)) argues that the meta-trained model can be applied to new task due to the high-quality features prior learned by the meta-initialized parameters rather than rapid learning. In this paper, we further study the impact of the task-specific adaptation for feature learning. Based on the analysis, we devise two algorithms, Random Decision Planes (RDP) and Meta Contrastive Learning (MCL) requiring less computation cost but still with competitive performance.
29
+
30
+ # 3 MODEL-AGNOSTIC META LEARNING (MAML)
31
+
32
+ The MAML aims to learn the meta-initialized parameters $\theta$ for the coming unseen tasks through the inner optimization loop and the outer optimization loop. Under the $N$ -way- $K$ -shot setting, for a task $T _ { b }$ sampled from the task distribution $P ( T )$ , we have a support set of $N \times K$ examples $T _ { b } ^ { s }$ and a query set $T _ { b } ^ { q }$ , where $N$ is the number of sampled class and $K$ is the number of instances for each class. During the inner loop, with the support set $T _ { b } ^ { s }$ , we perform fast adaptation in several gradient descent steps and obtain the task-specific parameters $\theta _ { T _ { b } } ^ { t }$ where $t$ is the number of gradient descent steps, given by:
33
+
34
+ Table 1: The evaluation results of 5-way-K-shot learning for methods with different training regimes on the MiniImageNet and TieredImageNet datasets.
35
+
36
+ <table><tr><td>Method</td><td>MiniImageNet-5-way</td><td>TieredImageNet-5-way</td></tr><tr><td>Multi-Head(1)</td><td>38.66 ± 0.34</td><td>31.78 ± 0.37</td></tr><tr><td>Multi-Task(1)</td><td>40.14 ± 0.38</td><td>33.62 ± 0.38</td></tr><tr><td>MAML (2017)(1)</td><td>49.31 ± 0.40</td><td>52.45 ± 0.48</td></tr><tr><td>ANIL (Almost No Inner Loop)(1)</td><td>50.23 ± 0.42</td><td>52.69 ± 0.47</td></tr><tr><td>BOHI (Body Outer loop, Head Inner Loop)(1)</td><td>50.61 ± 0.43</td><td>53.60 ± 0.48</td></tr><tr><td>Multi-Head(5)</td><td>48.99 ± 0.33</td><td>41.48 ± 0.38</td></tr><tr><td>Multi-Task(5)</td><td>50.82 ± 0.35</td><td>44.94 ± 0.39</td></tr><tr><td>MAML (2017)(5)</td><td>64.77 ± 0.36</td><td>67.66 ± 0.42</td></tr><tr><td>ANIL (Almost No Inner Loop)(5)</td><td>65.98 ± 0.38</td><td>67.44 ± 0.43</td></tr><tr><td>BOHI (Body Outer loop,Head Inner Loop)(5)</td><td>66.14 ± 0.37</td><td>68.39 ± 0.42</td></tr></table>
37
+
38
+ $$
39
+ \theta _ { T _ { b } } ^ { t } = \theta _ { T _ { b } } ^ { t - 1 } - \alpha \nabla _ { \theta _ { T _ { b } } ^ { t - 1 } } \mathcal { L } _ { T _ { b } ^ { s } } ( \theta _ { T _ { b } } ^ { t - 1 } )
40
+ $$
41
+
42
+ where $\alpha$ is the step size for inner loop and $\mathcal { L } _ { T _ { b } ^ { s } } ( \theta _ { T _ { b } } ^ { t - 1 } )$ denoted as the loss on the support set $T _ { b } ^ { s }$ after $t - 1$ steps. With the query set $T _ { b } ^ { q }$ b , we compute the meta loss on the task-specific parameters $\theta _ { T _ { b } } ^ { t }$ and backward to update the meta-initialized parameters $\theta$ , given by
43
+
44
+ $$
45
+ \theta = \theta - \beta \nabla _ { \theta } \frac { 1 } { B } \sum _ { b = 1 } ^ { B } \mathcal { L } _ { T _ { b } ^ { q } } ( \theta _ { T _ { b } } ^ { t } )
46
+ $$
47
+
48
+ where $\beta$ is the learning rate and $B$ is the number of sampled tasks in a batch.
49
+
50
+ # 4 IMPACT OF TASK-SPECIFIC ADAPTATION
51
+
52
+ # 4.1 THE MULTI-STEP TASK-SPECIFIC ADAPTATION IS IMPORTANT.
53
+
54
+ To explore the effectiveness of MAML, Raghu et al. (2019) have conducted sufficient experiments, indicating that the network body (the representation layers) has already absorbed the high-quality features prior. During meta-testing, instead of fine tuning on the network head (the classifier), simply building the prototypes with the support set can achieve comparable performance to MAML. Raghu et al. (2019) also shows that the task specificity of head at training can facilitate feature learning and ensure good representation learning in the network body. In our work, we show that besides the task specificity of head, the multi-step adaptation is also essential, and further study the role of network body and head during meta-training. We devise several methods using different training regimes: (1) Multi-Task, where all the tasks simply share one common head and the model is trained in a traditional way without inner loop adaptation; (2) Multi-Head, where different tasks are equipped with different heads for task specificity and the model is trained in a traditional way without inner loop adaptation; (3) Almost No Inner Loop (ANIL), where the network body is fixed during the inner loop; (4) Body Outer Loop, Head Inner Loop (BOHI), where the network body is updated only by the outer loop and the head is adapted only during the inner loop, making the head’s meta-initialized parameters unchanged. More algorithms’ details can be found in Appendix B, and implementation details can be found in Appendix C.1.
55
+
56
+ Following Raghu et al. (2019), we employ the cosine similarities between prototypes and the query datapoints to evaluate the quality of features learned. As Table 1 shows, even equipped with taskspecific head, the Multi-Head training still performs worse than the standard MAML algorithm by a large margin, indicating the multi-step adaptation of MAML is helpful for features learning. The results of Multi-Head and Multi-Task show the importance of multi-step task-specific adaptation.
57
+
58
+ ![](images/323b27e20fba56523cde9743ed75492f6ca7f5fff7291b139b0b1cd66eb3f61e.jpg)
59
+ Figure 1: The adaptation of the random initialized model for the sampled tasks in different steps.
60
+
61
+ ![](images/a40e1540dcd28c9760c7e7608a38024c2c13f4c874dc9ed191732136043309bf.jpg)
62
+ Figure 2: The adaptation after 5,000 iterations for the sampled tasks in different steps .
63
+
64
+ As the results shown in Table 1, the ANIL training remains effective comparable to the standard MAML algorithm, indicating that the task-specific adaptation of network body is unnecessary to learn good features. More interestingly, the BOHI training that keeps the meta-initialization of head unchanged even performs better than MAML, further demonstrating that good features learning depends on the multi-step task-specific adaptation of head during inner loop more than updating the meta-initialization of head in outer loop. Also, the ANIL and BOHI have similar performance, indicating that compared with learned prior knowledge in head, the inner loop adaptation, as a guidance, contributes more to the features learning. More experimental results can be found in Appendix C.2.
65
+
66
+ # .2 WHY IS MULTI-STEP TASK-SPECIFIC ADAPTATION IMPORTANT?
67
+
68
+ Having observed that the MAML algorithm outperforms the Multi-Task training by a large margin and the multi-step task-specific adaptation is important for features learning, we extend our analysis to explore the reason why the inner loop adaptation is essential for MAML at different stages of meta training. Specifically, we freeze the initialized MAML model and model at 5,000 iterations, sample validation tasks from the task distribution, and record the test accuracy of model in different inner loop steps. Both the body accuracy based on prototypes construction and head accuracy based on fine-tuning are given in Figure 1 and Figure 2, where “Task ID” stands for different tasks. As the results shows, at different stages of meta training, the head accuracy increases significantly in the first few adaptation steps since the model has learnt the correspondence between sample and label. However, at the beginning of training, there is only a small improvement on the body accuracy after first adaptation step. In Figure 2, as the model converges, the body accuracy even decreases in the first few adaptation steps. In the following steps, with the task-specific adaptation of head, the network body then learns better representations, further demonstrating that the multistep task-specific adaptation, making the body and head have similar classification capabilities, can be regarded as a guidance to provide better gradient descent direction for the feature learning of body.
69
+
70
+ Algorithm 1 The Random Decision Planes (RDP) Algorithm for N-way-K-shot learning
71
+
72
+ <table><tr><td>Algorithm1 The Random Decision Planes (RDP) Algorithm for N-way-K-shot learning Input: Network Body fe,Learning Rate β, Task Distribution P(T) while not done do Sample a batch of tasks {Tb}b=1, where Tb ~ P(T) forb∈{1,..,B} do</td></tr><tr><td>for each sample x in {TTdo</td></tr><tr><td>z = |lfe(x)ll end for define CrossEntropyLoss(H,D) as the cross entropy loss</td></tr><tr><td>on the features representations set D with head H. W*= argmin CrossEntropyLoss(W,{(z,)))</td></tr><tr><td>WEP Lb = CrossEntropyLoss(W*,{(z&#x27;,y)}K)</td></tr><tr><td>end for 0=θ-βVθB∑b=1Lb B end while</td></tr></table>
73
+
74
+ To understand this intuitive argument better, we consider a sample $( { \pmb x } , y )$ for few-shot classification where the cross entropy loss is employed, formulated as:
75
+
76
+ $$
77
+ \mathcal { L } _ { c } = - \mathrm { l o g } ( \frac { \mathrm { e x p } ( w _ { y } ^ { \top } h ) } { \sum _ { k } \mathrm { e x p } ( w _ { k } ^ { \top } h ) } ) = - w _ { y } ^ { \top } h + \mathrm { l o g } ( \sum _ { k } \mathrm { e x p } ( w _ { k } ^ { \top } h ) )
78
+ $$
79
+
80
+ where $\{ \pmb { w } _ { 1 } , \pmb { w } _ { 2 } , . . . , \pmb { w } _ { k } \}$ is the weights of the classifier head, $^ { h }$ is the body representation of $_ { \textbf { \em x } }$ . The gradients of loss $\mathcal { L } _ { c }$ with respect to the body representation $^ { h }$ are denoted by,
81
+
82
+ $$
83
+ \frac { \partial \mathcal { L } _ { c } } { \partial \pmb { h } } = - \pmb { w } _ { y } + \frac { \sum _ { k } \pmb { w } _ { k } \mathrm { e x p } ( \pmb { w } _ { k } ^ { \top } \pmb { h } ) } { \sum _ { k } \mathrm { e x p } ( \pmb { w } _ { k } ^ { \top } \pmb { h } ) } = - \pmb { w } _ { y } + \bar { \pmb { w } }
84
+ $$
85
+
86
+ where $\bar { \pmb w }$ is exactly the weighted average of the weights $\{ \pmb { w } _ { 1 } , \pmb { w } _ { 2 } , . . . , \pmb { w } _ { k } \}$ . As shown in Equation 4, a reasonable direction for the network body to minimize the target loss $\mathcal { L } _ { c }$ is to make the representation $^ { h }$ closer to the corresponding class weight ${ \pmb w } _ { y }$ , given by $\pmb { h } = \pmb { h } + \lambda ( \pmb { w } _ { y } - \pmb { \bar { w } } )$ . As the model converges, in the first few adaptation steps, there is a significant margin between the performance of head and body, and the classifier weights contain little knowledge about correspondence between samples and labels and differences between different classes. With the low-performance head, this updating rule for body may lead to a decline in the quality of features, which also explains why the simpler BOHI, ANIL even performs better than MAML in Table 1. After several adaptation steps during the inner loop, the body then receives the useful guidance for features learning from the taskspecific head since ${ \pmb w } _ { y }$ can better express its corresponding class. The formulation above shows that the multi-step task-specific adaptation, making the body and head have similar classification capabilities, can provide better gradient descent direction for the features learning of body.
87
+
88
+ # 4.3 TASK-SPECIFIC ADAPTATION IN OTHER META-LEARNING ALGORITHMS
89
+
90
+ Having noticed that the multi-step task-specific adaptation of MAML, which promotes the performance of head, can facilitate the features learning of body. It works similarly for other gradientbased methods that use end-to-end fine-tuning, such as Reptile (Nichol et al. (2018)). In the case of meta-learning methods that fix the network body and only update the head during the inner loop, such as MetaOptNet (Lee et al. (2019b)) and R2-D2 (Bertinetto et al. (2018)), the convex optimization of head also aims to provide a classifier with better classification capabilities. For metric-based methods, such as Prototypical Networks (Snell et al. (2017)), the adaptation of head is actually conducted through the nearest neighbor algorithm. In conclusion, the adaptation is a common mode but varied in different methods. These meta-learning algorithms reveal a general formula that the inner loop is for building a task-specific head that matches the classification capabilities of body and the outer loop for task-independent features learning.
91
+
92
+ Table 2: The evaluation results of 5-way-K-shot learning for the standard MAML and Random Decision Planes (RDP) with different backbones.
93
+
94
+ <table><tr><td>Method</td><td>Backbone</td><td>MiniImageNet-5-way</td><td> TieredImageNet-5-way</td><td>FC100-5-way</td></tr><tr><td>MAML (2017)(1)</td><td>Conv4</td><td>49.31 ± 0.40</td><td>52.45 ± 0.48</td><td>34.75 ± 0.39</td></tr><tr><td>RDP(1)</td><td>Conv4</td><td>46.12 ± 0.38</td><td>47.63 ± 0.44</td><td>36.63 ± 0.38</td></tr><tr><td>RDP(1)</td><td>ResNet12</td><td>51.16 ± 0.43</td><td>51.37 ± 0.46</td><td>37.54 ± 0.40</td></tr><tr><td>MAML (2017)(5)</td><td>Conv4</td><td>64.77 ± 0.36</td><td>67.66 ± 0.42</td><td>43.90 ± 0.38</td></tr><tr><td>RDP(5)</td><td>Conv4</td><td>63.34 ± 0.36</td><td>65.19 ± 0.42</td><td>49.46 ± 0.39</td></tr><tr><td>RDP(5)</td><td>ResNet12</td><td>65.72 ± 0.36</td><td>66.31 ± 0.41</td><td>50.29 ± 0.38</td></tr></table>
95
+
96
+ ![](images/97034f91d46151f9006f5649e7a8354abc351edc92e686aa641234f661b23922.jpg)
97
+ Figure 3: The effect of the number of decision planes on the miniImageNet and FC100 datasets.
98
+
99
+ # 5 THE RANDOM DECISION PLANES ALGORITHM
100
+
101
+ As discussed above, the multi-step adaptation based on gradient descent during the inner loop aims to provide guidance for features learning of body. From this consideration, we suppose that if a suitable linear classifier is given, the feature learning can be facilitated even without gradient descent during the inner loop. From this consideration, we devise such an algorithm named Random Decision Planes (RDP), where a classifier is chosen from a predefined set $\mathcal { P }$ according to the target loss on the support set. The predefined set of classifier $\mathcal { P }$ consists of $n _ { p }$ different orthonormal matrices that are generated through the Gram-Schmidt method from random matrices. During the inner loop, without gradient descent, we directly choose a most suitable classifier as the network head which minimizes the cross entropy loss on the support set. In the outer loop, we compute the loss based on the chosen head and run backward to update the network body. A formal description of RDP is presented in Algorithm 1. The implementation details can be found in Appendix C.1.
102
+
103
+ The overall evaluation results on three datasets are presented in Table 2. Note that we also remove the head and construct the prototypes from the body network $f _ { \theta }$ for predictions during meta-testing. The proposed RDP algorithm performs comparably to the standard MAML method on three datasets, especially on the FC100 dataset. Without any task-specific adaptation for the network body, a best performing classifier chosen from a set of randomly generated subspaces can also be a guidance to facilitate the features learning, further suggesting that a head with better classification capabilities, is key factor to learn good representations even if the chosen approximate head performs worse than a gradient-based head, and the main purpose of task-specific adaptation is to adjust the lowperformance head for features learning of body.
104
+
105
+ # Algorithm 2 The Meta Contrastive Learning (MCL) Algorithm for N-way learning
106
+
107
+ <table><tr><td>Input: Network Body fo, Projection Layer gφ,Learning Rate β, Constant T,Task Distribution P(T) while not done do Sample a batch of tasks {Tb}B=1, where Tb ~ P(T)</td></tr><tr><td>for b ∈ {1,...,B} do</td></tr><tr><td>and y2k-1= y2k where k ∈ {1,.,N}). for i ∈ {1,...,2N} do</td></tr><tr><td>zi=gΦ(fe(x)) end for</td></tr><tr><td>for i ∈{1.,..., 2N} and j ∈{1,...,2N} do Si,j= zzj/(zil|lzjl)</td></tr><tr><td>end for define l(i,j)=-log( exp(si,j/T) (∑11xp(s/</td></tr><tr><td>Lb=2∑_1[l(2k -1,2k)+ (2k,2k -1)] N end for θ=0-βθB∑B=1Lb JB</td></tr></table>
108
+
109
+ Also, we conduct experiments to explore the impact of the number of decision planes. Results are shown in Figure 3 on two datasets. With a small set of decision planes, it can be more difficult to find a suitable head to guide the features learning, while with enough decision planes, the performance then reaches the upper limit.
110
+
111
+ # 6 THE META CONTRASTIVE LEARNING ALGORITHM
112
+
113
+ We have already seen that the multi-step task-specific adaptation to improve the classifier head can essentially facilitate the features learning of body. In total, prior gradient-based methods based on the cross-entropy loss proposes to learn the correspondence between samples and assigned labels for different tasks, thus requiring the task-specific adaptation for the classifier head during inner loop. Since the task-specific head also serves for features learning of body, we wonder if we can remove the inner loop or adaptation, and make full use of the labels information in other way to be a guidance for features learning. From this consideration and inspired by recent works (Chen et al. (2020); He et al. (2020)) about self-supervised contrastive learning, we further devise the Meta Contrastive Learning (MCL) algorithm that directly removes the inner loop and exploits the inter-sample relationship with only the query set.
114
+
115
+ Specifically, rather than using cross entropy loss for task-specific adaptation, we simply impose that normalized representations from the same class are closer together than representations from different classes. For $N$ -way few-shot learning, we sample two examples per class to build the query set. Next, for a given anchor example, the meta contrastive loss pulls it closer to the point of same class while pushes the anchor farther away from the negative examples of other classes. Following Chen et al. (2020), we also employ a small neural network projection layer that maps the body features to the space where contrastive loss is applied. A formal description of MCL is presented in Algorithm 2. The implementation details can be found in Appendix C.1.
116
+
117
+ During meta-testing, we discard the projection layer $g _ { \phi }$ and construct the prototypes from the body network $f _ { \theta }$ for predictions. The overall evaluation results on the MiniImageNet, TieredImageNet and FC100 datasets are presented in Table 3. Note that TADAM (Oreshkin et al. (2018)) employs a extra task embedding network (TEN) block to predict element-wise scale and shift vectors, and MetaOptNet (Lee et al. (2019b)) proposes to learn a linear support vector machine (SVM) as classifier head during the inner loop. Unlike those methods, our MCL method is arguably simpler. By exploiting the relationship between different samples, we are able to remove the inner loop which contains a complex adaptation process, and devise a contrastive loss to train the network body directly. As the results shows, our method outperforms almost previous well-designed methods and also achieves results comparable to MetaOptNet. More experimental results and time-efficiency analysis can be found in Appendix C.2 and C.3.
118
+
119
+ Table 3: The evaluation results of 5-way-K-shot learning for the Meta Contrastive Learning (MCL) and other baselines with different backbones.
120
+
121
+ <table><tr><td>Method</td><td>Backbone</td><td>MiniImageNet-5-way</td><td>TieredImageNet-5-way</td><td>FC100-5-way</td></tr><tr><td>MAML (2017)(1)</td><td>Conv4</td><td>49.31 ± 0.40</td><td>52.45 ± 0.48</td><td>34.75 ± 0.39</td></tr><tr><td>MCL(1)</td><td>Conv4</td><td>50.73 ± 0.43</td><td>53.12 ± 0.48</td><td>37.73 ± 0.38</td></tr><tr><td>TADAM (2018)(1)</td><td>ResNet12</td><td>58.50 ± 0.30</td><td></td><td>40.10 ± 0.40</td></tr><tr><td>MetaOptNet (2019b)(1)</td><td>ResNet12</td><td>62.64 ± 0.61</td><td>65.99 ± 0.72</td><td>41.10 ± 0.60</td></tr><tr><td>MCL(1)</td><td>ResNet12</td><td>62.14 ± 0.43</td><td>65.98 ± 0.50</td><td>41.38 ± 0.40</td></tr><tr><td>MAML (2017)(5)</td><td>Conv4</td><td>64.77 ± 0.36</td><td>67.66 ± 0.42</td><td>43.90 ± 0.38</td></tr><tr><td>MCL(5)</td><td>Conv4</td><td>66.25 ± 0.36</td><td>69.31 ± 0.41</td><td>51.29 ± 0.39</td></tr><tr><td>TADAM (2018)(5)</td><td>ResNet12</td><td>76.70 ± 0.30</td><td></td><td>56.10 ± 0.40</td></tr><tr><td>MetaOptNet (2019b)(5)</td><td>ResNet12</td><td>78.63 ± 0.46</td><td>81.56 ± 0.53</td><td>55.50 ± 0.60</td></tr><tr><td>MCL(5)</td><td>ResNet12</td><td>78.34 ± 0.33</td><td>81.09 ± 0.37</td><td>56.64 ± 0.39</td></tr></table>
122
+
123
+ ![](images/ba3d9472b7185a0c80973c9148357d7d8caf73f0516c3efb9d5c9089fce9606d.jpg)
124
+ Figure 4: The effect of output dimension of $g _ { \phi }$ on the MiniImageNet dataset.
125
+
126
+ We also study the impact of the projection layer $g _ { \phi }$ . Figure 4 shows the evaluation results with different output dimensions. Note that “None” means that there is no projection layer for loss computation. As the results show, for a deeper ResNet12 backbone, the projection layer facilitates the features learning a lot ( $56 \%$ for 5-shot, ${ > } 5 \%$ for 1-shot). We conjecture that the projection layer is trained to extract task-specific information useful for the contrastive loss, while the body representations $^ { h }$ learns more general information. More analysis can be found in Appendix C.4.
127
+
128
+ # 7 CONCLUSION
129
+
130
+ In this paper, based on the hypothesis that feature reuse is the dominant factor for the success of MAML algorithm, we further study the impact of task-specific adaptation and devise several training regimes including BOHI, Multi-Head and so on. Also, we provide a more formal argument from the perspective of gradient descent optimization. Based on analysis above, we find that the multistep task-specific adaptation, making the body and head have similar classification capabilities, can provide better gradient descent direction for the features learning of body. We further connect our results to other meta-learning algorithm, showing the adaptation is a common mode but varied in different methods. From our consideration, we devise the RDP algorithm where a suitable linear classifier is chosen without gradient descent and get more supporting conclusions. We also build the
131
+
132
+ MCL algorithm that removes the inner loop and exploit the inter-sample relationship, and achieve results comparable to some state-of-the-art methods.
133
+
134
+ # REFERENCES
135
+
136
+ Luca Bertinetto, Joao F Henriques, Philip HS Torr, and Andrea Vedaldi. Meta-learning with differentiable closed-form solvers. arXiv preprint arXiv:1805.08136, 2018.
137
+
138
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020.
139
+
140
+ Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. arXiv preprint arXiv:1904.04232, 2019.
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
+ Chelsea Finn, Kelvin Xu, and Sergey Levine. Probabilistic model-agnostic meta-learning. In Advances in Neural Information Processing Systems, pp. 9516–9527, 2018.
145
+
146
+ Spyros Gidaris and Nikos Komodakis. Dynamic few-shot visual learning without forgetting. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4367– 4375, 2018.
147
+
148
+ Micah Goldblum, Steven Reich, Liam Fowl, Renkun Ni, Valeriia Cherepanova, and Tom Goldstein. Unraveling meta-learning: Understanding feature representations for few-shot tasks. arXiv preprint arXiv:2002.06753, 2020.
149
+
150
+ Erin Grant, Chelsea Finn, Sergey Levine, Trevor Darrell, and Thomas Griffiths. Recasting gradientbased meta-learning as hierarchical bayes. arXiv preprint arXiv:1801.08930, 2018.
151
+
152
+ 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.
153
+
154
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML deep learning workshop, volume 2. Lille, 2015.
155
+
156
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). URL http://www. cs. toronto. edu/kriz/cifar. html, 5, 2010.
157
+
158
+ Hae Beom Lee, Hayeon Lee, Donghyun Na, Saehoon Kim, Minseop Park, Eunho Yang, and Sung Ju Hwang. Learning to balance: Bayesian meta-learning for imbalanced and out-of-distribution tasks. arXiv preprint arXiv:1905.12917, 2019a.
159
+
160
+ Kwonjoon Lee, Subhransu Maji, Avinash Ravichandran, and Stefano Soatto. Meta-learning with differentiable convex optimization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10657–10665, 2019b.
161
+
162
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. arXiv preprint arXiv:1803.02999, 2018.
163
+
164
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
165
+
166
+ Boris Oreshkin, Pau Rodr´ıguez Lopez, and Alexandre Lacoste. Tadam: Task dependent adaptive ´ metric for improved few-shot learning. In Advances in Neural Information Processing Systems, pp. 721–731, 2018.
167
+
168
+ Siyuan Qiao, Chenxi Liu, Wei Shen, and Alan L Yuille. Few-shot image recognition by predicting parameters from activations. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7229–7238, 2018.
169
+
170
+ Aniruddh Raghu, Maithra Raghu, Samy Bengio, and Oriol Vinyals. Rapid learning or feature reuse? towards understanding the effectiveness of maml. arXiv preprint arXiv:1909.09157, 2019.
171
+
172
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. 2016.
173
+
174
+ Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B Tenenbaum, Hugo Larochelle, and Richard S Zemel. Meta-learning for semi-supervised few-shot classification. arXiv preprint arXiv:1803.00676, 2018.
175
+
176
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015.
177
+
178
+ Andrei A Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. arXiv preprint arXiv:1807.05960, 2018.
179
+
180
+ 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.
181
+
182
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in neural information processing systems, pp. 4077–4087, 2017.
183
+
184
+ Qianru Sun, Yaoyao Liu, Tat-Seng Chua, and Bernt Schiele. Meta-transfer learning for few-shot learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 403–412, 2019.
185
+
186
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in neural information processing systems, pp. 3630–3638, 2016.
187
+
188
+ Risto Vuorio, Shao-Hua Sun, Hexiang Hu, and Joseph J Lim. Multimodal model-agnostic metalearning via task-aware modulation. In Advances in Neural Information Processing Systems, pp. 1–12, 2019.
189
+
190
+ # A FEW-SHOT IMAGE CLASSIFICATION DATASETS
191
+
192
+ In this section, we introduce four benchmark datasets often used for few-shot image classification: the miniImageNet (Vinyals et al. (2016)), tieredImageNet (Ren et al. (2018)), CIFAR-FS (Bertinetto et al. (2018)) and FC100 (Oreshkin et al. (2018)).
193
+
194
+ The miniImageNet (Vinyals et al. (2016)) dataset is standard benchmark for few-shot image classification, comprises 100 classes randomly chosen from the original ImageNet (Russakovsky et al. (2015)) dataset, where 64 classes is used for meta-training, 16 classes for meta-validation and 20 classes for meta-testing. Each class contains 600 images of size $8 4 \times 8 4$ . Since the original class splits are unavailable, we use the commonly-used split proposed in Ravi & Larochelle (2016).
195
+
196
+ The tieredImageNet (Ren et al. (2018)) dataset is another larger subset of ImageNet (Russakovsky et al. (2015)). This dataset contains 608 classes that are grouped into 34 high-level categories, where 20 categories (351 classes) are used for meta-training, 6 categories (97 classes) for meta-validation and 8 categories(160 classes) for meta-testing. All images are also size of $8 4 \times 8 4$ .
197
+
198
+ The CIFAR-FS (Bertinetto et al. (2018)) dataset is a few-shot image classification benchmark, consisting of all 100 classes from CIFAR-100 (Krizhevsky et al. (2010)). These classes are randomly split into 64, 16, and 20 separately for meta-training, meta-validation and meta-testing. Each class contains 600 images of size $3 2 \times 3 2$ .
199
+
200
+ The FC100 (Oreshkin et al. (2018)) dataset is another benchmark derived from CIFAR100 (Krizhevsky et al. (2010)). This dataset comprises 100 classes that are grouped into 20 highlevel categories, where 12 categories (60 classes) are used for meta-training, 4 categories (20 classes) for meta-validation and 4 categories (20 classes) for meta-testing. Each class contains 600 images of size $3 2 \times 3 2$ .
201
+
202
+ Table 4: The evaluation results of 5-way-K-shot learning on the MiniImageNet dataset.
203
+
204
+ <table><tr><td>Method</td><td>Conv4, K=1</td><td>Conv4, K=5</td><td>ResNet12, K=1</td><td>ResNet12, K=5</td></tr><tr><td>MAML (Finn et al. (2017))</td><td>49.31 ± 0.40</td><td>64.77 ± 0.36</td><td>57.45 ± 0.47</td><td>72.70 ± 0.35</td></tr><tr><td>Almost No Inner Loop (ANIL)</td><td>50.23 ± 0.42</td><td>65.98 ± 0.38</td><td>59.43 ± 0.44</td><td>73.28 ± 0.33</td></tr><tr><td>Body Inner, Head Outer (BOHI)</td><td>50.61 ± 0.43</td><td>66.14 ± 0.37</td><td>59.69 ± 0.46</td><td>73.42 ± 0.37</td></tr><tr><td>MetaOptNet (Lee et al. (2019b))</td><td></td><td></td><td>62.64 ± 0.61</td><td>78.63 ± 0.46</td></tr><tr><td>Meta Contrastive Learning (MCL)</td><td>50.73 ± 0.43</td><td>66.25 ± 0.36</td><td>62.14 ± 0.43</td><td>78.34 ± 0.33</td></tr></table>
205
+
206
+ # B MORE DETAILS ABOUT ALGORITHMS
207
+
208
+ In this section, we provide further details about the training regimes and algorithms mentioned above. Note that we denote the meta parameters of the network as $\theta$ in previous sections. Considering the network is composed of the body (feature extractor) and head (classifier), we further rewrite $\theta$ as $\theta = [ \theta _ { f } , \theta _ { c } ]$ , where $\theta _ { f } , \theta _ { c }$ is the parameters of body and head respectively. For a given task $T _ { b } = \{ T _ { b } ^ { s } , \dot { T } _ { b } ^ { q } \}$ , the meta-initialization updating of MAML can be expressed as follows:
209
+
210
+ $$
211
+ \begin{array} { r l } & { \theta _ { f } ^ { t } = \theta _ { f } ^ { t - 1 } - \alpha \nabla _ { \theta _ { f } ^ { t - 1 } } \mathcal { L } _ { T _ { b } ^ { s } } ( \theta _ { f } ^ { t - 1 } , \theta _ { c } ^ { t - 1 } ) , \ \theta _ { c } ^ { t } = \theta _ { c } ^ { t - 1 } - \alpha \nabla _ { \theta _ { c } ^ { t - 1 } } \mathcal { L } _ { T _ { b } ^ { s } } ( \theta _ { f } ^ { t - 1 } , \theta _ { c } ^ { t - 1 } ) } \\ & { \theta _ { f } = \theta _ { f } - \beta \nabla _ { \theta _ { f } } \mathcal { L } _ { T _ { b } ^ { q } } ( \theta _ { f } ^ { t } , \theta _ { c } ^ { t } ) , \ \theta _ { c } = \theta _ { c } - \beta \nabla _ { \theta _ { c } } \mathcal { L } _ { T _ { b } ^ { q } } ( \theta _ { f } ^ { t } , \theta _ { c } ^ { t } ) } \end{array}
212
+ $$
213
+
214
+ where $\alpha$ is the step size of the inner loop, $\beta$ is the learning rate. In our work, we devise several methods using different training regimes including Multi-Task, Multi-Head, Almost No Inner Loop (ANIL) and Body Outer Loop, Head Inner Loop (BOHI) to study the role of network body and head during meta-training.
215
+
216
+ The updating rules of Multi-Task can be expressed as follows
217
+
218
+ $$
219
+ \theta _ { f } = \theta _ { f } - \beta \nabla _ { \theta _ { f } } \mathcal { L } _ { T _ { b } ^ { q } } ( \theta _ { f } , \theta _ { c } ) , \theta _ { c } = \theta _ { c } - \beta \nabla _ { \theta _ { c } } \mathcal { L } _ { T _ { b } ^ { q } } ( \theta _ { f } , \theta _ { c } )
220
+ $$
221
+
222
+ For different tasks, the Multi-head has different heads for task specificity, given by
223
+
224
+ $$
225
+ \boldsymbol { \theta } _ { f } = \boldsymbol { \theta } _ { f } - \beta \boldsymbol { \nabla } _ { \boldsymbol { \theta } _ { f } } \mathcal { L } _ { T _ { b } ^ { q } } ( \boldsymbol { \theta } _ { f } , \boldsymbol { \theta } _ { c } ^ { T _ { b } } ) , \ \boldsymbol { \theta } _ { c } ^ { T _ { b } } = \boldsymbol { \theta } _ { c } ^ { T _ { b } } - \beta \boldsymbol { \nabla } _ { \boldsymbol { \theta } _ { c } ^ { T _ { b } } } \mathcal { L } _ { T _ { b } ^ { q } } ( \boldsymbol { \theta } _ { f } , \boldsymbol { \theta } _ { c } ^ { T _ { b } } )
226
+ $$
227
+
228
+ where $\theta _ { c } ^ { T _ { b } }$ is the specific parameters for task $T _ { b }$ . The network body is fixed during the inner loop for ANIL, given by
229
+
230
+ $$
231
+ \begin{array} { r l } & { { \theta } _ { c } ^ { t } = { \theta } _ { c } ^ { t - 1 } - \alpha \nabla _ { { \theta } _ { c } ^ { t - 1 } } \mathcal { L } _ { T _ { b } ^ { s } } ( { \theta } _ { f } ^ { t - 1 } , { \theta } _ { c } ^ { t - 1 } ) } \\ & { { \theta } _ { f } = { \theta } _ { f } - \beta \nabla _ { { \theta } _ { f } } \mathcal { L } _ { T _ { b } ^ { q } } ( { \theta } _ { f } , { \theta } _ { c } ^ { t } ) , \ { \theta } _ { c } = { \theta } _ { c } - \beta \nabla _ { { \theta } _ { c } } \mathcal { L } _ { T _ { b } ^ { q } } ( { \theta } _ { f } , { \theta } _ { c } ^ { t } ) } \end{array}
232
+ $$
233
+
234
+ For BOHI, the network body is updated only by the outer loop and the head is adapted only during the inner loop, making the head’s meta-initialized parameters unchanged, given by
235
+
236
+ $$
237
+ \begin{array} { r l } & { \theta _ { c } ^ { t } = \theta _ { c } ^ { t - 1 } - \alpha \nabla _ { \theta _ { c } ^ { t - 1 } } \mathcal { L } _ { T _ { b } ^ { s } } ( \theta _ { f } ^ { t - 1 } , \theta _ { c } ^ { t - 1 } ) } \\ & { \theta _ { f } = \theta _ { f } - \beta \nabla _ { \theta _ { f } } \mathcal { L } _ { T _ { b } ^ { q } } ( \theta _ { f } , \theta _ { c } ^ { t } ) } \end{array}
238
+ $$
239
+
240
+ # C MORE EXPERIMENTAL DETAILS
241
+
242
+ # C.1 IMPLEMENTATION DETAILS
243
+
244
+ For all training regimes, RDP and MCL, we use the Adam optimizer with weight decay of 5e-4 and the learning rate is set to 1e-3. For 4-layer convolution network with 64 filters, we flatten the output feature map of the network body, and obtain 1600-d features for miniImageNet and tieredImageNet, while 256-d features for CIFAR-FS and FC100. For ResNet12 network, we employ a global max pooling layer on the output feature map of the network body, and obtain 512-d features for four public datasets. During meta-training, we adopt horizontal flip, random crop and color (brightness, contrast, and saturation) jitter data augmentation as proposed in Gidaris & Komodakis (2018); Qiao et al. (2018). We train all models 100 epochs and take 500 batches per epoch. For MAML, BOHI and ANIL, both models are trained using 5 gradient steps of size $\alpha = 0 . 0 1$ for Conv4 and $\alpha = 0 . 1$ for ResNet12. For the Random Decision Planes algorithm, the number of decision planes $n _ { p }$ is set to 64. For the Meta Contrastive Learning (MCL) algorithm, we apply a two-layer nonlinear projection layer with hidden size of 512. Also, the query datapoints come from 10 different classes for each sampled task, which is helpful for accelerating model convergence.
245
+
246
+ Table 5: The evaluation results of 5-way-K-shot learning on the TieredImageNet dataset.
247
+
248
+ <table><tr><td>Method</td><td>Conv4, K=1</td><td>Conv4, K=5</td><td>ResNet12, K=1</td><td>ResNet12, K=5</td></tr><tr><td>MAML (Finn et al. (2017))</td><td>52.45 ± 0.48</td><td>67.66 ± 0.42</td><td>63.05 ± 0.50</td><td>77.01 ± 0.40</td></tr><tr><td>Almost No Inner Loop (ANIL)</td><td>52.69 ± 0.47</td><td>67.44 ± 0.42</td><td>63.03 ± 0.49</td><td>76.98 ± 0.41</td></tr><tr><td>Body Inner, Head Outer (BOHI)</td><td>53.60 ± 0.48</td><td>68.39 ± 0.42</td><td>63.20 ± 0.51</td><td>77.11 ± 0.40</td></tr><tr><td>MetaOptNet (Lee et al. (2019b))</td><td></td><td></td><td>65.99 ± 0.72</td><td>81.56 ± 0.53</td></tr><tr><td>Meta Contrastive Learning (MCL)</td><td>53.12 ± 0.48</td><td>69.31 ± 0.41</td><td>65.98 ± 0.50</td><td>81.09 ± 0.37</td></tr></table>
249
+
250
+ Table 6: The evaluation results of 5-way-K-shot learning on the CIFAR-FS dataset.
251
+
252
+ <table><tr><td>Method</td><td>Conv4, K=1</td><td>Conv4, K=5</td><td>ResNet12, K=1</td><td>ResNet12, K=5</td></tr><tr><td>MAML (Finn et al. (2017))</td><td>61.96 ± 0.51</td><td>76.16 ± 0.39</td><td>67.41 ± 0.51</td><td>80.94 ± 0.37</td></tr><tr><td>Almost No Inner Loop (ANIL)</td><td>63.27 ± 0.52</td><td>77.25 ± 0.38</td><td>69.23 ± 0.50</td><td>81.85 ± 0.36</td></tr><tr><td>Body Inner, Head Outer (BOHI)</td><td>63.58 ± 0.52</td><td>77.11 ± 0.38</td><td>68.41 ± 0.52</td><td>80.86 ± 0.37</td></tr><tr><td>MetaOptNet (Lee et al. (2019b))</td><td></td><td></td><td>72.00 ± 0.70</td><td>84.20 ± 0.50</td></tr><tr><td>Meta Contrastive Learning (MCL)</td><td>64.59 ± 0.52</td><td>77.24 ± 0.38</td><td>71.17 ± 0.49</td><td>84.18 ± 0.35</td></tr></table>
253
+
254
+ Table 7: The evaluation results of 5-way-K-shot learning on the FC100 dataset.
255
+
256
+ <table><tr><td>Method</td><td>Conv4, K=1</td><td>Conv4, K=5</td><td>ResNet12,K=1</td><td>ResNet12,K=5</td></tr><tr><td>MAML (Finn et al. (2017))</td><td>34.75 ± 0.39</td><td>43.90 ± 0.38</td><td>38.43 ± 0.39</td><td>50.85 ± 0.38</td></tr><tr><td>Almost No Inner Loop (ANIL)</td><td>37.49 ± 0.38</td><td>49.58 ± 0.39</td><td>38.60 ± 0.40</td><td>50.70 ± 0.39</td></tr><tr><td>Body Inner, Head Outer (BOHI)</td><td>37.15 ± 0.41</td><td>48.68 ± 0.39</td><td>38.63 ± 0.40</td><td>50.65 ± 0.38</td></tr><tr><td>MetaOptNet (Lee et al. (2019b))</td><td></td><td></td><td>41.10 ± 0.60</td><td>55.50 ± 0.60</td></tr><tr><td>Meta Contrastive Learning (MCL)</td><td>37.73 ± 0.38</td><td>51.29 ± 0.39</td><td>41.38 ± 0.40</td><td>56.64 ± 0.39</td></tr></table>
257
+
258
+ # C.2 MORE RESULTS FOR BOHI, ANIL, MAML, MCL
259
+
260
+ In this section, we provide complete experimental results for BOHI, ANIL, MAML and MCL with different backbones on four datasets. The complete results on four datasets are presented in Table 4, Table 5, Table 6 and Table 7 respectively. The results can further verify our description mentioned above. Good features learning depends on the multi-step task-specific adaptation of head during the inner loop more than updating the meta-initialization of head in outer loop. With the lowperformance head, the update of body may even lead to a decline in the quality of features. In addition, the results on four datasets further demonstrate the effectiveness of our proposed MCL algorithm.
261
+
262
+ # C.3 THE TIME-EFFICIENCY ANALYSIS FOR BOHI, ANIL, MAML, MCL
263
+
264
+ It is obvious that ANIL, BOHI and MCL can speeds up training. The results about the comparison of computation time are presented in Table 8. We implement our methods based on PyTorch and the
265
+
266
+ Table 8: The computation time of different methods.(tasks/sec)
267
+
268
+ <table><tr><td>Method</td><td>Conv4</td><td>ResNet12</td></tr><tr><td>MAML (Finn et al. (2017))</td><td>10.60</td><td>2.24</td></tr><tr><td>Random Decision Planes (RDP)</td><td>31.24</td><td>6.88</td></tr><tr><td>Almost No Inner Loop (ANIL)</td><td>30.98</td><td>6.86</td></tr><tr><td>Body Inner, Head Outer (BOHI)</td><td>31.12</td><td>6.88</td></tr><tr><td>Meta Contrastive Learning (MCL)</td><td>63.76</td><td>30.96</td></tr></table>
269
+
270
+ training of models is run on two NVIDIA 1080Ti GPU. Notice that our MCL can run much faster than BOHI and ANIL while achieves better evaluation results. The training speedups also illustrate the significant computational benefit of MCL and prove its effectiveness.
271
+
272
+ Table 9: The evaluation results about the quality of features extracted by the network body and projection layer. (5-way-5-shot on MiniImageNet, ResNet12)
273
+
274
+ <table><tr><td>Hidden size of gΦ</td><td>Network Body fe</td><td>Projection Layer gΦ</td></tr><tr><td>64</td><td>77.69 ± 0.33</td><td>61.83 ± 0.37</td></tr><tr><td>256</td><td>77.98 ± 0.34</td><td>63.46 ± 0.38</td></tr><tr><td>512</td><td>78.34 ± 0.33</td><td>66.27 ± 0.40</td></tr></table>
275
+
276
+ # C.4 ABOUT THE PROJECTION LAYER OF MCL
277
+
278
+ We have found that with a deeper backbone, the features learning can be facilitated a lot by the projection layer. We further evaluate the quality of features extracted by the network body and the projection layer. The evaluation results are given in Table 9. Even if the contrastive loss is applied to the projection layer, the network body learns better and general representations. We conjecture that during the meta-training, the projection layer may absorb more task-specific information while the backbone tends to learn task-independent representations.
md/train/H1g8p1BYvS/H1g8p1BYvS.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL FILTERS OF DATASET BIASES
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Large-scale benchmark datasets have been among the major driving forces in AI, supporting training of models and measuring their progress. The key assumption is that these benchmarks are realistic approximations of the target tasks in the real world. However, while machine performance on these benchmarks advances rapidly — often surpassing human performance — it still struggles on the target tasks in the wild. This raises an important question: whether the surreal high performance on existing benchmarks are inflated due to spurious biases in them, and if so, how we can effectively revise these benchmarks to better simulate more realistic problem distributions in the real world.
8
+
9
+ In this paper, we posit that while the real world problems consist of a great deal of long-tail problems, existing benchmarks are overly populated with a great deal of similar (thus non-tail) problems, which in turn, leads to a major overestimation of true AI performance. To address this challenge, we present a novel framework of Adversarial Filters to investigate model-based reduction of dataset biases. We discuss that the optimum bias reduction via AFOPTIMUM is intractable, thus propose AFLITE, an iterative greedy algorithm that adversarially filters out data points to identify a reduced dataset with more realistic problem distributions and considerably less spurious biases.
10
+
11
+ AFLITE is lightweight and can in principle be applied to any task and dataset. We apply it to popular benchmarks that are practically solved — ImageNet and Natural Language Inference (SNLI, MNLI, QNLI) — and present filtered counterparts as new challenge datasets where the model performance drops considerably (e.g., from $84 \%$ to $24 \%$ for ImageNet and from $92 \%$ to $62 \%$ for SNLI), while human performance remains high. An extensive suite of analysis demonstrates that AFLITE effectively reduces measurable dataset biases in both the synthetic and real datasets. Finally, we introduce new measures of dataset biases based on K-nearest-neighbors to help guide future research on dataset developments and bias reduction.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Large-scale neural networks have achieved superhuman performance across many popular AI benchmarks, for tasks as diverse as image recognition (ImageNet; Russakovsky et al. (2015)), natural language inference (SNLI; Bowman et al. (2015)), and question answering (SQuAD; Rajpurkar et al. (2016)). Yet these deep models struggle when taken out of these dataset environments and evaluated on adversarial data or problems in the wild (Eykholt et al., 2018; Jia & Liang, 2017). This raises a key question: Does high model performance on today’s benchmark datasets indicate the underlying task is solved, or do those datasets overestimate the true capabilities of current AI systems?
16
+
17
+ Answering this question is key because benchmarks serve important roles in the community. Not only do they direct progress on core tasks, they also make it easier to tackle the lofty target tasks such as image recognition in the wild through a more practically-scoped dataset such as ImageNet. However, the closed-world assumption of most existing datasets is subject to significant bias (Torralba & Efros, 2011). Much of the data that is easy to obtain and label isn’t necessarily representative of the task we seek to measure. Thus, if left unchecked, artifacts from data collection (Fouhey et al., 2018) or human labeling (Gururangan et al., 2018; Poliak et al., 2018; Tsuchiya, 2018; Geva et al., 2019) can significantly inflate model performance. Though there exist task- and dataset-specific approaches for addressing these biases (Goyal et al., 2017; Geirhos et al., 2018), the complex artifacts that emerge from large-scale dataset creation are challenging to exhaustively identify and remove.
18
+
19
+ ![](images/92d062e2e02496cd00d087cc6083837faa34ec7bcddf685cd2d17227f4c79fd2.jpg)
20
+ Figure 1: Random ImageNet images for two labels – Monarch Butterfly and Chickadee – that were either selected (left) as adversarial by our AFLITE algorithm, or excluded (right). The heatmap shows pairwise cosine similarity between EfficientNet-B7 features (Tan & Le, 2019). The AFLITE images show significantly greater diversity – such as the cocoon of a butterfly, or the non-canonical chickadee poses – that is in turn reflected by the cosine similarity. This diversity suggests that the AFLITE examples more directly measure progress on the true task of image classification, versus fitting to dataset bias.
21
+
22
+ In this paper, we present AFLITE – a computationally efficient dataset reduction algorithm, aimed at systematically reducing spurious artifacts in a dataset. AFLITE is general and can be applied to any task and dataset. Our approach leverages a high capacity model to learn dataset specific biases on a small subset, then uses it to identify and filter artifact-prone instances in the remainder of the dataset to yield a final dataset that is possibly closer to the intended task.
23
+
24
+ We first evaluate the effectiveness of our method on synthetic data and show that AFLITE lowers the performance of models relying on annotation artifacts while preserving the performance of models whose representation captures the underlying tasks. In addition, while AFLITE aims to retain the more challenging, confusing instances, our experiments show that it can successfully remove biased instances that are adversarial to the correct representation of the data.
25
+
26
+ Finally, we apply the method to several benchmark datasets across various tasks and domains. In language understanding, we apply AFLITE to the SNLI (Bowman et al., 2015) and MNLI (Williams et al., 2018) datasets for natural language inference, and to QNLI (Wang et al., 2018) for question answering. We show a $3 0 \%$ absolute gap in performance in the current state-of-art methods before and after AFLITE. In computer vision, AFLITE reduces the performance of image classification neural methods on ImageNet (Russakovsky et al., 2015), showing a $49 \%$ absolute gap.
27
+
28
+ # 2 DATASET REDUCTION FOR REPRESENTATION-BIAS MINIMIZATION
29
+
30
+ In this section, we introduce AFLITE, a general approach for reducing the scope of bias in datasets. Large datasets run the risk of prioritizing performance on the data-rich head of the distribution, where examples are plentiful, and discounting the tail. Our goal is to minimize the ability of a model to exploit biases in the head of the distribution, while preserving the inherent complexity of the tail.
31
+
32
+ Let $\Phi$ represent a feature representation, defined over a dataset ${ \mathcal { D } } = ( X , Y )$ . With AFLITE, we seek a subset $S \subset \mathcal { D }$ of size $| S | \ge n$ that is maximally resilient to the features uncovered by $\Phi$ . For any identically-distributed train-test split of $\mathcal { D }$ , the features extracted by $\Phi$ should not generalize to the held-out set. Our approach allows for any choice of feature representation.
33
+
34
+ Formalization More formally, let $\mathcal { M }$ denote a family of classification models (e.g., logistic regression, SVM, or a particular neural architecture) that can be trained on subsets $S$ of $D \doteq ( X , Y )$
35
+
36
+ using features $\Phi ( X )$ . We define the representation bias of $\Phi$ in $S w x t { \mathcal { M } }$ , denoted ${ \mathcal { R } } ( \Phi , S , { \mathcal { M } } )$ , as the best possible out-of-sample classification accuracy achievable by models in $\mathcal { M }$ when predicting the true labels $Y$ using features $\Phi ( X )$ . For a given target reduced dataset size of at least $n$ , the goal is to find a subset $S \subset D$ , $| S | \ge n$ that minimizes this representation bias in $S$ w.r.t. $\mathcal { M }$ :
37
+
38
+ $$
39
+ \operatorname* { m i n } _ { S \subset D , | S | \geq n } { \mathcal { R } } ( \Phi , S , { \mathcal { M } } )
40
+ $$
41
+
42
+ Eq. (1) corresponds to the optimum bias reduction, referred to as AFOPTIMUM. ${ \mathcal { R } } ( \Phi , S , { \mathcal { M } } )$ can be formulated as the expected classification accuracy resulting from the following process. Let $q : 2 ^ { S } [ 0 , 1 ]$ be a probability distribution over subsets $T = \mathsf { \bar { ( } } X ^ { T } , Y ^ { T } )$ of $D$ . The process is to randomly choose a subset $T$ with probability $q ( T )$ , train a bias estimator $M _ { T } \in \mathcal { M }$ on $D \backslash T$ , and evaluate its classification accuracy $f _ { M _ { T } } ( \Phi ( X ^ { T } ) , Y ^ { T } )$ on $T$ . Note that the resulting classification accuracy on $T$ itself is a random variable, since the training set $D \setminus T$ is random. We define the expected value of this classification accuracy to be the representation bias:
43
+
44
+ $$
45
+ \mathcal { R } ( \Phi , S , \mathcal { M } ) \stackrel { \Delta } { = } \mathbb { E } _ { T \sim q } \left[ f _ { M _ { T } } ( \Phi ( X ^ { T } ) , Y ^ { T } ) \right]
46
+ $$
47
+
48
+ While this expression formalizes the intended objective function, it involves a large summation over subsets $T \subset S$ just to compute the representation bias present in a single set $S$ . It does not suggest a practical way to compute the minimization in Eq. (1) without further considering each of the exponentially many subsets $S \subset D$ individually – thus an optimal solution for Equation (2) is intractable. To get around this difficulty, we reformulate the representation bias in $S$ as a sum factored over the $| S |$ individual instances $i \in S$ . This will allow us to efficiently decide whether or not to include $i$ in the targeted, reduced subset we are constructing.
49
+
50
+ The idea is to aggregate the contribution of each $i$ towards the representation bias expression across all random choices of the training set $D \backslash T$ . We call this the predictability score $p ( i )$ for $i$ : on average, how reliably can the label $y _ { i }$ be predicted using features $\Phi ( x _ { i } )$ when a model from $\mathcal { M }$ is trained on a randomly chosen training set $D \backslash T$ not containing $i$ . The higher the value of $p ( i )$ , the easier it is to correctly classify the instance $( x _ { i } , y _ { i } )$ using model family $\mathcal { M }$ . This is the signal we will use to decide whether to include $i$ in the reduced subset $S$ we are constructing.
51
+
52
+ With some abuse of notation, for $i \in D$ , let $\begin{array} { r } { q ( i ) \triangleq \sum _ { T \ni i } q ( T ) } \end{array}$ denote the marginal probability of choosing a subset T that contains i. The ratio q(T )q(i) is then the probability of $T$ conditioned on it containing $i$ . Let $f _ { M _ { T } } ( \Phi ( x _ { i } ) , y _ { i } )$ be the classification accuracy of $M _ { T }$ on $i$ . The reformulation of representation bias in terms of predictability scores of individual instances works as follows:
53
+
54
+ $$
55
+ \begin{array} { r l } { \mathbb { E } _ { \mathcal { F } \sim \infty _ { + } } \left[ f _ { M \tau } \left( \Phi ( X ^ { \tau } ) , Y ^ { \tau } \right) \right] = \displaystyle \sum _ { t \in S } q ( T ) \cdot \frac { 1 } { | T | } \sum _ { i \in T } ^ { T } f _ { M \tau } \left( \Phi ( x _ { i } ) , y _ { i } \right) } & { } \\ & { = \displaystyle \sum _ { \tau \in S } \sum _ { i \in T } q ( T ) \cdot \frac { f _ { M \tau } \left( \Phi ( x _ { i } ) , y _ { i } \right) } { | T | } } \\ & { = \displaystyle \sum _ { \tau \in S } \sum _ { \tau \in S } q ( T ) \cdot \frac { f _ { M \tau } \left( \Phi ( x _ { i } ) , y _ { i } \right) } { | T | } } \\ & { = \displaystyle \sum _ { \tau \in S } \frac { \displaystyle \sum _ { \tau \in S } y } { \displaystyle \sum _ { \tau \in S } y } \cdot \frac { \displaystyle \frac { \bar { q } ( T ) } { \displaystyle \lambda } \sum _ { i \in T } \left( \frac { \bar { q } ( x _ { i } ) } { | T | } \right) \cdot y _ { i } } { | T | } } \\ & { = \displaystyle \sum _ { \tau \in S } q ( t ) \cdot \frac { \displaystyle \sum _ { \tau \in S } \bar { q } ( T ) } { \displaystyle \sum _ { \tau \in S } y } \frac { \displaystyle \bar { q } ( T ) } { \displaystyle \left( \bar { q } ( x _ { i } ) \right) } \frac { f _ { M \tau } \left( \Phi ( x _ { i } ) , y _ { i } \right) } { | T | } } \\ & { = \displaystyle \sum _ { \tau \in S } q ( \bar { q } ) \mathbb { E } _ { \tau \cap S , \tau \in S } \left\{ \frac { f _ { M \tau } \left( \bar { q } ( x _ { i } ) , y _ { i } \right) } { | T | } \right\} } \\ & { = \displaystyle \sum _ { \tau \in S } p ( i ) } \end{array}
56
+ $$
57
+
58
+ where $p ( i )$ is the predictability score of $i$ defined as:
59
+
60
+ $$
61
+ p ( i ) \triangleq q ( i ) \mathbb { E } _ { T \subset S , T \ni i } \left[ \frac { f _ { M _ { T } } ( \Phi ( x _ { i } ) , y _ { i } ) } { \vert T \vert } \right]
62
+ $$
63
+
64
+ While the method works for any probability distribution $q$ with non-zero support on all samples, for simplicity of exposition, we restrict $q$ to be the uniform distribution over all subsets $T \subset S$ of a fixed size. This makes both $| T |$ and $q ( i )$ fixed constants; in particular, $\begin{array} { r } { q ( i ) = \binom { | S | - 1 } { | T | - 1 } / \binom { | S | } { | T | } = \frac { | T | } { | S | } } \end{array}$ |T ||S| . This reduces the predictability score expression of Eq. (3) to the simplified variant $\tilde { p } ( i )$ :
65
+
66
+ $$
67
+ \tilde { p } ( i ) \triangleq \frac { 1 } { | S | } \mathbb { E } _ { T \subset S , T \ni i } \left[ f _ { M _ { T } } ( \Phi ( x _ { i } ) , y _ { i } ) \right]
68
+ $$
69
+
70
+ Putting the pieces together, we have a factored reformulation of the representation bias in Eq. (2):
71
+
72
+ $$
73
+ \mathcal { R } ( \Phi , S , \mathcal { M } ) = \sum _ { i \in S } \tilde { p } ( i )
74
+ $$
75
+
76
+ Armed with this factored representation, we return to the task of identifying an $S \subset D$ , $| S | \ge n$ that minimizes the representation bias. We use the simplified predictability scores (henceforth simply referred to as predictability scores) as a heuristic metric to decide which $i \in D$ to include in $S$ . We consider three approaches that iteratively filter out the most predictable instances from $D$ to arrive at $S$ . In all cases, we use a fixed training set size $| S \setminus T | = t < n$ . Further, since a larger filtered set is generally desirable, we terminate the filtering process early (i.e., while $\vert S \vert > n )$ if the predictability score for every $i$ falls below a pre-specified early stopping threshold $\tau \in [ 0 , 1 ]$ .
77
+
78
+ The three approaches are as follows. (A) A simple greedy approach starts with the full set $S = D$ , identifies an $i \in S$ with the highest predictability score, removes it from $S$ , and repeats up to $| D | - n$ times. (B) A greedy slicing approach identifies the instances with the $k$ highest predictability scores, removes all of them from $S$ , and repeats the process up to $\lfloor { \frac { \lfloor D \rfloor - n } { k } } \rfloor$ times. (C) A slice sampling approach where, instead of greedily choosing the top $k$ instances, it randomly samples $k$ instances with probabilities proportional to their predictability scores.1 In this paper, we use the greedy slicing approach in our experiments and refer to it as AFLITE. While the optimum bias reduction via AFOPTIMUM is intractable, its light-weight version, AFLITE, is applicable in practice.
79
+
80
+ The slice sampling approach can be efficiently implemented using what is known as the Gumbel method or Gumbel trick (Gumbel & Lieblein, 1954; Maddison et al., 2014), which uses random perturbations to turn sampling into a simpler problem of optimization. This has recently found success in several probabilistic inference applications (Kim et al., 2016; Jang et al., 2016; Maddison et al., 2016; Balog et al., 2017; Kool et al., 2019). Starting with the log-predictability scores $\log \tilde { p } ( i )$ for various $i$ , the idea is to perturb them by adding an independent random noise $\gamma _ { i }$ drawn from the standard Gumbel distribution. Interestingly, the maximizer $i ^ { * }$ of $\gamma _ { i } + \log \tilde { p } ( i )$ turns out to be an exact sample drawn from the (unnormalized) distribution defined by $\tilde { p }$ . Note that $i ^ { * }$ is a random variable since the $\gamma _ { i }$ are drawn at random. This result can be generalized (Vieira, 2014) for slice sampling: the $k$ highest values of Gumbel-perturbed log-predictability scores correspond to sampling, without replacement, $k$ items from the probability distribution defined by $\tilde { p }$ . The Gumbel method is typically applied to exponentially large combinatorial spaces, where it is challenging to scale up. In our setting, however, the overhead is minimal since the cost of drawing a random $\gamma _ { i }$ is negligible compared to computing $\tilde { p } ( i )$ .
81
+
82
+ Implementation Algorithm 1 provides an implementation of AFLITE. The algorithm takes as input a dataset $D = \bar { ( } X , Y )$ , a representation $\Phi ( X )$ we are interested in minimizing the bias in, a model family $\mathcal { M }$ (e.g., linear classifiers), a target dataset size $n$ , size $m$ of the support of the expectation in Eq. (4), training set size $t$ for the classifiers, size $k$ of each slice, and an early-stopping filtering threshold $\tau$ . Importantly, for efficiency, $\Phi ( X )$ is provided to AFLITE in the form of precomputed embeddings for all of $X$ . To obtain $\Phi ( X )$ in practice, we train a first model on a small fraction of the data based on the learning curve in low-data regime, and do not reuse this data for the rest of our experiments. Moreover, this fraction corresponds to the training size $t$ for AFLITE and it remains unchanged across iterations. We follow the iterative filtering approach, starting with $S \ : = \ : D$ and iteratively removing some instances with the highest predictability scores using the
83
+
84
+ # Algorithm 1: AFLITE
85
+
86
+ Input: dataset $D = ( X , Y )$ , pre-computed representation $\Phi ( X )$ , model family $\mathcal { M }$ , target dataset size $n$ ,
87
+ number of random partitions $m$ , training set size $t < n$ , slice size $k \leq n$ , early-stopping threshold $\tau$
88
+ Output: reduced dataset $S$
89
+ 1 $S = D$
90
+ 2 while $\vert S \vert > n$ do
91
+ // Filtering phase
92
+ 3 forall $i \in S$ do
93
+ 4 Initialize a multi-set of out-of-sample predictions $E ( i ) = \emptyset$
94
+ 5 for iteration $j : 1 . . m$ do
95
+ 6 Randomly partition $S$ into $( T _ { j } , S \setminus T _ { j } )$ s.t. $| S \setminus T _ { j } | = t$
96
+ 7 Train a classifier ${ \mathcal { L } } \in { \mathcal { M } }$ on $\{ ( \Phi ( x ) , y ) ~ | ~ ( x , y ) \in S \setminus T _ { j } \}$ $\mathcal { L }$ is typically a linear classifier)
97
+ 8 forall $i = ( x , y ) \in T _ { j }$ do
98
+ 9 Add the prediction ${ \mathcal { L } } ( \Phi ( x ) )$ to $E ( i )$
99
+ 10 forall $i = ( x , y ) \in S$ do
100
+ 11 Compute the predictability score $\tilde { p } ( i ) = | \{ \hat { y } \in E ( i ) \ s . t . \ \hat { y } = y \} | / \left| E ( i ) \right|$
101
+ 12 Select up to $k$ instances $S ^ { \prime }$ in $S$ with the highest predictability scores subject to $\tilde { p } ( i ) \geq \tau$
102
+ 13 $S = S \setminus S ^ { \prime }$
103
+ 14 if $| S ^ { \prime } | < k$ then
104
+ 15 break
105
+ 16 return $S$
106
+
107
+ greedy slicing strategy. Slice size $k$ and number of partitions $m$ are determined by the available computation budget.
108
+
109
+ At each filtering phase, we train models (linear classifiers in our implementation) on $m$ different random partitions of the data, and collect their predictions on their corresponding test set. For each instance $i$ , we compute its predictability score as the ratio of the number of times its label $y _ { i }$ is predicted correctly, over the total number of predictions for it. We rank the instances according to their predictability score and use the greedy slicing strategy of removing the top- $k$ instances whose score is not less than the early-stopping threshold $\tau$ . We repeat this process until fewer than $k$ instances pass the $\tau$ threshold in a filtering phase or fewer than $n$ instances remain.
110
+
111
+ # 3 EXPERIMENTAL ANALYSIS
112
+
113
+ We evaluate AFLITE across various domains (synthetic, natural language processing, computer vision), different tasks in a given domain (language inference and question answering in NLP), different datasets for a given task (SNLI and MNLI in natural language inference), and different representations for a given dataset (pre-computed embeddings from ESIM+GLoVe, BERT, RoBERTa for the SNLI dataset).
114
+
115
+ # 3.1 SYNTHETIC EXPERIMENTS
116
+
117
+ We demonstrate the utility of AFLITE in a synthetic data setting. Our dataset consists of twodimensional data, arranged in concentric circles, at four different levels of separation, as shown in the Figure 2. As is evident, a linear function might not be adequate for separating the two classes; it requires a more complex non-linear model such as an SVM with an RBF kernel. 2
118
+
119
+ We add class-specific artificially constructed features (artifacts) sampled from two different Gaussian distributions. These features are only added to $7 5 \%$ of the data in each class, while for the rest of the data, we insert random (noise) features. These artifacts make the task solvable through a linear function. Furthermore, for the first dataset, with the largest separation, we flipped the labels of some examples with artifacts, making the data slightly adversarial even to the RBF. Both models can clearly leverage the artifacts, and demonstrate improved performance over a baseline without artifacts.
120
+
121
+ Table 1: Dev accuracy $( \% )$ on the original SNLI dataset $D$ and the datasets obtained through various representation-bias minimization. The -HypOnly baselines correspond to models trained on the instances restricted to their hypotheses.
122
+
123
+ <table><tr><td>Model</td><td>D</td><td>D92k</td><td>D(ΦESIM+GLoVe)</td><td>D(ΦBERT)</td><td>D(ΦRoBERTa)</td></tr><tr><td>ESIM+ELMo (Peters et al.,2018)</td><td>88.7</td><td>86.0</td><td>61.5</td><td>54.2</td><td>51.9</td></tr><tr><td>BERT (Devlin et al., 2019)</td><td>91.3</td><td>87.6</td><td>74.7</td><td>61.8</td><td>57.0</td></tr><tr><td>RoBERTa (Liu et al.,2019b)</td><td>92.6</td><td>88.3</td><td>78.9</td><td>71.4</td><td>62.6</td></tr><tr><td>Max-PPMI baseline</td><td>54.5</td><td>52.0</td><td>41.1</td><td>41.5</td><td>41.9</td></tr><tr><td>BERT-HypOnly</td><td>71.5</td><td>70.1</td><td>52.3</td><td>46.4</td><td>48.4</td></tr><tr><td>RoBERTa-HypOnly</td><td>72.0</td><td>70.4</td><td>53.6</td><td>49.5</td><td>48.5</td></tr><tr><td>Human performance</td><td>88.1</td><td>88.1</td><td>82.3</td><td>80.3</td><td>77.8</td></tr><tr><td>Training set size</td><td>550k</td><td>92k</td><td>138k</td><td>109k</td><td>92k</td></tr></table>
124
+
125
+ Once we apply AFLITE, as expected, the number of examples with artifacts is reduced considerably, making the task hard once again for the linear model, but still solvable for the non-linear one. The filtered dataset is shown in the bottom half of Fig. 2, and the captions indicate the performance of a linear and an SVM model. For the first dataset, we see that AFLITE removes most of those examples with flipped labels.
126
+
127
+ ![](images/115f14c9115d54ffd350759e4fc7e5da77c8f8f5fbabc34a97b98e2ba25d04eb.jpg)
128
+ Figure 2: Four sample datasets with artifacts as input to AFLITE (top). Blue and orange indicate two different classes. Only the original two dimensions are shown, not the artifacts. For the leftmost dataset with the highest separation, we flip some labels at random, so even an RBF kernel cannot achieve perfect performance. AFLITE makes the data more challenging for the models (bottom).
129
+
130
+ # 3.2 NLP EXPERIMENTS
131
+
132
+ We evaluate AFLITE on two NLP tasks, namely NLI and question answer sentence selection. We use two popular NLI large-scale datasets – SNLI (Bowman et al., 2015) and MNLI (Wang et al., 2018). For the answer sentence selection task, we use QNLI which is a transformed version of the SQuAD question answering dataset (Rajpurkar et al., 2016) converted to binary classification where systems determine whether a sentence contains the answer to a question.
133
+
134
+ SNLI Each instance in the SNLI dataset consists of a premise-hypothesis pair that belongs to one out of three possible categories (entailment, contradiction, or neutral) based on the relationship between the premise and the hypothesis.
135
+
136
+ For SNLI, we experiment with three different feature representations derived from strong baseline models: $\Phi _ { B E R T }$ and $\Phi _ { R o B E R T a }$ which are based on BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019b), large-scale pretrained masked language models, plus $\Phi _ { E S I M + G L o V e }$ which uses the
137
+
138
+ Table 2: Dev accuracy $( \% )$ on the original MNLI-matched and QNLI datasets and the datasets obtained through $\Phi _ { R o B E R T a }$ -representation-bias minimization. The -PartialInput baselines correspond to models trained on partial, incomplete input, namely the Hypotheses for MNLI instances and the Answers for QNLI instances.
139
+
140
+ <table><tr><td></td><td colspan="2">MNLI</td><td colspan="2">QNLI</td></tr><tr><td>Model</td><td>D</td><td>D(RoBERTa)</td><td>D</td><td>D( RoBERTa)</td></tr><tr><td>BERT (Devlin et al., 2019)</td><td>86.6</td><td>55.8</td><td>92.0</td><td>63.5</td></tr><tr><td>RoBERTa (Liu et al.,2019b)</td><td>90.3</td><td>66.2</td><td>93.7</td><td>77.7</td></tr><tr><td>BERT-PartialInput</td><td>59.7</td><td>43.2</td><td>62.6</td><td>56.6</td></tr><tr><td>RoBERTa-PartialInput</td><td>60.3</td><td>44.4</td><td>63.9</td><td>59.4</td></tr></table>
141
+
142
+ ESIM model (Chen et al., 2016) with GLoVe word embeddings (Pennington et al., 2014). In all cases, feature representation $\Phi$ is trained on a random sample of $1 0 \%$ of the original training instances, and feature representations are extracted from the final layer before the output layer. These features are pre-computed for all remaining instances while we discard the instances $1 0 \%$ of training) used for training the embeddings in the subsequent steps of our algorithm. Additionally, to measure the ability of a weaker adversary to filter biases only learned by a stronger model, we evaluate the filtered datasets (for SNLI) with three different models: (i) ESIM with ELMo embeddings (Peters et al., 2018), (ii) BERT-large, and (iii) RoBERTa-large models.
143
+
144
+ Table 1 shows the results for SNLI. In all cases, applying AFLITE substantially reduces overall model accuracy, with typical drops of $1 5 . 3 5 \%$ depending on the models used for learning the feature representations and those used for evaluation of the filtered dataset. In general, performance is lowest when using the strongest model (RoBERTa) for learning feature representations. Results also highlight the ability of weaker adversaries to produce datasets that are still challenging for much stronger models with a drop of $1 3 . 7 \%$ for RoBERTa using $\Phi _ { E S I M + G L o V e }$ as feature representation. We also include a model that uses Point-wise Mutual Information (PMI) between words in a given instance and the target label as a feature. The baseline captures the extent to which datasets exhibit word-association artifacts. While this baseline is relatively weaker than other models, we still show that its performance reduce from $5 4 . 5 \%$ on $D$ to $4 1 . 9 \%$ on the $D ( \phi _ { R o B E R T a } )$ dataset.
145
+
146
+ It might seem unsurprising that reducing the size of the training set results in lower performance. To control for the confounding factor of the dataset size, we create another filtered dataset $D _ { 9 2 k }$ , sampled randomly from $D$ such that its size is approximately equal to the size of $D ( \phi _ { R o B E R T a } )$ dataset. All models achieve nearly the same performance as their performance on the full dataset – even when trained on just one-fifth the original dataset size. This result further points to the fact that current benchmark datasets contain significant redundancy within its instances.
147
+
148
+ Finally, to demonstrate the value of the iterative, ensemble-based AFLITE algorithm, we compare with a baseline where using a single model, we filter out the most predictable examples in a single iteration — a non-iterative, single-model version of AFLITE. A RoBERTa-large model trained on this subset (of the same size as $D ( \phi _ { R o B E R T a } ) )$ achieves a dev accuracy of $7 2 . 1 \%$ . Compared to the performance of RoBERTa on $D ( \phi _ { R o B E R T a } )$ $( 6 2 . 6 \%$ , see Table 1), it makes this baseline a sensible yet less effective approach. In particular, this illustrates the need for an iterative procedure involving models trained on multiple partitions of the remaining data in each iteration.
149
+
150
+ We also report the $\mathbf { k }$ -nearest neighbors distances between examples in the train and heldout data in Table 3. We consider distances for examples within each class, as well as examples across classes. The distances are computed using cosine similarity between pooled features from BERT-based model (features for the [CLS] token, indicating a sentence-pair feature) trained on the original SNLI dataset. Distances are measured between samples from the heldout data, and their nearest neighbors in the training data, before and after filtering. Distances generally increase after filtering, indicating that AFLITE promotes selecting a diverse set of examples from the dataset. The only exception to the rule is the neutral class, where distances to other classes decrease – this is not surprising since the neutral class is known to be associated with the least number of artifacts (Gururangan et al., 2018).
151
+
152
+ Table 3: KNN-distances by class, before and after applying (RoBERTa-filtered) AFLITE to SNLI.
153
+
154
+ <table><tr><td rowspan="2"></td><td colspan="4">Before AFLITE</td><td colspan="4">After AFLITE</td></tr><tr><td>Top1</td><td>Top5</td><td>Top10</td><td>Top50</td><td>Top1</td><td>Top5</td><td>Top10</td><td>Top50</td></tr><tr><td>Entailment</td><td>0.29</td><td>1.32</td><td>2.45</td><td>9.5</td><td>0.32</td><td>1.42</td><td>2.64</td><td>9.98</td></tr><tr><td>Neutral</td><td>0.40</td><td>1.89</td><td>3.68</td><td>16.83</td><td>0.42</td><td>1.97</td><td>3.80</td><td>16.66</td></tr><tr><td>Contradiction</td><td>0.49</td><td>2.41</td><td>4.77</td><td>23.09</td><td>0.52</td><td>2.49</td><td>4.84</td><td>22.10</td></tr><tr><td>Entailment vs others</td><td>0.32</td><td>1.48</td><td>2.87</td><td>12.98</td><td>0.34</td><td>1.53</td><td>2.92</td><td>12.31</td></tr><tr><td>Neutral vs others</td><td>0.43</td><td>2.05</td><td>3.99</td><td>18.42</td><td>0.41</td><td>1.94</td><td>3.72</td><td>16.41</td></tr><tr><td>Contradiction vs others</td><td>0.49</td><td>2.38</td><td>4.70</td><td>22.61</td><td>0.53</td><td>2.51</td><td>4.87</td><td>22.38</td></tr></table>
155
+
156
+ <table><tr><td></td><td colspan="4">HANS</td><td colspan="3">NLI-Diagnostics</td><td colspan="3">Adversarial-NLI</td></tr><tr><td>Model</td><td>Al</td><td>Lex.</td><td>Subseq.</td><td>Constit.</td><td>All</td><td>Logic</td><td>Knowl.</td><td>Rd1</td><td>Rd2</td><td>Rd3</td></tr><tr><td>RoBERTa</td><td>70.7</td><td>84.4</td><td>35.4</td><td>13.4</td><td>59.3</td><td>52.8</td><td>48.9</td><td>58.5</td><td>48.3</td><td>50.1</td></tr><tr><td>RoBERTa-AFlite</td><td>74.5</td><td>96.3</td><td>56.6</td><td>57.4</td><td>62.0</td><td>53.2</td><td>57.7</td><td>65.1</td><td>49.1</td><td>52.8</td></tr></table>
157
+
158
+ Table 4: SNLI accuracy $( \% )$ on three out-of-distribution evaluation tasks, comparing RoBERTalarge models pre-trained on the original SNLI data, and on AFLITE-filtered data. On the HANS dataset, both models are evaluated on $A l l$ , as well as on the non-entailment cases of the three syntactic heuristics (Lexical overlap, Subsequence, and Constituent). The NLI-Diagnostics dataset is broken down into the full dataset $( A l l )$ , as well as the instances requiring logical reasoning (Logic) and the ones requiring world and commonsense knowledge (Knowledge). For Adversarial NLI, we finetuned both models on the in-distribution training data for each round (Rd1, Rd2, and Rd3).
159
+
160
+ MNLI and QNLI Following the same procedure described above, we apply AFLITE on the MNLI and QNLI datasets. Since RoBERTa resulted in the largest drops in performance across the board in SNLI, we only experiment with RoBERTa as adversary for MNLI and QNLI. While RoBERTa achieves over $9 0 \%$ on both original datasets, its performance drops to $6 6 . 2 \%$ for MNLI and to $7 7 . 7 \%$ for QNLI on the reduced datasets. Similarly, partial input baseline performance also decreases substantially on both dataset compared to their performance on the original dataset. Table 2 shows these results. We show that AFLITE consistently result in reduced accuracy on the filtered datasets across multiple NLP benchmark datasets, even after controlling for the size of the training set.
161
+
162
+ # 3.2.1 OUT-OF-DISTRIBUTION NLI
163
+
164
+ We measure the performance of AFLITE on three other benchmarks for NLI evaluation, which provide out-of-distribution examples to challenge reliance on dataset biases in the original SNLI data (Glockner et al., 2018; Naik et al., 2018). Such benchmarks approximate the performance of NLI models in the wild. NLI Diagnostics (Wang et al., 2018) is a set of hand-crafted examples designed to demonstrate model performance on several fine-grained semantic categories, such as logical reasoning and commonsense knowledge. HANS (McCoy et al., 2019) contains evaluation examples designed to avoid common structural heuristics (such as word overlap) which could be used by models to correctly predict NLI inputs, without true inferential reasoning. Adversarial NLI (Nie et al., 2019) consists of premises collected from Wikipedia and other news corpora, and human generated hypotheses, arranged at different tiers of the challenge they present to a model, using a human and model in-the-loop procedure. Given that these benchmarks are collected independently of the original SNLI task, the biases from SNLI are less likely to carry over; however these benchmarks might contain their own biases (Liu et al., 2019a).
165
+
166
+ AFLITE assigns a predictability score to all samples in a dataset, resulting in an ordering of the data. Filtering out examples from the head of the data distribution based on this order yields more accurate benchmarks for measuring true model performance. On the other hand, transferability to out-of-distribution data would involve a greater balance between examples from the head and the tail ends of the data distribution. Hence we evaluate AFLITE for generalization using a larger filtered subset, amounting to only a third of the full training data. We present these results on all the above benchmarks in Table 4. On the two diagnostic datasets (HANS and NLI-Diagnostics), we perform a zero-shot evaluation of the two models. Adversarial NLI allows to test for transfer capabilities, by finetuning these models on each of the three training datasets (Rd1, Rd2 and Rd3). On each of the benchmarks above, the model trained on the AFLITE data consistently outperforms the model trained on the full SNLI data. challenging examples in the HANS benchmark, which targets models purely relying on lexical and syntactic cues. Similarly, our model performs better on the instances in NLI-Diagnostics that require logical reasoning and commonsense knowledge, as opposed to instances that can be solved through lexical entailment alone.
167
+
168
+ Table 5: Experimental results on ImageNet. We compare between three settings: the original dataset’s train-test splits, using $20 \%$ of the training set but evaluating on the validation set, and using the AFLITE produced training and validation sets. AFLITE produces a training dataset that is also $20 \%$ of the training set size, making it a fair comparison in terms of dataset examples. The results show a significant drop in Top-1 and Top-5 accuracy: the Top-1 accuracy goes down by roughly 40 percentage points per model in this new training and evaluation setting.
169
+
170
+ <table><tr><td rowspan="2">Model</td><td colspan="2">100% Train, Original Val</td><td colspan="2">20% Train, , Original Val</td><td colspan="2">AFLITE</td></tr><tr><td>Top-1</td><td>Top-5</td><td>Top-1</td><td>Top-5</td><td>Top-1</td><td>Top-5</td></tr><tr><td>EfficientNet-B0</td><td>76.3</td><td>93.2</td><td>58.5</td><td>81.2</td><td>18.1</td><td>48.1</td></tr><tr><td>EfficientNet-B2</td><td>79.8</td><td>94.9</td><td>60.9</td><td>82.8</td><td>20.7</td><td>53.1</td></tr><tr><td>EfficientNet-B4</td><td>82.6</td><td>96.3</td><td>64.4</td><td>85.8</td><td>23.3</td><td>58.8</td></tr><tr><td>EfficientNet-B7</td><td>84.4</td><td>97.1</td><td>73.8</td><td>90.8</td><td>24.5</td><td>60.6</td></tr><tr><td>ResNet-34</td><td>78.4</td><td>94.4</td><td>51.8</td><td>74.3</td><td>11.1</td><td>30.2</td></tr><tr><td>ResNet-50</td><td>79.2</td><td>94.7</td><td>53.2</td><td>75.5</td><td>12.2</td><td>30.2</td></tr><tr><td>ResNet-101</td><td>80.1</td><td>95.4</td><td>55.6</td><td>77.5</td><td>12.3</td><td>32.1</td></tr><tr><td>ResNet-152</td><td>80.6</td><td>95.5</td><td>56.5</td><td>78.2</td><td>13.2</td><td>33.8</td></tr></table>
171
+
172
+ # 3.3 IMAGENET EXPERIMENTS
173
+
174
+ We evaluate AFLITE on image classification through ImageNet (ILSVRC2012) classification. On ImageNet, we use the state-of-the-art EfficientNet-B7 model as our core feature extractor $\Phi$ (Tan & Le, 2019). The EfficientNet model is learned from scratch on a fixed $20 \%$ sample of the ImageNet training set, using AutoAugment data augmentation (Cubuk et al., 2019). We then use the 2560- dimensional features extracted by EfficientNet-B7 as then underlying representation for AFLITE to use to filter the remaining dataset.
175
+
176
+ In Table 5, we evaluate the robustness of the filtered dataset by considering ImageNet accuracy across the EfficientNet and ResNet model families (He et al., 2016). When lowering the size of the training set – down to $20 \%$ of the original, we find a large drop in performance. The EfficientNet models seem to suffer less – from $8 4 \%$ to $7 3 \%$ on EfficientNet-B7 versus $8 0 . 6 \%$ to $5 6 . 5 \%$ on ResNet-152. However, the biggest performance drop comes from training and evaluating on the AFLITE-filtered dataset: the top performer is still EfficientNet-B7, but its accuracy drops to $2 4 . 5 \%$ top-1. This is despite controlling for dataset size, as well as discrepancy between the training and validation sets.
177
+
178
+ Overall, these results suggest that image classification – even within a subset of the closed world of ImageNet – is far from solved. These results echo other findings that suggest that common biases that naturally occur in web-scale image data, such as towards canonical poses (Alcorn et al., 2019) or towards texture rather than shape (Geirhos et al., 2018), are problems for ImageNet-trained classifiers. Indeed, the randomly-selected ImageNet images in Figure 1 suggest that the AFLITE algorithm learns to identify subsets of the data that are particularly challenging.
179
+
180
+ # 4 RELATED WORK
181
+
182
+ Our proposed framework for artifact reduction is related to the adversarial filtering (AF) algorithm in Zellers et al. (2018), yet distinct in two key ways: our approach is (i) much more broadly applicable (by not requiring over generation of data instances), and (ii) considerably more lightweight (by not requiring re-training a model at each iteration of AF). Variants of this AF approach have recently been used to create other datasets such as HellaSwag (Zellers et al., 2019) and ANLI (Bhagavatula et al., 2019) by iteratively perturbing dataset instances until a target model cannot fit the resulting dataset. While effective, these approaches run into three main pitfalls. First, dataset curators need to explicitly devise a strategy of collecting or generating perturbations of a given instance. Second, the approach runs the risk of distributional bias where a discriminator can learn to distinguish between machine generated instances and human-generated ones. Finally it requires re-training a model at each iteration, which is computationally expensive especially when using a large model such as BERT (Devlin et al., 2019) as the adversary. In contrast, AFLITE focuses on addressing dataset biases from existing datasets instead of adversarially perturbing instances. AFLITE was earlier proposed by Sakaguchi et al. (2019) to create the Winogrande dataset. This paper presents more thorough experiments, theoretical justification and results from generalizing the proposed approach to multiple popular NLP and Vision datasets.
183
+
184
+ AFLITE is also inspired by Gururangan et al. (2018), who study lexical biased prevalent in the SNLI dataset (Bowman et al., 2015) and use point-wise mutual information (PMI) between a word and an inference class to determine the words that are highly indicative of the target label. Instead of lexical features, we adopt a deeper representation of the instances using their pre-computed dense feature representations. We use an ensemble of linear classifiers trained on random subsets of the data to determine whether the dense feature representations are highly indicative of the target label. If so, we discard the corresponding instances and proceed iteratively.
185
+
186
+ Li & Vasconcelos (2019) recently proposed REPAIR, a method to remove representation bias by dataset resampling. While resampling is a common technique for balancing datasets, the motivation in REPAIR is to learn a probability distribution over the dataset that favors instances that are hard for a given representation. This approach targets how to train better, less-biased models as opposed to creating datasets with fewer artifacts. In addition, the implementation of REPAIR relies on intraining classification loss as opposed to out-of-sample generalization accuracy. RESOUND (Li et al., 2018) is another method that quantifies the representation biases of datasets. It uses the representation biases to assemble a new K-class dataset with smaller biases by sampling an existing C-class dataset $( C > K )$ ).
187
+
188
+ Arjovsky et al. (2019) argue that unstable, spurious correlations in the data would generalize poorly to novel test environments. Thus, they propose Invariant Risk Minimization as an objective that promotes learning representations of the data which are stable across environments. Instead of learning optimal classifiers, our aim is to remove instances that exhibit artifacts in a dataset.
189
+
190
+ # 5 CONCLUSION
191
+
192
+ We presented AFLITE – a novel iterative greedy algorithm that adversarially filters out data points to arrive at a reduced dataset with more realistic problem distributions and considerably fewer spurious biases. We apply AFLITE to four widely-used datasets, including SNLI and ImageNet, where reported performance is extremely high – and show that state-of-the-art performance on the resulting filtered dataset drops by 30 points for SNLI and drops from $8 4 . 4 \%$ to $2 4 . 5 \%$ Top-1 accuracy for ImageNet. In extensive analysis we show that AFLITE is effective on real as well as synthetic datasets. We hope that dataset creators will employ AFLITE to identify unobservable artifacts before releasing new challenge datasets for the research community in order to have a more reliable estimate of model performance on future AI benchmarks.
193
+
194
+ # REFERENCES
195
+
196
+ Michael A Alcorn, Qi Li, Zhitao Gong, Chengfei Wang, Long Mai, Wei-Shinn Ku, and Anh Nguyen. Strike (with) a pose: Neural networks are easily fooled by strange poses of familiar objects. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4845– 4854, 2019.
197
+
198
+ Mart´ın Arjovsky, Leon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. ´ ArXiv, abs/1907.02893, 2019.
199
+
200
+ Matej Balog, Nilesh Tripuraneni, Zoubin Ghahramani, and Adrian Weller. Lost relatives of the gumbel trick. In ICML, 2017.
201
+
202
+ Chandra Bhagavatula, Ronan Le Bras, Chaitanya Malaviya, Keisuke Sakaguchi, Ari Holtzman, Hannah Rashkin, Doug Downey, Scott Wen tau Yih, and Yejin Choi. Abductive commonsense reasoning. ArXiv, abs/1908.05739, 2019.
203
+
204
+ Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In EMNLP, 2015.
205
+
206
+ Qian Chen, Xiao-Dan Zhu, Zhen-Hua Ling, Si Wei, Hui Jiang, and Diana Inkpen. Enhanced lstm for natural language inference. In ACL, 2016.
207
+
208
+ Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation strategies from data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 113–123, 2019.
209
+
210
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
211
+
212
+ Kevin Eykholt, Ivan Evtimov, Earlence Fernandes, Bo Li, Amir Rahmati, Chaowei Xiao, Atul Prakash, Tadayoshi Kohno, and Dawn Xiaodong Song. Robust physical-world attacks on deep learning models. In CVPR, 2018.
213
+
214
+ David F Fouhey, Wei-cheng Kuo, Alexei A Efros, and Jitendra Malik. From lifestyle vlogs to everyday interactions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4991–5000, 2018.
215
+
216
+ Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. ICLR, 2018.
217
+
218
+ Mor Geva, Yoav Goldberg, and Jonathan Berant. Are we modeling the task or the annotator? An investigation of annotator bias in natural language understanding datasets. In EMNLP, 2019.
219
+
220
+ Max Glockner, Vered Shwartz, and Yoav Goldberg. Breaking NLI systems with sentences that require simple lexical inferences. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-2103. URL https: //www.aclweb.org/anthology/P18-2103.
221
+
222
+ Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6904–6913, 2017.
223
+
224
+ Emil Julius Gumbel and Julius Lieblein. Statistical theory of extreme values and some practical applications: A series of lectures, volume 33. US Government Printing Office Washington, 1954.
225
+
226
+ Suchin Gururangan, Swabha Swayamdipta, Omer Levy, Roy Schwartz, Samuel Bowman, and Noah A. Smith. Annotation artifacts in natural language inference data. In NAACL-HLT, pp. 107–112, New Orleans, Louisiana, June 2018.
227
+
228
+ 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.
229
+
230
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In ICLR, 2016.
231
+
232
+ Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. In EMNLP, 2017.
233
+
234
+ Carolyn Kim, Ashish Sabharwal, and Stefano Ermon. Exact sampling with integer linear programs and random perturbations. In AAAI, 2016.
235
+
236
+ Wouter Kool, Herke van Hoof, and Max Welling. Stochastic beams and where to find them: The gumbel-top-k trick for sampling sequences without replacement. In ICML, 2019.
237
+
238
+ Yi Ci Li and Nuno Vasconcelos. REPAIR: Removing representation bias by dataset resampling. In CVPR, 2019.
239
+
240
+ Yingwei Li, Yi Li, and Nuno Vasconcelos. RESOUND: Towards action recognition without representation bias. In ECCV, pp. 513–528, 2018.
241
+
242
+ Nelson F. Liu, Roy Schwartz, and Noah A. Smith. Inoculation by fine-tuning: A method for analyzing challenge datasets. 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), Minneapolis, Minnesota, June 2019a. Association for Computational Linguistics. doi: 10.18653/v1/N19-1225. URL https://www.aclweb.org/anthology/ N19-1225.
243
+
244
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar S. Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke S. Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized BERT pretraining approach. ArXiv, abs/1907.11692, 2019b.
245
+
246
+ Chris J. Maddison, Daniel Tarlow, and Tom Minka. A\* sampling. In NIPS, 2014.
247
+
248
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In ICLR, 2016.
249
+
250
+ Tom McCoy, Ellie Pavlick, and Tal Linzen. Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 2019. doi: 10.18653/v1/P19-1334. URL https://www.aclweb.org/anthology/P19-1334.
251
+
252
+ Aakanksha Naik, Abhilasha Ravichander, Norman Sadeh, Carolyn Rose, and Graham Neubig. Stress test evaluation for natural language inference. In Proceedings of the 27th International Conference on Computational Linguistics. Association for Computational Linguistics, 2018. URL https://www.aclweb.org/anthology/C18-1198.
253
+
254
+ Yixin Nie, Adina Williams, Emily Dinan, Mohit Bansal, Jason Weston, and Douwe Kiela. Adversarial NLI: A new benchmark for natural language understanding. 2019.
255
+
256
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
257
+
258
+ Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke S. Zettlemoyer. Deep contextualized word representations. In NAACL, 2018.
259
+
260
+ Adam Poliak, Jason Naradowsky, Aparajita Haldar, Rachel Rudinger, and Benjamin Van Durme. Hypothesis only baselines in natural language inference. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pp. 180–191, New Orleans, Louisiana, June 2018. Association for Computational Linguistics.
261
+
262
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. In EMNLP, 2016.
263
+
264
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
265
+
266
+ Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. arXiv preprint arXiv:1907.10641, 2019.
267
+
268
+ Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pp. 6105–6114, 2019.
269
+
270
+ Antonio Torralba and Alexei A. Efros. Unbiased look at dataset bias. CVPR, pp. 1521–1528, 2011.
271
+
272
+ Masatoshi Tsuchiya. Performance impact caused by hidden bias of training data for recognizing textual entailment. In Proceedings of the 11th Language Resources and Evaluation Conference, Miyazaki, Japan, May 2018. European Language Resource Association.
273
+
274
+ Tim Vieira. Gumbel-max trick and weighted reservoir sampling, 2014. Blog post. https://timvieira:github:io/blog/post/2014/08/01/gumbel-max-trick-and-weighted-reservoirsampling.
275
+
276
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2018.
277
+
278
+ Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL-HLT, pp. 1112–1122, 2018.
279
+
280
+ Rowan Zellers, Yonatan Bisk, Roy Schwartz, and Yejin Choi. SWAG: A large-scale adversarial dataset for grounded commonsense inference. In EMNLP, 2018.
281
+
282
+ Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence? In ACL, 2019.
md/train/HJMHpjC9Ym/HJMHpjC9Ym.md ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BIG-LITTLE NET: AN EFFICIENT MULTI-SCALE FEATURE REPRESENTATION FOR VISUAL AND SPEECH RECOGNITION
2
+
3
+ Chun-Fu (Richard) Chen, Quanfu Fan, Neil Mallinar, Tom Sercu, Rogerio Feris IBM T.J. Watson Research Center, Yorktown Heights, NY 10598 {chenrich, qfan, neil.r.mallinar, tom.sercu1, rsferis}@us.ibm.com
4
+
5
+ # ABSTRACT
6
+
7
+ In this paper, we propose a novel Convolutional Neural Network (CNN) architecture for learning multi-scale feature representations with good tradeoffs between speed and accuracy. This is achieved by using a multi-branch network, which has different computational complexity at different branches with different resolutions. Through frequent merging of features from branches at distinct scales, our model obtains multi-scale features while using less computation. The proposed approach demonstrates improvement of model efficiency and performance on both object recognition and speech recognition tasks, using popular architectures including ResNet, ResNeXt and SEResNeXt. For object recognition, our approach reduces computation by $1 / 3$ while improving accuracy significantly over $1 \%$ point than the baselines, and the computational savings can be higher up to $1 / 2$ without compromising the accuracy. Our model also surpasses state-of-the-art CNN acceleration approaches by a large margin in terms of accuracy and FLOPs. On the task of speech recognition, our proposed multi-scale CNNs save $30 \%$ FLOPs with slightly better word error rates, showing good generalization across domains.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep Convolutional Neural Network (CNN) models have achieved substantial performance gains in many computer vision and speech recognition tasks (He et al., 2016; 2017; Vinyals et al., 2017; Sercu & Goel, 2016). However, the accuracy obtained by these models usually grows proportionally with their complexity and computational cost. This poses an issue for deploying these models in applications that require real-time inferencing and low-memory footprint, such as self-driving vehicles, human-machine interaction on mobile devices, and robotics.
12
+
13
+ Motivated by these applications, many methods have been proposed for model compression and acceleration, including techniques such as pruning (Dong et al., 2017; Li et al., 2017; Han et al., 2015), quantization (Hubara et al., 2016; Li & Liu, 2016), and low-rank factorization (Wen et al., 2017; Ioannou et al., 2015; Zhang et al., 2016). Most of these methods have been applied to single-scale inputs, without considering multi-resolution processing. More recently, another line of work applies dynamic routing to allocate different workloads in the networks according to image complexity (Wu et al., 2018; Wang et al., 2018; Figurnov et al., 2017; Veit & Belongie, 2018). Multi-scale feature representations have proven successful for many vision and speech recognition tasks compared to single-scale methods (Nah et al., 2017; Chen et al., 2017a; Tóth, 2017; Farabet et al., 2013); however, the computational complexity has not been addressed much in multi-scale networks.
14
+
15
+ The computational cost of a CNN model has much to do with the input image size. A model, if running at half of the image size, can gain a remarkable computational saving of $7 5 \%$ . Based on this fact, we propose an efficient network architecture by combining image information at different scales through a multi-branch network. As shown in Fig. 1, our key idea is to use a high-complexity branch (accurate but costly) for low-scale feature representation and low-complexity branch (efficient but less accurate) for high-scale feature representation. The two types of features are frequently merged together to complement and enrich each other, leading to a stronger feature representation than either of them individually. We refer to the deeper branch operating at low image resolution as Big-Branch and the shallower one as Little-Branch to reflect their differences in computation. The new network architecture is thus called Big-Little Net or bL-Net for short in this paper.
16
+
17
+ ![](images/0574022df5e50adb5747f9dd6217fb99fafb4314cbc906cbae2227b65290d2a4.jpg)
18
+ Figure 1: Our proposed Big-Little Net (bL-Net) for efficient multi-scale feature representations. (a) The bL-Net stacks several Big-Little Modules. A bL-module include $K$ branches $K = 2$ in this illustration) where the $k ^ { t h }$ branch represents an image scale of $1 / 2 ^ { k }$ . ‘M’ here denotes a merging operation. (b) Our implementation of the Big-Little Module includes two branches. The Big-Branch has the same structure as the baseline model while the Little-Branch reduces the convolutional layers and feature maps by $\alpha$ and $\beta$ , respectively. Larger values of $\alpha$ and $\beta$ lead to lower computational complexity in Big-Little Net.
19
+
20
+ While being structurally simple, our approach is quite effective. We demonstrate later that when bL-Net is integrated into state-of-the-art CNNs such as ResNet, ResNeXt and SEResNeXt, it yields $2 \times$ computational savings over the baselines without losing any accuracy. It also outperforms many other recently developed approaches based on more sophisticated architectures at the same FLOP count. One work that relates to ours is the Inception model (Szegedy et al., 2016a; 2017), which also leverages parallel pathways in a network building block for efficiency. However, the efficiency of these models relies on substantial use of $1 \times 1$ and separable filters (i.e. $1 \times 3$ and $3 \times 1$ ). In contrast, bL-Net is general and applicable to many architectures including Inception.
21
+
22
+ The main contributions of our paper are summarized as follows:
23
+
24
+ • We propose an efficient and effective multi-scale CNN architecture for object and speech recognition.
25
+ • We demonstrate that our approach reduces computation by $1 / 3$ in models such as ResNet and ResNeXt while improving accuracy over $1 \%$ point than the baselines, and the computational savings can be higher up to $1 / 2$ without losing any accuracy; these results outperform state-of-the-art networks that focus on CNN acceleration by a large margin at the same FLOPs.
26
+ We validate the proposed method on a speech recognition task, where we also achieve better word error rates while reducing the number of FLOPs by $30 \%$ .
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Model Compression and Acceleration. Network pruning (Dong et al., 2017; Li et al., 2017) and quantization (Hubara et al., 2016; Li & Liu, 2016) are popular techniques to remove model redundancy and save computational cost. Another thread of work consists of training a sparse model directly, such as IGCv2 (Xie et al., 2018) and SCConv (Fan et al., 2017). Efficient network architectures like MobileNetV2 (Sandler et al., 2018) and ShuffleNetV2 (Ma et al., 2018) have also been explored for training compact deep networks. Other methods include knowledge distillation (Hinton et al., 2015), compression with structured matrices (Cheng et al., 2015; Sindhwani et al., 2015), and hashing (Chen et al., 2015). Dynamic routing (Wu et al., 2018; Wang et al., 2018; Figurnov et al., 2017; Veit & Belongie, 2018) has also been explored in residual networks to improve efficiency. These methods operate with single-resolution inputs, while our approach processes multi-resolution data. It could be used in tandem with these methods to further improve efficiency.
31
+
32
+ Multi-Resolution Feature Representations. The notion of multi-scale feature representation can be dated back to image pyramids (Adelson et al., 1984) and scale-space theory (Lindeberg & ter Haar Romeny, 1994). More recently, several methods have proposed multi-scale CNN-based architectures for object detection and recognition. MSCNN (Cai et al., 2016), DAG-CNN (Yang & Ramanan, 2015) and FPN (Lin et al., 2017) use features at different layers to form multi-scale features. Hourglass networks (Newell et al., 2016) use a hierarchical multi-resolution model for human pose estimation. However, this approach induces a heavy workload as the complexity of each sub-network in their model is equal. Nah et al. (Nah et al., 2017) and Eigen et al. (Eigen & Fergus, 2015) combine the features from multiple networks working on different resolutions to generate multi-scale features. The overall computational cost grows along with the number of scales, leading to inefficient models. In contrast to existing methods, our approach uses different network capacities for different scales, and yields more powerful multi-scale features by fusing them at multiple levels of the network model.
33
+
34
+ Closely related to our work, approaches such as (Huang et al., 2018; Saxena & Verbeek, 2016), apply multiple branches at multi-scales while aiming at reducing computational complexity. In contrast to our work, their computational gain mostly comes from early exit depending on the input image. Our approach speeds up a network constantly regardless of the input image.
35
+
36
+ # 3 OUR APPROACH
37
+
38
+ We develop a simple, easy-to-implement, yet very efficient and effective network architecture. It learns multi-scale feature representations by fusing multiple branches with different image scales and computational complexity. As shown in Fig. 1, we design a multi-scale feature module with the following principles: (I) each branch corresponds to a single unique image scale (or resolution); (II) the computational cost of a branch is inversely proportional to the scale. Note that the principle (II) implies that we use high-complexity networks at lower resolutions and low-complexity networks at higher resolutions for the sake of efficiency.
39
+
40
+ # 3.1 BIG-LITTLE NET
41
+
42
+ Big-Little Net is a sequence of Big-Little Modules, each one taking input $\mathbf { x } _ { i }$ and producing output $\mathbf { x } _ { i + 1 }$ . Within a Big-Little Module, assume we have $K$ branches working on $K$ scales $[ 1 , \bar { 1 } / 2 , 1 / 4 , . . . , 1 / 2 ^ { K - 1 } ]$ . We denote a feature map $\mathbf { x } _ { i }$ at scale $1 / 2 ^ { k }$ as $\mathbf { x } _ { i } ^ { k }$ , indicating the spatial size of $\mathbf { x } _ { i }$ downsampled by $2 ^ { k }$ with respect to the original input dimension. We use a weighted sum to combine all branches into a feature representation at scale $1 / 2 ^ { k }$ . Mathematically, the module’s output $\mathbf x _ { i + 1 }$ can be expressed by
43
+
44
+ $$
45
+ \mathbf { x } _ { i + 1 } = F \left( \sum _ { k = 0 } ^ { K - 1 } c ^ { k } S ^ { k } \left( f _ { k } \left( \mathbf { x } _ { i } ^ { k } \right) \right) \right) ,
46
+ $$
47
+
48
+ where $f _ { k } ( \cdot )$ denotes a sequence of convolutional layers. Typically for higher $k$ , $f _ { k }$ will have more convolutional layers having more feature maps. $S ^ { k } ( \cdot )$ is the operation that matches the output size of the branches, either: (1) increasing the number feature maps with a $1 \times 1$ convolution, (2) upsampling to match the output size of the $k = 0$ branch, or both. $c ^ { k }$ indicates the weighting coefficients of each scale in the merge while $F ( \cdot )$ is an optional final fusion layer like a convolutional layer.
49
+
50
+ Note that branches are merged at the end of every Big-Little Module and merging the branch outputs happens at the highest resolution and highest number of feature maps between the branches. Maintaining these large intermediate states avoids information loss. A crucial aspect of this design is that through consecutive merging and downsampling, the expensive branches operating at low resolution still have access to the high resolution information, processed by the cheaper branches in the previous module.
51
+
52
+ While our design is suitable for any number of networks, in this work we primarily focus on the case of two networks, i.e., $K = 2$ . We also experimented with $K > 2$ in object and speech recognition; however, the $K = 2$ case provided the best balance between accuracy and computation (See Appendix A.4 and Section 4.2 for details). Following the principles above, we propose a multinetwork architecture that integrates two branches for multi-scale feature representation. Figure 1 (b) shows an example Big-Little Net architecture.
53
+
54
+ The module includes two branches, each of which represents a separate network block from a deep model (accurate but costly) and a less deep counterpart (efficient but less accurate). The two branches are fused at the end through linear combination with unit weights (i.e., $c ^ { 0 } = c ^ { 1 } = 1 . 0$ ). Before fusion, the low resolution feature maps are upsampled using bilinear interpolation to spatially match the higher-resolution counterparts $\bar { ( = { S ^ { 1 } ( \cdot ) } ) }$ . Similarly, the high resolution feature map has an additional $1 \times 1$ convolutional layer to increase the number of output channels $( = S ^ { 0 } ( \cdot ) )$ . Furthermore, since our design is based on ResNet, we add a residual block to further fuse the combined features (i.e., $F ( \cdot )$ is a residual block). For convenience, we refer to these two branches as Big-Branch (more layers and channels at low resolution) and Little-Branch (fewer layers and channels at high resolution), respectively. We also denote the module as Big-Little Module and the entire architecture as Big-Little Net or bL-Net.
55
+
56
+ To control the complexity of bL-Net, we introduce two parameters to specify the complexity of the Little-Branch with respect to the Big-Branch. The Big-Branch typically follows the structure of the original network, but the Little-Branch needs to be heavily slimmed and shortened to reduce computation as it operates on high resolution. Here we use two parameters $\alpha$ and $\beta$ to control the width and depth of the Little-Branch, respectively. As shown in Fig. 1 (b), $\alpha$ specifies the reduction factor of the number of channels in the convolutional layers of Little-Branch with respect to that of the original network while $\beta$ is the reduction factor of the number of convolutional layers. Larger values of $\alpha$ and $\beta$ lead to lower complexity in bL-Net. As demonstrated later, with an appropriate choice of $\alpha$ and $\beta$ (See Table 1 and Table 3), the cost of the Little-Branch can be $1 / 6$ of the $b L$ -Net and $1 / 1 2$ of the original network while still providing sufficient complementary information to the Big-Branch.
57
+
58
+ # 3.2 NETWORK MERGING
59
+
60
+ We consider two options for merging the outputs of the branches. The first option is a linear combination, which joins features from two networks by addition (Newell et al., 2016). The alternative concatenates the outputs of the two networks along the channel dimension, and if needed, a $1 \times 1$ convolution can be subsequently applied to reduce the number of feature maps (Szegedy et al., 2015). Both merging approaches have their pros and cons. With linear combination, the branches can easily compensate each other, meaning each branch can activate output neurons not activated by the other. However, additional cost is added as both the size of feature maps and the number of channels in the two branches need to be adjusted to be the same before addition. On the other hand, merging by concatenation only needs to spatially align the feature maps. On the other hand, concatenation only needs to align the feature map size, however requires a $1 \times 1$ convolution reducing the number of channels after concatenation, which is a more expensive operation than the pointwise addition.
61
+
62
+ While linear combination provides an immediate exchange of the activations of both branches, concatenation relies on the following layers for this exchange. This delay in exchange could possibly be problematic if the information from each branch is destructively altered before merging. For example, a nonlinearity such as ReLU would discard all activations less than zero, effectively ignoring negative features in both branches before merging. Since linear combination does not cause too much overhead and provides better accuracy, we chose linear combination as our merging approach. In Appendix A.4, we empirically show that the linear combination approach performs better than concatenation in object recognition.
63
+
64
+ # 4 EXPERIMENTAL RESULTS
65
+
66
+ We conducted extensive experiments, as discussed below, to validate the effectiveness of our proposed bL-Net on object and speech recognition tasks. bL-Net can be easily integrated with many modern CNNs and here we chose ResNet (He et al., 2016) as the primary architecture to evaluate our approach. For simplicity, from now on, we denote by bL-M the bL-Net using a backbone network $M$ For example, bL-ResNet-50 is the Big-Little net based on ResNet-50.
67
+
68
+ # 4.1 OBJECT RECOGNITION
69
+
70
+ We used the ImageNet dataset (Russakovsky et al., 2015) for all the experiments below on object recognition. This dataset is a common benchmark for object recognition, which contains 1.28 million training images and $5 0 \mathrm { k }$ validation images with labels from 1000 categories. The details of our experimental setup and the network structures for bL-ResNet-50, 101 and 152 can be found in Appendix A.1.
71
+
72
+ Table 1: Complexity study of the Little-Branch $\scriptstyle { \alpha }$ and $\beta$ ) for bL-ResNet-50.
73
+
74
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>bL-ResNet-50 (α = 2, β = 2)</td><td>22.72%</td><td>2.91 (1.41×)</td><td>26.97</td></tr><tr><td>bL-ResNet-50(α = 2, β= 4)</td><td>22.69%</td><td>2.85 (1.44×)</td><td>26.69</td></tr><tr><td>bL-ResNet-50 (α = 4, β = 2)</td><td>23.20%</td><td>2.49 (1.64×)</td><td>26.31</td></tr><tr><td>bL-ResNet-50 (α= 4, β= 4)</td><td>23.15%</td><td>2.48 (1.65×)</td><td>26.24</td></tr></table>
75
+
76
+ Table 2: Performance comparison for bL-ResNet, bL-ResNeXt and bL-SEResNeXt.
77
+
78
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td><td>Speed (ms/batch)t</td></tr><tr><td>ResNet-101</td><td>21.95%</td><td>7.80</td><td>44.54</td><td>186</td></tr><tr><td>bL-ResNet-101 (α= 2,β= 4)</td><td>21.80%</td><td>3.89 (2.01×)</td><td>41.85</td><td>140 (1.33×)</td></tr><tr><td>bL-ResNet-101@256(α = 2,β= 4)</td><td>21.04%</td><td>5.08 (1.54×)</td><td>41.85</td><td>162 (1.15×)</td></tr><tr><td>ResNet-152</td><td>21.51%</td><td>11.51</td><td>60.19</td><td>266</td></tr><tr><td>bL-ResNet-152(α = 2,β =4)</td><td>21.16%</td><td>5.04 (2.28×)</td><td>57.36</td><td>178 (1.49×)</td></tr><tr><td>bL-ResNet-152@256 (α= 2, β=4)</td><td>20.34%</td><td>6.58 (1.75x)</td><td>57.36</td><td>205 (1.30×)</td></tr><tr><td>ResNeXt-50 (32×4d)</td><td>22.20%</td><td>4.23</td><td>25.03</td><td>157</td></tr><tr><td>bL-ResNeXt-50 (32×4d) (α =2,β= 4)</td><td>21.60%</td><td>3.03 (1.40×)</td><td>26.19</td><td>125 (1.26×)</td></tr><tr><td>bL-ResNeXt-50@256(α = 2, β= 4)</td><td>20.96%</td><td>3.95 (1.08×)</td><td>26.19</td><td>153 (1.03×)</td></tr><tr><td>ResNeXt-101 (32×4d)</td><td>21.20%</td><td>7.97</td><td>44.17</td><td>269</td></tr><tr><td>bL-ResNeXt-101 (32×4d) (α =2,β =4)</td><td>21.08%</td><td>4.08 (1.95×)</td><td>41.51</td><td>169 (1.59×)</td></tr><tr><td>bL-ResNeXt-101@256(α = 2, β=4)</td><td>20.48%</td><td>5.33 (1.50x)</td><td>41.51</td><td>203 (1.33×)</td></tr><tr><td>ResNeXt-101(64×4d)</td><td>20.73%</td><td>15.46</td><td>83.46</td><td>485</td></tr><tr><td>bL-ResNeXt-101 (64×4d) (α = 2,β =4)</td><td>20.48%</td><td>7.14 (2.17×)</td><td>77.36</td><td>263 (1.98×)</td></tr><tr><td>bL-ResNeXt-101@256 (64×4d) (α = 2, β = 4)</td><td>19.65%</td><td>9.32 (1.66x)</td><td>77.36</td><td>318 (1.53×)</td></tr><tr><td>SEResNeXt-50 (32×4d)</td><td>21.78%</td><td>4.23</td><td>27.56</td><td>216</td></tr><tr><td>bL-SEResNeXt-50 (32×4d) (α = 2,β=4) bL-SEResNeXt-50@256 (32×4d) (α= 2, β = 4)</td><td>21.44%</td><td>3.03 (1.40×)</td><td>28.77</td><td>163 (1.33×)</td></tr><tr><td></td><td>20.74%</td><td>3.95 (1.08×)</td><td>28.77</td><td>192 (1.03×)</td></tr><tr><td>SEResNeXt-101 (32×4d)</td><td>21.00%</td><td>7.97</td><td>48.96</td><td>376</td></tr><tr><td>bL-SEResNeXt-101 (32×4d) (α = 2, β = 4)</td><td>20.87%</td><td>4.08 (1.95×)</td><td>45.88</td><td>235 (1.60×)</td></tr><tr><td>bL-SEResNeXt-101@256 (32×4d) (α = 2,β= 4)</td><td>19.87%</td><td>5.33 (1.50×)</td><td>45.88</td><td>270 (1.39×)</td></tr></table>
79
+
80
+ †: speed is benchmarked on NVIDIA Tesla K80 with batch size 16. Except for $@ 2 5 6$ , speed is evaluated under image size $2 2 4 \times 2 2 4$ . We trained all the ResNet, ResNeXt and SEResNeXt models by ourselves, so the accuracy is slightly different from the papers.
81
+
82
+ ResNet as the backbone network. We experimented with different complexity control factors ( $\overset { \cdot } { \alpha }$ and $\beta$ ) to better understand their effects on performance. $\alpha$ and $\beta$ control both the structural and computational complexity of the Little-Branch, which determines the overall computational cost of bL-Net.
83
+
84
+ As can be seen in Table 1, all the models based on ResNet-50 yield better performance over the baseline with less computation, clearly demonstrating the advantage of combining low- and highcomplexity networks to balance between speed and accuracy. In addition, the small performance gaps between these models suggest that a computationally light Little-Branch ( $\textless 1 5 \%$ of the entire network) can compensate well for the low resolution representation by providing finer image details. We consider $\alpha = 2$ and $\beta = 4$ as the default setting for the following experiments. Furthermore, there are more ablation studies on the design of bL-Net in the Appendix A.4.
85
+
86
+ We further evaluated our approach on deeper models by using ResNet-101 and ResNet-152 as the backbone networks. We see from Table 2 that bL-ResNet-101 and bL-ResNet-152 behave similarly to bL-ResNet-50. As expected, both of them produce better results against the baseline models and achieving notable computational gains. Interestingly, our approach computationally favors deeper models, as evidenced by the fact that more speedups are observed on bL-ResNet-152 $( 2 . 3 \times )$ than on bL-ResNet-101 $( 2 . 0 \times )$ and bL-ResNet-50 $( 1 . 4 \times )$ . This is mainly because the Little Branch operating on low resolution spends less computation in a deeper model.
87
+
88
+ ResNeXt and SEResNeXt as the backbone network. We extended bL-Net to ResNeXt and SEResNeXt, two of the more accurate yet compact network architectures. We also experimented with (SE)ResNeXt-50 and (SE)ResNeXt-101 using the $3 2 \times 4 \mathrm { d }$ and $6 4 \times 4 \mathrm { d }$ setting (Xie et al., 2017; Hu et al., 2018). In our case, the Big-Branch follows the same setting of (SE)ResNeXt; however, we changed the cardinality of the Little-Branch to align with the input channels of a group convolution in the Big-Branch. All the results are shown in Table 2.
89
+
90
+ ![](images/a6d6b75cec7913fe409b728001e78bc9467fe9e9c10ca41f278de9c663887d7f.jpg)
91
+ Figure 2: Comparison with the ResNet and ResNeXt related works.
92
+
93
+ bL-ResNeXt-50 achieves a moderate speedup $( 1 . 4 0 \times )$ and provides an additional gain of $0 . 6 \%$ i n accuracy. However, bL-ResNeXt-101 $( 3 2 \times 4 \mathrm { d } )$ gains a much more substantial speedup of $2 \times$ and seeing $0 . 1 2 \%$ improvement in accuracy. The same trend can be seen on bL-ResNeXt-101 $( 6 4 \times 4 \mathrm { d } )$ . On the other hand, our bL-SEResNeXts also produce better performance while reducing more FLOPs than SEResNeXts. bL-SEResNeXt-101 achieves $2 \times$ speedups and improves accuracy by $0 . 1 3 \%$ .
94
+
95
+ Since our bL-Net saves more budget in computation, we can evaluate a model at a larger image scale for better performance, e.g., $2 5 6 \times 2 5 6$ . As illustrated in Table 2, our models evaluated at $2 5 6 \times 2 5 6$ is consistently better than their corresponding baselines while still using fewer FLOPs. The advantage becomes more pronounced with deeper models. For instance, with $40 \%$ reduction on FLOPs, bL-ResNeXt-101 $\textcircled { \scriptsize { a } } 2 5 6$ $( 6 4 \times 4 \mathrm { d } )$ boosts the top-1 performance by $1 . 1 \%$ , which is quite impressive given that ResNeXt-101 $( 6 4 \times 4 \mathrm { d } )$ is a very competitive baseline. Table 2 also shows the running times of bL-Net on GPU, which indicate the practical speedups of these models are consistent with the theoretical FLOP reductions reported in Table 2.
96
+
97
+ # 4.1.1 COMPARISON WITH RELATED WORK
98
+
99
+ We first compared our method with the approaches that aim to accelerate ResNets or ResNeXts using techniques such as network pruning and adaptive computations. The results are shown in Figure 2.
100
+
101
+ Our bL-Net significantly outperforms all related works regarding FLOPs reduction and accuracy. Our bL-ResNet-101 is $\sim 5 \%$ better than the network pruning approaches such as PFEC (Li et al., 2017) and LCCL (Dong et al., 2017), but still using less computation. When compared to SACT and ACT (Figurnov et al., 2017), our bL-ResNet-101 improves the accuracy by $5 \%$ while using the same number of FLOPs. On the other hand, our bL-ResNet-101 outperforms some of the most recent works including BlockDrop (Wu et al., 2018), SkipNet (Wang et al., 2018) and ConvNet-AIG (Veit & Belongie, 2018) by $3 . 7 \%$ , $2 . 2 \%$ , $1 . 2 \%$ top-1 accuracy at the same FLOPs, respectively. This clearly demonstrates the advantages of a simple fusion of two branches at different scales over the more sophisticated dynamic routing techniques developed in these approaches. In comparison to SPPoint (Kuen et al., 2018) under the same FLOPs, our bL-ResNet-101 surpasses it by $2 . 2 \%$ in accuracy.
102
+
103
+ We also compared bL-Net with the variants of ResNets, like ResAttNe(X)t (Wang et al., 2017), SEResNeXt (Hu et al., 2018) and CBAM (Woo et al., 2018). These models introduces attention mechanisms to enhance feature representations in either the channel or the spatial domain. From Figure 2, it can be seen that our bL-Net outperforms all of them in both FLOPs and accuracy. Our bL-Net achieves better performance than ResAttNeXt while saving $1 . 5 \times \mathrm { F L O P s }$ . It also surpasses ${ \sim } 1 \%$ point with similar FLOPs or the similar accuracy with ${ \sim } 1 . 7 \times$ FLOPs reduction for both SEResNeXt and CBAM. It’s worth noting that bL-Net can be potentially integrated with these models to further improve their accuracy and efficiency.
104
+
105
+ Finally, we ran a benchmark test on bL-ResNeXt $@ 2 5 6$ under the PyTorch framework with a batch size of 16 on a K80 GPU, and compared against various models that are publicly available. These models include Inception-V3 (Szegedy et al., 2016a), Inception-V4 (Szegedy et al., 2017), Inception-ResNetV2 (Szegedy et al., 2017), PolyNet (Zhang et al., 2017), NASNet (Zoph et al., 2018), PNASNet (Liu et al., 2018), DualPathNet (Chen et al., 2017b) and DenseNet (Huang et al., 2017b). Among them, NASNet currently achieves the best accuracy on ImageNet.
106
+
107
+ ![](images/d00d2c0fac8445379485651a3bc5072b0003cb35fce602124c3b6ac1929e4ff2.jpg)
108
+ Figure 3: Comparison performance among other types of networks. (a) FLOPs. (b) GPU Speed.
109
+
110
+ From Fig. 3, we can see that overall, our bL-ResNeXt gains a better tradeoff between efficiency and accuracy. Compared to the Inception networks, bL-Net are better in both FLOPs and GPU running time. The bL-ResNeXt is also $2 \%$ point better than DenseNet at the same running speed, and $2 \times$ faster than DualPathNet at the same performance.
111
+
112
+ NASNet achieves lower FLOPs and higher accuracy than bL-Net; however, the networks result in slow GPU running time since their operations are divided into small pieces (i.e. a fragmented structure), which are not friendly for parallel computations. On the other hand, bL-Net, although requiring more FLOPs, can still enjoy the computation optimization brought by modern GPU cards. Moreover, compared with the lowest FLOP configuration of NASNet, our bL-ResNeXt is $0 . 5 \%$ point better while running $1 . 5 \times$ faster.
113
+
114
+ To further validate the generality of bL-Net, we also integrated the bL-Net with the highly efficient network, ShuffleNetV2 (Ma et al., 2018), and the results can be found in Appendix A.5. We also demonstrate the adaptability of $b L$ -Net on the object detection task (see Appendix A.6).
115
+
116
+ # 4.2 SPEECH RECOGNITION
117
+
118
+ We train ResNet style acoustic models in the hybrid framework on Switchboard $+$ Fisher (2000h) and provide results on Hub5 (Switchboard and Call Home portions). Switchboard is a large dataset with 2000 hours of transcribed speech from 28, 000 speakers, which is actively used as benchmark (Xiong et al., 2016; Saon et al., 2017) akin to ImageNet in the computer vision community. Our ResNet acoustic models are similar to the state of the art models described in (Saon et al., 2017), though slightly simplified (less fully connected layers) and trained with a simpler procedure (no class balancing). We provide results only after Cross-Entropy training and after decoding with a small language model (4M n-grams). Gains from this setting are typically maintained in the standard further pipelines like fine-tuning with sequence training, using more complex language models.
119
+
120
+ Appendix B gives a thorough overview of the architecture of the speech acoustic models. The main difference speech acoustic models have compared to image classification networks, is that striding or pooling only happens along the frequency axis, while along in the time direction we need to output dense predictions per frame (Sercu & Goel, 2016). This means that the branches at different resolutions have a fundamentally different view of the signal as it is propagating through the network; the ratio of resolution in frequency (downsampled in the Big-Branch) vs resolution in time (same between branches) is different. We can think about this as the convolutional kernels having different “aspect ratios” between branches. Therefore we not only expect FLOP reductions in bL-Net, but expect to have increased representational power. In addition, similar to the case in object recognition (Table 2), we could process the speech signal at higher frequency resolution than what is computationally feasible for the baseline ResNets.
121
+
122
+ Table 3 shows the results for the different architectures described in Appendix B. Most results are in line with the observations in the object recognition bL-Net. When comparing the baseline ResNet-22 (line 1) to the best bL-ResNet-22 (line 5), we see not only a reduction in FLOPs, but also a modest gain in Word Error Rate (WER). Comparing lines 2-4, we see that increasing $\beta$ (i.e. shorter little branches at full resolution) causes no WER degradation, while reducing the number of FLOPs. From line 5 we see that, similar to the object recognition ResNet results, decreasing $\alpha$ from 4 to 2 (i.e. keeping more feature maps in the full-resolution little branches) is important for performance, even though this increases the FLOPs again. We can summarize the best setting of $\alpha = 2$ and $\beta = 3$ for the little branches at full resolution: make them shorter but with more feature maps. This is consistent with the image classification results. From line 2 vs. line 6, the concatenation merge mode performs similar to the default additive merging, while increasing the number of FLOPs. Line 7 (compare to line 2) shows an experiment with additional branches on the lower layers (See Appendix B). Although there is some gain in WER, the added parameters and compute on the lower layers may not make this a worthwhile trade-off.
123
+
124
+ Table 3: Speech recognition results. We present results on Hub5 and the CallHome portion of Hub5, while the RT-02 Switchboard set was used for selecting decode epoch and HMM prior settings.
125
+
126
+ <table><tr><td>Model</td><td></td><td>FLOPs (109)</td><td>Params (106)</td><td>WER Avg</td><td>Hub5</td><td>Hub5 CH</td></tr><tr><td>1</td><td>Baseline: ResNet-22</td><td>1.11</td><td>3.02</td><td>14.67%</td><td>11.15%</td><td>18.17%</td></tr><tr><td>2</td><td>bL-ResNet-22 (α = 4,β = 1)</td><td>0.68 (1.63×)</td><td>3.15</td><td>14.72%</td><td>11.24%</td><td>18.18%</td></tr><tr><td>3</td><td>bL-ResNet-22 (α = 4,β = 2)</td><td>0.66 (1.68×)</td><td>3.11</td><td>14.47%</td><td>10.95%</td><td>17.95%</td></tr><tr><td>4</td><td>bL-ResNet-22(α = 4,β= 3)</td><td>0.65 (1.70×)</td><td>3.10</td><td>14.66%</td><td>11.25%</td><td>18.05%</td></tr><tr><td>5</td><td>bL-ResNet-22 (α = 2,β = 3)</td><td>0.77 (1.43×)</td><td>3.07</td><td>14.46%</td><td>11.10%</td><td>17.80%</td></tr><tr><td>6</td><td>bL-ResNet-22 (α = 4,β=1) cat</td><td>0.70 (1.58×)</td><td>3.18</td><td>14.67%</td><td>11.31%</td><td>18.00%</td></tr><tr><td>7</td><td>bL-PYR-ResNet-22 (α = 4, β =1)</td><td>0.98 (1.13×)</td><td>3.32</td><td>14.50%</td><td>11.05%</td><td>17.92%</td></tr></table>
127
+
128
+ # 4.3 DISCUSSION ON bL-Net
129
+
130
+ From the results of both tasks, we observe the following common insights, which enable us to design an efficient multi-scale network with competitive performance: (I) The Little-Branch can be very light-weight, (II) bL-Net performs better when the Little-Branch is wide and shallow (smaller $\alpha$ and larger $\beta$ ), (III) merging is effective when the feature dimension has changed, and (IV) branch merging by addition is more effective than concatenation. (I) is because the Big-Branch can extract essential information, a light Little-Branch is good enough to provide sufficient information the Big-Branch lacks. Regarding (II), wider networks have been shown to perform better than deep networks while using a similar number of parameters. (III) is well-discussed in Appendix A.4. Finally (IV), merging through addition provides better regularization for both branches to learn complementary features to form strong features.
131
+
132
+ # 5 CONCLUSION
133
+
134
+ We proposed an efficient multi-scale feature representation based on integrating multiple networks for object and speech recognition. The Big-Branches gain significant computational reduction by working at low-resolution input but still extract meaningful features while the Little-Branch enriches the features from high-resolution input but with light computation. On object recognition task, we demonstrated that our approach provides approximately $2 \times$ speedup over baselines while improving accuracy, and the result significantly outperforms the state-of-the-art networks by a large margin in terms of accuracy and FLOPs reduction. Furthermore, when using the proposed method on speech recognition task, we gained $0 . 2 \%$ WER and saved $30 \%$ FLOPs at the same time. In pratice, the proposed bL-Net shows that the reduced FLOPs can consistently speed up the running time on GPU. That evidence showed that the proposed bL-Net is an efficient multi-scale feature representation structure for competitive performance with less computation. In this paper, we chose ResNet, ResNeXt and SEResNeXt as our backbone networks but $b L$ -Net can be integrated with other advanced network structures, like DenseNet (Huang et al., 2017b), DualPathNet (Chen et al., 2017b) and NASNet (Zoph et al., 2018) to achieve competitive performance while saving computations. Furthermore, bL-Net can be integrated with those CNN acceleration approaches to make models more compact and efficient.
135
+
136
+ # ACKNOWLEDGMENTS
137
+
138
+ The authors would like to thank Dr. Paul Crumley and Dr. I-Hsin Chung for their help with the hardware infrastructure setup.
139
+
140
+ Quanfu Fan and Rogerio Feris are supported by IARPA via DOI/IBC contract number D17PC00341. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DOI/IBC, or the U.S. Government.
141
+
142
+ # REFERENCES
143
+
144
+ Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
145
+
146
+ Edward H Adelson, Charles H Anderson, James R Bergen, Peter J Burt, and Joan M Ogden. Pyramid methods in image processing. RCA engineer, 29(6):33–41, 1984.
147
+
148
+ Zhaowei Cai, Quanfu Fan, Rogerio S Feris, and Nuno Vasconcelos. A Unified Multi-scale Deep Convolutional Neural Network for Fast Object Detection. In Bastian Leibe, Jiri Matas, Nicu Sebe, and Max Welling (eds.), European Conference on Computer Vision (ECCV), pp. 354–370, 2016.
149
+
150
+ Wenlin Chen, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. Compressing neural networks with the hashing trick. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 2285–2294. JMLR.org, 2015. URL http: //dl.acm.org/citation.cfm?id=3045118.3045361.
151
+
152
+ Yanbei Chen, Xiatian Zhu, and Shaogang Gong. Person Re-Identification by Deep Learning Multi-Scale Representations. In The IEEE International Conference on Computer Vision (ICCV), October 2017a.
153
+
154
+ Yunpeng Chen, Jianan Li, Huaxin Xiao, Xiaojie Jin, Shuicheng Yan, and Jiashi Feng. Dual Path Networks. In Advances in Neural Information Processing Systems 30, pp. 4467–4475. Curran Associates, Inc., 2017b.
155
+
156
+ Y Cheng, F X Yu, R S Feris, S Kumar, A Choudhary, and S F Chang. An Exploration of Parameter Redundancy in Deep Networks with Circulant Projections. In 2015 IEEE International Conference on Computer Vision (ICCV), pp. 2857–2865. IEEE, December 2015.
157
+
158
+ Xuanyi Dong, Junshi Huang, Yi Yang, and Shuicheng Yan. More is less: A more complicated network with less inference complexity. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
159
+
160
+ David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In The IEEE International Conference on Computer Vision (ICCV), December 2015.
161
+
162
+ Mark Everingham, Luc Van Gool, Christopher K I Williams, John Winn, and Andrew Zisserman. The Pascal Visual Object Classes (VOC) Challenge. International Journal of Computer Vision, 88(2):303–338, June 2010.
163
+
164
+ Quanfu Fan, Chun-Fu (Richard) Chen, and Gwo Giun (Chris) Lee. Sparse Deep Feature Representation for Object Detection from Wearable Cameras. In Proceedings of the British Machine Vision Conference (BMVC). BMVA Press, September 2017.
165
+
166
+ Clement Farabet, Camille Couprie, Laurent Najman, and Yann LeCun. Learning hierarchical features for scene labeling. Pattern Analysis and Machine Intelligence, 2013.
167
+
168
+ Michael Figurnov, Maxwell D. Collins, Yukun Zhu, Li Zhang, Jonathan Huang, Dmitry Vetrov, and Ruslan Salakhutdinov. Spatially adaptive computation time for residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
169
+
170
+ Sam Gross and Michael Wilber. Training and investigating residual nets. http://torch.ch/blog/2016/ 02/04/resnets.html, 2016.
171
+
172
+ Song Han, Huizi Mao, and William J Dally. Deep Compression: Compressing Deep Neural Network with Pruning, Trained Quantization and Huffman Coding. ArXiv, abs/1510.00149, 2015.
173
+
174
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016.
175
+
176
+ Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask R-CNN. In The IEEE International Conference on Computer Vision (ICCV), October 2017.
177
+
178
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv:1503.02531, 2015.
179
+
180
+ Jie Hu, Li Shen, and Gang Sun. Squeeze-and-Excitation Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
181
+
182
+ G. Huang, Y. Li, Z. Liu G. Pleiss, J. E. Hopcroft, and K. Q. Weinberger. Snapshot ensembles: Train 1, get m for free. In International Conference on Learning Representations (ICLR), 2017a.
183
+
184
+ Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely Connected Convolutional Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017b.
185
+
186
+ Gao Huang, Danlu Chen, Tianhong Li, Felix Wu, Laurens van der Maaten, and Kilian Weinberger. Multiscale dense networks for resource efficient image classification. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\equiv$ Hk2aImxAb.
187
+
188
+ Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized Neural Networks. In D D Lee, M Sugiyama, U V Luxburg, I Guyon, and R Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4107–4115. Curran Associates, Inc., 2016.
189
+
190
+ Yani Ioannou, Duncan P Robertson, Jamie Shotton, Roberto Cipolla, and Antonio Criminisi. Training CNNs with Low-Rank Filters for Efficient Image Classification. ArXiv, abs/1511.06744, 2015.
191
+
192
+ Jason Kuen, Xiangfei Kong, Zhe Lin, Gang Wang, Jianxiong Yin, Simon See, and Yap-Peng Tan. Stochastic downsampling for cost-adjustable inference and improved regularization in convolutional networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
193
+
194
+ Fengfu Li and Bin Liu. Ternary weight networks. CoRR, abs/1605.04711, 2016. URL http://arxiv.org/ abs/1605.04711.
195
+
196
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning Filters for Efficient ConvNets. In International Conference on Learning Representation 2017, pp. 1–13, March 2017.
197
+
198
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft COCO: Common Objects in Context. In David Fleet, Tomas Pajdla, Bernt Schiele, and Tinne Tuytelaars (eds.), Computer Vision – ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V, pp. 740–755. Springer International Publishing, Cham, 2014.
199
+
200
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
201
+
202
+ Tony Lindeberg and Bart M ter Haar Romeny. Linear scale-space i: Basic theory. In Geometry-Driven Diffusion in Computer Vision, pp. 1–38. Springer, 1994.
203
+
204
+ Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan Yuille, Jonathan Huang, and Kevin Murphy. Progressive Neural Architecture Search. In The European Conference on Computer Vision (ECCV), September 2018.
205
+
206
+ I. Loshchilov and F. Hutter. Sgdr. Stochastic Gradient Descent with Restarts. In International Conference on Learning Representations (ICLR), 2017.
207
+
208
+ Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design. In The European Conference on Computer Vision (ECCV), September 2018.
209
+
210
+ Seungjun Nah, Tae Hyun Kim, and Kyoung Mu Lee. Deep Multi-Scale Convolutional Neural Network for Dynamic Scene Deblurring. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
211
+
212
+ Alejandro Newell, Kaiyu Yang, and Jia Deng. Stacked Hourglass Networks for Human Pose Estimation. In Computer Vision – ECCV 2016, pp. 483–499, Cham, 2016. Springer International Publishing.
213
+
214
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In NIPS-W, 2017.
215
+
216
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
217
+
218
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang Chieh Chen. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
219
+
220
+ George Saon, Gakuto Kurata, Tom Sercu, Kartik Audhkhasi, Samuel Thomas, Dimitrios Dimitriadis, Xiaodong Cui, Bhuvana Ramabhadran, Michael Picheny, Lynn-Li Lim, et al. English conversational telephone speech recognition by humans and machines. arXiv preprint arXiv:1703.02136, 2017.
221
+
222
+ Shreyas Saxena and Jakob Verbeek. Convolutional neural fabrics. In Proceedings of the 30th International Conference on Neural Information Processing Systems, NIPS’16, pp. 4060–4068, USA, 2016. Curran Associates Inc. ISBN 978-1-5108-3881-9. URL http://dl.acm.org/citation.cfm?id $\equiv$ 3157382.3157551.
223
+
224
+ Tom Sercu and Vaibhava Goel. Dense prediction on sequences with time-dilated convolutions for speech recognition. NIPS End-to-end Learning for Speech and Audio Processing Workshop, 2016.
225
+
226
+ Vikas Sindhwani, Tara Sainath, and Sanjiv Kumar. Structured Transforms for Small-Footprint Deep Learning. In C Cortes, N d Lawrence, D D Lee, M Sugiyama, and R Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 3088–3096. Curran Associates, Inc., 2015.
227
+
228
+ C Szegedy, Wei Liu, Yangqing Jia, P Sermanet, S Reed, D Anguelov, D Erhan, V Vanhoucke, and A Rabinovich. Going deeper with convolutions. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–9, 2015.
229
+
230
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the Inception Architecture for Computer Vision. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016a.
231
+
232
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the Inception Architecture for Computer Vision. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016b.
233
+
234
+ Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander Alemi. Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning. In Conference on Artificial Intelligence (AAAI), 2017.
235
+
236
+ László Tóth. Multi-resolution spectral input for convolutional neural network-based speech recognition. In Speech Technology and Human-Computer Dialogue (SpeD), 2017.
237
+
238
+ Andreas Veit and Serge Belongie. Convolutional Networks with Adaptive Inference Graphs. In The European Conference on Computer Vision (ECCV), September 2018.
239
+
240
+ O Vinyals, A Toshev, S Bengio, and D Erhan. Show and Tell: Lessons Learned from the 2015 MSCOCO Image Captioning Challenge. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 39(4): 652–663, April 2017.
241
+
242
+ Fei Wang, Mengqing Jiang, Chen Qian, Shuo Yang, Cheng Li, Honggang Zhang, Xiaogang Wang, and Xiaoou Tang. Residual Attention Network for Image Classification. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
243
+
244
+ Xin Wang, Fisher Yu, Zi-Yi Dou, and Joseph E. Gonzalez. Skipnet: Learning dynamic routing in convolutional networks. In SysML, Feb 2018.
245
+
246
+ Wei Wen, Cong Xu, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Coordinating Filters for Faster Deep Neural Networks. In The IEEE International Conference on Computer Vision (ICCV), October 2017.
247
+
248
+ Sanghyun Woo, Jongchan Park, Joon-Young Lee, and In So Kweon. CBAM: Convolutional Block Attention Module. In The European Conference on Computer Vision (ECCV), September 2018.
249
+
250
+ Yuxin Wu. Tensorpack. https://github.com/ppwwyyxx/tensorpack, 2017.
251
+
252
+ Zuxuan Wu, Tushar Nagarajan, Abhishek Kumar, Steven Rennie, Larry S Davis, Kristen Grauman, and Rogerio Feris. Blockdrop: Dynamic inference paths in residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
253
+
254
+ Guotian Xie, Jingdong Wang, Ting Zhang, Jianhuang Lai, Richang Hong, and Guo-Jun Qi. IGCV2: Interleaved Structured Sparse Convolutional Neural Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2018.
255
+
256
+ Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated Residual Transformations for Deep Neural Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
257
+
258
+ W Xiong, J Droppo, X Huang, F Seide, M Seltzer, A Stolcke, D Yu, and G Zweig. Achieving human parity in conversational speech recognition. arXiv:1610.05256, 2016.
259
+
260
+ Songfan Yang and Deva Ramanan. Multi-Scale Recognition With DAG-CNNs. In The IEEE International Conference on Computer Vision (ICCV), December 2015.
261
+
262
+ X Zhang, J Zou, K He, and J Sun. Accelerating Very Deep Convolutional Networks for Classification and Detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, PP(38):1943–1955, October 2016.
263
+
264
+ Xingcheng Zhang, Zhizhong Li, Chen Change Loy, and Dahua Lin. PolyNet: A Pursuit of Structural Diversity in Very Deep Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
265
+
266
+ Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V. Le. Learning transferable architectures for scalable image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
267
+
268
+ # Appendix
269
+
270
+ The appendix illustrates the details of our experiments on object recognition and speech recognition and more ablation study.
271
+
272
+ # A bL-Net FOR OBJECT RECOGNITION
273
+
274
+ # A.1 EXPERIMENTAL SETUP
275
+
276
+ We used the ImageNet dataset for all experiments. We trained all the models by Tensorpack (Wu, 2017), a higher-level wrapper for Tensorflow (Abadi et al., 2015). All the models were trained with 110 epochs, batch size 256, weight decay 0.0001, momentum 0.9 and Nesterov momentum optimizer. Furthermore, we used cosine learning-rate schedule as (Huang et al., $2 0 1 7 \mathrm { a }$ ; Loshchilov & Sgdr, 2017). We deployed the popular augmentation technique in (Szegedy et al., 2016b; Gross & Wilber, 2016) to increase the variety of training data, and randomly crop a $2 2 4 \times 2 2 4$ patch as training image. The validation error is evaluated by resizing the shorter side of an image to 256 and then crop a $2 2 4 \times 2 2 4$ from the center. Note that the results reported here for the vanilla ResNet, ResNeXt and SEResNeXt models are difference from those reported in the original paper (He et al., 2016; Gross & Wilber, 2016; Hu et al., 2018). Our vanilla ResNet is better than the original paper while vanilla ResNeXt and SEResNeXt is slightly worse than the original paper.
277
+
278
+ Table 4: Network configurations of bL-ResNet-50. Output size is illustrated in the parenthesis.
279
+
280
+ <table><tr><td rowspan=1 colspan=1>Layers</td><td rowspan=1 colspan=1>bL-ResNet-50</td><td rowspan=1 colspan=1>ResNet-50</td></tr><tr><td rowspan=1 colspan=1>Convolution</td><td rowspan=1 colspan=2>7 × 7,64, s2 (112 × 112)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>3×3,323 × 3,64,s2 3×3,32,s2(56 × 56)(1×1,64</td><td rowspan=1 colspan=1>MaxPooling (56 × 56)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>ResBlockg,256 ×2 ResBlockL,128 ×1ResBlock,256,s2 (28 × 28)</td><td rowspan=1 colspan=1>ResBlock,256 ×3, s1(56 × 56)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>ResBlockp,512 ×3 ResBlockL,256 ×1ResBlock, 512, s2 (14 × 14)</td><td rowspan=1 colspan=1>ResBlock,512 ×4, s2(28× 28)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>ResBlockb,1024 ×5 ResBlockL,512 ×1ResBlock,1024 (14 × 14)</td><td rowspan=1 colspan=1>ResBlock,1024 ×6, s2(14 × 14)</td></tr><tr><td rowspan=1 colspan=1>ResBlock</td><td rowspan=1 colspan=2>ResBlock,2048 ×3, s2 (7 × 7)</td></tr><tr><td rowspan=1 colspan=1>Average pool</td><td rowspan=1 colspan=2>7 ×7 average pooling</td></tr><tr><td rowspan=1 colspan=1>FC, softmax</td><td rowspan=1 colspan=2>1000</td></tr></table>
281
+
282
+ ResBlockB: the first $3 \times 3$ convolution is with stride 2, and a bi-linear upsampling is applied at the end. $\mathbf { R e s B l o c k } _ { L }$ : a $1 \times 1$ convolution is applied at the end to align the channel size. $\mathbf { s } 2$ : the stride is set to 2 for the $3 \times 3$ convolution in the ResBlock.
283
+
284
+ # A.2 NETWORK STRUCTURE
285
+
286
+ This section shows the details of network structures of our bL-ResNet, and the setting of $\alpha$ and $\beta$ is 2 and 4, respectively. To understand how do we design bL-ResNet-50 based on ResNet-50, Table 4 shows the details of network structure. We used a bottleneck residual block as a ResBlock, and a ResBlock, $C$ denotes a block composed of $1 \times 1 , 3 \times 3$ , and $1 \times 1$ convolutions, where the first $1 \times 1$ and the $3 \times 3$ have $C / 4$ kernels and the last $1 \times 1$ has $C$ kernels.
287
+
288
+ First, the Big-Branch and the Little-Branch shares a residual block at the transition layer, so the number of residual blocks in each branch will be subtracted by 1. The number of residual blocks in the Little-Branch is defined as $\begin{array} { r } { \left\lceil { \frac { L } { \beta } } \right\rceil - 1 } \end{array}$ and at least one, where $L$ is the number of residual blocks in the Big-Branch, and the number of kernels in a convolutional layer would be $\frac { C } { \alpha }$ , where $C$ is the number of kernels in the Big-Branch. Thus, for all stages, the number of blocks in the Little-Branch is only one, and the number of blocks in the Big-Branch would be the number of blocks in ResNet-50 miuns one.
289
+
290
+ For bL-ResNet-101 and bL-ResNet-152, we redistributed the residual blocks to different stages to balance the residual blocks at each stage. A ResNet model has 5 stages, and each stage has the same spatial size. These two models accumulate most of the convolutions (or computations) on the $4 ^ { t h }$ stage, where the size of feature maps is $1 4 \times 1 4$ when input size is $2 2 4 \times 2 2 4$ . While such a design may be suitable for a very deep model, it likely limits the ability of Big-Branch to learn information at large scales, which mostly resides at earlier stages. Thus, we move some blocks in the $4 ^ { t h }$ stage of these two models to the ${ \dot { \mathbf { \zeta } } } _ { 2 ^ { n d } }$ and $3 ^ { r d }$ stages. Table 5 shows the details of bL-ResNet-101 and bLResNet-152.
291
+
292
+ Table 5: Network configurations of bL-ResNets, and $\alpha = 2$ and $\beta = 4$
293
+
294
+ <table><tr><td>Layers</td><td>Output Size</td><td colspan="6">bL-ResNet-101 bL-ResNet-152</td></tr><tr><td>Convolution</td><td>112 × 112</td><td colspan="6">7 × 7,64,s2</td></tr><tr><td>bL-module</td><td>56× 56</td><td colspan="6">(3×3,32 3 ×3,64,s2 3×3,32,s2 (1×1,64</td></tr><tr><td>bL-module</td><td>56×56</td><td>/1×1,64 3×3,64 ×3(2) (1×1,256) B</td><td>/1×1,32 3×3,32 (1×1,128) L</td><td>×1</td><td>/1×1,64 3×3,64 × 4(2) (1×1,256) B</td><td>/1×1,32 3×3,32 (1×1,128)</td><td>×1 L</td></tr><tr><td>transition layer</td><td>28×28</td><td colspan="6">/1×1,64 3×3,64,s2 ×1 (1×1,256</td></tr><tr><td>bL-module</td><td>28×28</td><td>(1×1,128) /1×1,64 3×3,128 ×7(3) 3×3,64 (1×1,512) B</td><td>×1 (1×1,256) L</td><td colspan="2">(1×1,128) 3×3,128 (1×1,512)</td><td>× 11(7)</td><td>/1×1,64 3×3,64 ×2 (1×1,256) L</td></tr><tr><td>transition layer</td><td>14 × 14</td><td colspan="2"></td><td colspan="2">/1×1,128 3×3,128,s2 ×1 (1×1,512</td><td colspan="3">B</td></tr><tr><td>bL-module</td><td>14 × 14</td><td>/1×1,256 3×3,256 �� 17(22) (1×1,1024)B</td><td>(1×1,128) 3×3,128 (1×1,512 L</td><td>×3</td><td>/1×1,256 3×3,256 (1×1,1024) B</td><td>× 29(35)</td><td>(1×1,128) 3×3,128 (1×1,512)</td><td>×6 L</td></tr><tr><td>transition layer</td><td>14 × 14</td><td colspan="6">/1×1,256 3×3,256 ×1 (1×1,1024)</td></tr><tr><td>ResBlock</td><td>7×7</td><td colspan="6">/1×1,512 3 ×3,512,s2 ×3</td></tr><tr><td>Average pool</td><td>1×1</td><td colspan="6">(1×1,2048 7×7 average pooling</td></tr><tr><td>FC, softmax</td><td colspan="7">1000</td></tr></table>
295
+
296
+ For each $\overline { B }$ block, the first $3 \times 3$ convolution is with stride 2, and a bi-linear upsampling is applied at the end. For each $L$ block, a $1 \times 1$ convolution is applied at the end. $^ { s 2 }$ : the stride is set to 2 for the convolutional layer. The number in the parethesis denotes the original number of blocks in ResNet.
297
+
298
+ # A.3 PERFORMANCE ON LOW RESOLUTION INPUT
299
+
300
+ We analyzed what advantages bL-Net could provide as compared to the network which works on low resolution input directly (ResNet-50-lowres). As shown in Table 6, ResNet-50-lowres reduces lots of computations but its accuracy is not acceptable; however, bL-ResNet-50 $\alpha = 2$ and $\beta = 4$ ) achieves a better balance between accuracy and performance. A similar trend is also observed on a deeper model ResNet-101-lowres. While such performance is unsatisfying compared to the state of the art, it is quite reasonable and expected given that almost $3 \sim 4 \times$ reduction of computation are achieved in such a case.
301
+
302
+ Figure 4 shows the prediction results from bL-ResNet-50 and ResNet-50-lowres. When both models predict correctly (4 (a) and (b)), the bL-ResNet-50 provides better confidence for the prediction. Because the object only occupies a small portion of an image, the Little-Branch can still capture the object clearly. On the other hand, when the key features of an object is small, like the shape of beak of a bird (c) and the spots of a ladybug (d), bL-ResNet-50 can easily retain that key feature to predict correctly while ResNet-50-lowres provides wrong predicted label.
303
+
304
+ ![](images/bf948a2c1696a33afbd37fc5e16cb47be047e9384139f171958c590313dc30a9.jpg)
305
+ Figure 4: Prediction results for bL-ResNet-50 and ResNet-50-lowres. True labels, predicted labels and their probability are listed in the table. When both models predicts correctly ((a) and (b)), bL-ResNet-50 achieves much higher probability; on the other hand, bL-ResNet-50 captures the details on the object and then predicts correctly ((c) and (d)).
306
+
307
+ Table 6: Performance of ResNets at different input resolutions.
308
+
309
+ <table><tr><td>Network</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>ResNet-50-lowres</td><td>26.10%</td><td>1.29 (3.17×)</td><td>25.60</td></tr><tr><td>ResNet-101</td><td>21.95%</td><td>7.80</td><td>44.54</td></tr><tr><td>ResNet-101-lowres</td><td>24.80%</td><td>2.22 (3.51x)</td><td>44.57</td></tr></table>
310
+
311
+ # A.4 ABLATION STUDY ON NETWORK MERGING AND MULTI-BRANCH
312
+
313
+ Is linear combination better than concatenation? We adopt the simpler addition in bL-Net. Nonetheless, if we design the Big-Branch in a way that the output channels is identical to the backbone networks, then the number of kernels in the Big-Branch would be only $1 - \alpha$ with respect to the total number of kernels of the backbone network; thus, in this case, the overall $b L$ -Net can be more efficient while the performance degradation could be compromised. We compared the performance of these two different merging schemes in Table 7. Although concatenation approach is more efficient, it performs much worse than addition with a gap of almost $1 . 5 \%$ . This leaves addition as a better choice for bL-Net in both visual and speech tasks.
314
+
315
+ More-branch in bL-Net As mentioned in Section 3.1, our approach can be extended to a scenario with multiple image scales. We experimented with three scales [1/4, 1/2, 1] on bL-ResNet-50 $( K = 3$ ) where ResNet-50 is served as the Big-Branch at the scale of 1/4 of the original input, i.e. $5 6 \times 5 6$ As indicated in Table 7, a 3-scale bL-Net requires more FLOPs and parameters due to the fact that the overhead in merging more branches is significant for ResNet-50, but even though, it still cannot provide superior performance of a 2-scale bL-Net. This is because the Big-Branch in the 3-scale bL-Net is downsampled aggressively by 4 times, thus substantially degrade the capability of feature representation in the Big-Branch.
316
+
317
+ Table 7: Different scales and merging schemes on bL-ResNet.
318
+
319
+ <table><tr><td>Network</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>bL-ResNet-50 (addition,K = 2)</td><td>22.69 %</td><td>2.85 (1.43×)</td><td>26.69</td></tr><tr><td>bL-ResNet-50 (concatenation,K = 2)</td><td>24.04%</td><td>2.01 ( (2.03x)</td><td>20.57</td></tr><tr><td>bL-ResNet-50 (addition,K = 3)</td><td>24.12%</td><td>3.91 (1.04×)</td><td>27.23</td></tr></table>
320
+
321
+ Table 8: Different number of merges in bL-ResNet. $m$ : number of merges. $( \alpha = 2 , \beta = 4 )$
322
+
323
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>bL-ResNet-50 (m = 4) (baseline)</td><td>22.69%</td><td>2.85</td><td>26.69</td></tr><tr><td>bL-ResNet-50 (m = 2)</td><td>23.48%</td><td>2.74</td><td>26.66</td></tr><tr><td>bL-ResNet-50 (m = 1)</td><td>24.57%</td><td>2.64</td><td>26.64</td></tr><tr><td>bL-ResNet-101 (m= 4) (baseline)</td><td>21.80%</td><td>3.89</td><td>41.85</td></tr><tr><td>bL-ResNet-101 (m = 7)</td><td>21.85%</td><td>5.21</td><td>44.44</td></tr></table>
324
+
325
+ # Number of Merges in bL-Net
326
+
327
+ We also analyzed the number of merges we needed in the bL-Net. One big difference between our approach and others is that $b L$ -Net merges multiple times as opposed to only once in most of the other approaches. Below we provide an explanation of why more information exchange is encouraged in our approach and when is the best moment for merging operation.
328
+
329
+ In the above bL-Net, we merged branches before the feature dimension changes, except for the first stride convolution; thus, we used 4 merges $m = 4 ,$ ). We experimented with a different number of merges for bL-ResNet-50 and bL-ResNet-101, and the results are shown in Table 8. Since there are fewer layers in bL-ResNet-50, we reduce the number of merges to show their importance; on the other hand, there are more layers in bL-ResNet-101, so we add more merges to show that those additional merges would similarly not improve the performance anymore.
330
+
331
+ The accuracy of the bL-ResNet-50 models with less number of merges ( $m = 1$ and $m = 2$ ) is significantly worse than with more $\textlangle m = 4$ ) and they do not save many FLOPs and parameters at all. This justifies frequent information exchange improves the performance. On the other hand, bL-ResNet-101 $m = 7 ,$ ) uses more merges; however, it also does not improve the performance and requires more FLOPs, which comes from more merges. This is because the original setting for the amount of merging happened when either the channel number or feature map size is changed, so extra merges happened at the feature dimension. Thus, those extra merges could be redundant since merging at identical dimension could be reduced to one merging. Hence, it empirically proves that merging before dimension is changed is the most effective.
332
+
333
+ # A.5 bL-Net FOR HIGH-EFFICIENCY NETWORK
334
+
335
+ To demenstrate bL-Net can be applied on different types of network, we deploy bL-Net on the high-efficiency network, ShuffleNetV2 (Ma et al., 2018), and results are shown in Table 9. Our bL-ShuffleNetV2@256 outperforms ShuffleNetV2 by up to $0 . 5 \%$ point under similar FLOPs, which suggests that our approach can also improve the high-efficiency networks.
336
+
337
+ Table 9: Comparison with ShuffleNetV2 (Ma et al., 2018) $( \alpha = 2 , \beta = 2 ) .$
338
+
339
+ <table><tr><td>Model</td><td>|Model width</td><td>Top-1 Error</td><td>FLOPs (106)</td><td>Params (106)</td></tr><tr><td rowspan="3">ShuffleNetV2</td><td>1×</td><td>30.60%</td><td>146</td><td>2.30</td></tr><tr><td>1.5×</td><td>28.03%</td><td>299</td><td>3.51</td></tr><tr><td>2×</td><td>26.85%</td><td>588</td><td>7.40</td></tr><tr><td rowspan="3">bL-ShuffleNetV2 @ 256</td><td>1×</td><td>30.84%</td><td>150</td><td>2.33</td></tr><tr><td>1.5×</td><td>27.83%</td><td>298</td><td>4.80</td></tr><tr><td>2×</td><td>26.38%</td><td>590</td><td>7.60</td></tr></table>
340
+
341
+ All models are trained by ourselves.
342
+
343
+ # A.6 bL-Net FOR OBJECT DETECTION
344
+
345
+ We demonstrate the effectiveness of bL-Net on object detection. We use bL-Net as a backbone network for FasterRCNN $+$ FPN (Lin et al., 2017) on the PASCAL VOC (Everingham et al., 2010) and MS COCO datasets (Lin et al., 2014). Table 10 shows the comparison with the detector with ResNet-101
346
+
347
+ as the backbone network, and the results show that bL-Net achieves competitive performance while saving about $1 . 5 \times \mathrm { F L O P s } ^ { 1 }$ , suggesting that bL-Net is transferable to other vision tasks.
348
+
349
+ Table 10: Objection detection results. Detection performance on the PASCAL VOC 2007test dataset.
350
+
351
+ <table><tr><td>Network</td><td>mAP@[IoU=0.5] (bbox)</td><td>FLOPst (109)</td></tr><tr><td>ResNet-101</td><td>81.5</td><td>137.70</td></tr><tr><td>bL-ResNet-101 (α=2, β=4)</td><td>81.4</td><td>89.21 (1.54×)</td></tr><tr><td>bL-ResNet-101 (α=2, β=2)</td><td>81.5</td><td>93.95 (1.47×)</td></tr></table>
352
+
353
+ Detection performance on the MS COCO val2017 dataset.
354
+
355
+ <table><tr><td>Network</td><td>mAP@[IoU=0.50:0.95](bbox)|FLOPs‡ (109)</td><td></td></tr><tr><td>ResNet-101</td><td>39.2</td><td>234.85</td></tr><tr><td>bL-ResNet-101 (α=2, β=4)</td><td>39.5</td><td>151.11 (1.55×)</td></tr><tr><td>bL-ResNet-101 (α=2, β=2)</td><td>40.4</td><td>160.21 (1.47×)</td></tr></table>
356
+
357
+ †: FLOPs is calculated when the size of input image is $6 0 0 \times 1 0 2 4$ with 300 proposals. ‡: FLOPs is calculated when the size of input image is $8 0 0 \times 1 3 4 4$ with 300 proposals.
358
+
359
+ # A.7 COMPARISON OF MEMORY REQUIREMENT
360
+
361
+ We benchmarked the GPU memory consumption in runtime at both the training and test phases for all the models evaluated in Fig. 3. The results are shown in Fig. 5. The batch size was set to 8, which is the largest number allowed for NASNet on a P100 GPU card. The image size for any model in this benchmark experiment is the same as that used in the experiment reported in Fig. 3. For bL-Net, the input image size is $2 2 4 \times 2 2 4$ in training and $2 5 6 \times 2 5 6$ in test.
362
+
363
+ From Fig. 5, we can see that bL-Net is the most memory-efficient for training among all the approaches. In test, bL-ResNeXt consumes more memory than inception-resnet-v2 and inception-v4 at the same accuracy, but bL-SEResNeXt outperforms all the approaches. Note that NASNet and PNASNet are not memory friendly. This is largely because they are trained on a larger image size $( 3 3 1 \times 3 3 1 )$ ) and these models are composed of many layers.
364
+
365
+ ![](images/da4e5aec7cfa4b70d0b83baf77d263cacc8fcabedbed9c1b250d87d538f80742.jpg)
366
+ Figure 5: Comparison memory requirement at the training and test phases among other types of networks. (a) Training. (b) Test. (The batch size is 8.)
367
+
368
+ Table 11: Complexity study of the Little-Branch $\scriptstyle { \alpha }$ and $\beta$ ) for bL-ResNet-50 and bL-ResNet-101.
369
+
370
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>bL-ResNet-50 (α =1, β=1)</td><td>21.75%</td><td>5.65</td><td>34.12</td></tr><tr><td>bL-ResNet-50 (α =1, β=2)</td><td>22.11%</td><td>4.34</td><td>30.14</td></tr><tr><td>bL-ResNet-50(α= 2,) β=2)</td><td>22.72%</td><td>2.91</td><td>26.97</td></tr><tr><td>bL-ResNet-50(α =2,) β=4)</td><td>22.69%</td><td>2.85</td><td>26.69</td></tr><tr><td>bL-ResNet-50(α = 4, β = 2)</td><td>23.20%</td><td>2.49</td><td>26.31</td></tr><tr><td>bL-ResNet-50 (α =4, β= 4)</td><td>23.15%</td><td>2.48</td><td>26.24</td></tr><tr><td>ResNet-101</td><td>21.95%</td><td>7.80</td><td>44.54</td></tr><tr><td>bL-ResNet-101 (α=1,β=1)</td><td>20.31%</td><td>10.29</td><td>63.32</td></tr><tr><td>bL-ResNet-101 (α = 2, β= 2)</td><td>21.40%</td><td>4.27</td><td>43.39</td></tr><tr><td>bL-ResNet-101 (α = 2,β=4)</td><td>21.80%</td><td>3.89</td><td>41.85</td></tr></table>
371
+
372
+ # B bL-Net FOR SPEECH RECOGNITION
373
+
374
+ # B.1 EXPERIMENTAL SETUP
375
+
376
+ In our experiments, we start with an input size of $6 4 \times 4 9$ , where 64 is the number of logmel filterbanks, calculated for each utterance on-the-fly. We also stack their first and second derivatives to get 3 input channels, resulting in our final input of dimensionality batch_si $\mathsf { \Omega } : \in \times 3 \times 6 4 \times 4 9$ . Our output is of size batch_si $\mathsf { z e } \times 5 1 2 \times 4 \times 1$ , which is then projected to batch_si $\mathsf { z e } \times 5 1 2 \times 1 \times 1$ and finally to batch_ $\mathrm { ~ s ~ i ~ z ~ e ~ } \times \mathrm { 3 2 k } \times 1 \times 1$ for classification. We then perform softmax cross-entropy over this output space of 32k tied CD states from forced alignment, doing phone prediction on the central frame of the input utterance. We report results after Cross-Entropy training, on ${ \mathrm { H u b } } 5 ^ { \prime } { 0 0 }$ (SWB and CH part) after decoding using the standard small 4M n-gram language model with a $3 0 . 5 \mathrm { k }$ word vocabulary.
377
+
378
+ All models were trained in PyTorch (Paszke et al., 2017) over 16 epochs on 2 GPUs with per-GPU batch size 256 (total batch size of 512), gradient clipping 10.0, weight decay √ $1 \times 1 0 ^ { - 6 }$ , nesterov accelerated momentum 0.9, and learning rate 0.03 (annealed by $\sqrt { 0 . 5 }$ per epoch $\geq 1 0 $ ).
379
+
380
+ # B.2 NETWORK STRUCTURES
381
+
382
+ ResNet-22 Our models follow a ResNet architecture without padding in time (Saon et al., 2017), which accounts for the fact that padding in time adds undesirable artifacts when processing a longer utterance (Sercu & Goel, 2016). Under this constraint, each convolution operation reduces our input sequence in time by $k - 1$ , where $k$ is the kernel width used. This effect can be seen in Table 12, in which the time variable, $T$ , is reduced in accordance with the number of convolutions. For similar reasons, when we stride we only do so in frequency, and not in time. For the rest of this section, when we refer to striding we are referring only to striding in frequency. We define our residual blocks as a series of $3 \times 3$ convolutions. When we transition from one stage to the next, we stride by 2 on the first convolution of the following block. All of our models start with a $5 \times 5$ convolution with stride 2, which downsamples the input from 64 melbins to 32.
383
+
384
+ Our baseline model, ResNet-22, consists of four stages of two-convolution residual blocks: $( 3 \times$ $3 , 6 4 ) \times 3$ $\times 3 ; ( 3 \times 3 , 1 2 8 , s 2 ) \times 3 ; ( 3 \times 3 , 2 5 6 , s 2 ) \times 3 ; ( 3 \times 3 , 5 1 2 , s 2 ) \times 2$ . The output then goes through a bottleneck projection layer to the 32k-dimensional output CD state: $( 4 \times 1 , 5 1 2 )$ and $( 1 \times 1 , 3 2 \mathbf { k } )$ .
385
+
386
+ bL-ResNet-22 $( \alpha = 4 , \beta = 1 ,$ ) Table 12 displays two bL-Net architectures that we experimented with based on the ResNet-22 baseline. The bL-Net baseline, bL-ResNet-22 $( \alpha = 4 , \beta = 1 )$ , consists of two branches in each Big-Little Module and is well-defined through the parameters $\alpha$ and $\beta$ . In between each Big-Little Module we downsample our input using a transition layer consisting of a residual block with a single $3 \times 3$ convolution with stride 2. Therefore, we shift one convolution operation out of the last residual block in each stage that precedes a transition layer.
387
+
388
+ Whenever downsampling is performed in the Big-Branch, it is only in the frequency dimension and not in time. Similarly, bilinear upsampling only occurs in the frequency dimension. All $b L$ -Net variants end with the same projection and output layer as ResNet-22. All merges, unless otherwise specified, are through linear combination with unit weights per branch. For comparison, we experimented with a version of bL-ResNet-22 $\mathbf { \Phi } ( \alpha = 4 , \beta = 1 $ ) using concatenation to merge branches, the results of which are presented in Table 3. Using concatenation instead of linear combination in this model results in each stage having more channels after concatenation than the current stage of the network calls for (i.e. in stage 1 we end up with $6 4 + 1 6 = 8 0$ channels at the end of the relevant Big-Little Module, whereas we only want 64 channels to be outputted). To resolve this, we apply a $1 \times 1$ convolution to reduce the number of channels accordingly and fuse the two separate feature maps.
389
+
390
+ Table 12: Network configurations of bL-ResNets applied to speech for acoustic modeling.
391
+
392
+ <table><tr><td>Layers</td><td>Output Size 一</td><td colspan="3">bL-ResNet-22 (α=4,β=1)</td><td colspan="3">bL-ResNet-22 (α= 2,β=3)</td></tr><tr><td>Convolution</td><td>32×T T=49→45</td><td colspan="6">5×5,64,s2</td></tr><tr><td>bL-module</td><td>32×T T=45→35</td><td>(3×3,64) 3×3,64 ×2 B (3×3,64)g ×1</td><td>(3×3,16) (3×3,16)L (3 ×3,16), × 1</td><td>×2</td><td>(3×3,64) ×2 3×3,64) B (3 ×3,64)B ×1</td><td>(3×3,32) (3×3,32)</td><td>×1</td></tr><tr><td>transition layer</td><td>16×T T=35→33</td><td colspan="6">(3×3,64,s2)×1</td></tr><tr><td>bL-module</td><td>16×T T= 33→23</td><td>(3×3,128) ×2 (3×3,128) B</td><td>(3×3,32) (3×3,32)</td><td>×2 L</td><td>(3×3,128) ×2 3×3,128 B</td><td>(3×3,64) 3×3,64)</td><td>×1 L</td></tr><tr><td>transition layer</td><td>8×T T=23→21</td><td colspan="6">(3×3,128)B ×1 (3×3,32) ×1 (3×3,128)g ×1 (3×3,128,s2)×1</td></tr><tr><td>bL-module</td><td>8×T T=21→11</td><td>(3×3,256) ×2 3×3,256 B</td><td>(3×3,64) (3×3,64) L</td><td>×2</td><td>(3×3,256) ×2 3×3,256 B</td><td>(3×3,128) 3×3,128)</td><td>×1 L</td></tr><tr><td>transition layer</td><td>4×T</td><td colspan="6">(3×3,256)B ×1 (3×3,64) ×1 (3×3,256)g ×1 (3×3,256,s2) ×1</td></tr><tr><td>bL-module</td><td>T=11→9 4×T</td><td colspan="6">(3×3,512) (3×3,128) (3×3,512) ×2 ×2 ×2</td></tr><tr><td>Convolution</td><td>T=9→1 1×1</td><td colspan="6">(3×3,512) (3×3,128) (3×3,512) B L</td></tr><tr><td>Convolution</td><td>1×1</td><td colspan="6">4×1,512 1 × 1,32k</td></tr></table>
393
+
394
+ For each $B$ block, the first $3 \times 3$ convolution is with stride 2 (in frequency), and a bilinear upsampling is applied at the end. For each $L$ block, a $1 \times 1$ convolution is applied at the end to match feature maps. $s 2$ : the stride is set to 2 in the frequency dimension (not in time) for the convolutional layer. $T = T _ { 0 } T _ { 1 }$ indicates that $T _ { 0 }$ is the size of the time dimension at the start of the given layer, which is reduced to $T _ { 1 }$ by the end of the layer.
395
+
396
+ bL-ResNet-22 $( \alpha = 4 , \beta = 2 , 3 )$ We explored two more models where we fix $\alpha = 4$ , one in which we take $\beta = 2$ and another where $\beta = 3$ . All Big-Branchs in these models are the same as bL-ResNet-22 $( \alpha = 4 , \beta = 1 )$ ). The difference in each Little-Branch is based on the setting of $\beta$ . Since the number of convolutions we use in the bL-Net baseline is uneven in the first three stages, we take $\lceil L / \beta \rceil$ to be the depth of the Little-Branch, where $L$ is the depth of the Big-Branch. For $\beta = 2$ , the first three stages of the network have a Little-Branch consisting of one residual block with two $3 \times 3$ convolutions and one residual block with one $3 \times 3$ convolution. This results in a reduction of the number of convolutions from 5 in the Big-Branch to 3 in the Little-Branch. For $\beta = 3$ , the first three stages of the network have a Little-Branch consisting of one residual block with two $3 \times 3$ convolutions, resulting in a reduction in the number of convolutions from 5 in the Big-Branch to 2 in the Little-Branch. For both models, the Little-Branch in the final stage consists of a single residual block with two $3 \times 3$ convolutions, since there are only four convolutions in the Big-Branch of the final stage and $\lceil 4 / 3 \rceil = \lceil 4 / 2 \rceil = 2$ .
397
+
398
+ In all bL-Net variants in which $\beta > 1$ , because we can’t pad in time, we see that the time dimension will get out of sync between the Big-Branch and Little-Branch. Therefore, before merging we need to match the output size of each branch. To do this, we crop the shallower branches in time to match the deepest branch (i.e. the Big-Branch will always have a smaller time dimension due to having more convolutions, so we crop to match it). This is similar to the way the shortcut in ResNet is dealt with in (Saon et al., 2017), and does not introduce edge artifacts when processing longer sequences.
399
+
400
+ bL-ResNet-22 $( \alpha = 2 , \beta = 3 )$ ) The last of our two-branch models is where $\alpha = 2$ and $\beta = 3$ which is also presented in Table 12. This variant is well-defined in $\alpha$ and $\beta$ up to the first three stages of the network. In the last stage, however, we opt to not branch and instead follow identically the final stage of ResNet-22 with two residual blocks operating at the full input resolution with 512 channels.
401
+
402
+ bL-PYR-ResNet-22 $( \alpha = 4 , \beta = 1$ ) We additionally present results on a pyramidal structure, in which the first stage of the network operates with four branches, the second with three, the third with two, and the fourth equivalent to the fourth stage of ResNet-22 (and bL-ResNet-22 $( \alpha = 2 , \beta = 3 )$ ). Due to the setting of $\alpha = 4$ , we increased the number of channels in the first stage Big-Branch to have 256 channels (with the three Little-Branches in this stage having 64, 16, and 4 channels), avoiding a single channel on the smallest branch. Note that the middle branches require both resolution upsampling and $1 \times 1$ convolution to match channels. The third stage Big-Little Module operates on two branches and is identical to the analagous stage in bL-ResNet-22 $\alpha = 4 , \beta = 1$ ).
md/train/HJPmdP9le/HJPmdP9le.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EFFICIENT SUMMARIZATION WITH READ-AGAIN AND COPY MECHANISM
2
+
3
+ Wenyuan Zeng†, Wenjie $\mathbf { L u o } ^ { \ddagger }$ , Sanja Fidler‡, Raquel Urtasun‡
4
+
5
+ †Tsinghua University, ‡University of Toronto cengwy13@mails.tsinghua.edu.cn {wenjie, fidler, urtasun}@cs.toronto.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Encoder-decoder models have been widely used to solve sequence to sequence prediction tasks. However current approaches suffer from two shortcomings. First, the encoders compute a representation of each word taking into account only the history of the words it has read so far, yielding suboptimal representations. Second, current models utilize large vocabularies in order to minimize the problem of unknown words, resulting in slow decoding times and large storage costs. In this paper we address both shortcomings. Towards this goal, we first introduce a simple mechanism that first reads the input sequence before committing to a representation of each word. Furthermore, we propose a simple copy mechanism that is able to exploit very small vocabularies and handle out-of-vocabulary words. We demonstrate the effectiveness of our approach on the Gigaword dataset and DUC competition outperforming the state-of-the-art.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Encoder-decoder models have been widely used in sequence to sequence tasks such as machine translation (Cho et al. (2014); Sutskever et al. (2014)). They consist of an encoder which represents the whole input sequence with a single feature vector. The decoder then takes this representation and generates the desired output sequence. The most successful models are LSTM and GRU as they are much easier to train than vanilla RNNs.
14
+
15
+ In this paper we are interested in summarization where the input sequence is a sentence/paragraph and the output is a summary of the text. Several encoding-decoding approaches have been proposed (Rush et al. (2015); Hu et al. (2015); Chopra et al. (2016)). Despite their success, it is commonly believed that the intermediate feature vectors are limited as they are created by only looking at previous words. This is particularly detrimental when dealing with large input sequences. Bi-directorial RNNs (Schuster & Paliwal (1997); Bahdanau et al. (2014)) try to address this problem by computing two different representations resulting of reading the input sequence left-to-right and right-to-left. The final vectors are computed by concatenating the two representations. However, the word representations are computed with limited scope.
16
+
17
+ The decoder employed in all these methods outputs at each time step a distribution over a fixed vocabulary. In practice, this introduces problems with rare words (e.g., proper nouns) which are out of vocabulary. To alleviate this problem, one could potentially increase the size of the decoder vocabulary, but decoding becomes computationally much harder, as one has to compute the soft-max over all possible words. Gulcehre et al. (2016), Nallapati et al. (2016) and Gu et al. (2016) proposed to use a copy mechanism that dynamically copy the words from the input sequence while decoding. However, they lack the ability to extract proper embeddings of out-of-vocabulary words from the input context. Bahdanau et al. (2014) proposed to use an attention mechanism to emphasize specific parts of the input sentence when generating each word. However the encoder problem still remains in this approach.
18
+
19
+ In this work, we propose two simple mechanisms to deal with both encoder and decoder problems. We borrowed intuition from human readers which read the text multiple times before generating summaries. We thus propose a ‘Read-Again’ model that first reads the input sequence before committing to a representation of each word. The first read representation then biases the second read representation and thus allows the intermediate hidden vectors to capture the meaning appropriate for the input text. We show that this idea can be applied to both LSTM and GRU models. Our second contribution is a copy mechanism which allows us to use much smaller vocabulary sizes resulting in much faster decoding and much smaller storage space. Our copy mechanism also allows us to construct a better representation of out-of-vocabulary words. We demonstrate the effectiveness of our approach in the challenging Gigaword dataset and DUC competition showing state-of-the-art performance.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ # 2.1 SUMMARIZATION
24
+
25
+ In the past few years, there has been a lot of work on extractive summarization, where a summary is created by composing words or sentences from the source text. Notable examples are Neto et al. (2002), Erkan & Radev (2004), Wong et al. (2008), Filippova & Altun (2013) and Colmenares et al. (2015). As a consequence of their extractive nature the summary is restricted to words (sentences) in the source text.
26
+
27
+ Abstractive summarization, on the contrary, aims at generating consistent summaries based on understanding the input text. Although there has been much less work on abstractive methods, they can in principle produce much richer summaries. Abstractive summarization is standardized by the DUC2003 and DUC2004 competitions (Over et al. (2007)). Some of the prominent approaches on this task includes Banko et al. (2000), Zajic et al. (2004), Cohn & Lapata (2008) and Woodsend et al. (2010). Among them, the TOPIARY system (Zajic et al. (2004)) performs the best in the competitions amongst non neural net based methods.
28
+
29
+ Very recently, the success of deep neural networks in many natural language processing tasks (Collobert et al. (2011)) has inspired new work in abstractive summarization . Rush et al. (2015) propose a neural attention model with a convolutional encoder to solve this task. Hu et al. (2015) build a large dataset for Chinese text summarization and propose to feed all hidden states from the encoder into the decoder. More recently, Chopra et al. (2016) extended Rush et al. (2015)’s work with an RNN decoder, and Nallapati et al. (2016) proposed an RNN encoder-decoder architecture for summarization. Both techniques are currently the state-of-the-art on the DUC competition. However, the encoders exploited in these methods lack the ability to encode each word condition on the whole text, as an RNN encodes a word into a hidden vector by taking into account only the words up to that time step.
30
+
31
+ In contrast, in this work we propose a ‘Read-Again’ encoder-decoder architecture, which enables the encoder to understand each input word after reading the whole sentence. Our encoder first reads the text, and the results from the first read help represent the text in the second pass over the source text. Our second contribution is a simple copy mechanism that allows us to significantly reduce the decoder vocabulary size resulting in much faster inference times. Furthermore our copy mechanism allows us to handle out-of-vocabulary words in a principled manner. Finally our experiments show state-of-the-art performance on the DUC competition.
32
+
33
+ # 2.2 NEURAL MACHINE TRANSLATION
34
+
35
+ Our work is also closely related to recent work on neural machine translation, where neural encoderdecoder models have shown promising results (Kalchbrenner & Blunsom (2013); Cho et al. (2014); Sutskever et al. (2014)). Bahdanau et al. (2014) further developed an attention mechanism in the decoder in order to pay attention to a specific part of the input at every generating time-step. Our approach also exploits an attention mechanism during decoding.
36
+
37
+ # 2.3 OUT-OF-VOCABULARY AND COPY MECHANISM
38
+
39
+ Dealing with Out-Of-Vocabulary words (OOVs) is an important issue in sequence to sequence approaches as we cannot enumerate all possible words and learn their embeddings since they might not be part of our training set. Luong et al. (2014) address this issue by annotating words on the source, and aligning OOVs in the target with those source words. Recently, Vinyals et al. (2015)
40
+
41
+ ![](images/653fea17ac317937d4d03ec1901f36f8de6b5af657201f58b2b1b20b091388a4.jpg)
42
+ Figure 1: Read-Again Summarization Model
43
+
44
+ propose Pointer Networks, which calculate a probability distribution over the input sequence instead of predicting a token from a pre-defined dictionary. Cheng & Lapata (2016) develop a neural-based extractive summarization model, which predicts the targets from the input sequences. Gulcehre et al. (2016); Nallapati et al. (2016) use explicit gating to decide adaptively wether to generate a target word from the fixed-size dictionary or from the input sequence. Gu et al. (2016) use a implicit implicit gating operation instead of the explicit gating. This is similar to our decoder. However, our decoder can also extract different OOVs’ embedding accordingly from the input text instead of using a single ${ \bf \mathrm { < U N K > } }$ embedding to represent all OOVs. This further enhances the model’s ability to handle OOVs.
45
+
46
+ # 3 THE READ AGAIN MODEL
47
+
48
+ Text summarization can be formulated as a sequence to sequence prediction task, where the input is a longer text and the output is a summary of that text. In this paper we develop an encoder-decoder approach to summarization. The encoder is used to represent the input text with a set of continuous vectors, and the decoder is used to generate a summary word by word.
49
+
50
+ In the following, we first introduce our ‘Read-Again’ model for encoding sentences. The idea behind our approach is very intuitive and is inspired by how humans do this task. When we create summaries, we first read the text and then we do a second read where we pay special attention to the words that are relevant to generate the summary. Our ‘Read-Again’ model implements this idea by reading the input text twice and using the information acquired from the first read to bias the second read. This idea can be seamlessly plugged into LSTM and GRU models. Our second contribution is a copy mechanism used in the decoder. It allows us to reduce the decoder vocabulary size dramatically and can be used to extract a better embedding for OOVs. Fig. 1(a) gives an overview of our model.
51
+
52
+ # 3.1 ENCODER
53
+
54
+ We first review the typical encoder used in machine translation (e.g., Sutskever et al. (2014); Bahdanau et al. (2014)). Let $x = \{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { n } \}$ be the input sequence of words. An encoder sequentially reads each word and creates the hidden representation $h _ { i }$ by exploting a recurrent neural network (RNN)
55
+
56
+ $$
57
+ h _ { i } = \mathrm { R N N } ( \mathbf { x _ { i } } , h _ { i - 1 } ) ,
58
+ $$
59
+
60
+ where $\mathbf { x _ { i } }$ is the word embedding of $x _ { i }$ . The hidden vectors $h = \{ h _ { 1 } , h _ { 2 } , \cdots , h _ { n } \}$ are then treated as the feature representations for the whole input sentence and can be used by another RNN to decode and generate a target sentence. Although RNNs have been shown to be useful in modeling sequences, one of the major drawback is that $h _ { i }$ depends only on past information i.e., $\{ x _ { 1 } , \cdots , x _ { i } \}$ . However, it is hard (even for humans) to have a proper representation of a word without reading the whole input sentence.
61
+
62
+ Following this intuition, we propose our ‘Read-Again’ model where the encoder reads the input sentence twice. In particular, the first read is used to bias the second more attentive read. We apply this idea to two popular RNN architectures, i.e. GRU and LSTM, resulting in better encodings of the input text. Note that although other alternatives, such as bidirectional RNN exist, the hidden states from the forward RNN lack direct interactions with the backward RNN, and thus forward/backward hidden states still cannot utilize the whole sequence. Besides, although we only use our model in a uni-directional manner, it can also be easily adapted to the bidirectional case. We now describe the two variants of our model.
63
+
64
+ ![](images/7583a902ba579cd1e646597ef8cc176db700cc72ce413c7267649ce33a2c585e.jpg)
65
+ Figure 2: Read-Again Model
66
+
67
+ # 3.1.1 GRU READ-AGAIN
68
+
69
+ We read the input sentence $\{ x _ { 1 } , x _ { 2 } , \cdots , x _ { n } \}$ for the first-time using a standard GRU
70
+
71
+ $$
72
+ h _ { i } ^ { 1 } = \mathrm { G R U } ^ { 1 } ( \mathbf { x _ { i } } , h _ { i - 1 } ^ { 1 } ) ,
73
+ $$
74
+
75
+ where the function $G R U ^ { 1 }$ is defined as,
76
+
77
+ $$
78
+ \begin{array} { r l } & { z _ { i } = \sigma ( W _ { z } [ \mathbf { x _ { i } } , h _ { i - 1 } ^ { 1 } ] ) } \\ & { r _ { i } = \sigma ( W _ { r } [ \mathbf { x _ { i } } , h _ { i - 1 } ^ { 1 } ] ) } \\ & { \widetilde { h } _ { i } ^ { 1 } = t a n h ( W _ { h } [ \mathbf { x _ { i } } , r _ { i } \odot h _ { i - 1 } ^ { 1 } ] ) } \\ & { h _ { i } ^ { 1 } = ( 1 - z _ { i } ) \odot h _ { i - 1 } ^ { 1 } + z _ { i } \odot \widetilde { h } _ { i } ^ { 1 } } \end{array}
79
+ $$
80
+
81
+ It consists of two gatings $z _ { i } , r _ { i }$ , controlling whether the current hidden state $h _ { i } ^ { 1 }$ should be directly copied from $h _ { i - 1 } ^ { 1 }$ or should pass through a more complex path $\widetilde { h } _ { i } ^ { 1 }$ .
82
+
83
+ Given the sentence feature vector $h _ { n } ^ { 1 }$ , we then compute an importance weight vector $\alpha _ { i }$ of each word for the second reading. We put the importance weight $\alpha _ { i }$ on the skip-connections as shown in Fig. 2(a) to bias the two information flows: If the current word $x _ { i }$ has a very small weight $\alpha _ { i }$ , then the second read hidden state $h _ { i } ^ { 2 }$ will mostly take the information directly from the previous state $h _ { i - 1 } ^ { 2 }$ , ignoring the influence of the current word. If $\alpha _ { i }$ is close to 1 then it will be similar to a standard GRU, which is only influenced from the current word. Thus the second reading has the following update rule
84
+
85
+ $$
86
+ h _ { i } ^ { 2 } = ( 1 - \alpha _ { i } ) \odot h _ { i - 1 } ^ { 2 } + \alpha _ { i } \odot \mathrm { G R U } ^ { 2 } ( \mathbf { x _ { i } } , h _ { i - 1 } ^ { 2 } ) ,
87
+ $$
88
+
89
+ where $\odot$ means element-wise product. We compute the importance weights by attending $h _ { i } ^ { 1 }$ with $h _ { n } ^ { 1 }$ as follows
90
+
91
+ $$
92
+ \alpha _ { i } = t a n h ( W _ { e } h _ { i } ^ { 1 } + U _ { e } h _ { n } ^ { 1 } + V _ { e } \mathbf { x _ { i } } ) ,
93
+ $$
94
+
95
+ where $W _ { e }$ , $U _ { e }$ , $V _ { e }$ are learnable parameters. Note that $\alpha _ { i }$ is a vector representing the importance of each dimension in the word embedding. Empirically, we find that using a vector is better than a scalar gating. We hypothesize that this is because different dimensions represent different semantic meanings, and a scalar gating mechanism lacks the ability to capture the variances among these dimensions.
96
+
97
+ ![](images/60a53f9808b57076e7e777d401e2e7704cf3b6e00e61e896a2bbfa86eaee9eec.jpg)
98
+ Figure 3: Hierachical Read-Again
99
+
100
+ Combining this with the standard GRU update rule
101
+
102
+ $$
103
+ \mathrm { G R U } ^ { 2 } ( \mathbf { x _ { i } } , h _ { i - 1 } ^ { 2 } ) = ( 1 - z _ { i } ) \odot h _ { i - 1 } ^ { 2 } + z _ { i } \odot \widetilde { h } _ { i } ^ { 2 } ,
104
+ $$
105
+
106
+ we can simplify the updating rule Eq. (4) to get
107
+
108
+ $$
109
+ h _ { i } ^ { 2 } = ( 1 - \alpha _ { i } \odot z _ { i } ) \odot h _ { i - 1 } ^ { 2 } + ( \alpha _ { i } \odot z _ { i } ) \odot \widetilde { h } _ { i } ^ { 2 }
110
+ $$
111
+
112
+ This equations shows that our ‘read-again’ model on GRU is equivalent to replace the GRU cell with a more general gating mechanism that also depends on the feature representation of the whole sentence computed from the first reading pass. We argue that adding this global information could help direct the information flow for the forward pass resulting in a better encoder.
113
+
114
+ # 3.1.2 LSTM READ-AGAIN
115
+
116
+ We now apply the ‘Read-Again’ idea to the LSTM architecture as shown in Fig. 2(b). Our first reading is performed by an $\bar { L } S T M ^ { 1 }$ defined as
117
+
118
+ $$
119
+ \begin{array} { l } { f _ { i } = \sigma ( W _ { f } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { ~ i _ { i } = \sigma ( W _ { i } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { o _ { i } = \sigma ( W _ { o } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { ~ \widetilde C _ { i } = t a n h ( W _ { C } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { ~ C _ { i } = f _ { t } \odot C _ { i - 1 } + i _ { i } \odot \widetilde C _ { i } } \\ { h _ { i } = o _ { i } \odot t a n h ( C _ { i } ) } \end{array}
120
+ $$
121
+
122
+ Different from the GRU architecture, LSTM calculates the hidden state by applying a non-linear activation function to the cell state $C _ { i }$ , instead of a linear combination of two paths used in the GRU. Thus for our second read, instead of using skip-connections, we make the gating functions explicitly depend on the whole sentence vector computed from the first reading pass. We argue that this helps the encoding of the second reading $L S T M ^ { 2 }$ , as all gating and updating increments are also conditioned on the whole sequence feature vector $\left( h _ { i } ^ { 1 } , h _ { n } ^ { 1 } \right)$ . Thus
123
+
124
+ $$
125
+ h _ { i } ^ { 2 } = \mathrm { L S T M } ^ { 2 } ( [ \mathbf { x _ { i } } , h _ { i } ^ { 1 } , h _ { n } ^ { 1 } ] , h _ { i - 1 } ^ { 2 } ) ,
126
+ $$
127
+
128
+ # 3.1.3 READING MULTIPLE SENTENCES
129
+
130
+ In this section we extend our ‘Read-Again’ model to the case where the input sequence has more than one sentence. Towards this goal, we propose to use a hierarchical representation, where each sentence has its own feature vector from the first reading pass. We then combine them into a single vector to bias the second reading pass. We illustrate this in the context of two input sentences, but it is easy to generalize to more sentences. Let $\{ x _ { 1 } , x _ { 2 } , \cdots , x _ { n } \}$ and $\{ x _ { 1 } ^ { \prime } , \cdots , x _ { m } ^ { \bar { \prime } } \}$ be the two input sentences. The first RNN reads these two sentences independently to get two sentence feature vectors $h _ { n } ^ { 1 }$ and $h _ { m } ^ { \prime 1 }$ respectively.
131
+
132
+ Here we investigate two different ways to handle multiple sentences. Our first option is to simply concatenate the two feature vectors to bias our second reading pass:
133
+
134
+ $$
135
+ h _ { i } ^ { 2 } = \mathbf { R N N ^ { 2 } } ( [ \mathbf { x _ { i } } , h _ { i } ^ { 1 } , h _ { n } ^ { 1 } , h _ { m } ^ { \prime 1 } ] , h _ { i - 1 } ^ { 2 } )
136
+ $$
137
+
138
+ $$
139
+ h _ { i } ^ { \prime 2 } = \mathrm { R N N } ^ { 2 } ( [ \mathbf { x } _ { \mathbf { i } } ^ { \prime } , h _ { i } ^ { \prime 1 } , h _ { n } ^ { 1 } , h _ { m } ^ { \prime 1 } ] , h _ { i - 1 } ^ { \prime 2 } )
140
+ $$
141
+
142
+ where $h _ { 0 } ^ { 2 }$ and $h _ { 0 } ^ { \prime 2 }$ are initialized as zero vectors. Feeding $h _ { n } ^ { 1 } , h _ { m } ^ { \prime 1 }$ into the second RNN provides more global information explicitly and helps acquire long term dependencies.
143
+
144
+ The second option we explored is shown in Fig. 3. In particular, we use a non-linear transformation to get a single feature vector $h _ { g l o b a l }$ from both sentence feature vectors:
145
+
146
+ $$
147
+ h _ { g l o b a l } = t a n h ( W _ { r } h _ { n } ^ { 1 } + U _ { r } h _ { m } ^ { \prime 1 } + v _ { r } )
148
+ $$
149
+
150
+ The second reading pass is then
151
+
152
+ $$
153
+ \begin{array} { r l } & { \widetilde { h _ { i } ^ { 2 } } = \mathrm { R N N } ^ { 2 } ( [ \mathbf { x _ { i } } , h _ { i } ^ { 1 } , h _ { n } ^ { 1 } , h _ { g l o b a l } ] , h _ { i - 1 } ^ { 2 } ) } \\ & { \widetilde { h _ { i } ^ { \prime 2 } } = \mathrm { R N N } ^ { 2 } ( [ \mathbf { x _ { i } ^ { \prime } } , h _ { i } ^ { \prime 1 } , h _ { m } ^ { \prime 1 } , h _ { g l o b a l } ] , h _ { i - 1 } ^ { \prime 2 } ) } \end{array}
154
+ $$
155
+
156
+ Note that this is more easily scalable to more sentences. In our experiments both approaches perform similarly.
157
+
158
+ # 3.2 DECODER WITH COPY MECHANISM
159
+
160
+ In this paper we argue that only a small number of common words are needed for generating a summary in addition to the words that are present in the source text. We can consider this as a hybrid approach which combines extractive and abstractive summarization. This has two benefits: first it allow us to use a very small vocabulary size, speeding up inference. Furthermore, we can create summaries which contain OOVs if they are present in the source text.
161
+
162
+ Our decoder reads the vector representations of the input text using an attention mechanism, and generates the target summary word by word. We use an LSTM as our decoder, with a fixed-size vocabulary dictionary $Y$ and learnable word embeddings $\mathbf { Y } \in \mathbf { R } ^ { | Y | \times d i m }$ . At time-step $t$ the LSTM generates a summary word $y _ { t }$ by first computing the current hidden state $s _ { t }$ from the previous hidden state $s _ { t - 1 }$ , previous summary word $y _ { t - 1 }$ and current context vector $c _ { t }$
163
+
164
+ $$
165
+ s _ { t } = L S T M ( [ \mathbf { y _ { t - 1 } } , c _ { t } ] , s _ { t - 1 } ) ,
166
+ $$
167
+
168
+ where the context vector $c _ { t }$ is computed with an attention mechanism on the encoder hidden states:
169
+
170
+ $$
171
+ c _ { t } = \sum _ { i = 1 } ^ { n } \beta _ { i t } h _ { i } ^ { 2 } .
172
+ $$
173
+
174
+ The attention score $\beta _ { i t }$ at time-step $t$ on the $i$ -th word is computed via a soft-max over $o _ { i t }$ , where
175
+
176
+ $$
177
+ o _ { i t } = a t t ( s _ { t - 1 } , h _ { i } ^ { 2 } ) = v _ { a } ^ { T } t a n h ( W _ { a } s _ { t - 1 } + U _ { a } h _ { i } ^ { 2 } ) ,
178
+ $$
179
+
180
+ with $v _ { a }$ , $W _ { a }$ , $U _ { a }$ learnable parameters.
181
+
182
+ A typical way to treat OOVs is to encode them with a single shared embedding. However, different OOVs can have very different meanings, and thus using a single embedding for all OOVs will confuse the model. This is particularly detrimental when using small vocabulary sizes. Here we address this issue by deriving the representations of OOVs from their corresponding context in the input text. Towards this goal, we change the update rule of $\mathbf { y _ { t - 1 } }$ . In particular, if $y _ { t - 1 }$ belongs to a word that is in our decoder vocabulary we take its representation from the word embedding, otherwise if it appears in the input sentence as $x _ { i }$ we use
183
+
184
+ $$
185
+ \mathbf { y _ { t - 1 } } = \mathbf { p _ { i } } = t a n h ( W _ { c } h _ { i } ^ { 2 } + b _ { c } )
186
+ $$
187
+
188
+ where $W _ { c }$ and $b _ { c }$ are learnable parameters. Since $h _ { i } ^ { 2 }$ encodes useful context information of the source word $x _ { i }$ , $p _ { i }$ can be interpreted as the semantics of this word extracted from the input sentence. Furthermore, if $y _ { t - 1 }$ does not appear in the input text, nor in $Y$ , then we represent $\mathbf { y _ { t - 1 } }$ using the ${ \bf \mathrm { < U N K > } }$ embedding.
189
+
190
+ Given the current decoder’s hidden state $s _ { t }$ , we can generate the target summary word $y _ { t }$ . As shown in Fig. 1(b), at each time step during decoding, the decoder outputs a distribution over generating words from $Y$ , as well as over copying a specific word $x _ { i }$ from the source sentence.
191
+
192
+ # 3.3 LEARNING
193
+
194
+ We jointly learn our encoder and decoder by maximizing the likelihood of decoding the correct word at each time step. We refer the reader to the experimental evaluation for more details.
195
+
196
+ # 4 EXPERIMENTAL EVALALUATION
197
+
198
+ In this section, we show results of abstractive summarization on Gigaword (Graff & Cieri (2003); Napoles et al. (2012)) and DUC2004 (Over et al. (2007)) datasets. Our model can learn a meaningful re-reading weight distribution for each word in the input text, putting more emphasis on important verb and nous, while ignoring common words such as prepositions. As for the decoder, we demonstrate that our copy mechanism can successfully reduce the typical vocabulary size by a factor 5 while achieving much better performance than the state-of-the-art, and by a factor of 30 while maintaining the same level of performance. In addition, we provide an analysis and examples of which words are copied during decoding.
199
+
200
+ Dataset and Evaluation Metric: We use the Gigaword corpus to train and evaluate our models. Gigaword is a news corpus where the title is employed as a proxy for the summary of the article. We follow the same pre-processing steps of Rush et al. (2015), which include filtering, PTB tokenization, lower-casing, replacing digit characters with #, replacing low-frequency words with UNK and extracting the first sentence in each article. This results in a training set of $3 . 8 \mathbf { M }$ articles, a validation set and a test set each containing 400K articles. The average sentence length is 31.3 words for the source, and 8.3 words for the summaries. Following the standard protocol we evaluate ROUGE score on 2000 random samples from the test set. As for evaluation metric, we use full-length F1 score on Rouge-1, Rouge-2 and Rouge-L, following Chopra et al. (2016) and Nallapati et al. (2016), since these metrics are less bias to the outputs’ length than full-length recall scores.
201
+
202
+ Implemetation Details: We implement our model in Tensorflow and conduct all experiments on a NVIDIA Titan X GPU. Our models converged after 2-3 days of training, depending on model size. Our RNN cells in all models have 1 layer, 512-dimensional hidden states, and 512-dimensional word embeddings. We use dropout rate of 0.2 in all activation layers. All parameters, except the biases are initialized uniformly with a range of $\sqrt { 3 / d }$ , where $d$ is the dimension of the hidden state (Sussillo & Abbott (2014)). The biases are initialized to 0.1. We use plain SGD to train the model with gradient clipped at 10. We start with an initial learning rate of 2, and halve it every epoch after first 5 epochs. Our max epoch for training is 10. We use a mini-batch size of 64, which is shuffled during training.
203
+
204
+ # 4.1 QUANTITATIVE EVALUATION
205
+
206
+ Table 1: Different Read-Again Model. Ours denotes Read-Again models. C denotes copy mechanism. Ours-Opt-1 and Ours-Opt-2 are the models described in section 3.1.3. Size denotes the size of decoder vocabulary in a model.
207
+
208
+ <table><tr><td>#Input</td><td>Model</td><td>Size</td><td>Rouge-1</td><td>Rouge-2</td><td>Rouge-L</td></tr><tr><td rowspan="7">1 sent</td><td>ABS (baseline)</td><td>69K</td><td>24.12</td><td>10.24</td><td>22.61</td></tr><tr><td>GRU (baseline)</td><td>69K</td><td>26.79</td><td>12.03</td><td>25.14</td></tr><tr><td>Ours-GRU</td><td>69K</td><td>27.26</td><td>12.28</td><td>25.48</td></tr><tr><td>Ours-LSTM</td><td>69K</td><td>27.82</td><td>12.74</td><td>26.01</td></tr><tr><td>GRU (baseline)</td><td>15K</td><td>24.67</td><td>11.30</td><td>23.28</td></tr><tr><td>Ours-GRU</td><td>15K</td><td>25.04</td><td>11.40</td><td>23.47</td></tr><tr><td>Ours-LSTM</td><td>15K</td><td>25.30</td><td>11.76</td><td>23.71</td></tr><tr><td>Ours-GRU (C)</td><td>15K</td><td>27.41</td><td>12.58</td><td>25.74</td></tr><tr><td rowspan="2">2 sent</td><td>Ours-LSTM (C) Ours-Opt-1 (C)</td><td>15K 15K</td><td>27.37 27.95</td><td>12.64</td><td>25.69</td></tr><tr><td></td><td></td><td></td><td>12.65</td><td>26.10</td></tr><tr><td></td><td>Ours-Opt-2 (C)</td><td>15K</td><td>27.96</td><td>12.65</td><td>26.18</td></tr></table>
209
+
210
+ Results on Gigaword: We compare the performances of different architectures and report ROUGE scores in Table 1. Our baselines include the ABS model of Rush et al. (2015) with its proposed vocabulary size as well as an attention encoder-decoder model with uni-directional GRU encoder. We allow the decoder to generate variable length summaries. As shown in Table 1 our Read-Again models outperform the baselines on all ROUGE scores, when using both 15K and 69K sized vocabularies. We also observe that adding the copy mechanism further helps to improve performance: Even though the decoder vocabulary size of our approach with copy (15K) is much smaller than ABS (69K) and GRU (69K), it achieves a higher ROUGE score. Besides, our Multiple-Sentences model achieves the best performance.
211
+
212
+ Table 2: Rouge-N limited-length recall on DUC2004. Size denotes the size of decoder vocabulary in a model.
213
+
214
+ <table><tr><td>Models</td><td>Size</td><td>Rouge-1</td><td>Rouge-2</td><td>Rouge-L</td></tr><tr><td>ZOPIARY (Zajic et al. (2004))</td><td>-</td><td>25.12</td><td>6.46</td><td>20.12</td></tr><tr><td>ABS (Rush et al. (2015))</td><td>69K</td><td>26.55</td><td>7.06</td><td>23.49</td></tr><tr><td>ABS+ (Rush et al. (2015))</td><td>69K</td><td>28.18</td><td>8.49</td><td>23.81</td></tr><tr><td>RAS-LSTM (Chopra et al. (2016))</td><td>69K</td><td>27.41</td><td>7.69</td><td>23.06</td></tr><tr><td>RAS-Elman (Chopra et al. (2016))</td><td>69K</td><td>28.97</td><td>8.26</td><td>24.06</td></tr><tr><td>big-words-lvt2k-1sent (Nallapati et al. (2016))</td><td>69K</td><td>28.35</td><td>9.46</td><td>24.59</td></tr><tr><td>big-words-lvt5k-1sent (Nallapati et al. (2016))</td><td>200K</td><td>28.61</td><td>9.42</td><td>25.24</td></tr><tr><td>Ours-GRU (C)</td><td>15K</td><td>29.08</td><td>9.20</td><td>25.25</td></tr><tr><td>Ours-LSTM (C)</td><td>15K</td><td>29.89</td><td>9.37</td><td>25.93</td></tr><tr><td>Ours-Opt-2 (C)</td><td>15K</td><td>29.74</td><td>9.44</td><td>25.94</td></tr></table>
215
+
216
+ Evaluation on DUC2004: DUC 2004 (Over et al. (2007)) is a commonly used benchmark on summarization task consisting of 500 news articles. Each article is paired with 4 different humangenerated reference summaries, capped at 75 characters. This dataset is evaluation-only. Similar to Rush et al. (2015), we train our neural model on the Gigaword training set, and show the models’ performances on DUC2004. Following the convention, we also use ROUGE limited-length recall as our evaluation metric, and set the capping length to 75 characters. We generate summaries with 15 words using beam-size of 10. As shown in Table 2, our method outperforms all previous methods on Rouge-1 and Rouge-L, and is comparable on Rouge-2. Furthermore, our model only uses $1 5 \mathrm { k }$ decoder vocabulary, while previous methods use $6 9 \mathrm { k }$ or 200k.
217
+
218
+ Importance Weight Visualization: As we described in the section before, $\alpha _ { i }$ is a high-dimension vector representing the importance of each word $x _ { i }$ . While the importance of a word is different over each dimension, by averaging we can still look at general trends of which word is more relevant.indonesia has moved #.# million people and resettl Fig. 4 depicts sample sentences with the importance weight #,### village $\alpha _ { i }$ over input words. Words such asn a national transmigration scheme the, a, ${ \bf \Phi } _ { s }$ , have small $\alpha _ { i }$ , while words such as aeronautics, resettled, impediments, which carry morepast ## years , president suharto said here mo information have higher values. This shows that our read-again technique indeed extracts usefultariffs and other barriers remain serious impediments to information from the first reading to help bias the second reading results.onesia 's state-owned domestic carrier merpati nusantara and business in the asia-p
219
+
220
+ ![](images/539b0be6900581910a2f2c98f2c6c4cb02dad3c5523881834fbd893b85b67305.jpg)
221
+ Figure 4: Weight Visualization. Black indicates high weight
222
+
223
+ # 4.2 EVALUATION OF COPY MECHANISM
224
+
225
+ Table 3 shows the effect on our model of decreasing the decoder vocabulary size. We can see that when using the copy mechanism, we are able to reduce the decoder vocabulary size from 69K to 2K, with only 2-3 points drop on ROUGE score. This contrasts the models that do not use the copy mechanism. Equipped with a copy mechanism, our model is able to generate OOVs as summary words, and thus maintains its expressive ability even with a small decoder vocabulary size. We also observe from Table 4 that the copy mechanism help us to decrease the encoder vocabulary size as well. The model without copy suffers from severe OOV problem when encoder size is small, since a single shared ${ \bf \mathrm { < U N K > } }$ embedding cannot depict many different OOVs. This makes it difficult for the encoder to understand the input text. Meanwhile, our copy model can extract an OOV’s meaning accordingly from its context in the input text, and thus it is sufficient to learn and store only the high-frequency words embeddings using our model, which in turn save the storage. We also notice that shrinking the encoder vocabulary to $1 5 \mathrm { k }$ achieves better result. One possible reason is that long tail words can not learn efficient embeddings during training, and representing them with extracted embedding from our model performs better.
226
+
227
+ Table 3: ROUGE Evaluation for Models with Different Decoder Size and 110k Encoder Size. Ours denotes Read-Again. C denotes copy mechanism.
228
+
229
+ <table><tr><td></td><td colspan="2">Rouge-1</td><td colspan="2">Rouge-2</td><td colspan="2">Rouge-L</td></tr><tr><td>Size</td><td>Ours-LSTM</td><td>Ours-LSTM (C)</td><td>Ours-LSTM</td><td>Ours-LSTM (C)</td><td>Ours-LSTM</td><td>Ours-LSTM(C)</td></tr><tr><td>2K</td><td>14.39</td><td>24.21</td><td>6.46</td><td>11.27</td><td>13.74</td><td>23.09</td></tr><tr><td>5K</td><td>20.61</td><td>26.83</td><td>9.67</td><td>12.66</td><td>19.58</td><td>25.31</td></tr><tr><td>15K</td><td>25.30</td><td>27.37</td><td>11.76</td><td>12.64</td><td>23.74</td><td>25.69</td></tr><tr><td>30K</td><td>26.86</td><td>27.49</td><td>11.93</td><td>12.75</td><td>25.16</td><td>25.77</td></tr><tr><td>69K</td><td>27.82</td><td>27.89</td><td>12.73</td><td>12.69</td><td>26.01</td><td>26.03</td></tr></table>
230
+
231
+ Table 4: ROUGE Evaluation for Models with Different Encoder Size and 15k Decoder Size. Ours denotes Read-Again. C denotes copy mechanism.
232
+
233
+ <table><tr><td colspan="3"></td><td colspan="2">Rouge-2</td><td colspan="2">Rouge-L</td></tr><tr><td>Size</td><td>Ours-LSTM</td><td>Ours-LSTM (C)</td><td>Ours-LSTM</td><td>Ours-LSTM(C)</td><td>Ours-LSTM</td><td>Ours-LSTM(C)</td></tr><tr><td>5K</td><td>21.82</td><td>26.57</td><td>9.80</td><td>11.98</td><td>20.60</td><td>25.00</td></tr><tr><td>15K</td><td>23.84</td><td>27.79</td><td>10.69</td><td>12.54</td><td>22.50</td><td>25.96</td></tr><tr><td>30K</td><td>23.78</td><td>27.48</td><td>10.68</td><td>12.56</td><td>22.28</td><td>25.94</td></tr><tr><td>110K</td><td>25.30</td><td>27.37</td><td>11.76</td><td>12.64</td><td>23.74</td><td>25.69</td></tr></table>
234
+
235
+ Table 5 shows the decoding time as a function of vocabulary size. As computing the soft-max is usually the bottleneck for decoding, reducing vocabulary size dramatically reduces the decoding time from 0.38 second per sentence to 0.08 second.
236
+
237
+ Table 5: Decoding Time (s) per Sentence of Models with Different Decoder Size
238
+
239
+ <table><tr><td>Decoder-Size</td><td>2k</td><td>5k</td><td>15k</td><td>30k</td><td>69k</td></tr><tr><td>Ours-LSTM</td><td>0.076</td><td>0.081</td><td>0.111</td><td>0.161</td><td>0.356</td></tr><tr><td>Ours-LSTM(C)</td><td>0.084</td><td>0.090</td><td>0.123</td><td>0.171</td><td>0.376</td></tr></table>
240
+
241
+ Table 6 provides some examples of visualization of the copy mechanism. Note that we are able to copy key words from source sentences to improve the summary. From these examples we can see that our model is able to copy different types of rare words, such as special entities’ names in case 1 and 2, rare nouns in case 3 and 4, adjectives in case 5 and 6, and even rare verbs in the last example. Note that in the third example, when the copy model’s decoder uses the embedding of headmaster as its first input, which is extracted from the source sentence, it generates the same following sentence as the no-copy model. This probably means that the extracted embedding of headmaster is closely related to the learned embedding of teacher.
242
+
243
+ Table 6: Visualization of Copy Mechanism
244
+
245
+ <table><tr><td>Input: Golden: No Copy: </td><td>air new zealand said friday it had reached agreement to buya ## percent interest inaustralia&#x27;s ansett holdings limited for ### million australian -lrb-### million us dollars -rrb-. urgent air new zealand buys ## percent of australia &#x27;s ansett airlines air nz to buy ## percent stake in australia&#x27;s &lt;unk&gt; air nz to buy ## percent stake in ansett</td></tr><tr><td>Copy: Input: Golden: No Copy: Copy:</td><td>yemen &#x27;s ruling party was expected wednesday to nominate president ali abdullah saleh as its candidate for september &#x27;s presidential election ,although saleh insisted he is not bluffing about bowing out. the #### gmt news advisory yemen &#x27;s ruling party expected to nominate president as presidential candidate yemen &#x27;s ruling party expected to nominate saleh as presidential candidate</td></tr><tr><td>Input: Golden: No Copy: Copy:</td><td>a ##-year-old headmaster who taught children in care homes for more than ## years was jailed for ## years on friday after being convicted of ## sexual assaults against his pupils. britain :headmaster jailed for ## years for paedophilia teacher jailed for ## years for sexuallyabusing childre headmaster jailed for ## years for sexually abusing children</td></tr><tr><td>Input: Golden: No Copy: Copy:</td><td>singapore ’s rapidly ageing population poses the major challenge to fiscal policy in the ##st century, finance minister richard hu said,and warned against european-style state &lt;unk&gt;. ageing population to pose major fiscal challenge to singapore finance minister warns against &lt;unk&gt; state s pore &#x27;s ageing population poses challenge to fiscal policy</td></tr><tr><td>Input: Golden: No Copy:</td><td>angola is planning to refit its ageing soviet-era fleet of military jets in russan factories,a media report said on tuesday. angola to refit jet fighters in russia :report angola to &lt;unk&gt; soviet-era soviet-era fleet</td></tr></table>
246
+
247
+ # 5 CONCLUSION
248
+
249
+ In this paper we have proposed two simple mechanisms to alleviate the problems of current encoderdecoder models. Our first contribution is a ‘Read-Again’ model which does not form a representation of the input word until the whole sentence is read. Our second contribution is a copy mechanism that can handle out-of-vocabulary words in a principled manner allowing us to reduce the decoder vocabulary size and significantly speed up inference. We have demonstrated the effectiveness of our approach in the context of summarization and shown state-of-the-art performance. In the future, we plan to tackle summarization problems with large input text. We also plan to exploit our findings in other tasks such as machine translation.
250
+
251
+ # REFERENCES
252
+
253
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
254
+
255
+ Michele Banko, Vibhu O Mittal, and Michael J Witbrock. Headline generation based on statistical translation. In Proceedings of the 38th Annual Meeting on Association for Computational Linguistics, pp. 318–325. Association for Computational Linguistics, 2000.
256
+
257
+ Jianpeng Cheng and Mirella Lapata. Neural summarization by extracting sentences and words. arXiv preprint arXiv:1603.07252, 2016.
258
+
259
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
260
+
261
+ Sumit Chopra, Michael Auli, Alexander M Rush, and SEAS Harvard. Abstractive sentence summarization with attentive recurrent neural networks. arXiv preprint arXiv:1602.06023, 2016.
262
+
263
+ Trevor Cohn and Mirella Lapata. Sentence compression beyond word deletion. In Proceedings of the 22nd International Conference on Computational Linguistics-Volume 1, pp. 137–144. Association for Computational Linguistics, 2008.
264
+
265
+ Ronan Collobert, Jason Weston, Leon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel ´ Kuksa. Natural language processing (almost) from scratch. Journal of Machine Learning Research, 12(Aug):2493–2537, 2011.
266
+
267
+ Carlos A Colmenares, Marina Litvak, Amin Mantrach, and Fabrizio Silvestri. Heads: Headline generation as sequence prediction using an abstract feature-rich space. 2015.
268
+
269
+ Gunes Erkan and Dragomir R Radev. Lexrank: Graph-based lexical centrality as salience in text ¨ summarization. Journal of Artificial Intelligence Research, 22:457–479, 2004.
270
+
271
+ Katja Filippova and Yasemin Altun. Overcoming the lack of parallel data in sentence compression. In EMNLP, pp. 1481–1491. Citeseer, 2013.
272
+
273
+ David Graff and Christopher Cieri. English giga-word, 2003. Linguistic Data Consortium, Philadeplhia, 2003.
274
+
275
+ Jiatao Gu, Zhengdong Lu, Hang Li, and Victor OK Li. Incorporating copying mechanism in sequence-to-sequence learning. arXiv preprint arXiv:1603.06393, 2016.
276
+
277
+ Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. Pointing the unknown words. arXiv preprint arXiv:1603.08148, 2016.
278
+
279
+ Baotian Hu, Qingcai Chen, and Fangze Zhu. Lcsts: A large scale chinese short text summarization dataset. arXiv preprint arXiv:1506.05865, 2015.
280
+
281
+ Nal Kalchbrenner and Phil Blunsom. Recurrent continuous translation models. In EMNLP, volume 3, pp. 413, 2013.
282
+
283
+ Minh-Thang Luong, Ilya Sutskever, Quoc V Le, Oriol Vinyals, and Wojciech Zaremba. Addressing the rare word problem in neural machine translation. arXiv preprint arXiv:1410.8206, 2014.
284
+
285
+ Ramesh Nallapati, Bowen Zhou, C¸ a glar Gulc¸ehre, and Bing Xiang. Abstractive text summarization using sequence-to-sequence rnns and beyond. 2016.
286
+
287
+ Courtney Napoles, Matthew Gormley, and Benjamin Van Durme. Annotated gigaword. In Proceedings of the Joint Workshop on Automatic Knowledge Base Construction and Web-scale Knowledge Extraction, pp. 95–100. Association for Computational Linguistics, 2012.
288
+
289
+ Joel Larocca Neto, Alex A Freitas, and Celso AA Kaestner. Automatic text summarization using a machine learning approach. In Brazilian Symposium on Artificial Intelligence, pp. 205–215. Springer, 2002.
290
+
291
+ Paul Over, Hoa Dang, and Donna Harman. Duc in context. Information Processing & Management, 43(6):1506–1520, 2007.
292
+ Alexander M Rush, Sumit Chopra, and Jason Weston. A neural attention model for abstractive sentence summarization. arXiv preprint arXiv:1509.00685, 2015.
293
+ Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, 1997.
294
+ David Sussillo and LF Abbott. Random walk initialization for training very deep feedforward networks. arXiv preprint arXiv:1412.6558, 2014.
295
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
296
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015.
297
+ Kam-Fai Wong, Mingli Wu, and Wenjie Li. Extractive summarization using supervised and semisupervised learning. In Proceedings of the 22nd International Conference on Computational Linguistics-Volume 1, pp. 985–992. Association for Computational Linguistics, 2008.
298
+ Kristian Woodsend, Yansong Feng, and Mirella Lapata. Generation with quasi-synchronous grammar. In Proceedings of the 2010 conference on empirical methods in natural language processing, pp. 513–523. Association for Computational Linguistics, 2010.
299
+ David Zajic, Bonnie Dorr, and Richard Schwartz. Bbn/umd at duc-2004: Topiary. In Proceedings of the HLT-NAACL 2004 Document Understanding Workshop, Boston, pp. 112–119, 2004.
md/train/HJfwJ2A5KX/HJfwJ2A5KX.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HJr4QJ26W/HJr4QJ26W.md ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING IMAGE GENERATIVE MODELS WITH HUMAN INTERACTIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ GANs provide a framework for training generative models which mimic a data distribution. However, in many cases we wish to train a generative model to optimize some auxiliary objective function within the data it generates, such as making more aesthetically pleasing images. In some cases, these objective functions are difficult to evaluate, e.g. they may require human interaction. Here, we develop a system for efficiently training a GAN to increase a generic rate of positive user interactions, for example aesthetic ratings. To do this, we build a model of human behavior in the targeted domain from a relatively small set of interactions, and then use this behavioral model as an auxiliary loss function to improve the generative model. As a proof of concept, we demonstrate that this system is successful at improving positive interaction rates simulated from a variety of objectives, and characterize some factors that affect its performance.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative image models have improved rapidly in the past few years, in part because of the success of Generative Adversarial Networks, or GANs (Goodfellow et al., 2014). GANs attempt to train a “generator” to create images which mimic real images, by training it to fool an adversarial “discriminator,” which attempts to discern whether images are real or fake. This is one solution to the difficult problem of learning when we don’t know how to write down an objective function for image quality: take an empirical distribution of “good” images, and try to match it.
12
+
13
+ Often, we want to impose additional constraints on our goal distribution besides simply matching empirical data. If we can write down an objective which reflects our goals (even approximately), we can often simply incorporate this into the loss function to achieve our goals. For example, when trying to generate art, we would like our network to be creative and innovative rather than just imitating previous styles, and including a penalty in the loss for producing recognized styles appears to make GANs more creative (Elgammal et al., 2017). Conditioning on image content class, training the discriminator to classify image content as well as making real/fake judgements, and including a loss term for fooling the discriminator on class both allows for targeted image generation and improves overall performance (Odena et al., 2016).
14
+
15
+ However, sometimes it is not easy to write an explicit objective that reflects our goals. Often the only effective way to evaluate machine learning systems on complex tasks is by asking humans to determine the quality of their results (Christiano et al., 2017, e.g.) or by actually trying them out in the real world. Can we incorporate this kind of feedback to efficiently guide a generative model toward producing better results? Can we do so without a prohibitively expensive and slow amount of data collection? In this paper, we tackle a specific problem of this kind: generating images that cause more positive user interactions. We imagine interactions are measured by a generic Positive Interaction Rate (PIR), which could come from a wide variety of sources.
16
+
17
+ For example, users might be asked to rate how aesthetically pleasing an image is from 1 to 5 stars. The PIR could be computed as a weighted sum of how frequently different ratings were chosen. Alternatively, these images could be used in the background of web pages. We can assess user interactions with a webpage in a variety of ways (time on page, clicks, shares, etc.), and summarize these interactions as the PIR. In both of these tasks, we don’t know exactly what features will affect the PIR, and we certainly don’t know how to explicitly compute the PIR for an image. However, we can empirically determine the quality of an image by actually showing it to users, and in this paper we show how to use a small amount of this data (results on 1000 images) to efficiently tune a generative model to produce images which increase PIR. In this work we focus on simulated PIR values as a proof of concept, but in future work we will investigate PIR values from real interactions.
18
+
19
+ ![](images/ec679fbe76f983e591cddbdeceb8798f656c1b196c970471f04538046cd10173.jpg)
20
+ Figure 1: Diagram of our system
21
+
22
+ # 2 APPROACH
23
+
24
+ The most straight-forward way to improve an image GAN might be to evaluate the images the model produces with real users at each training step. However, this process is far too slow. Instead, we want to be able to collect a batch of PIR data on a batch of images, and then use this batch of data to improve the generative model for many gradient steps; we want to do this despite the fact that the images the generator is producing may evolve to be very different from the original images we collected PIR data on. In order to do this, we use the batch of image and PIR data to train a “PIR Estimator Model” which predicts PIRs on images. We then use these estimated PIRs at each step as a loss.
25
+
26
+ Our approach is inspired by the work of Christiano and colleagues (Christiano et al., 2017), who integrated human preference ratings between action sequences into training of a reinforcement learning model by using the preference data to estimate a reward function. However, our problem and approach differ in several key ways. First, we are optimizing a generative image model rather than a RL model. This is more difficult in some ways, since the output space is much higher-dimensional than typical RL problems, which means that scalar feedback (like a PIR) may be harder for the system to learn from. This difficulty is partially offset by the fact that we assume we get “reward” (PIR) information for an image when we evaluate, instead of just getting preferences which we have to map to rewards. Perhaps most importantly, we use our PIR estimation model as a fully-differentiable loss function for training, instead of just using its estimated rewards. This allows us to more effectively exploit its knowledge of the objective function (but risks overfitting).
27
+
28
+ Our system consists of three components: A generative image model, users who interact with the generated images in some way, and a PIR estimator that models user interactions given an image. See Fig. 1 for a diagram of the system’s general operation. The generative model produces images, which are served to users. Using interaction data from these users, we train the PIR estimator model, which predicts PIRs given a background image, and then incorporate this estimated PIR into the loss of the generative model to tune it to produce higher quality images. Below, we discuss each of these components in more detail.
29
+
30
+ # 2.1 GENERATIVE MODEL
31
+
32
+ We begin with a $\mathrm { G A N ^ { 1 } }$ (Goodfellow et al., 2014) which we pre-trained to produce images from a target distribution (specifically, landscapes of mountains and coasts). Let $D _ { \mathrm { s o u r c e } }$ be the source estimated by the discriminator, $G$ the generator, and $z$ a noise input to the generator sampled from a multivariate standard normal distribution $\mathcal { N } ( 0 , I )$ , and $\mathcal { T }$ be the set of real images shown to the discriminator. Define:
33
+
34
+ $$
35
+ \begin{array} { r l r } { L _ { \mathrm { f a k e i m a g e } } = } & { } & { E _ { z \sim \mathcal { N } ( 0 , I ) } \left[ \log P ( D _ { \mathrm { s o u r c e } } ( G ( z ) ) = \mathrm { f a k e } ) \right] } \\ { L _ { \mathrm { f a k e i m a g e f o o l s } } = } & { } & { E _ { z \sim \mathcal { N } ( 0 , I ) } \left[ \log P ( D _ { \mathrm { s o u r c e } } ( G ( z ) ) = \mathrm { r e a l } ) \right] } \\ { L _ { \mathrm { r e a l i m a g e } } = } & { } & { E _ { i \sim \mathcal { Z } } \left[ \log P ( D _ { \mathrm { s o u r c e } } ( i ) = \mathrm { r e a l } ) \right] } \end{array}
36
+ $$
37
+
38
+ Then the discriminator and generator are trained to maximize the following losses (respectively), where the $w _ { * }$ are weights set as hyperparameters:
39
+
40
+ $$
41
+ \begin{array} { r l r } { L _ { \mathrm { d i s c r i m i n a t o r } } = } & { { } } & { L _ { \mathrm { f a k e i m a g e } } + L _ { \mathrm { r e a l i m a g e } } } \\ { L _ { \mathrm { G e n e r a t o r } } = } & { { } } & { L _ { \mathrm { f a k e i m a g e f o o l s } } } \end{array}
42
+ $$
43
+
44
+ Note that there is a difference between these losses and the standard GAN formulation given in (Goodfellow et al., 2014) – we maximize $L _ { \mathrm { f a k e } }$ image fools $= \ \log \ P$ (classified real) rather than minimizing $\log { ( 1 - P }$ (classified real)). This seems to result in the generation of slightly better images in practice.
45
+
46
+ This GAN was trained on a dataset consisting of landscape images of mountains and coastlines (see Appendix C.2 for details of the architecture and training). It is worth noting that this generative model is not photorealistic (see Fig. 3a for some samples). Its expressive capacity is limited, and it has clear output modes with limited intra-mode variability. However, for our purposes this may not matter. Indeed, it is in some ways more interesting if we can tweak this model to optimize for many objective functions, since its limited expressive capacity will make it more difficult for us to estimate and pursue the real objective – a limited set of images will effectively give us fewer points to estimate the PIR function from, and will reduce the space in which the model can easily produce images, thus reducing the possibility of getting very optimal images from the model. For example, a model which produces images of birds may not produce data points which provide good estimates of a PIR based on how much the image looks like a car, and even if it could, it may not be able to produce images which are “more car-like.” If we are able to succeed in improving PIRs with this generative model, it is likely that a better generative model would yield even better results.
47
+
48
+ # 2.2 USER INTERACTIONS
49
+
50
+ We will show these images to users in a variety of ways, depending on our target domain. For the purposes of this paper, however, we will use simulated interaction data (see Section 3 for details). Of course, since showing images to users is an expensive prospect, we wanted to limit the size of the datasets we used to train the model. Typical datasets used to train vision models are on the order of millions of images, (e.g. ImageNet (Russakovsky et al., 2015)), but it is completely infeasible to collect user data on this number of images. We estimated that we could show 1000 images each 1000 times to generate our datasets. We used these dataset sizes and number of impressions for all experiments discussed here, and added noise to the PIRs that was binomially distributed according to the number of times each image was shown and the “true” PIR simulate from the objective.
51
+
52
+ # 2.3 PIR ESTIMATOR MODEL
53
+
54
+ The final component of our system is the PIR estimator model, which learns to predict PIR from a background image. We denote this model by $R : { \mathrm { i m a g e } } [ 0 , 1 ]$ . We parameterize this model as a deep neural network. Specifically, we take the Inception v2 architecture (Szegedy et al., 2016), remove the output layer, and replace it with a fully-connected layer to PIR estimates. We initialize the Inception v2 parameters from a version of the model trained on [dataset redacted for blind review]. See Appendix C.3 for more details.
55
+
56
+ Why did we not make estimated PIR simply another auxiliary output from the discriminator, like class in the ACGAN (Appendix C.1)? Because the PIR estimator needs to be held constant in order to provide an accurate training objective. If the PIR estimates were produced by the discriminator, then as the discriminator changed to accurately discriminate the evolving generator images, the PIR estimates would tend to drift without a ground-truth to train them on. Separating the discriminator and the PIR estimator allows us to freeze the PIR estimator while still letting the discriminator adapt.
57
+
58
+ # 2.4 INTEGRATION
59
+
60
+ Once we have trained a PIR estimator model, we have to use it to improve the GAN. We do this as follows. Let $R$ denote the PIR estimator model, as above. Define $L _ { \mathrm { P I R } }$ to be the expectation of the estimated PIR produced over images sampled from the generator:
61
+
62
+ $$
63
+ { \cal L } _ { \mathrm { P I R } } = { \cal E } _ { z \sim { \cal N } ( 0 , I ) , c \sim { \cal C } } \left[ R ( G ( z ) ) \right]
64
+ $$
65
+
66
+ Then we simply supplement the generator loss by adding this term times a weight $w _ { P I R }$ , set as a hyperparameter:
67
+
68
+ $$
69
+ L _ { \mathrm { G e n e r a t o r } } = L _ { \mathrm { f a k e i m a g e f o o l s } } + w _ { P I R } L _ { P I R }
70
+ $$
71
+
72
+ We set $w _ { P I R } = 1 0 0 0$ as this made the magnitude of the PIR loss and the other loss terms roughly comparable. Otherwise we used the same parameters as in the GAN training above, except that we reduced the learning rate to $1 0 ^ { - 6 }$ to allow the system to adapt more smoothly to the multiple objectives, and we trained for 50,000 steps.
73
+
74
+ # 3 DATA
75
+
76
+ In this paper, we use simulated interaction data as proof of concept. This raises an issue: what functions should we use to simulate user interactions? Human behavior is complex, and if we already knew precisely what guided user interactions, there would be no need to actually collect human behavioral data at all. Since we don’t know what features will guide human behavior, the next best thing we can do is to ensure that our system is able to alter the image generation model in a broad variety of ways, ranging from low level features (like making the images more colorful) to altering complex semantic features (such as including more plants in outdoor scenery). We also want to avoid hand-engineering tasks to the greatest extent possible. We present an overview of our approaches to simulating PIR data below, see Appendix C.4 for more details.
77
+
78
+ # 3.1 VGG FEATURES
79
+
80
+ The first approach we took to evaluating our system’s ability to train for different features was to use activity from hidden layers of a computer vision model, specifically VGG 16 (Simonyan & Zisserman, 2014) trained on ImageNet (Russakovsky et al., 2015). In particular, we took the activity of a single filter in a layer of VGG relative to the overall activity of that layer. This approach to simulating PIRs has several benefits. First, it gives a wide variety of complex objectives that can nevertheless be easily computed to simulate data. Second, models like VGG exhibit hierarchical organization, where lower levels generally respond to lower-level features such as edges and colors, while higher levels respond to higher-level semantic features such as faces (Zeiler & Fergus, 2014), and the represented features relate to those in human and macaque visual cortex (Yamins et al., 2014). Thus VGG features give a wide range of objectives which we may relate to the human perception we wish to target.
81
+
82
+ There are some caveats to this approach, however. First, although the higher layers of CNNs are somewhat selective for “abstract” object categories, they are also fooled by adversarial images that humans would not be, and directly optimizing inputs for these high level features does not actually produce semantically meaningful images (Nguyen et al., 2014). Thus, even if our system succeeds in increasing activity in a targeted layer which is semantically selective, it will likely do so by adversarially exploiting particulars of VGG 16’s parameterization of the classification problem (although the fact that we are not backpropagating through the true objective will make this harder). It is not necessarily a failure of the system if it exploits simple features of the objective it is given to increase PIRs – indeed, it should be seen as a success, as long as it is generalizes to novel images. However, success on this task does not necessarily guarantee success on modifying semantic content when interacting with actual humans. It may be easier for the PIR estimator model (which is based on a CNN) to learn objectives which come from another CNN than more general possible objectives. The fact that adversarial examples can sometimes transfer between networks with different architectures (Liu et al., 2016) suggests that the computations being performed by these networks are somewhat architecture invariant. Thus CNN objectives may be easier for our estimator than human ones.
83
+
84
+ We have tried to minimize these problems to the greatest extent possible by using different network architectures (Inception V2 and VGG 16, respectively) trained on different datasets ([hidden] and ImageNet (Russakovsky et al., 2015), respectively) for the estimator and the objective. However, we cannot be certain that the network is not “cheating” in some way on the VGG 16 tasks, so our results must be considered with this qualification in mind. Despite this, we think that evaluating our system’s ability to optimize for objectives generated from various layers of VGG will show its ability to optimize for a variety of complex objectives, and thus will serve as a useful indicator of its potential to improve PIRs from real users.
85
+
86
+ # 3.2 MULTIPLE FILTERS
87
+
88
+ After using our system on the tasks above, we noted that its performance was quite poor at layers 5, 6, and 7 of VGG compared to other tasks (see Fig. 2). This could suggest that our system was unable to capture the complex features represented at the higher levels of VGG. However, we also noticed that the feature representations at these layers tended to be quite sparse, so many of the simulated PIRs we generated were actually zero to within the bin width of our PIR estimator (see Appendix B Fig. 8 for a plot of how this affected learning). In order to evaluate whether the poor performance of our system at the higher layers of VGG was due to the number of zeros or to the complexity of the features, we created less sparse features from these layers by simply targeting a set of $k$ filters sampled without replacement from the layer, rather than a single filter. The single filter cases above can be thought of as a special case of this, where $k = 1$ . To complement these, we also tried $k = 2 0$ .
89
+
90
+ This can also be thought of as perhaps a more realistic simulation of human behavior, in the sense that it is highly unlikely that there is a single feature which influences human PIRs. Rather, there are probably many related features which influence PIR in various ways. Thus it is important to evaluate our system’s ability to target these types of features as well.
91
+
92
+ # 3.3 COLORS
93
+
94
+ Finally, we also considered some simpler objectives based on targeting specific colors in the output images, or targeting vertical bands of two different colors, one in each half of the image, or three colors, one in each third of the image. These objectives provide a useful complement to the VGG objectives above. Although the single color objectives may be relevant to the classification task VGG 16 performs, the split color tasks are less likely to be relevant to classification. Note that it is important that we split the images along the width instead of the height dimension, as there may well be semantically relevant features corresponding to color divisions along the height dimension, e.g. a blue upper half and green lower half likely correlates with outdoor images, which would provide useful class information. By contrast, it is harder to imagine circumstances where different colors on the left and right halves of the image are semantically predictive, especially since flipping left to right is usually included in the data augmentation for computer vision systems. Thus success on optimizing for these objectives would increase our confidence in the generality of our system.
95
+
96
+ # 4 RESULTS
97
+
98
+ We present our results in terms of the change in mean PIR from 1000 images produced by the GAN before tuning to 1000 images produced after tuning, or in terms of the effect size of this change (Cohen’s $d$ , i.e. the change in mean PIR standardized by the standard deviation of the PIRs in the pre- and post-tuning image sets). We assess whether these changes are significant by performing a Welch’s t-test (with a significance threshold of $\alpha = 0 . 0 0 1$ ) between the pre- and post-tuning PIRs.
99
+
100
+ Overall, our system was quite successful at improving PIRs across a range of simulated objective functions (see Fig. 2). Below, we discuss these results in more detail.
101
+
102
+ ![](images/452a4c3d84260f277ccf32fa578a0b0396ce5df970f4fe40eb77375a745ada9e.jpg)
103
+ Figure 2: Effect size (number of standard deviations change in mean PIR) on a variety of tasks. Values greater than zero indicate improvement. Each panel represents a set of tasks (such as single filters from VGG), each color/column represents a subset (such as a single layer within VGG), and each point represents one objective (such as a single filter from that layer) for which we optimized the generative model. Points for which the change in mean PIR is not significant by a Welch’s $t$ -test with a threshold of $\alpha = 0 . 0 0 1$ are partially transparent.
104
+
105
+ # 4.1 VGG OBJECTIVES
106
+
107
+ Our system largely succeed at increasing PIRs on a variety of VGG objectives (see Fig. 2). However, there are several interesting patterns to note. First, the system is not particularly successful at targeting single filters from the pool5, fc6, and fc7 layers. However, we believe this is due to the fact that filters in these layers produce relatively sparse activation, see section 3.2. Indeed, the performance of the system seems much more consistent when it is optimizing for sets of 20 filters than for single filters.
108
+
109
+ Even when using 20 filters, however, there is a noticeable decline in the effect size of the improvement the system is able to make at higher layers of VGG $\beta = - 0 . 1 3$ per layer, $t = - 7 . 8$ , $\dot { p } < 1 0 ^ { - 1 0 }$ in a linear model controlling for initial standard deviation and percent zeros). This suggests that as the objectives grow more complex, the system may be finding less accurate approximations to them. However, the system’s continuing (if diminished) success at the higher layers of VGG suggests that our model is capable of at least partially capturing complex objective functions.
110
+
111
+ # 4.2 COLOR OBJECTIVES
112
+
113
+ Overall, the system performed quite well at optimizing for the color objectives, particularly the single and two-color results (see Fig. 2). It had more difficulty optimizing for the three-color results, and indeed had produced only very small improvements after the usual 50,000 tuning steps for the generative model, but after 500,000 steps it was able to produce significant improvements for two out of the three objectives (these longer training results are the ones included here).
114
+
115
+ Because the color objectives are easiest to assess visually, we have included results for a variety of these objectives in Fig. 3. For the single color objectives, the improvement is quite clear, for example the images in Fig. 3d appear much more blue than the pre-training ones. For the two color objectives, it appears that the system found the “trick” of reducing the third color, for example the red-green split images in Fig. 3e appear much less blue than the pre-training images. Even on the three-color images where the system struggled, there are some visible signs of improvement, for example on the green-blue-red task the system has started producing a number of images with a blue streak in the middle.
116
+
117
+ ![](images/a677d9bfd60d90b339e6056f4eedc86e60ca0e0077525f722cfbef7db0088cd1.jpg)
118
+ Figure 3: Color objective sample images. Samples are randomly drawn, not cherry-picked.
119
+
120
+ # 4.3 SUPPLEMENTAL ANALYSES
121
+
122
+ We also conducted several supplemental analyses which can be found in detail Appendix A. In summary, the initial variability in the PIR of the images used to train the system is strongly correlated with the amount of improvement the system makes in the PIR, the system fairly consistently underestimates the performance it achieves (because of a detail of training procedure, see the Appendix), and iterating the process of improving PIRs yields better results for objectives from a lower layer of VGG but not a higher.
123
+
124
+ # 5 DISCUSSION
125
+
126
+ Overall, our system appears to be relatively successful. It can optimize a generative model to produce images which target a wide variety of objectives, ranging from low-level visual features such as colors and early features of VGG to features computed at the top layers of VGG. This success across a wide variety of objective functions allows us to be somewhat confident that our system will be able to achieve success in optimizing for real human interactions.
127
+
128
+ Furthermore, the system did not require an inordinate amount of training data. In fact, we were able to successfully estimate many different objective functions from only 1000 images, several orders of magnitude fewer than is typically used to train CNNs for vision tasks. Furthermore, these images came from a very biased and narrow distribution (samples from our generative model) which is reflective of neither the images that were used to pre-train the Inception model in the PIR estimator, nor the images the VGG model (which produced the simulated objectives) was trained on. Our success from this small amount of data suggests that not only will our system be able to optimize for real human interactions, it will be able to do so from a feasible number of training points.
129
+
130
+ These results are exciting – the model is able to approximate apparently complex objective functions from a small amount of data, even though this data comes from a very biased distribution that is unrelated to most the objectives in question. But what is really being learned? In the case of the color images, it’s clear that the model is doing something close to correct. However, for the objectives derived from VGG we have no way to really assess whether the model is making the images better or just more adversarial. For instance, when we are optimizing for the logit for “magpie,” it’s almost certainly the case that the result of this optimization will not look more like a magpie to a human, even if VGG does rate the images as more “magpie-like.” On the other hand, this is not necessarily a failure of the system – it is accurately capturing the objective function it is given. What remains to be seen is whether it can capture how background images influence human behavior as well as it can capture the vagaries of deep vision architectures.
131
+
132
+ We believe there are many domains where a system similar to ours could be useful. We mentioned producing better webpage backgrounds and making more aesthetic images above, but there are many potential applications for improving GANs with a limited amount of human feedback. For example, a model could be trained to produce better music (e.g. song skip rates on streaming generated music could be treated as inverse PIRs).
133
+
134
+ # 5.1 TRADING IMAGE DIVERSITY FOR PIR
135
+
136
+ When tuning the GAN, the decrease in the PIR loss is usually accompanied by an increase in the generator loss, and often by a partial collapse of the generator output (for example, the optimized images generally seem to have fewer output modes than the pre-training images in Fig. 3). This is not especially surprising – because we weighted the PIR loss very highly, the model is rewarded for trading some image diversity for image optimality. Depending on the desired application, the weight on the PIR loss could be adjusted as necessary to trade off between producing images close to the data distribution and optimizing PIR. At its most extreme, one could down-weight the generator loss entirely, and train until the model just produces a single optimal image. However, the generator likely provides some regularization by constraining the images to be somewhat close to the real images, which will reduce overfitting to an imperfect estimate of the PIR function. Furthermore, in many settings we will want to generate a variety of images (e.g. backgrounds for different websites). For these reasons, we chose to keep the generator loss when tuning the GAN.
137
+
138
+ # 5.2 FUTURE DIRECTIONS
139
+
140
+ There are a number of future directions suggested by this work. A number of possible improvements are discussed in Appendix C.5. However, we also think this work has potential applications from the perspective of distillation or imitation approaches, which attempt to train one network to emulate another (Hinton et al., 2015; Parisotto et al., 2015, e.g), as well as from the perspective of understanding the computations that these vision architectures perform. As far as we are aware, these results are the first to show that a deep vision model can be tuned rapidly from relatively little data to produce outputs which accurately emulate the behavior of hidden layers of another deep vision architecture trained on a different dataset. This suggests both that the inductive biases shared among these architectures are causing them to find similar solutions (which is also supported by work on transferable adversarial examples (Liu et al., 2016, e.g.)), and that these networks final layers represent the computations of earlier hidden layers in a way that is somewhat accessible. It’s possible that using our system with objectives from CNN layers as we did here might help to understand the features those layers are attending to, by analyzing the distribution of images that are produced. In this sense, our system can be thought of as offering a new approach to multifaceted feature visualization (Nguyen et al., 2016), because our system attempts to optimize a distribution of images for an objective and encourages diversity in the distribution produced, rather than just optimizing a single image.
141
+
142
+ # 6 CONCLUSIONS
143
+
144
+ We have described a system for efficiently tuning a generative image model according to a slow-toevaluate objective function. We have demonstrated the success of this system at targeting a variety of objective functions simulated from different layers of a deep vision model, as well as from low-level visual features of the images, and have shown that it can do so from a small amount of data. We have quantified some of the features that affect its performance, including the variability of the training PIR data and the number of zeros it contains. Our system’s success on a wide variety of objectives suggests that it will be able to improve real user interactions, or other objectives which are slow and expensive to evaluate. This may have many exciting applications, such as improving machine-generated images, music, or art.
145
+
146
+ # REFERENCES
147
+
148
+ Paul Christiano, Jan Leike, Tom B Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. arXi, 2017.
149
+
150
+ Ahmed Elgammal, Bingchen Liu, Mohamed Elhoseiny, and Marian Mazzone. CAN: Creative Adversarial Networks Generating ”Art” by Learning About Styles and Deviating from Style Norms. arXiv, (Iccc):1–22, 2017.
151
+
152
+ Ij Goodfellow, J Pouget-Abadie, and Mehdi Mirza. Generative Adversarial Networks. arXiv, pp. 1–9, 2014. ISSN 10495258. doi: 10.1001/jamainternmed.2016.8245.
153
+
154
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the Knowledge in a Neural Network. arXiv, pp. 1–9, 2015. ISSN 0022-2488. doi: 10.1063/1.4931082.
155
+
156
+ Diederik P Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. Iclr, pp. 1–15, 2015. ISSN 09252312. doi: http://doi.acm.org.ezproxy.lib.ucf.edu/10.1145/1830483.1830503.
157
+
158
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into Transferable Adversarial Examples and Black-box Attacks. arXiv, (2):1–24, 2016.
159
+
160
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep Neural Networks are Easily Fooled: High Confidence Predictions for Unrecognizable Images. arXiv, 2014. doi: 10.1109/CVPR.2015. 7298640.
161
+
162
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Multifaceted Feature Visualization: Uncovering the Different Types of Features Learned By Each Neuron in Deep Neural Networks. arXiv, 2016.
163
+
164
+ Anh Nguyen, Jason Yosinski, Yoshua Bengio, Alexey Dosovitskiy, and Jeff Clune. Plug $\{ \& \}$ Play Generative Networks: Conditional Iterative Generation of Images in Latent Space. ICCV, (3):33, 2017. doi: 10.1109/CVPR.2017.374.
165
+
166
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional Image Synthesis With Auxiliary Classifier GANs. arXiv, pp. 1–14, 2016. ISSN 1938-7228.
167
+
168
+ Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Actor-Mimic: Deep Multitask and Transfer Reinforcement Learning. arXiv, pp. 1–16, 2015.
169
+
170
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision, 115(3): 211–252, 2015. ISSN 15731405. doi: 10.1007/s11263-015-0816-y.
171
+
172
+ Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv, pp. 1–10, 2014. ISSN 09505849. doi: 10.1016/j.infsof.2008.09.005.
173
+
174
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the Inception Architecture for Computer Vision. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818–2826, 2016. ISSN 08866236. doi: 10.1002/2014GB005021.
175
+
176
+ Daniel L K 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 of the United States of America, 111(23): 8619–8624, 2014. ISSN 1091-6490. doi: 10.1073/pnas.1403112111.
177
+
178
+ Matthew D Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks arXiv:1311.2901v3 [cs.CV] 28 Nov 2013. Computer Vision–ECCV 2014, 8689:818–833, 2014. ISSN 978-3-319-10589-5. doi: 10.1007/978-3-319-10590-1 53.
179
+
180
+ ![](images/98240ce4438c7e3b31bfe707d1ab0bc9c597be9cf48d72834b5da56731a9b559.jpg)
181
+ Figure 4: Change in mean PIR vs. estimated change in mean PIR. Points for which the change in mean PIR is not significant by a Welch’s $t$ -test with a threshold of $\alpha = 0 . 0 0 1$ are partially transparent.
182
+
183
+ ![](images/4b39472a7f5980f4b2ddf37b5e22ac2583f56e4f0262421e27809b90bbe04416.jpg)
184
+ Figure 5: Change in mean PIR vs. initial variability. Points for which the change in mean PIR is not significant by a Welch’s $t$ -test with a threshold of $\alpha = 0 . 0 0 1$ are partially transparent.
185
+
186
+ # A OTHER ANALYSES
187
+
188
+ # A.1 INTROSPECTION
189
+
190
+ Because $L _ { P I R }$ is just the expected value of the PIR, by looking at $L _ { P I R }$ before and after tuning the generative model, we can tell how well the system thinks it is doing, i.e. how much it estimates that it improved PIR. This comparison reveals the interesting pattern that the system is overly pessimistic about its performance. In fact, it tends to underestimate its performance by a factor of more than 1.5 $\beta = 1 . 6 7$ when regressing change in mean PIR on predicted change in mean PIR, see Fig. 4). However, it does so fairly consistently. This effect appears to be driven by the system consistently underestimating the (absolute) PIRs, which is probably caused by our change in the softmax temperature between training the PIR estimator and tuning the generative model (which we empirically found improves performance, as noted above).
191
+
192
+ This is in contrast to the possible a priori expectation that the model would systematically overestimate its performance, because it is overfitting to an imperfectly estimated objective function. Although decreasing the softmax temperature between training and using the PIR obscures this effect, we do see some evidence of this; the more complex objectives (which the system produced lower effect sizes on) seem to both have lower estimated changes in mean PIR and true changes in PIR which are even lower than the estimated ones (see Fig. 4). Thus although the system is somewhat aware of its reduced effectiveness with these objectives (as evidenced by the lower estimates of change in mean PIR), it is not reducing its estimates sufficiently to account for the true difficulty of the objectives (as evidenced by the fact that the true change in PIR is even lower than the estimates). However, the system was generally still able to obtain positive results on these objectives (see Fig. 2).
193
+
194
+ # A.2 INITIAL VARIABILITY
195
+
196
+ There is a general trend (see Fig. 5) that the variability in PIR in the initial dataset is strongly positively related with the change in PIR the system is able to produce $\beta = 0 . 9 9$ , $t = 1 0 . 6$ , $p \bar { < } \bar { 1 0 } ^ { - 1 0 }$ , in a linear model controlling for initial mean PIR and initial percent of values that are zero). In fact, initial standard deviation explains about $50 \%$ of the variance in the change in mean PIR. This is perhaps not too surprising – more variability means that the generative model has capacity to produce higher PIR images without too much tweaking, and that the PIR estimator model gets a wider range of values to learn from. Still, when attempting to use this system in practice, it is important to keep in mind that starting with a sufficiently expressive generative model will more likely produce better results than starting with a more limited model.
197
+
198
+ ![](images/881a640f7021a2d81e1a10fbb7a3eae014fc91ad5806b8582eceaadd61ac6fd7.jpg)
199
+ Figure 6: Effect size evolution over two iterations
200
+
201
+ # A.3 ITERATION
202
+
203
+ Given that our model improves PIRs, an obvious question is whether we can iterate the process. Once we have increased PIRs, can we train a new PIR estimator on samples from our new generative model, and use that to increase PIRs again? If we could iterate this many times, we might be able to create much larger improvements in PIR than we can on a single step. On the other hand, it is possible that after a single step of optimization we will effectively have saturated the easily achievable improvement in the model, and further steps will not result in much improvement.
204
+
205
+ To evaluate this, we took the subset of models trained on single filters from VGG layers pool2 and fc8, and used the set of images generated from the post-tuning model along with the original set of images to tune their PIR estimators for another 25,000 steps, and then tuned the generative model using this updated PIR estimator for another 50,000 steps. We then evaluated them as before, see Fig. 6 for the results. The second iteration results were mixed, while the pool2 models all improved from the first step to the second, none of them improved as much as they had on the first step, and many of the fc8 models actually performed worse after the second step. However, it is possible that further hyperparameter tuning could improve these results, and it is certainly the case that running multiple steps of iteration and selecting the best model by experimentation could yield better results, so this is worth investigating further.
206
+
207
+ ![](images/bb5568a77c88b87dcfddadac91fed93fcab073ec0eaf412bb76545bbf1d6be46.jpg)
208
+ Figure 7: Change in mean PIR on a variety of tasks. Each panel represents a set of tasks (such as single filters from VGG), each color/column represents a subset (such as a single layer within VGG), and each point represents one objective (such as a single filter from that layer) for which we optimized the generative model. Points for which the change in mean PIR is not significant by a Welch’s $t$ -test with a threshold of $\alpha = 0 . 0 0 1$ are partially transparent.
209
+
210
+ # C DETAILED METHODS
211
+
212
+ # C.1 ACGAN
213
+
214
+ We describe our results using the standard GAN framework for clarity, but we actually used an ACGAN (Odena et al., 2016), which allows for conditioning for various user-specific features. This requires the following adjustments. Defining $\mathcal { C }$ to be the set of possible classes and $\mathcal { T } _ { c }$ to be the set of real images corresponding to a class $c \in { \mathcal { C } }$ :
215
+
216
+ $$
217
+ \begin{array} { r l r } { L _ { \mathrm { f a k e i m a g e } } = } & { } & { E _ { z \sim \mathcal { N } ( 0 , I ) , c \sim \mathcal { C } } \left[ \log P ( D _ { \mathrm { s o u r c e } } ( G ( z , c ) ) = \mathrm { f a k e } ) \right] } \\ { L _ { \mathrm { f a k e i m a g e ~ f o o l s } } = } & { } & { E _ { z \sim \mathcal { N } ( 0 , I ) , c \sim \mathcal { C } } \left[ \log P ( D _ { \mathrm { s o u r c e } } ( G ( z , c ) ) = \mathrm { r e a l } ) \right] } \\ { L _ { \mathrm { r e a l ~ i m a g e } } = } & { } & { E _ { c \sim \mathcal { C } , i \sim \mathcal { L } _ { c } } \left[ \log P ( D _ { \mathrm { s o u r c e } } ( i ) = \mathrm { r e a l } ) \right] } \\ { L _ { \mathrm { f a k e i m a g e c l a s s } } = } & { } & { E _ { z \sim \mathcal { N } ( 0 , I ) , c \sim \mathcal { C } } \left[ \log P ( D _ { \mathrm { c l a s s } } ( G ( z , c ) ) = c ) \right] } \\ { L _ { \mathrm { r e a l ~ i m a g e c l a s s } } = } & { } & { E _ { c \sim \mathcal { C } , i \sim \mathcal { Z } _ { c } } \left[ \log P ( D _ { \mathrm { c l a s s } } ( i ) = c ) \right] } \end{array}
218
+ $$
219
+
220
+ Then the discriminator and generator losses are modified as follows (letting $w _ { f a k e c l a s s } = 1 . 5$ and $w _ { r e a l c l a s s } = 1 . 0 \AA$ :
221
+
222
+ $$
223
+ \begin{array} { r l r } { L _ { \mathrm { d i s c r i m i n a t o r } } = } & { { } } & { L _ { \mathrm { f a k e ~ i m a g e } } + L _ { \mathrm { r e a l ~ i m a g e } } + w _ { r e a l c l a s s } L _ { \mathrm { r e a l ~ c l a s s } } } \\ { L _ { \mathrm { G e n e r a t o r } } = } & { { } } & { L _ { \mathrm { f a k e ~ i m a g e ~ f o o l s } } + w _ { f a k e c l a s s } L _ { \mathrm { f a k e ~ c l a s s } } } \end{array}
224
+ $$
225
+
226
+ Note that unlike the standard ACGAN formulation given in (Odena et al., 2016), we do not include $L _ { \mathrm { f a k e \ c l a s s } }$ in the discriminator’s loss, to keep the discriminator from cooperating with the generator on the classification task.
227
+
228
+ We modified the generator network by adding one-hot class inputs, and the discriminator by adding class outputs alongside the source output, as in (Odena et al., 2016).
229
+
230
+ # C.2 GENERATOR & DISCRIMINATOR
231
+
232
+ We parameterized the generator as a deep neural network, which begins with a fully-connected mapping from the latent (noise) space to a $4 \times 4 \times 5 1 2$ dimensional image, and then successively upsampled (a factor of 2 by nearest neighbor), padded and applied a convolution ( $3 \times 3$ kernel, stride of 1) and a leaky ReLU $\alpha = 0 . 2$ ) nonlinearity repeatedly. We repeated this process 5 times (except with no upsampling on the first step, and a tanh nonlinearity on the last), while stepping the image depth down as follows: 512, 512, 256, 128, 64, and finally 3 (RGB) for the output image. This means that the final output images were $6 4 \times 6 4$ . We parameterized the discriminator as a convolutional network with 7 layers, 6 convolutions (kernels all $3 \times 3$ ; strides 2, 1, 2, 1, 2, 1; dropout after the 1st, 3rd, and 5th layers; filter depth 16, 32, 64, 128, 256, 512; batch normalization after each layer) and a fully connected layer to a single output for real/fake. We used a leaky ReLU $\alpha = 0 . 2$ ) nonlinearity after each layer, except the final layer, where we used a tanh.
233
+
234
+ This GAN was trained on a dataset consisting of landscape images of mountains and coastlines obtained from the web. The generator was trained with the Adam optimizer (Kingma & Ba, 2015), and the discriminator with RMSProp. The learning rates for both were set to $1 0 ^ { - 5 }$ , and for Adam we set $\beta _ { 1 } = 0 . 5$ . We used a latent size of 64 units. The model was trained for $1 . 1 \times 1 0 ^ { 6 }$ gradient steps, when the generated images appeared to stop improving.
235
+
236
+ # C.3 PIR ESTIMATOR
237
+
238
+ Instead of predicting PIR as a scalar directly, we predict it by classifying into 100 bins via a softmax, which performs better empirically. This choice was motivated by noting that the scalar version was having trouble fitting some highly multi-modal distributions that appear in the data. We trained the PIR estimator with the Adam optimizer (learning rate $5 \cdot 1 0 ^ { - 4 }$ ). When evaluating and when using this model for improving the GAN we froze the weights of the PIR estimator. We also reduced the output softmax’s temperature to 0.01, so it was behaving almost like a max, which empirically improved results. Intuitively, a low softmax temperature in training allows the system to rapidly get gradients from many different output bins and adjust the distribution appropriately, whereas when actually using the system we want to be conservative with our estimates and not be too biased by low probability bins far from the modal estimate.
239
+
240
+ # C.4 SIMULATED DATA
241
+
242
+ # C.4.1 VGG FEATURES
243
+
244
+ The first approach we took to evaluating our system’s ability to train for different features was to use activity from hidden layers of a computer vision model, specifically VGG 16 (Simonyan & Zisserman, 2014) trained on ImageNet (Russakovsky et al., 2015). In particular, we took the $\ell _ { 2 }$ norm of the activity of one filter within a layer, and normalized it by the $\ell _ { 2 }$ norm of the total layer’s activity, i.e. letting $\mathrm { v G G } _ { l , f } ( i )$ be the vector of unit activations in filter $f$ of layer $l$ of VGG 16 on image $i$ , we computed PIR for that image and a given layer and filter $l ^ { * } , f ^ { * }$ as:
245
+
246
+ $$
247
+ \begin{array} { r } { \mathrm { P I R } _ { l ^ { * } , f ^ { * } } ( i ) = \sqrt { \frac { \left| \mathrm { V G G } _ { l ^ { * } , f ^ { * } } ( i ) \right| _ { 2 } ^ { 2 } } { \sum _ { f \in l ^ { * } } \left| \mathrm { V G G } _ { l ^ { * } , f } ( i ) \right| _ { 2 } ^ { 2 } } } } \end{array}
248
+ $$
249
+
250
+ (Note that if we did not normalize by the activity in the whole layer, the system might be able to “cheat” to improve the PIR by just increasing the contrast of the images, which will likely increase overall network activity.) As noted above, we also added binomially distributed noise to these PIRs.
251
+
252
+ # C.4.2 MULTIPLE FILTERS
253
+
254
+ After using our system on the tasks above, we noted that its performance was quite poor at layers 5, 6, and 7 of VGG compared to other tasks (see Fig. 2). This could suggest that our system was unable to capture the complex features represented at the higher levels of VGG. However, we also noticed that the feature representations at these layers tended to be quite sparse, so many of the simulated PIRs we generated were actually zero to within the bin width of our PIR estimator. Respectively, these layers had only $20 \%$ , $2 5 \%$ , and $24 \%$ non-zero PIRs (collapsing across filters), and around half the filters in each (resp. 6, 4, and 5) were producing $> 9 0 \%$ zero PIRs. (By contrast, the layer with the next greatest number of zero PIRs, fc8, still had $69 \%$ nonzero PIRs overall, and had no filters in which $90 \%$ or more of the PIRs were zero.) In a few cases on layers 5, 6, and 7, all of the generated PIRs were zero. This clearly makes learning infeasible, and indeed we noted that there was a strong relationship between number of non-zero simulated PIRs in the training dataset and the ability of our system to improve PIR (see Fig. 8). This is somewhat troubling, since probably most images in the real world will not produce a PIR that is truly zero.
255
+
256
+ ![](images/1cc28adcf4d57ca6b2d09c22ef5c94c72c0d24e85a98baf26a61262dbd9e4b51.jpg)
257
+ Figure 8: Percent non-zero PIRs vs. effect size (Single-filter VGG tasks and color tasks)
258
+
259
+ in order to evaluate whether the poor performance of our system at the higher layers of VGG was due to the number of zeros or to the complexity of the features, we created less sparse features from these layers by simply targeting a set of $k$ filters sampled without replacement from the layer, rather than a single filter. We did this by taking the norm across the $k$ target filters, or equivalently by summing the squared norms of the $k$ filters before taking the square root, and then normalizing by the activity in the layer as before. Formally, letting $a _ { 1 } , . . . , a _ { k }$ be a set of $k$ filter indices sampled without replacement from $\{ 0 , . . . ,$ number of filters in layer $\}$ , we computed the PIR for an image as:
260
+
261
+ $$
262
+ \mathrm { P I R } _ { l ^ { * } , f ^ { * } , k } ( i ) = \sqrt { \frac { \sum _ { j = 1 } ^ { j = k } \left| \mathrm { V G G } _ { l ^ { * } , a _ { j } } ( i ) \right| _ { 2 } ^ { 2 } } { \sum _ { f \in l ^ { * } } \left| \mathrm { V G G } _ { l ^ { * } , f } ( i ) \right| _ { 2 } ^ { 2 } } }
263
+ $$
264
+
265
+ The single filter cases above can be thought of as a special case of this, where $k = 1$ . To complement these, we also tried $k = 2 0$ . As above, we also added binomially distributed noise to these PIRs.
266
+
267
+ This can also be thought of as perhaps a more realistic simulation of human behavior, in the sense that it is highly unlikely that there is a single feature which influences human PIRs. Rather, there are probably many related features which influence PIR in various ways. Thus it is important to evaluate our system’s ability to target these types of features as well.
268
+
269
+ # C.4.3 COLORS
270
+
271
+ Finally, we also considered some simpler objectives based on targeting specific colors in the output images. Analogously to the VGG features, we computed the PIRs from the vector norm of a given image in the targeted color, normalized by the total image value. We considered several objectives of this type:
272
+
273
+ Single color: Optimizing for a single color of output image, e.g., for red the objective would be.
274
+
275
+ $$
276
+ \mathrm { P I R } _ { \mathrm { r e d } } ( i ) = \sqrt { \frac { | i ( : , : , \mathrm { r e d } ) | _ { 2 } ^ { 2 } } { | \mathbf { i } ( : , : , : ) | _ { 2 } ^ { 2 } } }
277
+ $$
278
+
279
+ Two color: We split the image horizontally into a left and right half, and then computed PIR from one color in the left half and a different color in the right half.
280
+
281
+ $$
282
+ \mathsf { P I R } _ { \mathrm { r e d \ b l u e } } ( i ) = \sqrt { \frac { \left| i ( : , : \frac { \mathrm { w i d t h } } { 2 } , \mathrm { r e d } ) \right| _ { 2 } ^ { 2 } + \left| i ( : , \frac { \mathrm { w i d t h } } { 2 } : , \mathsf { b l u e } ) \right| _ { 2 } ^ { 2 } } { | \dot { \mathbf { \mathbf { \mathbf { \mathbf { \Phi } } } } } ( : , : , : ) | _ { 2 } ^ { 2 } } }
283
+ $$
284
+
285
+ Three color: Similar to two color, but split the image into thirds, and computed PIR from a different color in each third.
286
+
287
+ (As above, we also added binomially distributed noise to these PIRs.) These objectives provide a useful complement to the VGG objectives discussed in section 3.1. Although the single color objectives may be relevant to the classification task VGG 16 performs, the split color tasks are less likely to be relevant to classification. Note that it is important that we split the images along the width instead of the height dimension, as there may well be semantically relevant features corresponding to color divisions along the height dimension, e.g. a blue upper half and green lower half likely correlates with outdoor images, which would provide useful class information. By contrast, it is harder to imagine circumstances where different colors on the left and right halves of the image are semantically predictive, especially since flipping left to right is usually included in the data augmentation for computer vision systems. Thus success on optimizing for these objectives would increase our confidence in the generality of our system.
288
+
289
+ # C.5 POSSIBLE IMPROVEMENTS
290
+
291
+ There are a number of techniques that could be explored to improve our system. As we mentioned above, iterating for multiple steps of PIR collection and generative model tuning is worth exploring further. Also, some form of data scaling might allow the system to perform better on tasks with low variance. We briefly tried normalizing all data for an objective to have mean 0.5 and standard deviation 0.25, but did not achieve particularly good results from this, possibly because there were many outliers getting clipped to 0 or 1. Still, there are many other possibilities for scaling data that could potentially result in some improvement in performance. Also, one alternative approach to training a GAN to produce high-PIR images would be to use the PIR estimator objective in the Plug & Play Generative Networks framework (Nguyen et al., 2017) instead of using it to tune the GAN. This could be an interesting direction to explore, but its success would probably depend on expressiveness of the initial generative model. With the mediocre model we started with, it’s probably better to actually tune the model itself, which may allow it to explore parts of image space which it had not previously.
md/train/HJy_5Mcll/HJy_5Mcll.md ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ENET: A DEEP NEURAL NETWORK ARCHITECTURE FOR REAL-TIME SEMANTIC SEGMENTATION
2
+
3
+ Adam Paszke
4
+ Faculty of Mathematics, Informatics and Mechanics
5
+ University of Warsaw, Poland
6
+ a.paszke@students.mimuw.edu.pl
7
+
8
+ # Abhishek Chaurasia, Sangpil Kim & Eugenio Culurciello
9
+
10
+ Electrical and Computer Engineering Purdue University, USA aabhish, sangpilkim, euge@purdue.edu
11
+
12
+ # ABSTRACT
13
+
14
+ The ability to perform pixel-wise semantic segmentation in real-time is of paramount importance in practical mobile applications. Recent deep neural networks aimed at this task have the disadvantage of requiring a large number of floating point operations and have long run-times that hinder their usability. In this paper, we propose a novel deep neural network architecture named ENet (efficient neural network), created specifically for tasks requiring low latency operation. ENet is up to $1 8 \times$ faster, requires $7 5 \times$ less FLOPs, has $7 9 \times$ less parameters, and provides similar or better accuracy to existing models. We have tested it on CamVid, Cityscapes and SUN datasets and report on comparisons with existing state-of-the-art methods, and the trade-offs between accuracy and processing time of a network. We present performance measurements of the proposed architecture on embedded systems and suggest possible software improvements that could make ENet even faster.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Recent interest in augmented reality wearables, home-automation devices, and self-driving vehicles has created a strong need for semantic-segmentation (or visual scene-understanding) algorithms that can operate in real-time on low-power mobile devices. These algorithms label each and every pixel in the image with one of the object classes. In recent years, the availability of larger datasets and computationally-powerful machines have helped deep convolutional neural networks (CNNs) (LeCun & Bengio (1998); Krizhevsky et al. (2012); Simonyan & Zisserman (2014a); Szegedy et al. (2015a)) surpass the performance of many conventional computer vision algorithms (Shotton et al. (2009); Perronnin et al. (2010); van de Sande et al. (2011)). Even though CNNs are increasingly successful at classification and categorization tasks, they provide coarse spatial results when applied to pixel-wise labeling of large images. Therefore, they are often cascaded with other algorithms to refine the results, such as color based segmentation (Farabet et al. (2013)) or conditional random fields (Chen et al. (2014)), to name a few.
19
+
20
+ In order to both spatially classify and finely segment images, several neural network architectures have been proposed, such as SegNet (Badrinarayanan et al. (2015a;b)) or fully convolutional networks (Long et al. (2015)). All these works are based on a VGG16 (Simonyan & Zisserman (2014b)) architecture, which is a very large model designed for multi-class classification. These references use models with a large number of parameters, and slow inference time. In these conditions, they become unusable for many mobile or battery-powered applications, which require processing images at rates higher than 10 fps.
21
+
22
+ In this paper, we propose a new neural network architecture optimized for high-accuracy and also fast inference. In our work, beside neural network processing, we chose not to use any other post-processing steps, in order to focus on the intrinsic performance of an end-to-end CNN approach.
23
+
24
+ In Section 3 we propose a fast and compact encoder-decoder architecture named ENet. It has been designed according to rules and ideas that have appeared in the literature recently, all of which we discuss in Section 4. Performance of the proposed network has been tested on Cityscapes (Cordts et al. (2016)) and CamVid (Brostow et al. (2008)) for driving scenario, whereas SUN dataset (Song et al. (2015)) has been used for testing our network in an indoor situation. We benchmark it on NVIDIA Jetson TX1 Embedded Systems Module as well as on an NVIDIA Titan X GPU. The results can be found in Section 5.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Semantic segmentation is important in fully understanding the content of images, find target objects and segment them. This technique is of utmost importance in applications such as driving and augmented reality. Moreover, real-time operation is a must for these applications, and therefore, designing CNNs carefully is vital. Contemporary computer vision applications extensively use deep neural networks, now one of the most widely used techniques for many different tasks, including semantic segmentation. This work presents a fully trainable neural network architecture, and therefore we aim to compare to other literature that performs the large majority of inference in the same way.
29
+
30
+ State-of-the-art scen-parsing CNNs use two separate neural network architectures combined together: an encoder and a decoder. Inspired by probabilistic auto-encoders (Ranzato et al. (2007); Ngiam et al. (2011)), encoder-decoder network architecture have been introduced in SegNet-basic (Badrinarayanan et al. (2015a)), and further improved in SegNet (Badrinarayanan et al. (2015b)). The encoder is a vanilla CNN (such as VGG16 from Simonyan & Zisserman (2014b)) which is trained to classify the input, while the decoder is used to upsample the output of the encoder (Long et al. (2015); Noh et al. (2015); Zheng et al. (2015); Eigen & Fergus (2015); Hong et al. (2015)). However, these networks are slow during inference due to their large architectures and numerous parameters. Unlike in Noh et al. (2015), fully connected layers of VGG16 were discarded in the latest incarnation of SegNet, in order to reduce the number of operations and memory footprint, making it the smallest of these networks. Still, none of them can operate in real-time.
31
+
32
+ Other existing architectures use simpler classifiers and then cascade it with Conditional Random Field (CRF) as a post-processing step (Chen et al. (2014); Sturgess et al. (2009)). As explained in Badrinarayanan et al. (2015b), these techniques use onerous post-processing steps and often fail to label the classes that occupy fewer number of pixels in a frame. CNNs can be combined with recurrent neural networks (Zheng et al. (2015)) for better performance, but suffers from further speed degradation. Also, one has to keep in mind that RNN, used as a post-processing step, can be used in conjunction with any other technique, including the one presented in this work.
33
+
34
+ # 3 NETWORK ARCHITECTURE
35
+
36
+ The architecture of our network is presented in Table 1. It is divided into several stages, as highlighted by horizontal lines in the table and the first digit after each block name. Output sizes are reported for an example input image resolution of $5 1 2 \times 5 1 2$ . We adopt a view of ResNets (He et al. (2015b)) that describes them as having a single main branch and extensions with convolutional filters that separate from it, and then merge back with an element-wise addition, as shown in Figure 1b. Just as in the original paper, we refer to these as bottleneck modules. They consist of three convolutional layers: a $1 \times 1$ projection that reduces the dimensionality, a main convolutional layer (conv in Figure 1b), and a $1 \times 1$ expansion. If the bottleneck is downsampling, a max pooling layer is added to the main branch. We zero pad the activations, to match the number of feature maps. Also, the first $1 \times 1$ projection is replaced with a $2 \times 2$ convolution with stride 2 in both dimensions. conv is either a regular, dilated or full convolution (also known as deconvolution or fractionally strided convolution) with $3 \times 3$ filters. Sometimes we replace it with asymmetric convolution i.e. a sequence of $5 \times 1$ and $1 \times 5$ convolutions. For the regularizer, we use Spatial Dropout (Tompson et al. (2015)), with $p = 0 . 0 1$ before bottleneck2.0, and $p = 0 . 1$ afterwards.
37
+
38
+ The initial stage contains a single block, that is presented in Figure 1a. Stage 1 consists of 5 bottleneck blocks, while stage 2 and 3 have the same structure, with the exception that stage 3 does not downsample the input at the beginning (we omit the 0th bottleneck). These three first stages are the encoder. Stage 4 and 5 belong to the decoder.
39
+
40
+ ![](images/3d811125fc485f27b800c8976f19705f72633a395c9c3be4441ef0eb0a1d69a4.jpg)
41
+ Figure 1: (a) ENet initial block. MaxPooling is performed with non-overlapping $2 \times 2$ windows, and the convolution has 13 filters, which sums up to 16 feature maps after concatenation. This is heavily inspired by Szegedy et al. (2015b). (b) ENet bottleneck module. conv is either a regular, dilated, or full convolution (also known as deconvolution) with $3 \times 3$ filters, or a $5 \times 5$ convolution decomposed into two asymmetric ones.
42
+
43
+ We did not use bias terms in any of the projections, in order to reduce the number of kernel calls and overall memory operations, as cuDNN (Chetlur et al. (2014)) uses separate kernels for convolutions and bias addition. This choice didn’t have any impact on the accuracy. Between each convolutional layer and following non-linearity we use Batch Normalization (Ioffe & Szegedy (2015)). In the decoder max pooling is replaced with max unpooling, and padding is replaced with spatial convolution without bias. We did not use unpooling information in the last upsampling module, because the initial block operated on the 3 channels of the input frame, while the final output has $C$ feature maps (the number of object classes). Also, for performance reasons, we decided to place only a bare full convolution as last module of the network, which alone takes up a sizeable portion of the decoder processing time.
44
+
45
+ Table 1: ENet architecture. Output sizes are given for an example input of $5 1 2 \times 5 1 2$ .
46
+
47
+ <table><tr><td>Name</td><td>Type</td><td>Output size</td></tr><tr><td>initial</td><td></td><td>16 × 256× 256</td></tr><tr><td>bottleneck1.0</td><td>downsampling</td><td>64× 128 ×128</td></tr><tr><td>4× bottleneck1.x</td><td></td><td>64 × 128 × 128</td></tr><tr><td>bottleneck2.0</td><td>downsampling</td><td>128 ×64× 64</td></tr><tr><td>bottleneck2.1</td><td></td><td>128 × 64× 64</td></tr><tr><td>bottleneck2.2</td><td>dilated 2</td><td>128×64×64</td></tr><tr><td>bottleneck2.3</td><td>asymmetric 5</td><td>128×64×64</td></tr><tr><td>bottleneck2.4</td><td>dilated 4</td><td>128 × 64× 64</td></tr><tr><td>bottleneck2.5</td><td></td><td>128 × 64× 64</td></tr><tr><td>bottleneck2.6</td><td>dilated 8</td><td>128 × 64× 64</td></tr><tr><td>bottleneck2.7</td><td>asymmetric 5</td><td>128 ×64×64</td></tr><tr><td>bottleneck2.8</td><td>dilated 16</td><td>128×64×64</td></tr><tr><td colspan="3">Repeat section 2,without bottleneck2.0</td></tr><tr><td>bottleneck4.0</td><td>upsampling</td><td>64 × 128 × 128</td></tr><tr><td>bottleneck4.1</td><td></td><td>64×128×128</td></tr><tr><td>bottleneck4.2</td><td></td><td>64 × 128 × 128</td></tr><tr><td>bottleneck5.0</td><td>upsampling</td><td>16 × 256 × 256</td></tr><tr><td>bottleneck5.1</td><td></td><td>16 × 256× 256</td></tr><tr><td>fullconv</td><td></td><td>C × 512 × 512</td></tr></table>
48
+
49
+ # 4 DESIGN CHOICES
50
+
51
+ In this section we will discuss our most important experimental results and intuitions, that have shaped the final architecture of ENet.
52
+
53
+ Feature map resolution: Downsampling images during semantic segmentation has two main drawbacks. Firstly, reducing feature map resolution implies loss of spatial information like exact edge shape. Secondly, full pixel segmentation requires that the output has the same resolution as the input. This implies that strong downsampling will require equally strong upsampling, which increase model size and computational cost. The first issue has been addressed in Long et al. (2015) by adding the feature maps produced by encoder, and in SegNet (Badrinarayanan et al. (2015a)) by saving the elements index from the corresponding encoder max-pooling module. We followed the SegNet approach, because it allows to reduce memory requirements, but we found that using a strong downsampling still reduces the final accuracy.
54
+
55
+ However, downsampling has one big advantage. Filters operating on downsampled images have a bigger receptive field, that allows them to gather more context. This is especially important when trying to differentiate between classes occupying a small portion of the overall image, as, for example, rider and pedestrian in a road scene. It is just not enough that the network learns how people look, the context in which they appear is important as well. At the end, we have found that it is better to use dilated convolutions for the purpose of extending context information (Yu & Koltun (2015)).
56
+
57
+ Early downsampling: One crucial intuition to achieving good performance and real-time operation is realizing that processing large input frames is very expensive. This might sound very obvious, however many popular architectures (Hong et al. (2015); Badrinarayanan et al. (2015b)) do not pay much attention towards optimization of early stages of network, which are often the most expensive.
58
+
59
+ ENet first two blocks heavily reduce the input size, and use only a small set of feature maps. The idea behind it, is that visual information is highly redundant in space, and thus can be compressed into a more efficient representation. Also, our intuition is that the initial network layers should not be used specifilly only for classification. Instead, they should rather act as good feature extractors and preprocess the input for later portions of the network. This insight worked well in our experiments. Increasing the number of feature maps from 16 to 32 did not improve the accuracy on Cityscapes dataset (Cordts et al. (2016)).
60
+
61
+ Decoder size: In this work we would like to provide a different view on encoder-decoder architectures than the one presented in Badrinarayanan et al. (2015b). SegNet is a very symmetric architecture, as the encoder is an exact mirror of the encoder. Instead, our architecture consists of a large encoder, and a small decoder. This is motivated by the idea that the encoder should be able to work in a similar fashion to original classification architectures, i.e. to operate on smaller resolution data and provide for information processing and filtering. Instead, the role of the the decoder, is only to upsample the output of the encoder, fine-tuning the details.
62
+
63
+ Nonlinear operations: He et al. (2016) report that it is beneficial to use ReLU and Batch Normalization layers before convolutions. We tried applying these ideas to ENet, but this had a detrimental effect on accuracy. Investigating its cause we replaced all ReLUs in the network with PReLUs (He et al. (2015a)), which use an additional parameter per feature map, with the goal of learning the negative slope of non-linearities. We expected that in layers where identity is a preferable transfer function, PReLU weights will have values around 1, and conversely, values around 0 if ReLU is preferable. Results of this experiment can be seen in Figure 2.
64
+
65
+ The first layers weights exhibit a large variance and are slightly biased towards positive values, while in the later portions of the encoder they settle to recurring pattern. All layers in the main branch behave nearly exactly like regular ReLUs, while the weights inside bottleneck modules are negative i.e. the function inverts and scales down negative values. We hypothesize that identity did not work out well in our architecture because of its limited depth. We hypothesize that the reason why such lossy functions are learned is that He et al. (2016) uses networks that are hundreds of layers deep, while our network uses fewer layers, and it needs to quickly filter out information. It is notable that the decoder weights become much more positive and learn functions closer to identity. This confirms our intuitions that the decoder is used only to fine-tune the upsampled output.
66
+
67
+ Information-preserving dimensionality changes: As stated earlier, it is necessary to downsample the input early, but aggressive dimensionality reduction can also hinder the information flow. A very good approach to this problem has been presented in Szegedy et al. (2015b). However, pooling after a convolution, in case of increasing feature map depth, is computationally expensive. Therefore, we prefer to perform pooling operation in parallel with convolution of stride 2, and concatenate resulting feature maps. This technique allowed us to speed up inference time of the initial block 10 times.
68
+
69
+ Additionally, we have found one problem in the original ResNet architecture. When downsampling, the first $1 \times 1$ projection of the convolutional branch is performed with a stride of 2 in both dimensions, which effectively discards $7 5 \%$ of the input. Increasing the filter size to $2 \times 2$ allows to take the full input into consideration, and thus improves the information flow and accuracy. Of course, it makes these layers $4 \times$ more computationally expensive, however there are so few of these in ENet, that the overhead is not noticeable.
70
+
71
+ ![](images/8ee4cf5e3cab0eb753a0beb93ff4d6ee95b858dcca5a326251df16b36b1dba7e.jpg)
72
+ Figure 2: PReLU weight distribution vs network depth. Blue line is the weights mean, while an area between maximum and minimum weight is grayed out. Each vertical dotted line corresponds to a PReLU in the main branch and marks the boundary between each of bottleneck blocks. The gray vertical line at 67th module is placed at encoder-decoder border.
73
+
74
+ Factorizing filters: It has been shown that convolutional weights have a fair amount of redundancy, and each $n \times n$ convolution can be decomposed into two smaller asymmetric convolutions: one with a $n \times 1$ filter followed by a $1 \times n$ filter (Jin et al. (2014); Szegedy et al. (2015b)). We have used asymmetric convolutions with $n = 5$ in our network, so cost of these two operations is similar to a single $3 \times 3$ convolution. This allowed to increase the variety of functions learned by each block and increase the receptive field.
75
+
76
+ Sequence of operations used in the bottleneck module (projection, convolution, projection) can be seen as decomposing one large convolutional layer into a series of smaller and simpler low-rank approximation operations. Such factorization allows for large speedups and reduction in number of parameters, making them less redundant (Jin et al. (2014)).
77
+
78
+ Dilated convolutions: As argued above, it is very important for the network to have a wide receptive field, so it can perform classification by taking a bigger portion of the image (context) into account. We wanted to avoid overly downsampling the feature maps, and decided to use dilated convolutions (Yu & Koltun (2015)) to improve our model. We have used them inside several bottleneck modules, in particular the ones that operate on the smallest resolutions. These gave a significant accuracy boost, by raising IoU on Cityscapes by around 4 percentage points, with no additional cost. We obtained the best accuracy when we interleaved them with other bottleneck modules (both regular and asymmetric), instead of arranging them in sequence, as has been done in Yu & Koltun (2015).
79
+
80
+ Regularization: Most pixel-wise segmentation datasets are relatively small (on order of $1 0 ^ { 3 }$ images), so such expressive models as neural networks quickly begin to overfit them. In initial experiments, we used L2 weight decay with little success. Then, inspired by Huang et al. (2016), we have tried stochastic depth, which increased accuracy. However it became apparent that dropping branches (i.e. setting their output to 0) is in fact a special case of applying Spatial Dropout (Tompson et al. (2015)), where either all of the channels, or none of them are ignored, instead of selecting a random subset. We placed Spatial Dropout at the end of convolutional branches, right before the addition, and it turned out to work much better than stochastic depth.
81
+
82
+ # 5 RESULTS
83
+
84
+ We benchmarked the performance of ENet on three different datasets to demonstrate real-time and accurate for practical applications. We tested on CamVid and Cityscapes datasets of road scenes, and SUN RGB-D dataset of indoor scenes. We set SegNet (Badrinarayanan et al. (2015b)) as a baseline since it is one of the fastest segmentation model available, that also requires less memory to operate than plain CNNs. All our models, training, testing and performance evaluation scripts were written using the Torch7 machine-learning library. To compare results, we use class average accuracy and intersection-over-union (IoU) metrics.
85
+
86
+ # 5.1 PERFORMANCE ANALYSIS
87
+
88
+ We report results on inference speed on widely used NVIDIA Titan X GPU as well as on NVIDIA TX1 embedded system module. ENet was designed to achieve more than 10 fps on the NVIDIA TX1 board with an input image size $6 4 0 \times 3 6 0$ (W,H), which is adequate for practical road scene parsing applications. For inference we merge batch normalization and dropout layers into the convolutional filters, to speed up all networks.
89
+
90
+ Table 2: Performance comparison. Image size is $\mathrm { W } \times \mathrm { H }$
91
+
92
+ <table><tr><td rowspan="3">Model</td><td colspan="6">NVIDIA TX1</td><td colspan="6">NVIDIA Titan X</td></tr><tr><td colspan="2">480×320</td><td colspan="2">640×360</td><td colspan="2">1280×720</td><td colspan="2">640×360</td><td colspan="2">1280×720</td><td colspan="2">1920×1080</td></tr><tr><td>ms</td><td>fps</td><td>ms</td><td>fps</td><td>ms</td><td>fps</td><td>ms</td><td>fps</td><td>ms</td><td>fps</td><td>ms</td><td>fps</td></tr><tr><td>SegNet</td><td>757</td><td>1.3</td><td>1251</td><td>0.8</td><td>-</td><td>1</td><td>69</td><td>14.6</td><td>289</td><td>3.5</td><td>637</td><td>1.6</td></tr><tr><td>ENet</td><td>47</td><td>21.1</td><td>69</td><td>14.6</td><td>262</td><td>3.8</td><td>7</td><td>135.4</td><td>21</td><td>46.8</td><td>46</td><td>21.6</td></tr></table>
93
+
94
+ Inference time: Table 2 compares inference time for a single input frame of varying resolution. We also report the number of frames per second that can be processed. Dashes indicate that we could not obtain a measurement, due to lack of memory. ENet is significantly faster than competing architectures, providing high frame rates for real-time applications and allowing for practical use of very deep neural network models with encoder-decoder architecture.
95
+
96
+ Table 3: Hardware requirements. FLOPs are estimated for an input of $3 \times 6 4 0 \times 3 6 0$ (C,W,H).
97
+
98
+ <table><tr><td></td><td>GFLOPs</td><td>Parameters</td><td>Model size (fp16)</td></tr><tr><td>SegNet</td><td>286.03</td><td>29.46M</td><td>56.2 MB</td></tr><tr><td>ENet</td><td>3.83</td><td>0.37M</td><td>0.7 MB</td></tr></table>
99
+
100
+ Hardware requirements: Table 3 reports a comparison of number of operations and parameters used by different models. ENet efficiency is evident in the much low number of operations per frame and overall parameters. Please note that we report storage required to store the models in half precision floating point format. ENet has so few parameters that it can be saved into a file of just 0.7MB, which makes it possible to fit the whole network in an extremely fast on-chip memory in embedded processors. This alleviates the need for model compression (Han et al. (2015)), making it possible to use general purpose code for neural network computation. However, if one needs to operate under incredibly strict memory constraints, these techniques can still be applied to ENet as well.
101
+
102
+ Software limitations: One of the most important techniques that has allowed us to reach these levels of performance is convolutional layer factorization. However, we have found one surprising drawback. Although applying this method allowed us to greatly reduce the number of floating point operations and parameters, it also increased the number of individual kernels calls, making each of them smaller.
103
+
104
+ We have found that some of these operations become so cheap, that the cost of GPU kernel launch starts to outweigh the cost of the actual computation. Also, because kernels do not have access to values that have been kept in registers by previous ones, they have to load all data from global memory at launch, and save it when their work is finished. This means that using a higher number of kernels, increases the number of memory operations, because feature maps have to be constantly saved and reloaded. This becomes especially apparent in case of non-linear operations. In ENet, PReLUs consume more than a quarter of inference time. Since they are only simple point-wise operations and very easy to parallelize, we hypothesize it is caused by the aforementioned data movement.
105
+
106
+ These are serious limitations, however they could be resolved by performing kernel fusion in existing software i.e. create kernels that apply non-linearities to results of convolutions directly, or perform a number of smaller convolutions in one call. This improvement in GPU libraries, such as CuDNN, could increase the speed and efficiency of our network even further.
107
+
108
+ # 5.2 BENCHMARKS
109
+
110
+ During training we have used the Adam optimization algorithm (Kingma & Ba (2014)). It allowed ENet to converge very quickly and on every dataset we haver used training took only 3-4 hours on Titan X. Training of ENet was performed in two stages: first we train only the encoder to categorize downsampled regions of the input image, then we appended the decoder and train the network to perform upsampling and pixel-wise categorization. in this work, a learning rate of $5 \mathrm { e } { - 4 }$ and L2 weight decay of $2 \mathrm { e } { - 4 }$ , along with batch size of 10 consistently provided the best results. For categorization, we have used a custom class weighing scheme defined as wclass = 1ln(c+pclass) . In contrast to the inverse class probability weighing, the weights are bounded as the probability approaches 0. c is an additional hyper-parameter, which we set to 1.02 (i.e. we restrict the class weights to be in the interval of [1, 50]).
111
+
112
+ Table 4: Cityscapes test set results
113
+
114
+ <table><tr><td>Model</td><td>Class IoU</td><td>Class iIoU</td><td>Category IoU</td><td>Category iIoU</td></tr><tr><td>SegNet</td><td>56.1</td><td>34.2</td><td>79.8</td><td>66.4</td></tr><tr><td>ENet</td><td>58.3</td><td>34.4</td><td>80.4</td><td>64.0</td></tr></table>
115
+
116
+ Cityscapes: This dataset consists of 5000 fine-annotated images, out of which 2975 are available for training, 500 for validation, and the remaining 1525 have been selected as test set (Cordts et al. (2016)). Cityscapes was the most important benchmark for us, because of its outstanding quality and highly varying road scenarios, often featuring many pedestrians and cyclists. We trained on 19 classes that have been selected in the official evaluation scripts (Cordts et al. (2016)). It makes use of an additional metric called instance-level intersection over union metric (iIoU), which is IoU weighed by the average object size. As reported in Table 4, ENet outperforms SegNet in class IoU and iIoU, as well as in category IoU. ENet is currently the fastest model in the Cityscapes benchmark.
117
+
118
+ Table 5: Results on CamVid test set of (1) SegNet-Basic, (2) SegNet, and (3) ENet
119
+
120
+ <table><tr><td>[apo</td><td>Buipling</td><td>2</td><td>S</td><td>8</td><td>S</td><td></td><td>rrrnsestd</td><td>geeee</td><td>P</td><td>xeeaaia</td><td>BTttreit</td><td>ae ssea</td><td>Grssero</td></tr><tr><td></td><td></td><td></td><td>91.2</td><td>82.7</td><td>36.9</td><td>93.3</td><td>55.0</td><td>47.5</td><td>44.8</td><td>74.1</td><td>16.0</td><td>62.9</td><td>n/a</td></tr><tr><td>1</td><td>75.0</td><td>84.6 87.3</td><td>92.4</td><td>82.1</td><td>20.5</td><td>97.2</td><td>57.1</td><td>49.3</td><td>27.5</td><td>84.4</td><td>30.7</td><td>65.2</td><td>55.6</td></tr><tr><td>23</td><td>88.8 74.7</td><td>77.8</td><td>95.1</td><td>82.4</td><td>51.0</td><td>95.1</td><td>67.2</td><td>51.7</td><td>35.4</td><td>86.7</td><td>34.1</td><td>68.3</td><td>51.3</td></tr></table>
121
+
122
+ CamVid: Another automotive dataset, on which we have tested ENet, was CamVid. It contains 367 training and 233 testing images (Brostow et al. (2008)). There are eleven different classes such as building, tree, sky, car, road, etc. while the twelfth class contains unlabeled data, which we ignore while training. The original frame resolution for this dataset is $9 6 0 \times 7 2 0$ (W,H) but we downsampled the images to $4 8 0 \times 3 6 0$ before training. In Table 5 we compare the performance of ENet with existing state-of-the-art algorithms. ENet outperforms other models in six classes, which are difficult to learn because they correspond to smaller objects.
123
+
124
+ Table 6: SUN RGB-D test set results
125
+
126
+ <table><tr><td>Model</td><td>Global avg.</td><td>Class avg.</td><td>Mean IoU</td></tr><tr><td>SegNet</td><td>70.3</td><td>35.6</td><td>26.3</td></tr><tr><td>ENet</td><td>59.5</td><td>32.6</td><td>19.7</td></tr></table>
127
+
128
+ SUN RGB-D: The SUN dataset consists of 5285 training images and 5050 testing images with 37 indoor object classes. We did not make any use of depth information in this work and trained the network only on RGB data. In Table 6 we compare the performance of ENet with SegNet (Badrinarayanan et al. (2015b)), which is the only neural network model that reports accuracy on this dataset. Our results, though inferior in global average accuracy and IoU, are comparable in class average accuracy. Since global average accuracy and IoU are metrics that favor correct classification of classes occupying large image patches, researchers generally emphasize the importance of other metrics in case of semantic segmentation. One notable example is introduction of iIoU metric (Cordts et al. (2016)). Comparable result in class average accuracy indicates, that our network is capable of differentiating smaller objects nearly as well as SegNet. Moreover, the difference in accuracy should not overshadow the huge performance gap between these two networks. ENet can process the images in real-time, and is nearly $2 0 \times$ faster than SegNet on embedded platforms.
129
+
130
+ ![](images/a43847be877615b29500a3b4907152b197ca7fa458f0a9158c8621cd2ca44e97.jpg)
131
+ Figure 3: ENet predictions on popular benchmarks (rows top to down represent input image, ground truth, and ENet output respectively).
132
+
133
+ # 6 CONCLUSION
134
+
135
+ We have proposed a novel neural network architecture designed from the ground up specifically for semantic segmentation. Our main aim is to make efficient use of scarce resources available on embedded platforms, compared to fully fledged deep learning workstations. Our work provides large gains in this task, while matching and at times exceeding existing baseline models, that have an order of magnitude larger computational and memory requirements. The application of ENet on the NVIDIA TX1 hardware exemplifies real-time portable embedded solutions.
136
+
137
+ Even though the main goal was to run the network on mobile devices, we have found that it is also very efficient on high end GPUs like NVIDIA Titan X. This may prove useful in data-center applications, where there is a need of processing large numbers of high resolution images. ENet allows to perform large-scale computations in a much faster and more efficient manner, which might lead to significant savings.
138
+
139
+ # ACKNOWLEDGMENT
140
+
141
+ This work is partly supported by the Office of Naval Research (ONR) grants N00014-12-1-0167, N00014-15-1-2791 and MURI N00014-10-1-0278. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the TX1, Titan X, K40 GPUs used for this research.
142
+
143
+ # REFERENCES
144
+
145
+ Vijay Badrinarayanan, Ankur Handa, and Roberto Cipolla. Segnet: A deep convolutional encoderdecoder architecture for robust semantic pixel-wise labelling. arXiv preprint arXiv:1505.07293, 2015a.
146
+
147
+ Vijay Badrinarayanan, Alex Kendall, and Roberto Cipolla. Segnet: A deep convolutional encoderdecoder architecture for image segmentation. arXiv preprint arXiv:1511.00561, 2015b.
148
+
149
+ Gabriel J. Brostow, Jamie Shotton, Julien Fauqueur, and Roberto Cipolla. Segmentation and recognition using structure from motion point clouds. In ECCV (1), pp. 44–57, 2008.
150
+
151
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Semantic image segmentation with deep convolutional nets and fully connected crfs. arXiv preprint arXiv:1412.7062, 2014.
152
+
153
+ Sharan Chetlur, Cliff Woolley, Philippe Vandermersch, Jonathan Cohen, John Tran, Bryan Catanzaro, and Evan Shelhamer. cudnn: Efficient primitives for deep learning. arXiv preprint arXiv:1410.0759, 2014.
154
+
155
+ Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
156
+
157
+ David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2650–2658, 2015.
158
+
159
+ C. Farabet, C. Couprie, L. Najman, and Y. LeCun. Learning hierarchical features for scene labeling. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1915–1929, Aug 2013. ISSN 0162-8828.
160
+
161
+ Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
162
+
163
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. pp. 1026–1034, 2015a.
164
+
165
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015b.
166
+
167
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. arXiv preprint arXiv:1603.05027, 2016.
168
+
169
+ Seunghoon Hong, Hyeonwoo Noh, and Bohyung Han. Decoupled deep neural network for semisupervised semantic segmentation. In Advances in Neural Information Processing Systems, pp. 1495–1503, 2015.
170
+
171
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Weinberger. Deep networks with stochastic depth. arXiv preprint arXiv:1603.09382, 2016.
172
+
173
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
174
+
175
+ Jonghoon Jin, Aysegul Dundar, and Eugenio Culurciello. Flattened convolutional neural networks for feedforward acceleration. arXiv preprint arXiv:1412.5474, 2014.
176
+
177
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
178
+
179
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25, pp. 1097–1105. 2012.
180
+
181
+ Yann LeCun and Yoshua Bengio. Convolutional networks for images, speech, and time series. The handbook of brain theory and neural networks, pp. 255–258, 1998.
182
+
183
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3431–3440, 2015.
184
+
185
+ Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew Y Ng. Multimodal deep learning. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 689–696, 2011.
186
+
187
+ Hyeonwoo Noh, Seunghoon Hong, and Bohyung Han. Learning deconvolution network for semantic segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1520–1528, 2015.
188
+
189
+ F. Perronnin, Y. Liu, J. Sánchez, and H. Poirier. Large-scale image retrieval with compressed fisher vectors. In Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on, pp. 3384–3391, 2010.
190
+
191
+ Marc Aurelio Ranzato, Fu Jie Huang, Y-Lan Boureau, and Yann LeCun. Unsupervised learning of invariant feature hierarchies with applications to object recognition. In Computer Vision and Pattern Recognition, 2007. CVPR’07. IEEE Conference on, pp. 1–8, 2007.
192
+
193
+ Jamie Shotton, John Winn, Carsten Rother, and Antonio Criminisi. Textonboost for image understanding: Multi-class object recognition and segmentation by jointly modeling texture, layout, and context. Int. Journal of Computer Vision (IJCV), January 2009.
194
+
195
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014a.
196
+
197
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014b.
198
+
199
+ Shuran Song, Samuel P Lichtenberg, and Jianxiong Xiao. Sun rgb-d: A rgb-d scene understanding benchmark suite. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 567–576, 2015.
200
+
201
+ Paul Sturgess, Karteek Alahari, Lubor Ladicky, and Philip HS Torr. Combining appearance and structure from motion features for road scene understanding. In BMVC 2012-23rd British Machine Vision Conference, 2009.
202
+
203
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015a.
204
+
205
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. arXiv preprint arXiv:1512.00567, 2015b.
206
+
207
+ Jonathan Tompson, Ross Goroshin, Arjun Jain, Yann LeCun, and Christoph Bregler. Efficient object localization using convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 648–656, 2015.
208
+
209
+ K. E. A. van de Sande, J. R. R. Uijlings, T. Gevers, and A. W. M. Smeulders. Segmentation as selective search for object recognition. In IEEE International Conference on Computer Vision, 2011.
210
+
211
+ Fisher Yu and Vladlen Koltun. Multi-scale context aggregation by dilated convolutions. arXiv preprint arXiv:1511.07122, 2015.
212
+
213
+ Shuai Zheng, Sadeep Jayasumana, Bernardino Romera-Paredes, Vibhav Vineet, Zhizhong Su, Dalong Du, Chang Huang, and Philip HS Torr. Conditional random fields as recurrent neural networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1529–1537, 2015.
md/train/HkG3e205K7/HkG3e205K7.md ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DOUBLY REPARAMETERIZED GRADIENT ESTIMATORS FOR MONTE CARLO OBJECTIVES
2
+
3
+ George Tucker Google Brain gjt@google.com
4
+
5
+ Dieterich Lawson New York University jdl404@nyu.edu
6
+
7
+ Shixiang Gu
8
+ Google Brain
9
+ shanegu@google.com
10
+
11
+ Chris J. Maddison University of Oxford, DeepMind cmaddis@stats.ox.ac.uk
12
+
13
+ # ABSTRACT
14
+
15
+ Deep latent variable models have become a popular model choice due to the scalable learning algorithms introduced by (Kingma & Welling, 2013; Rezende et al., 2014). These approaches maximize a variational lower bound on the intractable log likelihood of the observed data. Burda et al. (2015) introduced a multi-sample variational bound, IWAE, that is at least as tight as the standard variational lower bound and becomes increasingly tight as the number of samples increases. Counterintuitively, the typical inference network gradient estimator for the IWAE bound performs poorly as the number of samples increases (Rainforth et al., 2018; Le et al., 2018). Roeder et al. (2017) propose an improved gradient estimator, however, are unable to show it is unbiased. We show that it is in fact biased and that the bias can be estimated efficiently with a second application of the reparameterization trick. The doubly reparameterized gradient (DReG) estimator does not suffer as the number of samples increases, resolving the previously raised issues. The same idea can be used to improve many recently introduced training techniques for latent variable models. In particular, we show that this estimator reduces the variance of the IWAE gradient, the reweighted wake-sleep update (RWS) (Bornschein & Bengio, 2014), and the jackknife variational inference (JVI) gradient (Nowozin, 2018). Finally, we show that this computationally efficient, unbiased drop-in gradient estimator translates to improved performance for all three objectives on several modeling tasks.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Following the influential work by (Kingma & Welling, 2013; Rezende et al., 2014), deep generative models with latent variables have been widely used to model data such as natural images (Rezende & Mohamed, 2015; Kingma et al., 2016; Chen et al., 2016; Gulrajani et al., 2016), speech and music time-series (Chung et al., 2015; Fraccaro et al., 2016; Krishnan et al., 2015), and video (Babaeizadeh et al., 2017; Ha & Schmidhuber, 2018; Denton & Fergus, 2018). The power of these models lies in combining learned nonlinear function approximators with a principled probabilistic approach, resulting in expressive models that can capture complex distributions. Unfortunately, the nonlinearities that empower these model also make marginalizing the latent variables intractable, rendering direct maximum likelihood training inapplicable. Instead of directly maximizing the marginal likelihood, a common approach is to maximize a tractable lower bound on the likelihood such as the variational evidence lower bound (ELBO) (Jordan et al., 1999; Blei et al., 2017). The tightness of the bound is determined by the expressiveness of the variational family. For tractability, a factorized variational family is commonly used, which can cause the learned model to be overly simplistic.
20
+
21
+ Burda et al. (2015) introduced a multi-sample bound, IWAE, that is at least as tight as the ELBO and becomes increasingly tight as the number of samples increases. Counterintuitively, although the bound is tighter, Rainforth et al. (2018) theoretically and empirically showed that the standard inference network gradient estimator for the IWAE bound performs poorly as the number of samples increases due to a diminishing signal-to-noise ratio (SNR). This motivates the search for novel gradient estimators.
22
+
23
+ Roeder et al. (2017) proposed a lower-variance estimator of the gradient of the IWAE bound. They speculated that their estimator was unbiased, however, were unable to prove the claim. We show that it is in fact biased, but that it is possible to construct an unbiased estimator with a second application of the reparameterization trick which we call the IWAE doubly reparameterized gradient (DReG) estimator. Our estimator is an unbiased, computationally efficient drop-in replacement, and does not suffer as the number of samples increases, resolving the counterintuitive behavior from previous work (Rainforth et al., 2018). Furthermore, our insight is applicable to alternative multisample training techniques for latent variable models: reweighted wake-sleep (RWS) (Bornschein & Bengio, 2014) and jackknife variational inference (JVI) (Nowozin, 2018).
24
+
25
+ In this work, we derive DReG estimators for IWAE, RWS, and JVI and demonstrate improved scaling with the number of samples on a simple example. Then, we evaluate DReG estimators on MNIST generative modeling, Omniglot generative modeling, and MNIST structured prediction tasks. In all cases, we demonstrate substantial unbiased variance reduction, which translates to improved performance over the original estimators.
26
+
27
+ # 2 BACKGROUND
28
+
29
+ Our goal is to learn a latent variable generative model $p _ { \theta } ( x , z ) = p _ { \theta } ( z ) p _ { \theta } ( x | z )$ where $x$ are observed data and $z$ are continuous latent variables. The marginal likelihood of the observed data, $p _ { \theta } ( x ) =$ $\textstyle \int p _ { \theta } ( x , z ) d z$ , is generally intractable. Instead, we maximize a variational lower bound on $\log p _ { \theta } ( x )$ such as the ELBO
30
+
31
+ $$
32
+ \log p _ { \theta } ( x ) = \log \mathbb { E } _ { p _ { \theta } ( z ) } [ p _ { \theta } ( x | z ) ] \geq \mathbb { E } _ { q ( z | x ) } \left[ \log \frac { p _ { \theta } ( x , z ) } { q ( z | x ) } \right] ,
33
+ $$
34
+
35
+ where $q ( z | x )$ is a variational distribution. Following the influential work by (Kingma & Welling, 2013; Rezende et al., 2014), we consider the amortized inference setting where $q _ { \phi } ( z | x )$ , referred to as the inference network, is a learnable function parameterized by $\phi$ that maps from $x$ to a distribution over $z$ . The tightness of the bound is coupled to the expressiveness of the variational family (i.e., $\{ q _ { \phi } \} _ { \phi } )$ . As a result, limited expressivity of $\{ q _ { \phi } \} _ { \phi }$ , can negatively affect the learned model.
36
+
37
+ Burda et al. (2015) introduced the importance weighted autoencoder (IWAE) bound which alleviates this coupling
38
+
39
+ $$
40
+ \mathbb { E } _ { z _ { 1 : K } } \left[ \log \left( \frac { 1 } { K } \sum _ { i = 1 } ^ { K } \frac { p _ { \theta } ( x , z _ { i } ) } { q _ { \phi } ( z _ { i } | x ) } \right) \right] \le \log p _ { \theta } ( x ) ,
41
+ $$
42
+
43
+ with $z _ { 1 : K } \sim \textstyle \prod _ { i } q _ { \phi } ( z _ { i } | x )$ . The IWAE bound reduces to the ELBO when $K = 1$ , is non-decreasing as $K$ increases, and converges to $\log p _ { \theta } ( x )$ as $K \infty$ under mild conditions (Burda et al., 2015). When $q _ { \phi }$ is reparameterizable1, the standard gradient estimator of the IWAE bound is
44
+
45
+ $$
46
+ \bigtriangledown _ { \theta , \phi } \mathbb { E } _ { z _ { 1 : K } } \left[ \log \left( \frac { 1 } { K } \sum _ { i = 1 } ^ { K } w _ { i } \right) \right] = \nabla _ { \theta , \phi } \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \log \left( \frac { 1 } { K } \sum _ { i = 1 } ^ { K } w _ { i } \right) \right] = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { w _ { i } } { \sum _ { j } w _ { j } } \nabla _ { \theta , \phi } \log w _ { i } \right]
47
+ $$
48
+
49
+ where $w _ { i } = p _ { \theta } ( x , z _ { i } ) / q _ { \phi } ( z _ { i } | x )$ . A single sample estimator of this expectation is typically used as the gradient estimator.
50
+
51
+ As $K$ increases, the bound becomes increasingly tight, however, Rainforth et al. (2018) show that the signal-to-noise ratio (SNR) of the inference network gradient estimator goes to 0. This does not happen for the model parameters $\mathbf { \eta } ^ { ( \theta ) }$ . Following up on this work, Le et al. (2018) demonstrate that this deteriorates the performance of learned models on practical problems.
52
+
53
+ Because the IWAE bound converges to $\log p _ { \theta } ( x )$ (as $K \infty$ ) regardless of $q _ { \phi }$ , $\phi$ ’s affect on the bound must diminish as $K$ increases. It may be tempting to conclude that the SNR of the inference network gradient estimator must also decrease as $K \infty$ . However, low SNR is a limitation of the gradient estimator, not necessarily of the bound. Although the magnitude of the gradient converges to 0, if the variance of the gradient estimator decreases more quickly, then the SNR of the gradient estimator need not degrade. This motivates the search for lower variance inference network gradient estimators.
54
+
55
+ To derive improved gradient estimators for $\phi$ , it is informative to expand the total derivative2 of the IWAE bound with respect to $\phi$
56
+
57
+ $$
58
+ \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { w _ { i } } { \sum _ { j = 1 } ^ { K } w _ { j } } \left( - \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | x ) + \frac { \partial \log w _ { i } } { \partial z _ { i } } \frac { d z _ { i } } { d \phi } \right) \right] .
59
+ $$
60
+
61
+ Previously, Roeder et al. (2017) found that the first term within the parentheses of Eq. 3 can contribute significant variance to the gradient estimator. When $K = 1$ , this term analytically vanishes in expectation, so when $K > 1$ they suggested dropping it. Below, we abbreviate this estimator as STL. As we show in Section 6.1, the STL estimator introduces bias when $K > 1$ .
62
+
63
+ # 3 DOUBLY REPARAMETERIZED GRADIENT ESTIMATORS (DREGS)
64
+
65
+ Our insight is that we can estimate the first term within the parentheses of Eq. 3 efficiently with a second application of the reparameterization trick. To see this, first note that
66
+
67
+ $$
68
+ \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { w _ { i } } { \sum _ { j = 1 } ^ { K } w _ { j } } \frac { \partial } { \partial \phi } \log q ( \boldsymbol { z } _ { i } | \boldsymbol { x } ) \right] = \sum _ { i = 1 } ^ { K } \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \frac { w _ { i } } { \sum _ { j = 1 } ^ { K } w _ { j } } \frac { \partial } { \partial \phi } \log q ( \boldsymbol { z } _ { i } | \boldsymbol { x } ) \right] ,
69
+ $$
70
+
71
+ so it suffices to focus on one of the $K$ terms. Because the derivative is a partial derivativ e ∂∂ φ , it treats $z _ { i } = z ( \epsilon _ { i } , \phi )$ as a constant, so we can freely change the random variable that the expectation is over to $z _ { 1 : K }$ . Now,
72
+
73
+ $$
74
+ \mathbb { E } _ { z _ { 1 : K } } \left[ \frac { w _ { i } } { \sum _ { j } w _ { j } } \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | x ) \right] = \mathbb { E } _ { z _ { - i } } \mathbb { E } _ { z _ { i } } \left[ \frac { w _ { i } } { \sum _ { j } w _ { j } } \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | x ) \right] ,
75
+ $$
76
+
77
+ where $z _ { - i } = z _ { 1 : i - 1 , i + 1 : K }$ is the set of $z _ { 1 : K }$ without $z _ { i }$ . The inner expectation resembles a REINFORCE gradient term (Williams, 1992), where we interpret $\frac { w _ { i } } { \sum _ { j } w _ { j } }$ as the “reward”. Now, we can use the following well-known equivalence between the REINFORCE gradient and the reparameterization trick gradient (See Appendix 8.1 for a derivation)
78
+
79
+ $$
80
+ \mathbb { E } _ { q _ { \phi } ( z | x ) } \left[ f ( z ) \frac { \partial } { \partial \phi } \log q _ { \phi } ( z | x ) \right] = \mathbb { E } _ { \epsilon } \left[ \frac { \partial f ( z ) } { \partial z } \frac { \partial z ( \epsilon , \phi ) } { \partial \phi } \right] .
81
+ $$
82
+
83
+ This holds even when $f$ depends on $\phi$ . Typically, the reparameterization gradient estimator has lower variance than the REINFORCE gradient estimator because it directly takes advantage of the derivative of $f$ . Applying the identity from Eq. 5 to the right hand side of Eq. 4 gives
84
+
85
+ $$
86
+ \begin{array} { r l r } & { } & { \mathbb { E } _ { z _ { i } } \left[ \displaystyle \frac { w _ { i } } { \sum _ { j } w _ { j } } \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | x ) \right] = \mathbb { E } _ { \epsilon _ { i } } \left[ \displaystyle \frac { \partial } { \partial z _ { i } } \left( \displaystyle \frac { w _ { i } } { \sum _ { j } w _ { j } } \right) \displaystyle \frac { \partial z _ { i } } { \partial \phi } \right] } \\ & { } & { = \mathbb { E } _ { \epsilon _ { i } } \left[ \left( \displaystyle \frac { 1 } { \sum _ { j } w _ { j } } - \displaystyle \frac { w _ { i } } { ( \sum _ { j } w _ { j } ) ^ { 2 } } \right) \displaystyle \frac { \partial w _ { i } } { \partial z _ { i } } \displaystyle \frac { \partial z _ { i } } { \partial \phi } \right] = \mathbb { E } _ { \epsilon _ { i } } \left[ \left( \displaystyle \frac { w _ { i } } { \sum _ { j } w _ { j } } - \displaystyle \frac { w _ { i } ^ { 2 } } { ( \sum _ { j } w _ { j } ) ^ { 2 } } \right) \displaystyle \frac { \partial \log w _ { i } } { \partial z _ { i } } \displaystyle \frac { \partial z _ { i } } { \partial \phi } \right] . } \end{array}
87
+ $$
88
+
89
+ This last expression can be efficiently estimated with a single Monte Carlo sample. When $z _ { i }$ is not reparameterizable (e.g., the models in (Mnih & Rezende, 2016)), we can use a control variate (e.g.,
90
+
91
+ $\begin{array} { r } { \frac { 1 } { K } \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | \boldsymbol { x } ) ) } \end{array}$ . In both cases, when $K = 1$ , this term vanishes exactly and we recover the estimator proposed in (Roeder et al., 2017) for the ELBO. However, when $K > 1$ , there is no reason to believe this term will analytically vanish.
92
+
93
+ Substituting Eq. 6 into Eq. 3, we obtain a simplification due to cancellation of terms
94
+
95
+ $$
96
+ \nabla _ { \phi } \mathbb { E } _ { z _ { 1 : K } } \left[ \log \left( \frac { 1 } { K } \sum _ { i = 1 } ^ { K } w _ { i } \right) \right] = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \left( \frac { w _ { i } } { \sum _ { j } w _ { j } } \right) ^ { 2 } \frac { \partial \log w _ { i } } { \partial z _ { i } } \frac { \partial z _ { i } } { \partial \phi } \right] .
97
+ $$
98
+
99
+ We call the algorithm that uses the single sample Monte Carlo estimator of this expression for the inference network gradient the IWAE doubly reparameterized gradient estimator (IWAE-DReG). This estimator has the property that when $q ( z | x )$ is optimal (i.e., $q ( z | x ) = p ( z | x ) )$ , the estimator vanishes exactly and has zero variance, whereas this does not hold for the standard IWAE gradient estimator. We provide an asymptotic analysis of the IWAE-DReG estimator in Appendix 8.2. The conclusion of that analysis is that, in contrast to the standard IWAE gradient estimator, the SNR of√ the IWAE-DReG estimator exhibits the same scaling behaviour of $\mathcal { O } ( \sqrt { K } )$ for both the generation and inference network gradients (i.e., improving in $K$ ).
100
+
101
+ # 4 ALTERNATIVE TRAINING ALGORITHMS
102
+
103
+ Now, we review alternative training algorithms for deep generative models and derive their doubly reparameterized versions.
104
+
105
+ # 4.1 REWEIGHTED WAKE SLEEP (RWS)
106
+
107
+ Bornschein & Bengio (2014) introduced RWS, an alternative multi-sample update for latent variable models that uses importance sampling. Computing the gradient of the log marginal likelihood
108
+
109
+ $$
110
+ \nabla _ { \theta } \log p _ { \theta } ( x ) = \frac { \nabla _ { \theta } \int _ { z } p _ { \theta } ( x , z ) d z } { p _ { \theta } ( x ) } = \frac { \int _ { z } p _ { \theta } ( x , z ) \nabla _ { \theta } \log p _ { \theta } ( x , z ) d z } { p _ { \theta } ( x ) } = \mathbb { E } _ { p _ { \theta } ( z | x ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( x , z ) \right] ,
111
+ $$
112
+
113
+ requires samples from $p _ { \theta } ( z | x )$ , which is generally intractable. We can approximate the gradient with a self-normalized importance sampling estimator
114
+
115
+ $$
116
+ \mathbb { E } _ { p _ { \theta } ( z | x ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( x , z ) \right] \approx \mathbb { E } _ { z _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { w _ { i } } { \sum _ { j } w _ { j } } \nabla _ { \theta } \log p _ { \theta } ( x , z _ { i } ) \right] ,
117
+ $$
118
+
119
+ where $\begin{array} { r } { z _ { 1 : K } \sim \prod _ { i } q _ { \phi } ( z _ { i } | x ) } \end{array}$ . Interestingly, this is precisely the same as the IWAE gradient of $\theta$ , so the RWS update for $\theta$ can be interpreted as maximizing the IWAE lower bound in terms of $\theta$ . Instead of optimizing a joint objective for $p$ and $q$ , RWS optimizes a separate objective for the inference network. (Bornschein & Bengio, 2014) propose a “wake” update and a “sleep” update for the inference network. Le et al. (2018) provide empirical support for solely using the wake update for the inference network, so we focus on that update.
120
+
121
+ The wake update approximately minimizes the KL divergence from $p _ { \theta } ( z | x )$ to $q _ { \phi } ( z | x )$ . The gradient of the KL term is
122
+
123
+ $$
124
+ \nabla _ { \phi } \mathbb { E } _ { p _ { \theta } ( z | x ) } \left[ \log p _ { \theta } ( z | x ) - \log q _ { \phi } ( z | x ) \right] = - \mathbb { E } _ { p _ { \theta } ( z | x ) } \left[ \frac { \partial } { \partial \phi } \log q _ { \phi } ( z | x ) \right] .
125
+ $$
126
+
127
+ The wake update of the inference network approximates the intractable expectation by selfnormalized importance sampling
128
+
129
+ $$
130
+ - \mathbb { E } _ { p _ { \theta } ( z | x ) } \left[ \frac { \partial } { \partial \phi } \log q _ { \phi } ( z | x ) \right] \approx - \mathbb { E } _ { z _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { w _ { i } } { \sum _ { j } w _ { j } } \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | x ) \right] ,
131
+ $$
132
+
133
+ with $z _ { i } \sim q _ { \phi } ( z _ { i } | x )$ . Le et al. (2018) note that this update does not suffer from diminishing SNR as $K$ increases. However, a downside is that the updates for $p$ and $q$ are not gradients of a unified objective, so could potentially lead to instability or divergence.
134
+
135
+ # DOUBLY REPARAMETERIZED REWEIGHTED WAKE UPDATE
136
+
137
+ The wake update gradient for the inference network (Eq. 8) can be reparameterized
138
+
139
+ $$
140
+ - \mathbb { E } _ { z _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { w _ { i } } { \sum _ { j } w _ { j } } \frac { \partial } { \partial \phi } \log q _ { \phi } ( z _ { i } | x ) \right] = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \left( \frac { w _ { i } ^ { 2 } } { ( \sum _ { j } w _ { j } ) ^ { 2 } } - \frac { w _ { i } } { \sum _ { j } w _ { j } } \right) \frac { \partial \log w _ { i } } { \partial z _ { i } } \frac { \partial z _ { i } } { \partial \phi } \right] .
141
+ $$
142
+
143
+ We call the algorithm that uses the single sample Monte Carlo estimator of this expression as the wake update for the inference network RWS-DReG.
144
+
145
+ Interestingly, the inference network gradient estimator from (Roeder et al., 2017) can be seen as the sum of the IWAE gradient estimator and the wake update of the inference network (as the wake update minimizes, we add the negative of Eq. 9). Their positive results motivate further exploration of convex combinations of IWAE-DReG and RWS-DReG
146
+
147
+ $$
148
+ \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \left( \alpha \frac { w _ { i } } { \sum _ { j } w _ { j } } + ( 1 - 2 \alpha ) \frac { w _ { i } ^ { 2 } } { ( \sum _ { j } w _ { j } ) ^ { 2 } } \right) \frac { \partial \log w _ { i } } { \partial z _ { i } } \frac { \partial z _ { i } } { \partial \phi } \right] .
149
+ $$
150
+
151
+ We refer to the algorithm that uses the single sample Monte Carlo estimator of this expression as $\mathrm { D R e G } ( \alpha )$ . When $\alpha = 1$ , this reduces to RWS-DReG, when $\alpha = 0$ , this reduces to IWAE-DReG and when $\alpha = 0 . 5$ , this reduces STL.
152
+
153
+ # 4.2 JACKKNIFE VARIATIONAL INFERENCE (JVI)
154
+
155
+ Alternatively, Nowozin (2018) reinterprets the IWAE lower bound as a biased estimator for the log marginal likelihood. He analyzes the bias and introduces a novel family of estimators, Jackknife Variational Inference (JVI), which trade off reduction in bias for increased variance. This additional flexibility comes at the cost of no longer being a stochastic lower bound on the log marginal likelihood. The first-order JVI has significantly reduced bias compared to IWAE, which empirically results in a better estimate of the log marginal likelihood with fewer samples (Nowozin, 2018). For simplicity, we focus on the first-order JVI estimator
156
+
157
+ $$
158
+ K \times \mathbb { E } _ { z _ { 1 } \cdot K } \left[ \log \left( \frac { 1 } { K } \sum _ { i = 1 } ^ { K } w _ { i } \right) \right] - \frac { K - 1 } { K } \sum _ { i = 1 } ^ { K } \mathbb { E } _ { z _ { - i } } \left[ \log \left( \frac { 1 } { K - 1 } \sum _ { j \neq i } w _ { j } \right) \right] .
159
+ $$
160
+
161
+ It is straightforward to apply our approach to higher order JVI estimators.
162
+
163
+ DOUBLY REPARAMETERIZED JACKKNIFE VARIATIONAL INFERENCE (JVI)
164
+
165
+ The JVI estimator is a linear combination of $K$ and $K - 1$ sample IWAE estimators, so we can use the doubly reparameterized gradient estimator (Eq. 7) for each term.
166
+
167
+ # 5 RELATED WORK
168
+
169
+ Mnih & Rezende (2016) introduced a generalized framework of Monte Carlo objectives (MCO). The log of an unbiased marginal likelihood estimator is a lower bound on the log marginal likelihood by Jensen’s inequality. In this view, the ELBO can be seen as the MCO corresponding to a single importance sample estimator of the marginal likelihood with $q _ { \theta }$ as the proposal distribution. Similarly, IWAE corresponds to the $K$ -sample estimator. Maddison et al. (2017) show that the tightness of an MCO is directly related to the variance of the underlying estimator of the marginal likelihood.
170
+
171
+ However, Rainforth et al. (2018) point out issues with gradient estimators of multi-sample lower bounds. In particular, they show that although the IWAE bound is tighter, the standard IWAE gradient estimator’s SNR scales poorly with large numbers of samples, leading to degraded performance. Le et al. (2018) experimentally investigate this phenomenon and provide empirical evidence of this degradation across multiple tasks. They find that RWS (Bornschein & Bengio, 2014) does not suffer from this issue and find that it can outperform models trained with the IWAE bound. We conclude that it is not sufficient to just tighten the bound; it is important to understand the gradient estimators of the tighter bound as well.
172
+
173
+ Wake-sleep is an alternative approach to fitting deep generative models, first introduced in (Hinton et al., 1995) as a method for training Hemholtz machines. It was extended to the multi-sample setting by (Bornschein & Bengio, 2014) and the sequential setting in (Gu et al., 2015). It has been applied to generative modeling of images (Ba et al., 2015).
174
+
175
+ # 6 EXPERIMENTS
176
+
177
+ To evaluate DReG estimators, we first measure variance and signal-to-noise ratio $( \mathrm { S N R } ) ^ { 3 }$ of gradient estimators on a toy example which we can carefully control. Then, we evaluate gradient variance and model learning on MNIST generative modeling, Omniglot generative modeling, and MNIST structured prediction tasks.
178
+
179
+ # 6.1 TOY GAUSSIAN
180
+
181
+ We reimplemented the Gaussian example from (Rainforth et al., 2018). Consider the generative model with $z \sim N ( \theta , I )$ and $x | z \sim N ( z , I )$ and inference network $\begin{array} { r } { q _ { \phi } ( z | x ) \sim N ( A x ^ { - } + b , \frac { 2 } { 3 } I ) } \end{array}$ , where $\phi = \{ A , b \}$ . As in (Rainforth et al., 2018), we sample a set of parameters for the model and inference network close to the optimal parameters (perturbed by zero-mean Gaussian noise with standard deviation 0.01), then estimate the gradient of the inference network parameters for increasing number of samples $( K )$ .
182
+
183
+ In addition to signal-to-noise ratio (SNR), we plot the squared bias and variance of the gradient estimators4 in Fig. 1. The bias is computed relative to the expected value of the IWAE gradient estimator. As a result, although the average of $K$ ELBO gradient estimators is an unbiased estimator of the ELBO gradient, it is a biased gradient estimator of the IWAE objective. Importantly, SNR does not penalize estimators that are biased, so trivial constant estimators can have infinite SNR. Thus, it is important to consider additional evaluation measures as well. As $K$ increases, the SNR of the IWAE-DReG estimator increases, whereas the SNR of the standard gradient estimator of IWAE goes to 0, as previously reported. Furthermore, we can see the bias present in the STL estimator. As a check of our implementation, we verified that the observed “bias” for IWAE-DReG was statistically indistinguishable from 0 with a paired t-test. For the biased estimators (e.g., STL), we could easily reject the null hypothesis with few samples.
184
+
185
+ ![](images/4602530728769106fa89abfa2de18954281cbb1ea79b32fbc94d040f866f151a.jpg)
186
+ Figure 1: Signal-to-noise ratios (SNR), bias squared, and variance of gradient estimators with increasing $K$ over 10 random trials with 1000 measurement samples per trial (mean in bold). The observed “bias” for IWAE-DReG is not statistically significant under a paired t-test (as expected because IWAE-DReG is unbiased). IWAE-DReG is unbiased, its SNR increases with K, and it has the lowest variance of the estimators considered here.
187
+
188
+ # 6.2 GENERATIVE MODELING
189
+
190
+ Training generative models of the binarized MNIST digits dataset is a standard benchmark task for latent variable models. For this evaluation, we used the single latent layer architecture from (Burda et al., 2015). The generative model used 50 Gaussian latent variables with an isotropic prior and passed $z$ through two deterministic layers of 200 tanh units to parameterize factorized Bernoulli outputs. The inference network passed $x$ through two deterministic layers of 200 tanh units to parameterize a factorized Gaussian distribution over $z$ . Because our interest was in improved gradient estimators and optimization performance, we used the dynamically binarized MNIST dataset, which minimally suffers from overfitting. We used the standard split of MNIST into train, validation, and test sets.
191
+
192
+ We trained models with the IWAE gradient, the RWS wake update, and with the JVI estimator. In all three cases, the doubly reparameterized gradient estimator reduced variance5 and as a result substantially improved performance (Fig. 2).
193
+
194
+ ![](images/df131fe5998b53bb0ac88c7a2eb163c6e64208318f090fefa87a69dbc76fe0f7.jpg)
195
+ Figure 2: MNIST generative modeling trained according to IWAE (left), RWS (middle), and JVI (right). The top row compares the variance of the original gradient estimator (dashed) with the variance of the doubly reparameterized gradient estimator (solid). The bottom row compares test performance. The left and middle plots show the IWAE (stochastic) lower bound on the test set. The right plot shows the JVI estimator (which is not a bound) on the test set. The bold lines are the average over three trials, and individual trials are displayed as semi-transparent). All methods used $K = 6 4$ .
196
+
197
+ We found similar behavior with different numbers of samples (Fig. 3 and Appendix Fig. 8). Interestingly, the biased gradient estimators STL and RWS-DReG perform best on this task with RWSDReG slightly outperforming STL. As observed in (Le et al., 2018), RWS increasingly outperforms IWAE as $K$ increases. Finally, we experimented with convex combinations of IWAE-DReG and RWS-DReG (right Fig. 3). On this dataset, convex combinations that heavily weighted RWS-DReG had the best performance. However, as we show below, this is task dependent.
198
+
199
+ Next, we performed the analogous experiment with the dynamically binarized Omniglot dataset using the same model architecture. Again, we found that the doubly reparameterized gradient estimator reduced variance and as a result improved test performance (Figs. 5 and 6 in the Appendix).
200
+
201
+ # 6.3 STRUCTURED PREDICTION ON MNIST
202
+
203
+ Structured prediction is another common benchmark task for latent variable models. In this task, our goal is to model a complex observation $x$ given a context $c$ (i.e., model the conditional distribution $p ( x | c ) )$ . We can use a conditional latent variable model $p _ { \theta } ( x , z | c ) = p _ { \theta } ( x | z , c ) p _ { \theta } ( z | c )$ , however, as before, computing the marginal likelihood is generally intractable. It is straightforward to adapt the bounds and techniques from the previous section to this problem.
204
+
205
+ ![](images/91eefa28a63730121c99b026911c4b3915048b1370526f3bf876517154d33a0f.jpg)
206
+ Figure 3: Log-likelihood lower bounds for generative modeling on MNIST. The left and middle plots compare performance with different number of samples $K = 3 2$ , 256. For clarity the legend is shared between the plots. The bold lines are the average over three trials, and individual trials are displayed as semi-transparent). The right plot compares performance as the convex combination between IWAE-DReG and RWS-DReG is varied (Eq. 10). To highlight differences, we plot the difference between the test IWAE bound and the test IWAE bound IWAE-DReG achieved at that step.
207
+
208
+ To evaluate our method in this context, we use the standard task of modeling the bottom half of a binarized MNIST digit from the top half. We use a similar architecture, but now learn a conditional prior distribution $p _ { \theta } ( z | c )$ where $c$ is the top half of the MNIST digit. The conditional prior feeds $c$ to two deterministic layers of 200 tanh units to parameterize a factorized Gaussian distribution over $z$ . To model the conditional distribution $p _ { \theta } ( x | c , z )$ , we concatenate $z$ with $c$ and feed it to two deterministic layers of 200 tanh units to parameterize factorized Bernoulli outputs.
209
+
210
+ As in the previous tasks, the doubly reparameterized gradient estimator improves across all three updates (IWAE, RWS, and JVI; Appendix Fig. 7). However, on this task, the biased estimators (STL and RWS) underperform unbiased IWAE gradient estimators (Fig. 4). In particular, RWS becomes unstable later in training. We suspect that this is because RWS does not directly optimize a consistent objective.
211
+
212
+ ![](images/57312dcd20d125385cf7e6526c7c22ebd0eaef48131ffdc8b992f9c2c7c72fc0.jpg)
213
+ Figure 4: Log-likelihood lower bounds for structured prediction on MNIST. The left plot uses $K =$ 64 samples and the right plot uses $K \ : = \ : 2 5 6$ samples. For clarity the legend is shared between the plots. The bold lines are the average over three trials, and individual trials are displayed as semi-transparent). The right plot compares performance as the convex combination between IWAEDReG and RWS-DReG is varied (Eq. 10). To highlight differences, we plot the difference between the test IWAE bound and the test IWAE bound IWAE-DReG achieved at that step.
214
+
215
+ # 7 DISCUSSION
216
+
217
+ In this work, we introduce doubly reparameterized estimators for the updates in IWAE, RWS, and JVI. We demonstrate that across tasks they provide unbiased variance reduction, which leads to improved performance. Furthermore, DReG estimators have the same computational cost as the original estimators. As a result, we recommend that DReG estimators be used instead of the typical gradient estimators.
218
+
219
+ Variational Sequential Monte Carlo (Maddison et al., 2017; Naesseth et al., 2018; Le et al., 2018) and Neural Adapative Sequential Monte Carlo (Gu et al., 2015) extend IWAE and RWS to sequential latent variable models, respectively. It would be interesting to develop DReG estimators for these approaches as well.
220
+
221
+ We found that a convex combination of IWAE-DReG and RWS-DReG performed best, however, the weighting was task dependent. In future work, we intend to apply ideas from (Baydin et al., 2017) to automatically adapt the weighting based on the data.
222
+
223
+ Finally, the form of the IWAE-DReG estimator (Eq. 7) is surprisingly simple and suggests that there may be a more direct derivation that is applicable to general MCOs.
224
+
225
+ # ACKNOWLEDGMENTS
226
+
227
+ We thank Ben Poole and Diederik P. Kingma for helpful discussion and comments on drafts of this paper. We thank Sergey Levine and Jascha Sohl-Dickstein for insightful discussion.
228
+
229
+ # REFERENCES
230
+
231
+ Jimmy Ba, Ruslan R Salakhutdinov, Roger B Grosse, and Brendan J Frey. Learning Wake-Sleep Recurrent Attention Models. In C Cortes, N D Lawrence, D D Lee, M Sugiyama, and R Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2593–2601. 2015.
232
+
233
+ Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. International Conference on Learning Representations, 2017.
234
+
235
+ Atilim Gunes Baydin, Robert Cornish, David Martinez Rubio, Mark Schmidt, and Frank Wood. Online learning rate adaptation with hypergradient descent. arXiv preprint arXiv:1703.04782, 2017.
236
+
237
+ David M Blei, Alp Kucukelbir, and Jon D McAuliffe. Variational inference: A review for statisticians. Journal of the American Statistical Association, 2017.
238
+
239
+ Jorg Bornschein and Yoshua Bengio. Reweighted wake-sleep. ¨ International Conference on Learning Representations, 2014.
240
+
241
+ Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. nternational Conference on Learning Representations, 2015.
242
+
243
+ George Casella and Roger L Berger. Statistical inference, volume 2. Duxbury Pacific Grove, CA.
244
+
245
+ Xi Chen, Diederik P Kingma, Tim Salimans, Yan Duan, Prafulla Dhariwal, John Schulman, Ilya Sutskever, and Pieter Abbeel. Variational lossy autoencoder. International Conference on Learning Representations, 2016.
246
+
247
+ 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.
248
+
249
+ Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. International Conference on Machine Learning, 2018.
250
+
251
+ Michael Figurnov, Shakir Mohamed, and Andriy Mnih. Implicit reparameterization gradients. arXiv preprint arXiv:1805.08498, 2018.
252
+
253
+ 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.
254
+
255
+ Alex Graves. Stochastic backpropagation through mixture density distributions. arXiv preprint arXiv:1607.05690, 2016.
256
+
257
+ Shixiang Gu, Zoubin Ghahramani, and Richard E Turner. Neural adaptive sequential monte carlo. In Advances in Neural Information Processing Systems, pp. 2629–2637, 2015.
258
+
259
+ Ishaan Gulrajani, Kundan Kumar, Faruk Ahmed, Adrien Ali Taiga, Francesco Visin, David Vazquez, and Aaron Courville. Pixelvae: A latent variable model for natural images. International Conference on Learning Representations, 2016.
260
+
261
+ David Ha and Jurgen Schmidhuber. World models. ¨ Advances in neural information processing systems, 2018.
262
+
263
+ Geoffrey E Hinton, Peter Dayan, Brendan J Frey, and Radford M Neal. The” wake-sleep” algorithm for unsupervised neural networks. Science, 268(5214):1158–1161, 1995.
264
+
265
+ Martin Jankowiak and Theofanis Karaletsos. Pathwise derivatives for multivariate distributions. arXiv preprint arXiv:1806.01856, 2018.
266
+
267
+ Martin Jankowiak and Fritz Obermeyer. Pathwise derivatives beyond the reparameterization trick. arXiv preprint arXiv:1806.01851, 2018.
268
+
269
+ Michael I Jordan, Zoubin Ghahramani, Tommi S Jaakkola, and Lawrence K Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
270
+
271
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. nternational Conference on Learning Representations, 2013.
272
+
273
+ 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, pp. 4743–4751, 2016.
274
+
275
+ Rahul G Krishnan, Uri Shalit, and David Sontag. Deep kalman filters. arXiv preprint arXiv:1511.05121, 2015.
276
+
277
+ Tuan Anh Le, Adam R Kosiorek, N Siddharth, Yee Whye Teh, and Frank Wood. Revisiting reweighted wake-sleep. arXiv preprint arXiv:1805.10469, 2018.
278
+
279
+ Chris J Maddison, John Lawson, George Tucker, Nicolas Heess, Mohammad Norouzi, Andriy Mnih, Arnaud Doucet, and Yee Teh. Filtering variational objectives. In Advances in Neural Information Processing Systems, pp. 6573–6583, 2017.
280
+
281
+ Andriy Mnih and Danilo J Rezende. Variational inference for monte carlo objectives. International Conference on Machine Learning, 2016.
282
+
283
+ Christian Naesseth, Scott Linderman, Rajesh Ranganath, and David Blei. Variational sequential monte carlo. In International Conference on Artificial Intelligence and Statistics, pp. 968–977, 2018.
284
+
285
+ Sebastian Nowozin. Debiasing evidence approximations: On importance-weighted autoencoders and jackknife variational inference. International Conference on Learning Representations, 2018.
286
+
287
+ Tom Rainforth, Adam R Kosiorek, Tuan Anh Le, Chris J Maddison, Maximilian Igl, Frank Wood, and Yee Whye Teh. Tighter variational bounds are not necessarily better. International Conference on Machine Learning, 2018.
288
+
289
+ Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International Conference on Machine Learning, pp. 1530–1538, 2015.
290
+
291
+ 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.
292
+
293
+ Geoffrey Roeder, Yuhuai Wu, and David Duvenaud. Sticking the landing: An asymptotically zerovariance gradient estimator for variational inference. Advances in Neural Information Processing Systems, 2017.
294
+
295
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
296
+
297
+ ![](images/7ffa93e6f5fc7abf77a65f5e1e89c9d93b2b6bc4de4b83ce2419386b77d72819.jpg)
298
+ Figure 5: Omniglot generative modeling trained according to IWAE (left), RWS (middle), and JVI (right). The top row compares the variance of the original gradient estimator (dashed) with the variance of the doubly reparameterized gradient estimator (solid). The bottom row compares test performance. The left and middle plots show the IWAE (stochastic) lower bound on the test set. The right plot shows the JVI estimator (which is not a bound) on the test set. The bold lines are the average over three trials, and individual trials are displayed as semi-transparent). All methods used $K = 6 4$ .
299
+
300
+ ![](images/d1fea5490bd6f00c24f8597bd2e4e41c3581964a9195ed30b99b3ed5eadd72de.jpg)
301
+ Figure 6: Log-likelihood lower bounds for structured prediction on Omniglot. The left plot uses $K = 6 4$ samples and the right plot uses $K = 2 5 6$ samples. For clarity the legend is shared between the plots. The bold lines are the average over three trials, and individual trials are displayed as semi-transparent). The right plot compares performance as the convex combination between IWAEDReG and RWS-DReG is varied. To highlight differences, we plot the difference between the test IWAE bound and the test IWAE bound IWAE-DReG achieved at that step.
302
+
303
+ # 8.1 EQUIVALENCE BETWEEN REINFORCE GRADIENT AND REPARAMETERIZATION TRICK GRADIENT
304
+
305
+ Given a function $f ( z , \phi )$ , we have
306
+
307
+ $$
308
+ \mathbb { E } _ { q _ { \phi } ( z ) } \left[ f ( z , \phi ) \frac { \partial \log q _ { \phi } ( z ) } { \partial \phi } \right] = \mathbb { E } _ { \epsilon } \left[ \frac { \partial f ( z , \phi ) } { \partial z } \frac { \partial z ( \epsilon , \phi ) } { \partial \phi } \right] ,
309
+ $$
310
+
311
+ ![](images/f02e86f7fcf015fdcf9ac2e707a8330b4e3f45ea3fff361779e45e958a954f98.jpg)
312
+ Figure 7: Structured prediction on MNIST according to IWAE (left), RWS (middle), and JVI (right). The top row compares the variance of the original gradient estimator (dashed) with the variance of the doubly reparameterized gradient estimator (solid). The bottom row compares test performance. The left and middle plots show the IWAE (stochastic) lower bound on the test set. The right plot shows the JVI estimator (which is not a bound) on the test set. The bold lines are the average over three trials, and individual trials are displayed as semi-transparent). All methods used $K = 6 4$ .
313
+
314
+ ![](images/39fd367425ce5cdcaf0a8bab14584ea5412d42a363430f34083726be95e22c55.jpg)
315
+ Figure 8: Variance of the gradient estimators on the MNIST generative modeling task. We plot the trace of the variance of the doubly reparameterized gradient estimator relative to the original gradient estimator for IWAE (left), RWS (middle), and JVI (right) as the number of samples (K) is varied.
316
+
317
+ for a reparameterizable distribution $q _ { \phi } ( z )$ . To see this, note that
318
+
319
+ $$
320
+ \begin{array} { r l } & { \displaystyle \frac { d } { d \phi } \int _ { z } q _ { \phi } ( z ) f ( z , \phi ) d z = \int _ { z } \frac { \partial } { \partial \phi } q _ { \phi } ( z ) f ( z , \phi ) d z = \int _ { z } f ( z , \phi ) \frac { \partial } { \partial \phi } q _ { \phi } ( z ) + q _ { \phi } ( z ) \frac { \partial } { \partial \phi } f ( z , \phi ) d z } \\ & { \quad \quad \quad \quad = \int _ { z } f ( z , \phi ) q _ { \phi } ( z ) \frac { \partial \log q _ { \phi } ( z ) } { \partial \phi } d z + \mathbb { E } _ { q _ { \phi } ( z ) } \left[ \frac { \partial f ( z , \phi ) } { \partial \phi } \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { q _ { \phi } ( z ) } \left[ f ( z , \phi ) \frac { \partial \log q _ { \phi } ( z ) } { \partial \phi } \right] + \mathbb { E } _ { q _ { \phi } ( z ) } \left[ \frac { \partial f ( z , \phi ) } { \partial \phi } \right] , } \end{array}
321
+ $$
322
+
323
+ via the REINFORCE gradient. On the other hand,
324
+
325
+ $$
326
+ \begin{array} { l } { \displaystyle \frac { d } { d \phi } \int _ { z } q _ { \phi } ( z ) f ( z , \phi ) d z = \frac { d } { d \phi } \mathbb { E } _ { q _ { \phi } ( z ) } \left[ f ( z , \phi ) \right] = \frac { d } { d \phi } \mathbb { E } _ { \epsilon } \left[ f ( z ( \epsilon , \phi ) , \phi ) \right] = \mathbb { E } _ { \epsilon } \left[ \frac { d } { d \phi } f ( z ( \epsilon , \phi ) , \phi ) \right] } \\ { = \mathbb { E } _ { \epsilon } \left[ \frac { \partial f ( z , \phi ) } { \partial z } \frac { \partial z ( \epsilon , \phi ) } { \partial \phi } \right] + \mathbb { E } _ { \epsilon } \left[ \frac { \partial f ( z , \phi ) } { \partial \phi } \Big | _ { z = z ( \epsilon , \phi ) } \right] } \\ { = \mathbb { E } _ { \epsilon } \left[ \frac { \partial f ( z , \phi ) } { \partial z } \frac { \partial z ( \epsilon , \phi ) } { \partial \phi } \right] + \mathbb { E } _ { q _ { \phi } ( z ) } \left[ \frac { \partial f ( z , \phi ) } { \partial \phi } \right] , } \end{array}
327
+ $$
328
+
329
+ via the reparameterization trick. Thus, we conclude that
330
+
331
+ $\Xi _ { q _ { \phi } ( z ) } \left[ f ( z , \phi ) \frac { \partial \log q _ { \phi } ( z ) } { \partial \phi } \right] + \mathbb { E } _ { q _ { \phi } ( z ) } \left[ \frac { \partial f ( z , \phi ) } { \partial \phi } \right] = \mathbb { E } _ { \epsilon } \left[ \frac { \partial f ( z , \phi ) } { \partial z } \frac { \partial z ( \epsilon , \phi ) } { \partial \phi } \right] + \mathbb { E } _ { q _ { \phi } ( z ) } \left[ \frac { \partial f ( z , \phi ) } { \partial \phi } \right] ,$ from which the identity follows.
332
+
333
+ # 8.2 ASYMPTOTIC ANALYSIS
334
+
335
+ At a high level, Rainforth et al. (2018) show that the expected value of the IWAE gradient of the inference network collapses to zero with rate √ $1 / K$ , while its standard deviation is only shrinking at a rate of $1 / \sqrt { K }$ . This is the essence of the problem that results in the SNR (expectation divided by standard deviation) of the inference network gradients going to zero at a rate √ $\mathcal { O } ( ( 1 / K ) / ( 1 / \sqrt { K } ) ) \stackrel { - } { = }$ $\mathcal { O } ( 1 / \sqrt { K } )$ , worsening with $K$ . In contrast, Rainforth et al. (2018) show that the generation network gradients scales like $\mathcal { O } ( \sqrt { K } )$ , improving with $K$ .
336
+
337
+ Because the IWAE-DReG estimator is unbiased, we cannot hope to change the scaling of the expected value in $K$ , but we can hope to change the scaling of the variance. In particular, in this subsection, we provide an informal argument, via the delta method, that the standard deviation of IWAE-DReG scales like $K ^ { - 3 / 2 }$ , which results in an overall scaling of $\mathcal { O } ( \sqrt { K } )$ for the inference network gradient’s SNR (i.e., increasing with $K$ ). Thus, the SNR of the IWAE-DReG estimator improves similarly in $K$ for both inference and generation networks.
338
+
339
+ We will appeal to the delta method on a two-variable function $g : \mathbb { R } ^ { 2 } \mathbb { R }$ . Define the following notation for the partials of $g$ evaluated at the mean of random variables $X , Y$ ,
340
+
341
+ $$
342
+ g _ { x } ( X , Y ) = \left. { \frac { \partial g ( x , y ) } { \partial x } } \right| _ { ( x , y ) = ( \operatorname { \mathbb { E } } ( X ) , \operatorname { \mathbb { E } } ( Y ) ) }
343
+ $$
344
+
345
+ The delta method approximation of $\operatorname { V a r } ( g ( X , Y ) )$ is given by (Section 5.5 of Casella & Berger),
346
+
347
+ $$
348
+ \mathrm { V a r } ( g ( X , Y ) ) \approx g _ { x } ( X , Y ) ^ { 2 } \mathrm { V a r } ( X ) + 2 g _ { x } ( X , Y ) g _ { y } ( X , Y ) \mathrm { C o v } ( X , Y ) + g _ { y } ( X , Y ) ^ { 2 } \mathrm { V a r } ( Y )
349
+ $$
350
+
351
+ , f gen, and $\phi$ s a si. Let aramet, then $u _ { i } \ =$ $w _ { i } ^ { 2 } \frac { \partial \log { w _ { i } } } { \partial z _ { i } } \frac { \partial z _ { i } } { \partial \phi }$ $\textstyle X = \sum _ { i = 1 } ^ { K } u _ { i }$ $\textstyle Y = \sum _ { i = 1 } ^ { K } w _ { i }$ $g ( X , Y ) = X / Y ^ { 2 }$ $g ( X , Y )$ IWAE-DReG estimator whose variance we seek to understand. Letting $Z = \mathbb { E } ( w _ { i } )$ and $U = \mathbb { E } ( u _ { i } )$ we get in this case after cancellations,
352
+
353
+ $$
354
+ \mathrm { V a r } ( g ( X , Y ) ) \approx \frac { 1 } { Z ^ { 4 } } \frac { \mathrm { V a r } ( X ) } { K ^ { 4 } } - \frac { 4 U } { Z ^ { 5 } } \frac { \mathrm { C o v } ( X , Y ) } { K ^ { 4 } } + \frac { 4 U ^ { 2 } } { Z ^ { 6 } } \frac { \mathrm { V a r } ( Y ) } { K ^ { 4 } }
355
+ $$
356
+
357
+ Because $w _ { i }$ are all mutually independent, we get $\operatorname { V a r } ( Y ) = K \operatorname { V a r } ( w _ { i } )$ . Similarly for $\operatorname { V a r } ( X )$ and $u _ { i }$ . Because the $w _ { i }$ and $u _ { i }$ are identically distributed and independent for $i \neq j$ , we have $\operatorname { C o v } ( X , Y ) = K \operatorname { C o v } ( w _ { i } , u _ { i } )$ . All together we can see that $\mathrm { V a r } ( g ( \bar { X , Y } ) )$ scales like $\dot { K } ^ { - 3 }$ . Thus, the standard deviation scales like $K ^ { - 3 / 2 }$ .
358
+
359
+ # 8.3 UNIFIED SURROGATE OBJECTIVES FOR ESTIMATORS
360
+
361
+ In the main text, we assumed that $\theta$ and $\phi$ were disjoint, however, it can be helpful to share parameters between $p$ and $q$ (e.g., (Fraccaro et al., 2016)). With the IWAE bound, we differentiate a single objective with respect to both the $p$ and $q$ parameters. Thus it is straightforward to adapt IWAE and IWAE-DReG to the shared parameter setting. In this section, we discuss how to deal with shared parameters in RWS.
362
+
363
+ Suppose that both $p$ and $q$ are parameterized by $\theta$ . If we denote the unshared parameters of $q$ by $\phi$ , then we can restrict the RWS wake update to only $\phi$ . Alternatively, with a modified RWS wake update, we can derive a single surrogate objective for each scenario such that taking the gradient with respect to $\theta$ results in the proper update. For clarity, we introduce the following modifier notation for $p _ { \theta } ( x , z _ { i } )$ , $q _ { \theta } ( z _ { i } | x )$ , and $w _ { i }$ which are functions of $\theta$ and $z _ { i } = z ( \theta , \epsilon _ { i } )$ . We use $\tilde { X }$ to mean $X$ with stopped gradients with respect to $z _ { i }$ , $\hat { X }$ to mean $X$ with stopped gradients with respect to $\theta$ (but not $\theta$ is not stopped in $z ( \theta , \epsilon _ { i } { \bar { ) } } )$ , and $\bar { X }$ to mean $X$ with stopped gradients for all variables. Then, we can use the following surrogate objectives:
364
+
365
+ IWAE:
366
+
367
+ $$
368
+ L _ { I W A E } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \log w _ { i } \right]
369
+ $$
370
+
371
+ DReG IWAE:
372
+
373
+ $$
374
+ L _ { D R e G - I W A E } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \log \tilde { p } _ { \theta } ( x , z _ { i } ) + \left( \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \right) ^ { 2 } \log \hat { w } _ { i } \right]
375
+ $$
376
+
377
+ RWS:
378
+
379
+ $$
380
+ L _ { R W S } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \left( \log \tilde { p } _ { \theta } ( x , z _ { i } ) + \log \tilde { q } _ { \theta } ( z _ { i } | x ) \right) \right]
381
+ $$
382
+
383
+ DReG RWS:
384
+
385
+ $$
386
+ L _ { D R e G - R W S } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \log \tilde { p } _ { \theta } ( x , z _ { i } ) + \left( \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } - \left( \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \right) ^ { 2 } \right) \log \hat { w } _ { i } \right]
387
+ $$
388
+
389
+ STL:
390
+
391
+ $$
392
+ L _ { S T L } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \left( \log \tilde { p } _ { \theta } ( x , z _ { i } ) + \log \hat { w } _ { i } \right) \right]
393
+ $$
394
+
395
+ $\mathrm { D R e G } ( \alpha )$
396
+
397
+ $$
398
+ { \bf \Psi } _ { ^ { \prime } D R e G ( \alpha ) } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \log \tilde { p } \theta ( x , z _ { i } ) + \left( \alpha \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } + ( 1 - 2 \alpha ) \left( \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \right) ^ { 2 } \right) \log \hat { w } _ { i } \right]
399
+ $$
400
+
401
+ The only subtle difference is that DReG( $\alpha = 0 . 5$ ) does not correspond exactly to STL due to the scaling between terms:
402
+
403
+ $$
404
+ L _ { D R e G ( \alpha = 0 . 5 ) } ( \theta ) = \mathbb { E } _ { \epsilon _ { 1 : K } } \left[ \sum _ { i = 1 } ^ { K } \frac { \bar { w } _ { i } } { \sum _ { j } \bar { w } _ { j } } \left( \log \tilde { p } _ { \theta } ( x , z _ { i } ) + 0 . 5 \log \hat { w } _ { i } \right) \right]
405
+ $$
md/train/HkYhZDqxg/HkYhZDqxg.md ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TREE-STRUCTURED DECODING WITH DOUBLYRECURRENT NEURAL NETWORKS
2
+
3
+ David Alvarez-Melis & Tommi S. Jaakkola Computer Science and Artificial Intelligence Lab MIT {davidam,tommi}@csail.mit.edu
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a neural network architecture for generating tree-structured objects from encoded representations. The core of the method is a doubly recurrent neural network model comprised of separate width and depth recurrences that are combined inside each cell (node) to generate an output. The topology of the tree is modeled explicitly together with the content. That is, in response to an encoded vector representation, co-evolving recurrences are used to realize the associated tree and the labels for the nodes in the tree. We test this architecture in an encoderdecoder framework, where we train a network to encode a sentence as a vector, and then generate a tree structure from it. The experimental results show the effectiveness of this architecture at recovering latent tree structure in sequences and at mapping sentences to simple functional programs.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recurrent neural networks have become extremely popular for modeling structured data. Key to their success is their ability to learn long-range temporal dependencies, their flexibility, and ease of customization. These architectures are naturally suited for modeling sequences since the underlying state evolution resulting from successive operations follows an inherently linear order (Williams & Zipser, 1995; Hochreiter & Schmidhuber, 1997). Indeed, they have been successfully adapted to language modeling (Zaremba et al., 2015), machine translation (Sutskever et al., 2014) and conversational agents (Vinyals & Le, 2015), among other applications.
12
+
13
+ Although sequences arise frequently in practice, other structures such as trees or graphs do not naturally conform to a linear ordering. For example, natural language sentences or associated parse trees, programs, hierarchical structures in biology, or molecules are not inherently linear structures. While sentences in natural language can be modeled as if they were linear sequences, the underlying process is compositional (Frege, 1892). Models that construct sentences compositionally should derive an advantage from adopting a more appropriate inductive bias.
14
+
15
+ The flexibility and success of recurrent neural networks in modeling and generating sequential data has prompted efforts to adapt them to non-sequential data too. Recent work has focused on the application of neural architectures to hierarchical structures, albeit in limited ways. Much of this work has assumed that either the full tree structure is given (Socher et al., 2012; Tai et al., 2015) or at least the nodes are (Socher & Lin, 2011; Chen & Manning, 2014; Kiperwasser & Goldberg, 2016). In the former scenario, the network aggregates the node information in a manner that is coherent with a given tree structure while, in the latter, generation is reduced to an attachment problem, i.e., sequentially deciding which pairs of nodes to join with an edge until a tree is formed.
16
+
17
+ The full problem of decoding with structure, i.e., generating a tree-structured object with node labels from a given vector representation, has remained largely unexplored until recently. Recent efforts to adapt RNNs to this context have so far remained relatively close to their sequential counterparts. For example, in order to capture depth and branching in the tree, one can introduce special tokens (Dong & Lapata, 2016) or use alternating RNNs coupled with external classifiers to predict branching (Zhang et al., 2016).
18
+
19
+ In this work, we propose a novel architecture tailored specifically to tree-structured decoding. At the heart of our approach is a doubly-recurrent (breadth and depth-wise recurrent) neural network which separately models the flow of information between parent and children nodes, and between siblings. Each of these relationships is modeled with a recurrent module whose hidden states are updated upon observing node labels. Every node in the tree receives two hidden states, which are then combined and used to predict a label for that node. Besides maintaining separate but simultaneous fraternal and paternal recurrences, the proposed architecture departs from previous methods in that it explicitly models tree topology. Each node in the network has modules that predict, based on the cell state, whether the node is terminal, both in terms of depth and width. Decoupling these decisions from the label prediction allows for a more concise formulation, which does not require artificial tokens to be added to the tree to simulate branching.
20
+
21
+ We test this novel architecture in various encoder-decoder frameworks, coupling it with sequential encoders to predict tree structure from encoded vector representations of sequences. The experimental results show the effectiveness of this approach at recovering latent structure in flattened string representations of trees (Section 4.1) and at mapping from natural language descriptions of simple programs to abstract syntax trees (Section 4.2). In addition, we show that even for sequence-tosequence tasks such as machine translation, the proposed architecture exhibits desirable properties, such as invariance to structural changes and coarse-to-fine generation (Section 4.3).
22
+
23
+ To summarize, the main contributions of this paper are as follows:
24
+
25
+ • We propose a novel neural network architecture specifically tailored to tree-structured decoding, which maintains separate depth and width recurrent states and combines them to obtain hidden states for every node in the tree. We equip this novel architecture with a mechanism to predict tree topology explicitly (as opposed to implicitly by adding nodes with special tokens). We show experimentally that the proposed method is capable of recovering trees from encoded representations and that it outperforms state-of-the-art methods in a task consisting of mapping sentences to simple functional programs.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ Recursive Neural Networks. Recursive neural networks (Socher & Lin, 2011; Socher et al., 2012) were proposed to model data with hierarchical structures, such as parsed scenes and natural language sentences. Though they have been most successfully applied to encoding objects when their treestructured representation is given (Socher et al., 2013), the original formulation by Socher & Lin (2011) also considered using them to predict the structure (edges), albeit for the case where nodes are given. Thus, besides their limited applicability due to their assumption of binary trees, recursive neural networks are not useful for fully generating trees from scratch.
30
+
31
+ Tree-structured encoders. The Tree-LSTM of Tai et al. (2015) is a generalization of long shortterm memory networks (Hochreiter & Schmidhuber, 1997) to tree-structured inputs. Their model constructs a sentence representation bottom-up, obtaining at every step the representation of a node in the tree from those of its children. In this sense, this model can be seen as a generalization of recursive neural networks to trees with degree potentially greater than two, with the additional longrange dependency modeling provided by LSTMs. They propose two methods for aggregating the states of the children, depending on the type of underlying tree: N-ary trees or trees with unknown and potentially unbounded branching factor. TreeLSTMs have shown promising results for compositional encoding of structured data, though by construction they cannot be used for decoding, since they operate on a given tree structure.
32
+
33
+ Tree-structured decoders. Proposed only very recently, most tree-structured decoders rely on stacked on intertwined RNNs, and use heuristic methods for topological decisions during generation. Closest to our method is the Top-down Tree LSTM of Zhang et al. (2016), which generates a tree from an encoded representation. Their method relies on 4 independent LSTMs, which act in alternation—as opposed to simultaneously in our approach—yielding essentially a standard LSTM that changes the weights it uses based on the position of the current node. In addition, their method provides children with asymmetric parent input: “younger” children receive information from the parent state only through the previous sibling’s state. Though most of their experiments focus on the case where the nodes are given, they mention how to use their method for full prediction by introducing additional binary classifiers which predict which of the four LSTMs is to be used. These classifiers are trained in isolation after the main architecture has been trained. Contrary to this approach, our method can be trained end-to-end in only one pass, has a simpler formulation and explicitly incorporates topological prediction as part of the functioning of each neuron.
34
+
35
+ A similar approach is proposed by Dong & Lapata (2016). They propose SEQ2TREE, an encoderdecoder architecture that maps sentences to tree structures. For the decoder, they rely on hierarchical use of an LSTM, similar to Tai et al. (2015), but in the opposite direction: working top-down from the root of the tree. To decide when to change levels in the hierarchy, they augment the training trees with nonterminal nodes labeled with a special token $< n >$ , which when generated during decoding trigger the branching out into a lower level in the tree. Similar to our method, they feed nodes with hidden representations of their parent and sibling, but they do so by concatenating both states and running them through a single recurrent unit, as opposed to our method, where these two sources of information are handled separately. A further difference is that our approach does not require artificial nodes with special tokens to be added to the tree, resulting in smaller trees.
36
+
37
+ Hierarchical Neural Networks for Parsing. Neural networks have also been recently introduced to the problem of natural language parsing (Chen & Manning, 2014; Kiperwasser & Goldberg, 2016). In this problem, the task is to predict a parse tree over a given sentence. For this, Kiperwasser & Goldberg (2016) use recurrent neural networks as a building block, and compose them recursively to obtain a tree-structured encoder. Starting from the leaves (words) they predict a parse tree with a projective bottom-up strategy, which sequentially updates the encoded vector representation of the tree and uses it to guide edge-attaching decisions. Though conceptually similar to our approach, their method relies on having access to the nodes of the tree (words) and only predicts its topology, so—similar to recursive neural networks—it cannot be used for a fully generative decoding.
38
+
39
+ # 3 DOUBLY RECURRENT NEURAL NETWORKS
40
+
41
+ Generating a tree-structured object from scratch using only an encoded representation poses several design challenges. First, one must decide in which order to generate the tree. If the nodes on the decoder side were given (such as in parsing), it would be possible to generate a tree bottom-up from these nodes (e.g. as Kiperwasser & Goldberg 2016 do). In the setting we are interested in, however, not even the nodes are known when decoding, so the natural choice is a top-down decoder, which starting from an encoded representation generates the root of the tree and then recursively generates the children (if any) of every node.
42
+
43
+ The second challenge arises from the asymmetric hierarchical nature of trees. Unlike the sequenceto-sequence setting where encoding and decoding can be achieved with analogous procedures, when dealing with tree-structured data these two involve significantly different operations. For example, an encoder that processes a tree bottom-up using information of a node’s children to obtain its representation cannot be simply reversed and used as a decoder, since when generating the tree top-down, nodes have to be generated before their children are.
44
+
45
+ An additional design constraint comes from deciding what information to feed to each node. For sequences, the choice is obvious: a node should receive information from the node preceding or succeeding it (or both), i.e. there is a one-dimensional flow of information. In trees, there is an evident flow of information from parent to children (or vice-versa), but when generating nodes in a top-down order it seems unnatural to generate children in isolation: the label of one of them will likely influence what the states of the other children might be. For example, in the case of parse trees, generating a verb will reduce the chances of other verbs occurring in that branch.
46
+
47
+ With these considerations in mind, we propose an architecture tailored to tree decoding from scratch: top-down, recursive and doubly-recurrent, i.e. where both the ancestral (parent-to-children) and fraternal (sibling-to-sibling) flows of information are modeled with recurrent modules. Thus, the building block of a doubly recurrent neural network (DRNN) is a cell with two types of input states, one coming from its parent, updated and passed on to its descendants, and another one received from its previous sibling,1 updated and passed on to the next one. We model the flow of information in the two directions with separate recurrent modules.
48
+
49
+ Formally, let $\mathcal { T } = \{ \mathcal { V } , \mathcal { E } , \mathcal { X } \} _ { \mathrm { ~ \scriptsize ~ . ~ } }$ be a connected labeled tree, where $\nu$ is the set of nodes, $\mathcal { E }$ the set of edges and $\mathcal { X }$ are node labels.2 Let $g ^ { a }$ and $g ^ { f }$ be functions which apply one step of the two separate RNNs. For a node $i \in \mathcal V$ with parent $p ( i )$ and previous sibling $s ( i )$ , the ancestral and fraternal hidden states are updated via
50
+
51
+ $$
52
+ \begin{array} { r } { \mathbf h _ { i } ^ { a } = g ^ { a } ( \mathbf h _ { p ( i ) } ^ { a } , \mathbf x _ { p ( i ) } ) } \\ { \mathbf h _ { i } ^ { f } = g ^ { f } ( \mathbf h _ { s ( i ) } ^ { f } , \mathbf x _ { s ( i ) } ) } \end{array}
53
+ $$
54
+
55
+ where $\mathbf { x } _ { s ( j ) } , \mathbf { x } _ { p ( i ) }$ are the vectors representing the previous sibling’s and parent’s values, respectively. Once the hidden depth and width states have been updated with these observed labels, they are combined to obtain a predictive hidden state:
56
+
57
+ $$
58
+ \mathbf { h } _ { i } ^ { ( p r e d ) } = \operatorname { t a n h } \left( \mathbf { U } ^ { f } \mathbf { h } _ { i } ^ { f } + \mathbf { U } ^ { a } \mathbf { h } _ { i } ^ { a } \right)
59
+ $$
60
+
61
+ where $\mathbf { U } ^ { f } \in \mathbb { R } ^ { n \times D _ { f } }$ and $\mathbf { U } ^ { a } \in \mathbb { R } ^ { n \times D _ { a } }$ are learnable parameters. This state contains combined information of the node’s neighborhood in the tree, and is used to predict a label for it. In its simplest form, the network could compute the output of node $i$ by sampling from distribution
62
+
63
+ $$
64
+ \mathbf { o } _ { i } = \mathrm { s o f t m a x } ( \mathbf { W } \mathbf { h } _ { i } ^ { ( p r e d ) } )
65
+ $$
66
+
67
+ In the next section, we propose a slight modification to (4) whereby topological information is included in the computation of cell outputs. After the node’s output symbol $\mathbf { x } _ { i }$ has been obtained by sampling from $\mathbf { o } _ { i }$ , the cell passes $\mathbf { h } _ { i } ^ { a }$ to all its children and ${ \bf { h } } _ { i } ^ { f }$ to the next sibling (if any), enabling them to apply Eqs (1) and (2) to realize their states. This procedure continues recursively, until termination conditions (explained in the next section) cause it to halt.
68
+
69
+ # 3.1 TOPOLOGICAL PREDICTION
70
+
71
+ As mentioned before, the central issue with free-form tree construction is to predict the topology of the tree. When constructing the tree top-down, for each node we need to decide: (i) whether it is a leaf node (and thus it should not produce offspring) and (ii) whether there should be additional siblings produced after it. Answering these two questions for every node allows us to construct a tree from scratch and eventual stop growing it.
72
+
73
+ Sequence decoders typically rely on special tokens to terminate generation (Sutskever et al., 2014). The token is added to the vocabulary and treated as a regular word. During training, the examples are padded with this token at the end of the sequence, and during testing, generation of this token signals termination. These ideas has been adopted by most tree decoders (Dong & Lapata, 2016). There are two important downsides of using a padding strategy for topology prediction in trees. First, the size of the tree can grow considerably. While in the sequence framework only one stopping token is needed, a tree with $n$ nodes might need up to $O ( n )$ padding nodes to be added. This can have important effects in training speed. The second reason is that a single stopping token selected competitively with other tokens requires one to continually update the associated parameters in response to any changes in the distribution over ordinary tokens so as to maintain topological control.
74
+
75
+ Based on these observations, we propose an alternative approach to stopping, in which topological decisions are made explicitly (as opposed to implicitly, with stopping tokens). For this, we use the predictive hidden state of the node $\mathbf { \bar { h } } ^ { ( p r e d ) }$ with a projection and sigmoid activation:
76
+
77
+ $$
78
+ p _ { i } ^ { a } = \sigma ( \mathbf { u } ^ { a } \cdot \mathbf { h } _ { i } ^ { ( p r e d ) } )
79
+ $$
80
+
81
+ The value $p _ { i } ^ { a } \in [ 0 , 1 ]$ is interpreted as the probability that node $i$ has children. Analogously, we can obtain a probability of stopping fraternal branch growth after the current node as follows:
82
+
83
+ $$
84
+ p _ { i } ^ { f } = \sigma ( \mathbf { u } ^ { f } \cdot \mathbf { h } _ { i } ^ { ( p r e d ) } )
85
+ $$
86
+
87
+ ![](images/6812630ce984fe637e971c92890ea45b3726d69cb63be9c40c8f16aaf6c9cc03.jpg)
88
+ Figure 1: Left: A cell of the doubly-recurrent neural network corresponding to node $i$ with parent $p$ and sibling $s$ . Right: Structure-unrolled DRNN network in an encoder-decoder setting. The nodes are labeled in the order in which they are generated. Solid (dashed) lines indicate ancestral (fraternal) connections. Crossed arrows indicate production halted by the topology modules.
89
+
90
+ Note that these stopping strategies depart from the usual padding methods in a fundamental property: the decision to stop is made before instead of in conjunction with the label prediction. The rationale behind this is that the label of a node will likely be influenced not only by its context, but also by the type of node (terminal or non-terminal) where it is to be assigned. This is the case in language, for example, where syntactic constraints restrict the type of words that can be found in terminal nodes. For this purpose, we include the topological information as inputs to the label prediction layer. Thus, (4) takes the form
91
+
92
+ $$
93
+ \mathbf { o } _ { i } = \mathrm { s o f t m a x } ( \mathbf { W } \mathbf { h } _ { i } ^ { ( p r e d ) } + \alpha _ { i } \mathbf { v } ^ { a } + \varphi _ { i } \mathbf { v } ^ { f } )
94
+ $$
95
+
96
+ where $\alpha _ { i } , \varphi _ { i } \in \{ 0 , 1 \}$ are binary variables indicating the topological decisions and $\mathbf { v } ^ { a } , \mathbf { v } ^ { f }$ are learnable offset parameters. During training, we use gold-truth values in (7), i.e. $\alpha _ { i } = 1$ if node $i$ has children and $\varphi _ { i } = 1$ if it has a succeeding sibling. During testing, these values are obtained from $p ^ { a } , p ^ { f }$ by sampling or beam-search. A schematic representation of the internal structure of a DRNN cell and the flow of information in a tree are shown in Figure 1.
97
+
98
+ # 3.2 TRAINING DRNNS
99
+
100
+ We train DRNNs with (reverse) back-propagation through structure (BPTS) (Goller & Kuechler, 1996). In the forward pass, node outputs are computed in a top-down fashion on the structureunrolled version of the network, following the natural3 dependencies of the tree. We obtain error signal at the node level from the two types of prediction: label and topology. For the former, we compute cross-entropy loss of $\mathbf { o } _ { i }$ with respect to the true label of the node $\mathbf { x } _ { i }$ . For the topological values $p _ { i } ^ { a }$ and $p _ { i } ^ { f }$ we compute binary cross entropy loss with respect to gold topological indicators $\alpha _ { i } , \varphi _ { i } \in \{ 0 , 1 \}$ . In the backward pass, we proceed in the reverse (bottom-up) direction, feeding into every node the gradients received from child and sibling nodes and computing internally gradients with respect to both topology and label prediction. Further details on the backpropagation flow are provided in the Appendix.
101
+
102
+ Note that the way BPTS is computed implies and underlying decoupled loss function
103
+
104
+ $$
105
+ { \mathcal { L } } ( { \widehat { \mathbf { x } } } ) = \sum _ { i \in \mathcal { V } } { \mathcal { L } } ^ { l a b e l } ( \mathbf { x } _ { i } , { \widehat { \mathbf { x } } } _ { i } ) + { \mathcal { L } } ^ { t o p o } ( \mathbf { p } _ { i } , { \widehat { \mathbf { p } } } _ { i } )
106
+ $$
107
+
108
+ The decoupled nature of this loss allows us to weigh these two objectives differently, to emphasize either topology or label prediction accuracy. Investigating the effect of this is left for future work.
109
+
110
+ ![](images/fa6bf02ca4eb87925feb86a96cfa41b88c2eb0fa6f09d54cf324aab88035b0f8.jpg)
111
+ Figure 2: Trees generated by the DRNN decoder trained on subset of size $N$ of the synthetic dataset, for a test example with description “ROOT B W F J V”.
112
+
113
+ As is common with sequence generation, during training we perform teacher forcing: after predicting the label of a node and its corresponding loss, we replace it with its gold value, so that children and siblings receive the correct label for that node. Analogously, we obtain the probabilities $p ^ { a }$ and $p ^ { f }$ , compute their loss, and replace them for ground truth variables $\alpha _ { i } , \varphi _ { i }$ for all downstream computations. Addressing this exposure bias by mixing ground truth labels with model predictions during training (Venkatraman et al., 2015) or by incremental hybrid losses (Ranzato et al., 2016) is left as an avenue for future work.
114
+
115
+ # 4 EXPERIMENTS
116
+
117
+ # 4.1 SYNTHETIC TREE RECOVERY
118
+
119
+ In our first set of experiments we evaluate the effectiveness of the proposed architecture to recover trees from flattened string representations. For this, we first generate a toy dataset consisting of simple labeled trees. To isolate the effect of label content from topological prediction, we take a small vocabulary consisting of the 26 letters of the English alphabet. We generate trees in a top-down fashion, conditioning the label and topology of every node on the state of its ancestors and siblings. For simplicity, we use a Markovian assumption on these dependencies, modeling the probability of a node’s label as depending only on the label of its parent and the last sibling generated before it (if any). Conditioned on these two inputs, we model the label of the node as coming from a multinomial distribution over the alphabet with a dirichlet prior. To generate the topology of the tree, we model the probability of a node having children and a next-sibling as depending only on its label and the depth of the tree. For each tree we generate a string representation by traversing it in breadth-first preorder, starting from the root. The labels of the nodes are concatenated into a string in the order in which they were visited, resulting in a string of $| \tau |$ symbols. We create a dataset of 5,000 trees with this procedure, and split it randomly into train, validation and test sets (with a $8 0 \% , 1 0 \% , 1 0 \%$ split). Further details on the construction of this dataset are provided in the Appendix.
120
+
121
+ The task consists of learning a mapping from strings to trees, and using this learned mapping to recover the tree structure of the test set examples, given only their flattened representation. To do so, we use an encoder-decoder framework, where the strings are mapped to a fixed-size vector representation using a recurrent neural network. For the decoder, we use a DRNN with LSTM modules, which given the encoded representation generates a tree. We choose hyper-parameters with cross-validation. Full training details are provided in the Appendix.
122
+
123
+ Measuring performance only in terms of exact recovery would likely yield near-zero accuracies for most trees. Instead, we opt for a finer-grained metric of tree similarity that gives partial credit for correctly predicted subtrees. Treating tree generation as a retrieval problem, we evaluate the quality of the predicted tree in terms of the precision and recall of recovering nodes and edges present in the gold tree. Thus, we penalize both missing and superfluous components. As baseline, we induce a probabilistic context-free grammar (PCFG) on the full training data and use it to parse the test sentences. Note that unlike the DRNN, this parser has direct access to the sentence representation and thus its task is only to infer the tree structure on top of it, so this is indeed a strong baseline.
124
+
125
+ Figure 3 shows the results on the test set. Training on the full data yields node and edge retrieval F1-Scores of $7 5 \%$ and $7 1 \%$ , respectively, the latter considerably above the baseline.4 This $4 \%$ gap can be explained by correct nodes being generated in the wrong part of the tree, as in the example in
126
+
127
+ ![](images/52d37a6efb263a4c5b33630089f95cc5893e7e3496a04c264b290de2d64d54cc.jpg)
128
+ Figure 3: Left: F1-Score for models trained on randomly sampled subsets of varying size, averaged over 5 repetitions. Right: Node (first column) and edge (second) precision as a function of tree size.
129
+
130
+ ![](images/7b875204bc878bbfd26edbb3ab21a5df5bdab181ce0989b8dea5b0b05d98929c.jpg)
131
+ Figure 4: Node and edge precision as a function of tree depth (left figure) and width (right).
132
+
133
+ Figure 2. The second plot in Figure 3 shows that although small trees are recovered more accurately, precision decays slowly with tree size, with depth accounting for the largest effect (Figure 4).
134
+
135
+ # 4.2 MAPPING SENTENCES TO FUNCTIONAL PROGRAMS
136
+
137
+ Tree structures arise naturally in the context of programs. A typical compiler takes human-readable source code (expressed as sequences of characters) and transforms it into an executable abstract syntax tree (AST). Source code, however, is already semi-structured. Mapping natural language sentences directly into executable programs is an open problem, which has received considerable interest in the natural language processing community (Kate et al., 2005; Branavan et al., 2009).
138
+
139
+ The IFTTT dataset (Quirk et al., 2015) is a simple testbed for language-to-program mapping. It consists of if-this-then-that programs (called recipes) crawled from the IFTTT website5, paired with natural language descriptions of their purpose. The recipes consist of a trigger and an action, each defined in terms of a channel (e.g. “Facebook”), a function (e.g. “Post a status update”) and potentially arguments and parameters. An example of a recipe and its description are shown in Figure 5. The data is user-generated and extremely noisy, which makes the task significantly challenging.
140
+
141
+ ![](images/0f9ce1e2f1525e67ee95093f4be26f483a821b88a8a13e1cfd8b46e3af4990bf.jpg)
142
+ Figure 5: Example recipe from the IFTTT dataset. The description (above) is a user-generated natural language explanation of the if-this-then-that program (below).
143
+
144
+ Table 1: Results on the IFTTT task. Left: non-English and unintelligible examples removed (2,262 recipes). Right: examples for which at least $^ { 3 + }$ humans agree with gold (758 recipes).
145
+
146
+ <table><tr><td>Method</td><td>Channel</td><td>+Func</td><td>F1</td></tr><tr><td>retrieval</td><td>36.8</td><td>25.4</td><td>49.0</td></tr><tr><td>phrasal</td><td>27.8</td><td>16.4</td><td>39.9</td></tr><tr><td>sync</td><td>26.7</td><td>15.4</td><td>37.6</td></tr><tr><td>classifier</td><td>64.8</td><td>47.2</td><td>56.5</td></tr><tr><td>posclass</td><td>67.2</td><td>50.4</td><td>57.7</td></tr><tr><td>SEQ2SEQ</td><td>68.8</td><td>50.5</td><td>60.3</td></tr><tr><td>SEQ2TREE</td><td>69.6</td><td>51.4</td><td>60.4</td></tr><tr><td>GRU-DRNN</td><td>70.1</td><td>51.2</td><td>62.7</td></tr><tr><td>LSTM-DRNN</td><td>74.9</td><td>54.3</td><td>65.2</td></tr></table>
147
+
148
+ <table><tr><td>Method</td><td>Channel</td><td>+Func</td><td>F1</td></tr><tr><td>retrieval</td><td>43.3</td><td>32.3</td><td>56.2</td></tr><tr><td>phrasal</td><td>37.2</td><td>23.5</td><td>45.5</td></tr><tr><td>sync</td><td>36.5</td><td>23.5</td><td>45.5</td></tr><tr><td>classifier</td><td>79.3</td><td>66.2</td><td>65.0</td></tr><tr><td>posclass</td><td>81.4</td><td>71.0</td><td>66.5</td></tr><tr><td>SEQ2SEQ</td><td>87.8</td><td>75.2</td><td>73.7</td></tr><tr><td>SEQ2TREE</td><td>89.7</td><td>78.4</td><td>74.2</td></tr><tr><td>GRU-DRNN</td><td>89.9</td><td>77.6</td><td>74.1</td></tr><tr><td>LSTM-DRNN</td><td>90.1</td><td>78.2</td><td>77.4</td></tr></table>
149
+
150
+ We approach this task using an encoder-decoder framework. We use a standard RNN encoder, either an LSTM or a GRU (Cho et al., 2014), to map the sentence to a vector representation, and we use a DRNN decoder to generate the AST representation of the recipe. We use the original data split, which consists of 77,495 training, 5,171 development and 4,294 test examples. For evaluation, we use the same metrics as Quirk et al. (2015), who note that computing exact accuracy on such a noisy dataset is problematic, and instead propose to evaluate the generated AST in terms of F1-score on the set of recovered productions. In addition, they compute accuracy at the channel level (i.e. when both channels are predicted correctly) and at the function level (both channels and both functions predicted correctly).
151
+
152
+ We compare our methods against the various extraction and phrased-based machine translation baselines of Quirk et al. (2015) and the the methods of Dong & Lapata (2016): SEQ2SEQ, a sequenceto-sequence model trained on flattened representations of the AST, and SEQ2TREE, a token-driven hierarchical RNN. Following these two works, we report results on two noise-filtered subsets of the data: one with all non-English and unintelligible recipes removed and the other one with recipes for which at least three humans agreed with the gold AST. The results are shown in Table 1. In both subsets, DRNNs perform on par or above previous approaches, with LSTM-DRNN achieving significantly better results. The improvement is particularly evident in terms of F1-score, which is the only metric used by previous approaches that measures global tree reconstruction accuracy. To better understand the quality of the predicted trees beyond the function level (i.e. (b) in Figure 5), we computed node accuracy on the arguments level. Our best performing model, LSTM-DRNN, achieves a Macro F1 score of $51 \%$ (0.71 precision, 0.40 recall) over argument nodes, which shows that the model is reasonably successful at predicting structure even beyond depth three. The best performing alternative model, SEQ2TREE, achieves a corresponding F1 score of $46 \%$ .
153
+
154
+ # 4.3 MACHINE TRANSLATION
155
+
156
+ In our last set of experiments, we offer a qualitative evaluation DRNNs in the context of machine translation. Obtaining state-of-the-art results in machine translation requires highly-optimized architectures and large parallel corpora. This is not our goal. Instead, we investigate whether decoding with structure can bring benefits to a task traditionally approached as a sequence-to-sequence problem. For this reason, we consider a setting with limited data: a subset of the WMT14 dataset consisting of about 50K English French sentence pairs (see the Appendix for details) along with dependency parses of the target (English) side.
157
+
158
+ We train a sequence-to-tree model using an LSTM encoder and a DRNN decoder as in the previous experiments. A slight modification here is that we distinguish left and right children in the tree, using two symmetric width-modules $g _ { L } ^ { f } , g _ { R } ^ { f }$ that produce children from the parent outwards. With this, children are lexically ordered, and therefore trees can be easily and un-ambiguously projected back into sentences. We compare our model against a sequence-to-sequence architecture of similar complexity (in terms of number of parameters) trained on the same data using the optimized OpenNMT library (Klein et al., 2017). For decoding, we use a simple best-of-k sampling scheme for our model, and beam search for the SEQ2SEQ models.
159
+
160
+ ![](images/9465c0cc274f78abfc2b883af117a313f8ec839f97253b62a455ebde7c7598c6.jpg)
161
+ Figure 6: Likelihood change under target structural perturbation.
162
+
163
+ Table 2: Translations at different resolutions (size constraints imposed during decoding) for two example sentences.
164
+
165
+ <table><tr><td>Source</td><td>“ produit différentes réponses qui changent avec le temps selon nos expériences et nos relations ”</td><td>“je ne sais jamais quoi dire dans ces cas la&quot;</td></tr><tr><td>SEQ2SEQ:</td><td></td><td></td></tr><tr><td>l=1</td><td>a</td><td>I</td></tr><tr><td>l=4</td><td>with the different actions</td><td>Ido</td></tr><tr><td>=8</td><td>with the different actions who change with</td><td>I do not know what to say</td></tr><tr><td>DRNN:</td><td></td><td></td></tr><tr><td>d=1</td><td>answers</td><td>know</td></tr><tr><td>d=2</td><td>different answers change</td><td>but i do not know</td></tr><tr><td>d=3</td><td>product the different answers change .</td><td>but i do not know to say</td></tr></table>
166
+
167
+ First, we analyze the quality of translations as a function of the maximum allowed target sentence “size”. The notion of size for a sequence decoder is simply the length while for DRNN we use depth instead so as to tap into the inherent granularity at which sentences can be generated from this architecture. Two such examples are shown in Table 2. Since DRNN topology has been trained to mimic dependency parses top-down, the decoder tends to first generate the fundamental aspects of the sentence (verb, nouns), leaving less important refinements for deeper structures down in the tree. The sequence decoder, in contrast, is trained for left-to-right sequential generation, and thus produces less informative translations under max-length restrictions.
168
+
169
+ In our second experiment we investigate the decoders’ ability to entertain natural paraphrases of sentences. If we keep the semantic content of a sentence fixed and only change its grammatical structure, it is desirable that the decoder would assign nearly the same likelihood to the new sentence. One way to assess this invariance is to compare the relative likelihood that the model assigns to the gold sentence in comparison to its paraphrase. To test this, we take 50 examples from the WMT test split and manually generate paraphrases with various types of structural alterations (see details in the Appendix). For each type of decoder, we measure the relative change (in absolute value) of the log-likelihood resulting from the perturbation. All the models we compare have similar standard deviation $( 4 0 \pm 2 0 )$ of log-likelihood scores over these examples, so the relative changes in the log-likelihood remain directly comparable. For each architecture we train two versions of different sizes, where the sizes are balanced in terms of the number of parameters across the architectures. The results in Figure 6 show that DRNN’s exhibit significantly lower log-likelihood change, suggesting that, as language models, they are more robust to natural structural variation than their SEQ2SEQ counterparts.
170
+
171
+ # 5 DISCUSSION AND FUTURE WORK
172
+
173
+ We have presented doubly recurrent neural networks, a natural extension of (sequential) recurrent architectures to tree-structured objects. This architecture models the information flow in a tree with two separate recurrent modules: one carrying ancestral information (received from parent and passed on to offspring) and the other carrying fraternal information (passed from sibling to sibling). The topology of the tree is modeled explicitly and separately from the label prediction, with modules that given the state of a node predict whether it has children and siblings.
174
+
175
+ The experimental results show that the proposed method is able to predict reasonable tree structures from encoded vector representations. Despite the simple structure of the IFTTT trees, the results on that task suggest a promising direction of using DRNNs for generating programs or executable queries from natural language. On the other hand, the results on the toy machine translation task show that even when used to generate sequences, DRNN’s exhibit desirable properties, such as invariance over structural modifications and the ability to perform coarse-to-fine decoding. In order to truly use this architecture for machine translation, the approach must be scaled by resorting to batch processing in GPU. This is possible since forward and backward propagation are computed sequentially along tree traversal paths so that inputs and hidden states of parents and siblings can be grouped into tensors and operated in batch. We leave this as an avenue for future work.
176
+
177
+ # ACKNOWLEDGEMENTS
178
+
179
+ DA-M acknowledges support from a CONACYT fellowship. The authors would like to thank the anonymous reviewers for their constructive comments.
180
+
181
+ REFERENCES
182
+ Srk Branavan, Harr Chen, Luke S. Zettlemoyer, and Regina Barzilay. Reinforcement learning for mapping instructions to actions. Proc. Jt. Conf. 47th Annu. Meet. ACL 4th Int. Jt. Conf. Nat. Lang. Process. AFNLP Vol. 1-Volume 1, (August):82–90, 2009. ISSN 1742206X. doi: 10.3115/ 1687878.1687892.
183
+ Danqi Chen and Christopher D Manning. A Fast and Accurate Dependency Parser using Neural Networks. Proc. 2014 Conf. Empir. Methods Nat. Lang. Process., (i):740–750, 2014. URL https://cs.stanford.edu/{˜}danqi/papers/emnlp2014.pdf.
184
+ Kyunghyun Cho, Bart van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the Properties of Neural Machine Translation: Encoder–Decoder Approaches. Proc. SSST-8, Eighth Work. Syntax. Semant. Struct. Stat. Transl., pp. 103–111, 2014. URL http://arxiv.org/pdf/ 1409.1259v2.pdf.
185
+ Li Dong and Mirella Lapata. Language to Logical Form with Neural Attention. In ACL, pp. 33–43, 2016. doi: 10.18653/v1/P16-1004. URL http://arxiv.org/abs/1601.01280.
186
+ Gottlob Frege. Uber Sinn und Bedeutung. ¨ Zeitschrift fur Philos. und Philos. Krit. ¨ , (1):25–50, 1892.
187
+ Christoph Goller and Andreas Kuechler. Learning task-dependent distributed representations by backpropagation through structure. In Int. Conf. Neural Networks, pp. 347–352, 1996. ISBN 0-7803-3210-5. doi: 10.1109/ICNN.1996.548916.
188
+ Sepp Hochreiter and Jurgen Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8): 1–32, 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735.
189
+ Rj Kate, Yw Wong, and Rj Mooney. Learning to transform natural to formal languages. In Proc. Natl. Conf. Artif. Intell., volume 20, pp. 1062–1068, 2005. ISBN 1-57735-236-x. URL http: //www.aaai.org/Library/AAAI/2005/aaai05-168.php.
190
+ Diederik Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. Int. Conf. Learn. Represent., pp. 1–13, 2014. URL http://arxiv.org/abs/1412.6980.
191
+ Eliyahu Kiperwasser and Yoav Goldberg. Easy-First Dependency Parsing with Hierarchical Tree LSTMs. TACL, 2016. URL https://www.transacl.org/ojs/index.php/tacl/ article/viewFile/798/208.
192
+ G. Klein, Y. Kim, Y. Deng, J. Senellart, and A. M. Rush. OpenNMT: Open-Source Toolkit for Neural Machine Translation. ArXiv e-prints, 2017.
193
+ Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. The Stanford CoreNLP natural language processing toolkit. In Association for Computational Linguistics (ACL) System Demonstrations, pp. 55–60, 2014. URL http://www.aclweb.org/anthology/P/P14/P14-5010.
194
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. GloVe: Global Vectors for Word Representation. In Proc. 2014 Conf. Empir. Methods Nat. Lang. Process., 2014.
195
+ Chris Quirk, Raymond Mooney, and Michel Galley. Language to Code: Learning Semantic Parsers for If-This-Then-That Recipes. ACL-IJCNLP, (July):878–888, 2015. URL http: //www.aclweb.org/anthology/P15-1085.
196
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence Level Training with Recurrent Neural Networks. In ICLR, pp. 1–15, 2016. URL http://arxiv.org/ abs/1511.06732.
197
+ R Socher and Cc Lin. Parsing natural scenes and natural language with recursive neural networks. In EMNLP, pp. 129–136, 2011. ISBN 9781450306195. doi: 10.1007/978-3-540-87479-9.
198
+ Richard Socher, Brody Huval, Christopher D Manning, and Andrew Y Ng. Semantic Compositionality through Recursive Matrix-Vector Spaces. In EMNLP, number Mv, pp. 1201–1211, 2012. ISBN 9781937284435.
199
+ Richard Socher, Alex Perelygin, and Jy Wu. Recursive deep models for semantic compositionality over a sentiment treebank. Proc. . . . , pp. 1631–1642, 2013. ISSN 1932-6203. doi: 10.1371/ journal.pone.0073791.
200
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In NIPS, pp. 9, 2014. ISBN 1409.3215. URL http://arxiv.org/abs/1409.3215.
201
+ Kai Sheng Tai, Richard Socher, and Christopher D. Manning. Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks. In Proc. 53rd Annu. Meet. Assoc. Comput. Linguist. 7th Int. Jt. Conf. Nat. Lang. Process., pp. 1556–1566, 2015. ISBN 9781941643723. URL http://arxiv.org/abs/1503.0075.
202
+ Arun Venkatraman, Martial Hebert, and J Andrew Bagnell. Improving Multi-step Prediction of Learned Time Series Models. Twenty-Ninth AAAI Conf. Artif. Intell., pp. 3024–3030, 2015.
203
+ Orioi Vinyals and Quoc V. Le. A Neural Conversational Model. arXiv, 37, 2015.
204
+ Ronald J. Williams and David Zipser. Gradient-based learning algorithms for recurrent networks and their computational complexity. Back-propagation Theory, Archit. Appl., pp. 433–486, 1995. doi: 10.1080/02673039508720837.
205
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent Neural Network Regularization. ICLR, pp. 1–8, 2015. URL http://arxiv.org/abs/1409.2329.
206
+ Xingxing Zhang, Liang Lu, and Mirella Lapata. Top-down Tree Long Short-Term Memory Networks. In NAACL-HLT-2016, pp. 310–320, 2016.
207
+
208
+ # A VARIATIONS ON TOPOLOGY PREDICTION
209
+
210
+ Besides the topology prediction approach presented in Section 3.1, we experimented with two additional variations of the proposed doubly-recurrent neuron: (i) using tokens to trigger both depth and width termination (i.e. implicit topology prediction) and (ii) using tokens for width-stopping decision, but predict explicitly depth termination (single topology prediction). Recall that in the model proposed in Section 3.1 both decisions are explicit (double topology prediction). The neurons in each of these alternative formulations are depicted in Figure 7. In order to train these two alternative models, we add special stopping tokens to the vocabulary, and we pad the training with additional nodes labeled with this token. Besides requiring larger trees and resulting in slower training, we empirically observed alternatives (i) and (ii) to result in worse performance. We hypothesize that this has to do with the fact that when using token-based stopping, topological and label prediction decisions are confounded, which results in less efficient learning.
211
+
212
+ ![](images/fe0f0fd4871bdb513ab5a6aa190a48b889988b7899c6549f4b7c99f2085ed282.jpg)
213
+ Figure 7: A single unit in each of the three alternative versions of the doubly-recurrent neural network, for node $i$ with parent $p$ and sibling $s$ . Left: No explicit topology prediction, Middle: single (ancestral) topology prediction, Right: double (ancestral and fraternal) topology prediction. The top (left) incoming arrows represent the input and state received from the parent node (previous node, respectively).
214
+
215
+ # B TRAINING DETAILS
216
+
217
+ # B.1 BACKPROPAGATION WITH DRNN’S
218
+
219
+ During training, we do the forward pass over the trees in breadth-first preorder, feeding into every node an ancestral and a fraternal state. For computational efficiency, before passing on the ancestral state to the offspring, we update it through the RNN using the current node’s label, so as to avoid repeating this step for every child node. After the forward pass is complete, we compute label (cross-entropy) and topological (binary cross-entropy) loss for every node. In the backward pass, we compute in this order:
220
+
221
+ 1. Gradient of the current node’s label prediction loss with respect to softmax layer parameters $\mathbf { W } , \mathbf { v } ^ { a } , \mathbf { v } ^ { f } \colon \nabla _ { \boldsymbol { \theta } } \mathcal { L } \big ( \mathbf { x } _ { i } , \widehat { \mathbf { x } } _ { i } \big )$ .
222
+ 2. Gradients of topological prediction variable loss with respect to sigmoid layer parameters: $\nabla _ { \theta } \mathcal { L } ( p _ { i } ^ { a } , t _ { i } ^ { a } )$ and $\nabla _ { \theta } \mathcal { L } ( p _ { i } ^ { \dot { f } } , t _ { i } ^ { f } )$ .
223
+ 3. Gradient of predictive state layer parameters with respect to $\mathbf { h } ^ { ( p r e d ) }$ .
224
+ 4. Gradient of predicted ancestral and fraternal hidden states with respect to $g ^ { f }$ and $g ^ { a }$ ’s parameters.
225
+
226
+ The gradients of the input ancestral and fraternal hidden states are then passed on to the previous sibling and parent. When nodes have more than one child, we combine gradients from multiple children by averaging them. This procedure is repeated until the root note is reached, after which a single (ancestral state) gradient is passed to the encoder.
227
+
228
+ # B.2 MODEL SPECIFICATION AND TRAINING PARAMETERS
229
+
230
+ The best parameters for all tasks are chosen by performance on the validation sets. We perform early stopping based on the validation loss. For the IFTTT task, we initialize word embeddings with pretrained GloVe vectors (Pennington et al., 2014). For both tasks we clip gradients when the absolute value of any element exceeds 5. We regularize with a small penalty $\rho$ on the $l _ { 2 }$ norm of the parameters. We train all methods with ADAM (Kingma & Ba, 2014), with initial learning rate chosen by cross-validation. The parameter configurations that yielded the best results and were used for the final models are shown in Table 3. Details about the four models used for the machine translation task are shown in Table 4.
231
+
232
+ Table 3: Hyperparameter choice for DRNNs in the synthetic and IFTTT tasks
233
+
234
+ <table><tr><td>Task</td><td>Encoder</td><td>Dim</td><td>Batch</td><td>Learning Rate</td><td>Regularization p</td></tr><tr><td>synthetic</td><td>LSTM</td><td>50</td><td>20</td><td>0.05</td><td>1×10-5</td></tr><tr><td>IFTTT</td><td>GRU</td><td>150</td><td>35</td><td>0.06</td><td>1×10-4</td></tr><tr><td>IFTTT</td><td>LSTM</td><td>150</td><td>35</td><td>0.05</td><td>5×10-4</td></tr></table>
235
+
236
+ Table 4: Models used in the machine translation task.
237
+
238
+ <table><tr><td>Model</td><td>Encoder</td><td>Decoder</td><td>Dim</td><td>RNN Layers</td><td>Batch</td></tr><tr><td>SEQ2SEQ (Small)</td><td>LSTM</td><td>LSTM</td><td>150</td><td>1</td><td>64</td></tr><tr><td>SEQ2SEQ (Large)</td><td>LSTM</td><td>LSTM</td><td>300</td><td>3</td><td>64</td></tr><tr><td>DRNN (Small)</td><td>LSTM</td><td>DRNN-GRU (Left-Right)</td><td>150</td><td>1</td><td>32</td></tr><tr><td>DRNN (Large)</td><td>LSTM</td><td>DRNN-GRU (Left-Right)</td><td>300</td><td>1</td><td>32</td></tr></table>
239
+
240
+ # C DATASET DETAILS
241
+
242
+ # C.1 SYNTHETIC TREE DATASET GENERATION
243
+
244
+ We generate trees in a top-down fashion, conditioning the label and topology of every node on the state of its ancestors and siblings. For simplicity, we use a Markovian assumption on these dependencies, modeling the probability of a node’s label as depending only on the label of its parent $p ( i )$ and the last sibling $s ( i )$ generated before it (if any). Conditioned on these two inputs, we model the label of the node as coming from a multinomial distribution over the alphabet:
245
+
246
+ $$
247
+ \begin{array} { r } { P ( w _ { i } \mid \mathcal { T } ) = P ( w \mid w _ { p ( i ) } , w _ { s ( i ) } ) \sim \mathrm { M u l t i } \big ( \theta _ { w _ { p ( i ) } , w _ { s ( i ) } } \big ) } \end{array}
248
+ $$
249
+
250
+ where $\theta _ { w _ { p ( i ) } , w _ { s ( i ) } }$ are class probabilities drawn from a Dirichlet prior with parameter $\alpha _ { v }$ . On the other hand, we denote by $b _ { i } ^ { a }$ the binary variable indicating whether node $i$ has descendants, and by $b _ { i } ^ { f }$ that indicating whether it has an ensuing sibling. We model these variables as depending only on the label of the current node and its position in the tree:
251
+
252
+ $$
253
+ \begin{array} { r l } & { P ( b _ { i } ^ { a } \mid \mathcal { T } ) = P ( b _ { i } ^ { a } \mid w _ { i } , D _ { i } ) = \mathrm { B e r n o u l l i } ( p _ { w _ { i } } ^ { a } \cdot g ^ { a } ( D _ { i } ) ) } \\ & { P ( b _ { i } ^ { f } \mid \mathcal { T } ) = P ( b _ { i } ^ { f } \mid w _ { i } , W _ { i } ) = \mathrm { B e r n o u l l i } ( p _ { w _ { i } } ^ { f } \cdot g ^ { f } ( W _ { i } ) ) } \end{array}
254
+ $$
255
+
256
+ where $D _ { i }$ is the depth of node $i$ and $W _ { i }$ its width, defined as its position among the children of its parent $p ( i )$ . Intuitively, we want to make $P ( b _ { i } ^ { a } = 1 | \mathcal { T } )$ decrease as we go deeper and further along the branches of the tree, so as to control its growth. Thus, we model $g ^ { a }$ and $g ^ { f }$ as decreasing functions with geometric decay, namely $g ^ { a } ( D ) = ( \gamma ^ { a } ) ^ { D }$ and $g ^ { f } ( W ) = ( \gamma ^ { \breve { f } } ) ^ { W }$ , with $\gamma ^ { a } , \gamma ^ { f } \in ( 0 , \overline { { 1 } } )$ . For the label-conditioned branching probabilities $P ( b _ { i } ^ { a } \mid w _ { i } )$ and $P ( b _ { i } ^ { f } \mid w _ { i } )$ , we use Bernoulli distributions with probabilities drawn from beta priors with parameters $( \alpha ^ { a } , \beta ^ { a } )$ and $( \alpha ^ { f } , \beta ^ { f } )$ , respectively.
257
+
258
+ In summary, we use the following generative procedure to grow the trees:
259
+
260
+ 1. For each $w _ { i } \in V$ , draw $p _ { w _ { i } } ^ { a } \sim \mathbf { B e t a } ( \alpha ^ { a } , \beta ^ { a } )$ and $p _ { w _ { i } } ^ { f } \sim \mathrm { B e t a } ( \alpha ^ { f } , \beta ^ { f } )$
261
+
262
+ 2. For each pair $( w _ { i } , w _ { j } )$ draw $\theta _ { w _ { i } , w _ { j } } \sim \operatorname { D i r } ( \alpha ^ { V } )$
263
+
264
+ 3. While there is an unlabeled non-terminal node $i$ do:
265
+
266
+ • Sample a label for $i$ from $w ^ { * } \sim P ( w | w _ { p ( i ) } , w _ { s ( i ) } ) = \mathrm { M u l t i } \big ( \theta _ { w _ { p ( i ) } , w _ { s ( i ) } } \big ) .$ . • Draw $b _ { a } \sim P ( b ^ { a } | w ^ { * } , D ) = \operatorname { B e r n o u l l i } ( \gamma _ { a } ^ { D } \cdot p _ { w ( i ) } ^ { a } )$ , where $D$ is the current depth. If $b ^ { a } = 1$ , generate an node $k$ , set $p ( k ) = i$ , and add it to the queue. • Draw $b _ { a } \sim P ( b ^ { f } | w ^ { * } , D ) = \operatorname { B e r n o u l l i } ( \gamma _ { f } ^ { W } \cdot p _ { w ( i ) } ^ { f } )$ , where $W$ is the current width. If $b ^ { f } = 1$ , generate an node $k$ , set $s ( k ) = i$ , and add it to the queue.
267
+
268
+ Note that this generative process does create a dependence between the topology and content of the trees (since the variables $b ^ { a }$ and $b ^ { f }$ depend on the content of the tree via their dependence on the label of their corresponding node). However, the actual process by which labels and topological decision is generated relies on separate mechanisms. This is natural assumption which is reasonable to expect in practice.
269
+
270
+ The choice of prior parameters is done drawing inspiration from natural language parse trees. We want nodes to have low but diverse probabilities of generating children, so we seek a slow-decaying distribution with most mass allocated in values close to 0. For this, we use $( \alpha ^ { a } , \beta ^ { a } ) = ( 0 . 2 5 , 1 )$ . For sibling generation, we use $( \alpha ^ { f } , \beta ^ { f } ) = ( 7 , 2 )$ , which yields a distribution concentrated in values close to 1, so that nodes have on average a high and similar probability of producing siblings. Since we seek trees that are wider than they are deep, we use decay parameters $\gamma _ { a } = 0 . 6 , \gamma _ { f } = 0 . 9$ . Finally, we use a $\alpha _ { v } = 1 0 \cdot { \bf 1 }$ for the parent-sibling probability prior, favoring non-uniform interactions. Using this configuration, we generate 5000 sentence-tree pairs, which we split into training (4000 examples), validation (500) and test (500) sets. The characteristics of the trees in the dataset are summarized in Table 5.
271
+
272
+ Table 5: Synthetic tree dataset statistics. Tree size is measured in number of nodes, depth is the largest path from the root node to a leaf and width is the maximum number of children for any node in the tree. The values reported correspond to means with one standard deviation in parentheses.
273
+
274
+ <table><tr><td>Fold</td><td>Examples</td><td>Size</td><td>Depth</td><td>Width</td></tr><tr><td>train</td><td>4000</td><td>3.94 (3.38)</td><td>1.42 (0.66)</td><td>2.89 (1.71)</td></tr><tr><td>dev</td><td>500</td><td>4.13 (3.21)</td><td>1.46 (0.67)</td><td>2.91 (1.76)</td></tr><tr><td>test</td><td>500</td><td>3.64 (3.21)</td><td>1.32 (0.61)</td><td>2.80 (1.71)</td></tr></table>
275
+
276
+ # C.2 IFTTT
277
+
278
+ The IFTTT dataset comes with a script to generate the data by crawling and parsing the recipes. Unfortunately, by the time we ran the script many recipes had been removed or changed. We therefore resorted to the original dataset used by Quirk et al. (2015). We converted these recipes into our tree format, assigning a node to each element in the first three levels (channels, functions and arguments, see figure 5). For the parameters level, many recipes have sentences instead of single tokens, so we broke these up creating one node per word. The last two layers are therefore the most topologically diverse, whereas the structure of the first two layers is constant (all trees have channels and functions). A very small fraction $( < 1 \%$ ) of trees that could not by parsed into our format was excluded from the dataset.
279
+
280
+ Table 6 shows various statistics about the topological characteristics of the recipes in the IFTTT dataset. The middle columns show percentage of trees that contain nonempty arguments and parameters in trigger (IF) and action (THEN) branches. Almost all recipes have none empty arguments and parameters (and thus depth 4, excluding the root), and a lower percentage—but still a majority—has arguments and parameters on the trigger side too. The last two columns show tree statistics pertaining to the complexity of trees after conversion to our format. The distribution of tree sizes is mostly concentrated between 4 and 30 nodes, with a slow-decaying tail of examples above this range (see Figure 8).
281
+
282
+ Table 6: IFTTT dataset statistics. The middle columns show percentage of trees that contain nonempty arguments and parameters in trigger (IF) and action (THEN) branches. The last column shows average (with standard deviation) tree size and depth.
283
+
284
+ <table><tr><td rowspan="2">Fold</td><td rowspan="2">Examples</td><td colspan="2">Has args.(%)</td><td colspan="2">Has params. (%)</td><td colspan="2">Tree Size</td></tr><tr><td>Trigger</td><td>Action</td><td>Trigger</td><td>Action</td><td>#Nodes</td><td>Depth</td></tr><tr><td>train</td><td>67,444</td><td>69.10</td><td>98.46</td><td>65.47</td><td>96.77</td><td>16.93 (31.71)</td><td>3.99 (.13)</td></tr><tr><td>dev</td><td>4,038</td><td>69.44</td><td>98.46</td><td>66.42</td><td>96.31</td><td>16.55 (8.75)</td><td>3.99 (.11)</td></tr><tr><td>test</td><td>3,725</td><td>68.38</td><td>98.66</td><td>65.64</td><td>97.50</td><td>16.43 (8.18)</td><td>3.99 (.12)</td></tr></table>
285
+
286
+ ![](images/55bb3887b04062049bbba8bac0910b7d247e0a696c4c881323bbf4b64de0fedf.jpg)
287
+ Figure 8: Tree size distribution in the IFTTT dataset.
288
+
289
+ Regarding the content of the trees, the labels of the nodes in the first two levels (channels and functions) come from somewhat reduced vocabularies: 111 and 434 unique symbols for the trigger branch, respectively, and 157 and 85 for the action branch. The lower layers of the tree have a much more diverse vocabulary, with about 60K unique tokens in total. On the source side, the vocabulary over the sentence descriptions is large too, with about 30K unique tokens. The average sentence size is 6.07 tokens, with $80 \%$ of the sentences having at most 12 tokens.
290
+
291
+ # C.3 MACHINE TRANSLATION
292
+
293
+ Starting from a preprocessed6 $2 \%$ sub-selection of the English-French section of the WMT14 dataset, we further prune down the data by keeping only sentences of length between 5 and 20 words, and for which every word is within the 20K most frequent. The reason for this is to simplify the task by keeping only common words and avoiding out-of-vocabulary tokens. After this filtering, we are left with 53,607, 918 and 371 sentences for train, validation and test sets. After tokenizing, we obtain dependency parses for the target (English) sentences using the Stanford CoreNLP toolkit (Manning et al., 2014).
294
+
295
+ For the perturbation experiments, we randomly selected 50 sentences from among those in the test that could be easily restructured without significantly altering their meaning. The type of alterations we perform are: subordinate clause swapping, alternative construction substitution, passive/active voice change. In doing this, we try to keep the number of added/deleted words to a minimum, to minimize vocabulary-induced likelihood variations. When inserting new words, be verify that they are contained in the original vocabulary of 20K words. In Table 7 we show a few examples of the source, original target and perturbed target sentences.
296
+
297
+ Table 7: Example structural perturbations for likelihood robustness experiments.
298
+
299
+ <table><tr><td>source target perturbation</td><td>&quot;apres un accord de paix signe en 1992 elle est devenue un parti d opposition.&quot; “after a 1992 peace deal it became an opposition party.&quot; &quot;it became an opposition party after a 1992 peace deal.&quot;</td></tr><tr><td>source target perturbation</td><td>“cela représente environ 9 milliards de grains de mais.” “that&#x27;s about 9 billion individual kernels of corn.&quot; “this amounts to about 9 billion kernels of corn.&quot;</td></tr><tr><td>source target perturbation</td><td>“l&#x27;exercice de fonctions publiques est une question de service public.&quot; &quot;public office is about public service.&quot; &quot;the exercise of public functions is a matter of public service.</td></tr><tr><td>source target perturbation</td><td>“nous avons ainsi effectue depuis la fin de I&#x27;hiver dernier 64 interventions.” “hence we have carried out 64 operations since last winter.” “we have therefore carried out 64 operations since last winter.&quot;</td></tr><tr><td>source target perturbation</td><td>“on estime qu&#x27;un enfant sur 2OoO nés chaque année n&#x27;est ni un garcon ni une fille.&quot; “an estimated one in 2OoO children born each year is neither boy nor girl.&quot; “it is estimated that one in every 2OoO children born every year is neither a boy nor a girl.&quot;</td></tr></table>
300
+
301
+ # D ADDITIONAL EXAMPLE GENERATED TREES
302
+
303
+ ![](images/6ba28271cf52cee43f0c4e3dd11a59ccb0005caae90ef97b95c7008d843db2a0.jpg)
304
+ (a) Encoder sentence input: “ROOT P R C”
305
+
306
+ ![](images/08ac7093d55b4ae55d9b93ce147a909d3a705737afac4a50d965b08cfa223ee9.jpg)
307
+ (b) Encoder sentence input: “ROOT Z T Y Q”
308
+
309
+ ![](images/8d5161627149fde344ba399ee222056bdf3e5d0f27180bd6677c1a398c106283.jpg)
310
+ (c) Encoder sentence input: “ROOT K T V”
311
+
312
+ ![](images/02c13889f526a643fe6f1c0153c559ca65cd2303de42436849d119efedbf9f52.jpg)
313
+ (d) Encoder sentence input: “ROOT Q F V R G D A”
314
+ Figure 9: Selected trees generated by the DRNN decoder from vector-encoded descriptions for test examples of the synthetic tree dataset. Trees in the same row correspond to predictions by models trained on randomly sampled subsets of size $N$ of the training split. We present cases for which the prediction is accurate (a,c) and cases for which it is not (b,d). Note how in (d) the model predicts many of the labels correctly, but confuses some of the dependencies (edges) in the tree.
md/train/HyPpD0g0Z/HyPpD0g0Z.md ADDED
@@ -0,0 +1,518 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GROUPING-BY-ID: GUARDING AGAINST ADVERSARIAL DOMAIN SHIFTS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ When training a deep neural network for supervised image classification, one can broadly distinguish between two types of latent features of images that will drive the classification of class $Y$ . Following the notation of Gong et al. (2016), we can divide features broadly into the classes of (i) ‘core’ or ‘conditionally invariant’ features $X ^ { c i }$ whose distribution $P ( X ^ { c i } | Y )$ does not change substantially across domains and (ii) ‘style’ or ‘orthogonal’ features $X ^ { \perp }$ whose distribution $P \bar { ( } X ^ { \bot } | Y )$ can change substantially across domains. These latter orthogonal features would generally include features such as position, rotation, image quality or brightness but also more complex ones like hair color or posture for images of persons. We try to guard against future adversarial domain shifts by ideally just using the ‘conditionally invariant’ features for classification. In contrast to previous work, we assume that the domain itself is not observed and hence a latent variable. We can hence not directly see the distributional change of features across different domains.
8
+
9
+ We do assume, however, that we can sometimes observe a so-called identifier or ID variable. We might know, for example, that two images show the same person, with ID referring to the identity of the person. In data augmentation, we generate several images from the same original image, with ID referring to the relevant original image. The method requires only a small fraction of images to have an ID variable.
10
+
11
+ We provide a causal framework for the problem by adding the ID variable to the model of Gong et al. (2016). However, we are interested in settings where we cannot observe the domain directly and we treat domain as a latent variable. If two or more samples share the same class and identifier, $( Y , \mathrm { I D } ) = ( y , \mathrm { i d } )$ , then we treat those samples as counterfactuals under different style interventions on the orthogonal or style features. Using this grouping-by-ID approach, we regularize the network to provide near constant output across samples that share the same ID by penalizing with an appropriate graph Laplacian. This is shown to substantially improve performance in settings where domains change in terms of image quality, brightness, color changes, and more complex changes such as changes in movement and posture. We show links to questions of interpretability, fairness and transfer learning.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Deep neural networks (DNNs) have achieved outstanding performance on prediction tasks like visual object and speech recognition (Krizhevsky et al., 2012; Szegedy et al., 2015; He et al., 2015). Issues can arise when the learned representations rely on dependencies that vanish in test distributions (e.g. see Csurka (2017) and references therein). Such domain shifts can be caused by changing conditions, e.g. color, background or location changes arising when deploying the machine learning (ML) system in production. Predictive performance is then likely to degrade. For instance, the “Russian tank legend” is an example where the training data was subject to sampling biases that were not replicated in the real world. Concretely, the story relates how a machine learning system was trained to distinguish between Russian and American tanks from photos. The accuracy was very high but only due to the fact that all images of Russian tanks were of bad quality while the photos of
16
+
17
+ American tanks were not. The system learned to discriminate between images of different qualities but would have failed badly in practice (Emspak, 2016)1.
18
+
19
+ Hidden confounding factors like in the example above between image quality and the origin of the tank give rise to indirect associations. These are arguably one reason why deep learning requires large sample sizes as large sample sizes tend to ensure that the effect of the confounding factors averages out (although a large sample size is clearly not per se a guarantee that the confounding effect will become weaker). A large sample size is also required if one is trying to achieve invariance to known factors like translation, point of view, and rotation by using data augmentation. Another related example where human and artificial cognition deviate strongly are adversarial examples— imperceptibly but intentionally perturbed inputs that are misclassified by a ML model (Szegedy et al., 2014; Goodfellow et al., 2015). Adversarial examples do not fool humans and in general we only need to see one rotated example of the same object to achieve invariance to rotations in our perception. Our starting point is the question whether we can in a simple way mimic the human ability to learn desired invariances from a few instances of the same object and whether we can better align the features DNNs exploit with human cognition.
20
+
21
+ Considerations of fairness and discrimination might be another reason why we are interested in controlling that certain characteristics of the input data are not included in the learned representations and thus have no impact on the resulting decisions (Barocas & Selbst, 2016; Kilbertus et al., 2017). Unfortunately, existing biases in datasets used for training ML algorithms tend to be replicated in the estimated models (Bolukbasi et al., 2016). For instance, in June 2015 Google’s photo app tagged two non-white people as “gorillas”—most likely because the training examples for “people” were mainly photos of white persons, making “color” predictive for the class label (Crawford, 2016; Emspak, 2016). A human would not make the same mistake after only seeing one instance of a non-white person.
22
+
23
+ Addressing the issues outlined above, we propose counterfactual regularization (CORE) to control what latent features an estimator extracts from the input data. Conceptually, we take a causal view of the data generating process and categorize the latent data generating factors into ‘conditionally invariant’ (core) and ‘orthogonal’ (style) features, as in (Gong et al., 2016). It is desirable that a classifier uses only the core features as they pertain to the target of interest in a stable and coherent fashion. CORE yields an estimator which is invariant to factors of variation corresponding to style features. Consequently, it is robust with respect to adversarial domain shifts, arising through arbitrarily strong interventions on the style features. CORE relies on the fact that for certain datasets we can observe “counterfactuals” in the sense that we observe the same object under different conditions. Rather than pooling over all examples, CORE exploits knowledge about this grouping, i.e. that a number of instances relate to the same object.
24
+
25
+ The remainder of this manuscript is structured as follows: $\ S 2$ starts with two motivating examples, showing how CORE can reduce the need for data augmentation and help predictive performance in small sample size settings. In $\ S 3$ we review related work and in $\ S 4$ we formally introduce counterfactual regularization, along with the CORE estimator and theoretical insights for the logistic regression setting. In §5 we further evaluate the performance of CORE in a variety of experiments.
26
+
27
+ # 2 TWO MOTIVATING EXAMPLES
28
+
29
+ 2.1 GROUPING PHOTOS OF THE SAME PERSON: BETTER PREDICTIVE PERFORMANCE
30
+
31
+ The CelebA dataset (Liu et al., 2015) contains face images of celebrities. We consider the task of classifying whether a person wears glasses. Several photos of the same person are available. We use this grouping information and constrain the classification to yield the same prediction for all images belonging to the same person and sharing the same class label. We call the additional instances of the same person counterfactual (CF) observations. Figure 1a shows examples from the training set. The standard approach would be to pool all examples. The only additional information we exploit is that some observations can be grouped. We include $n = 1 0$ identities in the training set, resulting in a total sample size $m = 3 2 1$ as there are approximately 30 images of each person2.
32
+
33
+ (a) Grouping-by-ID with ID=identity.
34
+
35
+ (b) Grouping-by-ID with ID $=$ original image.
36
+
37
+ ![](images/ba66922606a44436f08eff197b11fa3c0dbae95f221a2936a7176b3141d60bbd.jpg)
38
+ Figure 1: Examples from a) the subsampled CelebA dataset and b) the augmented MNIST dataset. Connected images are counterfactual examples as they share the same realization of the ID which is the identity of the person in a) and the original image used for data augmentation in b). The comparison is a training of exactly the same network architecture that does not make use of the grouping information but using a standard ridge penalty. In a) exploiting the grouping information reduces the test error by $32 \%$ compared to pooling over all samples. In b) the test error on rotated digits is reduced by $50 \%$ .
39
+
40
+ Exploiting the group structure reduces the average test error from $2 4 . 7 6 \%$ to $1 6 . 8 9 \%$ , i.e. by approx. $32 \%$ , compared to the estimator which just pools all images and uses a standard ridge penalty for the cofficients3.
41
+
42
+ # 2.2 GROUPING AUGMENTED IMAGES BY ORIGINAL: MORE SAMPLE EFFICIENT
43
+
44
+ A different use case of CORE is to make data augmentation more efficient in terms of the required samples. In data augmentation, one creates additional samples by modifying the original inputs, e.g. by rotating, translating, or flipping the images (Scholkopf et al., 1996). In other words, additional ¨ samples are generated by interventions on style features. Using this augmented data set for training results in invariance of the estimator with respect to the transformations (style features) of interest. For CORE we can use the grouping information that the original and the augmented samples belong to the same object. This enforces the invariance with respect to the style features more strongly compared to normal data augmentation which just pools all samples. We assess this for the style feature “rotation” on MNIST (LeCun & Cortes, 2010) and only include $c = 1 0 0$ augmented training examples for $n = 1 0 0 0 0$ original samples, resulting in a total sample size of $m = 1 0 1 0 0$ . The degree of the rotations is sampled uniformly at random from [35, 70]. Figure 1b shows examples from the training set. By using CORE the average test error on rotated examples is reduced from $3 2 . 8 6 \%$ to $1 6 . 3 3 \%$ , around half its original value4.
45
+
46
+ # 3 RELATED WORK
47
+
48
+ Perhaps most similar to this work in terms of their goals are the work of Gong et al. (2016) and Domain-Adversarial Neural Networks (DANN) proposed in Ganin et al. (2016), an approach motivated by the work of Ben-David et al. (2007). While our approach requires grouped observations, both of these works rely on unlabeled data from the target task being available.
49
+
50
+ The main idea of Ganin et al. (2016) is to learn a representation that contains no discriminative information about the origin of the input (source or target domain). This is achieved by an adversarial training procedure: the loss on domain classification is maximized while the loss of the target prediction task is minimized simultaneously. In contrast, we do not assume that we have data from different domains but just different realizations of the same object under different interventions.
51
+
52
+ The data generating process assumed in Gong et al. (2016) is similar to our model, introduced in $\ S 4 . 2$ where we detail the similarities and differences between the models (cf. Figure 2). Gong et al. (2016) identify the conditionally independent features by adjusting a transformation of the variables to minimize the squared MMD distance between distributions in different domains5. The fundamental difference to our approach is that we use a different data basis. The domain identifier is explicitly observable in Gong et al. (2016), while it is latent in our approach. In contrast, we exploit presence of an identifier variable ID to penalize the classifier using any latent features outside the set of conditionally independent features.
53
+
54
+ Causal modeling has related aims to the setting of transfer learning and guarding against adversarial domain shifts. Specifically, causal models have the defining advantage that the predictions will be valid even under arbitrarily large interventions on all predictor variables (Haavelmo, 1944; Aldrich, 1989; Pearl, 2009; Scholkopf et al., 2012; Peters et al., 2016; Zhang et al., 2013; 2015; X. Yu, 2017; ¨ M. Rojas-Carulla, 2017; Magliacane et al., 2017). There are two difficulties in transferring these results to the setting of adversarial domain changes in image classification. The first hurdle is that the classification task is typically anti-causal since the image we use as a predictor is a descendant of the true class of the object we are interested in rather than the other way around. The second challenge is that we do not want to guard against arbitrary interventions on any or all variables but only would like to guard against a shift of the style features. It is hence not immediately obvious how standard causal inference can be used to guard against large domain shifts.
55
+
56
+ Recently, various approaches have been proposed that leverage causal motivations for deep learning or use deep learning for causal inference. In all of the following methods, the goals and the settings are different from ours. Specifically, the setting of anti-causal prediction and non-ancestral interventions on style variables is not considered. Various approaches focus on cause-effect inference where the goal is to find the causal relation between two random variables, $X$ and $Y$ (Lopez-Paz et al., 2017; Lopez-Paz & Oquab, 2017; Goudet et al., 2017). Lopez-Paz et al. (2017) propose the Neural Causation Coefficient (NCC) to estimate the probability of $X$ causing $Y$ and apply it to finding the causal relations between image features. Specifically, the NCC is used to distinguish between features of objects and features of the objects’ contexts. Lopez-Paz & Oquab (2017) note the similarity between structural equation modeling and CGANs (Mirza & Osindero, 2014). One CGAN is fitted in the direction $X Y$ and another one is fitted for $Y X$ . Based on a two-sample test statistic, the estimated causal direction is returned. Goudet et al. (2017) use generative neural networks for cause-effect inference, to identify $v$ -structures and to orient the edges of a given graph skeleton. Bahadori et al. (2017) devise a regularizer that combines an $\ell _ { 1 }$ penalty with weights corresponding to the estimated probability of the respective feature being causal for the target. The latter estimates are obtained by causality detection networks or scores such as estimated by the NCC. Besserve et al. (2017) draw connections between GANs and causal generative models, using a group theoretic framework. Kocaoglu et al. (2017) propose causal implicit generative models to sample from conditional as well as interventional distributions, using a conditional GAN architecture (CausalGAN). The generator structure needs to inherit its neural connections from the causal graph, i.e. the causal graph structure must be known. Louizos et al. (2017) propose the use of deep latent variable models and proxy variables to estimate individual treatment effects.
57
+
58
+ Kilbertus et al. (2017) exploit causal reasoning to characterize fairness considerations in machine learning. Distinguishing between the protected attribute and its proxies, they derive causal nondiscrimination criteria. The resulting algorithms avoiding proxy discrimination require classifiers to be constant as a function of the proxy variables in the causal graph, thereby bearing some structural similarity to our style features.
59
+
60
+ Distinguishing between core and style features can be seen as some form of disentangling factors of variation. Estimating disentangled factors of variation has gathered a lot of interested in the context of generative modeling (Higgins et al., 2017; Chen et al., 2016; Bouchacourt et al., 2017). For example, Matsuo et al. (2017) propose a “Transform Invariant Autoencoder” where the goal is to reduce the dependence of the latent representation on a specified transform of the object in the original image. Specifically, Matsuo et al. (2017) predefine location as the orthogonal style feature $X ^ { \perp }$ and the goal is to learn a latent representation that does not include $X ^ { \perp }$ . Here, we do not predefine which features are in $X ^ { \perp }$ . It could be location but also image quality, posture, brightness, background and contextual information. Additionally, the approach in Matsuo et al. (2017) cannot effectively deal with a confounding situation where the distribution of the style features differs conditional on the class (this is a natural restriction as the class label is not even observed in the autoencoder setting). As in CORE, Bouchacourt et al. (2017) exploit grouped observations. In a variational autoencoder framework, they aim to separate style and content—they assume that samples within a group share a common but unknown value for one of the factors of variation while the style can differ. Here we try to solve a classification task directly without estimating the latent factors explicitly as in a generative framework.
61
+
62
+ ![](images/092251423c06ea419ac63998157d4cdc64f2db82cb26ebd1209ccd2500749c25.jpg)
63
+ Figure 2: Left: data generating process for the considered model as in Gong et al. (2016), where the effect of the domain on the orthogonal features $X ^ { \perp }$ is mediated via unobserved noise $\Delta$ . Right: our setting. The domain itself is unobserved but we can now observe the ID variable we use for grouping.
64
+
65
+ # 4 COUNTERFACTUAL REGULARIZATION
66
+
67
+ We first describe the standard notation for classification before developing a causal graph that allows us to compare the setting of adversarial domain shifts to transfer learning, domain adaptation and adversarial examples.
68
+
69
+ # 4.1 NOTATION FOR STANDARD CLASSIFICATION
70
+
71
+ Let $Y \in \mathcal { V }$ be a target of interest. Typically $\mathcal { V } = \mathbb { R }$ for regression or $\mathcal { V } = \{ 1 , \ldots , K \}$ in classification with $K$ classes. Let $X \in \mathbb { R } ^ { p }$ be a predictor, for example the $p$ pixels of an image. The prediction $\hat { y }$ for $y$ , given $X = x$ , is of the form $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ for a suitable function $f _ { \theta }$ with parameters $\theta \in { \mathbb { R } } ^ { d }$ , where the parameters $\theta$ correspond to the weights in a DNN. For regression, $f _ { \theta } ( x ) \in \mathbb { R }$ , whereas for classification $f _ { \theta } ( x )$ corresponds to the conditional probability distribution of $Y \in \{ 1 , \ldots , K \}$ . Let $\ell$ be a suitable loss that maps $y$ and ${ \hat { y } } = f _ { \theta } ( x )$ to $\mathbb { R } ^ { + }$ . A standard goal is to minimize the expected loss or risk
72
+
73
+ $$
74
+ L ( \theta ) \ = \ E \Big [ \ell ( Y , f _ { \theta } ( X ) ) \Big ] .
75
+ $$
76
+
77
+ Let $( x _ { i } , y _ { i } )$ for $i = 1 , \ldots , n$ be the samples that constitute the training data and $\hat { y } _ { i } = f _ { \theta } ( x _ { i } )$ the prediction for $y _ { i }$ . A standard approach to parameter estimation is penalized empirical risk minimization, where we choose the weights or parameters as $\hat { \theta } = \mathrm { a r g m i n } _ { \theta } \ L _ { n } ( \theta )$ , with the empirical loss given by $\begin{array} { r l r } { L _ { n } ( \theta ) } & { { } = } & { { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \ell ( y _ { i } , f _ { \theta } ( x _ { i } ) ) + \lambda \cdot \mathrm { p e n } ( \theta ) } \end{array}$ , where the penalty $\mathrm { p e n } ( \theta )$ could be a ridge penalty or penalties that exploit underlying geometries such as the Laplacian regularized least squares (Belkin et al., 2006).
78
+
79
+ # 4.2 CAUSAL GRAPH
80
+
81
+ The full structural model for all variables is shown in the right panel of Figure 2. The domain variable $D$ is latent, in contrast to Gong et al. (2016). We add the ID variable (identity of a person, for example), whose distribution can change conditional on class $Y$ . The ID variable is used to
82
+
83
+ group observations, see Section 4.4, and can be assumed to be latent in the setting of Gong et al.
84
+ (2016).
85
+
86
+ The rest of the graph is in analogy to Gong et al. (2016). The prediction is anti-causal, that is the predictors $X$ that we use for $\hat { Y }$ are non-ancestral to $Y$ . In other words, the class label is causal for the image and not the other way around. The causal effect from the class label $Y$ on the image $X$ is mediated via two types of latent variables: the so-called core or ‘conditionally invariant’ features $X ^ { c i }$ and the orthogonal or style features $X ^ { \perp }$ . The distinguishing factor between the two is that external interventions $\Delta$ are possible on the style features but not on the core features. If the interventions $\Delta$ have different distributions in different domains, then the distribution $P ( X ^ { c i } | Y )$ is constant across domains while $P ( X ^ { \bot } | Y )$ can change across domains. The style features $X ^ { \perp }$ and $Y$ are confounded, in other words, by the latent domain $D$ . In contrast, the core or ‘conditionally invariant’ features satisfy $X ^ { c i } \perp \perp \mathsf { D } | Y$ . The dimension of $X ^ { c i }$ is chosen maximally large such that this conditional independence is still true. The style variable can include point of view, image quality, resolution, rotations, color changes, body posture, movement etc. and will in general be context-dependent6. The style intervention variable $\Delta$ influences both the latent style $\bar { X ^ { \bot } }$ , and hence also the image $X$ . In potential outcome notation, we let $X ^ { \bot } ( \Delta = \delta )$ be the style under intervention $\Delta = \delta$ , $X ( Y , \mathrm { I D } , \Delta = \delta )$ the image for class $Y$ , identity ID and style intervention $\Delta$ and this sometimes abbreviated as $X ( \Delta = \delta )$ for notational simplicity. Finally, $f _ { \theta } ( X ( \Delta = \delta ) )$ ) is the prediction under the style intervention $\Delta = \delta$ . For a formal justification of using a causal graph and potential outcome notation simultaneously see Richardson $\&$ Robins (2013).
87
+
88
+ # 4.3 DOMAIN ADAPTATION, ADVERSARIAL EXAMPLES AND ADVERSARIAL DOMAIN SHIFTS
89
+
90
+ In this work, we are interested in guarding against adversarial domain shifts. We use the causal graph to explain the related but not identical goals of domain adaptation, transfer learning and guarding against adversarial examples.
91
+
92
+ (i) Domain adaptation and transfer learning. Assume we have $J$ different domains, each with a new distribution $F _ { j }$ for the interventions $\Delta$ (or more generally of the joint distribution of $( Y , \Delta ) )$ . The shift of $F _ { j }$ for different domains $j = 1 , \dots , J$ causes a shift in both the distribution of $X$ and in the conditional distribution $Y | X$ . If we consider domain adaptation and transfer learning together, their goal is generally to give the best possible prediction $\hat { Y } _ { j } ( x )$ in each domain $j = 1 , \dots , J$ .
93
+
94
+ (ii) Standard adversarial examples. The setting of adversarial examples in the sense of Szegedy et al. (2014) and Goodfellow et al. (2015) can also be described by the causal graph above by using $X ^ { \perp } ( \Delta ) = \Delta$ and identifying $X ^ { \perp }$ with pixel-by-pixel additive effects. The magnitude of the intervention $\Delta$ is then typically assumed to be within an $\epsilon$ -ball in $\ell _ { q }$ -norm around the origin, with $q = \infty$ or $q = 2$ for example. If the input dimension is large many imperceptible changes in the coordinates of $X$ can cause a large change in the output, leading to a misclassification of the sample. The goal is to devise a classification in this graph that minimizes the adversarial loss
95
+
96
+ $$
97
+ E \Big [ \operatorname* { m a x } _ { { \Delta \in \mathbb { R } ^ { q } } \colon \| { \Delta \| _ { q } } \leq \epsilon } \ell \Big ( Y , f _ { \theta } \big ( X ( { \Delta } ) \big ) \Big ) \Big ] ,
98
+ $$
99
+
100
+ where $X ( \Delta )$ is the image under the intervention $\Delta$ and $\hat { Y } ~ = ~ f _ { \theta } ( X ( \Delta ) )$ is the estimated conditional distribution of $Y$ , given the image under the chosen interventions.
101
+
102
+ (iii) Adversarial domain shifts. Here we are interested in arbitrarily strong interventions $\Delta \in \mathbb { R } ^ { q }$ on the style features $X ^ { \perp }$ , which are not known explicitly in general. Analogously to (1), the adversarial loss under arbitrarily large style interventions is
103
+
104
+ $$
105
+ L _ { a d v } ( \theta ) = E \Big [ \operatorname* { m a x } _ { \Delta \in \mathbb { R } ^ { q } } \ell \Big ( Y , f _ { \theta } \big ( X ( \Delta ) \big ) \Big ) \Big ] .
106
+ $$
107
+
108
+ In contrast to (1) the interventions can be arbitrarily strong but we assume that the style features $X ^ { \perp }$ can only change certain aspects of the image, while other aspects of the image (mediated by the core features) cannot be changed. In contrast to Ganin et al. (2016), we use the term “adversarial” to refer to adversarial interventions on the style features, while the notion of “adversarial” in domain adversarial neural networks describes the training procedure. Nevertheless, the motivation of Ganin et al. (2016) is equivalent to ours—that is, to protect against shifts in the distribution(s) of test data which we characterize by distinguishing between core and style features.
109
+
110
+ # 4.4 COUNTERFACTUAL OBSERVATIONS / GROUPING
111
+
112
+ The classical problem of causal inference is that we can never observe a counterfactual. For instance, we can only see the health outcome $Z$ if we take a medicine, $T = 1$ , or not, $T = 0$ , but we can never see both health outcomes simultaneously. The counterfactual in this context would be an observation where we change the treatment but hold all observed and unobserved confounders constant. If the treatment $T$ changes while all other variables are kept constant, we could just read off the treatment effect as $Z ( T = \bar { 1 } ) - Z ( T = 0 )$ if $Z$ is the health outcome of interest. Observing such counterfactuals is in general impossible as we can either observe the outcome under treatment or under no treatment but not both.
113
+
114
+ Here, we use the term counterfactual for a situation where we keep class label $Y$ and ID constant but allow the value of the style intervention $\Delta$ to change. The new value of $\Delta$ could be a do-intervention (as when explicitly rotating an image in data augmentation) or it could be a noise-intervention by sampling a new realization of $\Delta$ . The style intervention $\Delta$ takes the same role as the treatment $T$ in the previous medical example. In contrast to the medical example, however, counterfactuals are conceivable for image analysis as we can see the same object $( Y , \mathrm { I D } )$ under different conditions (‘treatments’) $\Delta$ .
115
+
116
+ As an example, if $Y$ is the binary variable whether a person wears glasses and ID is the identity of a person, then $\Delta$ corresponds to all other variables that determine the different images of the same person (either consistently wearing glasses or not) and includes background, posture, viewing angle, image quality, etc.
117
+
118
+ In further contrast to the medical setting, we are not interested primarily in the ‘treatment effect’ of the style intervention $\Delta$ but we merely use it to implicitly rule out parts of the feature space for classification. We know that any ‘treatment effect’ of $\Delta$ occurs in the space of the style or orthogonal features $X ^ { \perp }$ and not in the ‘conditionally invariant’ space $X ^ { c i }$ and we would thus like to penalize any change in the classification under different style interventions $\Delta$ but constant class and identity $( Y , \mathrm { I D } )$ .
119
+
120
+ Notationally, we have for sample $i \in \{ 1 , \ldots , n \}$ with class label and identifier $\left( Y , \mathrm { I D } \right) = \left( y _ { i } , \mathrm { i d } _ { i } \right)$ , $m _ { i }$ different images $x ( y _ { i } , \mathrm { i d } _ { i } , \Delta _ { i , j } )$ for $j ~ = ~ 1 , \dots , m _ { i }$ under different (unobserved) values of $\Delta _ { i , 1 } , \ldots , \Delta _ { i , m _ { i } }$ . Let $\begin{array} { r } { m = \sum _ { i } m _ { i } } \end{array}$ denote the total number of samples and $c = m - n$ , the number of counterfactual observations. Denote the $j$ -th observation of sample $i$ , by $x _ { i , j } \in \mathbb { R } ^ { p }$ . Typically $m _ { i } = 1$ for most samples and occasionally $m _ { i } \geq 2$ .
121
+
122
+ # 4.4.1 STANDARD APPROACH: POOLED ESTIMATOR
123
+
124
+ The standard approach is to simply pool over all available observations, ignoring any grouping information that might be available. The pooled estimator thus treats all examples identically by summing over the loss as
125
+
126
+ $$
127
+ { \hat { \theta } } ^ { p o o l } = \operatorname { a r g m i n } _ { \theta } { \frac { 1 } { m } } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \left[ \ell { \bigl ( } y _ { i } , f _ { \theta } ( x _ { i , j } ) { \bigr ) } \right] + \lambda \cdot \operatorname { p e n } ( \theta ) ,
128
+ $$
129
+
130
+ where $\mathrm { p e n } ( \theta )$ could be a ridge penalty. The pooled estimator in all examples is always the ridge estimator with a cross-validated choice of the penalty parameter. The adversarial loss of the pooled estimator will in general be infinite; see $\ S 4 . 6$ for a concrete example. Using Figure 2, one can show that the pooled estimator will work well in terms of the adversarial loss $L _ { a d v }$ if both (i) $Y$ ⊥⊥ $X | X ^ { c i }$ and (ii) $\mathrm { ~ \bar { \it Y } ~ } \mathcal { Y } \mathrm { ~ \not \ = ~ } X ^ { c i } | X ^ { \bot }$ . The first condition (i) implies that if the estimator learns to extract $X ^ { c i }$ from the image $X$ , there is no further information in $X$ that explains $Y$ and, therefore, the direction corresponding to $X ^ { \perp }$ is not required for predicting $Y$ . The second condition (ii) is fulfilled if the relations between $Y$ , $X ^ { c i }$ , and $X ^ { \perp }$ are not deterministic. Intuitively, it ensures that $X ^ { \perp }$ cannot replace $X ^ { c i }$ in the first condition. From (i) and (ii), we see that the pooled estimator will work well in terms of the adversarial loss $\boldsymbol { L _ { a d v } }$ if (a) the edge from $X ^ { \perp }$ to $X$ is absent or if (b) both the edge from $D$ to $X ^ { \perp }$ and the edge from $Y$ to $X ^ { \perp }$ are absent (cf. Figure 2).
131
+
132
+ # 4.5 CORE ESTIMATOR
133
+
134
+ In order to minimize the adversarial loss (2) we have to ensure $f _ { \theta } ( x ( \Delta ) )$ is as constant as possible as a function of $\Delta$ for all $x \in \mathbb { R } ^ { p }$ . Let $I$ be the invariant parameter space
135
+
136
+ For all $\theta \in I$ , the adversarial loss (2) is identical to the loss under no interventions at all. More precisely, let $X$ be a shorthand notation for $X ( \Delta = 0 )$ , the images in absence of external interventions:
137
+
138
+ $$
139
+ { \mathrm { i f } } \theta \in I , { \mathrm { ~ t h e n } } \qquad E { \Bigl [ } \operatorname* { m a x } _ { \Delta \in \mathbb { R } ^ { q } } \ell { \Bigl ( } Y , f _ { \theta } { \bigl ( } X ( \Delta ) { \bigr ) } { \Bigr ) } { \Bigr ] } \ = \ E { \Bigl [ } \ell { \Bigl ( } Y , f _ { \theta } { \bigl ( } X { \bigl ) } { \Bigr ) } { \Bigr ] } .
140
+ $$
141
+
142
+ The optimal predictor in the invariant space $I$ is
143
+
144
+ $$
145
+ \theta ^ { * } \ = \ \operatorname { a r g m i n } _ { \theta } { \cal E } \Big [ \ell ( Y , f _ { \theta } ( X ) ) \Big ] \ \mathrm { s u c h ~ t h a t } \theta \in I .
146
+ $$
147
+
148
+ If $f _ { \theta }$ is only a function of the core features $X ^ { c i }$ , then $\theta \in I$ . The challenge is that the core features are not directly observable and we have to infer the invariant space $I$ from data. To get an approximation to the optimal invariant parameter vector (3), we use empirical risk minimization:
149
+
150
+ $$
151
+ { \hat { \theta } } ^ { c o r e } = \operatorname * { a r g m i n } _ { \theta } { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \ell \bigl ( y _ { i } , f _ { \theta } ( x _ { i , j } ) \bigr ) \ \mathrm { s u c h \ t h a t } \ \theta \in I _ { n } ,
152
+ $$
153
+
154
+ where the first part is the empirical version of the expectation in (3). The unknown invariant parameters space $I$ is approximated by an empirically invariant space $I _ { n }$ , defined as
155
+
156
+ $$
157
+ I _ { n } : = \{ \theta : \sum _ { i = 1 } ^ { n } \sigma _ { i } ^ { 2 } ( \theta ) \leq \tau \} ,
158
+ $$
159
+
160
+ where $\sigma _ { i } ^ { 2 } ( \theta )$ is the variance of $f _ { \theta } ( x _ { i , j } )$ when varying $j = 1 , \dots , m _ { i }$ for a fixed value of $i$ and $\tau \geq 0$ is a regularization constant. Setting $\tau = 0$ is equivalent to demanding that the estimated predictions for the class labels are identical across all $m _ { i }$ counterfactuals of image $i$ , while slightly larger values of $\tau$ allow for some small degree of variations. For all values $\tau \geq 0$ the true invariant space $I$ is a subset of the empirically invariant subspace $I _ { n }$ , that is $I \subseteq I _ { n }$ . Under the right assumptions we get $I _ { n } = I$ for $n \to \infty$ . We return to this question in $\ S 4 . 6$ . One can equally use the Lagrangian form of the constrained optimization in (4), with a penalty parameter $\lambda$ instead of a constraint $\tau$ to get
161
+
162
+ $$
163
+ { \hat { \theta } } ^ { c o r e } = \operatorname { \arg \operatorname* { m i n } } _ { \theta } { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \ell { \big ( } y _ { i } , f _ { \theta } ( x _ { i , j } ) { \big ) } + \lambda \cdot \operatorname { p e n } _ { \mathrm { I D } } ( \theta ) ,
164
+ $$
165
+
166
+ where $\mathrm { p e n } _ { \mathrm { I D } } ( \theta ) = \tilde { f } _ { \theta } ^ { t } L _ { \mathrm { I D } } \tilde { f } _ { \theta }$ , and $\tilde { f } _ { \theta } \in \mathbb { R } ^ { m }$ is the value of $f _ { \theta } ( x _ { i , j } )$ at all $\begin{array} { r } { m = \sum _ { i = 1 } ^ { n } m _ { i } } \end{array}$ observations. The matrix $L _ { \mathrm { I D } }$ is a graph Laplacian (Belkin et al., 2006), where the underlying graph has $n$ connectivity components as all samples that have the same ID are connected by an edge and form fully connected connectivity components. The graph Laplacian regularization is identical to penalizing the sum over the variances ${ \bar { \sigma _ { i } ^ { 2 } } } ( \theta )$ . The graph for the underlying regularization is formed in the sample space and induced by the identifier variable ID, in contrast to graphs formed in feature space as in Sandler et al. (2009), where prior knowledge is used to form the graph by connecting features that share similar characteristics.
167
+
168
+ We show in $\mathrm { \ S C . 1 }$ that the outcome does not depend strongly on the chosen value of the penalty $\lambda$ and the experiments show that it is crucial to define the graph in terms of the identifier variable ID. Other regularizations do not perform nearly as well when trying to guard against adversarial domain shifts.
169
+
170
+ ![](images/424042f58e8c291575d11526e46731d963f19bd9ce10f72cb017452c554bca19.jpg)
171
+ Figure 3: a) Examples from the stickmen training set. The first three images from the left have $y \equiv c h i l d$ ; the remaining three images have $y \equiv a d u l t$ . Connected images are counterfactual examples. b) Misclassified observations from test set 2. c) Misclassification rates for $c = 5 0$ . Results for $c \in \{ \bar { 2 0 } , 5 0 0 , 2 0 0 0 \}$ can be found in Figure C.10.
172
+
173
+ # 4.6 THEORETICAL RESULTS
174
+
175
+ In $\ S \mathbf { A }$ we analyze the adversarial loss, defined in Eq. (2), for the pooled and the CORE estimator in a one-layer network for binary classification (logistic regression). Here, we briefly sketch the result while all details are given in $\ S \mathbf { A }$ . Assume the structural equation for the image $X \in \mathbb { R } ^ { p }$ is linear in the style features $\mathbf { \bar { A } } ^ { \perp } \in \mathbb { R } ^ { q }$ (with generally $p \gg q ,$ ), the interventions are additive and we use logistic regression to predict a class label $Y \in \{ - 1 , 1 \}$ . Under suitable assumptions (cf. Assumption 1), the pooled estimator has infinite adversarial loss while the adversarial loss of the CORE estimator converges to the optimal adversarial loss as $n \to \infty$ .
176
+
177
+ # 5 EXPERIMENTS
178
+
179
+ We perform an array of different experiments: in $\ S 5 . 1$ and $\ S 5 . 2$ we study how CORE can handle confounded training data sets and changing style features in test distributions. For the assessment we explicitly control the level of confounding. In $\ S 5 . 3$ , we consider classifying elephants and horses where $X ^ { \perp } \equiv c o l o r$ . In $\ S \mathbf { B }$ , we include two additional experiments: in the first one, $Y \equiv g e n d e r$ and $\begin{array} { r l } { X ^ { \bot } } & { { } \equiv } \end{array}$ wearing glasses; in the second one, $Y \equiv$ wearing glasses and $\begin{array} { r l } { X ^ { \bot } } & { { } \equiv } \end{array}$ brightness. Additional experimental results for the settings introduced in $\ S 2$ can be found in $\mathrm { \displaystyle \ S C } . 2$ and $\ S { \bf C } . 3$ . A TensorFlow (Abadi et al., 2015) implementation of CORE will be made available as well as further code necessary to reproduce the experiments. In addition to the details provided below, information on the employed architectures can be found in $\mathrm { \{ \ - \hbar \mathcal { C . 7 } } $ . An open question is how to set the value of the tuning parameter $\tau$ or the penalty $\lambda$ in Lagrangian form. We show in $\mathrm { \ S C . 1 }$ that performance is typically not very sensitive to the choice of $\lambda$ .
180
+
181
+ # 5.1 STICKMEN IMAGE-BASED AGE CLASSIFICATION
182
+
183
+ In this example we consider synthetically generated stickmen images (cf. Figure 3a). The target of interest is $Y \in \{ a d u l t , c h i \bar { l } d \}$ and $X ^ { \dot { c i } } \equiv h e i g h t$ . The class $Y$ is causal for height and height cannot be easily intervened on, so we consider it to be a core feature—it is a robust predictor for differentiating between children and adults. Additionally, there is a dependence between age and $\begin{array} { r l } { X ^ { \bot } } & { { } \equiv } \end{array}$ movement in the training dataset which arises through the hidden common cause $D \equiv$ place of observation. The data generating process is illustrated in Figure C.9. For instance, the images of children might mostly show children playing while the images of adults typically show them in more “static” postures. If the learned model exploits this dependence for predicting $Y$ , it will fail when presented images of, say, dancing adults.
184
+
185
+ Figure 3a shows examples from the training set where large movements are associated with children and small movements are associated with adults. Test set 1 follows the same distribution. In test sets 2 and 3 $X ^ { \perp }$ is intervened on such that the edge from $D$ to $X ^ { \perp }$ is removed and the dependence between $Y$ and $X ^ { \perp }$ vanishes. In test sets 2 and 3 large movements are associated with both children and adults, while the movements are heavier in test set 3 than in test set 2. Figure C.10 shows examples from all test sets. Figure 3c shows misclassification rates for CORE and the pooled estimator for $c = 5 0$ with a total sample size of $m = 2 0 0 0 0$ . For as few as 50 counterfactual observations, CORE succeeds in achieving good predictive performance on test sets 2 and 3 where the pooled estimator fails (test errors $> 4 0 \%$ ). These results suggest that the learned representation of the pooled estimator uses movement as a predictor for age while CORE does not use this feature due to the counterfactual regularization. Importantly, including more counterfactual examples would not improve the performance of the pooled estimator as these would be subject to the same bias and hence also predominantly have examples of heavily moving children and “static” adults (also see Figure C.10 which shows results for $\bar { c ^ { \cdot } } \in \{ 2 0 , 5 0 0 , 2 0 0 0 \} )$ .
186
+
187
+ ![](images/c87df6c0af6f6f7d2710d03791aea64ae21fedcd4df62854e2ff4a137fdb7eb2.jpg)
188
+ Figure 4: a) Examples from the CelebA image quality dataset. The first three images from the left have $y \equiv n o$ glasses; the remaining three images have $y \equiv g l a s s e s$ . Connected images are counterfactual examples. b) Misclassified examples from the test sets. c) Misclassification rates for $\mu = 3 0$ and $c = 5 0 0 0$ . Results for different counterfactual settings and $\mu \in \{ 3 0 , 4 0 , 5 0 \}$ can be found in Figure C.12.
189
+
190
+ # 5.2 EYEGLASSES DETECTION: IMAGE QUALITY INTERVENTION
191
+
192
+ As in $\ S 2 . 1$ , we use the CelebA dataset and consider the problem of classifying whether the person in the image is wearing eyeglasses. Here, $X ^ { \perp }$ is the quality of the image which differs conditional on $Y ^ { 7 }$ —if the image shows a person wearing glasses, the image quality tends to be lower. This setting mimics the confounding that occurred in the Russian tank legend (cf. $\ S 1$ ). The strength of the image quality intervention is governed by sampling the new image quality as a percentage of the original image’s quality from a Gaussian distribution $\mathcal { N } ( \mu = 3 0 , \sigma = \bar { 1 } 0 )$ . Images of people without glasses are not changed. Thus, we only have counterfactual observations for $Y \equiv g l a s s e s$ . Figure 4a shows examples from the training set. Here, we use as the counterfactual observation the same image but with a newly sampled image quality value from $\mathcal { N } ( 3 0 , 1 0 )$ . We call using the same image as a counterfactual “CF setting $1 ^ { \circ }$ . Two alternatives for constructing counterfactual observations for this setting are discussed in $\ S \mathbf { B } . 2 . 1$ . Here, $c = 5 0 0 0$ and $m = 2 0 0 0 0$ .
193
+
194
+ Figure 4c shows misclassification rates for CORE and the pooled estimator on different test sets. Examples from all test sets can be found in Figure C.11. Test set 1 follows the same distribution as the training set. In test set 2 the class of the quality intervention is reversed, i.e. the quality of images showing people without glasses tends to be lower. In test set 3 all images are left unchanged and in test set 4 the quality of all images is decreased. First, we notice that the pooled estimator performs better than CORE on test set 1. This can be explained by the fact that it can exploit the predictive information contained in an image’s quality while CORE is restricted not to do so. Second, we observe that the pooled estimator does not perform well on test sets 2–4 as its learned representation seems to use the image’s quality as a predictor for the target. In contrast, the predictive performance of CORE is hardly affected by the changing image quality distributions. More experimental details are provided in $\ S C . 5$ . Results for quality interventions of different strengths $( \mu \in \{ 3 0 , 4 0 , 5 0 \} )$ are shown in Figure C.12.
195
+
196
+ ![](images/f3f623c9f6127ecb1309a0e60502a320fb01b75351daef0b88f4792639b2f6cf.jpg)
197
+ Figure 5: a) Examples from the subsampled and augmented AwA2 dataset. The first three images from the left shows horses, the remaining three images show elephants. Connected images are counterfactual examples. b) Misclassified examples from the test sets. c) Misclassification rates.
198
+
199
+ # 5.3 ELMER THE ELEPHANT
200
+
201
+ In this example, we want to assess whether invariance with respect to $X ^ { \perp } \equiv c o l o r$ can be achieved. In the children’s book “Elmer the elephant”8 one instance of a colored elephant suffices to recognize it as being an elephant, making the color “gray” no longer an integral part of the object “elephant”. Motivated by this process of concept formation, we would like to assess whether CORE can exclude “color” from its learned representation by including a few counterfactuals of different color.
202
+
203
+ We work with the “Animals with attributes $2 ^ { \circ }$ (AwA2) dataset (Xian et al., 2017) and consider classifying images of horses and elephants. The data generating process is illustrated in Figure C.14. We include counterfactual examples by adding grayscale images for $c = 2 5 0$ images of elephants, i.e. counterfactuals are only available for one class and the shift in color is quite subtle. The total sample size is 1850.
204
+
205
+ Figure 5a shows examples from the training set and Figure 5c shows misclassification rates for CORE and the pooled estimator on different test sets. Examples from all test sets can be found in Figure C.13. Test set 1 contains original, colored images only. In test set 2 images of horses are in grayscale and the colorspace of elephant images is modified, effectively changing the color gray to red-brown. Test set 3 contains grayscale images only and in test set 4 the colorspace of all images is shifted towards red. The details are given in $\mathrm { \ S C } . 6$ . We observe that the pooled estimator does not perform well on test sets 2 and 3 as its learned representation seems to exploit the fact that “gray” is predictive for the target in the training set. Using this information helps its predictive accuracy on test set 1. In contrast, the predictive performance of CORE is hardly affected by the changing color distributions.
206
+
207
+ It is noteworthy that a colored elephant can be recognized as an elephant by adding a few examples of a grayscale elephant to the very lightly colored pictures of natural elephants. If we just pool over these examples, there is still a strong bias that elephants are gray. The CORE estimator, in contrast, demands invariance of the prediction for instances of the same elephant and we can learn color invariance with a few added grayscale images.
208
+
209
+ While a thorough analysis in terms of fairness considerations is beyond the scope of this work, we would like to draw the following connection. If “color” was a protected attribute or a proxy for one, CORE would satisfy fairness in the sense that it would not include it in its learned representation. In contrast, there is no way to avoid that the pooled estimator extracts and uses “color” for its decisions.
210
+
211
+ # 6 CONCLUSION
212
+
213
+ Distinguishing the latent features in an image into core and style features, we have proposed counterfactual regularization (CORE) to achieve robustness with respect to arbitrarily large interventions on the style or conditionally invariant features. The main idea of the CORE estimator is to exploit the fact that we often have instances of the same object in the training data. By demanding invariance of the classifier amongst a group of instances that relate to the same object, we can achieve invariance of the classification performance with respect to adversarial interventions on style features such as image quality, fashion type, color, or body posture. The training also works despite sampling biases in the data.
214
+
215
+ There are two main applications areas. If the style features are known explicitly, we can achieve the same classification performance as standard data augmentation approaches but using fewer instances which, on top, do not have to be carefully balanced in the training data. Perhaps more interestingly, if the style features are unknown, the regularization of CORE avoids usage of them automatically by penalizing features that vary strongly between different instances of the same object in the training data.
216
+
217
+ An interesting line of work would be to use larger models such as Inception or large ResNet architectures (Szegedy et al., 2015; He et al., 2016). These models have been trained to be invariant to an array of explicitly defined style features. In $\mathrm { \ S B . l }$ we include results which show that using Inception V3 features does not guard against interventions on more implicit style features. We would thus like to assess what benefits CORE can bring for training Inception-style models end-to-end, both in terms of sample efficiency and in terms of generalization performance.
218
+
219
+ While we showed some examples where the necessary grouping information is available, an interesting possible future direction would be to use video data since objects display temporal constancy and the temporal information can hence be used for grouping and counterfactual regularization. Potentially an analogous approach could also help to debias word embeddings.
220
+
221
+ # REFERENCES
222
+
223
+ M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mane, R. Monga, S. Moore, D. Murray, C. Olah, ´ M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viegas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. ´ TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https: //www.tensorflow.org/. Software available from tensorflow.org.
224
+
225
+ J. Aldrich. Autonomy. Oxford Economic Papers, 41:15–34, 1989.
226
+
227
+ M. T. Bahadori, K. Chalupka, E. Choi, R. Chen, W. F. Stewart, and J. Sun. Causal regularization. ArXiv e-prints, 2017. URL http://arxiv.org/abs/1702.02604.
228
+
229
+ S. Barocas and A. D. Selbst. Big Data’s Disparate Impact. 104 California Law Review 671, 2016.
230
+
231
+ M. Belkin, P. Niyogi, and V. Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. Journal of machine learning research, 7(Nov): 2399–2434, 2006.
232
+
233
+ S. Ben-David, J. Blitzer, K. Crammer, and F. Pereira. Analysis of representations for domain adaptation. In Advances in Neural Information Processing Systems 19. 2007.
234
+
235
+ M. Besserve, N. Shajarisales, B. Scholkopf, and D. Janzing. Group invariance principles for causal ¨ generative models. ArXiv e-prints, 2017. URL http://arxiv.org/abs/1705.02212.
236
+
237
+ T. Bolukbasi, K.-W. Chang, J. Y. Zou, V. Saligrama, and A. T. Kalai. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Advances in Neural Information Processing Systems 29. 2016.
238
+
239
+ D. Bouchacourt, R. Tomioka, and S. Nowozin. Multi-level variational autoencoder: Learning disentangled representations from grouped observations. ArXiv e-prints, 2017. URL http: //arxiv.org/abs/1705.08841.
240
+
241
+ X. Chen, Y. Duan, R. Houthooft, J. Schulman, I. Sutskever, and P. Abbeel. InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets. In Advances in Neural Information Processing Systems 29. 2016.
242
+
243
+ K. Crawford. Artificial intelligence’s white guy problem. The New York Times, June 25 2016, 2016. URL https://www.nytimes.com/2016/06/26/opinion/sunday/ artificial-intelligences-white-guy-problem.html.
244
+
245
+ G. Csurka. A comprehensive survey on domain adaptation for visual applications. In Domain Adaptation in Computer Vision Applications., pp. 1–35. 2017.
246
+
247
+ J. Emspak. How a machine learns prejudice. Scientific American, December 29 2016, 2016. URL https://www.scientificamerican.com/article/ how-a-machine-learns-prejudice/.
248
+
249
+ Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky. Domain-adversarial training of neural networks. Journal of Machine Learning Research, 17(1), 2016.
250
+
251
+ M. Gong, K. Zhang, T. Liu, D. Tao, C. Glymour, and B. Scholkopf. Domain adaptation with ¨ conditional transferable components. In International Conference on Machine Learning, 2016.
252
+
253
+ I. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.
254
+
255
+ O. Goudet, D. Kalainathan, P. Caillou, D. Lopez-Paz, I. Guyon, M. Sebag, A. Tritas, and P. Tubaro.
256
+ Learning Functional Causal Models with Generative Neural Networks. ArXiv e-prints, 2017. URL https://arxiv.org/abs/1709.05321.
257
+ T. Haavelmo. The probability approach in econometrics. Econometrica, 12:S1–S115 (supplement), 1944.
258
+ K. He, X. Zhang, S. Ren, and J. Sun. Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification. ICCV, 2015.
259
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. CVPR, 2016.
260
+ I. Higgins, L. Matthey, A. Pal, C. Burges, X. Glorot, M. Botvinick, S. Mohamed, and A. Lerchner. beta-VAE: Learning Basic Visual Concepts with a Constrained Variational Framework. International Conference on Learning Representations, 2017.
261
+ N. Kilbertus, M. Rojas-Carulla, G. Parascandolo, M. Hardt, D. Janzing, and B. Scholkopf. Avoiding ¨ discrimination through causal reasoning. Advances in Neural Information Processing Systems, 2017.
262
+ D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. ICLR, 2015.
263
+ M. Kocaoglu, C. Snyder, A. G. Dimakis, and S. Vishwanath. CausalGAN: Learning Causal Implicit Generative Models with Adversarial Training. ArXiv e-prints, 2017. URL https://arxiv. org/abs/1709.02023.
264
+ A. Krizhevsky, I. Sutskever, and G. E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25. 2012.
265
+ Y. LeCun and C. Cortes. MNIST handwritten digit database. 2010. URL http://yann.lecun. com/exdb/mnist/.
266
+ Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
267
+ D. Lopez-Paz and M. Oquab. Revisiting Classifier Two-Sample Tests. International Conference on Learning Representations (ICLR), 2017.
268
+ D. Lopez-Paz, R. Nishihara, S. Chintala, B. Scholkopf, and L. Bottou. Discovering causal signals ¨ in images. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2017), 2017.
269
+ C. Louizos, U. Shalit, J. M. Mooij, D. Sontag, R. Zemel, and M. Welling. Causal effect inference with deep latent-variable models. Advances in Neural Information Processing Systems, 2017.
270
+ R. Turner J. Peters M. Rojas-Carulla, B. Scholkopf. Causal transfer in machine learning. ¨ ArXiv e-prints, 2017. URL https://arxiv.org/abs/1507.05333.
271
+ S. Magliacane, T. van Ommen, T. Claassen, S. Bongers, P. Versteeg, and J. M. Mooij. Causal transfer learning. ArXiv e-prints, 2017. URL https://arxiv.org/abs/1707.06422.
272
+ T. Matsuo, H. Fukuhara, and N. Shimada. Transform invariant auto-encoder. ArXiv e-prints, 2017. URL http://arxiv.org/abs/1709.03754.
273
+ M. Mirza and S. Osindero. Conditional Generative Adversarial Nets. ArXiv e-prints, 2014. URL https://arxiv.org/abs/1411.1784.
274
+ J. Pearl. Causality: Models, Reasoning, and Inference. Cambridge University Press, New York, USA, 2nd edition, 2009.
275
+ J. Peters, P. Buhlmann, and N. Meinshausen. Causal inference using invariant prediction: identifica- ¨ tion and confidence intervals. Journal of the Royal Statistical Society, Series B (with discussion), to appear, 2016.
276
+ T. Richardson and J. M. Robins. Single world intervention graphs (SWIGs): A unification of the counterfactual and graphical approaches to causality. Center for the Statistics and the Social Sciences, University of Washington Series. Working Paper 128, 30 April 2013, 2013.
277
+ Ted Sandler, John Blitzer, Partha P Talukdar, and Lyle H Ungar. Regularized learning with networks of features. In Advances in neural information processing systems, pp. 1401–1408, 2009.
278
+ B. Scholkopf, D. Janzing, J. Peters, E. Sgouritsa, K. Zhang, and J. Mooij. On causal and anticausal ¨ learning. In Proceedings of the 29th International Conference on Machine Learning (ICML), pp. 1255–1262, 2012.
279
+ B. Scholkopf, C. Burges, and V. Vapnik. Incorporating invariances in support vector learning ma- ¨ chines. pp. 47–52. Springer, 1996.
280
+ C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014.
281
+ C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In Computer Vision and Pattern Recognition (CVPR), 2015.
282
+ M. Gong K. Zhang D. Tao X. Yu, T. Liu. Transfer learning with label noise. ArXiv e-prints, 2017. URL https://arxiv.org/abs/1707.09724.
283
+ Y. Xian, C. H. Lampert, B. Schiele, and Z. Akata. Zero-shot learning - A comprehensive evaluation of the good, the bad and the ugly. ArXiv e-prints, 2017. URL http://arxiv.org/abs/ 1707.00600.
284
+ E. Yudkowsky. Artificial intelligence as a positive and negative factor in global risk. Global catastrophic risks, 1, 2008.
285
+ K. Zhang, B. Scholkopf, K. Muandet, and Z. Wang. Domain adaptation under target and conditional ¨ shift. In International Conference on Machine Learning, 2013.
286
+ K. Zhang, M. Gong, and B. Scholkopf. Multi-source domain adaptation: A causal view. In ¨ Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015.
287
+
288
+ # SUPPLEMENTARY MATERIAL
289
+
290
+ # A LOGISTIC REGRESSION
291
+
292
+ Assume the structural equation for the image $X \in \mathbb { R } ^ { p }$ is linear in the style features $X ^ { \bot } \in \mathbb { R } ^ { q }$ (with generally $p \gg q$ ) and we use logistic regression to predict a class label $Y \in \{ - 1 , 1 \}$ . Let the interventions $\Delta \in \mathbb { R } ^ { q }$ act additively on the style features $X ^ { \perp }$ (this is only for notational convenience) and let the style features $X ^ { \perp }$ act in a linear way on the image $X$ via a matrix $W \in \mathbb { R } ^ { p \times q }$ (this is an important assumption without which results are more involved). The core or ‘conditionally invariant’ features are $\bar { \boldsymbol X } ^ { c i } \in \mathbb { R } ^ { r }$ , where in general $r \le p$ but this is not important for the following. For independent $\varepsilon _ { Y } , \varepsilon _ { \mathrm { I D } } , \varepsilon _ { X ^ { \perp } } , \varepsilon _ { X }$ in $\mathbb { R } , \mathbb { R } ^ { q } , \mathbb { R } ^ { r } , \mathbb { R } ^ { p }$ respectively with positive density on their support and continuously differentiable functions $k _ { y } , k _ { \mathrm { I D } } , k _ { X ^ { \perp } } , k _ { X ^ { c i } } , k _ { x }$ ,
293
+
294
+ Of these, $Y , X$ and ID are observed whereas $D , X ^ { c i } , \Delta , X ^ { \perp }$ and the noise variables are latent.
295
+
296
+ We assume a logistic regression as a prediction of $Y$ from the image data $X$ :
297
+
298
+ $$
299
+ f _ { \theta } ( x ) : = \frac { \exp ( x ^ { t } \theta ) } { 1 + \exp ( x ^ { t } \theta ) } .
300
+ $$
301
+
302
+ Given training data with $m$ samples, we estimate $\theta$ with $\hat { \theta }$ and use here a logistic loss $\ell _ { \theta } ( y _ { i } , x _ { i } ) =$ $\log ( 1 + \exp ( - y _ { i } ( x _ { i } ^ { t } \theta ) ) )$ for training and testing. Some interesting expected losses on test data include
303
+
304
+ $$
305
+ \begin{array} { r l } & { \qquad L ( \theta ) = E \Bigl [ \ell \bigl ( Y , f _ { \theta } ( X ) ) \bigr ) \Bigr ] } \\ & { \qquad L _ { a d v } ( \theta ) = E \Bigl [ \underset { \Delta \in \mathbb { R } ^ { q } } { \operatorname* { m a x } } \ell \bigl ( Y , f _ { \theta } ( X ( \Delta ) ) \bigr ) \Bigr ] , } \end{array}
306
+ $$
307
+
308
+ where the $X$ in the first loss is a shorthand notation for $X ( \Delta = 0 )$ , that is the images in absence of interventions on the style variables. The first loss is thus a standard logistic loss in absence of adversarial interventions. The second loss is the loss under adversarial style or domain interventions as we allow arbitrarily large interventions on $X ^ { \perp }$ here. The corresponding benchmarks are
309
+
310
+ $$
311
+ L ^ { * } = \operatorname* { m i n } _ { \theta } L ( \theta ) , { \mathrm { ~ a n d ~ } } L _ { a d v } ^ { * } = \operatorname* { m i n } _ { \theta } L _ { a d v } ( \theta ) .
312
+ $$
313
+
314
+ The formulation of Theorem 1 relies on the following assumptions.
315
+
316
+ Assumption 1. We require the following conditions to hold:
317
+
318
+ (A1) Assume $\Delta$ is sampled from a distribution for training data in $\mathbb { R } ^ { q }$ with positive density on an $\epsilon$ -ball in $\ell _ { 2 }$ -norm around the origin for some $\epsilon > 0$ .
319
+ (A2) Assume the matrix $W$ has full rank $q$ .
320
+ (A3) Assume $c \geq q$ , that is the number $c = m - n$ of counterfactual examples in the samples is at least as large as the dimension of the style variables.
321
+
322
+ Regarding (A3): the sampling process is as follows. We collect $n$ independent samples $\left( y _ { i } , \mathrm { i d } _ { i } , \delta _ { i , 1 } \right)$ from a distribution of $( Y , \mathrm { I D } , \Delta )$ that satisfies the constraints above. Then, for $c = m - n$ of the samples we select each time $i \in \{ 1 , \ldots , n \}$ at random, keep $( y _ { i } , \mathrm { i d } _ { i } )$ fixed (and hence also the realization of $X ^ { \perp }$ is fixed) and redraw a new value of $\Delta$ as $\delta _ { i , u _ { i } + 1 }$ if $u _ { i }$ is the current number of counterfactual examples for sample $i$ . This leads to $m$ samples in total with in general $n$ distinct values of $( y _ { i } , \mathrm { i d } _ { i } )$ and $m _ { i }$ counterfactuals at each sample with corresponding $x _ { i , j }$ with $i \in \{ 1 , \ldots , n \}$ and $j \in \{ 1 , \dots , m _ { i } \}$ .
323
+
324
+ Theorem 1. Under Assumption $^ { l }$ , with probability $^ { l }$ with respect to the training data, the pooled estimator has infinite adversarial loss
325
+
326
+ $$
327
+ L _ { a d v } ( \hat { \theta } ^ { p o o l } ) = \infty .
328
+ $$
329
+
330
+ For the CORE estimator, for $n \to \infty$ ,
331
+
332
+ $$
333
+ L _ { a d v } ( \hat { \theta } ^ { c o r e } ) _ { p } L _ { a d v } ^ { * } .
334
+ $$
335
+
336
+ An equivalent results can be derived for misclassification loss instead of logistic loss (with infinity replaced by 1).
337
+
338
+ Proof. First part. To show the first part, namely that with probability 1,
339
+
340
+ $$
341
+ L _ { a d v } ( \hat { \theta } ^ { p o o l } ) = \infty ,
342
+ $$
343
+
344
+ we need to show that $W ^ { t } \hat { \theta } ^ { p o o l } \neq 0$ with probability 1. The reason this is sufficient is as follows: if $W ^ { t } \theta \neq 0$ , then $L _ { a d v } ( \theta ) = \infty$ as we can then find a $v \in \mathbb { R } ^ { q }$ such that $\gamma : = \theta ^ { t } W v \neq 0$ . Setting $\Delta _ { \kappa } = \kappa v$ for $\kappa \in \mathbb { R }$ , we get $x ( \Delta _ { \kappa } ) ^ { t } \theta = x ( \Delta = 0 ) ^ { t } \theta + \kappa \gamma$ . Hence $\log ( 1 + \exp ( - x ( \Delta _ { \kappa } ) ^ { t } \theta ) ) \to \infty$ for either $\kappa \infty$ or $\kappa - \infty$ .
345
+
346
+ To show that $W ^ { t } \hat { \theta } ^ { p o o l } \neq 0$ with probability 1, let ${ \hat { \theta } } ^ { * }$ be the oracle estimator that is constrained to be orthogonal to the column space of $W$ :
347
+
348
+ $$
349
+ \hat { \theta } ^ { * } = \mathrm { a r g m i n } _ { \theta : W ^ { t } \theta = 0 } L _ { n } ( \theta ) \mathrm { w i t h } L _ { n } ( \theta ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( y _ { i } , f _ { \theta } ( x _ { i } ( \Delta _ { i } ) ) ) .
350
+ $$
351
+
352
+ We show $W ^ { t } \hat { \theta } ^ { p o o l } \neq 0$ by contradiction. Assume hence that $W ^ { t } \hat { \theta } ^ { p o o l } = 0$ . If this is indeed the case, then the constraint $W ^ { t } \theta = 0$ in (6) becomes non-active and we have $\hat { \theta } ^ { p o o l } = \hat { \theta } ^ { * }$ . This would imply that taking the directional derivative of the training loss with respect to any $\delta \in \mathbb { R } ^ { p }$ in the column space of $W$ should vanish at the solution ${ \hat { \theta } } ^ { * }$ . Define $r _ { i } ( \theta ) : = ( y _ { i } + 1 ) / 2 - f _ { \hat { \theta } ^ { * } }$ . For all $i = 1 , \ldots , n$ we have $r _ { i } \neq 0$ . The derivative $g ( \delta )$ of $L _ { n } ( \theta )$ in direction of $\delta$ is proportional to
353
+
354
+ $$
355
+ g ( \delta ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } r _ { i } ( \hat { \theta } ^ { * } ) \sum _ { j = 1 } ^ { m _ { i } } x _ { i , j } ^ { t } \delta ,
356
+ $$
357
+
358
+ $x _ { i , j } \in \mathbb { R } ^ { p }$ is the $j$ -th counterfactual for training sample $i$ (with $j \in \{ 1 , \dots , m _ { i } \} )$ . Let $x _ { i , j } ( 0 ) =$ $x _ { i , 1 } ( 0 )$ for $i = 1 , \ldots , n$ be the counterfactual training data in absence of any interventions $( \Delta _ { i , j } =$ 0). Since the interventions only have an effect on the column space of $W$ in $X$ , the oracle estimator ${ \hat { \theta } } ^ { * }$ is identical under the true training data and the counterfactual training data $x ( 0 )$ . Hence, for any $\delta$ in $\mathbb { R } ^ { p }$ , the derivative $g ( \delta )$ in (7) can also be written as
359
+
360
+ $$
361
+ g ( \delta ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } r _ { i } ( \hat { \theta } ^ { * } ) \sum _ { j = 1 } ^ { m _ { i } } x _ { i , k } ( 0 ) ^ { t } \delta .
362
+ $$
363
+
364
+ Taking the difference between (7) and (8),
365
+
366
+ $$
367
+ { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } r _ { i } ( { \hat { \theta } } ^ { * } ) ( \sum _ { j = 1 } ^ { m _ { i } } ( x _ { i , j } - x _ { i , j } ( 0 ) ) ^ { t } \delta ) = 0 .
368
+ $$
369
+
370
+ Now, by the model assumptions, $x _ { i , j } - x _ { i , j } ( 0 ) = W \Delta _ { i , j }$ . Since $\delta$ is in the column-space of $W$ , there exists $u \in \mathbb { R } ^ { q }$ such that $\delta = W u$ . then (9) can be written as
371
+
372
+ $$
373
+ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } r _ { i } ( \hat { \theta } ^ { * } ) \sum _ { j = 1 } ^ { m _ { i } } \Delta _ { i , j } ^ { t } W ^ { t } W u = 0
374
+ $$
375
+
376
+ From (A2) we have that the eigenvalues of $W ^ { t } W$ are all positive. Also $r _ { i } ( { \hat { \theta } } ^ { * } )$ is not a function of the interventions $\Delta _ { i , j }$ since, as already argued above, the estimator ${ \hat { \theta } } ^ { * }$ is identical whether trained on the original data $x _ { i , j }$ or on the counterfactual data $x _ { i , j } ( 0 )$ . If we condition on $( x _ { i } ( 0 ) , y _ { i } )$ for $i = 1 , \ldots , n$ (that is everything except for the random $\Delta _ { i , j }$ , $i = 1 , \ldots , n )$ , then the interventions $\Delta _ { i , j }$ are by (A1) drawn from a continuous distribution. Hence the left hand side of (10) has a continuous distribution, and the probability of the left hand side of (10) being not identically 0 is 1. This completes the proof of the first part by contradiction.
377
+
378
+ Second part. For the second part, we first show that with probability 1, $\hat { \theta } ^ { c o r e } = \hat { \theta } ^ { * }$ with ${ \hat { \theta } } ^ { * }$ defined as in (6). Note that the invariant space is for this model the linear subspace $I = \{ \theta : W ^ { t } \theta = 0 \}$ . Note that by their respective definitions,
379
+
380
+ $$
381
+ \begin{array} { r l r } & { } & { \hat { \theta } ^ { * } = \operatorname * { a r g m i n } _ { \theta } \ \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \ell ( y _ { i } , f _ { \theta } ( x _ { i , j } ) ) \ \mathrm { s u c h \ t h a t } \ \theta \in I , } \\ & { } & { \hat { \theta } ^ { c o r e } = \operatorname * { a r g m i n } _ { \theta } \ \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \ell ( y _ { i } , f _ { \theta } ( x _ { i , j } ) ) \ \mathrm { s u c h \ t h a t } \ \theta \in I _ { n } . } \end{array}
382
+ $$
383
+
384
+ By (A2) and (A3), with probability 1, $I _ { n } = \{ \theta : W ^ { t } \theta = 0 \}$ since the number of counterfactuals examples is equal to or exceeds the rank $q$ of $W$ and $X ^ { \perp }$ has a linear influence on $X$ . Hence with probability 1, we have $I = I _ { n }$ and hence $\hat { \theta } ^ { c o r e } = \hat { \theta } ^ { * }$ . We thus need to show that
385
+
386
+ $$
387
+ L _ { a d v } ( \hat { \theta } ^ { * } ) _ { p } L _ { a d v } ^ { * } .
388
+ $$
389
+
390
+ Since ${ \hat { \theta } } ^ { * }$ is in $I$ , we have $\ell ( y , x ( \Delta ) ) = \ell ( y , x ( 0 ) )$ , where $x ( 0 )$ are the previously discussed counterfactual data in the absence of interventions. Hence
391
+
392
+ $$
393
+ \hat { \theta } ^ { * } = \operatorname * { a r g m i n } _ { \theta } \ \frac { 1 } { m } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \ell ( y _ { i } , f _ { \theta } ( x _ { i , j } ( 0 ) ) ) \ \mathrm { s u c h ~ t h a t } \theta \in I ,
394
+ $$
395
+
396
+ that is the estimator is unchanged if we use the data without interventions $\Delta _ { i } = 0$ ) as training data. Define the population-optimal vector as
397
+
398
+ $$
399
+ \theta ^ { * } = \operatorname { a r g m i n } _ { \theta } E \big [ \operatorname* { m a x } _ { \Delta } \ell ( Y , f _ { \theta } ( X ( \Delta ) ) ) \big ] \ \mathrm { s u c h \ t h a t } \ \theta \in I ,
400
+ $$
401
+
402
+ which can for the same reason be written as
403
+
404
+ $$
405
+ \theta ^ { * } = \operatorname { a r g m i n } _ { \theta } E \left[ \ell ( Y , f _ { \theta } ( X ( \Delta = 0 ) ) ) \right] \mathrm { { s u c h t h a t } } \theta \in I .
406
+ $$
407
+
408
+ Hence (12) and (13) can be written as
409
+
410
+ $$
411
+ \begin{array} { r l } & { \hat { \theta } ^ { * } = \operatorname * { a r g m i n } _ { \theta \colon \theta \in I } L _ { n } ^ { ( 0 ) } ( \theta ) \mathrm { ~ w h e r e ~ } L _ { n } ^ { ( 0 ) } ( \theta ) : = \displaystyle \frac { 1 } { m } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m _ { i } } \ell ( y _ { i } , f _ { \theta } ( x _ { i , j } ( 0 ) ) ) } \\ & { \theta ^ { * } = \operatorname * { a r g m i n } _ { \theta \colon \theta \in I } L ^ { ( 0 ) } ( \theta ) \mathrm { ~ w h e r e ~ } L ^ { ( 0 ) } ( \theta ) : = E [ \ell ( Y , f _ { \theta } ( X ( \Delta = 0 ) ) ) ] . } \end{array}
412
+ $$
413
+
414
+ Comparing (12) and (13), by uniform convergence of $L _ { n } ^ { ( 0 ) }$ to the population loss $L ^ { ( 0 ) }$ under the assumed sampling where $n$ samples of $( Y , \mathrm { I D } )$ are drawn independently then $c = m - n$ samples are redrawn from this empirical sample at random, we have $L ^ { ( 0 ) } ( { \hat { \theta } } ^ { * } ) \to _ { p } L ^ { ( 0 ) } ( \theta ^ { * } )$ .
415
+
416
+ By definition of $I$ and $\theta ^ { * }$ we have $L _ { a d v } ^ { * } = L _ { a d v } ( \theta ^ { * } ) = L ^ { ( 0 ) } ( \theta ^ { * } )$ . As ${ \hat { \theta } } ^ { * }$ is in $I$ , we also have ${ \cal L } _ { a d v } ( \hat { \theta } ^ { * } ) = { \cal L } ^ { ( 0 ) } ( \hat { \theta } ^ { * } )$ . Since, from above, $L ^ { ( 0 ) } ( { \hat { \theta } } ^ { * } ) \to _ { p } L ^ { ( 0 ) } ( \theta ^ { * } )$ , this also implies $L _ { a d v } ( { \hat { \theta } } ^ { * } ) \to _ { p }$ $L _ { a d v } ( \theta ^ { * } ) = L _ { a d v } ^ { * }$ . This completes the proof, using the previous fact that $\hat { \theta } ^ { c o r e } = \hat { \theta } ^ { * }$ with probability 1 under (A3).
417
+
418
+ # B ADDITIONAL EXPERIMENTS
419
+
420
+ # B.1 GENDER CLASSIFICATION
421
+
422
+ We work with the CelebA dataset (Liu et al., 2015) and consider the problem of classifying whether the person in the image is male or female. We create a confounding by including mostly images of men wearing glasses while the images of women do not include photos of women with glasses. As counterfactuals, we use an image of the same person without glasses if the person is male and with glasses if the person is female. We call using an image of the same person as counterfactual “CF setting 2”. Examples from the training and test sets are shown in Figure B.2. Test set 1 follows the same distribution as the training set. In test set 2 the association between gender and glasses is flipped: women always wear glasses while men never wear glasses.
423
+
424
+ ![](images/a13f32367c0487d116c0ffc11abaf9d92b2c009025197f57641f07fa81a22834.jpg)
425
+ Figure B.1: Examples from the CelebA gender dataset.
426
+
427
+ In this example, we would like to assess whether the results will differ when (a) training a fourlayer CNN (as detailed in Table C.1) end-to-end versus (b) using Inception V3 features and merely retraining the softmax layer. Figure B.2 shows the results for varying numbers of $m$ and $c$ —in the left column for training a four-layer CNN; in the right column for using Inception V3 features. Overall, we see the same trends: As $c$ increases, the performance difference between CORE and the pooled estimator becomes smaller. This is due to the fact that $X ^ { \perp }$ is binary in this example and, therefore, including counterfactual examples corresponds to data augmentation. Interestingly, the pooled estimator performs worse on test set 2 as $m$ becomes larger. It thus seems to exploit $\dot { X } ^ { \perp }$ to a larger extent as $m$ grows.
428
+
429
+ # B.2 EYEGLASSES DETECTION: BRIGHTNESS INTERVENTION
430
+
431
+ As in $\ S 5 . 2$ we work with the CelebA dataset and consider the problem of classifying whether the person in the image is wearing eyeglasses. Here we analyze a confounded setting that could arise as follows. Say the hidden common cause of $Y$ and $X ^ { \perp }$ , $D$ indicates whether the image was taken outdoors or indoors. If it was taken outdoors, then the person wears glasses and the image tends to be brighter. If the image was taken indoors, then the person does not wear glasses and the image tends to be darker. In other words, $X ^ { \perp } \equiv .$ brightness and the structure of the data generating process is equivalent to the one shown in Figure C.9. Figure B.3a shows examples from the training set. Here, we use as the counterfactual observation the same image (CF setting 1) but with a different brightness. Two alternatives for constructing counterfactual observations in this setting are discussed in $\ S \mathbf { B } . 2 . 1$ . We use $c = 2 0 0 0$ and $m = 2 0 0 0 0$ .
432
+
433
+ For the brightness intervention, we sample the value for the magnitude of the brightness increase resp. decrease from an exponential distribution with mean $\beta = 2 0$ . Specifically, we use ImageMag$\mathrm { i c k } ^ { \mathrm { \scriptsize 9 } }$ to modify the brightness of each image. In the training set and test set 1, we sample the brightness value as $b _ { i , j } = 1 0 0 + y _ { i } e _ { i , j }$ where $e _ { i , j } \sim E x p ( \beta ^ { - \bar { 1 } } )$ and $y _ { i } \in \{ - 1 , 1 \}$ . $y _ { i } = 1$ corresponds to $y _ { i } \equiv g l a s s e s$ . We then apply the command convert -modulate b ij, $^ { 1 0 0 , 1 0 0 }$ input.jpg output.jpg to the image. Importantly, since we sample from an exponential distribution, the brightness interventions are quite subtle in many cases as can be seen in Figure B.3a.
434
+
435
+ Figure B.3c shows misclassification rates for CORE and the pooled estimator on different test sets. Examples from all test sets can be found in Figure B.4. Test set 1 follows the same distribution as the training set. In test set 2 the sign of the brightness intervention is reversed, i.e. images of people with glasses tend to be darker; images of people without glasses tend to be brighter. In test set 3 all images are left unchanged and in test set 4 the brightness of all images is increased. First, we notice that the pooled estimator performs better than CORE on test set 1. This can be explained by the fact that it can exploit the predictive information contained in the brightness of an image while CORE is restricted not to do so. Second, we observe that the pooled estimator does not perform well on test sets 2 and 4 as its learned representation seems to use the image’s brightness as a predictor for the response which fails when the brightness distribution in the test set differs significantly from the training set. In contrast, the predictive performance of CORE is hardly affected by the changing brightness distributions. Results for $\beta \in \{ 5 , 1 0 , 2 0 \}$ and $c \in \{ 2 0 0 , 5 0 0 0 \}$ can be found in Figure B.5.
436
+
437
+ ![](images/7a62ea5acb75aa24137a62fbeed37566820efbb3b793133489f0443118d7d94e.jpg)
438
+ Figure B.2: Misclassification rates for the CelebA gender datasets with varying numbers for $m$ and $c$ . The left column shows results for training a four-layer CNN (cf. Table C.1) end-to-end, the right column shows results for using Inception V3 features and retraining the softmax layer.
439
+
440
+ ![](images/d16e6f39caf4bbec0a6a5f5d4cc670f751d20a0a246893e2e34dc69efaf115c2.jpg)
441
+ Figure B.3: a) Examples from the CelebA brightness dataset. The first three images from the left have $y \equiv n o$ glasses; the remaining three images have $y \equiv g l a s s e s$ . Connected images are counterfactual examples. b) Misclassified examples from the test sets. c) Misclassification rates for $\beta = 2 0$ and $c = 2 0 0 0$ . Results for different counterfactual settings, $\beta \in \{ 5 , 1 0 , 2 0 \}$ and $c \in \{ 2 0 0 , 5 0 0 0 \}$ can be found in Figure B.5.
442
+
443
+ # B.2.1 COUNTERFACTUAL SETTINGS 2 AND 3
444
+
445
+ Above we used the same image to create a counterfactual observation by sampling a different value for the brightness intervention. A plausible alternative is to use a different image of the same person as counterfactual. We call this “CF setting $2 ^ { \circ }$ . For comparison, we also evaluate using an image of a different person as counterfactual as a baseline (“CF setting $3 ^ { \circ }$ ). Examples from the training sets using CF setting 2 and 3 can be found in Figure B.4.
446
+
447
+ Results for all counterfactual settings, $\beta \in \{ 5 , 1 0 , 2 0 \}$ and $c \in \{ 2 0 0 , 5 0 0 0 \}$ can be found in Figure B.5. We see that using counterfactual setting 1 works best since we could explicitly control that only $X ^ { \perp } \equiv$ brightness varies between counterfactual examples. In counterfactual setting 2, different images of the same person can vary in many factors, making it more challenging to isolate brightness as the factor to be invariant against. Lastly, we see that even grouping images of different persons can still help predictive performance to some degree.
448
+
449
+ # C EXPERIMENTAL DETAILS AND ADDITIONAL RESULTS FOR EXPERIMENTS INTRODUCED IN §2 AND §5
450
+
451
+ # C.1 CHOOSING THE TUNING PARAMETER $\lambda$
452
+
453
+ An open question is how to set the value of the tuning parameter $\tau$ in Eq. (4) or the penalty $\lambda$ in the Lagrangian form. Figure C.6 shows the misclassification rates of CORE on the subsampled and augmented AwA2 dataset as a function of the penalty $\lambda$ . We see that performance is not very sensitive to the choice of $\lambda$ .
454
+
455
+ # .2 GROUPING PHOTOS OF THE SAME PERSON: BETTER PREDICTIVE PERFORMAN
456
+
457
+ Here, we show further results for the experiment introduced in $\ S 2 . 1$ . We vary the number of identities included in the training data set $n \in \{ 1 0 , 2 0 , 4 0 , 8 0 , 1 6 0 \}$ . This results in total sample sizes $m$ ranging from 321 for $n = 1 0$ to 4386 for $n = 1 6 0$ , implying that the average number of counterfactual observations per person varies between 27 and 32. Figure ${ \mathrm { C . 7 b } }$ shows the misclassification rates for the test set which consists of 5000 examples. We see that CORE helps predictive performance compared to the estimator which just pools all images, notably when $n$ is very small. It thus successfully mitigates the effect of potential confounders arising due to small sample sizes. As $n$ and $m$ increase the performance of CORE and the pooled estimator become comparable—the larger sample sizes ensure that fewer confounding factors are present in the training data and exploited by the pooled estimator.
458
+
459
+ ![](images/6fb23cf7597ce0bfd497baca22426a641baef6f9bc618d2b2178e4f022941491.jpg)
460
+ Figure B.4: Examples from the CelebA brightness datasets, counterfactual settings 1–3 with $\beta \in \{ 5 , 1 0 , 2 0 \}$ . In all rows, the first three images from the left have $y \equiv n o$ glasses; the remaining three images have $y \equiv$ glasses. Connected images are counterfactual examples. In panels (a)–(c), row 1 shows examples from the training set, rows 2–4 contain examples from test sets 2–4, respectively. Panels (d)–(i) show examples from the respective training sets.
461
+
462
+ ![](images/46e82328bf8065a71777f633a5c0c0720b996241c71a6addc6d310cf0f853153.jpg)
463
+ Figure B.5: Misclassification rates for the CelebA brightness datasets, counterfactual settings 1–3 with $c \in$ $\{ 2 0 0 , 2 0 0 0 , 5 0 0 0 \}$ and the mean of the exponential distribution $\beta \in \{ 5 , 1 0 , 2 0 \}$ .
464
+
465
+ ![](images/6b32a20d90e1783ad0b6b30717558e2450097912c52083e4a7a41f6a76d45528.jpg)
466
+ Figure C.6: Misclassification rates of CORE on the subsampled and augmented AwA2 dataset as a function of the penalty $\lambda$ . The outcome does not depend strongly on the chosen value.
467
+
468
+ (a) Training examples, grouped by identity.
469
+
470
+ ![](images/ee4ac5751f587d50c9f8315fb61544cc4bde63f0bd97fa249da7deecdf0c7564.jpg)
471
+ Figure C.7: a) Examples from the subsampled CelebA dataset. In each row, the first three images from the left have $y \equiv n o$ glasses; the remaining three images have $y \equiv g l a s s e s$ . Connected images are counterfactual examples. b) Misclassification rates for different numbers of identities, included in the training data.
472
+
473
+ ![](images/4ef8e29ff893328954129682c5011e461c940666e8fd2abc1afc62a82f128e8b.jpg)
474
+ Figure C.8: Data augmentation setting: Misclassification rates for MNIST and $S \equiv r o t a t i o n$ . In test set 1 all digits are rotated by a degree randomly sampled from [35, 70]. Test set 2 is the usual MNIST test set.
475
+
476
+ ![](images/d17d5ef3f7e0a2b80252731d113ac9911a85a5c325b0faf2ae4dd6d19f3ba48c.jpg)
477
+ Figure C.10: a) Examples from the stickmen test set 1 (row 1), test set 2 (row 2) and test sets 3 (row 3). In each row, the first three images from the left have $y \equiv c h i l d$ ; the remaining three images have $y \equiv a d u l t$ . Connected images are counterfactual examples. b) Misclassification rates for different numbers of counterfactual examples.
478
+
479
+ # C.4 STICKMEN IMAGE-BASED AGE CLASSIFICATION
480
+
481
+ ![](images/4c5fa35fe40db3bacec300cc709251e0a4e4a044f907b839bf20a83e1e3f815b.jpg)
482
+ Figure C.9: Data generating process for the stickmen example.
483
+
484
+ Here, we show further results for the experiment introduced in $\ S 5 . 1$ . Figure C.10b shows results for different numbers of counterfactual examples. For $c = 2 0$ the misclassification rate of CORE estimator has a large variance. For $c \in \{ 5 0 , 5 0 0 , 2 0 0 0 \}$ , the CORE estimator shows similar results. Its performance is thus not sensitive to the number of counterfactual examples, once there are sufficiently many counterfactual observations in the training set. The pooled estimator fails to achieve good predictive performance on test sets 2 and 3 as it seems to use “movement” as a predictor for “age”.
485
+
486
+ # C.5 EYEGLASSES DETECTION: IMAGE QUALITY INTERVENTION
487
+
488
+ Here, we show further results for the experiment introduced in $\ S 5 . 2$ . Specifically, we consider interventions of different strengths by varying the mean of the quality intervention in $\mu \in \{ 3 0 , 4 0 , 5 0 \}$ . As in $\mathrm { \ S B } . 2$ , we use ImageMagick, this time to modify the image quality. In the training set and in test set 1, we sample the image quality value as $q _ { i , j } \sim \mathcal { N } ( \mu , \overset { \cdot } { \sigma } = 1 0 \overset { \cdot } { ) }$ and apply the command convert -quality q ij input.jpg output.jpg if $y _ { i } \equiv g l a s s e s$ . If $y _ { i } \equiv n o$ glasses, the image is not modified. In test set 2, the above command is applied if $y _ { i } \equiv n o$ glasses while images with $y _ { i } \equiv g l a s s e s$ are not changed. In test set 3 all images are left unchanged and in test set 4 the command is applied to all images, i.e. the quality of all images is reduced.
489
+
490
+ We run experiments for counterfactual settings 1–3 and for $c = 5 0 0 0$ . Figure C.11 shows examples from the respective training and test sets and Figure C.12 shows the corresponding misclassification rates. Again, we observe that counterfactual setting 1 works best while there are only small differences in predictive performance between counterfactual settings 2 and 3. Interestingly, there is a large performance difference between $\mu = 4 0$ and $\mu = 5 0$ for the pooled estimator. Possibly, with $\mu = 5 0$ the image quality is not sufficiently predictive for the target.
491
+
492
+ ![](images/5f2946bdfa2e233a04f7b8e9bee68362bd4382f711992275bfb61f9674f1965f.jpg)
493
+ Figure C.11: Examples from the CelebA image quality datasets, counterfactual settings 1–3 with $\mu ~ \in$ $\{ 3 0 , 4 0 , 5 0 \}$ . In all rows, the first three images from the left have $y \equiv n o$ glasses; the remaining three images have $y \equiv g l a s s e s$ . Connected images are counterfactual examples. In panels (a)–(c), row 1 shows examples from the training set, rows 2–4 contain examples from test sets 2–4, respectively. Panels (d)–(i) show examples from the respective training sets.
494
+
495
+ ![](images/6d8d3765314d0a31ea31ac87ae0d7876cc86ea63abc4e7c10386bd3c0a8f807b.jpg)
496
+ Figure C.12: Misclassification rates for the CelebA image quality datasets, counterfactual settings 1–3 with $c = 5 0 0 0$ and the mean of the Gaussian distribution $\mu \in \{ 3 0 , 4 0 , 5 0 \}$ .
497
+
498
+ # C.6 ELMER THE ELEPHANT
499
+
500
+ The color interventions for the experiment introduced in $\ S 5 . 3$ are created as follows. In the training set, if $y _ { i } \equiv$ elephant we apply the following ImageMagick command only for the counterfactual examples convert -modulate $1 0 0 , 0 , 1 0 0$ input.jpg output.jpg, producing a grayscale image. In test set 1, all images are left unchanged. In test set 2, the above command is applied if $y _ { i } \equiv h o r s e$ ; if $y _ { i } \equiv$ elephant we sample $c _ { i , j } \sim \mathrm { \bar { \mathcal { N } } } ( \mu = 2 0 , \sigma = 1 )$ and apply convert -modulate $^ { 1 0 0 , 1 0 0 , 1 0 0 - \mathtt { C } _ { - } \mathtt { i } \mathtt { j } }$ input.jpg output.jpg to the image. In test set 4, the latter command is applied to all images. It rotates the colors of the image, in a cyclic manner10. In test set 3, all images are changed to grayscale.
501
+
502
+ ![](images/a3ed161efa8c79e208b50a7a239a3dc2954fcc1872197bb65b2f2b9c10c0cbd0.jpg)
503
+ Figure C.13: Examples from the subsampled and augmented AwA2 dataset. Row 1 shows examples from the training set, rows 2–5 show examples from test sets 1–4, respectively.
504
+
505
+ ![](images/c2ddfa99cc55938f7a9817fc6b4e78250561212fc699556819813dac2971cdbd.jpg)
506
+ Figure C.14: Data generating process for the Elmer the elephant example.
507
+
508
+ # C.7 NETWORK ARCHITECTURES
509
+
510
+ We implemented the considered models in TensorFlow (Abadi et al., 2015). The model architectures used are detailed in Table C.1. CORE and the pooled estimator thus use the same network architecture and training procedure; merely the loss function differs by the counterfactual regularization term. In all experiments we use the Adam optimizer (Kingma & Ba, 2015).
511
+
512
+ All experimental results are based on training the respective model five times (using the same data) to assess the variance due to the randomness in the training procedure.
513
+
514
+ In each epoch of the training, the training data $x _ { i , \cdot } , i = 1 , \ldots , n$ is randomly shuffled, keeping the counterfactual observations $x _ { i , j } , j = 1 , \dotsc , m _ { i }$ together to ensure that mini batches will contain counterfactual observations. In all experiments the mini batch size is set to 120. For small $c$ this implies that not all mini batches contain counterfactual observations, making the optimization more challenging.
515
+
516
+ Table C.1: Details of the model architectures used.
517
+
518
+ <table><tr><td>Dataset</td><td>Optimizer</td><td>Architecture</td><td></td></tr><tr><td>MNIST</td><td>Adam</td><td>Input CNN</td><td>28×28×1 Conv5×5×16,5×5×32</td></tr><tr><td>Stickmen</td><td>Adam</td><td>Input CNN</td><td>(same padding,strides= 2,ReLu activation), fully connected, softmax layer 64×64×1 Conv5×5×16,5×5×32,5×5×64,5×5×128</td></tr><tr><td>CelebA (all experiments</td><td>Adam</td><td>Input CNN</td><td>(same padding,strides = 2, leaky ReLu activation), fully connected, softmax layer 64×48×3 Conv5×5×16,5×5×32,5×5×64,5×5×128</td></tr><tr><td>using CelebA) AwA2</td><td>Adam</td><td>Input</td><td>(same padding,strides = 2,leaky ReLu activation), fully connected, softmax layer</td></tr><tr><td></td><td></td><td>CNN</td><td>32 ×32×3 Conv5×5×16,5×5×32,5×5×64,5×5×128 (same padding,strides = 2,leaky ReLu activation), fully connected, softmax layer</td></tr></table>
md/train/KYPz4YsCPj/KYPz4YsCPj.md ADDED
@@ -0,0 +1,537 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INDUCTIVE REPRESENTATION LEARNING IN TEMPORAL NETWORKS VIA CAUSAL ANONYMOUS WALKS
2
+
3
+ Yanbang Wang1∗, Yen-Yu Chang2, Yunyu $\mathbf { L i u ^ { 3 } }$ , Jure Leskovec1, Pan $\mathbf { L i ^ { 1 , 3 } }$
4
+
5
+ 1Department of Computer Science, 2Electrical Engineering, Stanford Univers 3Department of Computer Science, Purdue University
6
+ {ywangdr,jure}@cs.stanford.edu,yenyu@stanford.edu {liu3154,panli}@purdue.edu
7
+
8
+ # ABSTRACT
9
+
10
+ Temporal networks serve as abstractions of many real-world dynamic systems. These networks typically evolve according to certain laws, such as the law of triadic closure, which is universal in social networks. Inductive representation learning of temporal networks should be able to capture such laws and further be applied to systems that follow the same laws but have not been unseen during the training stage. Previous works in this area depend on either network node identities or rich edge attributes and typically fail to extract these laws. Here, we propose Causal Anonymous Walks (CAWs) to inductively represent a temporal network. CAWs are extracted by temporal random walks and work as automatic retrieval of temporal network motifs to represent network dynamics while avoiding the time-consuming selection and counting of those motifs. CAWs adopt a novel anonymization strategy that replaces node identities with the hitting counts of the nodes based on a set of sampled walks to keep the method inductive, and simultaneously establish the correlation between motifs. We further propose a neural-network model CAW-N to encode CAWs, and pair it with a CAW sampling strategy with constant memory and time cost to support online training and inference. CAW-N is evaluated to predict links over 6 real temporal networks and uniformly outperforms previous SOTA methods by averaged $15 \%$ AUC gain in the inductive setting. CAW-N also outperforms previous methods in 5 out of the 6 networks in the transductive setting.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Temporal networks consider dynamically interacting elements as nodes, interactions as temporal links, with labels of when those interactions happen. Such temporal networks provide abstractions to study many real-world dynamic systems (Holme & Saramäki, 2012). Researchers have investigated temporal networks in recent several decades and concluded many insightful laws that essentially reflect how these real-world systems evolve over time (Kovanen et al., 2011; Benson et al., 2016; Paranjape et al., 2017; Zitnik et al., 2019). For example, the law of triadic closure in social networks, describing that two nodes with common neighbors tend to have a mutual interaction later, reflects how people establish social connections (Simmel, 1950). Later, a more elaborate law on the correlation between the interaction frequency between two individuals and the degree that they share social connections, further got demonstrated (Granovetter, 1973; Toivonen et al., 2007). Feedforward control loops that consist of a direct interaction (from node $w$ to node $u$ ) and an indirect interaction (from $w$ through another node $v$ to $u$ ), also work as a law in the modulation of gene regulatory systems (Mangan & Alon, 2003) and also as the control principles of many engineering systems (Gorochowski et al., 2018). Although research on temporal networks has achieved the above success, it can hardly be generalized to study more complicated laws: Researchers have to investigate an exponentially increasing number of patterns when incorporating more interacting elements let alone their time-evolving aspects.
15
+
16
+ Recently, representation learning, via learning vector representations of data based on neural networks, has offered unprecedented possibilities to extract, albeit implicitly, more complex structural patterns (Hamilton et al., 2017b; Battaglia et al., 2018). However, as opposed to the study on static networks, representation learning of temporal networks is far from mature. Two challenges on temporal networks have been frequently discussed. First, the entanglement of structural and temporal
17
+
18
+ ![](images/40467c5e271e5773d80798469e21f9352137a12f2468d6a9cc93669eeb3ca6ab.jpg)
19
+ Figure 1: Triadic closure and feed-forward loops: Causal anonymous walks (CAW) capture the laws.
20
+
21
+ Example: three 3-step walks $( t _ { x } , X$ are the default timestamp and the default node when no historical links can be found)
22
+
23
+ ![](images/7540d82ab67e2037f4b9150644f1d5f6696f950c9818baa6667bec84f0ec6546.jpg)
24
+
25
+ Count number of $b$ ’s in different positions:
26
+
27
+ ![](images/e040abd14669a9fa48b1000380074bf83b5459d0cae4973f7127d0f34a681fdb.jpg)
28
+ Figure 2: Causal anonymous walks (CAW): causality extraction and set-based anonymization.
29
+
30
+ ![](images/859b7ac2a5c3f2a0ec2f95acc989adbe9316089986c8c2ebf0405488bc3b4d7b.jpg)
31
+
32
+ patterns required an elegant model to digest the two-side information. Second, the model scalability becomes more crucial over temporal networks as new arriving links need to be processed timely while a huge link set due to the repetitive links between two nodes needs to be digested simultaneously.
33
+
34
+ In contrast to the above two challenges, another challenge, the inductive capability of the temporalnetwork representation, is often ignored. However, it is equally important if not more, as the inductive capability indicates whether the models indeed capture the dynamic laws of the systems and can be further generalized to the system that share the same laws but have not been used to train these models. These laws may only depend on structures such as the triadic closure or feed-forward control loops as aforementioned. These laws may also correlate with node attributes, such as interactions between people affected by their gender and age (Kovanen et al., 2013). But in both cases, the laws should be independent from network node identities. Although previous works tend to learn inductive models by removing node identities (Trivedi et al., 2019; Xu et al., 2020), they run into other issues to inductively represent the dynamic laws, for which we leave more detailed discussion in Sec. 2.
35
+
36
+ Here we propose Causal Anonymous Walks (CAW) for modeling temporal networks. Our idea for inductive learning is inspired by the recent investigation on temporal network motifs that correspond to connected subgraphs with links that appear within a restricted time range (Kovanen et al., 2011; Paranjape et al., 2017). Temporal network motifs essentially reflect network dynamics: Both triadic closure and feed-forward control can be viewed as temporal network motifs evolving (Fig. 1); An inductive model should predict the 3rd link in both cases when it captures the correlation of these two links as they share a common node, while the model is agnostic to the node identities of these motifs.
37
+
38
+ Our CAW model has two important properties (Fig. 2): (1) Causality extraction — a CAW starts from a link of interest and backtracks several adjacent links over time to encode the underlying causality of network dynamics. Each walk essentially gives a temporal network motif; (2) Set-based anonymization — CAWs remove the node identities over the walks to guarantee inductive learning while encoding relative node identities based on the counts that they appear at a certain position according to a set of sampled walks. Relative node identities guarantee that the structures of motifs and their correlations are still kept after removing node identities. To predict temporal links between two nodes of interest, we propose a model CAW-Network (CAW-N) that samples a few CAWs related to the two nodes of interest, encodes and aggregates these CAWs via RNNs (Rumelhart et al., 1986) and set-pooling respectively to make the prediction.
39
+
40
+ Experiments show that CAW-N is extremely effective. CAW-N does not need to enumerate the types of motifs and count their numbers that have been used as features to predict network dynamics (Lahiri & Berger-Wolf, 2007; Rahman & Al Hasan, 2016; Rossi et al., 2019; AbuOda et al., 2019; Li & Milenkovic, 2017), which significantly saves feature-engineering effort. CAW-N also keeps all fine-grained temporal information along the walks that may be removed by directly counting motifs (Ahmed et al., 2015; Paranjape et al., 2017). CAWs share a similar idea as anonymous walks (AW) (Micali & Zhu, 2016) to remove node identities. However, AWs have only been used for entire static graph embedding (Ivanov & Burnaev, 2018) and are not directedly applied to represent temporal networks: AWs cannot capture causality; AWs get anonymized based on each single walk and hence lose the correlation between network motifs. In contrast, CAWs capture all the information, temporal, structural, motif-correlation that are needed, to represent temporal networks.
41
+
42
+ We conclude our contributions in three-folds: (1) A novel approach to represent temporal network CAW-N is proposed, which leverages CAWs to encode temporal network motifs to capture network dynamics while keeping fully inductive. CAW-N is evaluated to predict links over 6 real-world temporal networks. CAW-N outperforms all SOTA methods by about $15 \%$ averaged over 6 networks in the inductive setting and also significantly beat all SOTA methods over 5 networks in the transductive setting; (2) CAW-N significantly decreases the feature-engineering effort in traditional motif selection and counting approaches and keeps fine-grained temporal information; (3) CAW-N is paired with a CAW sampling method with constant memory and time cost, which conduces to online learning.
43
+
44
+ # 2 RELATED WORK
45
+
46
+ Prior work on representation learning of temporal networks preprocesses the networks by simply aggregating the sequence of links within consecutive time windows into network snapshots, and use graph neural networks (GNN) (Scarselli et al., 2008; Kipf & Welling, 2017) and RNNs or transformer networks (Vaswani et al., 2017) to encode structural patterns and temporal patterns respectively (Pareja et al., 2020; Manessi et al., 2020; Goyal et al., 2020; Hajiramezanali et al., 2019; Sankar et al., 2020). The main drawback of these approaches is that they need to predetermine a time granularity for link aggregation, which is hard to learn structural dynamics in different time scales. Therefore, approaches that work on link streams directly have been recently proposed (Trivedi et al., 2017; 2019; Kumar et al., 2019; Xu et al., 2020). Know-E (Trivedi et al., 2017), DyRep (Trivedi et al., 2019) and JODIE (Kumar et al., 2019) use RNNs to propagate messages across interactions to update node representations. Know-E, JODIE consider message exchanges between two directly interacted nodes while DyRep considers an additional hop of interactions. Therefore, DyRep gives a more expressive model at a cost of high complexity. TGAT (Xu et al., 2020) in contrast mimics GraphSAGE (Hamilton et al., 2017a) and GAT (Velickovi ˇ c et al., 2018) to propagate messages in a ´ GNN-like way from sampled historical neighbors of a node of interest. TGAT’s sampling strategy requires to store all historical neighbors, which is unscalable for online learning. Our CAW-N directly works on link streams and only requires to memorize constant many most recent links for each node.
47
+
48
+ Most of the above models are not inductive because they associate each node with an onehot identity (or the corresponding row of the adjacency matrix, or a free-trained vector) (Li et al., 2018; Chen et al., 2019; Kumar et al., 2019; Hajiramezanali et al., 2019; Sankar et al., 2020; Manessi et al., 2020; Goyal et al., 2020).
49
+
50
+ ![](images/d2549a96a4e14bdf943d40de6abf627c66f6937ae8a05294220ece0616340abb.jpg)
51
+ Figure 3: Ambiguity due to removing node identities in TGAT (Xu et al., 2020) $( t _ { 1 } < t _ { 2 } < t _ { 3 } )$ ).
52
+
53
+ TGAT (Xu et al., 2020) claimed to be inductive by removing node identities and just encoding link timestamps and attributes. However, TGAT was only evaluated over networks with rich link attributes, where the structural dynamics is not captured essentially: If we focus on structural dynamics only, it is easy to show a case when TGAT confuses node representations and will fail: Suppose in the history, two node pairs $\{ a , b \}$ and $\{ a ^ { \prime } , b ^ { \prime } \}$ only interact within each pair but share the timestamps (Fig. 3). Intuitively, a proper model should predict that future links still appear within each pair. However, TGAT cannot distinguish $a$ v.s. $a ^ { \prime }$ , and $b$ v.s. $b ^ { \prime }$ , which leads to incorrect prediction. Note that GraphSAGE (Hamilton et al., 2017a) and GAT (Velickovi ˇ c et al., 2018) also share the similar ´ issue when representing static networks for link prediction (Zhang et al., 2020; Srinivasan & Ribeiro, 2019). DyRep (Trivedi et al., 2019) is able to relieve such ambiguity by merging node representations with their neighbors’ via RNNs. However, when DyRep runs over a new network, it frequently encounters node representations unseen during its training and will fail to make correct prediction.
54
+
55
+ # Algorithm 1: Temporal Walk Extraction $( \mathcal { E } , \alpha , M , m , w _ { 0 } , t _ { 0 } )$
56
+
57
+ Initialize $M$ walks: $W _ { i } \gets ( ( w _ { 0 } , t _ { 0 } ) )$ , $1 \leq i \leq M$ ;
58
+
59
+ The rule: “one node (e.g. u) interacts with other nodes only if another node interacts with this node at least twice.”
60
+
61
+ 3 for $i$ from 1 to $M$ do 4 $( w _ { \mathsf { p } } , t _ { \mathsf { p } } ) \gets$ the last (node, time) pair in $W _ { i }$ ; 5 Sample one $( e , t ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ with prob. $\propto \exp ( \alpha ( t - t _ { \mathrm { p } } ) )$ Denote $\boldsymbol { e } = \{ w ^ { \prime } , w \}$ and then $W _ { i } \gets W _ { i } \oplus ( w ^ { \prime } , t )$ ;
62
+
63
+ 6 Return $\{ W _ { i } | 1 \leq i \leq M \}$ ;
64
+
65
+ ![](images/48cffeb4acfb34c6a6577ae037e112f82ed82578a1cad56743fe7d423e49c370.jpg)
66
+ ?? takes action $u \mathrm { N O T }$ takes action Figure 4: The correlation between walks needs to be captured to learn this law.
67
+
68
+ Our CAW-N removes node identities and leverages relative node identities to avoid the issue in Fig. 3.
69
+ Detailed explanations are given in Sec.4.2.
70
+
71
+ Network-embedding approaches may also be applied to temporal networks (Zhou et al., 2018; Du et al., 2018; Mahdavi et al., 2018; Singer et al., 2019; Nguyen et al., 2018). However, they directly assign each node with a learnable vector. Therefore, they are not inductive and cannot digest attributes.
72
+
73
+ # 3 PROBLEM FORMULATION AND NOTATIONS
74
+
75
+ Problem Formulation. A temporal network can be represented as a sequence of links that come in over time, i.e. $\mathcal { E } = \{ ( e _ { 1 } , t _ { 1 } ) , ( \bar { e } _ { 2 } , t _ { 2 } ) , . . . \}$ where $e _ { i }$ is a link and $t _ { i }$ is the timestamp showing when $e _ { i }$ arrives. Each link $e _ { i }$ corresponds to a dyadic event between two nodes $\{ v _ { i } , u _ { i } \}$ . For simplicity, we first assume those links to be undirected and without attributes while later we discuss how to generalized our method to directed attributed networks. The sequence of links encodes network dynamics. Therefore, the capability of a model for representation learning of temporal networks is typically evaluated by how accurately it may predict future links based on the historical links (Sarkar et al., 2012). In this work, we also use link prediction as the metric. Note that we care not only the link prediction between the nodes that have been seen during the training. We also expect the models to predict links between the nodes that has never been seen as the inductive evaluation.
76
+
77
+ Notations. We define $\mathcal { E } _ { v , t } = \{ ( e , t ^ { \prime } ) \in \mathcal { E } | t ^ { \prime } < t , v \in e \}$ to include the links attached to a node $v$ before certain time $t$ . A walk $W$ (reverse over time) on temporal networks can be represented as
78
+
79
+ $$
80
+ W = ( ( w _ { 0 } , t _ { 0 } ) , ( w _ { 1 } , t _ { 1 } ) , . . . , ( w _ { m } , t _ { m } ) ) , \ t _ { 0 } > t _ { 1 } > \cdot \cdot \cdot > t _ { m } , \ ( \{ w _ { i - 1 } , w _ { i } \} , t _ { i } ) \in \mathcal { E } \mathrm { ~ f o r ~ a l l ~ } \ t _ { 0 } < \mathbb { E } \mathrm { ~ o r ~ } \ t _ { 1 } < \mathbb { E } ,
81
+ $$
82
+
83
+ We use $W [ i ]$ to denote the $i$ th node-time pair, and $W [ i ] [ 0 ]$ and $W [ i ] [ 1 ]$ to denote the corresponding node and time in $W [ i ]$ correspondingly. Later, we also use $\oplus$ as vector concatenation.
84
+
85
+ Temporal network motifs are defined as connected subgraphs that consist of links appearing within a restricted time range (Kovanen et al., 2011). Based this definition, each walk defined in Eq. 1 naturally corresponds to a temporal network motif as long as $\left( t _ { 1 } - t _ { m } \right)$ is in the time range.
86
+
87
+ # 4 PROPOSED METHOD: CAUSAL ANONYMOUS WALK-NETWORK
88
+
89
+ # 4.1 PRELIMINARIES: ANONYMOUS WALK AND TEMPORAL NETWORK MOTIF
90
+
91
+ Anonymous walks were first considered by Micali & Zhu (2016) to study the reconstruction of a Markov process from the records without sharing a common “name space”. AWs can be directly rephrased in the network context. Specifically, an AW starts from a node, performs random walks over the graph to collect a walk of nodes, e.g. $( v _ { 1 } , v _ { 2 } , . . . , v _ { m } )$ . AW has an important anonymization step to replace the node identities by the orders of their appearance in each walk, which we term relative node identities in AW and define it as
92
+
93
+ $$
94
+ I _ { A W } ( w ; W ) \triangleq | \{ v _ { 0 } , v _ { 1 } , . . . , v _ { k ^ { * } } \} |
95
+ $$
96
+
97
+ Note that the set operation above removes duplicated elements. Although AW removes node identities, those nodes are still distinguishable within this walk. Therefore, an AW can be viewed as a network motif while the information on which specific nodes form this motif is removed. Examples of AWs are shown as follows. While these are two different walks, they may be mapped to the same AW when node identities get removed.
98
+
99
+ ![](images/d6e9fb23b0ffa2f5f256b5887a40dd252ed31e92613a66243d5005342b3a9e6c.jpg)
100
+
101
+ # 4.2 CAUSAL ANONYMOUS WALK
102
+
103
+ We propose CAW that shares the high-level concept with AW to remove the original node identities. However, CAW has a different causal sampling strategy and a novel set-based approach for node anonymization, which are specifically designed to encode temporal network dynamics (Fig. 2).
104
+
105
+ Causality Extraction. Alg. 1 shows our causal sampling: We sample connected links by backtracking over time to extract the underlying causality of network dynamics. More recent links may be more informative and thus we introduce a non-negative hyper-parameter $\alpha$ to sample a link with a probability proportional to $\exp ( \alpha ( t - t _ { \mathrm { p } } ) )$ where $t , t _ { \mathrm { p } }$ are the timestamps of this link and the link previously sampled respectively. A large $\alpha$ can emphasize more on recent links while zero $\alpha$ leads to uniform sampling. In Sec.4.4, we will discuss an efficient sampling strategy for the step 5 in Alg.1, which avoids computing those probabilities by visiting the entire historical links.
106
+
107
+ Then, given a link $\{ u _ { 0 } , v _ { 0 } \}$ and a time $t _ { 0 }$ , we use Alg. 1 to collect $M$ many $m$ -step walks starting from both $u _ { 0 }$ and $v _ { 0 }$ , and record them in $S _ { u }$ and $S _ { v }$ respectively. For convenience, a walk $W$ from a starting node $w _ { 0 } \in \{ u , v \}$ can be represented as Eq.1.
108
+
109
+ Set-based Anonymization. Based on $S _ { u }$ and $S _ { v }$ , we may anonymize each node identity $w$ that appears on at least one walk in $S _ { u } \cup S _ { v }$ and design relative node identity $I _ { C A W } ( w ; \{ S _ { u } , \overrightharpoonup { S } _ { v } \} )$ for $w$ . Our design has the following consideration. $I _ { A W }$ (Eq.2) only depends on a single path, which results from the original assumption that any two AWs do not even share the name space (i.e., node identities) (Micali & Zhu, 2016). However, in our case, node identities are actually accessible, though an inductive model is not allowed to use them directly. Instead, correlation across different walks could be a key to reflect laws of network dynamics: Consider the case when the link $\{ u , v \}$ happens only if there is another node appearing in multiple links connected to $u$ (Fig. 4). Therefore, we propose to use node identities to first establish such correlation and then remove the original identities.
110
+
111
+ Specifically, we define $I _ { C A W } ( w ; \{ S _ { u } , S _ { v } \} )$ as follows: For $w _ { 0 } \in \{ u , v \}$ , let $g ( w , S _ { w _ { 0 } } ) \in \mathbb { Z } ^ { m + 1 }$ count the times in $S _ { w _ { 0 } }$ node $w$ appears at certain positions, i.e., $g ( w , S _ { w _ { 0 } } ) [ i ] \triangleq | \{ W | W \in S _ { w _ { 0 } } , w =$ $W [ i ] [ 0 ] \}$ for $i \in \{ 0 , 1 , . . . , m \}$ . Further, define
112
+
113
+ $$
114
+ I _ { C A W } ( w ; \{ S _ { u } , S _ { v } \} ) \triangleq \{ g ( w , S _ { u } ) , g ( w , S _ { v } ) \} .
115
+ $$
116
+
117
+ Essentially, $g ( w , S _ { u } )$ and $g ( w , S _ { v } )$ encode the correlation between walks within $S _ { u }$ and $S _ { v }$ respectively and the set operation in Eq.3 establishes the correlation across $S _ { u }$ and $S _ { v }$ . For the case in Fig.3, suppose $S _ { a } , S _ { b } , S _ { a ^ { \prime } } , S _ { b ^ { \prime } }$ include all historical one-step walks (before $t _ { 3 }$ ) starting from $a , b , a ^ { \prime } , b ^ { \prime }$ respectively. Then, it is easy to show that $I _ { C A W } ( a ; \{ { \bar { S } } _ { a } , S _ { b } \} ) \neq I _ { C A W } ( a ^ { \prime } ; \{ S _ { a ^ { \prime } } , { \bar { S } } _ { b } \} )$ that allows differentiating $a$ and $a ^ { \prime }$ , while TGAT ( $\mathrm { X u }$ et al., 2020) as discussed in Sec.2 fails. From the networkmotif point of view, $I _ { C A W }$ not only encodes each network motif that corresponds to one single walk as $I _ { A W }$ does but also establish the correlation among these network motifs. $I _ { A W }$ cannot establish the correlation between motifs and will also fail to distinguish $a$ and $a ^ { \prime }$ in Fig.3. We see it as a significant breakthrough as such correlation often gets neglected in previous works that directly count motifs or adopt AW-type anonymization $I _ { A W }$ .
118
+
119
+ Later, we use $I _ { C A W } ( w )$ for simplicity when the reference set $\{ S _ { u } , S _ { v } \}$ can be inferred from the context. Then, each walk $W$ (Eq.1) can be anonymized as
120
+
121
+ $$
122
+ \hat { W } = ( ( I _ { C A W } ( w _ { 0 } ) , t _ { 0 } ) , ( I _ { C A W } ( w _ { 1 } ) , t _ { 1 } ) , . . . , ( I _ { C A W } ( w _ { m } ) , t _ { m } ) ) .
123
+ $$
124
+
125
+ The following theorem indicates that $I _ { C A W }$ does not depend on node identities to guarantee the inductive property of the models, which can be easily justified.
126
+
127
+ Theorem 4.1. For two pairs of walk sets $\{ S _ { u } , S _ { v } \}$ and $\{ S _ { u ^ { \prime } } , S _ { v ^ { \prime } } \}$ , if there exists a bijective mapping $\pi$ between node identities such that each walk $W$ in $S _ { u } \cup S _ { v }$ can be bijectively mapped to one walk $W ^ { \prime }$ in $S _ { u ^ { \prime } } \cup S _ { v ^ { \prime } }$ according to $\pi ( W [ i ] [ 0 ] ) = W ^ { \prime } [ i ] [ 0 ]$ for all $i \in [ 0 , m ]$ . Then $I _ { C A W } ( w | \{ S _ { u } , S _ { v } \} ) =$ $I _ { C A W } ( \pi ( w ) | \{ S _ { u ^ { \prime } } , S _ { v ^ { \prime } } \} )$ for all nodes $w$ that appear in at least one walk in $S _ { u } \cup S _ { v }$ .
128
+
129
+ # 4.3 NEURAL ENCODING FOR CAUSAL ANONYMOUS WALKS
130
+
131
+ After we collect CAWs, neural networks can be conveniently leveraged to extract their structural (in $I _ { C A W } ( \cdot ) )$ and fine-grained temporal information by encoding CAWs: We will propose the model CAW-N to first encode each walk $\hat { W }$ (Eq.4) and then aggregate all encoded walks in $S _ { u } \cup S _ { v }$ .
132
+
133
+ <table><tr><td>Measurement</td><td>Reddit</td><td>Wikipedia</td><td>MOOC</td><td>Social Evo.</td><td>Enron</td><td>UCI</td></tr><tr><td>nodes&amp; temporal links attributes for nodes &amp; links</td><td>10,985&amp;672,447 172&amp;172</td><td>9,227&amp;157,474 172 &amp;172</td><td>7145&amp;411,749</td><td>184&amp;125,235</td><td>74&amp;2,099,520</td><td>1,899&amp;59,835 0&amp;0</td></tr><tr><td>avg. link stream intensity T</td><td>4.57×10-5</td><td>1.27 × 10-5</td><td>0&amp;4 4.48×10-5</td><td>0&amp;0 6.50 × 10-5</td><td>0&amp;0 4.98 × 10-3</td><td>3.59×10-5</td></tr></table>
134
+
135
+ Table 1: Summary of dataset statistics. Average link stream intensity is calculated by $2 | E | / ( | V | T )$ , where $T$ is the total time range of all edges in unit of seconds, $| V |$ and $| E |$ are number of nodes and temporal links.
136
+
137
+ Encode $\hat { W }$ . Note that each walk is a sequence of node-time pairs. If we encode each node-time pair and plug those pairs in a sequence encoder, e.g., RNNs, we obtain the encoding of $\hat { W }$ :
138
+
139
+ $$
140
+ \begin{array} { r } { \mathrm { e n c } ( \hat { W } ) = \mathrm { R N N } ( \{ f _ { 1 } \big ( I _ { C A W } ( w _ { i } ) \big ) \oplus f _ { 2 } ( t _ { i - 1 } - t _ { i } ) \} _ { i = 0 , 1 , \dots , m } ) , \mathrm { ~ w h e r e ~ } t _ { - 1 } = t _ { 0 } , } \end{array}
141
+ $$
142
+
143
+ where $f _ { 1 } , f _ { 2 }$ are two encoding function on $I _ { C A W } ( w _ { i } )$ and $t _ { i - 1 } - t _ { i }$ respectively. One may use transformer networks instead of RNNs to encode the sequences but as the sequences in our case are not long $( 1 \sim 5 )$ , RNNs have achieved good enough performance. Now, we specify the two encoding functions $f _ { 1 } ( I _ { C A W } ( w _ { i } ) )$ and $f _ { 2 } ( t _ { i - 1 } - t _ { i } )$ as follows. Recall the definition of $I _ { C A W } ( w _ { i } )$ (Eq.3).
144
+
145
+ $\begin{array} { r } { f _ { 1 } \big ( I _ { C A W } \big ( w _ { i } \big ) \big ) = \mathbf { M L P } \big ( g \big ( w , S _ { u } \big ) \big ) + \mathbf { M L P } \big ( g \big ( w , S _ { v } \big ) \big ) . } \end{array}$ , where two MLPs share parameters.
146
+
147
+ Here the encoding of $I _ { C A W } ( w _ { i } )$ adopts the sum-pooling as the order of $u , v$ is not relevant. For $f _ { 2 } ( t )$ , we adopt random Fourier features to encode time ( $\mathrm { { X u } }$ et al., 2019; Kazemi et al., 2019) which may approach any positive definite kernels according to the Bochner’s theorem (Bochner, 1992).
148
+
149
+ $f _ { 2 } ( t ) = [ \cos ( \omega _ { 1 } t ) , \sin ( \omega _ { 1 } t ) , . . . , \cos ( \omega _ { d } t ) , \sin ( \omega _ { d } t ) ] .$ , where $\omega _ { i }$ ’s are learnable parameters.
150
+
151
+ Encode $S _ { u } \cup S _ { v }$ . After encoding each walk in $S _ { u } \cup S _ { v }$ , we aggregate all these walks to obtain the final representation enc $( S _ { u } \cup S _ { v } )$ for prediction. We suggest to use either mean-pooling for algorithmic efficiency or self-attention (Vaswani et al., 2017) followed by mean-pooling to further capture subtle interactions between different walks. Specifically, suppose $\{ \hat { W } _ { i } \} _ { 1 \leq i \leq 2 M }$ are the $2 M$ CAWs in $S _ { u } \cup S _ { v }$ and each enc $( \hat { W } _ { i } ) \in \mathbb { R } ^ { d \times 1 }$ . We set enc $( S _ { u } \cup S _ { v } )$ as
152
+
153
+ • $\begin{array} { r } { \mathbf { M e a n - A G G } ( S _ { u } \cup S _ { v } ) \colon \frac { 1 } { 2 M } \sum _ { i = 1 } ^ { 2 M } \operatorname { e n c } ( \hat { W } _ { i } ) . } \end{array}$
154
+ • Self-Att- $\operatorname { A G G } ( S _ { u } \cup S _ { v } )$ $\begin{array} { r l } { \colon } & { { } \frac { 1 } { 2 M } \sum _ { i = 1 } ^ { 2 M } \mathrm { s o f t m a x } ( \{ \mathrm { e n c } ( \hat { W } _ { i } ) ^ { T } Q _ { 1 } \mathrm { e n c } ( \hat { W } _ { j } ) \} _ { 1 \leq j \leq n } ) \mathrm { e n c } ( \hat { W } _ { i } ) Q _ { 2 } } \end{array}$ where $Q _ { 1 } , Q _ { 2 } \in \mathbb { R } ^ { d \times d }$ are two learnable parameter matrices.
155
+
156
+ We add 2-layer perceptron over enc $( S _ { u } \cup S _ { v } )$ to make the final link prediction.
157
+
158
+ # 4.4 EXTENSION AND DISCUSSION
159
+
160
+ Attributed nodes/links and directed links. In some real networks, nodes or links may have attributes available, e.g., the message content in the case of SMS networks. In this case, the walk in Eq.1 can be associated with node/link attributes $X _ { 0 } , X _ { 1 } , . . . , X _ { m }$ where $X _ { i }$ refers to the attributes on link $( \{ w _ { i - 1 } , w _ { i } \} , t _ { i } )$ or on the node $w _ { i }$ or a concatenation of these two parts. Note that the direction of a link can also be viewed as a binary link attribute, where a 2-dimensional one-hot encoding can be used. To incorporate such information, we only need to change enc $( \hat { W } )$ (Eq.5) as
161
+
162
+ Since $f _ { 1 } ( I _ { C A W } ( w _ { i } ) )$ is a strong signal, in practice it is optional to use another RNN to encode its own dynamics. The derived encoding is then concatenated with enc $( \hat { W } )$ to obtain the enhanced final encoding of $\hat { W }$ .
163
+
164
+ Efficient link sampling. A naive implementation of the link sampling in step 5 in Alg.1 is to compute and normalize the sampling probabilities of all links in $\mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ , which requires to memorize all historical links and costs much time and memory. To solve this problem, we propose a sampling strategy (Appendix A) with expected time and memory complexity $\begin{array} { r } { \operatorname* { m i n } \{ \frac { 2 \tau } { \alpha } + 1 , \top E _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } } | \} } \end{array}$ if links in Ewp,tp come in by following a Poisson process with intensity $\tau$ (Last & Penrose, 2017). This means that our sampling strategy with a positive $\alpha$ allows the model only recording $\textstyle O ( { \frac { \tau } { \alpha } } )$ recent links for each node instead of the entire history. Our experiments in Sec.5.3 show that $\alpha$ that achieves the best prediction performance makes $\textstyle { \frac { \tau } { \alpha } } \approx 5$ in different datasets. Since the time and memory complexity do not increase with respect to the number of links, our model can be used for online training and inference. Note that the $\alpha = 0$ case reduces to uniform sampling, mostly adopted by previous methods ( $\mathrm { \Delta X u }$ et al., 2020), which requires to record the entire history and thus is not scalable.
165
+
166
+ # 5 EXPERIMENTS
167
+
168
+ # 5.1 EXPERIMENTAL SETUP
169
+
170
+ CAW-N Variants. We test CAW-N-mean and CAW-N-attn which uses mean and attention pooling respectively to encode $S _ { u } \cup S _ { v }$ (Sec. 4.3). Their code is provided in the supplement.
171
+
172
+ Baselines. Our method is compared with six previous state-of-the-art baselines on representation learning of temporal networks. They can be grouped into two categories based on their input data structure: (1) Snapshot-based methods, including DynAERNN (Goyal et al., 2020), VGRNN (Hajiramezanali et al., 2019) and EvolveGCN (Pareja et al., 2020); (2) Stream-based methods, including TGAT (Xu et al., 2020), JODIE (Kumar et al., 2019) and DyRep (Trivedi et al., 2019). We give their detailed introduction in Appendix C.2.2. For the snapshot-based methods, we view the link aggregation as a way to preprocess historical links. We adopt the aggregation ways suggested in their papers. These models are trained and evaluated over the same link sets as the stream-based methods.
173
+
174
+ Dataset. We use six real-world public datasets: Wikipedia is a network between wiki pages and human editors. Reddit is a network between posts and users on subreddits. MOOC is a network of students and online course content units. Social Evolution is a network recording the physical proximity between students. Enron is a email communication network. UCI is a network between online posts made by students. We summarize their statistics in Tab.1 and give their detailed description and access in Appendix C.1.
175
+
176
+ Evaluation Tasks. Two types of tasks are for evaluation: transductive and inductive link prediction.
177
+
178
+ Transductive link prediction task allows temporal links between all nodes to be observed up to a time point during the training phase, and uses all the remaining links after that time point for testing. In our implementation, we split the total time range $[ 0 , T ]$ into three intervals: [0, $T _ { t r a i n } )$ , $[ T _ { t r a i n }$ , $T _ { v a l }$ ), $[ T _ { v a l } , T ]$ . links occurring within each interval are dedicated to training, validation, and testing set, respectively. For all datasets, we fix $T _ { t r a i n } / T { = } 0 . 7$ , and ${ T _ { v a l } } / T \mathrm { = } 0 . 8 5$ .
179
+
180
+ Inductive link prediction task predicts links associated with nodes that are not observed in the training set. There are two types of such links: 1) "old vs. new" links, which are links between an observed node and an unobserved node; 2) "new vs. new" links, which are links between two unobserved nodes. Since these two types of links suggest different types of inductiveness, we distinguish them by reporting their performance metrics separately. In practice, we follow two steps to split the data: 1) we use the same setting of the transductive task to first split the links chronologically into training / validation / testing sets; 2) we randomly select $10 \%$ nodes, remove any links associated with them from the training set, and remove any links not associated with them in the validation and testing sets.
181
+
182
+ Following most baselines, we randomly sample an equal amount of negative links and consider link prediction as a binary classification problem. For fair comparison, we use the same evaluation procedures for all baselines, including the snapshot-based methods.
183
+
184
+ Training configuration. We use binary cross entropy loss and Adam optimizer to train all the models, and early stopping strategy to select the best epoch to stop training. For hyperparameters, we primarily tune those that control the CAW sampling scheme including the number $M$ , the length $m$ of CAWs and the time decay $\alpha$ . We will investigate their sensitivity in Sec.5.3. For all baselines, we adapt their implemented models into our evaluation pipeline and extensively tune them. Detailed description of all models’ tuning can be found in Appendix C. Finally, we adopt two metrics to evaluate the models’ performance: Area Under the ROC curve (AUC) and Average Precision (AP).
185
+
186
+ # 5.2 RESULTS AND DISCUSSION
187
+
188
+ We report AUC scores in Tab.2, and report AP scores in Tab.6 of Appendix D.1. In the inductive setting and especially with "new vs new" links, our models significantly outperform all baselines on all datasets. On average, our best method improves over the strongest baseline by $1 4 . 4 6 \%$ (new vs. new) and $3 . 4 9 \%$ (old vs. new) in relative, or reduces the error $( = 1 - \mathsf { A U C } )$ by $6 9 . 7 3 \%$ (new vs. new) and $5 8 . 6 3 \%$ (old vs. new). Noticeably, out method achieves almost perfect AUCs on UCI’s "new vs. new" edges, when all baselines’ performance is below 0.8.
189
+
190
+ Even in transductive setting where the baselines claim their primary contribution, our approaches still significantly outperform them on five out of six datasets. Note that our models achieve almost perfect scores on Reddit and Wikpedia when the baselines are far from perfect. Meanwhile, the strongest baseline on these two attributed datasets, TGAT ( $\mathrm { X u }$ et al., 2020), suffers a lot on all the other datasets where informative node / link attributes become unavailable.
191
+
192
+ Table 2: Performance in AUC (mean in percentage $\pm 9 5 \%$ confidence level.) $\dagger$ highlights the best baselines. ∗, bold font, bold font∗ respectively highlights the case where our models’ performance exceeds the best baseline on average, by $7 0 \%$ confidence, by $9 5 \%$ confidence.
193
+
194
+ <table><tr><td colspan="2">Task</td><td>Methods</td><td>Reddit</td><td>Wikipedia</td><td>MOOC</td><td>Social Evo.</td><td>Enron</td><td>UCI</td></tr><tr><td rowspan="7">Trgeecer</td><td rowspan="7">Mwass aaa</td><td>DynAERNN JODIE DyRep</td><td>57.51 ± 2.54 72.49 ± 0.38</td><td>55.16 ± 1.15 70.78 ± 0.75</td><td>60.85 ± 1.61 80.04±0.28†</td><td>52.00±0.16 87.66 ±0.12†</td><td>51.57 ± 2.63 73.99 ± 2.54†</td><td>50.20± 2.78 64.77 ± 0.75</td></tr><tr><td></td><td>62.37 ± 1.49 61.93 ± 0.72</td><td>67.07 ± 1.26</td><td>74.07 ± 1.88</td><td>83.92 ±0.02</td><td>69.74 ± 0.44</td><td>63.76± 4.67</td></tr><tr><td>VGRNN EvolveGCN</td><td>63.31 ±0.53</td><td>60.64 ±0.68 58.01 ± 0.16</td><td>63.01 ± 0.29 52.31 ± 4.14</td><td>66.30 ± 0.84</td><td>61.35 ± 1.10</td><td>61.35 ± 1.10</td></tr><tr><td>TGAT</td><td>94.96 ± 0.88†</td><td>93.53 ± 0.84†</td><td>70.10 ± 0.35</td><td>46.95 ± 0.85</td><td>42.53 ± 2.12</td><td>76.65 ± 0.63†</td></tr><tr><td>CAW-N-mean</td><td>98.30 ± 0.71*</td><td></td><td></td><td>53.27 ± 1.16</td><td>63.34 ± 2.95</td><td>76.36 ± 1.48</td></tr><tr><td>CAW-N-attn</td><td>98.11 ± 0.58*</td><td>96.36±0.48* 97.83 ± 0.67*</td><td>90.29±0.82* 90.40 ± 0.75*</td><td>93.81 ± 0.69* 94.55 ± 0.81*</td><td>94.26±0.62* 93.53 ± 0.63*</td><td>99.62 ± 0.34*</td></tr><tr><td>DynAERNN</td><td>58.79 ±3.01 57.97 ± 2.38</td><td>80.99 ±1.35</td><td>52.31 ±0.59</td><td></td><td></td><td>100.00 ±0.00* 52.26 ± 1.36</td></tr><tr><td rowspan="7">PlO &#x27;s&#x27;A Mau</td><td>JODIE</td><td>76.33 ± 0.03</td><td>74.65 ± 0.06</td><td>87.40 ± 1.71</td><td>91.80 ± 0.01†</td><td>54.36± 1.48 85.24 ± 0.08</td><td>69.95 ± 0.11</td></tr><tr><td>DyRep</td><td>66.13 ± 1.07</td><td>76.72 ± 0.19</td><td>88.23 ± 1.20†</td><td>87.98 ± 0.45</td><td>94.39 ± 0.32†</td><td>93.28 ± 0.96†</td></tr><tr><td>VGRNN</td><td>54.11 ± 0.74</td><td>62.93 ± 0.69</td><td>60.10 ± 0.88</td><td>64.66 ± 0.41</td><td>68.71 ± 0.92</td><td></td></tr><tr><td>EvolveGCN</td><td>65.61 ± 0.37</td><td>56.29 ± 2.17</td><td>50.20 ± 1.92</td><td>50.73 ±1.36</td><td>42.53 ± 2.13</td><td>62.39 ± 1.08</td></tr><tr><td>TGAT</td><td>97.25 ± 0.18†</td><td>95.47 ± 0.17†</td><td>69.30 ± 0.08</td><td></td><td></td><td>70.78 ± 0.22</td></tr><tr><td>CAW-N-mean</td><td>99.88 ± 0.04*</td><td>98.94 ± 0.05*</td><td>90.88 ± 0.54*</td><td>54.22 ± 1.28 95.15 ± 0.40*</td><td>58.76 ± 1.18 94.76 ± 1.05*</td><td>74.19 ± 0.88</td></tr><tr><td></td><td>99.93 ±0.03*</td><td>99.61± 0.25*</td><td>90.89 ±0.56*</td><td>95.74 ± 0.68*</td><td>93.43 ± 1.41</td><td>99.04± 0.34*</td></tr><tr><td rowspan="10">Trarrsreeea</td><td>CAW-N-attn DynAERNN</td><td>83.37 ±1.48</td><td>71.00±1.10</td><td>89.34± 0.24</td><td>67.78±0.80</td><td>63.11 ± 1.13</td><td>98.99 ± 0.44*</td></tr><tr><td>JODIE</td><td>87.71 ± 0.02</td><td>88.43 ± 0.02</td><td>90.50 ± 0.01†</td><td>89.78 ± 0.04</td><td>89.36 ± 0.06</td><td>83.72± 1.79</td></tr><tr><td>DyRep</td><td>67.36 ± 1.23</td><td></td><td></td><td></td><td></td><td>74.63 ± 0.11</td></tr><tr><td>VGRNN</td><td>51.89 ±0.92</td><td>77.40 ± 0.13 71.20 ± 0.65</td><td>90.49 ± 0.03 90.03 ±0.32</td><td>90.85 ± 0.01† 78.28 ± 0.69</td><td>96.71 ± 0.04† 93.84 ±0.58</td><td>95.23 ± 0.25†</td></tr><tr><td>EvolveGCN</td><td>58.42 ±0.52</td><td>60.48 ± 0.47</td><td>50.36 ± 0.85</td><td>60.36 ± 0.65</td><td>74.02 ± 0.31</td><td>89.43 ± 0.27</td></tr><tr><td>TGAT</td><td>96.65 ± 0.06†</td><td>96.36 ± 0.05†</td><td>72.09 ± 0.29</td><td>56.63 ± 0.55</td><td>60.88 ±0.37</td><td>78.30 ± 0.22</td></tr><tr><td>CAW-N-mean</td><td>99.97 ± 0.01*</td><td>99.91 ± 0.04*</td><td>91.99 ± 0.72*</td><td>94.12 ± 0.15*</td><td>93.53 ± 0.73</td><td>77.67 ± 0.27</td></tr><tr><td>CAW-N-attn</td><td>99.98 ±0.01*</td><td>99.89±0.03*</td><td>92.38 ±0.58*</td><td>94.79 ±0.16*</td><td>95.93 ± 0.39</td><td>95.90 ± 0.71</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>98.45±0.49*</td></tr></table>
195
+
196
+ <table><tr><td>No.</td><td>Ablation</td><td>Wikipedia</td><td>UCI</td><td>Social Evo.</td></tr><tr><td>1.</td><td>original method (CAW-N-mean)</td><td>98.49 ± 0.38</td><td>99.12± 0.33</td><td>94.54± 0.69</td></tr><tr><td>2.</td><td>remove fi(IcAw)</td><td>96.28 ± 0.66</td><td>79.45 ± 0.71</td><td>53.69 ± 0.21</td></tr><tr><td>3.</td><td>remove f2(t)</td><td>97.99 ± 0.13</td><td>95.00 ±0.42</td><td>71.93 ± 2.32</td></tr><tr><td>4.</td><td>remove fi(IcAw),f2(t)</td><td>88.94 ± 0.85</td><td>50.01 ± 0.02</td><td>50.00 ±0.00</td></tr><tr><td>5.</td><td>replace fi(IcAw) byone-hot(IAw)</td><td>96.55 ± 0.21</td><td>85.59 ± 0.34</td><td>68.47 ± 0.86</td></tr><tr><td>6.</td><td>fixα=0</td><td>75.10 ± 3.12</td><td>87.13 ± 0.49</td><td>78.01 ± 0.69</td></tr></table>
197
+
198
+ Table 3: Ablation study with CAW-N-mean. AUC scores on all inductive test links are reported.
199
+
200
+ Comparing the two training settings, we observe that the performance of four baselines (JODIE, VGRNN, DynAERNN,DyRep) drop significantly when transiting from the transductive setting to the inductive one, as they mostly record node identities either explicitly (JODIE, VGRNN, DynAERNN) or implicitly (DyRep). TGAT and EvolveGCN do not use node identities and thus their performance gaps between the two settings are small, while they sometimes do not perform well in the transductive setting, as they encounter the ambiguity issue in Fig. 3. In contrast, our methods perform well in both the transductive and inductive settings. We attribute this superiority to the anonymization procedure: the set-based relative node identities well capture the correlation between walks to make good prediction while removing the original node identities to keep entirely inductive. Even when the network structures greatly change and new nodes come in as long as the network evolves according to the same law as the network used for training, CAW-N will always work. Comparing CAW-N-mean and CAW-N-attn, we see that our attention-based variant outperforms the mean-pooling variant, albeit at the cost of high computation complexity. Also note that the strongest baselines on all datasets are stream-based methods, which indicates that the aggregation of links into network snapshots may remove some useful time information (see more discussion in Appendix D.2).
201
+
202
+ We further conduct ablation studies on Wikipedia (attributed), UCI (non-attributed), and Social Evolution (non-attributed), to validate effectiveness of critical components of our model. Tab. 3 shows the results. By comparing Ab.1 with Ab.2, 3 and 4 respectively, we observe that our proposed node anonymization and encoding, $f _ { 1 } ( I _ { C A W } )$ , contributes most to the performance, though the time encoding ${ \dot { f } } _ { 2 } ( t )$ also helps. Comparing performance across different datasets, we see that the impact of ablation is more prominent when informative node/link attributes are unavailable such as with UCI and Social Evolution. Therefore, in such scenarios our CAWs are highly crucial. In Ab.5, we replace our proposed $I _ { C A W }$ with $I _ { A W }$ (Eq.2), which is used in standard AWs, and we use one-hot encoding of node new identities $I _ { A W }$ . We see by comparing Ab.1, 2, and 5 that such anonymization process is significantly less effective than our $I _ { C A W }$ , though it helps to some extent. Finally, Ab.6 suggests that entirely uniform sampling of the history may hurt performance.
203
+
204
+ ![](images/9ec0d59d700c9619967deb9fcfa86cbc9899ba2e1df8ce4606fe42d07ab3800c.jpg)
205
+ Figure 5: Hyperparameter sensitivity in CAW sampling. AUC on all inductive test links are reported.
206
+
207
+ ![](images/72705a5154c4f49127ce3c0370e2c6003416fbe4886d79f7e26cb9c346c78665.jpg)
208
+ Figure 6: Complexity evaluation: The accumulated runtime of (a) temporal random walk extraction (Alg.1) and (b) the entire CAW-N training, timed over one epoch on Wikipedia (using different $| \mathcal { E } |$ for training).
209
+
210
+ # 5.3 HYPERPARAMETER INVESTIGATION OF CAW SAMPLING
211
+
212
+ We systematically analyze the effect of hyperparameters used in CAW sampling schemes, including sampling number $M$ , temporal decay coefficient $\alpha$ and walk length $m$ . The experiments are conducted on UCI and Wikipedia datasets using CAW-N-mean. When investigating each hyperparameter, we set the rest two to an optimal value found by grid search, and report the mean AUC performance on all inductive test links (i.e. old vs. new, new vs. new) and their $9 5 \%$ confidence intervals.
213
+
214
+ The results are summarized in Fig.5. From (a), we observe that only a small number of sampled CAWs are needed to achieve a competitive performance. Meanwhile, the performance gain is saturated as the sampling number increases. We analyze the temporal decay $\alpha$ in (b): $\alpha$ usually has an optimal interval, whose values and length also vary with different datasets to capture the different levels of temporal dynamics; a small $\alpha$ suggests an almost uniform sampling of interaction history, which hurts the performance; an overly large $\alpha$ also damages the model, since it makes the model only sample the most recent few interactions for computation and blind to the rest. Based on our efficient sampling strategy (Sec.4.4), we may combine the optimal $\alpha$ with the average link intensity $\tau$ (Tab.1), and concludes that CAW-N only needs to online record and sample from about a constant times about 5 $\begin{array} { r } { ( \approx \frac { \tau } { \alpha } ) } \end{array}$ most recent links for each node. Plot (c) suggests that the performance may peak at a certain CAW length, while the exact value may vary with datasets. Longer CAWs indicate that the corresponding networks evolve according to more complicated laws encoded in higher-order motifs.
215
+
216
+ # 5.4 COMPLEXITY EVALUATION
217
+
218
+ We examine how the runtime of CAW-N depends on the number of edges $| \mathcal { E } |$ used for training. We record the runtimes of CAW-N for training one epoch on the Wikipedia datasets using $M = 3 2$ , $m = 2$ with batch-size $^ { = 3 2 }$ . Specifics of the computing infrastructure are given in Appendix C.5. Fig. 6 (a) shows the accumulated runtime of executing the random walk extraction i.e. Alg.1 only. It well aligns with our theoretical analysis (Thm. A.2) that each step of the random walk extraction has constant complexity (i.e. accumulated runtime linear with $| \mathcal { E } | )$ . Plot (b) shows the entire runtime for one-epoch training, which is also linear with $| \mathcal { E } |$ . Note that $\dot { O ( | \mathcal { E } | ) }$ is the time complexity that one at least needs to pay. The study demonstrates our method is scalable to long edge streams.
219
+
220
+ # 6 CONCLUSION
221
+
222
+ We proposed CAW-N to inductively represent the dynamics of temporal networks. CAW-N uses CAWs to implicitly extract network motifs via temporal random walks and adopts novel set-based anonymization to establish the correlation between network motifs. The success of CAW-N points out many promising future research directions on temporal networks: Pairing CAW-N with neural network interpretation techniques (Montavon et al., 2018) may give a chance to automatically discover larger and meaningful motifs/patterns of temporal networks; CAW-N may also be generalized to predict high-order structures (e.g., triangles) that correspond to some function units of temporal networks from different domains (Benson et al., 2016; 2018; Zitnik et al., 2019).
223
+
224
+ # ACKNOWLEDGMENTS
225
+
226
+ We thank Jiaxuan You and Rex Ying for their helpful discussion on the idea of Causal Anonymous Walks. We also thank Rok Sosic, Camilo Andres Ruiz and Maria Brbi ˇ c for providing insightful ´ feedback on the abstract. We also gratefully acknowledge the support of DARPA under Nos. FA865018C7880 (ASED), N660011924033 (MCS); ARO under Nos. W911NF-16-1-0342 (MURI), W911NF-16-1-0171 (DURIP); NSF under Nos. OAC-1835598 (CINES), OAC-1934578 (HDR), CCF-1918940 (Expeditions), IIS-2030477 (RAPID); Stanford Data Science Initiative, Wu Tsai Neurosciences Institute, Chan Zuckerberg Biohub, Amazon, Boeing, JPMorgan Chase, Docomo, Hitachi, JD.com, KDDI, NVIDIA, Dell. J. L. is a Chan Zuckerberg Biohub investigator.
227
+
228
+ # REFERENCES
229
+
230
+ Ghadeer AbuOda, Gianmarco De Francisci Morales, and Ashraf Aboulnaga. Link prediction via higher-order motif features. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases. Springer, 2019.
231
+
232
+ Nesreen K Ahmed, Jennifer Neville, Ryan A Rossi, and Nick Duffield. Efficient graphlet counting for large networks. In International Conference on Data Mining. IEEE, 2015.
233
+
234
+ Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
235
+
236
+ Austin R Benson, David F Gleich, and Jure Leskovec. Higher-order organization of complex networks. Science, 353(6295), 2016.
237
+
238
+ Austin R Benson, Rediet Abebe, Michael T Schaub, Ali Jadbabaie, and Jon Kleinberg. Simplicial closure and higher-order link prediction. Proceedings of the National Academy of Sciences, 115 (48):E11221–E11230, 2018.
239
+
240
+ Salomon Bochner. A theorem on Fourier-Stieltjes integrals. Collected Papers of Salomon Bochner, 2, 1992.
241
+
242
+ Jinyin Chen, Jian Zhang, Xuanheng Xu, Chenbo Fu, Dan Zhang, Qingpeng Zhang, and Qi Xuan. E-lstm-d: A deep learning framework for dynamic network link prediction. IEEE Transactions on Systems, Man, and Cybernetics: Systems, 2019.
243
+
244
+ Lun Du, Yun Wang, Guojie Song, Zhicong Lu, and Junshan Wang. Dynamic network embedding: An extended approach for skip-gram based network embedding. In International Joint Conference on Artificial Intelligence, 2018.
245
+
246
+ Thomas E Gorochowski, Claire S Grierson, and Mario di Bernardo. Organization of feed-forward loop motifs reveals architectural principles in natural and engineered networks. Science advances, 4(3), 2018.
247
+
248
+ Palash Goyal, Sujit Rokka Chhetri, and Arquimedes Canedo. dyngraph2vec: Capturing network dynamics using dynamic graph representation learning. Knowledge-Based Systems, 187, 2020.
249
+
250
+ Mark S Granovetter. The strength of weak ties. American journal of sociology, 78(6), 1973.
251
+
252
+ Ehsan Hajiramezanali, Arman Hasanzadeh, Krishna Narayanan, Nick Duffield, Mingyuan Zhou, and Xiaoning Qian. Variational graph recurrent neural networks. In Advances in Neural Information Processing Systems, 2019.
253
+
254
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, 2017a.
255
+
256
+ William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. IEEE Data Engineering Bulletin, 40(3), 2017b.
257
+
258
+ Petter Holme and Jari Saramäki. Temporal networks. Physics reports, 519(3), 2012.
259
+
260
+ Sergey Ivanov and Evgeny Burnaev. Anonymous walk embeddings. In International Conference on Machine Learning, 2018.
261
+
262
+ Seyed Mehran Kazemi, Rishab Goel, Sepehr Eghbali, Janahan Ramanan, Jaspreet Sahota, Sanjay Thakur, Stella Wu, Cathal Smyth, Pascal Poupart, and Marcus Brubaker. Time2vec: Learning a vector representation of time. arXiv preprint arXiv:1907.05321, 2019.
263
+
264
+ Thomas N Kipf and Max Welling. Variational graph auto-encoders. arXiv preprint arXiv:1611.07308, 2016.
265
+
266
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
267
+
268
+ Lauri Kovanen, Márton Karsai, Kimmo Kaski, János Kertész, and Jari Saramäki. Temporal motifs in time-dependent networks. Journal of Statistical Mechanics: Theory and Experiment, 2011(11), 2011.
269
+
270
+ Lauri Kovanen, Kimmo Kaski, János Kertész, and Jari Saramäki. Temporal motifs reveal homophily, gender-specific patterns, and group talk in call sequences. Proceedings of the National Academy of Sciences, 110(45), 2013.
271
+
272
+ Srijan Kumar, Xikun Zhang, and Jure Leskovec. Predicting dynamic embedding trajectory in temporal interaction networks. In International Conference on Knowledge Discovery Data Mining, 2019.
273
+
274
+ Mayank Lahiri and Tanya Y Berger-Wolf. Structure prediction in temporal networks using frequent subgraphs. In IEEE Symposium on Computational Intelligence and Data Mining, 2007.
275
+
276
+ Günter Last and Mathew Penrose. Lectures on the Poisson process, volume 7. Cambridge University Press, 2017.
277
+
278
+ Stephen Lavenberg. Computer performance modeling handbook. Elsevier, 1983.
279
+
280
+ Pan Li and Olgica Milenkovic. Inhomogeneous hypergraph clustering with applications. In Advances in Neural Information Processing Systems, 2017.
281
+
282
+ Taisong Li, Jiawei Zhang, S Yu Philip, Yan Zhang, and Yonghong Yan. Deep dynamic network embedding for link prediction. IEEE Access, 6, 2018.
283
+
284
+ Sedigheh Mahdavi, Shima Khoshraftar, and Aijun An. dynnode2vec: Scalable dynamic network embedding. In International Conference on Big Data (Big Data). IEEE, 2018.
285
+
286
+ Franco Manessi, Alessandro Rozza, and Mario Manzo. Dynamic graph convolutional networks. Pattern Recognition, 97, 2020.
287
+
288
+ Shmoolik Mangan and Uri Alon. Structure and function of the feed-forward loop network motif. Proceedings of the National Academy of Sciences, 100(21), 2003.
289
+
290
+ Silvio Micali and Zeyuan Allen Zhu. Reconstructing markov processes from independent and anonymous experiments. Discrete Applied Mathematics, 200, 2016.
291
+
292
+ Grégoire Montavon, Wojciech Samek, and Klaus-Robert Müller. Methods for interpreting and understanding deep neural networks. Digital Signal Processing, 73:1–15, 2018.
293
+
294
+ Giang Hoang Nguyen, John Boaz Lee, Ryan A Rossi, Nesreen K Ahmed, Eunyee Koh, and Sungchul Kim. Continuous-time dynamic network embeddings. In Companion Proceedings of the The Web Conference, 2018.
295
+
296
+ Ashwin Paranjape, Austin R Benson, and Jure Leskovec. Motifs in temporal networks. In International Conference on Web Search and Data Mining, 2017.
297
+
298
+ Aldo Pareja, Giacomo Domeniconi, Jie Chen, Tengfei Ma, Toyotaro Suzumura, Hiroki Kanezashi, Tim Kaler, Tao B Schardl, and Charles E Leiserson. EvolveGCN: Evolving graph convolutional networks for dynamic graphs. In AAAI Conference on Artificial Intelligence, 2020.
299
+
300
+ Mahmudur Rahman and Mohammad Al Hasan. Link prediction in dynamic networks using graphlet. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases. Springer, 2016.
301
+
302
+ Ryan A Rossi, Anup Rao, Sungchul Kim, Eunyee Koh, Nesreen K Ahmed, and Gang Wu. Higherorder ranking and link prediction: From closing triangles to closing higher-order motifs. arXiv preprint arXiv:1906.05059, 2019.
303
+
304
+ David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by back-propagating errors. nature, 323(6088), 1986.
305
+
306
+ Aravind Sankar, Yanhong Wu, Liang Gou, Wei Zhang, and Hao Yang. DySAT: Deep neural representation learning on dynamic graphs via self-attention networks. In International Conference on Web Search and Data Mining, 2020.
307
+
308
+ Purnamrita Sarkar, Deepayan Chakrabarti, and Michael I Jordan. Nonparametric link prediction in dynamic networks. In International Conference on Machine Learning, 2012.
309
+
310
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1), 2008.
311
+
312
+ Georg Simmel. The sociology of georg simmel, volume 92892. Simon and Schuster, 1950.
313
+
314
+ Uriel Singer, Ido Guy, and Kira Radinsky. Node embedding over temporal graphs. In International Joint Conference on Artificial Intelligence, 2019.
315
+
316
+ Balasubramaniam Srinivasan and Bruno Ribeiro. On the equivalence between positional node embeddings and structural graph representations. In International Conference on Learning Representations, 2019.
317
+
318
+ Riitta Toivonen, Jussi M Kumpula, Jari Saramäki, Jukka-Pekka Onnela, János Kertész, and Kimmo Kaski. The role of edge weights in social networks: modelling structure and dynamics. In Noise and Stochastics in Complex Systems and Finance, volume 6601. International Society for Optics and Photonics, 2007.
319
+
320
+ Rakshit Trivedi, Hanjun Dai, Yichen Wang, and Le Song. Know-evolve: deep temporal reasoning for dynamic knowledge graphs. In International Conference on Machine Learning, 2017.
321
+
322
+ Rakshit Trivedi, Mehrdad Farajtabar, Prasenjeet Biswal, and Hongyuan Zha. Dyrep: Learning representations over dynamic graphs. In International Conference on Learning Representation, 2019.
323
+
324
+ 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, 2017.
325
+
326
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua ´ Bengio. Graph attention networks. In International Conference on Learning Representations, 2018.
327
+
328
+ Yanbang Wang, Pan Li, Chongyang Bai, VS Subrahmanian, and Jure Leskovec. Generic representation learning for dynamic social interaction. International Conference on Knowledge Discovery Data Mining, MLG workshop, 2020.
329
+
330
+ 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, 2019.
331
+
332
+ Da Xu, Chuanwei Ruan, Evren Korpeoglu, Sushant Kumar, and Kannan Achan. Inductive representation learning on temporal graphs. In International Conference on Learning Representation, 2020.
333
+
334
+ Muhan Zhang, Pan Li, Yinglong Xia, Kai Wang, and Long Jin. Revisiting graph neural networks for link prediction. arXiv preprint arXiv:2010.16103, 2020.
335
+
336
+ Le-kui Zhou, Yang Yang, Xiang Ren, Fei Wu, and Yueting Zhuang. Dynamic network embedding by modeling triadic closure process. In AAAI Conference on Artificial Intelligence, 2018.
337
+
338
+ Marinka Zitnik, Marcus W Feldman, Jure Leskovec, et al. Evolution of resilience in protein interactomes across the tree of life. Proceedings of the National Academy of Sciences, 116(10), 2019.
339
+
340
+ # A EFFICIENT LINK SAMPLING
341
+
342
+ Our efficient link sampling strategy contains two subroutines – Online probability computation (Alg.2) and Iterative sampling (Alg.3). The Online probability computation subroutine Alg.2 essentially works online to assign each new incoming link $( \{ u , v \} , t )$ with a pair of probabilities $\{ p _ { u , t } , p _ { v , t } \}$ such that
343
+
344
+ $$
345
+ p _ { u , t } = \frac { \exp ( \alpha t ) } { \sum _ { ( e , t ^ { \prime } ) \in E _ { u , t } } \exp ( \alpha t ^ { \prime } ) } , \quad p _ { v , t } = \frac { \exp ( \alpha t ) } { \sum _ { ( e , t ^ { \prime } ) \in E _ { v , t } } \exp ( \alpha t ^ { \prime } ) } .
346
+ $$
347
+
348
+ These probabilities will be used later in sampling (Alg.3) and do not need to be updated any more.
349
+
350
+ # Algorithm 2: Online probability computation $( G , \alpha )$
351
+
352
+ 1 Initialize $V \emptyset$ , $\Omega \emptyset$ ;
353
+ 2 for $( \{ u , v \} , t ) \in \mathcal { E }$ do
354
+ 3 for $w \in \{ u , v \}$ do
355
+ 4 if $w \not \in V$ then
356
+ 5 V ← V ∪ {w};
357
+ 6 Pw ← exp(αt);
358
+ 7 else
359
+ 8 Find $P _ { w } \in \Omega$ ;
360
+ 9 $P _ { w } \gets P _ { w } + \exp ( \alpha t ) ;$
361
+ 10 p ← exp(αt) ; Pw
362
+ 11 Ω ← Ω ∪ {Pw};
363
+
364
+ 12 Assign two probability scores: $( \{ ( u , p _ { u , t } ) , ( v , p _ { v , t } ) \} , t , ) \gets ( \{ u , v \} , t ) ;$
365
+
366
+ The Iterative sampling subroutine $\mathrm { A l g } . 3$ is an efficient implementation of step 5 in Alg.1. We may first show that the sampling probability of a link $( e , t )$ in $E _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ is proportional to $\exp ( \alpha ( t - t _ { \mathrm { p } } ) )$ in Prop.A.1.
367
+
368
+ # Algorithm 3: Iterative Sampling $( \mathcal { E } , \alpha , w _ { \mathsf { p } } , t _ { \mathsf { p } } )$
369
+
370
+ 1 Initialize $V \emptyset$ , $\Omega \emptyset$ ;
371
+ 2 for $( e , t ) \in \mathcal { E } _ { w _ { p } , t _ { p } }$ with an decreasing order of $t$ do
372
+ 3 Sample $a \sim { \mathrm { U n i f } } [ 0 , 1 ]$ ;
373
+ 4 $p _ { w _ { \mathrm { p } } , t }$ is the score of this link related to $w _ { \mathsf { p } }$ obtained from Alg.2;
374
+ 5 if $a < p _ { w _ { p } , t }$ then
375
+ 6 Return $( e , t )$ ;
376
+
377
+ 7 Return $( \{ w _ { \mathrm { p } } , X \} , t _ { X } )$ ;
378
+
379
+ Proposition A.1. Based on the probabilities (Eq.9) pre-computed by Alg.2, Alg.3 will sample a link $( e , t )$ in $\mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ with probability proportional to $\mathrm { e x p } ( \bar { \alpha } ( t - t _ { \mathrm { p } } ) )$ .
380
+
381
+ Proof. To show this, we first order the timestamps of links in $\mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ between $[ t , t _ { \mathsf { p } } )$ as $t = t _ { 0 } ^ { \prime } < t _ { 1 } ^ { \prime } <$ $t _ { 2 } ^ { \prime } < \cdots < t _ { k } ^ { \prime } < t _ { \mathrm { p } }$ where there exists an link $( e ^ { \prime } , t _ { i } ^ { \prime } ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ for $t _ { i } ^ { \prime }$ . Then, the probability to sample a link $( e , t ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ satisfies
382
+
383
+ $$
384
+ \begin{array} { l } { p = p _ { w _ { \mathrm { p } } , t } \times \displaystyle \prod _ { i = 1 } ^ { k } \left( 1 - p _ { w _ { \mathrm { p } } , t _ { i } ^ { \prime } } \right) } \\ { = \displaystyle \frac { \exp ( \alpha t ) } { \sum _ { ( e ^ { \prime } , t ^ { \prime } ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t } } \exp { ( \alpha t ^ { \prime } ) } } \times \displaystyle \prod _ { i = 1 } ^ { k } \frac { \sum _ { ( e ^ { \prime } , t ^ { \prime } ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { i - 1 } ^ { \prime } } } \exp ( \alpha t ^ { \prime } ) } { \sum _ { ( e ^ { \prime } , t ^ { \prime } ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { i } ^ { \prime } } } \exp ( \alpha t ^ { \prime } ) } } \\ { = \displaystyle \frac { \exp ( \alpha t ) } { \sum _ { ( e ^ { \prime } , t ^ { \prime } ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { 0 } } } \exp { ( \alpha t ^ { \prime } ) } } = \frac { \exp \left( \alpha \left( t - t _ { \mathrm { p } } \right) \right) } { \sum _ { ( e ^ { \prime } , t ^ { \prime } ) \in \mathcal { E } _ { w _ { \mathrm { p } } , t _ { 0 } } } \exp { \left( \alpha \left( t ^ { \prime } - t _ { \mathrm { p } } \right) \right) } } , } \end{array}
385
+ $$
386
+
387
+ which is exactly the probability that we need.
388
+
389
+ We have the following Thm.A.2 with a weak assumption that evaluates the complexity of Alg.3. We assume that links come in by following a Poisson point process with intensity $\tau$ , which is a frequently used assumption to model communication networks (Lavenberg, 1983). This result indicates that if $\alpha > 0$ , for each node, we only need to record the most recent $\textstyle O ( { \frac { \tau } { \alpha } } )$ links to sample. This result is important as it means our method can do online training and inference with time and memory complexity that are not related to the total number of links.
390
+
391
+ Theorem A.2. If the links that are connected to $w _ { \mathsf { p } }$ appear by following a Poisson point process with intensity $\tau$ . Then, the expected number of iterations of Alg.3 is bounded by $\begin{array} { r } { \operatorname* { m i n } \{ \frac { 2 \tau } { \alpha } + 1 , | \mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } } | \} } \end{array}$ .
392
+
393
+ Proof. The number of iterations of Alg.3 is always bounded by $| \mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } } |$ . So we only need to prove that the expected number of interactions of Alg.3 is bounded by $\begin{array} { r } { \frac { 2 \tau } { \alpha } + 1 } \end{array}$ .
394
+
395
+ To show this, we order the timestamps of links in $\mathcal { E } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ between $[ 0 , t _ { \mathrm { p } } )$ as $0 = t _ { 0 } < t _ { 1 } < t _ { 2 } <$ $\cdot \cdot \cdot < t _ { k } < t _ { \mathrm { p } }$ where there exists an link $( e , t _ { i } ) \in \dot { \mathcal { E } } _ { w _ { \mathrm { p } } , t _ { \mathrm { p } } }$ for $t _ { i }$ . Further define we define $Z _ { i } =$ $\exp ( \alpha ( t _ { i } - t _ { i - 1 } ) )$ for $i \in [ 1 , k ]$ .
396
+
397
+ Due to the definition of Poisson process, we know that each time difference in $\{ t _ { i } - t _ { i - 1 } \} _ { 1 \leq i \leq k }$ follows i.i.d. exponential distribution with parameter $\tau$ . Therefore, $\{ Z _ { i } \} _ { 1 \le i \le k }$ are also i.i.d.. Let $\begin{array} { r } { \psi = \mathbb { E } ( Z _ { i } ^ { - 1 } ) = \frac { \tau } { \alpha + \tau } } \end{array}$ .
398
+
399
+ The probability that Alg.3 runs $j$ iterations is equal to the probability that the link with timestamp $t _ { k + 1 - j } )$ gets sampled. That is
400
+
401
+ $$
402
+ \mathbb { P } ( \mathrm { i t e r } = j ) = \frac { \prod _ { i = 1 } ^ { k + 1 - j } Z _ { i } } { \sum _ { h = 1 } ^ { k } \prod _ { i = 1 } ^ { k + 1 - h } Z _ { i } } .
403
+ $$
404
+
405
+ Therefore, the expected number of iterations is
406
+
407
+ $$
408
+ \mathbb { E } ( \mathrm { i t e r } ) = \mathbb { E } \left[ \frac { \sum _ { j = 1 } ^ { k } j \prod _ { i = 1 } ^ { k + 1 - j } Z _ { i } } { \sum _ { h = 1 } ^ { k } \prod _ { i = 1 } ^ { k + 1 - h } Z _ { i } } \right] = \sum _ { j = 1 } ^ { k } j \mathbb { E } \left[ \frac { \prod _ { i = 1 } ^ { j - 1 } Z _ { i } ^ { \prime } } { \sum _ { h = 1 } ^ { k } \prod _ { i = 1 } ^ { h - 1 } Z _ { i } ^ { \prime } } \right] .
409
+ $$
410
+
411
+ where $Z _ { i } ^ { \prime } = Z _ { k + 1 - i } ^ { - 1 }$ and $\textstyle \prod _ { i = 1 } ^ { 0 } Z _ { i } ^ { \prime } = 1$ . Next we will prove that each item in right-hand-side of Eq.10 satisfies
412
+
413
+ $$
414
+ j \mathbb { E } \left[ \frac { \prod _ { i = 1 } ^ { j - 1 } Z _ { i } ^ { \prime } } { \sum _ { h = 1 } ^ { k } \prod _ { i = 1 } ^ { h - 1 } Z _ { i } ^ { \prime } } \right] \leq [ 1 + ( j - 1 ) ( 1 - \psi ) ] \psi ^ { j - 1 } .
415
+ $$
416
+
417
+ If this is true, then
418
+
419
+ $$
420
+ \begin{array} { l } { { \mathbb { E } ( \mathrm { i t e r } ) \leq \displaystyle \sum _ { j = 1 } ^ { k } [ 1 + ( j - 1 ) ( 1 - \psi ) ] \psi ^ { j - 1 } = \sum _ { j = 1 } ^ { k } \psi ^ { j - 1 } + \sum _ { j = 1 } ^ { k } ( j - 1 ) ( 1 - \psi ) \psi ^ { j - 1 } } } \\ { { \leq \displaystyle \frac { 1 } { 1 - \psi } + \frac { \psi } { 1 - \psi } = \frac { 2 \tau } { \alpha } + 1 . } } \end{array}
421
+ $$
422
+
423
+ Now, let us prove Eq.11. For $j = 1$ , Eq.11 is trivial. For $j > 1$ ,
424
+
425
+ $$
426
+ \mathbb { E } \left[ \frac { \prod _ { i = 1 } ^ { j - 1 } Z _ { i } ^ { \prime } } { \sum _ { h = 1 } ^ { k } \prod _ { i = 1 } ^ { h - 1 } Z _ { i } ^ { \prime } } \right] \leq \mathbb { E } \left[ \frac { \prod _ { i = 1 } ^ { j - 1 } Z _ { i } ^ { \prime } } { 1 + \sum _ { h = 2 } ^ { j } \prod _ { i = 1 } ^ { h - 1 } Z _ { i } ^ { \prime } } \right] \leq \frac { \prod _ { i = 1 } ^ { j - 1 } \mathbb { E } ( Z _ { i } ^ { \prime } ) } { 1 + \sum _ { h = 2 } ^ { j } \prod _ { i = 1 } ^ { h - 1 } \mathbb { E } ( Z _ { i } ^ { \prime } ) } = \frac { \psi ^ { j - 1 } } { \sum _ { i = 0 } ^ { j - 1 } \psi ^ { i } } ,
427
+ $$
428
+
429
+ where the second inequality is due to the Jensen’s inequality and the fact that for any positive $c _ { 1 } , c _ { 2 }$ , $\frac { x } { c _ { 1 } + c _ { 2 } x }$ is concave with respect to $x$ . Moreover, we also have
430
+
431
+ $$
432
+ [ 1 + ( j - 1 ) ( 1 - \psi ) ] \sum _ { i = 0 } ^ { j - 1 } \psi ^ { i } = j + \sum _ { i = 1 } ^ { j - 1 } \psi ^ { i } - ( j - 1 ) \psi ^ { j } \ge j .
433
+ $$
434
+
435
+ Combining Eq.12 and Eq.13, we prove Eq.11, which concludes the proof.
436
+
437
+ # B TREE-STRUCTURED SAMPLING
438
+
439
+ We may further decrease the sampling complexity by revising Alg. 1 into tree-structured sampling. Alg. 1 originally requires to sample link $M m$ times because we need to search $M$ links that connected to $w _ { 0 }$ in the first step and then sample one link for each of the $M$ nodes in each following step. A tree-structured sampling strategy may reduce this number: Specifically, we sample $k _ { i }$ links for each node in step $i$ but we make sure $\textstyle \prod _ { i = 1 } ^ { m } k _ { i } = M$ , which does not change the total number of walks. In this way, the times of link search decrease to $\textstyle \sum _ { i = 1 } ^ { m } k _ { 1 } k _ { 2 } \ldots k _ { i }$ . Suppose $M = 6 4$ , $m = 3$ , and $k _ { 1 } = 4 , k _ { 2 } = 4 , k _ { 3 } = 4$ , then the times of link search decrease to about $0 . 4 4 M m$ . Though empirical results below show that tree-structured sampling achieves slightly worse performance, it provides an opportunity to tradeoff between prediction performance and time complexity.
440
+
441
+ ![](images/cd5d1123535379ab95d15e0c2679d92067a8f48de186d184852ce7ba1c17a25b.jpg)
442
+ Figure 7: Effect of sampling of different tree structures on inductive performance.
443
+
444
+ We conduct more experiment to investigate this topic with Wikipedia and UCI datasets. The setup is as follows: first, we fix CAW sampling number $\dot { M } = 6 4 = 2 ^ { 6 }$ and length $m = 2$ , so that we always have $k _ { 1 } k _ { 2 } = M = 2 ^ { 6 }$ ; next, we assign different values to $k _ { 1 }$ , so that the shape of the tree changes accordingly; controlling other hyperparameters to be the optimal combination found by grid search, we plot the corresponding inductive AUC scores of CAW-N-mean on all testing edges in Fig. 7. It is observed that while tree-structured sampling may affect the performance to some extent, its negative impact is less prominent when the first-step sampling number $k _ { 1 }$ is relatively large, and our model still achieves state-of-the-art performance compared to our baselines. That makes the tree-structured sampling a reasonable strategy that can further reduce time complexity.
445
+
446
+ # C ADDITIONAL EXPERIMENTAL SETUP DETAILS
447
+
448
+ # C.1 DATASET INTRODUCTION AND ACCESS
449
+
450
+ We list the introduction of the six datasets as follows.
451
+
452
+ • Reddit1 is a dataset of posts made by users on subredditts over a month. Its nodes are users and posts, and its links are the timestamped posting requests. Wikipedia2 is a dataset of edits over wiki pages over a month, whose nodes represent human editors and wiki pages and whose links represent timestamped edits.
453
+ • Social Evolution3 is a dataset recording the detailed evolving physical proximity between students in a dormitory over a year, deterimined from wireless signals of their mobile devices. Enron4 is a communication network whose links are email communication between core employees of a cooperation over several years.
454
+ • $\mathrm { U C I } ^ { 5 }$ is a dataset recording online posts made by university students on a forum, but is non-attributed.
455
+ • $\mathbf { M O O C } ^ { 6 }$ is a dataset of online courses where nodes represent students and course content units such as videos and problem sets, and links represent student’s access behavior to a particular unit.
456
+
457
+ # C.2 BASELINES, IMPLEMENTATION AND TRAINING DETAILS
458
+
459
+ # C.2.1 CAW-N-MEAN AND CAW-N-ATTN
460
+
461
+ We first report the general training hyperparameters of our models in addition to those mentioned in the main text: on all datasets, we train both variants with mini-batch size 32 and set learning rate $=$ $1 . 0 \times 1 0 ^ { - 4 }$ ; the maximum training epoch number is 50 though in practice we observe that with early stopping we usually find the optimal epoch in fewer than 10 epochs; our early stopping strategy is that if the validation performance does not increase for more than 3 epoch then we stop and use the third previous epoch for testing; dropout layers with dropout probability $= 0 . 1$ are added to the RNN module, the MLP modules, and the self-attention pooling layer. Please refer to our code for more details.
462
+
463
+ In terms of the three hyperparameters controlling CAW sampling, we discussed them in Sec 5.3. For all datasets, they are systematically tuned with grid search, whose ranges are reported in Tab.4.
464
+ Table 4: Hyperparameter search range of CAW sampling.
465
+
466
+ <table><tr><td>Dataset</td><td>Sampling number M</td><td>Time decay α</td><td>Walk length m</td></tr><tr><td>Reddit</td><td>32,64,128</td><td>{0.25, 0.5, 1.0,2.0,4.0}×10-5</td><td>1,2,3,4</td></tr><tr><td>Wikipedia</td><td>32,64,128</td><td>{0.25,0.5,1.0,2.0,4.0}×10-6</td><td>2,3,4</td></tr><tr><td>MOOC</td><td>32,64,128</td><td>{0.25,0.5,1.0,2.0,4.0}×10-6</td><td>2,3,4,5</td></tr><tr><td>Social Evo.</td><td>32,64,128</td><td>{0.25,0.5,1.0,2.0,4.0,8.0}x10-6</td><td>1,2,3</td></tr><tr><td>Enron</td><td>32,64,128</td><td>{0.25,0.5,1.0,2.0,4.0}×10-7</td><td>1,2, 3,4</td></tr><tr><td>UCI</td><td>32,64,128</td><td>{0.6,0.8,1.0, 1.2, 1.4}×10-5</td><td>1,2,3</td></tr></table>
467
+
468
+ Apart from the hyperparameters controlling CAW sampling, hidden dimensions of CAW-N mentioned in Sec.4.3, including that of the various encodings, MLPs, RNN, and attention projection matrices, are relatively less tuned. We select them based on two principles: 1) when node & link attributes are available, dimension of all these modules are set to have the same dimensions as baselines; 2) when node & link attributes are unavailable, the dimensions are picked from 32, 64, 128, whichever leads to a better performance.
469
+
470
+ # C.2.2 BASELINES
471
+
472
+ We list the introduction of the six baselines as follows:
473
+
474
+ • DynAERNN (Goyal et al., 2020) uses a fully connected encoder to acquire network representations, passes them into LSTM and uses a fully connected network to decode the future network structures. JODIE (Kumar et al., 2019) applies RNNs to estimate the future embedding of nodes. The model was proposed for bipartite graphs while we properly modify it for standard graphs if the input graphs are non-bipartite. DyRep (Trivedi et al., 2019) also uses RNNs to learn node embedding while its loss function is built upon temporal point process.
475
+ • VGRNN (Hajiramezanali et al., 2019) generalizes the variational GAE (Kipf & Welling (2016)) to temporal graphs, which makes the prior depend on the historical dynamics and captures those dynamics with RNNs. EvolveGCN (Pareja et al., 2020) uses a RNN to estimate the GCN parameters for the future snapshots.
476
+ • TGAT (Xu et al., 2020) leverages GAT to extract node representations where the nodes’ neighbors are sampled from the history and encodes temporal information via Eq.7.
477
+
478
+ We introduce how we tune these baselines as follows.
479
+
480
+ DynAERNN. The model with code provided here is adapted into our evaluation pipeline. We follow most of the settings in the code. We tune the embedding size in {32, 64} and lookback in {2, 3, 5} to report the best performance.
481
+
482
+ JODIE. The model with code provided here is adapted into our evaluation pipeline. JODIE calculates the $L _ { 2 }$ distances between the predicted item embedding to other items and uses the rankings to evaluate their performance. Here, we consider the negative distances as the prediction score. Based on the prediction score, we calculate mAP and AUC. We split the data according to the setting in section 5.1. The model is trained for 50 epoches. The dimensions of the dynamic embedding is searched in{64, 128} and the best performance is reported.
483
+
484
+ DyRep. The model with code provided here is adapted into our evaluation pipeline. We follow most of the settings in the paper. That is, we set the number of samples for survival to 5, gradient clipping to 100. And we tune the hidden unit size and embedding size in {32, 64} to report the best performance. The model uses likelihood based on point process to predict links and therefore we use these likelihood scores to compute AUC and AP.
485
+
486
+ VGRNN. The model with code provided here is adapted into our evaluation pipeline. We use several of its default settings: one-hot node features as input when node attributes are unavailable as suggested by the original paper (Hajiramezanali et al., 2019), one layer of GRU network as the history tracking backbone, a learning rate of 1e-2, and training for 1000 epochs. Its hidden dimension is searched in {32, 64} and the best performance is reported.
487
+
488
+ EvolveGCN. The model with code provided here is adapted into our evaluation pipeline. We utilize EvolveGCN-O version since it can capture more graph structural information. For most hyperparameters, we follow the default values. According to our setting, we sample an equal amount of negative links, which means we set negative_mult_training and negative_mult_test to 1. One central hyperparameter needs to be further tuned is number of previous snapshots used for training and testing. We search its optimal value in {3, 4, 6, 8, 10} when tuning the model for most datasets. Since Enron only contains 11 snapshots, we search its optimal value in {3,4,5,6}.
489
+
490
+ TGAT. The model with code provided here is adapted into our evaluation pipeline. We use several of their default settings. That is, we use product attention, set the number of attention heads to 2, set the number of graph attention layers to 2, and use 100 as their default hidden dimension. One central hyperparameter that needs to be further tuned is the degree of their neighbor sampling. We search its optimal value in {10, 20, 30} when tuning the model.
491
+
492
+ C.3 EVALUATION OF SNAPSHOT-BASED BASELINES
493
+ Table 5: Snapshot split for evaluating snapshot-based baselines.
494
+
495
+ <table><tr><td></td><td>Reddit</td><td>Wikipedia</td><td>MOOC</td><td>Social Evo.</td><td>Enron</td><td>UCI</td></tr><tr><td>total snapshots</td><td>174</td><td>20</td><td>20</td><td>27</td><td>11</td><td>88</td></tr><tr><td>exact split</td><td>122 /26 /26</td><td>14/3/3</td><td>14/3/3</td><td>19/4/4</td><td>7/2/2</td><td>62/13/13</td></tr><tr><td>referenced baseline</td><td>EvolveGCN</td><td>-</td><td>-</td><td>VGRNN</td><td>VGRNN</td><td>EvolveGCN</td></tr></table>
496
+
497
+ We make the following decisions to evaluate snapshot-based baselines in a fair manner, so that their performances are comparable to those derived from the stream-based evaluation procedure. The first step we do is to evenly split the whole dataset chronologically into a number of snapshots. We determine the exact number of snapshots by referring the three snapshot-based baselines we use. For Wikipedia and MOOC dataset which are not used by any snapshot-based baseline, we split them into a total of 20 snapshots. Next, we need to determine the proportions of these snapshots assigned each to training, validation, and testing set. In doing this, our principle is that the proportions of these three sets should be close to 70:15:15 as much as possible, since that ratio is what we use for evaluating stream-based baselines and our proposed method. These decisions lead to our final splitting scheme summarized in Tab. 5.
498
+
499
+ Extra care should also be taken when testing snapshot-based methods. For a queried link in a snapshot, usually snapshot-based methods only make a binary prediction whether or not that link may exist at any time in that snapshot. They do not, however, take care of the case that the link may appear multiple times at different time points within that snapshot’s time range. This lead to a different evaluation scheme than stream-based methods, which do consider the multiplicity of links. Therefore, when testing snapshot-based methods, if a link appear in a certain snapshot for multiple times, we record the model’s prediction the same number of times before computing its performance metrics.
500
+
501
+ # C.4 CHOICE OF EVALUATION METRIC
502
+
503
+ When considering link prediction as a binary classification problem, the existing literature usually choose metrics from the following: Area Under the ROC Curve (AUC), Average Precision (AP), and Accuracy (ACC). The reason we do not use ACC is that a proper confidence threshold of decision is ill-defined in literature, which leads to unfair comparison across different works.
504
+
505
+ # C.5 COMPUTING INFRASTRUCTURE
506
+
507
+ All the experiments were carried out on a Ubuntu 16.04 server with Xeon Gold 6148 2.4 GHz 40-core CPU, Nvidia 2080 Ti RTX 11GB GPU, and 768 GB memory.
508
+
509
+ # D ADDITIONAL EXPERIMENTAL RESULTS
510
+
511
+ # D.1 PERFORMANCE IN AVERAGE PRECISION
512
+
513
+ <table><tr><td>Task</td><td>Methods</td><td>Reddit</td><td>Wikipedia</td><td>MOOC</td><td>Social Evo.</td><td>Enron</td><td>UCI</td></tr><tr><td rowspan="7">Trngeeier</td><td>DynAERNN JODIE maas mna</td><td>58.63 ±5.42 80.03 ± 0.13</td><td>54.94±2.29 76.90 ± 0.49</td><td>59.84±1.26 82.27 ± 0.46†</td><td>54.76±1.33 87.96 ± 0.12†</td><td>54.89±3.79 79.80 ± 1.48†</td><td>51.59 ± 3.92 71.64 ± 0.62</td></tr><tr><td>DyRep VGRNN</td><td>61.28 ± 1.89</td><td>57.57 ± 2.56</td><td>62.29 ± 2.09</td><td>75.42 ± 0.32</td><td>69.97 ± 0.92</td><td>63.08 ± 7.40</td></tr><tr><td></td><td>60.64 ± 0.68</td><td>52.55 ± 0.82</td><td>65.44 ± 0.82</td><td>67.83 ± 0.53</td><td>67.93 ± 0.88</td><td>67.50 ± 0.92</td></tr><tr><td>EvolveGCN</td><td>62.99 ± 0.17</td><td>55.64 ±1.03</td><td>52.28 ±1.80</td><td>52.26 ± 1.16</td><td>47.36 ± 1.24</td><td>80.98 ± 1.09†</td></tr><tr><td>TGAT</td><td>95.17 ± 0.91†</td><td>93.18 ± 0.73†</td><td>72.91 ± 0.92</td><td>52.17± 1.94</td><td>63.83 ± 3.70</td><td>75.27 ± 2.34</td></tr><tr><td>CAW-N-mean</td><td>98.05 ± 0.87*</td><td>96.01±0.25*</td><td>90.36 ±0.80*</td><td>92.16 ± 1.03*</td><td>93.93 ± 0.66*</td><td>99.63 ± 0.34*</td></tr><tr><td>CAW-N-attn DynAERNN</td><td>98.08 ±0.66*</td><td>97.86 ±0.63*</td><td>90.35 ±0.81*</td><td>93.29 ±1.90*</td><td>92.73±0.76*</td><td>100.00 ±0.00*</td></tr><tr><td rowspan="8">PO ‘S&#x27;A Mou</td><td></td><td>66.59 ± 2.90</td><td>63.76±2.82</td><td>82.02 ±1.59</td><td>52.54±0.22</td><td>55.50± 2.07</td><td>57.29±2.52</td></tr><tr><td>JODIE</td><td>83.15 ± 0.03</td><td>80.54 ± 0.06</td><td>87.95 ± 0.08</td><td>91.40 ± 0.04†</td><td>89.57± 0.30</td><td>76.34 ± 0.17</td></tr><tr><td>DyRep</td><td>66.73 ± 1.99</td><td>76.89 ± 0.31</td><td>88.25 ± 1.20†</td><td>89.41 ± 0.29</td><td>95.97 ± 0.28†</td><td>93.60 ± 1.47†</td></tr><tr><td>VGRNN</td><td>52.84 ±0.66</td><td>60.99 ± 0.55</td><td>62.95 ± 0.58</td><td>69.20 ± 0.52</td><td>67.93 ± 0.88</td><td>67.50 ± 0.92</td></tr><tr><td>EvolveGCN</td><td>66.29 ± 0.52</td><td>53.82 ± 1.64</td><td>51.53 ± 0.92</td><td>52.01 ± 0.67</td><td>46.56 ± 1.89</td><td>76.30 ± 0.33</td></tr><tr><td>TGAT</td><td>97.09 ± 0.18†</td><td>95.17 ± 0.15†</td><td>71.77 ± 0.23</td><td>52.48 ± 0.52</td><td>59.70 ± 1.49</td><td></td></tr><tr><td>CAW-N-mean</td><td>98.89 ±0.04*</td><td>99.04 ± 0.04*</td><td>90.99 ± 0.96*</td><td>93.71± 0.75*</td><td>92.93 ± 0.94</td><td>75.01 ± 0.72 98.86 ± 0.95*</td></tr><tr><td>CAW-N-attn</td><td>99.90 ± 0.05*</td><td>99.55 ± 0.30*</td><td>91.24 ± 0.93*</td><td>94.17 ± 0.86*</td><td>92.38 ± 1.36</td><td>98.53±0.64*</td></tr><tr><td rowspan="11">Trlrrseeera</td><td>DynAERNN</td><td>85.58 ± 2.12</td><td>76.58 ± 1.41</td><td>89.29± 0.49</td><td>66.58 ± 1.84</td><td>60.90±2.70</td><td>84.95± 2.13</td></tr><tr><td>JODIE</td><td>91.14 ± 0.01</td><td>91.39 ± 0.04</td><td>91.19 ± 0.03†</td><td>89.22 ± 0.01</td><td>91.94 ± 0.01</td><td>80.27 ± 0.08</td></tr><tr><td>DyRep</td><td>67.54 ± 2.02</td><td>77.36 ± 0.25</td><td>90.49 ± 0.03</td><td>94.48 ± 0.01†</td><td>97.14 ± 0.07†</td><td></td></tr><tr><td>VGRNN</td><td>50.87 ± 0.81</td><td>67.66 ± 0.89</td><td>83.70 ± 0.56</td><td>78.66 ± 0.67</td><td>94.02 ± 0.52</td><td>95.29 ± 0.13†</td></tr><tr><td>EvolveGCN</td><td>54.49 ± 0.73</td><td>55.84 ± 0.37</td><td>51.80 ± 0.46</td><td>56.90 ± 0.54</td><td>69.72 ± 0.49</td><td>82.23 ± 0.56</td></tr><tr><td>TGAT</td><td>98.38 ± 0.01†</td><td>96.65 ± 0.06†</td><td>69.75 ± 0.23</td><td>57.37 ± 1.18</td><td>57.37 ± 0.18</td><td>81.63 ± 0.23</td></tr><tr><td>CAW-N-mean</td><td>99.96 ± 0.01*</td><td>99.91±0.03*</td><td>92.05 ± 0.88</td><td>95.90 ± 0.09*</td><td></td><td>60.25 ± 0.31</td></tr><tr><td>CAW-N-attn</td><td>99.99 ± 0.01*</td><td></td><td>92.23±0.76*</td><td></td><td>94.93 ± 0.39</td><td>95.89 ± 0.87</td></tr><tr><td></td><td></td><td>99.89±0.03*</td><td></td><td>96.37 ± 0.09*</td><td>96.13 ± 0.37</td><td>98.86±0.38*</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
514
+
515
+ Table 6: Performance in Average Precision (AP) (mean in percentage $\pm 9 5 \%$ confidence level.) $\dagger$ highlights the best baselines. ∗, bold font, bold font∗ respectively highlights the case where our models’ performance exceeds the best baseline on average, by $7 0 \%$ confidence, by $9 5 \%$ confidence.
516
+
517
+ # D.2 MORE DISCUSSION ON STREAM-BASED VS. SNAPSHOT-BASED METHODS
518
+
519
+ Stream-based methods usually treat each temporal link as an individual training instance. In contrast, snapshot-based methods stack all the temporal links within a time slice into one static graph snapshot and do not further distinguish temporal order of links within that snapshot. In Tab. 2 and 6 we saw that stream-based methods generally exhibit better performance than snapshot-based methods. An important reason is that stream-based methods are able to access the few most recent interactions previous to the target link to predict. This makes them especially advantageous when used to model many common temporal networks whose dynamics are governed by some short-term laws. In contrast, snapshot-based methods are less able to access such immediate history, because they make prediction on all links within one future snapshot all at once. In principle they could alleviate this problem by making very fine-grained snapshots so that less immediate history is missed. However, this is not practical with real-word large temporal graphs whose temporal links come in millions, which leads to snapshot sequences of extreme length intractable to their recurrent neural structure. This issue was also observed by the recent work to model social interacting behaviors (Wang et al., 2020), although temporal convolutional networks may alleviate this issue to some extent. That said, snapshot-based methods usually has the advantage that they usually consume less memory and computation time. Stream-based methods on the other hand need to manage how they sample history very carefully to balance the efficiency and effectiveness. Our proposed algorithm on CAW sampling comes into the place in light of this to solve the problem.
520
+
521
+ ![](images/e3d29759c34f7a2389e6c5903fe4ace1e3257b5998f42cc15a5fc1b8e5c3477e.jpg)
522
+ Figure 8: Visualizing most discriminatory CAWs, and their occurrence ratios with positive / negative samples.
523
+
524
+ # E VISUALIZING CAWS AND AWS
525
+
526
+ Here, we introduce one way to visualize and interpret CAWs. Our interpretation can also illustrate the importance to capture the correlation between walks to represent the dynamics of temporal networks, where the set-based anonymization of CAWs can work while AWs will fail. The basic idea of our intrepretation is to identify different shapes of CAWs via their patterns encoded in $I _ { C A W }$ , and compare their contributions to the link-prediction confidence. The idea will be also used to interpret AWs so that we can compare CAWs with AWs.
527
+
528
+ First, we define the shapes of walks based on $I _ { C A W }$ . Recall from Eq. 3 that $g ( w , S _ { u } )$ encodes the number of times node $w$ that appears in different walk positions w.r.t source node $u$ . This encoding induces a temporal shortest-path distance $d _ { u w }$ between node $w$ and $u$ : $d _ { u w } \triangleq \operatorname* { m i n } \{ i | g ( w , S _ { u } ) [ i ] >$ $0 \}$ . Note that in temporal networks, there is not a canonical way to define shortest-path distance between two nodes as there is no static structures. So our definition $d _ { u w }$ can be viewed the shortestpath distance between u and w over the subgraph that consists of walks in $S _ { u }$ . Based on the way to define $( d _ { u w } , d _ { v w } )$ , we introduce the mapping from $I _ { C A W }$ of the node $w$ to a coordinate of this node in the subgraph that consists of walks in $S _ { u } \cap S _ { v }$ : $g ( w , S _ { u } ) , g ( w , S _ { v } ) ) \to \mathrm { c o o r } ( w ; u , v ) = ( d _ { u w } , d _ { v u }$ ). This cooredinate can be viewed as a relative coordinate of node $w$ w.r.t. the source nodes $u$ , $v$ . Each walk $W \in S _ { u } \cup S _ { v }$ can then represented as a sequence of such coordinates by mapping each node’s $I _ { C A W }$ to a coordinate. The obtained sequence can be viewed as a shape of $W$ and we denote the obtained shape as $s _ { C A W } ( W )$ . For instance, in the toy example shown by Fig. 2 right, the first CAW in $S _ { u }$ , $u b a c$ is mapped to a new coordinate sequence $( 0 , 2 ) \overset { \cdot } { } ( \bar { 1 } , 2 ) \overset { - } { } ( 2 , \infty ) ( 3 , \infty )$ . The $\infty$ marks the setting that node $a , c$ do not appear in $S _ { v }$ .
529
+
530
+ Next, we score the contributions of CAWs with different shapes. We use CAW-N-Mean as enc $( S _ { u } \cup S _ { v } )$ is simply mean over the encodings of sampled CAWs and further use linear projection $\beta ^ { T } \mathrm { e n c } ( S _ { u } \cup S _ { v } )$ to compute the final scalar logit for prediction. As the two operations mean and projection are commutative, the above setting allows each CAW $\hat { W _ { i } }$ contributing a scalar score $l o g i t ( \hat { W } _ { i } ) = \beta ^ { T } \mathrm { e n c } ( \hat { W } _ { i } )$ to the final logit.
531
+
532
+ Fig. 8 lists the 3 highest-scored and 3 lowest-scored shapes of CAW, which are extracted from the Wikipedia dataset with $M = 3 2$ and $m = 3$ . A law of general motif closure can be observed from the highest-scored CAWs: two nodes that commonly appear in some types of motif are more inclined to have a link in between. For example, the highest-scored shape of CAW, $( 0 , \infty ) ( 1 , 2 ) ( 2 , 3 ) $ $( 1 , 2 )$ , implies that the nodes except the first in this CAW appear in the sampled common 3-hop neighborhood around the two nodes between which the link is to be predicted. Therefore, CAW-N essentially adaptively samples a temporal motif closure pattern that is very informative to predict this link. CAW-N does not explicitly enumerating or counting these motif patterns. In contrast, when CAWs do not bridge the two nodes, as shown in top-2 lowest-scored CAWs, very unlikely there will exist a link. Fig. 8 also displays each of the 6 CAW’s occurrence ratio with positive and negative links. The difference within each pair of ratios is an indicator of the corresponding CAW’s discriminatory power. We also see that the discriminatory power of CAWs is very strong: highest-scored CAWs almost never occur with negative links, and lowest-scored CAWs also seldom occur with positive links.
533
+
534
+ ![](images/af8de1ab6b3f16fbe94a970a87c2cb8b1159fd24bdc8c1ca711ffa7c020a3c6c.jpg)
535
+ Figure 9: Visualizing all AWs, and their occurrence ratios with positive / negative samples.
536
+
537
+ We further apply the similar procedure to analyze the AWs introduced in Sec. 4.1 and the model Ab.5 of Tab. 3 used for ablation study. Note that AW cannot establish the correlation between walks, each single AW itself, say $W = ( v _ { 0 } , v _ { 1 } , . . . , v _ { m } )$ , decides its own shape $s _ { A W } ( W )$ . We directly set $s _ { A W } ( W ) = I _ { A W } ( v _ { 0 } ; W ) \to I _ { A W } ( v _ { 2 } ; W ) \to \cdots \to I _ { A W } ( v _ { m } ; W )$ with $I _ { A W } ( w ; W )$ defined in Eq. 2. As the Wikipedia dataset is a bipartite graph, there are in total four different shapes when $m = 3$ as listed align with the $\mathbf { X }$ -axis of Fig. 9. For illustration, we explain one shape of AW as an example, say $0 1 2 1$ : The corresponding walks have the second and the fourth nodes correspond to the same node, which the first, second and third nodes are different. As shown in Fig. 9, we can see that AW’s occurrence with positive versus negative links are highly mixed-up, compared to CAW’s. That suggests that AWs possess significantly less discriminatory power than CAWs. The main reason is that AWs do not have set-based anonymization, so they cannot capture the correlation between walks/motifs but CAWs can do that. This observation further gives a reason on why the model Ab.5 of Tab. 3 only achieves some performance on-par with the model Ab.2 where we totally remove the anonymization procedure: the anonymization adopted by AWs loses too much information of the structure and cannot benefit the prediction much. However, the original CAW-N well captures such information via the set-based anonymization.
md/train/MJIve1zgR_/MJIve1zgR_.md ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNBIASED TEACHER FOR SEMI-SUPERVISED OBJECT DETECTION
2
+
3
+ Yen-Cheng ${ \bf L i u ^ { 1 , 2 } }$ ∗, Chih-Yao $\mathbf { M } \mathbf { a } ^ { 2 }$ , Zijian $\mathbf { H e } ^ { 2 }$ , Chia-Wen ${ \bf K u o } ^ { 1 }$ , Kan Chen2, Peizhao Zhang2, Bichen $\mathbf { W } \mathbf { u } ^ { 2 }$ , Zsolt ${ \bf K i r a } ^ { 1 }$ , Peter Vajda2
4
+
5
+ 1Georgia Tech, 2Facebook Inc. {ycliu,cwkuo,zkira}@gatech.edu, {cyma,zijian,kanchen18,stzpz,wbc,vajdap}@fb.com
6
+
7
+ # ABSTRACT
8
+
9
+ Semi-supervised learning, i.e., training networks with both labeled and unlabeled data, has made significant progress recently. However, existing works have primarily focused on image classification tasks and neglected object detection which requires more annotation effort. In this work, we revisit the Semi-Supervised Object Detection (SS-OD) and identify the pseudo-labeling bias issue in SSOD. To address this, we introduce Unbiased Teacher1, a simple yet effective approach that jointly trains a student and a gradually progressing teacher in a mutually-beneficial manner. Together with a class-balance loss to downweight overly confident pseudo-labels, Unbiased Teacher consistently improved state-ofthe-art methods by significant margins on COCO-standard, COCO-additional, and $V O C$ datasets. Specifically, Unbiased Teacher achieves 6.8 absolute mAP improvements against state-of-the-art method when using $1 \%$ of labeled data on MS-COCO, achieves around $1 0 \mathrm { m A P }$ improvements against the supervised baseline when using only $0 . 5 , 1 , 2 \%$ of labeled data on MS-COCO.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The availability of large-scale datasets and computational resources has allowed deep neural networks to achieve strong performance on a wide variety of tasks. However, training these networks requires a large number of labeled examples that are expensive to annotate and acquire. As an alternative, Semi-Supervised Learning (SSL) methods have received growing attention (Sohn et al., 2020a; Berthelot et al., 2020; 2019; Laine & Aila, 2017; Tarvainen & Valpola, 2017; Sajjadi et al., 2016; Lee, 2013; Grandvalet & Bengio, 2005). Yet, these advances have primarily focused on image classification, rather than object detection where bounding box annotations require more effort.
14
+
15
+ In this work, we revisit object detection under the SSL setting (Figure 1): an object detector is trained with a single dataset where only a small amount of labeled bounding boxes and a large amount of unlabeled data are provided, or an object detector is jointly trained with a large labeled dataset as well as a large external unlabeled dataset. A straightforward way to address Semi-Supervised Object Detection (SS-OD) is to adapt from existing advanced semi-supervised image classification methods (Sohn et al., 2020a). Unfortunately, object detection has some unique characteristics that interact poorly with such methods. For example, the nature of class-imbalance in object detection tasks impedes the usage of pseudo-labeling. In object detection, there exists foreground-background imbalance and foreground classes imbalance (see Section 3.3). These imbalances make models trained in SSL settings prone to generate biased predictions. Pseudo-labeling methods, one of the most successful SSL methods in image classification (Lee, 2013; Sohn et al., 2020a), may thus be biased towards dominant and overly confident classes (background) while ignoring minor and less confident classes (foreground). As a result, adding biased pseudo-labels into the semi-supervised training aggravates the class-imbalance issue and introduces severe overfitting. As shown in Figure 2, taking a two-stage object detector as an example, there exists heavy overfitting on the fore
16
+
17
+ ![](images/3a4afc16fb87e7ab4911d64720067079773c86fa7d2001ddeb2589e799611b56.jpg)
18
+ Figure 1: (a) Illustration of semi-supervised object detection, where the model observes a set of labeled data and a set of unlabeled data in the training stage. (b) Our proposed model can efficiently leverage the unlabeled data and perform favorably against the existing semi-supervised object detection works, including CSD (Jeong et al., 2019) and STAC (Sohn et al., 2020b).
19
+
20
+ # ground/background classification in the RPN and multi-class classification in the ROIhead (but not on bounding box regression).
21
+
22
+ To overcome these issues, we propose a general framework – Unbiased Teacher: an approach that jointly trains a Student and a slowly progressing Teacher in a mutually-beneficial manner, in which the Teacher generates pseudo-labels to train the Student, and the Student gradually updates the Teacher via Exponential Moving Average (EMA)2, while the Teacher and Student are given different augmented input images (see Figure 3). Inside this framework, (i) we utilize the pseudo-labels as explicit supervision for both RPN and ROIhead and thus alleviate the overfitting issues in both RPN and ROIhead. (ii) We also prevent detrimental effects due to noisy pseudo-labels by exploiting the Teacher-Student dual models (see further discussion and analysis in Section 4.2). (iii) With the use of EMA training and the Focal loss (Lin et al., 2017b), we can address the pseudo-labeling bias problem caused by class-imbalance and thus improve the quality of pseudo-labels. As the result, our object detector achieves significant performance improvements.
23
+
24
+ We benchmark Unbiased Teacher with SSL setting using the MS-COCO and PASCAL VOC datasets, namely COCO-standard, COCO-additional, and VOC. When using only $1 \%$ labeled data from MS-COCO (COCO-standard), Unbiased Teacher achieves 6.8 absolute mAP improvement against the state-of-the-art method, STAC (Sohn et al., 2020b). Unbiased Teacher consistently achieves around 10 absolute mAP improvements when using only $0 . 5 , 1 , 2 , 5 \%$ of labeled data compared to supervised baseline.
25
+
26
+ We highlight the contributions of this paper as follows:
27
+
28
+ • By analyzing object detectors trained with limited-supervision, we identify that the nature of class-imbalance in object detection tasks impedes the effectiveness of pseudo-labeling method on SS-OD task.
29
+ • We thus proposed a simple yet effective method, Unbiased Teacher, to address the pseudolabeling bias issue caused by class-imbalance existing in ground-truth labels and the overfitting issue caused by the scarcity of labeled data.
30
+ • Our Unbiased Teacher achieves state-of-the-art performance on SS-OD across COCOstandard, COCO-additional, and VOC datasets. We also provide an ablation study to verify the effectiveness of each proposed component.
31
+
32
+ # 2 RELATED WORKS
33
+
34
+ Semi-Supervised Learning. The majority of the recent SSL methods typically consist of (1) input augmentations and perturbations, and (2) consistency regularization. They regularize the model to be invariant and robust to certain augmentations on the input, which requires the outputs given the original and augmented inputs to be consistent. For example, existing approaches apply convention data augmentations (Berthelot et al., 2019; Laine & Aila, 2017; Sajjadi et al., 2016; Tarvainen &
35
+
36
+ ![](images/e1d662fcdba0482b7dbffc1b58afdd60f65be1a18a88c6c93f878f6025574475.jpg)
37
+ Figure 2: Validation Losses of our model and the model trained with labeled data only. When the labeled data is insufficient ( $1 \%$ and $5 \%$ ), RPN and ROIhead classifiers suffer from overfitting, while RPN and ROIhead regression do not suffer from overfitting. Our model can significantly alleviates the overfitting issue in classifiers and also improves the validation box regression loss.
38
+
39
+ Valpola, 2017) to generate different transformations of the semantically identical images, perturb the input images along the adversarial direction (Miyato et al., 2018; Yu et al., 2019), utilize multiple networks to generate various views of the same input data (Qiao et al., 2018), mix input data to generate augmented training data and labels (Zhang et al., 2018; Yun et al., 2019; Guo et al., 2019; Hendrycks et al., 2020), or learn augmented prototypes in feature space instead of the image space (Kuo et al., 2020). However, the complexities in architecture design of object detectors hinder the transfer of existing semi-supervised techniques from image classification to object detection.
40
+
41
+ Semi-Supervised Object Detection. Object detection is one of the most important computer vision tasks and has gained enormous attention (Lin et al., 2017a; He et al., 2017; Redmon & Farhadi, 2017; Liu et al., 2016). While existing works have made significant progress over the years, they have primarily focused on training object detectors with fully-labeled datasets. On the other hand, there exist several semi-supervised object detection works that focus on training object detector with a combination of labeled, weakly-labeled, or unlabeled data. This line of work began even before the resurgence of deep learning (Rosenberg et al., 2005). Later, along with the success of deep learning, Hoffman et al. (2014) and Gao et al. (2019) trained object detectors on data with bounding box labels for some classes and image-level class labels for other classes, enabling detection for categories that lack bounding box annotations. Tang et al. (2016) adapted the image-level classifier of a weakly labeled category (no bounding boxes) into a detector via similarity-based knowledge transfer. Misra et al. (2015) exploited a few sparsely labeled objects and bounding boxes in some video frames and localized unknown objects in the following videos.
42
+
43
+ Unlike their settings, we follow the standard SSL setting and adapt it to the object detection task, in which the training contains a small set of labeled data and another set of completely unlabeled data (i.e., only images). In this setting, Jeong et al. (2019) proposed a consistency-based method, which enforces the predictions of an input image and its flipped version to be consistent. Sohn et al. (2020b) pre-trained a detector using a small amount labeled data and generates pseudo-labels on unlabeled data to fine-tune the pre-trained detector. Their pseudo-labels are generated only once and are fixed through out the rest of training. While they can improve the performance against the model trained on labeled data, imbalance issue is not considered in existing SS-OD works. In contrast, our method not only improve the pseudo-label generation model via teacher-student mutual learning regimen (Sec. 3.2) but address the crucial imbalance issue in generated pseudo-labels (Sec. 3.3).
44
+
45
+ # 3 UNBIASED TEACHER
46
+
47
+ Problem definitiof labeled images $D _ { s } = \{ \mathbf { \bar { x } } _ { i } ^ { s } , \pmb { y } _ { i } ^ { s } \} _ { i = 1 } ^ { N _ { s } }$ dress object detection in a sem and a set of unlabeled images $\bar { D _ { u } } \bar { = } \{ \pmb { x } _ { i } ^ { u } \} _ { i = 1 } ^ { N _ { u } }$ tting, where a setare available for training. and $N _ { u }$ are the number of supervised and unsupervised data. For each labeled image $\pmb { x } ^ { s }$ , the annotations $\boldsymbol { y } ^ { s }$ contain locations, sizes, and object categories of all bounding boxes.
48
+
49
+ Overview. As shown in Figure 3, our Unbiased Teacher consists of two training stages, the BurnIn stage and the Teacher-Student Mutual Learning stage. In the Burn-In stage (Sec. 3.1), we simply train the object detector using the available supervised data to initialize the detector. At the beginning of the Teacher-Student Mutual Learning stage (Sec. 3.2), we duplicate the initialized detector into two models (Teacher and Student models). Our Teacher-Student Mutual Learning stage aims at evolving both Teacher and Student models via a mutual learning mechanism, where the Teacher generates pseudo-labels to train the Student, and the Student updates the knowledge it learned back to the Teacher; hence, the pseudo-labels used to train the Student itself are improved. Lastly, there exists class-imbalance and foreground-background imbalance problems in object detection, which impedes the effectiveness of semi-supervised techniques of image classification (e.g., pseudo-labeling) being used directly on SS-OD. Therefore, in Sec. 3.3, we also discuss how Focal loss (Lin et al., 2017b) and EMA training alleviate the imbalanced pseudo-label issue.
50
+
51
+ ![](images/b89dd1e2de99c64f3afd899e071ee73e67ed8a0064fecfe4297e088566767240.jpg)
52
+ Figure 3: Overview of Unbiased Teacher. Unbiased Teacher consists of two stages. Burn-In: we first train the object detector using available labeled data. Teacher-Student Mutual Learning consists of two steps. Student Learning: the fixed teacher generates pseudo-labels to train the Student, while Teacher and Student are given weakly and strongly augmented inputs, respectively. Teacher Refinement: the knowledge that the Student learned is then transferred to the slowly progressing Teacher via exponential moving average (EMA) on network weights. When the detector is trained until converge in the Burn-In stage, we switch to the Teacher-Student Mutual Learning stage.
53
+
54
+ # 3.1 BURN-IN
55
+
56
+ It is important to have a good initialization for both Student and Teacher models, as we will rely on the Teacher to generate pseudo-labels to train the Student in the later stage. To do so, we first use the available supervised data to optimize our model $\theta$ with the supervised loss $\mathcal { L } _ { s u p }$ . With the supervised data $D _ { s } = \{ \pmb { x } _ { i } ^ { s } , \pmb { y } _ { i } ^ { s } \} _ { i = 1 } ^ { N _ { s } }$ , the supervised loss of object detection consists of four losses: ithe RPN classification loss $\mathcal { L } _ { c l s } ^ { r p n }$ =1, the RPN regression loss $\mathcal { L } _ { r e g } ^ { r p n }$ , the ROI classification loss $\mathcal { L } _ { c l s } ^ { r o i }$ and the ROI regression loss $\mathcal { L } _ { r e g } ^ { r o i }$ (Ren et al., 2015),
57
+
58
+ $$
59
+ \mathcal { L } _ { s u p } = \sum _ { i } \mathcal { L } _ { c l s } ^ { r p n } ( \boldsymbol { x } _ { i } ^ { s } , \boldsymbol { y } _ { i } ^ { s } ) + \mathcal { L } _ { r e g } ^ { r p n } ( \boldsymbol { x } _ { i } ^ { s } , \boldsymbol { y } _ { i } ^ { s } ) + \mathcal { L } _ { c l s } ^ { r o i } ( \boldsymbol { x } _ { i } ^ { s } , \boldsymbol { y } _ { i } ^ { s } ) + \mathcal { L } _ { r e g } ^ { r o i } ( \boldsymbol { x } _ { i } ^ { s } , \boldsymbol { y } _ { i } ^ { s } ) .
60
+ $$
61
+
62
+ After Burn-In, we duplicate the trained weights $\theta$ for both the Teacher and the Student models $( \theta _ { t } \gets \theta , \theta _ { s } \gets \theta )$ . Starting from this trained detector, we further utilize the unsupervised data to improve the object detector via the following proposed training regimen.
63
+
64
+ # 3.2 TEACHER-STUDENT MUTUAL LEARNING
65
+
66
+ Overview. To leverage the unsupervised data, we introduce the Teacher-Student Mutual Learning regimen, where the Student is optimized by using the pseudo-labels generated from the Teacher, and the Teacher is updated by gradually transferring the weights of continually learned Student model. With the interaction between the Teacher and the Student, both models can evolve jointly and continuously to improve detection accuracy. With the improvement on detection accuracy, this also means that the Teacher generates more accurate and stable pseudo-labels, which we identify as one of the keys for large performance improvement compared to existing work (Sohn et al., 2020b). In another perspective, we can also regard the Teacher as the temporal ensemble of the Student models in different time steps. This aligns our observation that the accuracy of the Teacher is consistently higher than the Student. As noted in prior works (Tarvainen & Valpola, 2017; Xie et al., 2020), one crucial factor in improving the Teacher model is the diversity of Student models; we thus use the strongly augmented images as as input of the Student, but we use the weakly augmented images as input of the Teacher to provide reliable pseudo-labels.
67
+
68
+ Student Learning with Pseudo-Labeling. To address the lack of ground-truth labels for unsupervised data, we adapt the pseudo-labeling method to generate labels for training the Student with unsupervised data. This follows the principle of existing successful examples in semi-supervised image classification task (Lee, 2013; Sohn et al., 2020a). Similar to classification-based methods, to prevent the consecutively detrimental effect of noisy pseudo-labels (i.e., confirmation bias or error accumulation), we first set a confidence threshold $\delta$ of predicted bounding boxes to filter lowconfidence predicted bounding boxes, which are more likely to be false positive samples.
69
+
70
+ While the confidence threshold method have achieved tremendous success in the image classification, it is however not sufficient for object detection. This is because there also exist duplicated box predictions and imbalanced prediction issues in the SS-OD (we leave the discussion of the imbalanced prediction issue in Sec. 3.3). To address the duplicated boxes prediction issue, we remove the repetitive predictions by applying class-wise non-maximum suppression (NMS) before the use of confidence thresholding as performed in STAC (Sohn et al., 2020b).
71
+
72
+ In addition, noisy pseudo-labels can affect the pseudo-label generation model (Teacher). As a result, we detach the Student and the Teacher. To be more specific, after obtaining the pseudo-labels from the Teacher, only the learnable weights of the Student model is updated via back-propagation.
73
+
74
+ $$
75
+ \theta _ { s } \xleftarrow \theta _ { s } + \gamma \frac { \partial ( \mathcal { L } _ { s u p } + \lambda _ { u } \mathcal { L } _ { u n s u p } ) } { \partial \theta _ { s } } , \quad \mathcal { L } _ { u n s u p } = \sum _ { i } \mathcal { L } _ { c l s } ^ { r p n } ( \pmb { x } _ { i } ^ { u } , \hat { \pmb { y } } _ { i } ^ { u } ) + \mathcal { L } _ { c l s } ^ { r o i } ( \pmb { x } _ { i } ^ { u } , \hat { \pmb { y } } _ { i } ^ { u } )
76
+ $$
77
+
78
+ Note that we do not apply unsupervised losses for the bounding box regression since the naive confidence thresholding is not able to filter the pseudo-labels that are potentially incorrect for bounding box regression (because the confidence of predicted bounding boxes only indicate the confidence of predicted object categories instead of the quality of bounding box locations (Jiang et al., 2018)).
79
+
80
+ Teacher Refinement via Exponential Moving Average. To obtain more stable pseudo-labels, we apply EMA to gradually update the Teacher model. The slowly progressing Teacher model can be regarded as the ensemble of the Student models in different training iterations.
81
+
82
+ $$
83
+ \theta _ { t } \alpha \theta _ { t } + ( 1 - \alpha ) \theta _ { s } .
84
+ $$
85
+
86
+ This approach has been shown to be effective in many existing works, e.g., ADAM optimization (Kingma & Ba, 2015), Batch Normalization (Ioffe & Szegedy, 2015), self-supervised learning (He et al., 2020; Grill et al., 2020), and SSL image classification (Tarvainen & Valpola, 2017), while we, for the first time, demonstrate its effectiveness also in alleviating pseudo-labeling bias issue for SS-OD (see next section).
87
+
88
+ # 3.3 BIAS IN PSEUDO-LABEL
89
+
90
+ Ideally, the methods based on pseudo-labels can address problems caused by the scarcity of labels, yet the inherent nature of imbalance in object detection tasks/datasets impedes the effectiveness of pseudo-labeling methods. As mentioned in (Oksuz et al., 2020), in object detection, there exists foreground-background imbalance (e.g., background instances accounts for $70 \%$ of all training instances) and foreground classes imbalance (e.g., human instances accounts for $30 \%$ of all foreground training instances in MS-COCO (Lin et al., 2014)). If standard cross-entropy is applied in the condition of insufficient training data, the model is likely prone to predict the dominant classes. This makes the prediction bias toward prevailing classes and leads to the class-imbalance issue in generated pseudo-labels. Relying on the biased pseudo-labels during training makes the imbalanced prediction issue even more severe. To address the imbalance issue in object detection, existing works have proposed several methods (Shrivastava et al., 2016; Lin et al., 2017b; Li et al., 2020).
91
+
92
+ In this work, we consider a simple yet effective method; we replace the standard cross-entropy with the multi-class Focal loss (Lin et al., 2017b) for the multi-class classification of ROIhead classifier (i.e., $\mathcal { L } _ { c l s . } ^ { r o i }$ ). Focal loss is designed to put more loss weights on the samples with lower-confidence instances. As a result, it makes the model focus on hard samples, instead of the easier examples that are likely from dominant classes. Although the Focal loss is not widely used for vanilla supervised object detection settings (the accuracy of YOLOv3 (Redmon & Farhadi, 2018) even drops if the focal loss is applied), we argue that it is crucial for SS-OD due to the issue of biased pseudo-labels.
93
+
94
+ Table 1: Experimental results on COCO-standard comparing with CSD (Jeong et al., 2019) and STAC (Sohn et al., 2020b). \*: we implement the CSD method and adapt it on the MS-COCO dataset. The results of $0 . 5 \%$ with STAC is from their released code.
95
+
96
+ <table><tr><td rowspan="2"></td><td colspan="5">COCO-standard</td></tr><tr><td>0.5%</td><td>1%</td><td>2%</td><td>5%</td><td>10%</td></tr><tr><td>Supervised</td><td>6.83 ± 0.15</td><td>9.05 ± 0.16</td><td>12.70 ± 0.15</td><td>18.47± 0.22</td><td>23.86±0.81</td></tr><tr><td>CSD*</td><td>7.41 ± 0.21 (+0.58)</td><td>10.51 ± 0.06 (+1.46)</td><td>13.93 ± 0.12 (+1.23)</td><td>18.63 ± 0.07 (+0.16)</td><td>22.46 ± 0.08 (-1.40)</td></tr><tr><td>STAC</td><td>9.78 ± 0.53 (+2.95)</td><td>13.97 ± 0.35 (+4.92)</td><td>18.25 ± 0.25 (+5.55)</td><td>24.38 ± 0.12 (+5.86)</td><td>28.64 ± 0.21 (+4.78)</td></tr><tr><td>Unbiased Teacher</td><td>16.94 ± 0.23 (+10.11)</td><td>20.75 ± 0.12 (+11.72)</td><td>24.30 ± 0.07 (+11.60)</td><td>28.27 ± 0.11 (+9.80)</td><td>31.50 ± 0.10 (+7.64)</td></tr></table>
97
+
98
+ On the other hand, we also observe that the EMA training can also alleviate the imbalanced pseudolabeling biased issue due to the conservative property of the EMA training. To be more specific, with the EMA mechanism, the new Teacher model is regularized by the previous Teacher model, and this prevents the decision boundary from drastically moving toward the minority classes. In detail, the weights of the Teacher model can be represented as follows:
99
+
100
+ $$
101
+ \theta _ { t } ^ { i } = \hat { \theta } - \gamma \sum _ { k = 1 } ^ { i - 1 } ( 1 - \alpha ^ { - k + ( i - 1 ) } ) \frac { \partial ( \mathcal { L } _ { s u p } + \lambda _ { u } \mathcal { L } _ { u n s u p } ) } { \partial \theta _ { s } ^ { k } } ,
102
+ $$
103
+
104
+ where $\hat { \theta }$ is the model weight after the burn-in stage, $\theta _ { t } ^ { i }$ is the Teacher model weight in $i$ -th iteration, $\theta _ { s } ^ { k }$ is the Student model weight in $k$ -th iteration, $\gamma$ is the learning rate, and $\alpha$ is the EMA coefficient.
105
+
106
+ The regularization of the previous Teacher model is equivalent to putting an additional small coefficient on the gradients on Student models in previous steps. With the slowly altered decision boundary (i.e., higher stability), the pseudo-labels of these unlabeled instances are less likely to change dramatically, and this prevents the decision boundary from moving toward minority classes (i.e., majority class bias). Thus, the EMA-trained Teacher model is beneficial for producing more stable pseudo-labels and addressing the class-imbalance issue in SS-OD.
107
+
108
+ We note that the class-imbalance issue is crucial when using pseudo-labeling method to address semi-supervised or other low-label object detection tasks. There indeed exist other class-imbalance methods that can potentially improve the performance, but we leave this for future research.
109
+
110
+ # 4 EXPERIMENTS
111
+
112
+ Datasets. We benchmark our proposed method on experimental settings using MS-COCO (Lin et al., 2014) and PASCAL VOC (Everingham et al., 2010) following existing works (Jeong et al., 2019; Sohn et al., 2020b). Specifically, there are three experimental settings: (1) COCO-standard: we randomly sample 0.5, 1, 2, 5, and $10 \%$ of labeled training data as a labeled set and use the rest of the data as the training unlabeled set. (2) COCO-additional: we use the standard labeled training set as the labeled set and the additional COCO2017-unlabeled data as the unlabeled set. (3) VOC: we use the VOC07 trainval set as the labeled training set and the VOC12 trainval set as the unlabeled training set. Model performance is evaluated on the VOC07 test set.
113
+
114
+ Implementation Details. For a fair comparison, we follow STAC (Sohn et al., 2020b) to use FasterRCNN with FPN (Lin et al., 2017a) and ResNet-50 backbone (He et al., 2016) as our object detectior, where the feature weights are initialized by the ImageNet-pretrained model, same as existing works (Jeong et al., 2019; Sohn et al., 2020b). We use confidence threshold $\delta = 0 . 7$ . For the data augmentation, we apply random horizontal flip for weak augmentation and randomly add color jittering, grayscale, Gaussian blur, and cutout patches for strong augmentations. Note that we do not apply any geometric augmentations, which are used in STAC. We use $A P _ { 5 0 : 9 5 }$ (denoted as mAP) as evaluation metric, and the performance is evaluated on the Teacher model. More training and implementation details can be found in the Appendix.
115
+
116
+ # 4.1 RESULTS
117
+
118
+ COCO-standard. We first evaluate the efficacy of our Unbiased Teacher on COCO-standard (Table 1). When there are only $0 . 5 \%$ to $1 0 \%$ of data labeled, our model consistently performs favorably against the state-of-the-art methods, CSD (Jeong et al., 2019) and STAC (Sohn et al., 2020b). It is worth noting that our model trained on $1 \%$ labeled data achieves $2 0 . 7 5 \%$ mAP, which is even higher than STAC trained on $2 \%$ labeled data (mAP $1 8 . 2 5 \%$ ), CSD trained on $5 \%$ labeled data (mAP $1 8 . 5 7 \%$ ), and the supervised baseline trained on $5 \%$ labeled data (mAP $1 8 . 4 7 \%$ ). We also observe that, as there are less labeled data, the improvements between our method and the existing approaches becomes larger. Unbiased Teacher consistently shows around 10 absolute mAP improvements when using less than $5 \%$ of labeled data compared to supervised method. We attribute the improvements to several crucial factors:
119
+
120
+ Table 2: Experimental results on COCO-additional comparing with CSD (Jeong et al., 2019) and STAC (Sohn et al., 2020b). \*: we implement the CSD method and adapt it on the MS-COCO dataset. Note that 1x represents 90K training iterations, and $N \mathbf { x }$ represents $N { \times } 9 0 \mathrm { K }$ training iterations.
121
+
122
+ <table><tr><td rowspan="2"></td><td colspan="5">COCO-additional</td></tr><tr><td>Supervised (1x)</td><td>Supervised (3x)</td><td>CSD (3x)</td><td>STAC (6x)</td><td>Ours (3x)</td></tr><tr><td>AP50:95</td><td>37.63</td><td>40.20</td><td>38.82</td><td>39.21</td><td>41.30</td></tr></table>
123
+
124
+ ![](images/6a448004ebf6e555f29b1f5a65f89bf04374154ea1352f042dca80bbe487040d.jpg)
125
+ Figure 4: Pseudo-label improvement on (a) accuracy, (b) mIoU, and (c) number of bounding boxes in the case of $C O C O$ -standard $1 \%$ labeled data. We measure the (a) accuracy and (b) mIoU by comparing the ground-truth boxes and pseudo boxes. The Burn-In limit curves indicate the pseudoboxes obtained from the model right after the Burn-In stage without further refinement (i.e., the model trained on labeled data only). GT curve on the number of boxes figure indicates the averaged number of bounding boxes in the GT labels, and we showed that there are around 7 bounding boxes per image on average in MS-COCO. This result indicates our model can generate more accurate pseudo-labels after the Burn-In stage (i.e., 2k iterations).
126
+
127
+ 1) More accurate pseudo-labels. When leveraging the pseudo-labeling and consistency regularization between two networks (Teacher and Student in our case), it is critical to make sure pseudo-labels are accurate and reliable. Existing method attempts to do this by training the pseudo-label generation model using all the available labeled data and is completely frozen afterwards. In contrast, in our framework, our pseudo-label generation model (Teacher) continues to evolve gradually and smoothly via Teacher-Student Mutual Learning. This enables the Teacher to generate more accurate pseudo-labels as presented in Figure 4, which are properly exploited in the training of the Student.
128
+
129
+ 2) Class-imbalance on pseudo-labels. Our improvement also comes from both the use of the EMA and the Focal loss (Lin et al., 2017b), which addresses the class-imbalanced pseudo-labeling issue. As mentioned in Sec. 3.3, using more balanced pseudo-labels not only avoids the consecutive biased prediction problem but also benefits the predictions on the minority classes. Later in Sec. 4.2, we present the details of the ablation study on the EMA and the Focal loss.
130
+
131
+ COCO-additional and VOC. In the previous section, we presented Unbiased Teacher can successfully leverage very small amounts of labeled data. We now aim to verify whether the model trained on $1 0 0 \%$ supervised data can be further improved by using additional unlabeled data. We thus consider COCO-additional and VOC and present the results in Table 1 and 3.
132
+
133
+ In the case of COCO-additional (Table 2), compared with supervised only model, our model has a 1.10 absolute AP improvement. We also found a similar trend in the VOC experiment (Table 3). With VOC07 as labeled set and VOC12 as an additional unlabeled set, STAC shows 2.51 absolute mAP improvement with respect to the supervised model, whereas our model demonstrates 6.56 absolute mAP improvement. To further examine whether increasing the size of unlabeled data can further improve the performance, we follow CSD and STAC to use COCO20cls dataset3 as an additional unlabeled set. STAC shows 3.88 absolute mAP improvement, while our model achieves 8.21 absolute mAP improvement. These results demonstrate that our model can further improve the object detector trained on existing labeled datasets by using more unlabeled data. Note that, following STAC, we use a more challenging metric, $A P _ { 5 0 : 9 5 }$ , which averages the ten values over $A P _ { 5 0 }$ to $A P _ { 9 5 }$ since the metric of $A P _ { 5 0 }$ has been indicated as a saturated metric by the prior work (Cai & Vasconcelos, 2018; Sohn et al., 2020b).
134
+
135
+ Table 3: Results on VOC comparing with CSD (Jeong et al., 2019) and STAC (Sohn et al., 2020b).
136
+
137
+ <table><tr><td></td><td>Backbone</td><td>Labeled</td><td>Unlabeled</td><td>AP50</td><td>AP50:95</td></tr><tr><td>Supervised (from Ours)</td><td>ResNet50-FPN</td><td>VOC07</td><td>None</td><td>72.63</td><td>42.13</td></tr><tr><td>CSD</td><td>ResNet101-R-FCN</td><td rowspan="3">VOC07</td><td rowspan="3">VOC12</td><td>74.70 (+2.07)</td><td>1</td></tr><tr><td>STAC</td><td>ResNet50-FPN ResNet50-FPN</td><td>77.45 (+4.82)</td><td>44.64 (+2.51)</td></tr><tr><td>Unbiased Teacher</td><td></td><td>77.37 (+4.74)</td><td>48.69 (+6.56)</td></tr><tr><td>CSD</td><td>ResNet101-R-FCN</td><td rowspan="3">VOC07</td><td>VOC12</td><td>75.10 (+2.47)</td><td>1</td></tr><tr><td>STAC</td><td>ResNet50-FPN</td><td>+</td><td>79.08 (+6.45)</td><td>46.01 (+3.88)</td></tr><tr><td>Unbiased Teacher</td><td>ResNet50-FPN</td><td>COC020cls</td><td>78.82 (+6.19)</td><td>50.34 (+8.21)</td></tr></table>
138
+
139
+ ![](images/be922bddd41d90b7e021568577d4b7ef678fa14785ed7eb5e97fec9efc6ebc76.jpg)
140
+ Figure 5: Ablation study on the EMA and the Focal loss in the case of COCO-standard $1 \%$ labeled data. (a) mAP of the models using the Focal loss or cross-entropy and applying the EMA or standard training. (b) Class empirical distribution (i.e., histogram) of pseudo-labels generated by each model and compute $\kappa \mathcal { L }$ -divergence between the ground-truth labels distribution and the pseudo-label distribution. Among these models, the model using the Focal loss and EMA training (i.e., green curve) achieves the best mAP with the most balanced pseudo-labels .
141
+
142
+ # 4.2 ABLATION STUDY
143
+
144
+ Effect of the EMA training. We first examine the effect of EMA training and present a comparison between our model with EMA and without EMA. Our model without EMA is where the model weights of Teacher and Student are shared during the training stage, and it implies the Teacher model is also updated when the student model is optimized by using unlabeled data and pseudolabels. Note that the state-of-the-art semi-supervised classification model, FixMatch (Sohn et al., 2020a) similarly shares the model weights of the Teacher and the Student models.
145
+
146
+ From Figure 5, we observe that our model with EMA is superior to without EMA, and this trend can be found both in the model using the Focal loss and cross-entropy. To further analyze the diverged results, we visualize the class distribution of pseudo-labels generated by each model and measure the $\kappa \mathcal { L }$ -divergence between the ground-truth labels distribution and the pseudo-labels distribution. With the use of cross-entropy and standard training (i.e., without EMA training), the model generates the imbalanced pseudo-labels. To be more specific, the instances of most object categories in pseudolabels disappear, while only instances of specific object categories remain. We observe that using the EMA training can alleviate the imbalanced pseudo-labels issue and reduces the $\kappa \mathcal { L }$ -divergence from 1.7915 to 0.2482. On the other hand, we also observe that the model with EMA has a smoother learning curve compared with the model without EMA. This is because the model weight of the pseudo-label generation model (Teacher) is detached from the optimized model (Student). The pseudo-label generation model can thus prevent the detrimental effect caused by the noisy pseudolabels (e.g., false positive boxes) as we describe in Sec. 3.2.
147
+
148
+ In sum, the EMA training has several advantages: it 1) prevents the imbalanced pseudo-labels issue caused by the imbalanced nature in low-labeled object detection tasks, 2) prevents the detrimental effect caused by the noisy pseudo-labels, and 3) the Teacher model can be regarded as the temporal ensembles model of Student models in different time steps.
149
+
150
+ Effect of the Focal loss. In addition to the EMA training, we also verify the effectiveness of the Focal loss. As presented in Figure 5, the model using Focal loss can perform favorably against the model using cross-entropy. The model trained with the Focal loss can generate the pseudo-label which distribution is more similar to the distribution of ground-truth labels, and it can improve the $\kappa \mathcal { L }$ -divergence from 1.7915 (Cross entropy w/o EMA) to 0.2001 (Focal loss w/o EMA) and mAP from 13.42 to 17.85. When EMA training is applied, the $\kappa \mathcal { L }$ -divergence of the model with the Focal loss can be further improved from 0.2482 (Cross entropy w/ EMA) to 0.0851 (Focal loss w/ EMA) and mAP improve from 16.91 to 21.19. This confirms the effectiveness of the Focal loss in handling the class imbalance issues existed in the semi-supervised object detection. The reduction of $\kappa \mathcal { L }$ -divergence (i.e., better-fitting pseudo-label distributions to ground-truth label distributions) results in the mAP improvement.
151
+
152
+ Other ablation studies. We also ablate the effects of the Burn-In stage, pseudo-labeling thresholding, EMA rates, and unsupervised loss weights in the Appendix.
153
+
154
+ # 5 CONCLUSION
155
+
156
+ In this paper, we revisit the semi-supervised object detection task. By analyzing the object detectors in low-labeled scenarios, we identify and address two major issues: overfitting and class imbalance. We proposed Unbiased Teacher — a unified framework consisting of a Teacher and a Student that jointly learn to improve each other. In the experiments, we show our model prevents pseudo-labeling bias issue caused by class imbalance and overfitting issue due to labeled data scarcity. Our Unbiased Teacher achieves satisfactory performance across multiple semi-supervised object detection datasets.
157
+
158
+ # 6 ACKNOWLEDGMENTS
159
+
160
+ Yen-Cheng Liu and Zsolt Kira were partly supported by DARPA’s Learning with Less Labels (LwLL) program under agreement HR0011-18-S-0044, as part of their affiliation with Georgia Tech.
161
+
162
+ # REFERENCES
163
+
164
+ David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A Raffel. Mixmatch: A holistic approach to semi-supervised learning. In Advances in Neural Information Processing Systems (NeurIPS), pp. 5049–5059, 2019.
165
+ David Berthelot, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Kihyuk Sohn, Han Zhang, and Colin Raffel. Remixmatch: Semi-supervised learning with distribution alignment and augmentation anchoring. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
166
+ Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
167
+ Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
168
+ Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International Journal of Computer Vision (IJCV), 88(2):303–338, 2010.
169
+
170
+ Jiyang Gao, Jiang Wang, Shengyang Dai, Li-Jia Li, and Ram Nevatia. Note-rcnn: Noise tolerant ensemble rcnn for semi-supervised object detection. In Proceedings of the IEEE international conference on computer vision (ICCV), pp. 9508–9517, 2019.
171
+
172
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In Advances in neural information processing systems (NeurIPS), pp. 529–536, 2005.
173
+
174
+ Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
175
+
176
+ Hongyu Guo, Yongyi Mao, and Richong Zhang. Mixup as locally linear out-of-manifold regularization. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), volume 33, pp. 3714–3722, 2019.
177
+
178
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
179
+
180
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision (ICCV), pp. 2961–2969, 2017.
181
+
182
+ 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 (CVPR), pp. 9729–9738, 2020.
183
+
184
+ Dan Hendrycks, Norman Mu, Ekin D. Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. AugMix: A simple data processing method to improve robustness and uncertainty. Proceedings of the International Conference on Learning Representations (ICLR), 2020.
185
+
186
+ Judy Hoffman, Sergio Guadarrama, Eric S Tzeng, Ronghang Hu, Jeff Donahue, Ross Girshick, Trevor Darrell, and Kate Saenko. Lsda: Large scale detection through adaptation. In Advances in Neural Information Processing Systems ((NeurIPS)), pp. 3536–3544, 2014.
187
+
188
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the International Conference on Machine Learning (ICML), 2015.
189
+
190
+ Jisoo Jeong, Seungeui Lee, Jeesoo Kim, and Nojun Kwak. Consistency-based semi-supervised learning for object detection. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
191
+
192
+ Borui Jiang, Ruixuan Luo, Jiayuan Mao, Tete Xiao, and Yuning Jiang. Acquisition of localization confidence for accurate object detection. In Proceedings of the European Conference on Computer Vision (ECCV), 2018.
193
+
194
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the International Conference on Learning Representations (ICLR), 2015.
195
+
196
+ Chia-Wen Kuo, Chih-Yao Ma, Jia-Bin Huang, and Zsolt Kira. Featmatch: Feature-based augmentation for semi-supervised learning. In Proceedings of the European Conference on Computer Vision (ECCV), 2020.
197
+
198
+ Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In Proceedings of the International Conference on Learning Representations (ICLR), 2017.
199
+
200
+ Hei Law and Jia Deng. Cornernet: Detecting objects as paired keypoints. In Proceedings of the European Conference on Computer Vision (ECCV), 2018.
201
+
202
+ Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on Challenges in Representation Learning, ICML, volume 3, pp. 2, 2013.
203
+
204
+ Yu Li, Tao Wang, Bingyi Kang, Sheng Tang, Chunfeng Wang, Jintao Li, and Jiashi Feng. Overcoming classifier imbalance for long-tail object detection with balanced group softmax. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
205
+
206
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ Proceedings of the European Conference on Computer Vision (ECCV), 2014.
207
+
208
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie.´ Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017a.
209
+
210
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In Proceedings of the IEEE international conference on computer vision (CVPR), pp. 2980–2988, 2017b.
211
+
212
+ Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In European conference on computer vision (ECCV), pp. 21–37. Springer, 2016.
213
+
214
+ Ishan Misra, Abhinav Shrivastava, and Martial Hebert. Watch and learn: Semi-supervised learning for object detectors from video. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3593–3602, 2015.
215
+
216
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence (PAMI), 41(8):1979–1993, 2018.
217
+
218
+ Kemal Oksuz, Baris Can Cam, Sinan Kalkan, and Emre Akbas. Imbalance problems in object detection: A review. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.
219
+
220
+ Siyuan Qiao, Wei Shen, Zhishuai Zhang, Bo Wang, and Alan Yuille. Deep co-training for semisupervised image recognition. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 135–152, 2018.
221
+
222
+ Joseph Redmon and Ali Farhadi. Yolo9000: better, faster, stronger. In Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR), pp. 7263–7271, 2017.
223
+
224
+ Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
225
+
226
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems (NeurIPS), pp. 91–99, 2015.
227
+
228
+ Chuck Rosenberg, Martial Hebert, and Henry Schneiderman. Semi-supervised self-training of object detection models. In 2005 Seventh IEEE Workshops on Applications of Computer Vision, volume 1, pp. 29–36, 2005.
229
+
230
+ Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1163–1171, 2016.
231
+
232
+ Abhinav Shrivastava, Abhinav Gupta, and Ross Girshick. Training region-based object detectors with online hard example mining. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
233
+
234
+ Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. In Advances in Neural Information Processing Systems (NeurIPS), 2020a.
235
+
236
+ Kihyuk Sohn, Zizhao Zhang, Chun-Liang Li, Han Zhang, Chen-Yu Lee, and Tomas Pfister. A simple semi-supervised learning framework for object detection. arXiv preprint arXiv:2005.04757, 2020b.
237
+
238
+ Peng Tang, Chetan Ramaiah, Ran Xu, and Caiming Xiong. Proposal learning for semi-supervised object detection. arXiv preprint arXiv:2001.05086, 2020.
239
+
240
+ Yuxing Tang, Josiah Wang, Boyang Gao, Emmanuel Dellandrea, Robert Gaizauskas, and Liming ´ Chen. Large scale semi-supervised object detection using visual and semantic knowledge transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2119–2128, 2016.
241
+
242
+ Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in neural information processing systems (NeurIPS), pp. 1195–1204, 2017.
243
+
244
+ Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019.
245
+
246
+ Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V Le. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
247
+
248
+ Bing Yu, Jingfeng Wu, Jinwen Ma, and Zhanxing Zhu. Tangent-normal adversarial regularization for semi-supervised learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10676–10684, 2019.
249
+
250
+ Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), pp. 6023–6032, 2019.
251
+
252
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In Proc. International Conference on Learning Representations (ICLR), 2018.
253
+
254
+ Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. arXiv preprint arXiv:1708.04896, 2017.
255
+
256
+ A APPENDIX
257
+
258
+ # A.1 EMA ON IMBALANCED PSEUDO-LABELING ISSUE
259
+
260
+ To empirically examine the effectiveness of EMA on imbalance, we present the pseudo-label distribution in different training iterations as presented in Figure 6. At the beginning of training (i.e., 30k), both Teacher models with and without EMA could generate the balanced pseudo-labels (the KL divergence between ground-truth labels and pseudo-labels are both small). However, since the Student model is trained with the pseudo-labels generated by the Teacher models, the model without EMA starts biasing towards specific classes. In contrast, with the EMA training, the model generates less imbalanced pseudo-labels. Note that, although the EMA is applied, the balance issue still exists. We thus apply Focal loss to enhance the ability to mitigate the imbalance issue further.
261
+
262
+ ![](images/8c66018ff39bcc905db717d1459ba275913e67adbdbb062381a9234b158d0e8b.jpg)
263
+ Figure 6: Ablation study on EMA at different training iterations. Both the models with EMA and without EMA have pseudo-label distributions, which are similar to the ground-truth distributions in the early stage of training iterations. However, the model without EMA tends to generate more biased pseudo-label distribution later during training.
264
+
265
+ # A.2 ADDITIONAL ABLATION STUDY
266
+
267
+ In addition to the ablation studies provided in the main paper, we further ablate Unbiased Teacher in the following sections.
268
+
269
+ # A.2.1 EFFECT OF BURN-IN STAGE
270
+
271
+ As mentioned in Section 3.1, it is crucial to have a good initialization for both Student and Teacher models. We thus present a comparison between the model with and without the Burn-In stage in Figure 7. We observe that, with the Burn-In stage, the model can derive more accurate pseudo-boxes in the early stage of the training. As a result, the model can achieve higher accuracy in the early stage of the training, and it also achieves better results when the model is converged.
272
+
273
+ # A.2.2 EFFECT OF PSEUDO-LABELING THRESHOLD
274
+
275
+ As mentioned in Section 3.3, we apply confidence thresholding to filter these low-confidence predicted bounding boxes, which are more likely to be false-positive instances. To show the effectiveness of thresholding, we first provide the accuracy of predicted bounding boxes before and after the pseudo-labeling in Figure 8.
276
+
277
+ ![](images/ad0b577dcf3b79e1d30a56ea6e45a0681e88b573a42250b897db93ae7b6df28f.jpg)
278
+ Figure 7: In the case of $C O C O$ -standard $1 \%$ labeled data, (a) Unbiased Teacher with Burn-In stage achieve higher mAP against Unbiased Teacher without Burn-In stage. Using Burn-In Stage results in the early improvement of (b) box accuracy and (c) mIoU. (d) Unbiased Teacher with Burn-In stage can derive more pseudo-boxes than Unbiased Teacher without Burn-In stage.
279
+
280
+ ![](images/0eb3b49413c21aed94c0e4d005e9e4abc2c5254796681119fbf32a6ad8f77f46.jpg)
281
+ Figure 8: Pseudo-label accuracy improvement with the use of confidence thresholding. We measure the accuracy by comparing the ground-truth labels and predicted labels before and after confidence thresholding. This result indicates that confidence thresholding can significantly improve the quality of pseudo-labels.
282
+
283
+ When varying the threshold value $\delta$ from 0 to 0.9, as expected, the number of generated pseudoboxes increases as the threshold $\delta$ reduces (Figure 9). The model using excessively high threshold (e.g., $\delta \ : = \ : 0 . 9 $ ) cannot perform satisfactory results, as the number of generated pseudo-labels is very low. On the other hand, the model using a low threshold (e.g., $\delta = 0 . 6$ ) also cannot achieve favorable results since the model generates too many bounding boxes, which are likely to be falsepositive instances. We also observe that the model cannot even converge if the threshold is below 0.5.
284
+
285
+ ![](images/bf9b4c94616e04dc7472b854643e99875718344a8755433a7ba7324efd05841e.jpg)
286
+ Figure 9: (a) Validation AP and (b) number of pseudo-label bounding boxes per image with various pseudo-labeling thresholds $\delta$ . With an excessively low threshold (e.g., $\delta = 0 . 6$ ), the model has a lower AP, as it predicts more pseudo-labeled bounding boxes compared to the number of bounding boxes in ground-truth labels. On the other hand, the performance of the model using an excessively high threshold (e.g., $\delta = 0 . 9$ ) drops as it cannot predict sufficient number of bounding boxes in its generated pseudo-labels.
287
+
288
+ # A.2.3 EFFECT OF EMA RATES
289
+
290
+ We also evaluate the model using various EMA rate $\alpha$ from 0.5 to 0.9999 and present the mAP result of the Teacher model in Figure 10. We observe that, with a smaller EMA rate (e.g., $\alpha = 0 . 5$ ), the model has lower mAP and higher variance, as the Student contributes more to the Teacher model for each iteration. This implies the Teacher model is likely to suffer from the detrimental effect caused by noisy pseudo-labels. This unstable learning curve can be stabilized and improved as the EMA rate $\alpha$ increases. When the EMA rate $\alpha$ achieves 0.99, it performs the best mAP. However, if the EMA rate $\alpha$ keeps increasing, the teacher model will grow overly slow as the Teacher model derive the next model weight mostly from the previous Teacher model weight.
291
+
292
+ ![](images/d503bf0212abfc65305c79627f753df496e9ec7a00e7abe32048bb7fac5e032a.jpg)
293
+ Figure 10: Validation AP on the Teacher model with various MMA rates $\alpha$ . (a) With a small MMA rate (e.g., $\alpha = 0 . 5$ ), the Teacher model has lower AP and larger variance. In contrast, as the MMA rate grows to 0.99, the Teacher model can gradually improve along the training iterations. However, when the MMA grows to 0.9999, the Teacher model grows overly slow but has lowest variance. (b) We breakdown the AP metric into APs from $A P _ { 5 0 }$ to $A P _ { 9 5 }$ .
294
+
295
+ # A.2.4 EFFECT OF UNSUPERVISED LOSS WEIGHTS
296
+
297
+ To examine the effect unsupervised loss weights, we vary the unsupervised loss weight $\lambda _ { u }$ from 1.0 to 8.0 in the case of $C O C O$ -standard $1 0 \%$ labeled data. As shown in Table 4, with a lower unsupervised loss weight $\lambda _ { u } = 1 . 0$ , the model performs $2 9 . 3 0 \%$ . On the other hand, we observe that the model performs the best with unsupervised loss weight $\lambda = 5 . 0$ . However, when the weight increases to 8.0, the training of the model cannot converge.
298
+
299
+ Table 4: Ablation study of varying unsupervised loss weight $\lambda _ { u }$ on the model trained using $1 0 \%$ labeled and $9 0 \%$ unlabeled data.
300
+
301
+ <table><tr><td>入u</td><td>1.0</td><td>2.0</td><td>4.0</td><td>5.0</td><td>6.0</td><td>8.0</td></tr><tr><td>AP(%)</td><td>29.30</td><td>30.64</td><td>31.82</td><td>32.00</td><td>31.80</td><td>Cannot Converge</td></tr></table>
302
+
303
+ # A.3 AP BREAKDOWN FOR COCO-STANDARD
304
+
305
+ We present an AP breakdown for COCO-standard $0 . 5 \%$ labeled data. As mentioned in Section 4, our proposed model can perform favorably against both STAC (Sohn et al., 2020b) and CSD (Jeong et al., 2019). This trend appears in all evaluation metrics from $A P _ { 5 0 }$ to $A P _ { 9 5 }$ , as shown in Figure 11, and it confirms that our model is preferable for handling extremely low-label scenario compared to the state of the arts.
306
+
307
+ ![](images/4d3b72fa84190227bca23d5caa8b1d806600fe3fa37368cb21899d4e56818f2a.jpg)
308
+ Figure 11: Evaluation metric breakdown of all methods on $0 . 5 \%$ labeled data.
309
+
310
+ # A.4 IMPLEMENTATION AND TRAINING DETAILS
311
+
312
+ Network and framework. Our implementation builds upon the Detectron2 framework (Wu et al., 2019). For a fair comparison, we follow the prior work (Sohn et al., 2020b) to use Faster-RCNN with FPN (Lin et al., 2017a) and ResNet-50 backbone (He et al., 2016) as our object detection network.
313
+
314
+ Training. At the beginning of the Burn-In stage, the feature backbone network weights are initialized by the ImageNet-pretrained model, which is same as existing works (Jeong et al., 2019; Tang et al., 2020; Sohn et al., 2020b). We use the SGD optimizer with a momentum rate 0.9 and a learning rate 0.01, and we use constant learning rate scheduler. The batch size of supervised and unsupervised data are both 32 images. For the COCO-standard, we train 180k iterations, which includes $1 / 2 / 6 / 1 2 / 2 0 \mathbf { k }$ iterations for $0 . 5 \% / 1 \% / 2 \% / 5 \% / 1 0 \%$ in the Burn-In stage and the remaining iterations in the Teacher-Student Mutual Learning stage. For the COCO-additional, we train $3 6 0 \mathrm { k }$ iterations, which includes $9 0 \mathrm { k }$ iterations in the Burn-Up stage and the remaining $2 7 0 \mathrm { k }$ iterations in the Teacher-Student Mutual Learning stage.
315
+
316
+ Hyper-parameters. We use confidence threshold $\delta \ : = \ : 0 . 7$ to generate pseudo-labels for all our experiments, the unsupervised loss weight $\lambda _ { u } = 4$ is applied for $C O C O$ -standard and VOC, and the unsupervised loss weight $\lambda _ { u } = 2$ is applied for $C O C O$ -additional. We apply $\alpha = 0 . 9 9 9 6$ as the EMA rate for all our experiments. Hyper-parameters used are summarized in Table 5.
317
+
318
+ Data augmentation. As shown in Table 6, we apply randomly horizontal flip for weak augmentation and randomly add color jittering, grayscale, Gaussian blur, and cutout patches (DeVries & Taylor, 2017) for the strong augmentation. Note that we do not apply any image-level or box-level geometric augmentations, which are used in STAC (Sohn et al., 2020b). In addition, we do not aggressively search the best hyper-parameters for data augmentations, and it is possible to obtain better hyperparameters.
319
+
320
+ Table 5: Meanings and values of the hyper-parameters used in experiments.
321
+
322
+ <table><tr><td>Hyper-parameter</td><td>Description</td><td>COCO-standard and VOC</td><td>COCO-additional</td></tr><tr><td>8</td><td>Confidence threshold</td><td>0.7</td><td>0.7</td></tr><tr><td>入u</td><td>Unsupervised loss weight</td><td>4</td><td>2</td></tr><tr><td>a</td><td>EMA rate</td><td>0.9996</td><td>0.9996</td></tr><tr><td>b</td><td>Batch size for labeled data</td><td>32</td><td>16</td></tr><tr><td>bu</td><td>Batch size for unlabeled data</td><td>32</td><td>16</td></tr><tr><td>Y</td><td>Learning rate</td><td>0.01</td><td>0.01</td></tr></table>
323
+
324
+ Table 6: Detail of data augmentations. Probability in the table indicates the probability of applying the corresponding image process.
325
+
326
+ <table><tr><td colspan="4">Weak Augmentation</td></tr><tr><td>Process</td><td>Probability</td><td>Parameters</td><td>Descriptions</td></tr><tr><td>Horizontal Flip</td><td>0.5</td><td>-</td><td>None</td></tr><tr><td colspan="4">Strong Augmentation</td></tr><tr><td>Process</td><td>Probability</td><td>Parameters</td><td>Descriptions</td></tr><tr><td>Color Jittering</td><td>0.8</td><td>(brightness,contrast, saturation, hue) =(0.4,0.4,0.4,0.1)</td><td>Brightness factor is chosen uniformly from [O.6,1.4], contrast factor is chosen uniformly from [O.6,1.4], saturation factor is chosen uniformly from [O.6,1.4], and hue value is chosen uniformly from[-O.1, 0.1].</td></tr><tr><td>Grayscale</td><td>0.2</td><td>None</td><td>None</td></tr><tr><td>GaussianBlur</td><td>0.5</td><td>(sigma_x,sigma_y)=(0.1,2.0)</td><td>Gaussian filter with ox = O.1 and σy= 2.O is applied.</td></tr><tr><td>CutoutPattern1</td><td>0.7</td><td>scale=(0.05,0.2),ratio=(0.3,3.3)</td><td>Randomly selects a rectangle region in an image and erases its pixels.We refer the detail in Zhong et al. (2017).</td></tr><tr><td>CutoutPattern2</td><td>0.5</td><td>scale=(0.02,0.2),ratio=(0.1,6)</td><td>Randomly selects a rectangle region in an image and erases its pixels.We refer the detail in Zhong et al.(2017).</td></tr><tr><td>CutoutPattern3</td><td>0.3</td><td>scale=(0.02,0.2),ratio=(0.05,8)</td><td>Randomly selects a rectangle region in an image and erases its pixels.We refer the detail in Zhong et al.(2017).</td></tr></table>
327
+
328
+ Evaluation Metrics. $A P _ { 5 0 : 9 5 }$ is used to evaluate all methods following the prior works (Law & Deng, 2018; Sohn et al., 2020b).
md/train/M_lkFOwVdYc/M_lkFOwVdYc.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Long-Short Transformer: Efficient Transformers for Language and Vision
2
+
3
+ Chen $Z \mathrm { { h u } ^ { \ddag 1 * } }$ , Wei Ping†2, Chaowei Xiao†2,3, Mohammad Shoeybi2, Tom Goldstein1, Anima Anandkumar2,4, and Bryan Catanzaro2
4
+
5
+ 1University of Maryland, College Park 2 NVIDIA 3Arizona State University 4California Institute of Technology ‡chenzhu@cs.umd.edu, †{wping, chaoweix}@nvidia.com
6
+
7
+ # Abstract
8
+
9
+ Transformers have achieved success in both language and vision domains. However, it is prohibitively expensive to scale them to long sequences such as long documents or high-resolution images, because self-attention mechanism has quadratic time and memory complexities with respect to the input sequence length. In this paper, we propose Long-Short Transformer (Transformer-LS), an efficient self-attention mechanism for modeling long sequences with linear complexity for both language and vision tasks. It aggregates a novel long-range attention with dynamic projection to model distant correlations and a short-term attention to capture fine-grained local correlations. We propose a dual normalization strategy to account for the scale mismatch between the two attention mechanisms. Transformer-LS can be applied to both autoregressive and bidirectional models without additional complexity. Our method outperforms the state-of-the-art models on multiple tasks in language and vision domains, including the Long Range Arena benchmark, autoregressive language modeling, and ImageNet classification. For instance, Transformer-LS achieves 0.97 test BPC on enwik8 using half the number of parameters than previous method, while being faster and is able to handle $3 \times$ as long sequences compared to its full-attention version on the same hardware. On ImageNet, it can obtain the state-of-the-art results (e.g., a moderate size of $5 5 . 8 \mathbf { M }$ model solely trained on $2 2 4 \times 2 2 4$ ImageNet-1K can obtain Top-1 accuracy $8 4 . 1 \%$ ), while being more scalable on high-resolution images. The source code and models are released at https://github.com/NVIDIA/transformer-ls.
10
+
11
+ # 1 Introduction
12
+
13
+ Transformer-based models [1] have achieved great success in the domains of natural language processing (NLP) [2, 3] and computer vision [4–6]. These models benefit from the self-attention module, which can capture both adjacent and long-range correlations between tokens while efficiently scaling on modern hardware. However, the time and memory consumed by self-attention scale quadratically with the input length, making it very expensive to process long sequences. Many language and vision tasks benefit from modeling long sequences. In NLP, document-level tasks require processing long articles [e.g., 7, 8], and the performance of language models often increases with sequence length [e.g., 9, 10]. In computer vision, many tasks involve high-resolution images, which are converted to long sequences of image patches before being processed with Transformer models [4, 6, 11]. As a result, it is crucial to design an efficient attention mechanism for long sequence modeling that generalizes well across different domains.
14
+
15
+ Various methods have been proposed to reduce the quadratic cost of full attention. However, an efficient attention mechanism that generalizes well in both language and vision domains is less explored. One family of methods is to sparsify the attention matrix with predefined patterns such as sliding windows [e.g., 12–15] and random sparse patterns [16]. These methods leverage strong inductive biases to improve both computational and model performance, but they limit the capacity of a self-attention layer because each specific token can only attend to a subset of tokens. Another family of methods leverages low-rank projections to form a low resolution representation of the input sequence, but the successful application of these methods has been limited to certain NLP tasks [e.g., 17–19]. Unlike sparse attention, this family of methods allows each token to attend to the entire input sequence. However, due to the loss of high-fidelity token-wise information, their performance sometimes is not as good as full attention or sparse attention on tasks that require fine-grained local information, including standard benchmarks in language [20] and vision [21].
16
+
17
+ Despite the rapid progress in efficient Transformers, some proposed architectures can only be applied to bidirectional models [e.g., 15, 16, 18]. Transformer-based autoregressive models have achieved great successes in language modeling [22], image synthesis [23], and text-to-image synthesis [24], which also involve long texts or high-resolution images. It is desirable to design an efficient transformer that can be applied to both autoregressive and bidirectional models.
18
+
19
+ In this work, we unify a local window attention and a novel long-range attention into a single efficient attention mechanism. We show that these two kinds of attention have complementary effects that together yield the state-of-the-art results on a range of tasks in language and vision, for both autoregressive and bidirectional models. Specifically, we make the following contributions:
20
+
21
+ • We propose Long-Short Transformer (Transformer-LS), an efficient Transformer that integrates a dynamic projection based attention to model long-range correlations, and a local window attention to capture fine-grained correlations. Transformer-LS can be applied to both autoregressive and bidirectional models with linear time and memory complexity.
22
+ • We compute a dynamic low-rank projection, which depends on the content of the input sequence. In contrast to previous low-rank projection methods, our dynamic projection method is more flexible and robust to semantic-preserving positional variations (e.g., insertion, paraphrasing). We demonstrate that it outperforms previous low-rank methods [17, 18] on Long Range Arena benchmark [20].
23
+ • We identify a scale mismatch problem between the embeddings from the long-range and shortterm attentions, and design a simple but effective dual normalization strategy, termed DualLN, to account for the mismatch and enhance the effectiveness of the aggregation.
24
+ • We demonstrate that Long-Short Transformer, despite its low memory and runtime complexity, outperforms the state-of-the-art models on a set of tasks from Long Range Arena, and autoregressive language modeling on enwik8 and text8. In addition, the proposed efficient attention mechanism can be easily applied to the most recent vision transformer architectures [6, 11] and provides state-of-the-art results, while being more scalable to high-resolution images. We also investigate the robustness properties of the Transformer-LS on diverse ImageNet datasets.
25
+
26
+ # 2 Related Work
27
+
28
+ # 2.1 Efficient Transformers
29
+
30
+ In recent years, many methods have been introduced for dealing with the quadratic cost of full attention. In general, they can be categorized as follows: i) Sparse attention mechanism with predefined patterns (e.g., sliding window), including Sparse Transformer [12], Image Transformer [13], Axial Transformer [25] for modeling images, and Longformer [14], blockwise self-attention [26], ETC [15], Big Bird [16] for modeling language. ii) Low-rank projection attention, including Linformer [17], Nyströmformer [18], Synthesizer [19]. For example, Linformer uses linear layers to project the original high resolution keys $( K )$ and values $( V )$ with length $n$ to low resolution with size $r$ $( r \ll n )$ ) and allows all query tokens $( Q )$ to attend these compressed representations. iii) Memory-based mechanisms like Compressive Transformer [10] and Set Transformer [27], which use extra memories for caching global long-range information for use in computing attention between distant tokens. iv) Kernel-based approximation of the attention matrix, including Performer [28], Linear
31
+
32
+ ![](images/cac6035bb2eb7c5eb4e197f0f078ccb16d4a2c66c0c57d273bbe65a2ec761215.jpg)
33
+ Figure 1: Long-short term attention of a single attention head. Here, the sequence length $n = 8$ , hidden dimension $d = 3$ , local window segment size $w = 2$ , and rank of dynamic projection $r = 3$ . Within the figure, $K ( V )$ denotes key $K$ or value $V$ . In the left figure, we virtually replicate $K$ or $V \in \mathbb { R } ^ { n \times d }$ into $n$ rows, and highlight the keys and values within the attention span (denoted as $\tilde { K } ( \tilde { V } ) )$ of all $_ n$ queries $Q$ for the short-term attention. In the middle figure, all queries attend to the same projected keys $\bar { K }$ and values $\bar { V }$ within the long-term attention. In the right figure, $\tilde { K } ( \tilde { V } )$ and $\bar { K } ( \bar { V } )$ are first normalized with two sets of LayerNorms, and the queries attend to normalized $\tilde { K } ( \tilde { V } )$ and $\bar { K } ( \bar { V } )$ within their attention span simultaneously.
34
+
35
+ Transformer [29], and Random Feature Attention [30]. vi) Similarity and clustering based methods, including Reformer [31], Routing Transformer [32], and Sinkhorn Transformer [33].
36
+
37
+ Our method seamlessly integrates both low-rank projection and local window attentions, to leverage their strengths for modeling long-range and short-term correlations. In particular, our long-range attention uses a dynamic low-rank projection to encode the input sequence, and outperforms the previous low-rank projection method used by the Linformer [17]. In the similar vein, a few other methods also try to combine the strengths of different methods. For example, Longformer [14] and ETC [15] augment local window attention with task motivated global tokens. Such global tokens may not be applicable for some tasks (e.g., autoregressive modelling). BigBird [16] further combines local window and global token attention with random sparse attention. It is not applicable in autoregressive tasks because the global token and random sparse pattern are introduced. To compress the model footprint on edge devices, Lite Transformer [34] combines convolution and self-attention, but it still has quadratic complexity for long sequences.
38
+
39
+ # 2.2 Vision Transformers
40
+
41
+ Vision Transformer (ViT) [4] splits images as small patches and treats the patches as the input word tokens. It uses a standard transformer for image classification and has shown to outperform convolutional neural networks (e.g., ResNet [35]) with sufficient training data. DeiT [36] has applied the teacher-student strategy to alleviate the data efficiency problem of ViT and has shown strong comparable performance using only the standard ImageNet dataset [37]. Instead of applying transformer at a single low resolution of patches (e.g., $1 6 \times 1 6$ patches), very recent works, including Pyramid Vision Transformer (PVT) [5], Swin-Transformer [38], T2T-ViT [39], Vision Longformer (ViL) [11] and Convolutional Vision Transformer (CvT) [6], stack a pyramid of ViTs to form a multi-scale architecture and model long sequences of image patches at much higher resolution (e.g., $5 6 \times 5 6 = 3 1 3 6$ patches for images with $2 2 4 \times 2 2 4$ pixels). Most of these methods have quadratic complexity of self-attention with respect to the input image size.
42
+
43
+ To reduce the complexity, Swin-Transformer [38] achieves linear complexity by limiting the computation of self-attention only within each local window. HaloNet [40] applies local attention on blocked images and only has quadratic complexity with respect to the size of the block. Perceiver [41] uses cross-attention between data and latent arrays to replace the self-attention on data to remove the quadratic complexity bottleneck. Vision Longformer (ViL) [11], another concurrent work, achieves linear complexity by adapting Longformer [14] to Vision. ViL augments local window attention with task-specific global tokens, but the global tokens are not applicable for decoding task (e.g., image synthesis [23, 24]). In contrast, our method reduces the quadratic cost to linear cost by combining local window attention with global dynamic projection attention, which can be applied to both encoding and decoding tasks.
44
+
45
+ # 3 Long-Short Transformer
46
+
47
+ Transformer-LS approximates the full attention by aggregating long-range and short-term attentions, while maintaining its ability to capture correlations between all input tokens. In this section, we first introduce the preliminaries of multi-head attention in Transformer. Then, we present the short-term attention via sliding window, and long-range attention via dynamic projection, respectively. After that, we propose the aggregating method and dual normalization (DualLN) strategy. See Figure 1 for an illustration of our long-short term attention.
48
+
49
+ # 3.1 Preliminaries and Notations
50
+
51
+ Multi-head attention is a core component of the Transformer [1], which computes contextual representations for each token by attending to the whole input sequence at different representation subspaces. It is defined as
52
+
53
+ $$
54
+ \mathrm { M u l t i H e a d } ( Q , K , V ) = \mathrm { C o n c a t } ( H _ { 1 } , H _ { 2 } , . . . , H _ { h } ) W ^ { O } ,
55
+ $$
56
+
57
+ where $Q , K , V \in \mathbb { R } ^ { n \times d }$ are the query, key and value embeddings, $W ^ { O } \in \mathbb { R } ^ { d \times d }$ is the projection matrix for output, the $i$ -th head $\bar { H _ { i } } \in \bar { \mathbb { R } } ^ { n \times \check { d } _ { k } }$ is the scaled dot-product attention, and $d _ { k } = d / h$ is the embedding dimension of each head,
58
+
59
+ $$
60
+ H _ { i } = \mathrm { A t t e n t i o n } ( Q W _ { i } ^ { Q } , K W _ { i } ^ { K } , V W _ { i } ^ { V } ) = \mathrm { s o f t m a x } \left[ \frac { Q W _ { i } ^ { Q } \left( K W _ { i } ^ { K } \right) ^ { \mathsf { T } } } { \sqrt { d _ { k } } } \right] V W _ { i } ^ { V } = A _ { i } V W _ { i } ^ { V } ,
61
+ $$
62
+
63
+ where $W _ { i } ^ { Q } , W _ { i } ^ { K } , W _ { i } ^ { V } \in \mathbb { R } ^ { d \times d _ { k } }$ are learned projection matrices, and $A _ { i } \in \mathbb { R } ^ { n \times n }$ denotes the full attention matrix for each attention head. The complexity of computing and storing $A _ { i }$ is $O ( n ^ { 2 } )$ , which can be prohibitive when $n$ is large. For simplicity, our discussion below is based on the case of 1D input sequences. It is straightforward to extend to the 2D image data given a predetermined order.
64
+
65
+ # 3.2 Short-term Attention via Segment-wise Sliding Window
66
+
67
+ We use the simple yet effective sliding window attention to capture fine-grained local correlations, where each query attends to nearby tokens within a fixed-size neighborhood. Similar techniques have also been adopted in [14, 16, 11]. Specifically, we divide the input sequence into disjoint segments with length $w$ for efficiency reason. All tokens within a segment attend to all tokens within its home segment, as well as $w / 2$ consecutive tokens on the left and right side of its home segment (zero-padding when necessary), resulting in an attention span over a total of $2 w$ key-value pairs. See Figure 5 in Appendix for an illustration. For each query $Q _ { t }$ at the position $t$ within the $i$ -th head, we denote the $2 w$ key-value pairs within its window as $\bar { K } _ { t } , \tilde { V } _ { t } \in \mathbb { R } ^ { \bar { 2 w } \times d }$ . For implementation with PyTorch, this segment-wise sliding window attention is faster than the per-token sliding window attention where each token attends to itself and $w$ tokens to its left and right, and its memory consumption scales linearly with sequence length; see [14] and our Figure 3 for more details.
68
+
69
+ The sliding window attention can be augmented to capture long-range correlations in part, by introducing different dilations to different heads of sliding window attention [14]. However, the dilation configurations for different heads need further tuning and an efficient implementation of multi-head attention with different dilations is non-trivial. A more efficient alternative is to augment sliding window attention with random sparse attention [16], but this does not guarantee that the long-range correlations are captured in each layer as in full attention. In the following section, we propose our long-range attention to address this issue.
70
+
71
+ # 3.3 Long-range Attention via Dynamic Projections
72
+
73
+ Previous works have shown that the self-attention matrix can be well approximated by the product of low-rank matrices [17]. By replacing the full attention with the product of low-rank matrices [42, 19, 18, 43, 28], each query is able to attend to all tokens. Linformer [17] is one of the most representative models in this category. It learns a fixed projection matrix to reduce the length of the keys and values, but the fixed projection is inflexible to semantic-preserving positional variations.
74
+
75
+ Starting from these observations, we parameterize the dynamic low-rank projection at $i$ -th head as $P _ { i } = f ( K ) \in \mathbb { R } ^ { n \times r }$ , where $r \ll n$ is the low rank size and $P _ { i }$ depends on all the keys $K \in \mathbb { R } ^ { n \times d }$ of input sequence. It projects the $( n \times d _ { k } )$ -dimensional key embeddings $K W _ { i } ^ { K }$ and value embeddings $V W _ { i } ^ { V }$ into shorter, $( r \times d _ { k } )$ -dimensional key ${ \bar { K } } _ { i }$ and value $\bar { V } _ { i }$ embeddings. Unlike Linformer [17], the low-rank projection matrix is dynamic, which depends on the input sequence and is intended to be more flexible and robust to, e.g., insertion, deletion, paraphrasing, and other operations that change sequence length. See Table 2 for examples. Note that, the query embeddings $Q \bar { W } _ { i } ^ { Q } \in \mathbb { R } ^ { n \times d _ { k } }$ are kept at the same length, and we let each query attend to ${ \bar { K } } _ { i }$ and $\bar { V } _ { i }$ . In this way, the full $( n \times n )$ attention matrix can be decomposed into the product of two matrices with $r$ columns or rows. Specifically, we define the dynamic projection matrix $P _ { i } \in \mathbb { R } ^ { n \times r }$ and the key-value embeddings $\bar { K } _ { i } , \dot { \bar { V } } _ { i } \in \mathbb { R } ^ { r \times \mathbf { \dot { d } } _ { k } }$ of low-rank attention as
76
+
77
+ $$
78
+ P _ { i } = \mathrm { s o f t m a x } ( K W _ { i } ^ { P } ) , \bar { K } _ { i } = P _ { i } ^ { \intercal } K W _ { i } ^ { K } , \bar { V } _ { i } = P _ { i } ^ { \intercal } V W _ { i } ^ { V } ,
79
+ $$
80
+
81
+ where $W _ { i } ^ { P } \in \mathbb { R } ^ { d \times r }$ are learnable parameters,2 and the softmax normalizes the projection weights on the first dimension over all $n$ tokens, which stabilizes training in our experiments. Note that $K = V$ in all the experiments we have considered, so $P _ { i }$ remains the same if it depends on $V$ . The computational complexity of Eq. 3 is $O ( r n )$ .
82
+
83
+ To see how the full attention is replaced by the product of low-rank matrices, we compute each head $H _ { i } \in \mathbb { R } ^ { n \times d _ { k } }$ of long-range attention as,
84
+
85
+ $$
86
+ \bar { H } _ { i } = \underbrace { \mathrm { s o f t m a x } \left[ \frac { Q W _ { i } ^ { Q } \bar { K } _ { i } ^ { \top } } { \sqrt { d _ { k } } } \right] } _ { \bar { A } _ { i } } \bar { V } _ { i } = \bar { A } _ { i } \big ( P _ { i } ^ { \top } V W _ { i } ^ { V } \big ) ,
87
+ $$
88
+
89
+ so the full attention is now replaced with the implicit product of two low-rank matrices $\bar { A } _ { i } \in \mathbb { R } ^ { n \times r }$ and $P _ { i } ^ { \mathsf { T } } \in \mathbb { R } ^ { r \times n }$ , and the computational complexity is reduced to $O ( r n )$ . Note the effective attention weights of a query on all tokens still sum to 1. Our global attention allows each query to attend to all token embeddings within the same self-attention layer. In contrast, the sparse attention mechanisms [14, 16] need stack multiple layers to build such correlations.
90
+
91
+ Application to Autoregressive Models: In autoregressive models, each token can only attend to the previous tokens, so the long-range attention should have a different range for different tokens. A straightforward way to implement our global attention is to update $\bar { K } _ { i } , \bar { V } _ { i }$ for each query recurrently, but this requires re-computing the projection in Eq. (3) for every token due to the nonlinearity of softmax, which results in $O ( r n ^ { 2 } )$ computational complexity. To preserve the linear complexity, for autoregressive models, we first divide the input sequence into equal-length segments with length $l$ , and apply our dynamic projection to extract $\bar { \bar { K } } _ { i } , \bar { \bar { V } } _ { i }$ from each segment. Each token can only attend to $\bar { K } _ { i } , \bar { V _ { i } }$ of segments that do not contain its future tokens. Formally, let $Q _ { t }$ be the query at position $t$ , $K _ { ( l - 1 ) s : l s } , V _ { ( l - 1 ) s : l s }$ be the key-value pairs from the $s$ -th segment, and $s _ { t } = \lfloor t / l \rfloor$ . For autoregressive models, we compute the long-range attention of $Q _ { t }$ by attending to $K _ { i , t } , V _ { i , t }$ , defined as
92
+
93
+ $$
94
+ \bar { K } _ { i , t } = [ P _ { i , 1 } ^ { \top } K _ { 1 : l } ; . . . ; P _ { i , s _ { t } } ^ { \top } K _ { ( l - 1 ) s _ { t } : l s _ { t } } ] W _ { i } ^ { K } , \bar { V } _ { i , t } = [ P _ { i , 1 } ^ { \top } V _ { 1 : l } ; . . . ; P _ { i , s _ { t } } ^ { \top } V _ { ( l - 1 ) s _ { t } : l s _ { t } } ] W _ { i } ^ { V } .
95
+ $$
96
+
97
+ In this way, the dynamic low-rank projection is applied to each segment only once in parallel, preserving the linear complexity and the high training speed. By comparison, Random Feature Attention [30] is slow at training due to the requirement for recurrence.
98
+
99
+ # 3.4 Aggregating Long-range and Short-term Attentions
100
+
101
+ To aggregate the local and long-range attentions, instead of adopting different attention mechanisms for different heads [12, 14, 34], we let each query at $i$ -th head attend to the union of keys and values from the local window and global low-rank projections, thus it can learn to select important information from either of them. We find this aggregation strategy works better than separating the heads in our initial trials with the autoregressive language models. Specifically, for the $i$ -th head, we denote the global low-rank projected keys and values as $\bar { K } _ { i } , \bar { V } _ { i } \in \dot { \mathbb { R } ^ { r \times d _ { k } } }$ , and the local keys and values as $\tilde { K } _ { t } , \tilde { \tilde { V } } _ { t } \in \mathbb { R } ^ { 2 w \times d }$ within the local window of position $t$ for the query $Q _ { t }$ . Then the $i$ -th attention $H _ { i , t }$ at position $t$ is
102
+
103
+ $$
104
+ H _ { i , t } = \mathrm { s o f t m a x } \left[ \frac { Q _ { t } W _ { i } ^ { Q } \left[ \tilde { K } _ { t } W _ { i } ^ { K } ; \bar { K } _ { i } \right] ^ { \mathsf { T } } } { \sqrt { d _ { k } } } \right] [ \tilde { V } _ { t } W _ { i } ^ { V } ; \bar { V } _ { i } ] .
105
+ $$
106
+
107
+ where $\left[ \cdot ; \cdot \right]$ denotes concatenating the matrices along the first dimension. Furthermore, we find a scale mismatch between the initial norms of $\tilde { K } _ { t } W _ { i } ^ { K }$ and ${ \bar { K } } _ { i }$ , which biases the attention to the local window at initialization for both language and vision tasks. We introduce a normalization strategy (DualLN) to align the norms and improve the effectiveness of the aggregation in the following.
108
+
109
+ ![](images/f18b82a395374db947c61de1d4db34317ba404018776556822de750fb1f9ea62.jpg)
110
+ Figure 2: Left: Ratios of the average $\ell _ { 2 }$ norms of the local window to global low-rank key/value embeddings at initialization. Without DualLN, the sparse and low-rank embeddings have a magnitude mismatch. With DualLN, the ratios will be 1.0 at every layer, which will facilitate optimization. Right: The validation loss of Transformer-LS with and without DualLN on enwik8 and text8.
111
+
112
+ DualLN: For Transformers with Layer Normalization (LN) (see [44] for an illustration), the $K _ { i } , V _ { i }$ embeddings are the outputs of LN layers, so they have zero mean and unit variance at initialization. The $\ell _ { 2 }$ norm of vectors with zero-mean entries is proportional to their variance in expectation. We note a weighted average will reduce the variance and therefore the norm of such zero-mean vectors. As a result, the embedding vectors from low-rank attention in the weighted average $\bar { K } _ { i } , \bar { V } _ { i }$ of Eq. (3) will have smaller norms than the regular key and value embeddings from sliding window attention (see Figure 2 Left for an illustration). This scale mismatch causes two side effects. First, the inner product $Q _ { t } W _ { i } ^ { Q } { \bar { K } } _ { i } ^ { \mathsf { T } }$ from local-rank component tends to have smaller magnitude than the local window one, thus the attention scores on long-range attention is systematically smaller. Second, the key-value pairs $\bar { K } _ { i } , \bar { V } _ { i }$ for the low-rank attention will naturally have less impact on the direction of $H _ { i }$ even when low-rank and local window are assigned with same attention scores, since $\bar { V } _ { i }$ has smaller norms. Both effects lead to small gradients on the low-rank components and hinders the model from learning to effectively use the long-range correlations.
113
+
114
+ To avoid such issues, we add two sets of Layer Normalizations after the key and value projections for the local window and global low-rank attentions, so that their scales are aligned at initialization, but the network can still learn to re-weight the norms after training. Specifically, the aggregated attention is now computed as
115
+
116
+ $$
117
+ { \cal H } _ { i , t } = \mathrm { s o f t m a x } \left[ \frac { { Q _ { t } W _ { i } ^ { Q } \left[ { \cal L N } _ { L } ( { { \tilde { K } } _ { t } } W _ { i } ^ { K } ) ; { \cal L N } _ { G } ( { { \bar { K } } _ { i } } ) \right] ^ { \top } } } { \sqrt { d _ { k } } } \right] [ { \cal L N } _ { L } ( { { \tilde { V } } _ { t } } W _ { i } ^ { V } ) ; { \cal L N } _ { G } ( { { \bar { V } } _ { i } } ) ] ,
118
+ $$
119
+
120
+ where $\mathrm { L N } _ { L } ( \cdot ) , \mathrm { L N } _ { G } ( \cdot )$ denote the Layer Normalizations for the local and global attentions respectively. In practice, to maintain the consistency between the local attention and dynamic projection, we use $\mathsf { L } \bar { \mathsf { N } } _ { L } ( K ) , \mathsf { L } \mathsf { N } _ { L } ( V )$ instead of $K , V$ to compute $\bar { K } _ { i } , \bar { V } _ { i }$ in Eq. 3. As illustrated in Figure 2 Right, the Transformer-LS models trained with DualLN has consistently lower validation loss than the models without DualLN.
121
+
122
+ # 4 Experiments
123
+
124
+ In this section, we demonstrate the effectiveness and efficiency of our method in both language and vision domains. We use PyTorch for implementation and count the FLOPs using fvcore [45].
125
+
126
+ # 4.1 Bidirectional Modeling on Long Range Arena and IMDb
127
+
128
+ To evaluate Long-Short Transformer as a bidirectional encoder for long text, we train our models on the three NLP tasks, ListOps, Text, and Retrieval, from the recently proposed Long Range Arena (LRA) benchmark [20], following the setting of Peng et al. [30] and Tay et al. [46]. For fair comparisons, we use the PyTorch implementation and the same data preprocessing/split, training hyperparameters and model size from [18], except for Retrieval where we accidentally used more warmup steps and improved the results for all models. See Appendix B for more details. The results on these three tasks are given in Table 1. Results of the other two image-based tasks of LRA, as well as models implemented in JAX, are given in Appendix C and C.2.
129
+
130
+ Table 1: Accuracy $( \% )$ and FLOPs (G) on Long Range Arena (LRA), with the model configs annotated (see Table 7 for more). All results are averages of 4 runs with different random seeds.
131
+
132
+ <table><tr><td>Task (mean ± std.) of sequence length</td><td colspan="2">ListOps (888±339)</td><td colspan="2">Text (1296 ± 893)</td><td colspan="2">Retrieval (3987 ± 560)</td><td>Average</td></tr><tr><td>Model</td><td>Acc.</td><td>FLOPs</td><td>Acc.</td><td>FLOPs</td><td>Acc.</td><td>FLOPs</td><td>Acc.</td></tr><tr><td>Full Attention [1]</td><td>37.13</td><td>1.21</td><td>65.35</td><td>4.57</td><td>82.30</td><td>9.14</td><td>61.59</td></tr><tr><td>Reformer [31] (2)</td><td>36.44</td><td>0.27</td><td>64.88</td><td>0.58</td><td>78.64</td><td>1.15</td><td>59.99</td></tr><tr><td>Linformer [17] (k=256)</td><td>37.38</td><td>0.41</td><td>56.12</td><td>0.81</td><td>79.37</td><td>1.62</td><td>57.62</td></tr><tr><td>Performer [28] (r = 256)</td><td>32.78</td><td>0.41</td><td>65.21</td><td>0.82</td><td>81.70</td><td>1.63</td><td>59.90</td></tr><tr><td>Nystromformer[18](l =128)</td><td>37.34</td><td>0.61</td><td>65.75</td><td>1.02</td><td>81.29</td><td>2.03</td><td>61.46</td></tr><tr><td>Transformer-LS (w,r = 8,32)</td><td>37.50</td><td>0.20</td><td>66.01</td><td>0.40</td><td>81.79</td><td>0.80</td><td>61.77</td></tr><tr><td>Dynamic Projection (best)</td><td>37.79</td><td>0.15</td><td>66.28</td><td>0.69</td><td>81.86</td><td>2.17</td><td>61.98</td></tr><tr><td>Transformer-LS (best)</td><td>38.36</td><td>0.16</td><td>68.40</td><td>0.29</td><td>81.95</td><td>2.17</td><td>62.90</td></tr></table>
133
+
134
+ Table 2: Comparing the robustness of the models under test-time insertions and deletions. DP refers to long-range attention via Dynamic Projection, and Win. refers to sliding window attention.
135
+
136
+ <table><tr><td rowspan="2">Task Test Perturb</td><td colspan="3">Text</td><td colspan="3">Retrieval</td></tr><tr><td>None</td><td>Insertion</td><td>Deletion</td><td>None</td><td>Insertion</td><td>Deletion</td></tr><tr><td>Linformer</td><td>56.12</td><td>55.94</td><td>54.91</td><td>79.37</td><td>53.66</td><td>51.75</td></tr><tr><td>DP</td><td>66.28</td><td>63.16</td><td>58.95</td><td>81.86</td><td>70.01</td><td>64.98</td></tr><tr><td>Linformer+ Win.</td><td>59.63</td><td>56.69</td><td>56.29</td><td>79.68</td><td>52.83</td><td>52.13</td></tr><tr><td>DP + Win. (ours)</td><td>68.40</td><td>66.34</td><td>62.62</td><td>81.95</td><td>69.93</td><td>64.19</td></tr></table>
137
+
138
+ Table 3: Comparing the results of pretrained language models fine-tuned on IMDb.
139
+
140
+ <table><tr><td>Model</td><td>RoBERTa-base RoBERTa-large Longformer-base LS-base LS-large</td><td></td><td></td><td></td><td></td></tr><tr><td> Accuracy</td><td>95.3</td><td>96.5</td><td>95.7</td><td>96.0</td><td>96.8</td></tr></table>
141
+
142
+ In addition, we follow the pretraining procedure of Longformer [14] to pretrain our models based on RoBERTa-base and RoBERTa-large [47], and fine-tune it on the IMDb sentiment classification dataset. The results are given in Table 3.
143
+
144
+ Results. From Table 3, our base model outperforms Longformer-base, and our large model achieves improvements over RoBERTa-large, demonstrating the benefits of learning to model long sequences. Comparisons with models on LRA are given in Table 1. Transformer-LS (best) with the best configurations of $w , r$ for each task are given in Table 7 in Appendix B. We also report the results of using fixed hyperparameter $w = 8 , r = 3 2$ on all tasks. Overall, our Transformer-LS (best) is significantly better than other efficient Transformers, and the model with $w , r = 8 , 3 2$ performs favorably while using only about $50 \%$ to $70 \%$ computation compared to other efficient Transformers on all three tasks. The advantage of aggregating local and long-range attentions is the most significant on ListOps, which requires the model to understand the tree structures involving both long-term and short-term relations. On Retrieval, where document-level encoding capability is tested, we find our global attention more effective than window attention. The test accuracy of using only dynamic projection is about $10 \%$ higher than Linformer on Text (i.e., 66.28 vs. 56.12), which has the highest variance in sequence length (i.e. standard deviation 893). This demonstrates the improved flexibility of dynamic projection at learning representations for data with high variance in sequence length, compared to the learned but fixed projection of Linformer. Similarly, Linformer, Nyströmformer and our model outperform full attention on ListOps, indicating they may have better inductive bias, and efficient Transformers can have better efficacy beyond efficiency.
145
+
146
+ Robustness of Dynamic Projection. In Table 2, we compare the robustness of Linformer and the proposed Dynamic Projection (DP) against insertion and deletion on Text and Retrieval tasks of LRA. We train the models on the original, clean training sets and only perturb their test sets. For insertion, we insert 10 random punctuations at 10 random locations of each test sample. For deletion, we delete all punctuations from the test samples. Both transforms are label-preserving in most cases. By design, dynamic projection is more robust against location changes.
147
+
148
+ ![](images/4e35688918560b95df1faea3ced37447c973045ec764520f5c395363eee27938.jpg)
149
+ Forward-backprop Time per Iteration (Autoregressive LM)
150
+
151
+ ![](images/a333c6dfca964b5bcfe654e6654b8084e932baa4210e0e064ae9391c72990b47.jpg)
152
+ Figure 3: Running time and memory consumption of Transformer-XL (full attention) and our TransformerLS on Char-LM. We increase the sequence length until we use up the 32GB of memory on a V100 GPU. Transformer-LS is the same smaller model in Table 4. We use dashed lines to represent the full attention Transformer and solid lines to represent our model. We use different colors to represent different batch sizes.
153
+
154
+ Table 4: BPC (↓) of smaller models on enwik8 and text8 (left), and larger models on enwik8 (right).
155
+
156
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">#Param</td><td colspan="3">text8</td></tr><tr><td>Dev Test</td><td>enwik8 Dev</td><td>Test</td></tr><tr><td>T12 [49] Transformer-XL [9]</td><td>44M</td><td>1 1.18</td><td>1</td><td>1.11</td></tr><tr><td>Reformer [31]</td><td>41M -</td><td>1 1 - 1</td><td>1 1</td><td>1.06 1.05</td></tr><tr><td>Adaptive [50]</td><td>38M</td><td>1.05 1.11</td><td>1.04</td><td>1.02</td></tr><tr><td>BP-Transformer [51] Longformer [20]</td><td>38M 41M</td><td>1 1.11 1.04 1.10</td><td>1 1.02</td><td>1.02 1.00</td></tr></table>
157
+
158
+ <table><tr><td colspan="3">Method #Param‘ TestBPC</td></tr><tr><td>Transformer-XL [9]</td><td>88M</td><td>1.03 0.99</td></tr><tr><td>Transformer-XL [9] Routing [32]</td><td>277M 223M</td><td>0.99</td></tr><tr><td>Longformer [14]</td><td>102M</td><td>0.99</td></tr><tr><td>Sparse [12]</td><td>95M</td><td>0.99</td></tr><tr><td>Adaptive [50]</td><td>209M</td><td>0.98</td></tr><tr><td>Compressive [10]</td><td>227M</td><td>0.97</td></tr><tr><td>Transformer-LS</td><td>110M</td><td>0.97</td></tr></table>
159
+
160
+ # 4.2 Autoregressive Language Modeling
161
+
162
+ We compare our method with other efficient transformers on the character-level language modeling where each input token is a character.
163
+
164
+ Setup. We train and evaluate our model on enwik8 and text8, each with 100M characters and are divided into 90M, 5M, 5M for train, dev, test, following [48]. Our smaller 12-layer and larger 30-layer models are Pre-LN Transformers with the same width and depth as Longformer [20], except that we add relative position encoding to the projected segments in each layer. We adopt the cache mechanism of Transformer-XL [9], setting the cache size to be the same as the input sequence length. We follow similar training schedule as Longformer, and train our model in 3 phases with increasing sequence lengths. The input sequence lengths are 2048, 4096 and 8192 respectively for the 3 phases. By comparison, Longformer trains their model in 5 phases on GPUs with 48GB memory (The maximal of ours is 32GB) where the sequence length is 23,040 in the last phase. The window size of Longformer increases with depth and its average window size is 4352 in phase 5, while our effective number of attended tokens is 1280 on average in the last phase. Each experiment takes around 8 days to finish on 8 V100 GPUs. Detailed hyperparameters are shown in Appendix D. For testing, same as Longformer, we split the dataset into overlapping sequences of length 32K at a step size of 512, and evaluate the BPCs for predicting the next 512 tokens given the previous 32K characters.
165
+
166
+ Results Table 4 shows comparisons on text8 and enwik8. Our method has achieved state-of-the-art results. On text8, we achieve a test BPC of 1.09 with the smaller model. On enwik8, our smaller model achieves a test BPC of 0.99, and outperforms the state-of-the-art models with comparable number of parameters. Our larger model obtains a test BPC of 0.97, on par with the Compressive Transformer with $2 \times$ parameters. Our results are consistently better than Longformer which is trained on longer sequences with 5 stages and 48 GPU memory. In Figure 3, we show our model is much more memory and computational efficient than full attention.
167
+
168
+ Table 5: Test accuracies on ImageNet, ImageNet Real [52], and ImageNet V2 [53] of models trained on ImageNet-1K. Grey-colored rows are our results. ${ \mathrm { C v T ^ { * } } }$ -LS denotes our long-short term attention based on the non-official CvT implementation. ViL models with LS suffixes are our long-short term attention based on the official ViL implementation with relative positional bias. We also provide the latency of models tested using batch size 32 on the same V100 GPU. Our improvements over ViL is mainly from a better implementation of the short-term attention.
169
+
170
+ <table><tr><td>Model</td><td>(M)</td><td>Size</td><td>#Param Image FLOPs ImageNet (G)</td><td>top-1 (%)</td><td>Real top-1 (%) top-1 (%)</td><td>V2</td><td>Latency (s)</td></tr><tr><td>ResNet-50</td><td>25</td><td>224²</td><td>4.1</td><td>76.2</td><td>82.5</td><td>63.3</td><td>=</td></tr><tr><td>ResNet-101</td><td>45</td><td>2242</td><td>7.9</td><td>77.4</td><td>83.7</td><td>65.7</td><td></td></tr><tr><td>ResNet-152</td><td>60</td><td>2242</td><td>11</td><td>78.3</td><td>84.1</td><td>67.0</td><td>=</td></tr><tr><td>DeiT-S [36]</td><td>22</td><td>224²</td><td>4.6</td><td>79.8</td><td>85.7</td><td>68.5</td><td></td></tr><tr><td>DeiT-B [36]</td><td>86</td><td>2242</td><td>17.6</td><td>81.8</td><td>86.7</td><td>70.9</td><td></td></tr><tr><td>PVT-Medium [5]</td><td>44</td><td>2242</td><td>6.7</td><td>81.2</td><td>1</td><td>1</td><td></td></tr><tr><td>PVT-Large [5]</td><td>61</td><td>2242</td><td>9.8</td><td>81.7</td><td></td><td></td><td></td></tr><tr><td>Swin-S [38]</td><td>50</td><td>2242</td><td>8.7</td><td>83.2</td><td></td><td></td><td></td></tr><tr><td>Swin-B[38]</td><td>88</td><td>2242</td><td>15.4</td><td>83.5</td><td></td><td></td><td>0.115</td></tr><tr><td>PVTv2-B4 [54]</td><td>62.6</td><td>2242</td><td>10.1</td><td>83.6</td><td></td><td></td><td></td></tr><tr><td>PVTv2-B5 [54]</td><td>82.0</td><td>2242</td><td>11.8</td><td>83.8</td><td></td><td></td><td></td></tr><tr><td>ViT-B/16 [4]</td><td>86</td><td>3842</td><td>55.5</td><td>77.9</td><td></td><td></td><td></td></tr><tr><td>ViT-L/16 [4]</td><td>307</td><td>3842</td><td>191.1</td><td>76.5</td><td></td><td></td><td></td></tr><tr><td>DeiT-B [36]</td><td>86</td><td>3842</td><td>55.5</td><td>83.1</td><td></td><td></td><td></td></tr><tr><td>Swin-B [38]</td><td>88</td><td>3842</td><td>47.1</td><td>84.5</td><td>1</td><td>1</td><td>0.378</td></tr><tr><td>CvT-13 [6]</td><td>20</td><td>2242</td><td>6.7</td><td>81.6</td><td>86.7</td><td>70.4</td><td>0.122</td></tr><tr><td>CvT-21 [6]</td><td>32</td><td>2242</td><td>10.1</td><td>82.5</td><td>87.2</td><td>71.3</td><td>0.165</td></tr><tr><td>CvT*-LS-13</td><td>20.3</td><td>2242</td><td>4.9</td><td>81.9</td><td>87.0</td><td>70.5</td><td>0.083</td></tr><tr><td>CvT*-LS-17</td><td>23.7</td><td>2242</td><td>9.8</td><td>82.5</td><td>87.2</td><td>71.6</td><td>-</td></tr><tr><td>CvT*-LS-21</td><td>32.1</td><td>224²</td><td>7.9</td><td>82.7</td><td>87.5</td><td>71.9</td><td>0.122</td></tr><tr><td>CvT*-LS-21S</td><td>30.1</td><td>2242</td><td>11.3</td><td>82.9</td><td>87.4</td><td>71.7</td><td>-</td></tr><tr><td>CvT-13 [6]</td><td>20</td><td>3842</td><td>31.9</td><td>83.0</td><td>87.9</td><td>71.9</td><td>1</td></tr><tr><td>CvT-21 [6]</td><td>32</td><td>3842</td><td>45.0</td><td>83.3</td><td>87.7</td><td>71.9</td><td></td></tr><tr><td>CvT*-LS-21</td><td>32.1</td><td>3842</td><td>23.9</td><td>83.2</td><td>88.0</td><td>72.5</td><td></td></tr><tr><td>CvT*-LS-21</td><td>32.1</td><td>4482</td><td>34.2</td><td>83.6</td><td>88.2</td><td>72.9</td><td></td></tr><tr><td>ViL-Small [14]</td><td>24.6</td><td>2242</td><td>4.9</td><td>82.4</td><td>-</td><td>1</td><td></td></tr><tr><td>ViL-Medium [14]</td><td>39.7</td><td>2242</td><td>8.7</td><td>83.5</td><td></td><td></td><td>0.106</td></tr><tr><td>ViL-Base [14]</td><td>55.7</td><td>2242</td><td>13.4</td><td>83.7</td><td></td><td></td><td>0.164</td></tr><tr><td>ViL-LS-Medium</td><td>39.8</td><td>2242</td><td>8.7</td><td>83.8</td><td></td><td></td><td>0.075</td></tr><tr><td>ViL-LS-Base</td><td>55.8</td><td>224²</td><td>13.4</td><td>84.1</td><td></td><td></td><td>0.113</td></tr><tr><td> ViL-LS-Medium</td><td>39.9</td><td>3842</td><td>28.7</td><td>84.4</td><td></td><td></td><td>0.271</td></tr></table>
171
+
172
+ # 4.3 ImageNet Classification
173
+
174
+ We train and evaluate the models on ImageNet-1K with $1 . 3 \mathbf { M }$ images and 1K classes. We use CvT [6] and ViL [11], state-of-the art vision transformer architectures, as the backbones and replace their attention mechanisms with our long-short term attention, denoted as ${ \mathrm { C v T ^ { * } } }$ -LS and ViL-size-LS in Table 5. CvT uses overlapping convolutions to extract dense patch embeddings from the input images and feature maps, resulting in a long sequence length in the early stages (e.g., $5 6 \times 5 6 = 3 1 3 6$ patches for images with $2 2 4 ^ { 2 }$ pixels). For ViL, our sliding window uses the same group size $w$ , but each token attends to at most $2 w \times 2 w$ (rounding when necessary) tokens inside the window, instead of $3 w \times 3 w$ as ViL, which allows adding our dynamic projection without increasing the FLOPs. We set $r = 8$ for the dynamic projections for both ViL-LS-Medium and ViL-LS-Base. Note that, our efficient attention mechanism does not depend on the particular architecture, and it can be applied to other vision transformers [e.g., 4, 36, 5]. Please refer to Appendix E for more details.
175
+
176
+ Classification Results. The results are shown in the Table 5, where we also list test accuracies on ImageNet Real and ImageNet V2. Except for CvT, we compare with the original ViT [4] and the enhanced DeiT [36], PVT [5] that also uses multi-scale stragey, ViL [11] that uses window attention and global tokens to improve the efficiency. Training at high-resolution usually improves the test accuracy of vision transformer. With our long-short term attention, we can easily scale the training to higher resolution, and the performance of ${ \mathrm { C v T ^ { * } } }$ -LS and ViL-LS also improves. Our best model with CvT ${ \mathrm { C v T ^ { * } } }$ -LS-21 at $4 4 { \bar { 8 } } ^ { 2 }$ ) achieves $0 . 3 \%$ higher accuracy than the best reported result of CvT while using the same amount of parameters and $76 \%$ of its FLOPs. In CvT architecture, the spatial dimension of feature maps in earlier stages are large, representing more fine-grained details of the image. Similar to training with high-resolution images, the model should also benefit from denser feature maps. With our efficient long-short term attention, we can better utilize these fine-grained feature maps with less concerns about the computational budget. In this way, our ${ \mathrm { C v T ^ { * } } }$ -LS-17 achieves better result than CvT-21 at resolution 224 using fewer parameters and FLOPs, and our ${ \mathrm { C v T ^ { * } } }$ -LS-21S model further improves our ${ \mathrm { C v T ^ { * } } }$ -LS-21 model.
177
+
178
+ Table 6: Robustness evaluation on various ImageNet datasets. Top-1/Acc.: Top-1 accuracy. mCE: Mean Corrupution Error. Mixed-same/Mixed-rand: accuracies on MIXED-SAME/MIXED-RAND subsets.
179
+
180
+ <table><tr><td>Model</td><td colspan="5">[Params|ImageNet|IN-C [56]|IN-A [57]|IN-R [58]]</td><td colspan="2">ImageNet-9 [59]</td></tr><tr><td></td><td>(M)</td><td>Top-1</td><td>mCE(↓)</td><td>Acc.</td><td>Acc.</td><td>|Mixed-same Mixed-rand</td><td></td></tr><tr><td>ResNet-50 [35]]</td><td>25.6</td><td>76.2</td><td>78.9</td><td>6.2</td><td>35.3</td><td>87.1</td><td>81.6</td></tr><tr><td>DeiT-S [36]</td><td>22.1</td><td>79.8</td><td>57.1</td><td>19.0</td><td>41.9</td><td>89.1</td><td>84.2</td></tr><tr><td>CvT-13</td><td>20</td><td>81.6</td><td>59.6</td><td>25.4</td><td>42.9</td><td>90.5</td><td>85.7</td></tr><tr><td>CvT-21</td><td>32</td><td>82.5</td><td>56.2</td><td>31.1</td><td>42.6</td><td>90.5</td><td>85.0</td></tr><tr><td>CvT*-LS-13</td><td>20.3</td><td>81.9</td><td>58.7</td><td>27.0</td><td>42.6</td><td>90.7</td><td>85.6</td></tr><tr><td>CvT*-LS-21</td><td>32.1</td><td>82.7</td><td>55.2</td><td>29.3</td><td>45.0</td><td>91.5</td><td>85.8</td></tr></table>
181
+
182
+ Our ViL-LS-Medium and ViL-LS-Base with long-short term attention improve the accuracies of ViL-Medium and ViL-Base from 83.5 and 83.7 to 83.8 and 84.1 respectively, without an increase in FLOPs. When increasing the resolution for training ViL-LS-Medium from $\dot { 2 } 2 4 ^ { 2 }$ to $3 8 4 ^ { 2 }$ , the FLOPs increased (approximately) linearly and the accuracy improved by $0 . 6 \%$ , showing our method still benefits greatly from increased resolution while maintaining the linear complexity in practice.
183
+
184
+ Short-term Attention Suppresses Oversmoothing. By restricting tokens from different segments to attend to different windows, our short-term sparse local attention encourages diversity of the feature representations and helps to alleviate the over-smoothing problem [55] (where all queries extract similar information in deeper layers and the attention mechanism is less important), thus can fully utilize the depth of the network. As in [55], we provide the cosine similarity of patch embeddings of our ${ \mathrm { C v T ^ { * } } }$ -LS-13 and re-implemented CvT-13 (81.1 accuracy) in Figure 6 within Appendix. This is one of the reasons why our efficient attention mechanism can get even better results than the full attention CvT model in the same setting.
185
+
186
+ Robustness evaluation on Diverse ImageNet Datasets. As vision models have been widely used in safety-critical applications (e.g. autonomous driving), their robustness is vital. In addition to out-of-distribution robustness (ImageNet-Real and Imageet-v2), we further investigate the robustness of our vision transformer against common corruption (ImageNet-C), semantic shifts (ImageNet-R), Background dependence (ImageNet-9) and natural adversarial examples (ImageNet-A). We compare our methods with standard classification methods, including CNN-based model (ResNet [35]) and Transformer-based models (DeiT [36]) with similar numbers of parameters. As shown in Table 6, we observe that our method significantly outperforms the CNN-based method (ResNet-50). Compared to DeiT, our models also achieve favorable improvements. These results indicate that the design of different attention mechanisms plays an important role for model robustness, which sheds new light on the design of robust vision transformers. More details and results can be found in Appendix E.
187
+
188
+ # 5 Conclusion
189
+
190
+ In this paper, we introduced Long-Short Transformer, an efficient transformer for long sequence modeling for both language and vision domain, including both bidirectional and autoregressive models. We design a novel global attention mechanism with linear computational and memory complexity in sequence length based on a dynamic projection. We identify the scale mismatch issue and propose the DualLN technique to eliminate the mismatch at initialization and more effectively aggregate the local and global attentions. We demonstrate that our method obtains the state-of-the-art results on the Long Range Arena, char-level language modeling and ImageNet classification. We look forward to extending our methods to more domains, including document QA, object detection and semantic segmentation on high-resolution images.
191
+
192
+ References
193
+ [1] 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, volume 30, 2017.
194
+ [2] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. NAACL, 2019.
195
+ [3] 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.
196
+ [4] 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, 2021.
197
+ [5] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
198
+ [6] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv preprint arXiv:2103.15808, 2021.
199
+ [7] Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. TACL, 7:453–466, 2019.
200
+ [8] Raghavendra Pappagari, Piotr Zelasko, Jesús Villalba, Yishay Carmiel, and Najim Dehak. Hierarchical transformers for long document classification. In 2019 IEEE Automatic Speech Recognition and Understanding Workshop (ASRU), pages 838–844. IEEE, 2019.
201
+ [9] Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL, 2019.
202
+ [10] Jack W Rae, Anna Potapenko, Siddhant M Jayakumar, and Timothy P Lillicrap. Compressive Transformers for long-range sequence modelling. In ICLR, 2020.
203
+ [11] Pengchuan Zhang, Xiyang Dai, Jianwei Yang, Bin Xiao, Lu Yuan, Lei Zhang, and Jianfeng Gao. Multiscale vision longformer: A new vision transformer for high-resolution image encoding. arXiv preprint arXiv:2103.15358, 2021.
204
+ [12] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
205
+ [13] Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In ICML, pages 4055–4064, 2018.
206
+ [14] Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
207
+ [15] Joshua Ainslie, Santiago Ontanon, Chris Alberti, Vaclav Cvicek, Zachary Fisher, Philip Pham, Anirudh Ravula, Sumit Sanghai, Qifan Wang, and Li Yang. Etc: Encoding long and structured inputs in transformers. In EMNLP, pages 268–284, 2020.
208
+ [16] Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, et al. Big Bird: Transformers for longer sequences. In NeurIPS, 2020.
209
+ [17] Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
210
+ [18] Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh. Nyströmformer: A nyström-based algorithm for approximating self-attention. AAAI, 2021.
211
+ [19] Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking self-attention in transformer models. In ICML, 2021.
212
+ [20] Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long Range Arena: A benchmark for efficient transformers. In ICLR, 2021.
213
+ [21] Pengchuan Zhang, Xiyang Dai, Jianwei Yang, Bin Xiao, Lu Yuan, Lei Zhang, and Jianfeng Gao. Multiscale vision longformer: A new vision transformer for high-resolution image encoding. arXiv preprint arXiv:2103.15358, 2021.
214
+ [22] 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.
215
+ [23] Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with vq-vae-2. arXiv preprint arXiv:1906.00446, 2019.
216
+ [24] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021.
217
+ [25] Jonathan Ho, Nal Kalchbrenner, Dirk Weissenborn, and Tim Salimans. Axial attention in multidimensional transformers. arXiv preprint arXiv:1912.12180, 2019.
218
+ [26] Jiezhong Qiu, Hao Ma, Omer Levy, Scott Wen-tau Yih, Sinong Wang, and Jie Tang. Blockwise selfattention for long document understanding. arXiv preprint arXiv:1911.02972, 2019.
219
+ [27] 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 ICML, 2019.
220
+ [28] Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. ICLR, 2021.
221
+ [29] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, 2020.
222
+ [30] Hao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz, Noah A Smith, and Lingpeng Kong. Random feature attention. ICLR, 2021.
223
+ [31] Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In ICLR, 2020.
224
+ [32] Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. TACL, 9:53–68, 2021.
225
+ [33] Yi Tay, Dara Bahri, Liu Yang, Donald Metzler, and Da-Cheng Juan. Sparse sinkhorn attention. In ICML. PMLR, 2020.
226
+ [34] Zhanghao Wu, Zhijian Liu, Ji Lin, Yujun Lin, and Song Han. Lite transformer with long-short range attention. arXiv preprint arXiv:2004.11886, 2020.
227
+ [35] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
228
+ [36] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
229
+ [37] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
230
+ [38] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021.
231
+ [39] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021.
232
+ [40] Ashish Vaswani, Prajit Ramachandran, Aravind Srinivas, Niki Parmar, Blake Hechtman, and Jonathon Shlens. Scaling local self-attention for parameter efficient visual backbones. arXiv preprint arXiv:2103.12731, 2021.
233
+ [41] Andrew Jaegle, Felix Gimeno, Andrew Brock, Andrew Zisserman, Oriol Vinyals, and Joao Carreira. Perceiver: General perception with iterative attention. arXiv preprint arXiv:2103.03206, 2021.
234
+ [42] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML. PMLR, 2020.
235
+ [43] Hao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz, Noah A Smith, and Lingpeng Kong. Random feature attention. ICLR, 2021.
236
+ [44] Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tieyan Liu. On layer normalization in the transformer architecture. In ICML. PMLR, 2020.
237
+ [45] fvcore: Flop counter for pytorch models. https://github.com/facebookresearch/fvcore/blob/ master/docs/flop_count.md, 2021.
238
+ [46] Yi Tay, Mostafa Dehghani, Vamsi Aribandi, Jai Gupta, Philip Pham, Zhen Qin, Dara Bahri, Da-Cheng Juan, and Donald Metzler. Omninet: Omnidirectional representations from transformers. ICML, 2021.
239
+ [47] 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.
240
+ [48] Matt Mahoney. Large text compression benchmark. URL http://mattmahoney.net/dc/textdata, 6, 2009.
241
+ [49] Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. Character-level language modeling with deeper self-attention. In AAAI, volume 33, pages 3159–3166, 2019.
242
+ [50] Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. ACL, 2019.
243
+ [51] Zihao Ye, Qipeng Guo, Quan Gan, Xipeng Qiu, and Zheng Zhang. Bp-transformer: Modelling long-range context via binary partitioning. arXiv preprint arXiv:1911.04070, 2019.
244
+ [52] Lucas Beyer, Olivier J Hénaff, Alexander Kolesnikov, Xiaohua Zhai, and Aäron van den Oord. Are we done with imagenet? arXiv preprint arXiv:2006.07159, 2020.
245
+ [53] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, pages 5389–5400. PMLR, 2019.
246
+ [54] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pvtv2: Improved baselines with pyramid vision transformer. 2021.
247
+ [55] Chengyue Gong, Dilin Wang, Meng Li, Vikas Chandra, and Qiang Liu. Improve vision transformers training by suppressing over-smoothing. arXiv preprint arXiv:2104.12753, 2021.
248
+ [56] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019.
249
+ [57] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019.
250
+ [58] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020.
251
+ [59] Kai Xiao, Logan Engstrom, Andrew Ilyas, and Aleksander Madry. Noise or signal: The role of image backgrounds in object recognition. ArXiv preprint arXiv:2006.09994, 2020.
252
+ [60] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In CVPR, 2015.
253
+ [61] Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In AISTATS, 2010.
254
+ [62] Nikita Nangia and Samuel Bowman. Listops: A diagnostic dataset for latent tree learning. In NAACL: Student Research Workshop, pages 92–99, 2018.
255
+ [63] Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ , and Christopher Potts. Learning word vectors for sentiment analysis. In ACL, 2011.
256
+ [64] Dragomir R Radev, Pradeep Muthukrishnan, Vahed Qazvinian, and Amjad Abu-Jbara. The acl anthology network corpus. Language Resources and Evaluation, 47(4):919–944, 2013.
257
+ [65] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
258
+ [66] François Chollet. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1251–1258, 2017.
259
+ [67] Lei Huang, Xianglong Liu, Yang Liu, Bo Lang, and Dacheng Tao. Centered weight normalization in accelerating training of deep neural networks. In Proceedings of the IEEE International Conference on Computer Vision, pages 2803–2811, 2017.
260
+ [68] Siyuan Qiao, Huiyu Wang, Chenxi Liu, Wei Shen, and Alan Yuille. Micro-batch training with batch-channel normalization and weight standardization. arXiv preprint arXiv:1903.10520, 2019.
md/train/MbM_gvIB3Y4/MbM_gvIB3Y4.md ADDED
@@ -0,0 +1,459 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WHICH MUTUAL-INFORMATION REPRESENTATION LEARNING OBJECTIVES ARE SUFFICIENT FOR CONTROL?
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Mutual information maximization provides an appealing formalism for learning representations of data. In the context of reinforcement learning, such representations can accelerate learning by discarding irrelevant and redundant information, while retaining the information necessary for control. Much of the prior work on these methods has addressed the practical difficulties of estimating mutual information from samples of high-dimensional observations, while comparatively less is understood about which mutual information objectives are sufficient for reinforcement learning (RL) from a theoretical perspective. In this paper we identify conditions under which representations that maximize specific mutual-information objectives are theoretically sufficient for learning and representing the optimal policy. Somewhat surprisingly, we find that several popular objectives can yield insufficient representations given mild and common assumptions on the structure of the MDP. We corroborate our theoretical results with empirical results experiments on a simulated game environment with visual observations.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ While deep reinforcement learning (RL) algorithms are capable of learning policies from highdimensional observations, such as images (Mnih et al., 2013; Lee et al., 2019; Kalashnikov et al., 2018), in practice policy learning faces a bottleneck in acquiring useful representations of the observation space (Shelhamer et al., 2016). State representation learning approaches aim to remedy this issue by learning structured and compact representations on which to perform RL. While a wide range of representation learning objectives have been proposed (Lesort et al., 2018), a particularly appealing class of methods that is amenable to rigorous analysis is based on maximizing mutual information (MI) between variables. In the unsupervised learning setting, this is often realized as the InfoMax principle (Linsker, 1988; Bell & Sejnowski, 1995), which maximizes the mutual information between the input and its latent representation subject to domain-specific constraints. This approach has been widely applied in unsupervised learning in the domains of image, audio, and natural language understanding (Oord et al., 2018; Hjelm et al., 2018; Ravanelli & Bengio, 2019). In RL, the variables of interest for MI maximization are sequential states, actions, and rewards (see Figure 1). As we will discuss, several popular methods for representation learning in RL involve mutual information maximization with different combinations of these variables (Anand et al., 2019; Oord et al., 2018; Pathak et al., 2017; Shelhamer et al., 2016).
12
+
13
+ A useful representation should retain the factors of variation that are necessary to learn and represent the optimal policy or the optimal value function, and discard irrelevant and redundant information. While much prior work has focused on the problem of how to optimize various mutual information objectives in high dimensions (Song & Ermon, 2019; Belghazi et al., 2018; Oord et al., 2018; Hjelm et al., 2018), we focus instead on whether the representations that maximize these objectives are actually theoretically sufficient for learning and representing the optimal policy or value function. We find that some commonly used objectives are insufficient given relatively mild and common assumptions on the structure of the MDP, and identify other objectives which are sufficient. We show these results theoretically and illustrate the analysis empirically in didactic examples in which MI can be computed exactly. Our results provide some guidance to the deep RL practitioner on when and why objectives may be expected to work well or fail, and also provide a framework to analyze newly proposed representation learning objectives based on MI. To investigate how our theoretical results pertain to deep RL, we compare the performance of RL agents in a simulated game trained with state representations learned by maximizing the MI objective given visual inputs. The experimental results corroborate our theoretical findings, and demonstrate that the sufficiency of a representation can have a substantial impact on the performance of an RL agent that uses that representation.
14
+
15
+ # 2 RELATED WORK
16
+
17
+ In this paper, we analyze several widely used mutual information objectives for control. In this section we first review MI-based unsupervised learning, then the application of these techniques to the RL setting. Finally, we discuss alternative perspectives on representation learning in RL.
18
+
19
+ Mutual information-based unsupervised learning. Mutual information-based methods are particularly appealing for representation learning as they admit both rigorous analysis and intuitive interpretation. Tracing its roots to the InfoMax principle (Linsker, 1988; Bell & Sejnowski, 1995), a common technique is to maximize the MI between the input and its latent representation subject to domain-specific constraints (Becker & Hinton, 1992). This technique has been applied to learn representations for natural language (Devlin et al., 2019), video (Sun et al., 2019), and images (Bachman et al., 2019; Hjelm et al., 2018). A major challenge to using MI maximization methods in practice is the difficulty of estimating MI from samples (McAllester & Statos, 2018) and with high-dimensional inputs (Song & Ermon, 2019). Much recent work has focused on improving MI estimation via variational methods (Song & Ermon, 2019; Poole et al., 2019; Oord et al., 2018; Belghazi et al., 2018). In this work we are concerned with analyzing the MI objectives, and not the estimation method. In our experiments with image observations, we make use of noise contrastive estimation methods (Gutmann & Hyvarinen, 2010), though other choices could also suffice.¨
20
+
21
+ Mutual information objectives in RL. Reinforcement learning adds aspects of temporal structure and control to the standard unsupervised learning problem discussed above (see Figure 1). This structure can be leveraged by maximizing MI between sequential states, actions, or combinations thereof. Some works omit the action, maximizing the MI between current and future states (Anand et al., 2019; Oord et al., 2018; Stooke et al., 2020). Much prior work learns latent forward dynamics models (Watter et al., 2015; Karl et al., 2016; Zhang et al., 2018b; Hafner et al., 2019; Lee et al., 2019), related to the forward information objective we introduce in Section 4. Multi-step inverse models, closely related to the inverse information objective (Section 4), have been used to learn control-centric representations (Yu et al., 2019; Gregor et al., 2016). Single-step inverse models have been deployed as regularization of forward models (Zhang et al., 2018a; Agrawal et al., 2016) and as an auxiliary loss for policy gradient RL Shelhamer et al. (2016); Pathak et al. (2017). The MI objectives that we study have also been used as reward bonuses to improve exploration, without impacting the representation, in the form of empowerment (Klyubin et al., 2008; 2005; Mohamed & Rezende, 2015; Leibfried et al., 2019) and information-theoretic curiosity (Still & Precup, 2012).
22
+
23
+ Representation learning for reinforcement learning. In RL, the problem of finding a compact state space has been studied as state aggregation or abstraction (Bean et al., 1987; Li et al., 2006). Abstraction schemes include bisimulation (Givan et al., 2003), homomorphism (Ravindran & Barto, 2003), utile distinction (McCallum, 1996), and policy irrelevance (Jong & Stone, 2005). While efficient algorithms exist for MDPs with known transition models for some abstraction schemes such as bisimulation (Ferns et al., 2006; Givan et al., 2003), in general obtaining error-free abstractions is highly impractical for most problems of interest. For approximate abstractions prior work has bounded the sub-optimality of the policy (Bertsekas et al., 1988; Dean & Givan, 1997; Abel et al., 2016) as well as the sample efficiency (Lattimore & Szepesvari, 2019; Van Roy & Dong, 2019; Du et al., 2019), with some results extending to the deep learning setting (Gelada et al., 2019; Nachum et al., 2018). In this paper, we focus on whether a representation can be used to learn the optimal policy, and not the tractability of learning. Alternatively, priors based on the structure of the physical world can be used to guide representation learning (Jonschkowski & Brock, 2015). In deep RL, many auxiliary objectives distinct from the objectives that we study have been proposed, including meta-learning general value functions (Veeriah et al., 2019), predicting multiple value functions (Bellemare et al., 2019; Fedus et al., 2019; Jaderberg et al., 2016) and predicting domainspecific measurements (Mirowski, 2019; Dosovitskiy & Koltun, 2016). We restrict our analysis to objectives that can be expressed as MI-maximization.
24
+
25
+ # 3 REPRESENTATION LEARNING FOR RL
26
+
27
+ The goal of representation learning for RL is to learn a compact representation of the state space that discards irrelevant and redundant information. In this section we formalize each part of this statement, starting with defining the RL problem and representation learning in the context of RL. We then propose and define the metric of sufficiency to evaluate the usefulness of a representation.
28
+
29
+ # 3.1 PRELIMINARIES
30
+
31
+ We begin with brief preliminaries of reinforcement learning and mutual information.
32
+
33
+ Reinforcement learning. A Markov decision process (MDP) is defined by the tuple $( \boldsymbol { S } , \boldsymbol { A } , \boldsymbol { T } , \boldsymbol { r } )$ , where $s$ is the set of states, $\mathcal { A }$ the set of actions, $\mathcal { T } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } [ 0 , 1 ]$ the state transition distribution, and $r : S \times \mathcal { A } \times \mathcal { S } \mathbb { R }$ the reward function. We will use capital letters to refer to random variables and lower case letters to refer to values of those variables (e.g., $S$ is the random variable for the state and s is a specific state). Throughout our analysis we will often be interested in multiple reward functions, and denote a set of reward functions as $\mathcal { R }$ . The objective of RL is to find a policy that maximizes the sum of discounted returns $\bar { R }$ for a given reward function $r$ , and we denote this optimal policy as $\begin{array} { r } { \pi _ { r } ^ { * } = \arg \operatorname* { m a x } _ { \pi } \mathbb { E } _ { \pi } [ \sum _ { t } \gamma ^ { t } r ( S _ { t } , A _ { t } ) ] } \end{array}$ for discount factor $\gamma$ . We also define the optimal $Q$ -function as $\begin{array} { r } { Q _ { r } ^ { \ast } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) = \mathbb { E } _ { \pi ^ { \ast } } [ \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r ( S _ { t } , { \cal A } _ { t } ) | \mathbf { s } _ { t } , \mathbf { a } _ { t } ] } \end{array}$ . The optimal $Q$ -function satisfies the recursive Bellman equation, $\begin{array} { r } { Q _ { r } ^ { * } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) = r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) + \gamma \mathbb { E } _ { p ( \mathbf { s } _ { t + 1 } \mid \mathbf { s } _ { t } , \mathbf { a } _ { t } ) } } \end{array}$ arg maxat+1 Q∗r(st+1, at+1). The optimal policy and the optimal Q-function are related according to $\pi ^ { * } ( { \mathbf { s } } ) = \arg \operatorname* { m a x } _ { \mathbf { a } } Q ^ { * } ( { \mathbf { s } } , { \mathbf { a } } )$ .
34
+
35
+ Mutual information. In information theory, the mutual information (MI) between two random variables, $X$ and $Y$ , is defined as (Cover, 1999):
36
+
37
+ $$
38
+ I ( X ; Y ) = \mathbb { E } _ { p ( x , y ) } \log { \frac { p ( x , y ) } { p ( x ) p ( y ) } } = H ( X ) - H ( X | Y ) .
39
+ $$
40
+
41
+ The first definition indicates that MI can be understood as a relative entropy (or KL-divergence), while the second underscores the intuitive notion that MI measures the reduction in the uncertainty of one random variable from observing the value of the other.
42
+
43
+ Representation learning for RL. The goal of representation learning for RL is to find a compact representation of the state space that discards details in the state that are not relevant for representing the policy or value function, while preserving task-relevant information (see Figure 1). While state aggregation methods typically define deterministic rules to group states in the representation (Bean et al., 1987; Li et al., 2006), MI-based representation learning methods used for deep RL treat the representation as a random variable (Nachum et al., 2018; Oord et al., 2018; Pathak et al., 2017). Accordingly, we formalize a representation as a stochastic mapping between original state space and representation space.
44
+
45
+ Definition 1. A stochastic representation $\phi _ { \mathcal { Z } }$ (s) is a mapping from states $\mathbf { s } \in { \mathcal { S } }$ to a probability distribution $p ( Z | S = \mathbf { s } )$ ) over elements of a new representation space $z \in { \mathcal { Z } }$ .
46
+
47
+ ![](images/9e662ae63ac9fbc6afeb4c3d7af340b019c69d98dc1c935dd61bd7067e1c2111.jpg)
48
+ Figure 1: Probabilistic graphical model illustrating the state representation learning problem, estimating state representation $Z$ from original state $S$ .
49
+
50
+ In this work we consider learning state representations from data by maximizing an objective $\mathbb { J }$ Given an objective $\mathbb { J }$ , we define the set of representations that maximize this objective as $\Phi _ { \mathbb { J } } =$ $\{ \phi _ { \mathcal { Z } } \}$ s.t. $\phi _ { \mathcal { Z } } \in \arg \operatorname* { m a x } \mathbb { J } ( \phi )$ .
51
+
52
+ Unlike problem formulations for partially observed settings (Watter et al., 2015; Hafner et al., 2019; Lee et al., 2019), we assume that $S$ is a Markovian state; therefore the representation for a given state is conditionally independent of the past states, a common assumption in the state aggregation literature (Bean et al., 1987; Li et al., 2006). See Figure 1 for a depiction of the graphical model.
53
+
54
+ # 3.2 SUFFICIENT REPRESENTATIONS FOR REINFORCEMENT LEARNING
55
+
56
+ We now turn to the problem of evaluating stochastic representations for RL. Intuitively, we expect a useful state representation to be capable of representing the optimal policy in the original state space.
57
+
58
+ Definition 2. A representation $\phi _ { \mathcal { Z } }$ is $\pi ^ { * }$ -sufficient with respect to a set of reward functions $\mathcal { R }$ if $\forall r \in \mathcal R$ , $\phi _ { \mathcal { Z } } ( \mathbf { s } _ { 1 } ) = \phi _ { \mathcal { Z } } ( \mathbf { s } _ { 2 } ) \implies \pi _ { r } ^ { * } ( A | \mathbf { s } _ { 1 } ) = \pi _ { r } ^ { * } ( A | \mathbf { s } _ { 2 } )$ .
59
+
60
+ When a stochastic representation $\phi _ { \mathcal { Z } }$ produces the same distribution over the representation space for two different states ${ \bf s } _ { 1 }$ and $\mathbf { s } _ { 2 }$ we say it aliases these states. Unfortunately, as already proven in Theorem 4 of Li et al. (2006) for the more restrictive case of deterministic representations, being able to represent the optimal policy does not guarantee that it can be learned via RL in the representation space. Accordingly, we define a stricter notion of sufficiency that does guarantee the convergence of Q-learning to the optimal policy in the original state space (refer to Theorem 4 of Li et al. (2006) for the proof of this).
61
+
62
+ Definition 3. A representation $\phi _ { \mathcal { Z } }$ is $Q ^ { * }$ -sufficient with respect to a set of reward functions $\mathcal { R }$ if $\forall r \in { \mathcal { R } }$ $\mathcal { R } , \phi _ { \mathcal { Z } } ( \mathbf { s } _ { 1 } ) = \phi _ { \mathcal { Z } } ( \mathbf { s } _ { 2 } ) \implies \forall \mathbf { a } , Q _ { r } ^ { * } ( \mathbf { a } , \mathbf { s } _ { 1 } ) = Q _ { r } ^ { * } ( \mathbf { a } , \mathbf { s } _ { 2 } )$ .
63
+
64
+ Note that $Q ^ { * }$ -sufficiency implies $\pi ^ { * }$ -sufficiency since the optimal policy and the optimal Q-function are directly related via $\begin{array} { r } { \pi _ { r } ^ { * } ( s ) = \arg \operatorname* { m a x } _ { a } Q _ { r } ^ { * } ( s , a ) } \end{array}$ (Sutton $\&$ Barto, 2018); however the converse is not true. We emphasize that while $Q ^ { * }$ -sufficiency guarantees convergence, it does not guarantee tractability, which has been explored in prior work (Lattimore & Szepesvari, 2019; Du et al., 2019).
65
+
66
+ We will further say that an objective $\mathbb { J }$ is sufficient with respect to some set of reward functions $\mathcal { R }$ if all the representations that maximize that objective $\Phi _ { \mathbb { J } }$ are sufficient with respect to every element of $\mathcal { R }$ according to the definition above. Surprisingly, we will demonstrate that not all commonly used objectives satisfy this basic qualification even when $\mathcal { R }$ contains a single known reward function.
67
+
68
+ # 4 MUTUAL INFORMATION FOR REPRESENTATION LEARNING IN RL
69
+
70
+ In our study, we consider several MI objectives proposed in the literature.
71
+
72
+ Forward information: A commonly sought characteristic of a state representation is to ensure it retains maximum predictive power over future state representations. This property is satisfied by representations maximizing the following MI objective,
73
+
74
+ $$
75
+ \mathbb { J } _ { f w d } = I ( Z _ { t + k } ; Z _ { t } , A _ { t } ) = H ( Z _ { t + k } ) - H ( Z _ { t + k } | Z _ { t } , A _ { t } ) .
76
+ $$
77
+
78
+ We suggestively name this objective “forward information” due to the second term, which is the entropy of the forward dynamics distribution. This objective is related to that proposed in Nachum et al. (2018), where they consider a sequence of actions.
79
+
80
+ State-only transition information: Several popular methods (Oord et al., 2018; Anand et al., 2019; Stooke et al., 2020) optimize a similar objective, but do not include the action 1:
81
+
82
+ $$
83
+ \mathbb { J } _ { s t a t e } = I ( Z _ { t + k } ; Z _ { t } ) = H ( Z _ { t + k } ) - H ( Z _ { t + k } | Z _ { t } ) .
84
+ $$
85
+
86
+ As we will show, the exclusion of the action can have a profound effect on the characteristics of the resulting representations.
87
+
88
+ Inverse information: Another commonly sought characteristic of state representations is to retain maximum predictive power of the action distribution that could have generated an observed transition from $\mathbf { s } _ { t }$ to $\mathbf { s } _ { t + 1 }$ . Such representations can be learned by maximizing the following information theoretic objective:
89
+
90
+ $$
91
+ \mathbb { J } _ { i n v } = I ( A _ { t } ; Z _ { t + k } | Z _ { t } ) = H ( A _ { t } | Z _ { t } ) - H ( A _ { t } | Z _ { t } , Z _ { t + k } )
92
+ $$
93
+
94
+ We suggestively name this objective “inverse information” due to the second term, which is the entropy of the inverse dynamics. A wide range of prior work learns representations by optimizing closely related objectives (Gregor et al., 2016; Shelhamer et al., 2016; Agrawal et al., 2016; Pathak et al., 2017; Yu et al., 2019; Zhang et al., 2018a). Intuitively, inverse models allow the representation to capture only the elements of the state that are necessary to predict the action, allowing the discard of potentially irrelevant information.
95
+
96
+ # 5 SUFFICIENCY ANALYSIS
97
+
98
+ In this section we analyze the sufficiency for control of representations obtained by maximizing each objective presented in Section 4. To focus on the representation learning problem, we decouple it from RL by assuming access to a dataset of transitions collected with a policy that reaches all states with some probability, which can then be used to learn the desired representation. We also assume that distributions, such as the dynamics or inverse dynamics, can be modeled with arbitrary accuracy, and that the maximizing set of representations for a given objective can be computed. While these assumptions might be relaxed in any practical RL algorithm, and exploration plays a confounding role, studying these objectives under such simplifying assumptions allows us to compare them in terms of sufficiency on an equal playing field, isolating the role of representation learning from other confounding components of a complete RL algorithm.
99
+
100
+ # 5.1 FORWARD INFORMATION
101
+
102
+ In this section we show that a representation that maximizes $\mathbb { J } _ { f w d }$ is sufficient for optimal control under any reward function. This result aligns with intuition that a representation that captures forward dynamics can represent everything predictable in the state space, and can thus be used to learn the optimal policy for any task. Note that this strength can also be a weakness if there are many predictable elements that are irrelevant for downstream tasks, since the representation retains more information than is needed for the task.
103
+
104
+ Proposition 1. $\mathbb { J } _ { f w d }$ is sufficient for all reward functions.
105
+
106
+ Proof. (Sketch) We first show that if $Z _ { t } , A _ { t }$ are maximally informative of $Z _ { t + k }$ , they are also maximally informative of the return $\bar { R } _ { t }$ . Due to the Markov structure, $\mathbb { E } _ { p ( Z _ { t } | S _ { t } = \mathbf { s } ) } p ( \bar { R } _ { t } | Z _ { t } , A _ { t } ) =$ $p ( \bar { R } _ { t } | S _ { t } = \mathbf { s } , A _ { t } )$ . In other words, given $\phi _ { \mathcal { Z } }$ , additionally knowing $S$ doesn’t change our belief about the future return. The $Q$ -value is the expectation of the return, so $Z$ has as much information about the Q-value as $S$ does. The full proof can be found in Appendix 8.1. □
107
+
108
+ # 5.2 STATE-ONLY TRANSITION INFORMATION
109
+
110
+ While $\mathbb { J } _ { s t a t e }$ is closely related to $\mathbb { J } _ { f w d }$ , we now show that it is not sufficient.
111
+
112
+ Proposition 2. $\mathbb { J } _ { s t a t e }$ is not sufficient for all reward functions.
113
+
114
+ Proof. Consider the counter-example in Figure 2. Suppose that the two actions ${ \bf a } _ { 0 }$ and ${ \bf a } _ { 1 }$ are equally likely under the policy distribution. Each state gives no information about which of the two possible next states is more likely; this depends on the action. Therefore, a representation maximizing $\mathbb { J } _ { s t a t e }$ is free to alias states with the same next-state distribution, such as $\mathbf { s } _ { 0 }$ and ${ \bf s } _ { 3 }$ . An alternative view is that such a representation can maximize $\mathbb { J } _ { s t a t e } = H ( Z _ { t + k } ) - H ( Z _ { t + k } | Z _ { t } )$ by reducing both terms in equal amounts - aliasing $\mathbf { s } _ { 0 }$ and ${ \bf s } _ { 3 }$ decreases the marginal entropy as well as the entropy of predicting the next state starting from ${ \bf s } _ { 1 }$ or ${ \bf s } _ { 2 }$ . However, this aliased representation is not capable of representing the optimal policy which must distinguish $\mathbf { s } _ { 0 }$ and ${ \bf s } _ { 3 }$ in order to choose the correct action to reach $\mathbf { s } _ { 2 }$ , which yields reward. □
115
+
116
+ # 5.3 INVERSE INFORMATION
117
+
118
+ Here we show that representations that maximize $\mathbb { J } _ { i n v }$ are not sufficient for control in all MDPs. Intuitively, one way that the representation can be insufficient is by retaining only controllable state elements, while the reward function depends on state elements outside the agent’s control. We then show that additionally representing the immediate reward is not enough to resolve this issue.
119
+
120
+ ![](images/f09aad04268a7b54929f4b8c241ee90ab6f1ea5ffe2cdcb24e84ffd1ae3fa254.jpg)
121
+ Figure 2: (left) A representation that aliases the states ${ \bf s } _ { 0 }$ and ${ \bf s } _ { 3 }$ into a single state maximizes $\mathbb { J } _ { s t a t e }$ but is not sufficient to represent the optimal policy which must choose different actions in ${ \bf s } _ { 0 }$ and ${ \bf s } _ { 3 }$ to reach $\mathbf { s } _ { 2 }$ which yields reward. (right) Values of $\mathbb { J } _ { s t a t e }$ and $\mathbb { J } _ { f w d }$ for a few representative state representations, ordered by increasing $I ( Z ; S )$ . The representation that aliases $\mathbf { s } _ { 0 }$ and ${ \bf s } _ { 3 }$ (plotted with a diamond) maximizes $\mathbb { J } _ { s t a t e }$ , but the policy learned with this representation may not be optimal (as shown here). The original state representation (plotted with a star) is sufficient.
122
+
123
+ Proposition 3. $\mathbb { J } _ { i n v }$ is not sufficient for all reward functions. Additionally, adding $I ( R _ { t } ; Z _ { t } )$ to the objective does not make it sufficient.
124
+
125
+ Proof. Consider the MDP illustrated in Figure 3, and the representation that aliases the states ${ \bf s } _ { 0 }$ and $\mathbf { s } _ { 1 }$ . The same actions taken from these states lead to different next states which may have different rewards ${ \bf \dot { a } } _ { 0 }$ leads to the reward from $\mathbf { s } _ { 0 }$ while ${ \bf a } _ { 1 }$ leads to the reward from ${ \bf s } _ { 1 }$ ). However, this representation maximizes $\mathbb { J } _ { i n v }$ because given each pair of states, the action is identifiable. Interestingly, this problem cannot be remedied by simply requiring that the representation also be capable of predicting immediate rewards. The same counterexample holds since we assumed ${ \bf s } _ { 0 }$ and ${ \bf s } _ { 1 }$ have the same reward. □
126
+
127
+ ![](images/df72795a71197bc7cb6e2b95e593b14aa638b99f2ada4d18f7476ca9c67dc4e6.jpg)
128
+ Figure 3: (left) In this MDP, a representation that aliases the states $\mathbf { s } _ { 0 }$ and $\mathbf { s } _ { 1 }$ into a single state maximizes $\mathbb { J } _ { i n v }$ , yet is not sufficient to represent the optimal policy, which must distinguish between $\mathbf { s } _ { 0 }$ and ${ \bf s } _ { 1 }$ in order to take a different action (towards the high-reward states outlined in green). (right) Values of $\mathbb { J } _ { i n v }$ and $\mathbb { J } _ { f w d }$ for a few selected state representations, ordered by increasing $I ( Z ; S )$ . The representation that aliases ${ \bf s } _ { 0 }$ and $\mathbf { s } _ { 1 }$ (plotted with a diamond) maximizes $\mathbb { J } _ { i n v }$ , but is not sufficient to learn the optimal policy. Note that this counterexample holds also for $\mathbb { J } _ { i n v } + I ( R ; Z )$ .
129
+
130
+ # 6 EXPERIMENTS
131
+
132
+ In this section, we present experiments studying MI-based representation learning with image observations, to analyze whether the conclusions of our theoretical analysis hold in practice. Our goal is not to show that any particular method is necessarily better or worse, but rather to illustrate that the sufficiency arguments that we presented translate into quantifiable performance differences in the deep RL setting.
133
+
134
+ # 6.1 EXPERIMENTAL SETUP
135
+
136
+ To separate representation learning from RL, we first optimize each representation learning objective on a dataset of offline data consisting of $5 0 \mathrm { k }$ transitions collected from a uniform random policy. We then freeze the weights of the state encoder learned in the first phase and train RL agents with the representation as state input. To clearly illustrate the characteristics of each objective, we use the simple pygame (Shinners, 2011) video game catcher, in which the agent controls a paddle that it can move back and forth to catch fruit that falls from the top of the screen (see Figure 4). A positive reward is given when the fruit is caught and a negative reward when the fruit is not caught. The episode terminates after one piece of fruit falls. We optimize $\mathbb { J } _ { f w d }$ and $\mathbb { J } _ { s t a t e }$ with noise contrastive estimation (Gutmann & Hyvarinen, 2010), and ¨ $\mathbb { J } _ { i n v }$ by training an inverse model via maximum likelihood. For the RL algorithm, we use the Soft Actor-Critic algorithm Haarnoja et al. (2018), modified slightly for the discrete action distribution. Please see Appendix 8.2 for full experimental details.
137
+
138
+ # 6.2 COMPUTATIONAL RESULTS
139
+
140
+ In principle, we expect that a representation learned with $\mathbb { J } _ { i n v }$ may not sufficient to solve the catcher game. Because the agent does not control the fruit, a representation maximizing $\mathbb { J } _ { i n v }$ might discard that information, thereby making it impossible to represent the optimal policy. We observe in Figure 5 (top left) that indeed representations trained to maximize $\mathbb { J } _ { i n v }$ result in RL agents that converge slower and to a lower asymptotic expected return. Further, attempting to learn a decoder from the learned representation to the position of the falling fruit incurs a high error (Figure 5, bottom left), indicating that the fruit is not precisely captured by the representation. We argue that this type of problem setting is not contrived, and is representative of many situations in realistic tasks. Consider, for instance, an autonomous vehicle that is stopped
141
+
142
+ ![](images/ce6da2f5fbaece3ee7c7efb1812e0e1a2eaaf453217dbda173ab92da6a6456bf.jpg)
143
+ Figure 4: (left) Original catcher game in which the agent (grey paddle) moves left or right to catch fruit (yellow square) that falls from the top of the screen. (right) Variation catcher-grip in which the agent is instantiated as a gripper, and must open the gripper to catch fruit.
144
+
145
+ at a stoplight. Because the agent does not control the color of the stoplight, it may not be captured in the representation learned by $\mathbb { J } _ { i n v }$ and the resulting RL policy may choose to run the light.
146
+
147
+ In the second experiment, we consider a failure mode of $\mathbb { J } _ { s t a t e }$ . We augment the paddle with a gripper that the agent controls and must be open in order to properly catch the fruit. Since the change in the gripper is completely controlled by a single action, the current state contains no information about the state of the gripper in the future. Therefore, a representation maximizing $\mathbb { J } _ { s t a t e }$ might alias states where the gripper is open with states where the gripper is closed. In our experiment, we see that the error in predicting the state of the gripper from the representation learned via $\mathbb { J } _ { s t a t e }$ is chance (Figure 5, bottom right). This degrades the performance of an RL agent trained with this state representation since the best the agent can do is move under the fruit and randomly open or close the gripper (Figure 5, top right). In the driving example, suppose turning on the headlights incurs positive reward if it’s raining but negative reward if it’s sunny. The representation could fail to distinguish the state of the headlights, making it impossible to learn when to properly use the headlights.
148
+
149
+ ![](images/9680d5ec132ab084bbcc8453ec85f7bb3920cfa78c9927a7f37d1fa1a3df869f.jpg)
150
+
151
+ <table><tr><td>Obj.</td><td>Agent Err.</td><td>Fruit Err.</td><td>Grip Err.</td></tr><tr><td>Jfwd</td><td>0.1</td><td>0.1</td><td>0.3</td></tr><tr><td>Jstate</td><td>0.1</td><td>0.1</td><td>0.5</td></tr></table>
152
+
153
+ Figure 5: (top) Policy performance using learned representations as state inputs to RL, for the catcher and catcher-grip environments. (bottom) Error in predicting the positions of ground truth state elements from each learned representation. Representations maximizing $\mathbb { J } _ { i n v }$ need not represent the fruit, while representations maximizing $\mathbb { J } _ { s t a t e }$ need not represent the gripper, leading these representations to perform poorly in catcher and catcher-grip respectively.
154
+
155
+ <table><tr><td>Obj.</td><td>Agent Err.</td><td>Fruit Err.</td></tr><tr><td>Jfwd</td><td>0.1</td><td>0.1</td></tr><tr><td>Jinu</td><td>0.15</td><td>0.47</td></tr></table>
156
+
157
+ $\mathbb { J } _ { f w d }$ produces useful representations in all cases, and is equally or more effective than learning representations purely from the RL objective alone (as in Figure 5). We experiment with more visual complexity by adding background distractors; these results are presented in Appendix 8.4. We find that in this setting representations learned with $\mathbb { J } _ { f w d }$ to yield even larger gains over learning representations end-to-end via RL. We also analyze the learned representations by evaluating how well they predict the optimal $Q ^ { * }$ in Appendix 8.3.
158
+
159
+ # 7 DISCUSSION
160
+
161
+ In this work, we aimed to analyze mutual information representation learning objectives for control from a theoretical perspective. In contrast to much prior work that studies how these objectives can be effectively optimized given high-dimensional observations, we analyze which objectives are guaranteed to yield representations that are actually sufficient for learning the optimal policy. Surprisingly, we show that two common objectives yield representations that are theoretically insufficient, and provide a proof of sufficiency for a third. We validate our theoretical results with an empirical investigation on a simple video game environment, and show that the insufficiency of these objectives can degrade the performance of deep RL agents.
162
+
163
+ We view this investigation as a step forward in understanding the theoretical characteristics of representation learning techniques commonly used in deep RL. We see many exciting avenues for future work. First, identifying more restrictive MDP classes in which insufficient objectives are in fact sufficient, and relating these to realistic applications. Second, investigating if sample complexity bounds can be established in the case of a sufficient objective. Third, extending our analysis to the partially observed setting, which is more reflective of practical applications. We see these directions as fruitful in providing a deeper understanding of the learning dynamics of deep RL, and potentially yielding novel algorithms for provably accelerating RL with representation learning.
164
+
165
+ # REFERENCES
166
+
167
+ David Abel, D Ellis Hershkowitz, and Michael L Littman. Near optimal behavior via approximate state abstraction. In Proceedings of the 33rd International Conference on International Conference on Machine Learning-Volume 48, pp. 2915–2923, 2016.
168
+
169
+ Pulkit Agrawal, Ashvin V Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. In Advances in neural information processing systems, pp. 5074–5082, 2016.
170
+
171
+ Ankesh Anand, Evan Racah, Sherjil Ozair, Yoshua Bengio, Marc-Alexandre Cotˆ e, and R Devon ´ Hjelm. Unsupervised state representation learning in atari. In Advances in Neural Information Processing Systems, pp. 8766–8779, 2019.
172
+
173
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In Advances in Neural Information Processing Systems, pp. 15509–15519, 2019.
174
+
175
+ James C Bean, John R Birge, and Robert L Smith. Aggregation in dynamic programming. Operations Research, 35(2):215–220, 1987.
176
+
177
+ Suzanna Becker and Geoffrey E Hinton. Self-organizing neural network that discovers surfaces in random-dot stereograms. Nature, 355(6356):161–163, 1992.
178
+
179
+ Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and R Devon Hjelm. Mine: mutual information neural estimation. arXiv preprint arXiv:1801.04062, 2018.
180
+
181
+ Anthony J Bell and Terrence J Sejnowski. An information-maximization approach to blind separation and blind deconvolution. Neural computation, 7(6):1129–1159, 1995.
182
+
183
+ Marc Bellemare, Will Dabney, Robert Dadashi, Adrien Ali Taiga, Pablo Samuel Castro, Nicolas Le Roux, Dale Schuurmans, Tor Lattimore, and Clare Lyle. A geometric perspective on optimal representations for reinforcement learning. In Advances in Neural Information Processing Systems, pp. 4360–4371, 2019.
184
+
185
+ Dimitri P Bertsekas, David A Castanon, et al. Adaptive aggregation methods for infinite horizon dynamic programming. 1988.
186
+
187
+ Thomas M Cover. Elements of information theory. John Wiley & Sons, 1999.
188
+
189
+ Thomas Dean and Robert Givan. Model minimization in markov decision processes. In AAAI/IAAI, pp. 106–111, 1997.
190
+
191
+ 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: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, 2019.
192
+
193
+ Alexey Dosovitskiy and Vladlen Koltun. Learning to act by predicting the future. In International Conference on Learning Representations, 2016.
194
+
195
+ Simon S Du, Sham M Kakade, Ruosong Wang, and Lin F Yang. Is a good representation sufficient for sample efficient reinforcement learning? arXiv preprint arXiv:1910.03016, 2019.
196
+
197
+ William Fedus, Carles Gelada, Yoshua Bengio, Marc G Bellemare, and Hugo Larochelle. Hyperbolic discounting and learning over multiple horizons. arXiv preprint arXiv:1902.06865, 2019.
198
+
199
+ Norm Ferns, Pablo Samuel Castro, Doina Precup, and Prakash Panangaden. Methods for computing state similarity in markov decision processes. In Proceedings of the Twenty-Second Conference on Uncertainty in Artificial Intelligence, pp. 174–181, 2006.
200
+
201
+ Carles Gelada, Saurabh Kumar, Jacob Buckman, Ofir Nachum, and Marc G Bellemare. Deepmdp: Learning continuous latent space models for representation learning. In International Conference on Machine Learning, pp. 2170–2179, 2019.
202
+
203
+ Robert Givan, Thomas Dean, and Matthew Greig. Equivalence notions and model minimization in markov decision processes. Artificial Intelligence, 147(1-2):163–223, 2003.
204
+
205
+ Karol Gregor, Danilo Jimenez Rezende, and Daan Wierstra. Variational intrinsic control. arXiv preprint arXiv:1611.07507, 2016.
206
+
207
+ 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.
208
+
209
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018.
210
+
211
+ Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International Conference on Machine Learning, pp. 2555–2565, 2019.
212
+
213
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670, 2018.
214
+
215
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
216
+
217
+ Nicholas K Jong and Peter Stone. State abstraction discovery from irrelevant state variables. In IJCAI, volume 8, pp. 752–757, 2005.
218
+
219
+ Rico Jonschkowski and Oliver Brock. Learning state representations with robotic priors. Autonomous Robots, 39(3):407–428, 2015.
220
+
221
+ Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Scalable deep reinforcement learning for vision-based robotic manipulation. In Conference on Robot Learning, pp. 651–673, 2018.
222
+
223
+ 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 International Conference on Learning Representations, 2016.
224
+
225
+ Alexander S Klyubin, Daniel Polani, and Chrystopher L Nehaniv. Empowerment: A universal agent-centric measure of control. In 2005 IEEE Congress on Evolutionary Computation, volume 1, pp. 128–135. IEEE, 2005.
226
+
227
+ Alexander S Klyubin, Daniel Polani, and Chrystopher L Nehaniv. Keep your options open: An information-based driving principle for sensorimotor systems. PloS one, 3(12), 2008.
228
+
229
+ Tor Lattimore and Csaba Szepesvari. Learning with good feature representations in bandits and in rl with a generative model. arXiv preprint arXiv:1911.07676, 2019.
230
+
231
+ Alex X. Lee, Anusha Nagabandi, Pieter Abbeel, and Sergey Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. arXiv preprint arXiv:1907.00953, 2019.
232
+
233
+ Felix Leibfried, Sergio Pascual-D´ıaz, and Jordi Grau-Moya. A unified bellman optimality principle combining reward maximization and empowerment. In Advances in Neural Information Processing Systems, pp. 7867–7878, 2019.
234
+
235
+ Timothee Lesort, Natalia D ´ ´ıaz-Rodr´ıguez, Jean-Franois Goudou, and David Filliat. State representation learning for control: An overview. Neural Networks, 108:379–392, 2018.
236
+
237
+ Lihong Li, Thomas J Walsh, and Michael L Littman. Towards a unified theory of state abstraction for mdps. In ISAIM, 2006.
238
+
239
+ Ralph Linsker. Self-organization in a perceptual network. Computer, 21(3):105–117, 1988.
240
+
241
+ David McAllester and Karl Statos. Formal limitations on the measurement of mutual information. arXiv preprint arXiv:1811.04251, 2018.
242
+
243
+ Andrew Kachites McCallum. Reinforcement Learning with Selective Perception and Hidden State. PhD thesis, University of Rochester, 1996.
244
+
245
+ Piotr Mirowski. Learning to navigate. In 1st International Workshop on Multimodal Understanding and Learning for Embodied Applications, pp. 25–25, 2019.
246
+
247
+ 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.
248
+
249
+ Shakir Mohamed and Danilo Jimenez Rezende. Variational information maximisation for intrinsically motivated reinforcement learning. In Advances in neural information processing systems, pp. 2125–2133, 2015.
250
+
251
+ Ofir Nachum, Shixiang Gu, Honglak Lee, and Sergey Levine. Near-optimal representation learning for hierarchical reinforcement learning. 2018.
252
+
253
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
254
+
255
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2778–2787. JMLR. org, 2017.
256
+
257
+ Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A Alemi, and George Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019.
258
+
259
+ Mirco Ravanelli and Yoshua Bengio. Learning speaker representations with mutual information, 2019.
260
+
261
+ Balaraman Ravindran and Andrew G Barto. Smdp homomorphisms: an algebraic approach to abstraction in semi-markov decision processes. In Proceedings of the 18th international joint conference on Artificial intelligence, pp. 1011–1016, 2003.
262
+
263
+ Evan Shelhamer, Parsa Mahmoudieh, Max Argus, and Trevor Darrell. Loss is its own reward: Self-supervision for reinforcement learning. arXiv preprint arXiv:1612.07307, 2016.
264
+
265
+ Pete Shinners. Pygame. http://pygame.org/, 2011.
266
+
267
+ Jiaming Song and Stefano Ermon. Understanding the limitations of variational mutual information estimators. arXiv preprint arXiv:1910.06222, 2019.
268
+
269
+ Susanne Still and Doina Precup. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, 131(3):139–148, 2012.
270
+
271
+ Adam Stooke, Kimin Lee, Pieter Abbeel, and Michael Laskin. Decoupling representation learning from reinforcement learning. Technical report, UC Berkeley, 2020.
272
+
273
+ Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. Contrastive bidirectional transformer for temporal representation learning. arXiv preprint arXiv:1906.05743, 2019.
274
+
275
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
276
+
277
+ Benjamin Van Roy and Shi Dong. Comments on the du-kakade-wang-yang lower bounds. arXiv preprint arXiv:1911.07910, 2019.
278
+
279
+ Vivek Veeriah, Matteo Hessel, Zhongwen Xu, Janarthanan Rajendran, Richard L Lewis, Junhyuk Oh, Hado P van Hasselt, David Silver, and Satinder Singh. Discovery of useful questions as auxiliary tasks. In Advances in Neural Information Processing Systems, pp. 9306–9317, 2019.
280
+
281
+ 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.
282
+
283
+ Tianhe Yu, Gleb Shevchuk, Dorsa Sadigh, and Chelsea Finn. Unsupervised visuomotor control through distributional planning networks. In Robotics Science and Systems, 2019.
284
+
285
+ Amy Zhang, Harsh Satija, and Joelle Pineau. Decoupling dynamics and reward for transfer learning. arXiv preprint arXiv:1804.10689, 2018a.
286
+
287
+ Marvin Zhang, Sharad Vikram, Laura Smith, Pieter Abbeel, Matthew J Johnson, and Sergey Levine. Solar: Deep structured latent representations for model-based reinforcement learning. arXiv preprint arXiv:1808.09105, 2018b.
288
+
289
+ # 8 APPENDIX
290
+
291
+ # 8.1 SUFFICIENCY OF $\mathbb { J } _ { f w d }$ : PROOF OF PROPOSITION 1
292
+
293
+ We describe the proofs for the sufficiency results from Section 5 here. We begin by providing a set of lemmas, before proving the sufficiency of $\mathbb { J } _ { f w d }$ .
294
+
295
+ ![](images/34983f5e13dab7cad97c50e0a4b9d33a15aecc253a0c83bb14e760120b6c938c.jpg)
296
+ Figure 6: Graphical model for Lemma 1, depicting true states $S$ , states in the representation $Z$ , actions $A$ , rewards $R$ , and the variable $X$ (which we will interpret as the sum of future rewards in the proof of Proposition 1).
297
+
298
+ Lemma 1. Let $X$ be a random variable dependent on $S _ { t + k }$ , with the conditional independence assumptions implied by the graphical model in Figure 6. (In the main proof of Proposition $^ { l }$ , we will let $X$ be the sum of rewards from time $t + k$ onwards.) $\begin{array} { r } { t f I ( Z _ { t + k } ; Z _ { t } , A _ { t } ) = I ( S _ { t + k } ; S _ { t } , A _ { t } ) \forall k } \end{array}$ , then $I ( X ; Z _ { t } , A _ { t } ) = I ( X ; S _ { t } , A _ { t } ) \forall k$ .
299
+
300
+ Proof. For proof by contradiction, assume there is some $\phi _ { \mathcal { Z } }$ and some $r$ such that $I ( X ; Z _ { t } , A _ { t } ) <$ $I ( X ; S _ { t } , A _ { t } )$ and that $I ( Z _ { t + k } ; Z _ { t } , A _ { t } ) = I ( S _ { t + k } ; S _ { t } , A _ { t } )$ . Now we know that because $Z _ { t } \to S _ { t } \to$ $S _ { t + k } \to Z _ { t + k }$ form a Markov chain, by the data processing inequality (DPI) $I ( Z _ { t + k } ; Z _ { t } , A _ { t } ) \le$ $I ( S _ { t + k } ; Z _ { t } , A _ { t } ) \ \leq \ I ( S _ { t + k } ; S _ { t } , A _ { t } )$ . We will proceed by showing that that $I ( X ; Z _ { t } , A _ { t } ) ~ <$ $I ( X ; S _ { t } , A _ { t } ) \implies I ( S _ { t + k } ; Z _ { t } , A _ { t } ) < I ( S _ { t + k } ; S _ { t } , A _ { t } ) |$ , which gives the needed contradiction.
301
+
302
+ Using chain rule, we can expand the following expression in two different ways.
303
+
304
+ $$
305
+ I ( X ; Z _ { t } , S _ { t } , A _ { t } ) = I ( X ; Z _ { t } | S _ { t } , A _ { t } ) + I ( X ; S _ { t } , A _ { t } ) = 0 + I ( X ; S _ { t } , A _ { t } )
306
+ $$
307
+
308
+ $$
309
+ I ( X ; Z _ { t } , S _ { t } , A _ { t } ) = I ( X ; S _ { t } | Z _ { t } , A _ { t } ) + I ( X ; Z _ { t } , A _ { t } )
310
+ $$
311
+
312
+ Note that the first term in Equation 5 is zero by the conditional independence assumptions in Figure 6. Equating the expansions, we can see that to satisfy our assumption that $I ( X ; Z _ { t } , A _ { t } \bar { ) } < I ( X ; \bar { S _ { t } } , A _ { t } )$ , we must have that $I ( X ; S _ { t } | Z _ { t } , A _ { t } ) > 0$ .
313
+
314
+ Now we follow a similar procedure to expand the following expression:
315
+
316
+ $$
317
+ I ( S _ { t + k } ; Z _ { t } , S _ { t } , A _ { t } ) = I ( S _ { t + k } ; Z _ { t } | S _ { t } , A _ { t } ) + I ( S _ { t + k } ; S _ { t } , A _ { t } ) = 0 + I ( S _ { t + k } ; S _ { t } , A _ { t } )
318
+ $$
319
+
320
+ $$
321
+ I ( S _ { t + k } ; Z _ { t } , S _ { t } , A _ { t } ) = I ( S _ { t + k } ; S _ { t } | Z _ { t } , A _ { t } ) + I ( S _ { t + k } ; Z _ { t } , A _ { t } )
322
+ $$
323
+
324
+ The first term in Equation 7 is zero by the conditional independence assumptions in Figure 6. Comparing the first term in Equation 8 with the first term in Equation 6, we see because $S _ { t } $ $S _ { t + k } \to X$ form a Markov chain, by the DPI that $I ( S _ { t + k } ; S _ { t } | Z _ { t } , \bar { A } _ { t } ) \ge I ( X ; S _ { t } | Z _ { t } , A _ { t } )$ . Therefore we must have $I ( S _ { t + k } ; S _ { t } | Z _ { t } , A _ { t } ) > 0 $ . Combining Equations 7 and 8:
325
+
326
+ $$
327
+ I ( S _ { t + k } ; S _ { t } , A _ { t } ) = I ( S _ { t + k } ; S _ { t } | Z _ { t } , A _ { t } ) + I ( S _ { t + k } ; Z _ { t } , A _ { t } )
328
+ $$
329
+
330
+ Since $I ( S _ { t + k } ; S _ { t } | Z _ { t } , A _ { t } ) > 0 , I ( S _ { t + k } ; Z _ { t } , A _ { t } ) < I ( S _ { t + k } ; S _ { t } , A _ { t } ) _ { \mathrm { t } }$ , which is exactly the contradiction we set out to show.
331
+
332
+ Lemma 2. If $I ( Y ; Z ) ~ = ~ I ( Y ; X )$ and $Y ~ \perp ~ Z | X$ , then $\exists p ( Z | X ) ~ s . t . ~ \forall x , p ( Y | X ~ = ~ x ) ~ =$ $\begin{array} { r } { \int p ( Y | Z ) p ( \dot { Z } | X = x ) \dot { d z } } \end{array}$ .
333
+
334
+ Proof. First note that the statement is not trivially true. Without any assumption regarding MI, we can write,
335
+
336
+ $$
337
+ p ( Y | X = x ) = \int p ( Y , Z | X = x ) d z = \int p ( Y | Z , X = x ) p ( Z | X = x ) d z
338
+ $$
339
+
340
+ Comparing this with the statement we’d like to prove, we can see that the key idea is to show that the MI equivalence implies that $p ( Y | Z , X = x ) = p ( Y | Z )$ . To begin, consider $I ( Y ; Z ) = I ( Y ; X )$ . We can re-write this equality using the entropy definition of MI.
341
+
342
+ $$
343
+ H ( Y ) - H ( Y \vert Z ) = H ( Y ) - H ( Y \vert X )
344
+ $$
345
+
346
+ Note that the $H ( Y )$ cancel and substituting the definition of entropy we have:
347
+
348
+ $$
349
+ \mathbb { E } _ { p ( Y , Z ) } [ \log p ( Y | Z ) ] = \mathbb { E } _ { p ( Y , X ) } [ \log p ( Y | X ) ]
350
+ $$
351
+
352
+ Note that on the right-hand side, we can use the Tower property to re-write the expectation as
353
+
354
+ $$
355
+ \begin{array} { r } { { \mathbb E } _ { p ( Y , X ) } [ \log p ( Y | X ) ] = { \mathbb E } _ { p ( Z ) } { \mathbb E } _ { p ( Y , X \mid Z ) } [ \log p ( Y | X ) ] = { \mathbb E } _ { p ( Y | X ) p ( X , Z ) } [ \log p ( Y | X ) ] } \end{array}
356
+ $$
357
+
358
+ Now we can use the Tower property again to re-write the expectation on both sides.
359
+
360
+ $$
361
+ \begin{array} { r l } & { \mathbb { E } _ { p ( X ) } [ \mathbb { E } _ { p ( Y , Z | X ) } [ \log p ( Y | Z ) ] ] = \mathbb { E } _ { p ( X ) } [ \mathbb { E } _ { p ( Y | X ) p ( X , Z | X ) } [ \log p ( Y | X ) ] ] } \\ & { \mathbb { E } _ { p ( X ) } [ \mathbb { E } _ { p ( Y | X ) p ( Z | X ) } [ \log p ( Y | Z ) ] ] = \mathbb { E } _ { p ( X ) } [ \mathbb { E } _ { p ( Y | X ) p ( Z | X ) } [ \log p ( Y | X ) ] ] } \\ & { \mathbb { E } _ { p ( X ) } [ \mathbb { E } _ { p ( Y | X ) p ( Z | X ) } [ \log p ( Y | Z ) ] ] - \log p ( Y | X ) ] = 0 } \\ & { \mathbb { E } _ { p ( X ) } [ \mathbb { E } _ { p ( Y | X ) } [ \mathbb { E } _ { p ( Z | X ) } [ \log p ( Y | Z ) ] - \log p ( Y | X ) ] ] = 0 } \end{array}
362
+ $$
363
+
364
+ Log probabilities are always $\leq 0$ , therefore for the sum to equal zero, each term must be zero.
365
+
366
+ $$
367
+ \log p ( Y | X ) = \mathbb { E } _ { p ( Z | X ) } [ \log p ( Y | Z ) ]
368
+ $$
369
+
370
+ By Jensen’s inequality,
371
+
372
+ $$
373
+ \log p ( Y | X ) \leq \log \mathbb { E } _ { p ( Z | X ) } [ p ( Y | Z ) ]
374
+ $$
375
+
376
+ By the monotonicity of the logarithm:
377
+
378
+ $$
379
+ p ( Y | X ) \leq \mathbb { E } _ { p ( Z | X ) } [ p ( Y | Z ) ]
380
+ $$
381
+
382
+ If there exists some $x$ and some $y$ such that $p ( Y = y | X = x ) < \mathbb { E } _ { p ( Z | X = x ) } [ p ( Y = y | Z ) ]$ , then there must be some other $y ^ { \prime }$ for the same $x$ where $p ( Y = y ^ { \prime } | X = x ) > \mathbb { E } _ { p ( Z | X = x ) } [ p ( Y = y ^ { \prime } | Z ) ]$ because $\rho ( Y | X = x )$ must sum to 1.
383
+
384
+ $$
385
+ p ( Y | X ) = \mathbb { E } _ { p ( Z | X ) } [ p ( Y | Z ) ] = \int p ( Y | Z ) p ( Z | X = x ) d z = \int p ( Y , Z | X = x ) d z
386
+ $$
387
+
388
+ Where the last equality follows by conditional independence of $Y$ and $Z$ given $X$ .
389
+
390
+ Given the lemmas stated above, we can then use them to prove the sufficiency of $\mathbb { J } _ { f w d }$
391
+
392
+ Proposition 1. (Sufficiency of $\mathbb { J } _ { f w d } )$ Let $( \boldsymbol { S } , \boldsymbol { A } , \boldsymbol { T } , \boldsymbol { r } )$ be an MDP with dynamics $p ( S _ { t + 1 } | S _ { t } , A _ { t } )$ . Let the policy distribution $p ( A | S )$ and steady-state state occupancy $p ( S )$ have full support on the action and state alphabets $\mathcal { A }$ and $s$ respectively. See Figure 6 for a graphical depiction of the conditional independence relationships between variables.
393
+
394
+ For a representation $\phi _ { \mathcal { Z } }$ and set of reward functions $\mathcal { R }$ , if $I ( Z _ { t + k } ; Z _ { t } , A _ { t } )$ is maximized $\forall k > 0 , t > 0$ then $\forall r \in \mathcal { R }$ and $\forall \mathbf { s } _ { 1 } , \mathbf { s } _ { 2 } \in S$ $, \phi _ { \mathcal { Z } } ( \mathbf { s } _ { 1 } ) = \phi _ { \mathcal { Z } } ( \mathbf { s } _ { 2 } ) \implies \forall \mathbf { a } , Q _ { r } ^ { * } ( \mathbf { a } , \mathbf { s } _ { 1 } ) = Q _ { r } ^ { * } ( \mathbf { a } , \mathbf { s } _ { 2 } ) .$ .
395
+
396
+ Proof. Note that $\left( Z _ { t + k } ; Z _ { t } , A _ { t } \right)$ is maximized if the representation $\phi _ { \mathcal { Z } }$ is taken to be the identity. In other words $\begin{array} { r } { \operatorname* { m a x } _ { \phi } I ( Z _ { t + k } ; Z _ { t } , A _ { t } ) = I ( S _ { t + k } ; S _ { t } , A _ { t } ) } \end{array}$ .
397
+
398
+ Define the random variable $\bar { R } _ { t }$ to be the discounted return starting from state $\mathbf { s } _ { t }$ .
399
+
400
+ $$
401
+ \bar { R } _ { t } = \sum _ { k = 1 } ^ { H - t } \gamma ^ { k } R _ { t + k }
402
+ $$
403
+
404
+ Plug in $\bar { R } _ { t }$ for the random variable $X$ in Lemma 1:
405
+
406
+ $$
407
+ I ( Z _ { t + k } ; Z _ { t } , A _ { t } ) = I ( S _ { t + k } ; S _ { t } , A _ { t } ) \qquad \Longrightarrow \qquad I ( \bar { R } _ { t + k } ; Z _ { t } , A _ { t } ) = I ( \bar { R } _ { t + k } ; S _ { t } , A _ { t } )
408
+ $$
409
+
410
+ Now let $X = [ S _ { t } , A _ { t } ]$ , $Y = \bar { R } _ { t }$ , and $Z = Z _ { t }$ , and note that by the structure of the graphical model in Figure $6 , Y \perp Z | X$ . Plugging into Lemma 2:
411
+
412
+ $$
413
+ \mathbb { E } _ { p ( \mathbf { z } _ { t } \mid S _ { t } = \mathbf { s } ) } p ( \bar { R } _ { t } | Z _ { t } , A _ { t } ) = p ( \bar { R } _ { t } | S _ { t } = \mathbf { s } , A _ { t } )
414
+ $$
415
+
416
+ Now the $Q$ -function given a reward function $r$ and a state-action pair $( \mathbf { s } , \mathbf { a } )$ can be written as an expectation of this random variable $\bar { R } _ { t }$ , given $S _ { t } = \mathbf { s }$ and $A = \mathbf { a }$ . (Note that $p ( \bar { R } _ { t } | S _ { t } = \mathbf { s } , A _ { t } = \mathbf { a } )$ can be calculated from the dynamics, policy, and reward distributions.)
417
+
418
+ $$
419
+ Q _ { r } ( \mathbf { s } , \mathbf { a } ) = \mathbb { E } _ { p ( \bar { R } _ { t } | S _ { t } = \mathbf { s } , A _ { t } = \mathbf { a } ) } [ \bar { R } _ { t } ]
420
+ $$
421
+
422
+ Since $\phi _ { \mathcal { Z } } ( \mathbf { s } _ { 1 } ) _ { - } = \phi _ { \mathcal { Z } } ( \mathbf { s } _ { 2 } )$ , $p ( \mathbf { z } _ { t } | S _ { t } = \mathbf { s } _ { 1 } ) = p ( \mathbf { z } _ { t } | S _ { t } = \mathbf { s } _ { 2 } )$ . Therefore by Equation 21, $p ( { \bar { R } } _ { t } | S _ { t } =$ $\mathbf { s } _ { 1 } , A _ { t } ) = p ( \bar { R } _ { t } | S _ { t } = \mathbf { s } _ { 2 } , A _ { t } )$ . Plugging this result into Equation 22, $Q _ { r } ( \mathbf { a } , \mathbf { s } _ { 1 } ) = Q _ { r } ( \mathbf { a } , \mathbf { s } _ { 2 } )$ . Because this reasoning holds for all $Q$ -functions 2, it also holds for the optimal $Q$ , therefore ${ \cal Q } _ { r } ^ { \ast } ( { \bf a } , { \bf s } _ { 1 } ) =$ $Q _ { r } ^ { * } ( \mathbf { a } , \mathbf { s } _ { 2 } )$ .
423
+
424
+ # 8.2 EXPERIMENTAL DETAILS
425
+
426
+ # 8.2.1 DIDACTIC EXPERIMENTS
427
+
428
+ The didactic examples are computed as follows. Given the list of states in the MDP, we compute the possible representations, restricting our focus to representations that group states into “blocks.” We do this because there are infinite stochastic representations and the MI expressions we consider are not convex in the parameters of $p ( Z | S )$ , making searching over these representations difficult. Given each state representation, we compute the value of the MI objective as well as the optimal value function using exact value iteration. In these examples, we assume that the policy distribution is uniform, and that the environment dynamics are deterministic. Since we consider the infinite horizon setting, we use the steady-state state occupancy in our calculations.
429
+
430
+ # 8.2.2 DEEP RL EXPERIMENTS
431
+
432
+ The deep RL experiments with the catcher game are conducted as follows. First, we use a uniform random policy to collect 50k transitions in the environment. In this simple environment, the uniform random policy suffices to visit all states (the random agent is capable of accidentally catching the fruit, for example). Next, each representation learning objective is maximized on this dataset. For all objectives, the images are pre-processed in the same manner (resized to 64x64 pixels and normalized) and embedded with a convolutional network. The convolutional encoder consists of five convolutional layers with ReLU activations and produces a latent vector with dimension 256. We use the latent vector to estimate each mutual information objective, as described below.
433
+
434
+ Inverse information: We interpret the latent embeddings of the images $S _ { t }$ and $S _ { t + 1 }$ as the parameters of Gaussian distributions $p ( Z | S _ { t } )$ and $p ( Z | S _ { t + 1 } )$ . We obtain a single sample from each of these two distributions, concatenate them and pass them through a single linear layer to predict the action. The objective we maximize is the cross-entropy of the predicted actions with the true actions, as in Agrawal et al. 2016 and Shelhamer et al. 2016. To prevent recovering the trivial solution of preserving all the information in the image, we add an information bottleneck to the image embeddings. We tune the Lagrange multiplier on this bottleneck such that the action prediction loss remains the same value as when trained without the bottleneck. This approximates the objective $\begin{array} { r } { \operatorname* { m i n } _ { \phi } I ( Z ; S ) s . t . I _ { i n v } = \operatorname* { m a x } I _ { i n v } } \end{array}$ . To use the learned encoder for RL, we embed the image from the current timestep and take the mean of the predicted distribution as the state for the RL agent.
435
+
436
+ State-only information: We follow the Noise Contrastive Estimation (NCE) approach presented in CPC (Oord et al. 2018). Denoting $Z _ { t }$ and $Z t + 1$ as the latent embedding vectors from the convolutional encoders, we use a log-bilinear model as in CPC to compute the score: $f ( Z _ { t } , Z _ { t + 1 } ) =$ $\mathrm { e x p } ( Z _ { t } ^ { T } W Z _ { t + 1 } )$ for the cross-entropy loss. We also experimented with an information bottleneck as described above, but found that it wasn’t needed to obtain insufficient representations. To use the learned encoder for RL, we embed the image from the current timestep and use this latent vector as the state for the RL agent.
437
+
438
+ Forward information: We follow the same NCE strategy as for state-only information, with the difference that we concatenate the action to $Z _ { t }$ before computing the contrastive loss.
439
+
440
+ We then freeze the state encoder learned via MI-maximization and use the representation as the state input for RL. The RL agent is trained using the Soft Actor-Critic algorithm Haarnoja et al. (2018), modified slightly for the discrete action distribution (the Q-function outputs Q-values for all actions rather than taking action as input, the policy outputs the action distribution rather than parameters of a distribution, and we can directly compute the expectation in the critic loss rather than sampling). The policy and critic networks consist of two hidden linear layers of 200 units each. We use ReLU activations.
441
+
442
+ # 8.3 ANALYSIS: PREDICTING $Q ^ { * }$ FROM THE REPRESENTATION
443
+
444
+ In Section 6, we evaluated the learned representations by running a temporal difference RL algorithm with the representation as the state input. In this section, instead of using the bootstrap to learn the $Q$ -function, we instead regress the $Q$ -function to the optimal $Q ^ { * }$ . To do this, we first compute the (roughly) optimal $Q ^ { * }$ by running RL with ground truth game state as input and taking the learned $Q$ as $Q ^ { * }$ . Then, we instantiate a new RL agent and train it with the learned image representation as input, regressing the $Q$ -function directly onto the values of $Q ^ { * }$ . We evaluate the policy derived from this new $Q$ -function, and plot the results for both the catcher and catcher-grip environments in Figure 7. We find that similar to the result achieved using the bootstrap, the policy performs poorly when using representations learned by insufficient objectives $( \mathbb { J } _ { i n v }$ in catcher and $\mathbb { J } _ { s t a t e }$ in catcher-grip). Interestingly, we find that the error between the learned $Q$ -values and the $Q ^ { * }$ -values is roughly the same for sufficient and insufficient representations. We hypothesize that this discrepancy between $Q$ -value error and policy performance is due to the fact that small differences in $Q$ -values on a small set of states can result in significant behavior differences in the policy.
445
+
446
+ ![](images/bfe152a6102f04bc06c789aca1582b802178090103147e0e8f43929d4e4f4aa5.jpg)
447
+ Figure 7: Performance of policies obtained from a $Q$ -function trained to predict $Q ^ { * }$ , given state representations learned by each MI objective, in the (left) catcher environment and (right) catchergrip environment. Insufficient objectives $\mathbb { J } _ { i n v }$ and $\mathbb { J } _ { s t a t e }$ respectively perform worse than sufficient objective $\mathbb { J } _ { f w d }$ .
448
+
449
+ # 8.4 DEEP RL EXPERIMENTS WITH BACKGROUND DISTRACTORS
450
+
451
+ In this section we repeat the experiments from Section 6 with added visual complexity in the form of background distractors. We randomly generate images of 10 circles of different colors and replace the black background of the game with these images. Examples of the agent’s observations are shown in Figure 8.
452
+
453
+ We plot the results for both the catcher and catcher-grip games with distractors in Figure 9. As in Section 6, we show both the result of performing RL with the frozen representation as input (top), as well as the error of decoding true state elements from the representation (bottom). In both environments, end-to-end RL from images performs poorly, demonstrating the need for representation learning to aid in solving the task. As predicted by the theory, the representation learned by $\mathbb { J } _ { i n v }$ fails in both games, and the representation learned by $\mathbb { J } _ { s t a t e }$ fails in the catcher-grip game. We find that the difference in performance between sufficient and insufficient objectives is even more pronounced in this setting than in the plain background setting.
454
+
455
+ ![](images/9e77ef9c2ec0c4acef995494602c1bc826deab08aec366292e60e18eee10d8a2.jpg)
456
+ Figure 8: Example 64x64 pixel observations with background distractors.
457
+
458
+ ![](images/35cefecdbd5d43cb5e03e389b19c95b6d44c8bc42f578882b2590715dd7828fd.jpg)
459
+ Figure 9: (top) Policy performance using learned representations as state inputs to RL, for the catcher and catcher-grip environments with background distractors. (bottom) Error in predicting the positions of ground truth state elements from each learned representation. Representations maximizing $\mathbb { J } _ { i n v }$ need not represent the fruit, while representations maximizing $\mathbb { J } _ { s t a t e }$ need not represent the gripper, leading these representations to perform poorly in catcher and catcher-grip respectively.
md/train/NzTU59SYbNq/NzTU59SYbNq.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EIGENGAME: PCA AS A NASH EQUILIBRIUM
2
+
3
+ Ian Gemp, Brian McWilliams, Claire Vernade & Thore Graepel DeepMind {imgemp,bmcw,vernade,thore}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ We present a novel view on principal component analysis (PCA) as a competitive game in which each approximate eigenvector is controlled by a player whose goal is to maximize their own utility function. We analyze the properties of this PCA game and the behavior of its gradient based updates. The resulting algorithm—which combines elements from Oja’s rule with a generalized GramSchmidt orthogonalization—is naturally decentralized and hence parallelizable through message passing. We demonstrate the scalability of the algorithm with experiments on large image datasets and neural network activations. We discuss how this new view of PCA as a differentiable game can lead to further algorithmic developments and insights.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The principal components of data are the vectors that align with the directions of maximum variance. These have two main purposes: a) as interpretable features and b) for data compression. Recent methods for principal component analysis (PCA) focus on the latter, explicitly stating objectives to find the $k$ -dimensional subspace that captures maximum variance (e.g., (Tang, 2019)), and leaving the problem of rotating within this subspace to, for example, a more efficient downstream singular value (SVD) decomposition step1. This point is subtle, yet critical. For example, any pair of twodimensional, orthogonal vectors spans all of $\mathbb { R } ^ { 2 }$ and, therefore, captures maximum variance of any two-dimensional dataset. However, for these vectors to be principal components, they must, in addition, align with the directions of maximum variance which depends on the covariance of the data. By learning the optimal subspace, rather than the principal components themselves, objectives focused on subspace error ignore the first purpose of PCA. In contrast, modern nonlinear representation learning techniques focus on learning features that are both disentangled (uncorrelated) and low dimensional (Chen et al., 2016; Mathieu et al., 2018; Locatello et al., 2019; Sarhan et al., 2019).
12
+
13
+ It is well known that the PCA solution of the $d$ -dimensional dataset $\ b { X } \in \mathbb { R } ^ { n \times d }$ is given by the eigenvectors of $X ^ { \top } X$ or equivalently, the right singular vectors of $X$ . Impractically, the cost of computing the full SVD scales with $\bar { \mathcal { O } } ( \operatorname* { m i n } \{ n \bar { d } ^ { 2 } , n ^ { 2 } \bar { d } \} )$ -time and $\mathcal { O } ( n d )$ -space (Shamir, 2015; Tang, 2019). For moderately sized data, randomized methods can be used (Halko et al., 2011). Beyond this, stochastic—or online—methods based on Oja’s rule (Oja, 1982) or power iterations (Rutishauser, 1971) are common. Another option is to use streaming $k$ -PCA algorithms such as Frequent Directions (FD) (Ghashami et al., 2016) or Oja’s algorithm2 (Allen-Zhu and Li, 2017) with storage complexity $\mathcal { O } ( k d )$ . Sampling or sketching methods also scale well, but again, focus on the top- $k$ subspace (Sarlos, 2006; Cohen et al., 2017; Feldman et al., 2020).
14
+
15
+ In contrast to these approaches, we view each principal component (equivalently eigenvector) as a player in a game whose objective is to maximize their own local utility function in controlled competition with other vectors. The proposed utility gradients are interpretable as a combination of Oja’s rule and a generalized Gram-Schmidt process. We make the following contributions:
16
+
17
+ • A novel formulation of PCA as finding the Nash equilibrium of a suitable game, • A sequential, globally convergent algorithm for approximating the Nash on full-batch data, • A decentralized algorithm with experiments demonstrating the approach as competitive with modern streaming $k$ -PCA algorithms on synthetic and real data, In demonstration of the scaling of the approach, we compute the top-32 principal components of the matrix of RESNET-200 activations on the IMAGENET dataset $\cdot n \approx 1 0 ^ { \hat { 6 } }$ , $d \approx \dot { 2 0 } \cdot 1 0 ^ { 6 }$ ).
18
+
19
+ Each of these contributions is important. Novel formulations often lead to deeper understanding of problems, thereby, opening doors to improved techniques. In particular, $k$ -player games are in general complex and hard to analyze. In contrast, PCA has been well-studied. By combining the two fields we hope to develop useful analytical tools. Our specific formulation is important because it obviates the need for any centralized orthonormalization step and lends itself naturally to decentralization. And lastly, theory and experiments support the viability of this approach for continued research.
20
+
21
+ # 2 PCA AS AN EIGEN-GAME
22
+
23
+ We adhere to the following notation. Vectors and matrices meant to approximate principal components (equivalently eigenvectors) are designated with hats, $\hat { v }$ and $\hat { V }$ respectively, whereas true principal components are $v$ and $V$ . Subscripts indicate which eigenvalue a vector is associated with. For example, $v _ { i }$ is the ith largest eigenvector. In this work, we will assume each eigenvalue is distinct. By an abuse of notation, $v _ { j < i }$ refers to the set of vectors $\{ v _ { j } | j \in \{ 1 , \ldots , i - 1 \} \bar \}$ and are also referred to as the parents of $v _ { i }$ $\mathbf { \chi } _ { v _ { i } }$ is their child). Sums over indices should be clear from context, e.g., $\textstyle \sum _ { j < i } = \sum _ { j = 1 } ^ { i - 1 }$ . The Euclidean inner product is written $\langle u , v \rangle = u ^ { \top } v$ . We denote the unit sphere by $S ^ { d - 1 }$ and simplex by $\Delta ^ { d - 1 }$ in $d$ -dimensional ambient space.
24
+
25
+ Outline of derivation As argued in the introduction, the PCA problem is often mis-interpreted as learning a projection of the data into a subspace that captures maximum variance (equiv. maximizing the trace of a suitable matrix $R$ introduced below). This is in contrast to the original goal of learning the principal components. We first develop the intuition for deriving our utility functions by (i) showing that only maximizing the trace of $R$ is not sufficient for recovering all principal components (equiv. eigenvectors), and (ii) showing that minimizing off-diagonal terms in $R$ is a complementary objective to maximizing the trace and can recover all components. We then consider learning only the top- $k$ and construct utilities that are consistent with findings in (i) and (ii), equal the true eigenvalues at the Nash of the game we construct, and result in a game that is amenable to analysis.
26
+
27
+ Derivation of player utilities. The eigenvalue problem for a symmetric matrix $X ^ { \top } X = M \in$ $\mathbb { R } ^ { d \times d }$ is to find a matrix of $d$ orthonormal column vectors $V$ (implies $V$ is full-rank) such that $M V = V \Lambda$ with $\Lambda$ diagonal. Given a solution to this problem, the columns of $V$ are known as eigenvectors and corresponding entries in $\Lambda$ are eigenvalues. By left-multiplying by $V ^ { \top }$ and recalling $V ^ { \top } V = V V ^ { \top } = I$ by orthonormality (i.e., $V$ is unitary), we can rewrite the equality as
28
+
29
+ $$
30
+ V ^ { \top } M V = V ^ { \top } V \Lambda \stackrel { \mathrm { u n i t a r y } } { = } \Lambda .
31
+ $$
32
+
33
+ Let $\hat { V }$ denote a guess or estimate of the true eigenvectors $V$ and define $R ( { \hat { V } } ) { \stackrel { \mathrm { d e f } } { = } } { \hat { V } } ^ { \top } M { \hat { V } }$ . The PCA problem is often posed as maximizing the trace of $R$ (equiv. minimizing reconstruction error):
34
+
35
+ $$
36
+ \operatorname* { m a x } _ { \hat { V } ^ { \top } \hat { V } = I } \bigg \{ \qquad = \mathrm { T r } ( R ) = \mathrm { T r } ( \hat { V } ^ { \top } M \hat { V } ) = \mathrm { T r } ( \hat { V } \hat { V } ^ { \top } M ) \qquad \Big \} .
37
+ $$
38
+
39
+ Surprisingly, the objective in (2) is independent of $\hat { V }$ , so it cannot be used to recover all (i.e., $k = d$ ) the eigenvectors of $M$ —(i). Alternatively, Equation (1) implies the eigenvalue problem can be phrased as ensuring all off-diagonal terms of $R$ are zero, thereby ensuring $R$ is diagonal—(ii):
40
+
41
+ $$
42
+ \operatorname* { m i n } _ { \hat { V } ^ { \top } \hat { V } = I } \sum _ { i \neq j } R _ { i j } ^ { 2 } .
43
+ $$
44
+
45
+ It is worth further examining the entries of $R$ in detail. Diagonal entries $R _ { i i } = \langle \hat { v } _ { i } , M \hat { v } _ { i } \rangle$ are recognized as Rayleigh quotients because $| | \hat { v } _ { i } | | = 1$ by the constraints. Off-diagonal entries $R _ { i j } =$ $\langle \hat { v } _ { i } , M \hat { v } _ { j } \rangle$ measure alignment between $\hat { v } _ { i }$ and $\hat { v } _ { j }$ under a generalized inner product $\langle \cdot , \cdot \rangle _ { M }$ .
46
+
47
+ ![](images/5a2012c084c16f131e17053fea30fade5eefb797947af202891999acf57cfe59.jpg)
48
+ Figure 1: Each player $i$ ’s utility function depends on its parents represented here by a directed acyclic graph. Each parent must broadcast its vector, “location”, down the hierarchy in a fixed order.
49
+
50
+ So far, we have considered learning all the eigenvectors. If we repeat the logic for the top- $k$ eigenvectors with $k \ < \ d$ , then by Equation (1), $R$ must still be diagonal. $V$ is not square, so $V \mathbf { } ^ { \top } \neq I$ , but assuming $V$ is orthonormal as before, we have $V V ^ { \top } = P$ is a projection matrix. Left-multiplying Equation (1) by $V$ now reads $( P M ) V = V \Lambda$ so we are solving an eigenvalue problem for a subspace of $M$ .
51
+
52
+ If we only desire the top- $k$ eigenvectors, maximizing the trace encourages learning a subspace spanned by the top- $k$ eigenvectors, but does not recover the eigenvectors themselves. On the other hand, Equation (3) places no preference on recovering large over small eigenvectors, but does enforce the columns of $\hat { V }$ to actually be eigenvectors. The preceding exercise is intended to introduce minimizing the off-diagonal terms of $R$ as a possible complementary objective for solving top- $k$ PCA. Next, we will use these two objectives to construct utility functions for each eigenvector $\hat { v } _ { i }$ .
53
+
54
+ We want to combine the objectives to take advantage of both their strengths. A valid proposal is
55
+
56
+ $$
57
+ \operatorname* { m a x } _ { \hat { V } ^ { \top } \hat { V } = I } \sum _ { i } R _ { i i } - \sum _ { i \neq j } R _ { i j } ^ { 2 } .
58
+ $$
59
+
60
+ However, this objective ignores the natural hierarchy of the top- $k$ eigenvectors. For example, $\hat { v } _ { 1 }$ is penalized for aligning with $\hat { v } _ { k }$ and vice versa, but $\hat { v } _ { 1 }$ , being the estimate of the largest eigenvector, should be free to search for the direction that captures the most variance independent of the locations of the other vectors. Instead, first consider solving for the top-1 eigenvector, $v _ { 1 }$ , in which case $R = [ \langle \hat { v } _ { 1 } , M \hat { v } _ { 1 } \rangle ]$ is a $1 \times 1$ matrix. In this setting, Equation (3) is not applicable because there are no off-diagonal elements, so $\mathrm { m a x } _ { \hat { v } _ { 1 } ^ { \top } \hat { v } _ { 1 } = 1 } \langle \hat { v } _ { 1 } , M \hat { v } _ { 1 } \rangle$ is a sensible utility function for $\hat { v } _ { 1 }$ .
61
+
62
+ If considering the top-2 eigenvectors, $\hat { v } _ { 1 }$ ’s utility remains as before, and we introduce a new utility for $\hat { v } _ { 2 }$ . Equation (3) is now applicable, so $\hat { v } _ { 2 }$ ’s utility is
63
+
64
+ $$
65
+ \operatorname* { m a x } _ { \hat { v } _ { 2 } ^ { \top } \hat { v } _ { 2 } = 1 , \hat { v } _ { 1 } ^ { \top } \hat { v } _ { 2 } = 0 } \langle \hat { v } _ { 2 } , M \hat { v } _ { 2 } \rangle - \frac { \langle \hat { v } _ { 2 } , M \hat { v } _ { 1 } \rangle ^ { 2 } } { \langle \hat { v } _ { 1 } , M \hat { v } _ { 1 } \rangle }
66
+ $$
67
+
68
+ where we have divided the off-diagonal penalty by $\langle v _ { 1 } , M v _ { 1 } \rangle$ so a) the two terms in Equation (5) are on a similar scale and b) for reasons that ease analysis. Additionally note that the constraint $\hat { v } _ { 1 } ^ { \top } \hat { v } _ { 2 } = 0$ may be redundant at the optimum $\hat { v } _ { 1 } ^ { * } = v _ { 1 } , \hat { v } _ { 2 } ^ { * } = v _ { 2 } ,$ ) because the second term, $\langle \hat { v } _ { 2 } ^ { * } , M \hat { v } _ { 1 } ^ { * } \rangle ^ { 2 } =$ $\langle v _ { 2 } , M v _ { 1 } \rangle ^ { 2 } = \Lambda _ { 1 1 } ^ { 2 } \langle v _ { 2 } , v _ { 1 } \rangle ^ { 2 }$ , already penalizes such deviations $\Lambda _ { i i }$ is the $i$ th largest eigenvector). These reasons motivate the following set of objectives (utilities), one for each vector $i \in \{ 1 , \ldots , k \}$ :
69
+
70
+ $$
71
+ \operatorname* { m a x } _ { \hat { v } _ { i } ^ { \top } \hat { v } _ { i } = 1 } \left\{ u _ { i } ( \hat { v } _ { i } | \hat { v } _ { j < i } ) = \hat { v } _ { i } ^ { \top } M \hat { v } _ { i } - \sum _ { j < i } \frac { ( \hat { v } _ { i } ^ { \top } M \hat { v } _ { j } ) ^ { 2 } } { \hat { v } _ { j } ^ { \top } M \hat { v } _ { j } } = | | X \hat { v } _ { i } | | ^ { 2 } - \sum _ { j < i } \frac { \langle X \hat { v } _ { i } , X \hat { v } _ { j } \rangle ^ { 2 } } { \langle X \hat { v } _ { j } , X \hat { v } _ { j } \rangle } \right\}
72
+ $$
73
+
74
+ where the notation $u _ { i } ( a _ { i } | b )$ emphasizes that player $i$ adjusts $a _ { i }$ to maximize a utility conditioned on $b$
75
+
76
+ It is interesting to note that by incorporating knowledge of the natural hierarchy (see Figure 1), we are immediately led to constructing asymmetric utilities, and thereby, inspired to formulate the PCA problem as a game, rather than a direct optimization problem as in Equation (4).
77
+
78
+ A key concept in games is a Nash equilibrium. A Nash equilibrium specifies a variable for each player from which no player can unilaterally deviate and improve their outcome. In this case, $\hat { V }$ is a (strict-)Nash equilibrium if and only if for all $i$ , $u _ { i } ( \hat { v } _ { i } | \hat { v } _ { j < i } ) > u _ { i } ( z _ { i } | \hat { v } _ { j < i } )$ for all $z _ { i } \in \mathcal { S } ^ { d - 1 }$ .
79
+
80
+ Theorem 2.1 (PCA Solution is the Unique strict-Nash Equilibrium). Assume that the top- $k$ eigenvalues of $X ^ { \top } X$ are positive and distinct. Then the top- $k$ eigenvectors form the unique strictNash equilibrium of the proposed game in Equation (6).3 The proof is deferred to Appendix L.
81
+
82
+ Solving for the Nash of a game is difficult in general. Specifically, it belongs to the class of PPADcomplete problems (Gilboa and Zemel, 1989; Daskalakis et al., 2009). However, because the game
83
+
84
+ is hierarchical and each player’s utility only depends on its parents, it is possible to construct a sequential algorithm that is convergent by solving each player’s optimization problem in sequence.
85
+
86
+ # 3 METHOD
87
+
88
+ Utility gradient. In Section 2, we mentioned that normalizing the penalty term from Equation (5) had a motivation beyond scaling. Dividing by $\langle \hat { v } _ { j } , M \hat { v } _ { j } \rangle$ results in the following gradient for player $i$ :
89
+
90
+ $$
91
+ \nabla _ { \hat { v } _ { i } } u _ { i } \big ( \hat { v } _ { i } | \hat { v } _ { j < i } \big ) = 2 M \Big [ \hat { v } _ { i } - \sum _ { j < i } \frac { \hat { v } _ { i } ^ { \top } M \hat { v } _ { j } } { \hat { v } _ { j } ^ { \top } M \hat { v } _ { j } } \hat { v } _ { j } \Big ] = 2 X ^ { \top } \Big [ X \hat { v } _ { i } - \sum _ { j < i } \frac { \langle X \hat { v } _ { i } , X \hat { v } _ { j } \rangle } { \langle X \hat { v } _ { j } , X \hat { v } _ { j } \rangle } X \hat { v } _ { j } \Big ] .
92
+ $$
93
+
94
+ The resulting gradient with normalized penalty term has an intuitive meaning. It consists of a single generalized Gram-Schmidt step followed by the standard matrix product found in power iteration and Oja’s rule. Also, notice that applying the gradient as a fixed point operator in sequence $\hat { v } _ { i } \gets$ $\begin{array} { r } { \frac { 1 } { 2 } \nabla _ { \hat { v } _ { i } } \bar { u } _ { i } \big ( \hat { v } _ { i } | \hat { v } _ { j < i } \big ) \big ) } \end{array}$ on $M = I$ recovers the standard Gram-Schmidt procedure for orthogonalization.
95
+
96
+ A sequential algorithm. Each eigenvector can be learned by maximizing its utility. The vectors are constrained to the unit sphere, a non-convex Riemannian manifold, so we use Riemmanian gradient ascent with gradients given by Equation (7). In this case, Riemannian optimization theory simply requires an intermediate step where the gradient, $\nabla _ { \hat { v } _ { i } }$ , is projected onto the tangent space of the sphere to compute the Riemannian gradient, $\nabla _ { \hat { v } _ { i } } ^ { \tilde { R } }$ . A more detailed illustration can be found in Appendix J. Recall that each $u _ { i }$ depends on $\hat { v } _ { j < i }$ . If any of $\hat { v } _ { j < i }$ are being learned concurrently, then $\hat { v } _ { i }$ is maximizing a non-stationary objective which makes a convergence proof difficult. Instead, for completeness, we prove convergence assuming each $\hat { v } _ { i }$ is learned in sequence. Algorithm 1 learns $\hat { v } _ { i }$ given fixed parents $\hat { v } _ { j < i }$ ; we present the convergence guarantee in Section 4 and details on setting $\rho _ { i }$ and $\alpha$ in Appendix O.
97
+
98
+ ![](images/39c8426c3f737061f92367d5bc997c4b7a2e0ec6f926bd67ed13d247f37932a5.jpg)
99
+ Figure 2: EigenGame guides each $\hat { v } _ { i }$ along the unit-sphere from $\uparrow$ to in parallel; $M = \bar { \mathrm { d i } } \mathsf { a g } ( [ 3 , 2 , 1 ] )$ .
100
+
101
+ <table><tr><td>Algorithm1 EigenGameR-Sequential</td><td>Algorithm 2 EigenGameR (EigenGame-update Given: matrix X ∈ Rnxd maximum err with Voi instead of V)</td></tr><tr><td>tolerance ρi, initial vector ∈ Sd-1, learned approximate parents Uj&lt;i, and step size α.</td><td>Given: stream, Xt ∈ Rmxd, total iterations T, initial vector O ∈ Sd-1, and step size α.</td></tr><tr><td>v← ti =「 min(|/Vouil/2, pi)-²]</td><td>← fort=1: Tdo</td></tr><tr><td>fort=1:tdo</td><td>rewards ←Xti {XtO,Xtj)</td></tr><tr><td>rewards ←Xi penalties←∑j&lt;iXo,xo) (Xui,X0j) Xuj</td><td>penalties←∑j&lt;iXtoxXt XtUj</td></tr><tr><td>Vo ← 2XT[rewards -penalties]</td><td>Vo←2XT rewards-penalties</td></tr><tr><td>B←Vo-{Vo,Ui)Ui 0←0+aV</td><td>V←Vo-{VoUi)i 0←0+aV</td></tr></table>
102
+
103
+ A decentralized algorithm. While Algorithm 1 enjoys a convergence guarantee, learning every parent $\hat { v } _ { j < i }$ before learning $\hat { v } _ { i }$ may be unnecessarily restrictive. Intuitively, as parents approach their respective optima, they become quasi-stationary, so we do not expect maximizing utilities in parallel to be problematic in practice. To this end, we propose Algorithm 2 visualized in Figure 2.
104
+
105
+ ![](images/b113e234d2341807b50a55bc76b6f8c8dcef8cf9a74140dfb4443aff798aa468.jpg)
106
+ Figure 3: (a) The longest streak of consecutive vectors with angular error less than $\frac { \pi } { 8 }$ radians is plotted versus algorithm iterations for a matrix $M \in \mathbb { R } ^ { 5 0 \times 5 0 }$ with a spectrum decaying from 1000 to 1 linearly and exponentially. Average runtimes are reported in milliseconds next to the method names5. We omit Krasulina’s as it is only designed to find the top- $k$ subspace. Both EigenGame variants and GHA achieve similar asymptotes on the linear spectrum. (b) Longest streak and subspace distance on MNIST with average runtimes reported in seconds. (a,b) Learning rates were chosen from $\{ 1 0 ^ { - 3 } , \dotsc , 1 0 ^ { - 6 } \}$ on 10 held out runs. Solid lines denote results with the best performing learning rate. Dotted and dashed lines denote results using the best learning rate $\times 1 0$ and 0.1. All plots show means over 10 trials. Shading highlights $\pm$ standard error of the mean for the best learning rates.
107
+
108
+ In practice we can assign each eigenvector update to its own device (e.g. a GPU or TPU). Systems with fast interconnects may facilitate tens, hundreds or thousands of accelerators to be used. In such settings, the overhead of broadcast $( \hat { v } _ { i } )$ is minimal. We can also specify that the data stream is co-located with the update so $\hat { v } _ { i }$ updates with respect to its own $X _ { i , t }$ . This is a standard paradigm for e.g. data-parallel distributed neural network training. We provide further details in Section 6.
109
+
110
+ Message Passing on a DAG. Our proposed utilities enforce a strict hierarchy on the eigenvectors. This is a simplification that both eases analysis (see Appendix M) and improves convergence4, however, it is not optimal. We assume vectors are initialized randomly on the sphere and, for instance, $\hat { v } _ { k }$ may be initialized closer to $v _ { 1 }$ than even $\hat { v } _ { 1 }$ and vice versa. The hierarchy shown in Figure 1 enforces a strict graph structure for broadcasting information of parents to the childrens’ utilities.
111
+
112
+ To our knowledge, our utility formulation in Equation (6) is novel. One disadvantage is that stochastic gradients of Equation (7) are biased. This is mitigated with large batch sizes (further discussion in Appendix I).
113
+
114
+ # 4 CONVERGENCE OF EIGENGAME
115
+
116
+ Here, we first show that Equation (6) has a simple form such that any local maximum of $u _ { i }$ is also a global maximum. Player $i$ ’s utility depends on its parents, so we next explain how error in the parents propagates to children through mis-specification of player $i$ ’s utility. Using the first result and accounting for this error, we are then able to give global, finite-sample convergence guarantees in the full-batch setting by leveraging recent non-convex Riemannian optimization theory.
117
+
118
+ The utility landscape and parent-to-child error propagation. Equation (6) is abstruse, but we prove that the shape of player $i$ ’s utility is simply sinusoidal in the angular deviation of $\hat { v } _ { i }$ from the optimum. The amplitude of the sinusoid varies with the direction of the angular deviation along the unit-sphere and is dependent on the accuracy of players $j < i$ . In the special case where players $j < i$ have learned the top- $( i - 1 )$ eigenvectors exactly, player $i$ ’s utility simplifies (see Lemma N.1) to
119
+
120
+ $$
121
+ u _ { i } \big ( \hat { v } _ { i } , \big \{ v _ { j < i } \big \} \big ) = \Lambda _ { i i } - \sin ^ { 2 } ( \theta _ { i } ) \Big ( \Lambda _ { i i } - \sum _ { l > i } z _ { l } \Lambda _ { l l } \Big )
122
+ $$
123
+
124
+ where $\theta _ { i }$ is the angular deviation and $z \in \Delta ^ { d - 1 }$ parameterizes the deviation direction. Note that $\sin ^ { 2 }$ has period $\pi$ instead of $2 \pi$ , which simply reflects the fact that $v _ { i }$ and $- v _ { i }$ are both eigenvectors.
125
+
126
+ An error propagation analysis reveals that it is critical to learn the parents to a given degree of accuracy. The angular distance between $v _ { i }$ and the maximizer of player $i$ ’s utility with approximate parents has $\tan ^ { - 1 }$ dependence (i.e., a soft step-function; see Lemma N.5 and Figure 13 in Appendix N).
127
+
128
+ Theorem 4.1 (Global convergence). Algorithm 1 achieves finite sample convergence to within $\theta _ { t o l }$ angular error of the top- $k$ principal components, independent of initialization. Furthermore, if each $\hat { v } _ { i }$ is initialized to within $\frac { \pi } { 4 }$ of $v _ { i }$ , Algorithm $^ { l }$ returns the components with angular error less than $\theta _ { t o l }$ in $\begin{array} { r } { T = \left\lceil \mathcal { O } \Big ( k \Big [ \frac { ( k - 1 ) ! } { \theta _ { t o l } } \prod _ { i = 1 } ^ { k } \big ( \frac { 1 6 \Lambda _ { 1 1 } } { g _ { i } } \big ) \Big ] ^ { 2 } \Big ) \right\rceil } \end{array}$ iterations. Proofs are deferred to Appendices O.4 and O.5.
129
+
130
+ Angular error is defined as the angle between $\hat { v } _ { i }$ and $v _ { i }$ : $\theta _ { i } = \mathrm { s i n } ^ { - 1 } ( \sqrt { 1 - \langle v _ { i } , \hat { v } _ { i } \rangle ^ { 2 } } )$ . The first $k$ in the formula for $T$ appears from a naive summing of worst case bounds on the number of iterations required to learn each $\hat { v } _ { j < k }$ individually. The constant 16 arises from the error propagation analysis; parent vectors, $\hat { v } _ { j < i }$ , must be learned to under 1/16th of a canonical error threshold, $\frac { g _ { i } } { ( i - 1 ) \Lambda _ { 1 1 } }$ , for the child $\hat { v } _ { i }$ where $g _ { i } = \Lambda _ { i i } - \Lambda _ { i + 1 , i + 1 }$ . The Riemannian optimization theory we leverage dictates that $\textstyle { \frac { 1 } { \rho ^ { 2 } } }$ iterations are required to meet a $\mathcal { O } ( \rho )$ error threshold. This is why the squared inverse of the error threshold appears here. Breaking down the error threshold itself, the ratio $\Lambda _ { 1 1 } / g _ { i }$ says that more iterations are required to distinguish eigenvectors when the difference between them (summarized by the gap $g _ { i }$ ) is small relative to the scale of the spectrum, $\Lambda _ { 1 1 }$ . The $( k - 1 ) !$ ! term appears because learning smaller eigenvectors requires learning a much more accurate $\hat { v } _ { 1 }$ higher up the DAG.
131
+
132
+ Lastly, the utility function for each $\hat { v } _ { i }$ is sinusoidal, and it is possible that we initialize $\hat { v } _ { i }$ with initial utility arbitrarily close to the trough (bottom) of the function where gradients are arbitrarily small. This is why the global convergence rate depends on the initialization in general. Note that Algorithm 1 effectively detects the trough by measuring the norm of the initial gradient $( \nabla _ { \widehat { v } _ { i } ^ { 0 } } u _ { i } )$ and scales the number of required iterations appropriately. A complete theorem that considers the probability of initializing $\hat { v } _ { i }$ within $\frac { \pi } { 4 }$ of $v _ { i }$ is in Appendix O, but this possibility shrinks to zero in high dimensions.
133
+
134
+ We would also like to highlight that these theoretical findings are strong relative to some other claims. For example, the exponential convergence guarantee for Matrix Krasulina requires the initial guess at the eigenvectors capture the top- $\left( k - 1 \right)$ subspace (Tang, 2019), unlikely when $d \gg k$ . A similar condition is required in (Shamir, 2016b). These guarantees are given for the mini-batch setting while ours is for the full-batch, however, we provide global convergence without restrictions on initialization.
135
+
136
+ # 5 RELATED WORK
137
+
138
+ PCA is a century-old problem and a massive literature exists (Jolliffe, 2002; Golub and Van Loan, 2012). The standard solution to this problem is to compute the SVD, possibly combined with randomized algorithms, to recover the top- $k$ components as in (Halko et al., 2011) or with Frequent Directions (Ghashami et al., 2016) which combines sketching with SVD.
139
+
140
+ In neuroscience, Hebb’s rule (Hebb, 2005) refers to a connectionist rule that solves for the top eigenvector of a matrix $M$ using additive updates of a vector $v$ as $v v + \eta M v$ . Likewise, Oja’s rule (Oja, 1982; Shamir, 2015) refers to a similar update $v v + \eta ( I - v v ^ { \top } ) M v$ . In machine learning, using a normalization step of $v v / | | v | |$ with Hebb’s rule is somewhat confusingly referred to as Oja’s algorithm (Shamir, 2015), the reason being that the subtractive term in Oja’s rule can be viewed as a regularization term for implicitly enforcing the normalization. In the limit of infinite step size, $\eta \infty$ , Oja’s algorithm effectively becomes the well known Power method. If a normalization step is added to Oja’s rule, this is referred to as Krasulina’s algorithm (Krasulina, 1969). In the language of Riemannian manifolds, $v / | | v | |$ can be recognized as a retraction and $( I - v v ^ { \top } )$ as projecting the gradient $M v$ onto the tangent space of the sphere (Absil et al., 2009).
141
+
142
+ Many of the methods above have been generalized to the top- $k$ components. Most generalizations involve adding an orthonormalization step after each update, typically accomplished with a QR factorization plus some minor sign accounting (e.g., see Algorithm 3 in Appendix A.1). An extension of Krasulina’s algorithm to the top- $k$ setting, termed Matrix Krasulina (Tang, 2019), was recently proposed in the machine learning literature. This algorithm can be recognized as projecting the gradient onto the Stiefel manifold (the space of orthonormal matrices) followed by a QR step to maintain orthonormality, which is a well known retraction.
143
+
144
+ Maintaining orthonormality via QR is computationally expensive. Amid and Warmuth (2019) propose an alternative Krasulina method which does not require re-orthonormalization but instead requires inverting a $k \times k$ matrix; in a streaming setting restricted to minibatches of size 1 $( X _ { t } \in \mathbb { R } ^ { d }$ ), Sherman-Morrison (Golub and Van Loan, 2012) can be used to efficiently replace the inversion step. Raja and Bajwa (2020) develop a data-parallel distributed algorithm for the top eigenvector. Alternatively, the Jacobi eigenvalue algorithm explicitly represents the matrix of eigenvectors as a Givens rotation matrix using sin’s and cos’s and rotates $M$ until it is diagonal (Golub and Van der Vorst, 2000).
145
+
146
+ In contrast, other methods extract the top components in sequence by solving for the ith component using an algorithm such as power iteration or Oja’s, and then enforcing orthogonality by removing the learned subspace from the matrix, a process known as deflation. Alternatively, the deflation process may be intertwined with the learning of the top components. The generalized Hebbian algorithm (Sanger, 1989) (GHA) works this way as do Lagrangian inspired formulations (Ghojogh et al., 2019) as well as our own approach. We make the connection between GHA and our algorithm concrete in Prop. K.1. Note, however, that the GHA update is not the gradient of any utility (Prop. K.2) and therefore, lacks a clear game interpretation.
147
+
148
+ Of these, Oja’s algorithm has arguably been the most extensively studied (Shamir, 2016a; Allen-Zhu and Li, $2 0 1 \bar { 7 } ) ^ { 6 }$ Note that Oja’s algorithm converges to the actual principal components (Allen-Zhu and Li, 2017) and Matrix Krasulina (Tang, 2019) converges to the top- $k$ subspace. However, neither can be obviously decentralized. GHA (Sanger, 1989) converges to the principal components asymptotically and can be decentralized (Gang et al., 2019). Each of these is applicable in the streaming $k$ -PCA setting.
149
+
150
+ # 6 EXPERIMENTS
151
+
152
+ We compare our approach against GHA, Matrix Krasulina, and Oja’s algorithm7. We present both EigenGame and EigenGameR which projects the gradient onto the tangent space of the sphere each step. We measure performance of methods in terms of principal component accuracy and subspace distance. We measure principal component accuracy by the number of consecutive components, or longest streak, that are estimated within an angle of $\frac { \pi } { 8 }$ from ground truth. For example, if the angular errors of the $\hat { v } _ { i }$ ’s returned by a method are, in order, $\begin{array} { r } { [ \theta _ { 1 } , \bar { \theta } _ { 2 } , \theta _ { 3 } , . . . ] = [ \frac { \pi } { 1 6 } , \frac { \pi } { 4 } , \frac { \pi } { 1 0 } , . . . ] , } \end{array}$ [ π16 , π4 , π10 , . . . ] , th en the method is credited with a streak of only 1 regardless of the errors $\theta _ { i > 2 }$ . For Matrix Krasulina, we first compute the optimal matching from $\hat { v } _ { i }$ to ground truth before measuring angular error. We present the longest streak as opposed to $^ { 6 6 } \#$ of eigenvectors found” because, in practice, no ground truth is available and we think the user should be able to place higher confidence in the larger eigenvectors being correct. If an algorithm returns $k$ vectors, $\frac { k } { 2 }$ of which are accurate components but does not indicate which, this is less helpful. We measure normalized subspace distance using $\textstyle 1 - { \frac { 1 } { k } } \cdot \operatorname { T r } ( U ^ { * } P ) \in [ 0 , 1 ]$ where $U ^ { * } = V V ^ { \dagger }$ and $P = \hat { V } \hat { V } ^ { \dag }$ similarly to Tang (2019).
153
+
154
+ Synthetic data. Experiments on synthetic data demonstrate the viability of our approach (Figure 3a). Oja’s algorithm performs best on synthetic experiments because strictly enforcing orthogonalization with an expensive QR step greatly helps when solving for all eigenvectors. EigenGame is able to effectively parallelize this over $k$ machines and the advantage of QR diminishes in Figure 3b. The remaining algorithms perform similarly on a linearly decaying spectrum, however, EigenGame performs better on an exponentially decaying spectrum due possibly to instability of Riemannian gradients near the equilibrium (see Appendix J for further discussion). GHA and EigenGameR are equivalent under specific conditions (see Proposition K.1).
155
+
156
+ Figure 4a shows EigenGame solves for the eigenvectors up to a high degree of accuracy $\frac { \pi } { 3 2 }$ , i.e. the convergence results in Figure 3a are not the result of using a loose tolerance of $\frac { \pi } { 8 }$ . With the lower tolerance, all algorithms take slightly more iterations to learn the eigenvectors of the linear spectrum; it is difficult to see any performance change for the exponential spectrum. Although Theorem 4.1 assumes distinct eigenvalues, Figure 4b supports the claim that EigenGame does not require distinct eigenvalues for convergence. We leave proving convergence in this setting to future work.
157
+
158
+ ![](images/6669788ae7fec1a85e64041d26b0412233317a21e23fcff30771f113df148876.jpg)
159
+ Figure 4: (a) Repeats analysis of Figure 3a but for a lower angular tolerance of $\frac { \pi } { 3 2 }$ . (b) Repeats analysis of Figure 3a with an angular tolerance of $\frac { \pi } { 8 }$ as before, but with eigenvalues $\mathrm { \bar { 1 0 } - 1 9 }$ of the ordered spectrum overwritten with $\lambda _ { 1 0 }$ of the original spectrum. We compute angular error for the eigenvectors on either side of this “bubble" to show that EigenGame finds these eigenvectors despite repeated eigenvalues in the spectrum; note $4 0 / 5 0$ is optimal in this experiment.
160
+
161
+ ![](images/fb90b017833142d5eb56cb041919940760489f3a8b2cea66b0a552456fc4c292.jpg)
162
+ Figure 5: (a) Top-8 principal components of the activations of a RESNET-200 on IMAGENET ordered block-wise by network topology (dimension of each block on the right $y$ -axis). Block 1 is closest to input and Block 5 is the output of the network. Color coding is based on relative variance between blocks across the top-8 PCs from blue (low) to red (high). (b) Block 1 mean activation maps of the top-32 principal components of RESNET-200 on IMAGENET computed with EigenGame.
163
+
164
+ MNIST handwritten digits. We compare EigenGame against GHA, Matrix Krasulina, and Oja’s algorithm on the MNIST dataset (Figure 3b). We flatten each image in the training set to obtain a $6 0 , 0 0 0 \times 7 8 4$ dimensional matrix. EigenGame is competitive with Oja’s in a high batch size regime (1024 samples per mini-batch). The performance gap between EigenGame and the other methods shrinks as the mini-batch size is reduced (see Appendix I), expectedly due to biased gradients.
165
+
166
+ The principal components of RESNET-200 activations on IMAGENET are edge filters. A primary goal of PCA is to obtain interpretable low-dimensional representations. To this end we present an example of using EigenGame to compute the top-32 principal components of the activations of a pretrained RESNET-200 on the IMAGENET dataset. We concatenate the flattened activations from the output of each residual block resulting in a $d \approx 2 0 \mathbf { M }$ dimensional vector representation for each of the roughly 1.2M input images. It is not possible to store the entire 195TB matrix in memory, nor incrementally compute the Gram/covariance matrix.
167
+
168
+ We implemented a data-and-model parallel version of EigenGame in JAX (Bradbury et al., 2018) where each $\hat { v } _ { i }$ is assigned to it’s own TPU (Jouppi et al., 2017). Each device keeps a local copy of the RESNET parameters and the IMAGENET datastream. Sampling a mini-batch (of size 128), computing the network activations and updating $\hat { v } _ { i }$ are all performed locally. The broadcast $( \hat { v } _ { i } )$ ) step is handled by the pmap and lax.all_gather functions. Computing the top-32 principal components takes approximately nine hours on 32 TPUv3s.
169
+
170
+ Figure 5a shows the top principal components of the activations of the trained network organized by network topology (consisting of five residual blocks). Note that EigenGame is not applied block-wise, but on all 20M dimensions. We do not assume independence between blocks and the eigenvector has unit norm across all blocks. We observe that Block 1 (closest to input) of PC 1 has very small magnitude activations relative to the other PCs. This is because PC 1 should capture the variance which discriminates most between the classes in the dataset. Since Block 1 is mainly concerned with learning low-level image filters, it stands to reason that although these are important for good performance, they do not necessarily extract abstract representations which are useful for classification. Conversely, we see that PC 1 has larger relative activations in the later blocks.
171
+
172
+ We visualize the average principal activation in Block $1 ^ { 8 }$ in Figure 5b. The higher PCs learn distinct filters (Gabor filters, Laplacian-of-Gaussian filters c.f. (Bell and Sejnowski, 1997)).
173
+
174
+ # 7 CONCLUSION
175
+
176
+ It seems easier to train a bi-directional LSTM with attention than to compute the SVD of a large matrix. –Chris Re
177
+
178
+ NeurIPS 2017 Test-of-Time Award, Rahimi and Recht (Rahimi and Recht, 2017).
179
+
180
+ In this work we motivated PCA from the perspective of a multi-player game. This inspired a decentralized algorithm which enables large-scale principal components estimation. To demonstrate this we used EigenGame to analyze a large neural network through the lens of PCA. To our knowledge this is the first academic analysis of its type and scale (for reference, (Tang, 2019) compute the top-6 PCs of the $d = 2 3 0 0$ outputs of VGG). EigenGame also opens a variety of research directions.
181
+
182
+ Scale. In experiments, we broadcast across all edges in Figure 1 every iteration. Introducing lag or broadcasting with dropout may improve efficiency. Can we further reduce our memory footprint by storing only scalars of the losses and avoiding congestion through online bandit or reinforcement learning techniques? Our decentralized algorithm may have implications for federated and privacy preserving learning as well (Heinze et al., 2016; Heinze-Deml et al., 2018; Bonawitz et al., 2019).
183
+
184
+ Games. EigenGame has a unique Nash equilibrium due to the fixed DAG structure, but vectors are initialized randomly so $\hat { v } _ { k }$ may start closer to $v _ { 1 }$ than $\hat { v } _ { 1 }$ does. Adapting the DAG could make sense, but might also introduce spurious fixed points or suboptimal Nash. Might replacing vectors with populations accelerate extraction of the top principal components?
185
+
186
+ Core ML. EigenGame could be useful as a diagnostic or for accelerating training (Desjardins et al., 2015; Krummenacher et al., 2016); similarly, spectral normalization has shown to be a valuable tool for stabilizing GAN training (Miyato et al., 2018).
187
+
188
+ Lastly, GANs (Goodfellow et al., 2014) recently reformulated learning a generative model as a two-player zero-sum game. Here, we show how another fundamental unsupervised learning task can be formulated as a $k$ -player game. While two-player, zero-sum games are well understood, research on $k$ -player, general-sum games lies at the forefront in machine learning. We hope that marrying a fundamental, well-understood task in PCA with the relatively less understood domain of many player games will help advance techniques on both ends.
189
+
190
+ # ACKNOWLEDGEMENTS
191
+
192
+ We are grateful to Trevor Cai for his help scaling the JAX implementation of EigenGame to handle the large IMAGENET experiment and to Daniele Calandriello for sharing his expert knowledge of related work and advice on revising parts of the manuscript.
193
+
194
+ # REFERENCES
195
+
196
+ P-A. Absil, Robert Mahony, and Rodolphe Sepulchre. Optimization Algorithms on Matrix Manifolds. Princeton University Press, 2009.
197
+
198
+ Zeyuan Allen-Zhu and Yuanzhi Li. First efficient convergence for streaming k-PCA: a global, gap-free, and near-optimal rate. In 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS), pages 487–492. IEEE, 2017.
199
+
200
+ Ehsan Amid and Manfred K Warmuth. An implicit form of Krasulina’s k-PCA update without the orthonormality constraint. arXiv preprint arXiv:1909.04803, 2019.
201
+
202
+ Anthony J Bell and Terrence J Sejnowski. The “independent components” of natural scenes are edge filters. Vision Research, 37(23):3327–3338, 1997.
203
+
204
+ Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Konecny, Stefano Mazzocchi, H Brendan McMahan, et al. Towards federated learning at scale: system design. arXiv preprint arXiv:1902.01046, 2019.
205
+
206
+ Nicolas Boumal, Pierre-Antoine Absil, and Coralia Cartis. Global rates of convergence for nonconvex optimization on manifolds. IMA Journal of Numerical Analysis, 39(1):1–33, 2019.
207
+
208
+ James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, and Skye Wanderman-Milne. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.
209
+
210
+ 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, pages 2172–2180, 2016.
211
+
212
+ Michael B Cohen, Cameron Musco, and Christopher Musco. Input sparsity time low-rank approximation via ridge leverage score sampling. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1758–1777. SIAM, 2017.
213
+
214
+ Constantinos Daskalakis, Paul W Goldberg, and Christos H Papadimitriou. The complexity of computing a Nash equilibrium. SIAM Journal on Computing, 39(1):195–259, 2009.
215
+
216
+ Guillaume Desjardins, Karen Simonyan, Razvan Pascanu, et al. Natural neural networks. In Advances in Neural Information Processing Systems, pages 2071–2079, 2015.
217
+
218
+ Dan Feldman, Melanie Schmidt, and Christian Sohler. Turning big data into tiny data: Constant-size coresets for k-means, PCA, and projective clustering. SIAM Journal on Computing, 49(3):601–657, 2020.
219
+
220
+ Arpita Gang, Haroon Raja, and Waheed U Bajwa. Fast and communication-efficient distributed pca. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 7450–7454. IEEE, 2019.
221
+
222
+ Mina Ghashami, Edo Liberty, Jeff M Phillips, and David P Woodruff. Frequent directions: simple and deterministic matrix sketching. SIAM Journal on Computing, 45(5):1762–1792, 2016.
223
+
224
+ Benyamin Ghojogh, Fakhri Karray, and Mark Crowley. Eigenvalue and generalized eigenvalue problems: Tutorial. arXiv preprint arXiv:1903.11240, 2019.
225
+
226
+ Itzhak Gilboa and Eitan Zemel. Nash and correlated equilibria: some complexity considerations. Games and Economic Behavior, 1(1):80–93, 1989.
227
+
228
+ Gene H Golub and Henk A Van der Vorst. Eigenvalue computation in the 20th century. Journal of Computational and Applied Mathematics, 123(1-2):35–65, 2000.
229
+
230
+ Gene H Golub and Charles F Van Loan. Matrix Computations, volume 3. JHU press, 2012.
231
+
232
+ 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.
233
+
234
+ Nathan Halko, Per-Gunnar Martinsson, and Joel A Tropp. Finding structure with randomness: probabilistic algorithms for constructing approximate matrix decompositions. SIAM review, 53(2):217–288, 2011.
235
+
236
+ Donald Olding Hebb. The Organization of Behavior: A Neuropsychological Theory. Psychology Press, 2005.
237
+
238
+ Christina Heinze, Brian McWilliams, and Nicolai Meinshausen. Dual-loco: distributing statistical estimation using random projections. In Artificial Intelligence and Statistics, pages 875–883, 2016.
239
+
240
+ Christina Heinze-Deml, Brian McWilliams, and Nicolai Meinshausen. Preserving privacy between features in distributed estimation. Stat, 7(1):e189, 2018.
241
+
242
+ Roger A Horn and Charles R Johnson. Matrix Analysis. Cambridge University Press, 2012.
243
+
244
+ Ian T Jolliffe. Principal components in regression analysis. In Principal Component Analysis. Springer, 2002.
245
+
246
+ Norman P Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, et al. In-datacenter performance analysis of a tensor processing unit. In Proceedings of the 44th Annual International Symposium on Computer Architecture, pages 1–12, 2017.
247
+
248
+ TP Krasulina. The method of stochastic approximation for the determination of the least eigenvalue of a symmetrical matrix. USSR Computational Mathematics and Mathematical Physics, 9(6):189–195, 1969.
249
+
250
+ Gabriel Krummenacher, Brian McWilliams, Yannic Kilcher, Joachim M Buhmann, and Nicolai Meinshausen. Scalable adaptive stochastic optimization using random projections. In Advances in Neural Information Processing Systems, pages 1750–1758, 2016.
251
+
252
+ Shengqiao Li. Concise formulas for the area and volume of a hyperspherical cap. Asian Journal of Mathematics and Statistics, 4(1):66–70, 2011.
253
+
254
+ Francesco Locatello, Stefan Bauer, Mario Lucic, Gunnar Raetsch, Sylvain Gelly, Bernhard Schölkopf, and Olivier Bachem. Challenging common assumptions in the unsupervised learning of disentangled representations. In Proceedings of the International Conference on Machine Learning, pages 4114–4124, 2019.
255
+
256
+ Emile Mathieu, Tom Rainforth, N Siddharth, and Yee Whye Teh. Disentangling disentanglement in variational autoencoders. arXiv preprint arXiv:1812.02833, 2018.
257
+
258
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
259
+
260
+ Erkki Oja. Simplified neuron model as a principal component analyzer. Journal of Mathematical Biology, 15(3): 267–273, 1982.
261
+
262
+ Ali Rahimi and Benjamin Recht. Reflections on random kitchen sinks, 2017. URL http://www.argmin. net/2017/12/05/kitchen-sinks/.
263
+
264
+ Haroon Raja and Waheed U Bajwa. Distributed stochastic algorithms for high-rate streaming principal component analysis. arXiv preprint arXiv:2001.01017, 2020.
265
+
266
+ H Rutishauser. Simultaneous iteration method for symmetric matrices. In Handbook for Automatic Computation, pages 284–302. Springer, 1971.
267
+
268
+ Terence D Sanger. Optimal unsupervised learning in a single-layer linear feedforward neural network. Neural Networks, 2(6):459–473, 1989.
269
+
270
+ Mhd Hasan Sarhan, Abouzar Eslami, Nassir Navab, and Shadi Albarqouni. Learning interpretable disentangled representations using adversarial VAEs. In Domain Adaptation and Representation Transfer and Medical Image Learning with Less Labels and Imperfect Data, pages 37–44. Springer, 2019.
271
+
272
+ Tamas Sarlos. Improved approximation algorithms for large matrices via random projections. In 2006 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS’06), pages 143–152. IEEE, 2006.
273
+
274
+ Ohad Shamir. A stochastic PCA and SVD algorithm with an exponential convergence rate. In Proceedings of the International Conference on Machine Learning, pages 144–152, 2015.
275
+
276
+ Ohad Shamir. Convergence of stochastic gradient descent for PCA. In Proceedings of the International Conference on Machine Learning, pages 257–265, 2016a.
277
+
278
+ Ohad Shamir. Fast stochastic algorithms for SVD and PCA: Convergence properties and convexity. In Proceedings of the International Conference on Machine Learning, pages 248–256, 2016b.
279
+
280
+ Cheng Tang. Exponentially convergent stochastic $\mathbf { k }$ -PCA without variance reduction. In Advances in Neural Information Processing Systems, pages 12393–12404, 2019.
281
+
282
+ Aladin Virmaux and Kevin Scaman. Lipschitz regularity of deep neural networks: analysis and efficient estimation. In Advances in Neural Information Processing Systems, pages 3835–3844, 2018.
md/train/P5MtdcVdFZ4/P5MtdcVdFZ4.md ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AugMax: Adversarial Composition of Random Augmentations for Robust Training
2
+
3
+ Haotao Wang1∗, Chaowei $\mathbf { X i a o ^ { 2 , 3 } }$ , Jean Kossaifi2, Zhiding $\mathbf { Y } \mathbf { u } ^ { 2 }$ , Anima Anandkumar2,4, and Zhangyang Wang1
4
+
5
+ 1Department of Electrical and Computer Engineering, University of Texas at Austin 2NVIDIA 3Arizona State University 4California Institute of Technology 1{htwang, atlaswang}@utexas.edu 2{chaoweix, jkossaifi, zhidingy, aanandkumar}@nvidia.com
6
+
7
+ # Abstract
8
+
9
+ Data augmentation is a simple yet effective way to improve the robustness of deep neural networks (DNNs). Diversity and hardness are two complementary dimensions of data augmentation to achieve robustness. For example, AugMix explores random compositions of a diverse set of augmentations to enhance broader coverage, while adversarial training generates adversarially hard samples to spot the weakness. Motivated by this, we propose a data augmentation framework, termed AugMax, to unify the two aspects of diversity and hardness. AugMax first randomly samples multiple augmentation operators and then learns an adversarial mixture of the selected operators. Being a stronger form of data augmentation, AugMax leads to a significantly augmented input distribution which makes model training more challenging. To solve this problem, we further design a disentangled normalization module, termed DuBIN (Dual-Batch-and-Instance Normalization), that disentangles the instance-wise feature heterogeneity arising from AugMax. Experiments show that AugMax-DuBIN leads to significantly improved out-of-distribution robustness, outperforming prior arts by $3 . 0 3 \%$ , $3 . 4 9 \%$ , $1 . 8 2 \%$ and $0 . 7 1 \%$ on CIFAR10-C, CIFAR100-C, Tiny ImageNet-C and ImageNet-C. Codes and pretrained models are available: https://github.com/VITA-Group/AugMax.
10
+
11
+ # 1 Introduction
12
+
13
+ Out-of-distribution (OOD) samples present a challenge when deploying AI models in the real world. Examples include natural corruptions (e.g., due to camera blurs or noise, snow, rain, or fog in image data), sensory perturbations (e.g., sensor transient error, electromagnetic interference) and domain shifts (e.g., summer winter). However, deep networks are often trained on limited amounts of data which may not cover sufficient scenarios. As a result, they are vulnerable to unforeseen distributional changes despite achieving high performance on standard benchmarks [1–3]. This jeopardizes their trustworthiness as well as safe deployment in real-world environments. Thus it is critical to develop techniques that improve robustness even when training with relatively clean datasets.
14
+
15
+ Several techniques have been proposed to consolidate the robustness against unforeseen corruptions, including robust data augmentation [5, 3, 8, 6], Lipschitz continuity [9–11], stability training [12], pre-training [13–16], and robust network structures [17–19], to name a few. Among these techniques, data augmentation is of particular interest due to its empirical effectiveness, ease of implementation, low computational overhead, and plug-and-play nature.
16
+
17
+ ![](images/96da970a0935f651f016706faf1673e344b89a5c13bdb2ecde02923b0a6543ea.jpg)
18
+ Figure 1: The effects of diversity and hardness in data augmentations. We visualize features of augmented images fed to the network during training. The features are from the penultimate layer of a ResNeXt29 trained on CIFAR10 training data using only standard data augmentation (random flipping and translation) following [4]. For visualization, we randomly selected 300 fixed images from 3 fixed classes (denoted by different colors) to which we apply different augmentation methods: (a) standard augmentation (random flipping and translation); (b) AugMix [5]; (c) PGD Attack [6, 7]; (d) AugMax (ours). In order to achieve good model robustness, the augmented training data should both be diverse and also contain enough hard cases. As can be seen, PGD Attack generates hard cases (which the network cannot separate) but are not diverse enough (they are all clustered together) while AugMix creates diverse but not hard samples (they are well separated). By contrast, our approach (AugMax) achieves a unification between hard and diverse samples.
19
+
20
+ There are mainly two categories of data augmentation approaches:
21
+
22
+ The first category aims to increase diversity of the training data by composing multiple random transformations [20–22, 5, 3]. While standard data augmentation methods (e.g., random flipping and translation) lead to poor robustness [5], more aggressive combinations of multiple augmentations have shown promise. One such successful example is AugMix [5], which stochastically samples from diverse augmentation operations and randomly mixing them to produce highly diverse augmented images. AugMix can increase the sample diversity coverage compared to standard augmentations, as shown in Figure 1 (a) and (b).
23
+
24
+ The second category aims to boost the hardness of the training data by sampling from the worst-case augmentations that tries to fool the model into misclassifying the samples. A common technique to achieve this goal is adversarial perturbation [6, 23, 8]. Training over such worst-case samples allows a model to actively fix its generalization weaknesses [24] and empirically improves its robustness against corruptions [25, 26, 7]. Due to the extra complexity to generate adversarial perturbations, the improved robustness usually comes at the cost of largely increased training time compared with non-adversarial methods [6, 27]. An example falling into this category is the PGD attack [6], as is shown in Figure 1 (c).
25
+
26
+ Previous work has focused on leveraging one of these category to improve robustness. In this paper, we unify both approaches in a single framework. In particular, we show that diversity and hardness are complementary and that a unification between the two is necessary to achieve robustness. We propose a new strategy to achieve this unification and successfully increase robustness.
27
+
28
+ # Summary of contributions:
29
+
30
+ • We propose AugMax, a novel augmentation framework which achieves robustness through a unification between diversity and hardness, by searching for the worst-case mixing strategy. • Being a stronger form of data augmentation, AugMax leads to a significantly augmented and more heterogeneous input distribution, which also makes model training more challenging. To solve this problem, we design a new normalization strategy, termed DuBIN, to disentangle the instance-wise feature heterogeneity of AugMax samples. • We show that combination of AugMax and DuBIN (AugMax-DuBIN) achieves state-of-the-art robustness against corruptions and improves robustness against other common distribution shifts.
31
+
32
+ AugMax achieves a good unification between sample diversity and hard corner-case generation during data augmentation. AugMax is built on top of the AugMix framework [5] which mixes multiple data augmentation operators in a multi-branch and layered pipeline. However, different from AugMix where augmentation operators and mixing weights are both randomly sampled, operators are first randomly sampled, followed by adversarially trained mixture of the selected operators in Augmax. This simple change from AugMix to AugMax results in considerable difference in their feature distributions. From the visualizations (in Figure 1), AugMax generates more adversarially “hard samples", while still keeping a good amount of diversity compared to AugMix and PGD Attack. Searching for adversarial mixing strategies in AugMax is slightly more expensive since it involves adversarial mixing. To make this efficient, we adopt an efficient adversarial training strategy [28]. As a result, AugMax adds only a reasonable amount of extra complexity compared to non-adversarial training methods, while improving robustness significantly. For example, AugMax training time is only $\sim 1 . 5$ times that of AugMix on ImageNet (see Table 7). Moreover, Augmax is significantly more efficient than traditional adversarial training which has $\sim 1 0$ times training time overhead compared with AugMix.
33
+
34
+ ![](images/5c2b2929baf2ee2ecdb10d564875ad242f4ebe5bd3f8d0fcce5c19740424a479.jpg)
35
+ Figure 2: AugMax overview. Black and red arrows represent forward paths and back-propagation paths to generate AugMax images, respectively. In contrast to AugMax, where the mixing parameters $m$ and $\pmb { w }$ are adversarially learned, AugMix randomly samples $m$ and $\pmb { w }$ from predefined distributions (and thus no backpropergation on $m$ and $\textbf { \em w }$ ).
36
+
37
+ Being a stronger form of data augmentation with adversarial sample generation, AugMax leads to a significantly augmented input distribution which makes model training more challenging. This naturally motivates us to propose a novel and finer-grained normalization scheme termed Dual-Batchand-Instance Normalization (DuBIN). As illustrated in Figure 3, DuBIN adds an additional instance normalization (IN) in parallel to the traditional Dual Batch Normalization (DuBN) [7, 29] used in adversarial training, in order to better model and disentangle the instance-wise feature heterogeneity arising from AugMax. We show that adding the instance normalization is an important knob to promote the capability of AugMax in boosting model robustness.
38
+
39
+ Our framework, AugMax-DuBIN, is illustrated in Figure 2. AugMax-DuBIN trains on clean images and achieves state-of-the-art robustness on natural corruption benchmarks [1], and also improves model robustness against other common distribution shifts [30, 2]. In particular, our method surpasses state-of-the-art method on CIFAR10-C, CIFAR100-C, Tiny ImageNet-C and ImageNet-C by $3 . 0 3 \%$ , $3 . 4 9 \%$ , $1 . 8 2 \%$ and $0 . 7 1 \%$ respectively.
40
+
41
+ # 2 Related Work
42
+
43
+ # 2.1 Robustness to Distributional Shifts
44
+
45
+ Hendrycks et al. [1] pioneer the study of prediction errors exhibited by machine learning models on unseen natural corruptions and perturbations. They introduce two variants of the original ImageNet validation set to evaluate the model’s robustness: the ImageNet-C for input corruption robustness, and the ImageNet-P for input perturbation robustness. The former applies 15 diverse corruptions drawn from four main categories (noise, blur, weather, and digital) on ImageNet validation images. The latter contains perturbation sequences generated from each image. Recht et al. [30, 2] collect CIFAR10.1 and ImageNet-V2 as a reproduction of the original CIFAR10 [31] and ImageNet [32] test sets, and find that a minute natural distribution shift caused by the minutiae in dataset collection process leads to a large drop in accuracy for a broad range of image classifiers. Geirhos et al. [33] observe that deep models trained on ImageNet are biased towards textures, and the model robustness can be improved by emphasizing more on global shape features [33–36]. Wang et al. [37] find that the benchmark test performance does not always translate to the real-world generalizability, and propose an efficient method to troubleshoot trained models using real-world unlabeled images. Hendrycks et al. [38] collect ImageNet-A with the new concept of natural adversarial examples: unmodified real-world images that falsify common machine learning models. Other representative benchmark efforts include [39–42, 3], all demonstrating the brittleness of deep models under various distribution shifts. Readers of interest are referred to a recent survey [43].
46
+
47
+ # 2.2 Data Augmentation: Random and Adversarial
48
+
49
+ Data augmentations have been widely used to increase training set diversity and improve model generalization ability [44, 21, 33, 22]. Among those methods, AugMix [5] achieves the outstanding robustness against natural corruptions by randomly mixing multiple diverse augmentations. It establishes high performance bars on many natural corruption benchmarks including CIFAR10-C, CIFAR100-C and ImageNet-C [1]. DeepAugment [3] feeds clean images to image-to-image models with randomly perturbed model weights to generate visually diverse augmented images. Combined with AugMix, it achieves state-of-the-art robustness on ImageNet-C [1]. Lately, a concurrent work MaxUp [45] generates hard training samples by selecting the worst-case weights in the MixUp [20] pipeline, to improve both model generalization ability and adversarial robustness. Our work shared a similar mindset to MaxUp, but we build on the more sophisticated AugMix pipeline and handle the resulting higher feature heterogeneity using a new normalization module.
50
+
51
+ Besides, Adversarial training (AT) [6, 46–52] utilizes adversarial samples as a special data augmentation method, and has also shown promise in improving model robustness against natural corruptions [23] and domain gaps [25], usually at the cost of increasing training time [27] and degrading the standard accuracy on clean images [53]. Volpi et al. [25] and Zhao et al. [26] augment the training set with samples from a fictitious adversarial domain to improve domain adaptation performance. Xie et al. [7] show that adversarial training can improve both standard accuracy and robustness against distribution shifts, with the help of auxiliary batch normalization. Adversarial Noise Training (ANT) [8] uses random Gaussian noise with learned adversarial hyperparameters (mean and variance) as the augmentation. Gowal et al. [54] propose to generate new augmented images by adversarially composing the representations of different original images. Wang et al. [55] improve the robustness of pose estimation models by adversarially mixing different corrupted images as data augmentation. Based on DeepAugment [3], Calian et al. [56] propose AdversarialAugment, which optimizes the parameters of image-to-image models to generate adversarially augmented images, achieving promising results against natural corruptions. Robey et al. [57] proposed model-based robust learning which generates augmented images with adversarial natural variations to improve model robustness against naturally-occurring conditions (e.g., snow, decolorization, shadow, and many others). The authors further generalized such idea to the domain generalization problem and achieved impressive results [58].
52
+
53
+ # 2.3 Normalization
54
+
55
+ Batch Normalization (BN) [59] has been a cornerstone for training deep networks. Inspired by BN, more task-specific modifications are proposed by exploiting different normalization axes, such as Instance Normalization (IN) [60], Layer Normalization (LN) [61] and Group Normalization (GN) [62]. A few latest works investigate to use multiple normalization layers instead of one BN. Zajkac et al. [63] use two separate BNs to handle the domain shift between labeled and unlabeled data in semi-supervised learning. Xie et al. [64, 7] observe the difference between standard and adversarial feature statistics during AT, and craft dual batch normalization (DuBN) to disentangle the standard and adversarial feature statistic to improve both the standard accuracy and robustness. While most deep models just use one normalization type throughout the network, IBN-Net [29] unifies IN and BN in one model. It finds that when applied together, IN tends to learn features invariant to appearance (colors, styles, etc.) changes, while BN is essential for preserving high-level semantic contents. IBN-Net shows that combining IN and BN in an appropriate manner can improve model generalization. A similar combination was also explored in the style transfer field [65], learning to selectively normalize only disturbing styles while preserving useful styles.
56
+
57
+ # 3 Method
58
+
59
+ # 3.1 Preliminary: The AugMix Framework
60
+
61
+ At a high level, AugMix creates a new composite image from a clean sample by first applying several simple augmentation operations to it before combining the results through random linear combinations. This augmentation scheme is coupled with a Jensen-Shannon consistency loss that enforces feature similarity among clean and augmented images. Specifically, AugMix consists of multiple augmentation chains (3 by default), each applied in parallel to the same input image. Each chain composes one to three randomly selected augmentation operations. These augmentations are the same as AutoAugment [21], but excluding those that overlap with ImageNet-C corruptions. The augmented images from each augmentation chains are then combined together with the original, clean sample using a linear combinations with randomly samples coefficients. The final image thus incorporates several sources of randomness, coming respectively from the choice of operations, the severity level of these operations, the lengths of the augmentation chains and the mixing weights. Despite its simplicity, AugMix achieves state-of-the-art corruption robustness. In the remaining of this section, we build on the previous AugMix work and propose AugMax, an augmentation strategy that further improves robustness.
62
+
63
+ # 3.2 AugMax: Augmented Training with Unified Diversity and Hardness
64
+
65
+ In this section, we rigorously introduce our new data augmentation method, AugMax, illustrated in Figure 2. At a high level, the main difference between AugMax and AugMix is a new optimization procedure used to select the mixing weights $m$ and $\pmb { w }$ .
66
+
67
+ Given a data distribution $\mathbb { D }$ over images $\pmb { x } \in \mathbb { R } ^ { d }$ and labels $\pmb { y } \in \mathbb { R } ^ { c }$ , our goal is to train a mapping (classifier) $f : \mathbb { R } ^ { d } \mathbb { R } ^ { c }$ from images to output softmax probabilities, parameterized by $\pmb \theta$ , that is robust to (unknown) distribution shifts. We minimize the empirical risk
68
+
69
+ $$
70
+ \operatorname* { m i n } _ { \pmb { \theta } } \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } } \ \mathcal { L } ( f ( \pmb { x } ; \pmb { \theta } ) , \pmb { y } ) ,
71
+ $$
72
+
73
+ where $\mathcal L ( \cdot , \cdot )$ is the loss function (e.g., cross-entropy). As illustrated in Figure 2, an AugMax image $\pmb { x } ^ { * }$ is generated by learning a set of adversarial mixing parameters $m ^ { * } , w ^ { * }$ which maximizes the loss:
74
+
75
+ $$
76
+ { \pmb x } ^ { * } = g ( { \pmb x } _ { o r i g } ; m ^ { * } , { \pmb w } ^ { * } ) ,
77
+ $$
78
+
79
+ where $g ( \cdot )$ denotes the AugMax augmentation function, $\pmb { x } _ { o r i g }$ is the original image, and
80
+
81
+ $$
82
+ m ^ { * } , \boldsymbol { w } ^ { * } = \underset { m , w } { \arg \operatorname* { m a x } } \mathcal { L } \big ( f ( g ( x _ { o r i g } ; m , w ) ; \theta ) , y \big ) , \quad \mathrm { s . t . } m \in [ 0 , 1 ] , w \in [ 0 , 1 ] ^ { b } , w ^ { T } \mathbf { 1 } = 1 .
83
+ $$
84
+
85
+ To simplify the optimization problem in Eq. (3), we use a re-parameterization trick by setting ${ \pmb w } = \sigma ( { \pmb p } )$ , where $\sigma ( \cdot )$ is the softmax function, and convert the optimization into a differentiable one:
86
+
87
+ $$
88
+ m ^ { * } , \pmb { p } ^ { * } = \operatorname * { a r g m a x } _ { m \in [ 0 , 1 ] , \pmb { p } \in \mathbb { R } ^ { b } } \mathcal { L } ( f ( g ( \pmb { x } _ { o r i g } ; m , \sigma ( \pmb { p } ) ) ; \theta ) , \pmb { y } ) ; \quad \pmb { w } ^ { * } = \sigma ( \pmb { p } ^ { * } )
89
+ $$
90
+
91
+ Training with AugMax augmentation can then be written altogether as minimax optimization:
92
+
93
+ $$
94
+ \begin{array} { r l } & { \underset { \theta } { \operatorname* { m i n } } \mathbb { E } _ { ( \boldsymbol { x } , \boldsymbol { y } ) \sim \mathcal { D } } \frac { 1 } { 2 } [ \mathcal { L } ( f ( \boldsymbol { x } ^ { * } ) ; \boldsymbol { \theta } ) , \boldsymbol { y } ) + \mathcal { L } ( f ( \boldsymbol { x } ) ; \boldsymbol { \theta } ) , \boldsymbol { y } ) ] + \lambda \mathcal { L } _ { c } ( \boldsymbol { x } , \boldsymbol { x } ^ { * } ) } \\ & { \mathrm { s . t . } \boldsymbol { x } ^ { * } = g ( \boldsymbol { x } ; m ^ { * } , \boldsymbol { w } ^ { * } ) ; \boldsymbol { w } ^ { * } = \sigma ( p ^ { * } ) ; \boldsymbol { m } ^ { * } , p ^ { * } = \underset { m \in [ 0 , 1 ] , p \in \mathbb { R } ^ { b } } { \arg \operatorname* { m a x } } \mathcal { L } ( f ( g ( \boldsymbol { x } ; m , \sigma ( p ) ) ; \boldsymbol { \theta } ) , \boldsymbol { y } ) } \end{array}
95
+ $$
96
+
97
+ where $\mathcal { L } _ { c }$ is a consistency loss regularizing augmented images to have similar model outputs with the original images and $\lambda$ is the trade-off parameter. Our implementation of $\mathcal { L } _ { c }$ is adapted from [5]:
98
+
99
+ $$
100
+ \mathcal { L } _ { c } ( { \pmb x } , { \pmb x } ^ { * } ) = \mathrm { J S } ( f ( { \pmb x } ; \theta ) , f ( \tilde { { \pmb x } } ; \theta ) , f ( { \pmb x } ^ { * } ; \theta ) )
101
+ $$
102
+
103
+ with $\mathrm { J } \mathrm { S } ( \cdot )$ being the Jensen-Shannon divergence and $\tilde { \pmb x }$ being the augmented image generated by AugMix from $_ { \textbf { \em x } }$ . In order to reduce the training complexity overhead caused by adversarial training, we employ an accelerated adversarial attack method [28] to solve Eq. (4), which adds only a reasonable amount of extra complexity compared to AugMix baseline. The algorithm to solve Eq. (5) is summarized in Appendix A.
104
+
105
+ Visualization of the effects of diversity and hardness To illustrate the motivation behind AugMax, we visualize the feature representations induced by different augmentation methods to showcase their diversity and hardness in Figure 1. Specifically, we visualize the impact of various data augmentation methods on the feature representations obtained with a ResNeXt29 that is normally trained on CIFAR-10. Note that the model is trained using only default standard augmentations (i.e., random flipping and translation), and therefore has never seen augmentation from AugMix, AugMax, or PGD attack. Following [4], we visualize the penultimate layer feature distributions of training samples from three different classes. Three hundred training images are selected from each class for visualization. For AugMix and $\ell _ { \infty }$ PGD attack, we use the same hyperparameters in the original papers [5, 6].
106
+
107
+ We observe in Figure 1 that the clean images form well-separated clusters in the feature space, leaving large regions between those clusters empty. This potentially causes uncertain and unreliable generalization if new test samples (from a shifted distribution) fall into those regions. AugMix enlarges each cluster to cover a broader region, effectively increasing sample diversity. However, after augmentation, very few samples are close to the decision boundaries, revealing an inability to generate hard samples. Samples from the PGD attack, on the other hand, collapse into a small region around the classification borders, losing feature diversity. We further investigate the method through ablation studies in Section 4.3.
108
+
109
+ # 3.3 DuBIN: Disentangled Normalization for Heterogeneous Features
110
+
111
+ AugMax leads to better coverage of the input space by unifying sample diversity and hardness, as demonstrated in Figure 1. While such more versatile distribution in data augmentation has the potential to increase robustness, we do observe that naive incorporation of AugMax leads to relatively marginal improvement over AugMix (see Section 4.3). This is due to the comprehensiveness of AugMax can also lead to a higher feature heterogeneity, which may require larger model capacity to encode. To address this problem, we design a novel normalization layer, termed Dual Batch-and-Instance Normalization (DuBIN), to disentangle the instance-level heterogeneity.
112
+
113
+ As illustrated in Figure 3, DuBIN consists of two parallel parts: (1) a dual batch normalization (DuBN) [7], which is the by-default normalization layer to use for adversarial training [7, 64], to disentangle the group-level statistics of the clean and corner-case augmented samples2; and (2) an additional instance normalization, to account for instancelevel feature statistics due to augmentation diversity. At each layer, the input feature is split into halves along the channel dimension: one half is then fed into IN, and the other fed into DuBN. Finally, the outputs of IN and DuBN are concatenated back along the channel dimension for the next layer.
114
+
115
+ ![](images/37442dadfb77175a367b93c847e84dc9a4c01bb733ad3830171f67604343a360.jpg)
116
+ Figure 3: Illustration of DuBIN. “Split” and “cat” represent splitting and concatenating on features along the channel dimension. The input feature $x$ with $C$ channels is split into halves (i.e., $x _ { A }$ and $x _ { B }$ , each with $C / 2$ channels). Each half goes into different normalization layers (either IN or DuBN) and the outputs are concatenated back along the channel dimension.
117
+
118
+ To provide additional insights of DuBIN, we compare the BN statistics of AugMax-DuBN and AugMax-DuBIN in Table 1. $\overline { { \sigma } } _ { c } ^ { 2 }$ and $\overline { { \sigma } } _ { a } ^ { 2 }$ represent the average batch normalization variance over all channels of $B N _ { c }$ and $B N _ { a }$ , respectively. We observe that both $\overline { { \sigma } } _ { c } ^ { 2 }$ and $\overline { { \sigma } } _ { a } ^ { 2 }$ are smaller in the DuBIN network than those in the DuBN counterpart. This shows that the IN branch in DuBIN can reduce the feature diversity that BN otherwise needs to model, by
119
+
120
+ Table 1: BN statistics of different layers in WRN40-2 with DuBN or DuBIN trained on CIFAR100 using AugMax training.
121
+
122
+ <table><tr><td colspan="2">Layer</td><td>Block 1 layer 2</td><td>Block1 layer 3</td><td>Block 2 layer 2</td></tr><tr><td rowspan="3">AugMax-DuBN</td><td></td><td>0.0369</td><td>0.0450</td><td>0.0301</td></tr><tr><td>品</td><td>0.0469</td><td>0.0585</td><td>0.0382</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td rowspan="3">AugMax-DuBIN</td><td></td><td>0.0306</td><td>0.0403</td><td>0.0264</td></tr><tr><td></td><td>0.0348</td><td>0.0466</td><td>0.0292</td></tr><tr><td>R</td><td></td><td></td><td></td></tr></table>
123
+
124
+ encoding instance-level diversities. With lower feature variation, BNs can converge better with improved performance [66].
125
+
126
+ # 4 Experiments
127
+
128
+ Here, we introduce in detail the experimental setting, and report quantitative results for robustness against natural corruptions and distribution shifts. We show that our method induces better robustness than existing ones. We study the properties of our approach in thorough ablation studies.
129
+
130
+ # 4.1 Experimental Setup
131
+
132
+ Datasets and Models We evaluate our proposed method on CIFAR10, CIFAR100 [31], ImageNet [32] and Tiny ImageNet $\left( \mathrm { T I N } \right)$ . For neural architectures, we use a ResNet18 [67], WRN40-2 [68] and ResNeXt29 [69] on the CIFAR datasets, and ResNet18 on ImageNet and Tiny ImageNet4. To evaluate the model’s robustness against common natural corruptions, we use CIFAR10-C, CIFAR100- C, ImageNet-C and Tiny ImageNet-C (TIN-C) [1], which are generated by adding natural corruptions to the original test set images.
133
+
134
+ Evaluation Metrics Following established conventions [1, 5], we define robustness accuracy (RA) as the average classification accuracy over all 15 corruptions, to measure the models’ robustness on CIFAR10-C and CIFAR100-C. On ImageNet-C and Tiny ImageNet-C, we use both RA and mean corruption error (mCE) to evaluate robustness. As defined by [1], mCE is the weighted average of target model corruption
135
+
136
+ Table 2: Evaluation results on CIFAR10 and CIFAR10-C. The best metric is shown in bold.
137
+
138
+ <table><tr><td>Model</td><td>Metric</td><td>Normal</td><td>AugMix</td><td>AugMax-DuBIN</td></tr><tr><td rowspan="2">ResNet18</td><td>SA(%)</td><td>95.56</td><td>95.79</td><td>95.76 (-0.03)</td></tr><tr><td>RA(%)</td><td>74.75</td><td>89.49</td><td>90.36 (+0.87)</td></tr><tr><td rowspan="2">WRN40-2</td><td>SA(%)</td><td>94.78</td><td>95.67</td><td>95.68 (+0.01)</td></tr><tr><td>RA(%)</td><td>73.71</td><td>89.01</td><td>90.67 (+1.66)</td></tr><tr><td rowspan="2">ResNeXt29</td><td>SA(%)</td><td>95.60</td><td>96.25</td><td>96.39 (+0.14)</td></tr><tr><td>RA(%)</td><td>71.70</td><td>89.08</td><td>92.11 (+3.03)</td></tr></table>
139
+
140
+ errors normalized by the corruption errors of a baseline model across different types of corruptions. We use the AlexNet provide in [1] as the baseline model for experiments on ImageNet. Since [1] does not provide an off-the-shelf baseline model for Tiny ImageNet, we use the conventionally trained ResNet18 on Tiny ImageNet as the baseline model for experiments on Tiny ImageNet. We use standard accuracy (SA) to denote the classification accuracy on the original clean testing images.
141
+
142
+ Baseline Methods On CIFAR10-C and CIFAR100-C, we compare our method with the state-of-the-art method, AugMix [5]. In addition, AugMix has previously been combined with other orthogonal methods, such as DeepAugment [3], to further boost performance on ImageNet-C. Specifically, [3] combine DeepAugment as an orthogonal component to AugMix, and achieve state-of-the-art
143
+
144
+ Table 3: Evaluation results on CIFAR100 and CIFAR100-C. The best metric is shown in bold.
145
+
146
+ <table><tr><td>Model</td><td>Metric</td><td>Normal</td><td>AugMix</td><td>AugMax-DuBIN</td></tr><tr><td rowspan="2">ResNet18</td><td>SA(%)</td><td>77.99</td><td>78.23</td><td>78.69 (+0.46)</td></tr><tr><td>RA(%)</td><td>48.46</td><td>62.67</td><td>65.75 (+3.08)</td></tr><tr><td rowspan="2">WRN40-2</td><td>SA(%)</td><td>76.19</td><td>77.03</td><td>76.80 (-0.23)</td></tr><tr><td>RA(%)</td><td>46.80</td><td>64.56</td><td>66.35 (+1.79)</td></tr><tr><td rowspan="2">ResNeXt29</td><td>SA(%)</td><td>79.95</td><td>78.58</td><td>80.70 (+2.12)</td></tr><tr><td>RA(%)</td><td>47.76</td><td>65.37</td><td>68.86 (+3.49)</td></tr></table>
147
+
148
+ performance on ImageNet-C with DeepAugment $^ +$ AugMix [3]. To allow comparison with this scenario, we also run the following comparison experiment on ImageNet-C and Tiny ImageNet-C: (1) AugMix v.s. AugMax and (2) DeepAugment $^ +$ AugMix v.s. DeepAugment $^ +$ AugMax. We show that the advantages of AugMax still exist when combined with other orthogonal methods.
149
+
150
+ Finally, we also compare AugMax with ANT [8], which utilizes Gaussian noises with learned distribution parameters for data augmentation. Since models tend to generalize better on test images similar to those seen during training [70], ANT mainly improves robustness against high frequency corruptions (e.g., additive noises), while achieving comparable robustness on other unseen corruptions (e.g., bluring) with AugMix. Following [8], we perform the comparison on the subset of Tiny ImageNet-C with 12 remaining corruptions after removing all additive noises.
151
+
152
+ Table 4: Evaluation results on ImageNet and ImageNet-C. The best metric is shown in bold.
153
+
154
+ <table><tr><td>Method</td><td>SA (%,↑)</td><td>RA (%,↑)</td><td>mCE(%,↓)</td></tr><tr><td>Normal</td><td>69.83</td><td>30.91</td><td>87.47</td></tr><tr><td>AugMix</td><td>68.06 67.62</td><td>34.58 35.01</td><td>83.08 82.56</td></tr><tr><td>AugMax-DuBIN</td><td>(-0.44)</td><td>(+0.43)</td><td>(-0.52)</td></tr><tr><td>DeepAugment + AugMix</td><td>65.32</td><td>45.84</td><td>69.29</td></tr><tr><td>DeepAugment +</td><td>64.43</td><td>46.55</td><td>68.47</td></tr><tr><td>AugMax-DuBIN</td><td>(-0.89)</td><td>(+0.71)</td><td>(-0.82)</td></tr></table>
155
+
156
+ Implementation Details We follow [5] for hyperparameter settings. Specifically, for all experiments on CIAFR10 and CIFAR100, we use SGD optimizer with initial learning rate 0.1 and cosine annealing learning rate scheduler, and train all models for 200 epochs. For all experiments on ImageNet, we use SGD optimizer with initial learning rate 0.1 and batch size 256 to train the model for 90 epochs. We reduce the learning rate by $1 / 1 0$ at the 30-th and 60-th epoch. For all experiments on Tiny ImageNet, we train for 200 epochs and decay the learning rate at the 100-th and 150-th epoch. Other hyperparameter settings are identical as those in ImageNet experiments.
157
+
158
+ We set batch size to 256 for all experiments. In Eq. (4), $m$ and $\pmb { p }$ are uniformly randomly initialized between 0 and 1. We use PGD to update $m$ : first do gradient ascend on $m$ and then project it back into the $[ 0 , 1 ]$ interval. $\pmb { p }$ is updated using gradient ascend. AugMax follows the same rules as AugMix [5] to randomly select augmentation operation type, severity level and chain length. Following [6], we iteratively solve the inner maximization and outer minimization problems in Eq. (5): the inner maximization is updated for $n$ steps, for every 1 step update on
159
+
160
+ Table 5: Evaluation results on TIN and TIN-C. The best metric is shown in bold.
161
+
162
+ <table><tr><td>Method</td><td>SA (%,↑)</td><td>RA (%,↑)</td><td>mCE(%,↓)</td></tr><tr><td>Normal</td><td>61.64</td><td>23.91</td><td>100.00</td></tr><tr><td>AugMix</td><td>61.79 62.21</td><td>36.85 38.67</td><td>83.04 80.72</td></tr><tr><td>AugMax-DuBIN</td><td>(+0.42)</td><td>(+1.82)</td><td>(-2.32)</td></tr><tr><td>DeepAugment + AugMix</td><td>59.59</td><td>40.67</td><td>78.28</td></tr><tr><td>DeepAugment +</td><td>59.72</td><td>40.99</td><td>77.83</td></tr><tr><td>AugMax-DuBIN</td><td>(+0.13)</td><td>(+0.32)</td><td>(-0.45)</td></tr></table>
163
+
164
+ the outer minimization. Both $m$ and $\pmb { p }$ are updated with step size $\alpha = 0 . 1$ . We set $n = 5$ on ImageNet for efficiency and $n = 1 0$ on other datasets. We set $\lambda$ in Eq. (5) to be 12 on ImageNet and 10 on all other datasets, except for ResNet18 on CIFAR100 where we find $\lambda = 1$ leads to better performance. All experiments are conducted on a server with four NVIDIA RTX A6000 GPUs.
165
+
166
+ # 4.2 Robustness against Natural Corruptions
167
+
168
+ Results on CIFAR10-C and CIFAR100-C are shown in Table 2 and 3 respectively, where “normal” means training with default standard augmentations (e.g., random flipping and translation). From the results, we see that AugMax-DuBIN achieves new state-of-the-art performance on both datasets with different model structures. For example, compared with AugMix, our method improves accuracy by as high as $3 . 0 3 \%$ and $3 . 4 9 \%$ on CIFAR10-C and CIFAR100-C, respectively. Moreover, we observe that our method benefits larger models more. Specifically, in both CIFAR10 and CIFAR100 experiments, the largest robustness gain is achieved on ResNeXt29, which has the largest capacity among the three models.
169
+
170
+ Results on ImageNet are shown in Table 4. AugMax-DuBIN outperforms AugMix by $0 . 5 2 \%$ in terms of $\mathrm { m C E }$ on ImageNet-C. Further combining AugMax-DuBIN with DeepAugment outperforms AugMix $^ +$ DeepAugment by $0 . 8 2 \%$ in terms of mCE, achieving a new stateof-the-art performance on ImageNet-C. This
171
+
172
+ Table 6: Evaluation results on TIN and TIN-C (w/o noise). The best metric is shown in bold.
173
+
174
+ <table><tr><td>Method</td><td>SA(%,↑)</td><td>RA(%,↑)</td><td>mCE(%,)</td></tr><tr><td>Normal</td><td>61.64</td><td>24.38</td><td>100.00</td></tr><tr><td>AugMix</td><td>61.79</td><td>37.63</td><td>82.54</td></tr><tr><td>ANT</td><td>61.26</td><td>35.30</td><td>85.70</td></tr><tr><td>AugMax-DuBIN</td><td>62.21</td><td>38.66</td><td>80.29</td></tr></table>
175
+
176
+ shows that AugMax can be used as a more advanced basic building block for model robustness and inspires future researches to build other defense methods on top of it.
177
+
178
+ Results on Tiny ImageNet-C are shown in Table 5 and Table 6. From Table 5, we see that our method improves the mCE by $2 . 3 2 \%$ compared with AugMix and $0 . 4 5 \%$ when combined with DeepAugment. From Table 6, we can see our method outperforms ANT by a considerable margin.
179
+
180
+ Training Time Since we use an accelerated adversarial training method [28] to solve Eq. (4), the worst-case mixing strategy can be searched efficiently. As a result, AugMax adds only a modest training overhead over AugMix, and is significantly more efficient than traditional adversarial training (AT). Detailed training time is shown in Table 7.
181
+
182
+ Table 7: Training time on ImageNet with ResNet18, reported on a single NVIDIA A6000.
183
+
184
+ <table><tr><td>Method</td><td>Time (sec/epoch)</td></tr><tr><td>Normal</td><td>2669</td></tr><tr><td>AugMix</td><td>3622</td></tr><tr><td>AT[6]</td><td>37162</td></tr><tr><td>AugMax</td><td>5264</td></tr></table>
185
+
186
+ # 4.3 Ablation Study
187
+
188
+ Analysis of Different Normalization Layers In this paragraph, we compare AugMax/AugMix when combined with different normalization schemes. When using DuBN or DuBIN, we route original images to the $B N _ { c }$ , and AugMax/AugMix images to $B N _ { a }$ . Since it is the by-default setting to use disentangled normalization layers (e.g., DuBN) for original and augmentation images in adversarial training [7, 64], we follow this traditional routing and combine AugMax with DuBN or DuBIN instead of BN or IBN. It is fair to compare AugMax-DuBN/DuBIN with either AugMixBN/IBN or AugMix-DuBN/DuBIN.
189
+
190
+ Results are shown in Table 8. AugMax-DuBN outperforms both AugMix-BN and AugMixDuBN, and AugMax-DuBIN outperforms both AugMix-IBN and AugMix-DuBIN. Noticeably, when combined with AugMix, DuBIN also helps improve robustness. This shows the potential of applying DuBIN to other diversity augmentation methods for general performance improvement.
191
+
192
+ We also conduct stability analyses on these experiments, by showing the statistical significance of the improvements achieved by
193
+
194
+ Table 8: Ablation results on DuBIN. RA $( \% )$ on CIFAR10/100-C with WRN40-2 backbone are reported. Mean and standard derivation over three random seeds are shown for each experiment.
195
+
196
+ <table><tr><td>Method</td><td>CIFAR10-C</td><td>CIFAR100-C</td></tr><tr><td>AugMix-BN</td><td>89.01 (± 0.03)</td><td>64.56 (± 0.04)</td></tr><tr><td>AugMix-IBN</td><td>89.17 (± 0.24)</td><td>63.94 (± 0.28)</td></tr><tr><td>AugMix-DuBN</td><td>89.11 (± 0.21)</td><td>64.07 (± 0.38)</td></tr><tr><td>AugMix-DuBIN</td><td>89.74(± 0.35)</td><td>65.02 (± 0.58)</td></tr><tr><td>AugMax-DuBN</td><td>89.60 (± 0.62)</td><td>65.06 (± 0.28)</td></tr><tr><td>AugMax-DuBIN</td><td>90.67 (± 0.16)</td><td>66.35 (± 0.21)</td></tr></table>
197
+
198
+ AugMax-DuBIN over the algorithm randomness. Specifically, we run all experiments in Table 8 using three different random seeds, and report the mean (denoted as $\mu _ { . }$ ) and standard derivation (denoted as $\sigma$ ) of accuracy in the form of $\mu$ $( \pm \sigma )$ in Table 8. As we can observe, the improvements achieved by AugMax-DuBIN are statistically significant and consistent.
199
+
200
+ AugMax Hyperparameters In this paragraph, we check the sensitivity of AugMax with respect to its hyperparameters: maximization steps $n$ , step size $\alpha$ and consistency loss tradeoff parameter $\lambda$ . The results are shown in Table 9. We first fix $\lambda = 1 0$ and try different values for $n$ and $k$ . We fix $k = 1$ when adjust
201
+
202
+ Table 9: Ablation results on AugMax-DuBIN update step number $n$ and, early-stopping step $k$ and consistency loss tradeoff parameter $\lambda$ . Results are reported on CIFAR10/CIFAR10-C with WRN40-2.
203
+
204
+ <table><tr><td></td><td colspan="2">n</td><td colspan="3"></td><td colspan="3"></td></tr><tr><td></td><td>5</td><td>10</td><td>1</td><td>k2</td><td>3</td><td>1</td><td>入 10</td><td>15</td></tr><tr><td>SA(%)</td><td>95.78</td><td>95.68</td><td>95.68</td><td>95.60</td><td>95.51</td><td>95.90</td><td>95.68</td><td>95.88</td></tr><tr><td>RA (%)</td><td>90.49</td><td>90.67</td><td>90.67</td><td>90.38</td><td>90.21</td><td>88.89</td><td>90.67</td><td>90.30</td></tr></table>
205
+
206
+ ing $n$ and fix $n = 1 0$ when adjusting $k$ . As we can see, AugMax is stable with respect to different values of $n$ and $k$ . We use $n = 1 0$ and $k = 1$ as the default values since they empirically yield good results at low training overhead. We then fix $n = 1 0 , k = 1$ and adjust $\lambda$ . We find robustness peaks at around $\lambda = 1 0$ , which we set as the default value.
207
+
208
+ Comparison with Different Diversity and Hardness Strategies In this paragraph, we study different strategies to combine diversity and hardness. The results confirm that diversity and hardness are two complementary dimensions and their proper unification boosts model robustness.
209
+
210
+ Specifically, we compare AugMax with baseline methods from each strategy group (i.e., diversity or hardness), and other possible strategies to combine both. Besides AugMix and Adversarial Training (e.g., PDGAT [6], FAT [28]), which are the two representative examples for diversity and hardness as shown in Figure 1, we also design the following baseline methods. (1) AugMix+PGDAT: using both AugMix and adversarial images for augmentation. This is a naive baseline to combine diversity with hardness. (2)
211
+
212
+ Table 10: Results of different augmentation strategies on CIFAR100(-C) with ResNet18.
213
+
214
+ <table><tr><td>Method</td><td>Strategy</td><td>SA(%)</td><td>RA(%)</td></tr><tr><td>Normal</td><td>-</td><td>77.99</td><td>48.46</td></tr><tr><td>AugMix [5]</td><td>(diversity)</td><td>78.23</td><td>62.67</td></tr><tr><td>PGDAT [6]</td><td rowspan="4">(hardness)</td><td>60.94</td><td>47.71</td></tr><tr><td>FAT[28]</td><td>61.51</td><td>48.70</td></tr><tr><td>AdvMax</td><td>56.61</td><td>38.65</td></tr><tr><td>AugMix+PGDAT</td><td>61.68</td><td>51.39</td></tr><tr><td>AdvMix</td><td rowspan="2">(diversity &amp;adversity)</td><td>72.36</td><td>56.89</td></tr><tr><td>AugMax-DuBIN</td><td>78.52</td><td>64.02</td></tr></table>
215
+
216
+ AdvMix: applying adversarial attacks on the augmentation hyperparameters such as the rotation angles and translation pixel numbers [71, 72], while randomly selecting the mixing parameters; (3) AdvMax: applying adversarial attacks on both the augmentation hyperparameters and the mixing weights.5 Please see Appendix B for their implementation details.
217
+
218
+ The results are shown in Table 10. AugMax-DuBIN achieves the best performance, outperforming all methods from either diversity or hardness group. This shows diversity and hardness to be indeed complementary. On the other hand, the other two naive baselines jointly considering diversity and hardness achieve poorer performance, showing it nontrivial to design a method achieving good balance between diversity and hardness.
219
+
220
+ # 4.4 Robustness against Other Distribution Shifts
221
+
222
+ Although AugMax mainly aims at improving model robustness against common corruptions, we find that it can also gain robustness against other types of distribution shifts. Specifically, we evaluate on the distribution shifts caused by the differences in data collection process using CIFAR10.1 [30], and against Spatial Transform adversarial Attacks (STA) [71] on CIFAR10-STA. We generate CIFAR10-STA by applying the worst-of- $k$ attack with $k = 1 0$ on CIFAR10 test set following [71].
223
+
224
+ Table 11: Robustness against other distribution shifts. Accuracy $( \% )$ on CIFAR10.1 and CIFAR10-STA are evaluated on ResNeXt29 trained on CIFAR10.
225
+
226
+ <table><tr><td>Method</td><td>CIFAR10.1</td><td>CIFAR10-STA</td></tr><tr><td>Normal</td><td>88.90</td><td>30.30</td></tr><tr><td>AugMix</td><td>88.90</td><td>54.30</td></tr><tr><td>AugMax-DuBIN</td><td>90.64</td><td>63.20</td></tr></table>
227
+
228
+ Results are reported in Table 11 (using the same ResNeXt29 models trained on CIFAR10 as in Section 4.2). AugMax-DuBIN steadily outperforms AugMix against both distributional shifts.
229
+
230
+ # 5 Conclusion
231
+
232
+ In this paper, we propose AugMax, a novel data augmentation strategy, that significantly improves robustness by strategically unifying diversity and hardness. To enable efficient training while facing the resulting heterogeneous features, we design a novel normalization scheme termed DuBIN. Using the combination of AugMax and DuBIN, we consistently demonstrate state-of-the-art robustness on several natural corruption benchmarks.
233
+
234
+ AugMax unifies diversity and hardness in a heuristic manner. While we showed in ablation studies that AugMax outperforms other heuristic combinations, there may be better trade-offs available. We leave such study for future work and focus in this paper on showing the benefit of unifying diversity and hardness, which were separately considered in previous research.
235
+
236
+ # Acknowledgement
237
+
238
+ Z.W. is supported by the U.S. Army Research Laboratory Cooperative Research Agreement W911NF17-2-0196 (IOBT REIGN), and an NVIDIA Applied Research Accelerator Program.
239
+
240
+ # References
241
+
242
+ [1] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations (ICLR), 2019. 1, 3, 4, 7
243
+ [2] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do ImageNet classifiers generalize to ImageNet? arXiv preprint arXiv:1902.10811, 2019. 3
244
+ [3] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization. In IEEE International Conference on Computer Vision (ICCV), pages 8340–8349, 2021. 1, 2, 4, 7
245
+ [4] Rafael Müller, Simon Kornblith, and Geoffrey Hinton. When does label smoothing help? arXiv preprint arXiv:1906.02629, 2019. 2, 6
246
+ [5] Dan Hendrycks, Norman Mu, Ekin D Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. AugMix: A simple data processing method to improve robustness and uncertainty. In International Conference on Learning Representations (ICLR), 2020. 1, 2, 4, 5, 6, 7, 8, 9, 15
247
+ [6] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018. 1, 2, 4, 6, 8, 9
248
+ [7] Cihang Xie, Mingxing Tan, Boqing Gong, Jiang Wang, Alan Yuille, and Quoc V Le. Adversarial examples improve image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 819–828, 2020. 2, 3, 4, 6, 9
249
+ [8] Evgenia Rusak, Lukas Schott, Roland S Zimmermann, Julian Bitterwolf, Oliver Bringmann, Matthias Bethge, and Wieland Brendel. A simple way to make neural networks robust against diverse image corruptions. In European Conference on Computer Vision (ECCV), pages 53–69, 2020. 1, 2, 4, 7
250
+ [9] Matthias Hein and Maksym Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. In Advances in Neural Information Processing Systems (NeurIPS), pages 2266–2276, 2017. 1
251
+ [10] Tsui-Wei Weng, Huan Zhang, Hongge Chen, Zhao Song, Cho-Jui Hsieh, Duane S. Boning, Inderjit S. Dhillon, and Luca Daniel. Towards fast computation of certified robustness for ReLU networks. In International Conference on Machine Learning (ICLR), pages 5273–5282, 2018.
252
+ [11] Tsui-Wei Weng, Huan Zhang, Pin-Yu Chen, Jinfeng Yi, Dong Su, Yupeng Gao, Cho-Jui Hsieh, and Luca Daniel. Evaluating the robustness of neural networks: An extreme value theory approach. In International Conference on Learning Representations (ICLR), 2018. 1
253
+ [12] Stephan Zheng, Yang Song, Thomas Leung, and Ian Goodfellow. Improving the robustness of deep neural networks via stability training. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 4480–4488, 2016. 1
254
+ [13] Dan Hendrycks, Kimin Lee, and Mantas Mazeika. Using pre-training can improve model robustness and uncertainty. In International Conference on Machine Learning (ICML), pages 2712–2721, 2019. 1
255
+ [14] Tianlong Chen, Sijia Liu, Shiyu Chang, Yu Cheng, Lisa Amini, and Zhangyang Wang. Adversarial robustness: From self-supervised pre-training to fine-tuning. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 699–708, 2020.
256
+ [15] Ziyu Jiang, Tianlong Chen, Ting Chen, and Zhangyang Wang. Robust pre-training by adversarial contrastive learning. In Advances in Neural Information Processing Systems (NeurIPS), pages 16199–16210, 2020.
257
+ [16] Jiachen Sun, Yulong Cao, Christopher Choy, Zhiding Yu, Chaowei Xiao, Anima Anandkumar, and Z Morley Mao. Improving adversarial robustness in 3D point cloud classification via self-supervisions. In International Conference on Machine Learning Workshop (ICMLW), 2021. 1
258
+ [17] Richard Zhang. Making convolutional networks shift-invariant again. In International Conference on Machine Learning (ICML), pages 7324–7334, 2019. 1
259
+ [18] Cristina Vasconcelos, Hugo Larochelle, Vincent Dumoulin, Nicolas Le Roux, and Ross Goroshin. An effective anti-aliasing approach for residual networks. arXiv preprint arXiv:2011.10675, 2020.
260
+ [19] Jungkyu Lee, Taeryun Won, and Kiho Hong. Compounding the performance improvements of assembled techniques in a convolutional neural network. arXiv preprint arXiv:2001.06268, 2020. 1
261
+ [20] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. MixUp: Beyond empirical risk minimization. In International Conference on Learning Representations (ICLR), 2018. 2, 4
262
+ [21] Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. AutoAugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018. 4, 5
263
+ [22] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. CutMix: Regularization strategy to train strong classifiers with localizable features. In IEEE International Conference on Computer Vision (ICCV), pages 6023–6032, 2019. 2, 4
264
+ [23] Justin Gilmer, Nicolas Ford, Nicholas Carlini, and Ekin Cubuk. Adversarial examples are a natural consequence of test error in noise. In International Conference on Machine Learning (ICML), pages 2280–2289, 2019. 2, 4
265
+ [24] Tianlong Chen, Yu Cheng, Zhe Gan, Jianfeng Wang, Lijuan Wang, Zhangyang Wang, and Jingjing Liu. Adversarial feature augmentation and normalization for visual recognition. arXiv preprint arXiv:2103.12171, 2021. 2
266
+ [25] Riccardo Volpi, Hongseok Namkoong, Ozan Sener, John C. Duchi, Vittorio Murino, and Silvio Savarese. Generalizing to unseen domains via adversarial data augmentation. In Advances in Neural Information Processing Systems (NeurIPS), pages 5334–5344, 2018. 2, 4
267
+ [26] Long Zhao, Ting Liu, Xi Peng, and Dimitris Metaxas. Maximum-entropy adversarial data augmentation for improved generalization and robustness. In Advances in Neural Information Processing Systems (NeurIPS), 2020. 2, 4
268
+ [27] Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, and Bin Dong. You only propagate once: Accelerating adversarial training via maximal principle. In Advances in Neural Information Processing Systems (NeurIPS), pages 227–238, 2019. 2, 4
269
+ [28] Jingfeng Zhang, Xilie Xu, Bo Han, Gang Niu, Lizhen Cui, Masashi Sugiyama, and Mohan Kankanhalli. Attacks which do not kill training make adversarial learning stronger. In International Conference on Machine Learning (ICML), pages 11278–11287, 2020. 3, 5, 8, 9, 15
270
+ [29] Xingang Pan, Ping Luo, Jianping Shi, and Xiaoou Tang. Two at once: Enhancing learning and generalization capacities via ibn-net. In European Conference on Computer Vision (ECCV), pages 464–479, 2018. 3, 4
271
+ [30] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do CIFAR-10 classifiers generalize to CIFAR-10? arXiv preprint arXiv:1806.00451, 2018. 3, 10
272
+ [31] Alex Krizhevsky. Learning multiple layers of features from tiny images. Master’s thesis, University of Toronto, 2009. 3, 7
273
+ [32] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 248–255, 2009. 3, 7
274
+ [33] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations (ICLR), 2019. 3, 4
275
+ [34] Katherine Hermann, Ting Chen, and Simon Kornblith. The origins and prevalence of texture bias in convolutional neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pages 19000–19015, 2020.
276
+ [35] Yingwei Li, Qihang Yu, Mingxing Tan, Jieru Mei, Peng Tang, Wei Shen, Alan Yuille, and Cihang Xie. Shape-texture debiased neural network training. In International Conference on Learning Representations (ICLR), 2021.
277
+ [36] Mingjie Sun, Zichao Li, Chaowei Xiao, Haonan Qiu, Bhavya Kailkhura, Mingyan Liu, and Bo Li. Can shape structure features improve model robustness under diverse adversarial settings? In IEEE International Conference on Computer Vision (ICCV), pages 7526–7535, 2021. 3
278
+ [37] Haotao Wang, Tianlong Chen, Zhangyang Wang, and Kede Ma. I am going MAD: Maximum discrepancy competition for comparing classifiers adaptively. In International Conference on Machine Learning (ICLR), 2020. 3
279
+ [38] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019. 4
280
+ [39] Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems (NeurIPS), pages 10506–10518, 2019. 4
281
+ [40] Keren Gu, Brandon Yang, Jiquan Ngiam, Quoc Le, and Jonathon Shlens. Using videos to evaluate image model robustness. arXiv preprint arXiv:1904.10076, 2019.
282
+ [41] Vaishaal Shankar, Achal Dave, Rebecca Roelofs, Deva Ramanan, Benjamin Recht, and Ludwig Schmidt. Do image classifiers generalize across time? arXiv preprint arXiv:1906.02168, 2019.
283
+ [42] Rohan Taori, Achal Dave, Vaishaal Shankar, Nicholas Carlini, Benjamin Recht, and Ludwig Schmidt. Measuring robustness to natural distribution shifts in image classification. In Advances in Neural Information Processing Systems (NeurIPS), pages 18583–18599, 2020. 4
284
+ [43] Sina Mohseni, Haotao Wang, Zhiding Yu, Chaowei Xiao, Zhangyang Wang, and Jay Yadawa. Practical machine learning safety: A survey and primer. arXiv preprint arXiv:2106.04823, 2021. 4
285
+ [44] Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. arXiv preprint arXiv:1708.04896, 2017. 4
286
+ [45] Chengyue Gong, Tongzheng Ren, Mao Ye, and Qiang Liu. MaxUp: A simple way to improve generalization of neural network training. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2474–2483, 2021. 4
287
+ [46] Shupeng Gui, Haotao Wang, Haichuan Yang, Chen Yu, Zhangyang Wang, and Ji Liu. Model compression with adversarial robustness: A unified optimization framework. In Advances in Neural Information Processing Systems (NeurIPS), pages 1283–1294, 2019. 4
288
+ [47] Ting-Kuei Hu, Tianlong Chen, Haotao Wang, and Zhangyang Wang. Triple wins: Boosting accuracy, robustness and efficiency together by enabling input-adaptive inference. In International Conference on Learning Representations (ICLR), 2020.
289
+ [48] Haotao Wang, Tianlong Chen, Shupeng Gui, Ting-Kuei Hu, Ji Liu, and Zhangyang Wang. Once-for-all adversarial training: In-situ tradeoff between robustness and accuracy for free. In Advances in Neural Information Processing Systems (NeurIPS), pages 7449–7461, 2020.
290
+ [49] Tianlong Chen, Zhenyu Zhang, Sijia Liu, Shiyu Chang, and Zhangyang Wang. Robust overfitting may be mitigated by properly learned smoothening. In International Conference on Learning Representations (ICLR), 2020.
291
+ [50] Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. In Advances in Neural Information Processing Systems (NeurIPS), pages 2958–2969, 2020.
292
+ [51] Ruize Gao, Feng Liu, Jingfeng Zhang, Bo Han, Tongliang Liu, Gang Niu, and Masashi Sugiyama. Maximum mean discrepancy test is aware of adversarial attacks. In International Conference on Machine Learning (ICML), pages 3564–3575, 2021.
293
+ [52] Jingfeng Zhang, Jianing Zhu, Gang Niu, Bo Han, Masashi Sugiyama, and Mohan Kankanhalli. Geometryaware instance-reweighted adversarial training. In International Conference on Learning Representations (ICLR), 2020. 4
294
+ [53] Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. In International Conference on Learning Representations (ICLR), 2019. 4
295
+ [54] Sven Gowal, Chongli Qin, Po-Sen Huang, Taylan Cemgil, Krishnamurthy Dvijotham, Timothy Mann, and Pushmeet Kohli. Achieving robustness in the wild via adversarial mixing with disentangled representations. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1211–1220, 2020. 4
296
+ [55] Jiahang Wang, Sheng Jin, Wentao Liu, Weizhong Liu, Chen Qian, and Ping Luo. When human pose estimation meets robustness: Adversarial algorithms and benchmarks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 11855–11864, 2021. 4
297
+ [56] Dan A Calian, Florian Stimberg, Olivia Wiles, Sylvestre-Alvise Rebuffi, Andras Gyorgy, Timothy Mann, and Sven Gowal. Defending against image corruptions through adversarial augmentations. arXiv preprint arXiv:2104.01086, 2021. 4
298
+ [57] Alexander Robey, Hamed Hassani, and George J Pappas. Model-based robust deep learning: Generalizing to natural, out-of-distribution data. arXiv preprint arXiv:2005.10247, 2020. 4
299
+ [58] Alexander Robey, George J Pappas, and Hamed Hassani. Model-based domain generalization. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 4
300
+ [59] Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning (ICML), pages 448–456, 2015. 4
301
+ [60] Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016. 4
302
+ [61] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. 4
303
+ [62] Yuxin Wu and Kaiming He. Group normalization. In European Conference on Computer Vision (ECCV), pages 3–19, 2018. 4
304
+ [63] Michał Zaj ˛ac, Konrad Zołna, and Stanisław Jastrz˛ebski. Split batch normalization: Improving semi- ˙ supervised learning under domain shift. arXiv preprint arXiv:1904.03515, 2019. 4
305
+ [64] Cihang Xie and Alan Yuille. Intriguing properties of adversarial training. In International Conference on Learning Representations (ICLR), 2020. 4, 6, 9
306
+ [65] Hyeonseob Nam and Hyo-Eun Kim. Batch-instance normalization for adaptively style-invariant neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pages 2558–2567, 2018. 4
307
+ [66] Xiangru Lian and Ji Liu. Revisit batch normalization: New understanding and refinement via composition optimization. In International Conference on Artificial Intelligence and Statistics (AISTATS), pages 3254–3263, 2019. 6
308
+ [67] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016. 7
309
+ [68] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference (BMVC), pages 87.1–87.12, 2016. 7
310
+ [69] Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1492–1500, 2017. 7
311
+ [70] Aharon Azulay and Yair Weiss. Why do deep convolutional networks generalize so poorly to small image transformations? arXiv preprint arXiv:1805.12177, 2018. 7
312
+ [71] Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. Exploring the landscape of spatial robustness. In International Conference on Machine Learning (ICML), pages 1802–1811, 2019. 9, 10, 15
313
+ [72] Chaowei Xiao, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. Spatially transformed adversarial examples. In International Conference on Learning Representations (ICLR), 2018. 9, 15
md/train/S1EwLkW0W/S1EwLkW0W.md ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DISSECTING ADAM: THE SIGN, MAGNITUDE ANDVARIANCE OF STOCHASTIC GRADIENTS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The ADAM optimizer is exceedingly popular in the deep learning community. Often it works very well, sometimes it doesn’t. Why? We interpret ADAM as a combination of two aspects: for each weight, the update direction is determined by the sign of the stochastic gradient, whereas the update magnitude is solely determined by an estimate of its relative variance. We disentangle these two aspects and analyze them in isolation, shedding light on ADAM’s inner workings. Transferring the “variance adaptation” to momentum-SGD gives rise to a novel method, completing the practitioner’s toolbox for problems where ADAM fails.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Many prominent machine learning models pose empirical risk minimization problems of the form
12
+
13
+ $$
14
+ \operatorname* { m i n } _ { \theta \in \mathbb { R } ^ { d } } \mathcal { L } ( \theta ) = \frac { 1 } { M } \sum _ { k = 1 } ^ { M } \ell ( \theta ; x _ { k } ) , \quad \mathrm { w i t h ~ g r a d i e n t } \quad \nabla \mathcal { L } ( \theta ) = \frac { 1 } { M } \sum _ { k = 1 } ^ { M } \nabla \ell ( \theta ; x _ { k } ) ,
15
+ $$
16
+
17
+ where $\theta \in \mathbb { R } ^ { d }$ is a vector of parameters, $\{ x _ { 1 } , \ldots , x _ { M } \}$ a training set, and $\ell ( \theta ; x )$ is a loss quantifying the performance of parameter vector $\theta$ on example $x$ . Computing the exact gradient in each step of an iterative optimization algorithm becomes inefficient for large $M$ . Instead, we construct a minibatch $B \subset \{ 1 , \ldots , M \}$ of $| B | \ll M$ data points sampled uniformly and independently from the training set and compute an approximate stochastic gradient
18
+
19
+ $$
20
+ g ( \theta ) = \frac { 1 } { | \boldsymbol { \mathcal { B } } | } \sum _ { \boldsymbol { k } \in \boldsymbol { B } } \nabla \ell ( \theta ; x _ { k } ) ,
21
+ $$
22
+
23
+ which is an unbiased estimate, $\mathbf { E } [ g ( \theta ) ] ~ = ~ \nabla \mathcal { L } ( \theta )$ . We will denote by $\sigma ( \theta ) _ { i } ^ { 2 } : = { \bf v a r } [ g ( \theta ) _ { i } ]$ its element-wise variances.1
24
+
25
+ The basic stochastic optimizer is stochastic gradient descent (SGD, Robbins & Monro, 1951) and its momentum variants (Polyak, 1964; Nesterov, 1983). A number of methods, widely-used in the deep learning community, choose per-element update magnitudes based on the history of stochastic gradient observations. Among these are ADAGRAD (Duchi et al., 2011), RMSPROP (Tieleman & Hinton, 2012), ADADELTA (Zeiler, 2012) and ADAM (Kingma & Ba, 2015).
26
+
27
+ # 1.1 A CLOSER LOOK AT ADAM
28
+
29
+ We start out from a reinterpretation of the widely-used ADAM optimizer. Some of the considerations naturally extend to ADAM’s close relatives RMSPROP and ADADELTA, but we restrict our attention to ADAM to keep the presentation concise. ADAM maintains moving averages of the observed stochas
30
+
31
+ ![](images/404fb4e564117211c1dc17e230c6d82c1898c0efaa509e7f6c6fab1fff3186f8.jpg)
32
+ Figure 1: Conceptual sketch of variance adaptation, ignoring the sign aspect of ADAM. The left panel shows the true gradient $\nabla { \mathcal { L } } = ( 2 , 1 )$ and stochastic gradients scattered around it with $( \sigma _ { 1 } , \bar { \sigma _ { 2 } } ) =$ (1, 1.5). In the right panel, we employ a variance adaptation (to be derived in $\ S 3 . 2 )$ that scales the $i$ -th coordinate by $( 1 \dot { + } \eta _ { i } ^ { 2 } ) ^ { - 1 }$ . In this example, the $\theta _ { 2 }$ -coordinate has much higher relative variance $( \eta _ { 2 } ^ { 2 } = 2 . 2 5 )$ than the $\theta _ { 1 }$ -coordinate $( \eta _ { 1 } ^ { 2 } = 0 . 2 5 )$ and is thus shortened. This reduces the variance of the update direction at the expense of biasing it away from the true gradient in expectation.
33
+
34
+ tic gradients and their element-wise square2,
35
+
36
+ $$
37
+ \begin{array} { r l } & { \tilde { m } _ { t } = \beta _ { 1 } \tilde { m } _ { t - 1 } + ( 1 - \beta _ { 1 } ) g _ { t } , \qquad m _ { t } = ( 1 - \beta _ { 1 } ^ { t } ) ^ { - 1 } \tilde { m } _ { t } , } \\ & { \tilde { v } _ { t } = \beta _ { 2 } \tilde { v } _ { t - 1 } + ( 1 - \beta _ { 2 } ) g _ { t } ^ { 2 } , \qquad v _ { t } = ( 1 - \beta _ { 2 } ^ { t } ) ^ { - 1 } \tilde { v } _ { t } . } \end{array}
38
+ $$
39
+
40
+ Here, $m _ { t }$ and $v _ { t }$ are “bias-corrected” versions of the exponential moving averages to obtain convex combinations of past observed (squared) gradients. ADAM then updates
41
+
42
+ $$
43
+ \theta _ { t + 1 } = \theta _ { t } - \alpha \frac { m _ { t } } { \sqrt { v _ { t } } + \varepsilon }
44
+ $$
45
+
46
+ with a small constant $\varepsilon > 0$ guaranteeing numerical stability of this division. Ignoring $\varepsilon$ and assuming $| m _ { t , i } | > 0$ for the moment, we can rewrite the update direction as3
47
+
48
+ $$
49
+ { \frac { m _ { t } } { \sqrt { v _ { t } } } } = { \frac { \mathrm { s i g n } ( m _ { t } ) | m _ { t } | } { \sqrt { v _ { t } } } } = { \frac { \mathrm { s i g n } ( m _ { t } ) } { \sqrt { \frac { v _ { t } } { m _ { t } ^ { 2 } } } } } = { \frac { \mathrm { s i g n } ( m _ { t } ) } { \sqrt { 1 + { \frac { v _ { t } - m _ { t } ^ { 2 } } { m _ { t } ^ { 2 } } } } } } .
50
+ $$
51
+
52
+ Since $m _ { t }$ and $v _ { t }$ approximate the first and second moment of the stochastic gradient $g _ { t }$ , respectively, $v _ { t } - m _ { t } ^ { 2 }$ can be seen as an estimate of element-wise stochastic gradient variances. The division by the non-central second moment effectively removes the magnitude of $m _ { t }$ ; it only appears in the ratio $( v _ { t } - m _ { t } ^ { 2 } ) / m _ { t } ^ { 2 }$ . Hence, ADAM can be interpreted as a combination of the two following aspects:
53
+
54
+ • The update direction $( \pm )$ for the $i$ -th weight is given by the sign of $m _ { t , i }$ • The update magnitude for the $i$ -th weight is uniquely determined by the global step size $\alpha$ and an estimate of the relative variance,
55
+
56
+ $$
57
+ \hat { \eta } _ { t , i } ^ { 2 } : = \frac { v _ { t , i } - m _ { t , i } ^ { 2 } } { m _ { t , i } ^ { 2 } } \approx \frac { \sigma _ { t , i } ^ { 2 } } { \nabla { \mathcal { L } _ { t , i } ^ { 2 } } } = : \eta _ { t , i } ^ { 2 } .
58
+ $$
59
+
60
+ Specifically, the update in the $i$ -th coordinate is scaled by $\left( 1 + \hat { \eta } _ { t , i } ^ { 2 } \right) ^ { - 1 / 2 }$ , shortening steps in high-relative-variance coordinates. Fig. 1 shows a sketch of this variance adaptation.
61
+
62
+ Table 1: The methods under consideration in this paper.
63
+
64
+ <table><tr><td></td><td>Sign + Magnitude</td><td>Sign</td></tr><tr><td>Not Variance-Adapted</td><td>SGD</td><td>SSD &quot;Stochastic Sign Descent&quot;</td></tr><tr><td rowspan="2">Variance-Adapted</td><td></td><td></td></tr><tr><td>SVAG “Stochastic Variance-Adapted Gradient&quot;</td><td>ADAM</td></tr></table>
65
+
66
+ # 1.2 OVERVIEW
67
+
68
+ Both aspects of ADAM—taking the sign and variance adaptation—are briefly mentioned in Kingma & Ba (2015), who note that “[t]he effective stepsize [...] is also invariant to the scale of the gradients” and refer to $m _ { t } / \sqrt { v _ { t } }$ as a “signal-to-noise ratio”. The purpose of this paper is to disentangle these two intertwined aspects in order to discuss and analyze them in isolation.
69
+
70
+ This perspective naturally suggests two alternative methods by incorporating one of the aspects but not the other (see Table 1). Taking the sign of the stochastic gradient (or momentum term) without any further modification gives rise to “Stochastic Sign Descent” (SSD). On the other hand, “Stochastic Variance-Adapted Gradient” (SVAG) applies element-wise variance adaptation factors directly on the stochastic gradient (or momentum term) instead of on its sign. We proceed as follows: In Section 2, we investigate the sign aspect. In the simplified setting of stochastic quadratic problems, we derive conditions under which the element-wise sign of a stochastic gradient can be a better update direction than the stochastic gradient itself. Section 3 discusses the variance adaptation. We present a principled derivation of “optimal” element-wise variance adaptation factors for a stochastic gradient as well as its sign. Subsequently, we incorporate momentum and briefly discuss the practical estimation of stochastic gradient variance. Section 4 presents some experimental results.
71
+
72
+ # 1.3 RELATED WORK
73
+
74
+ The idea of using the sign of the gradient as the principal source of the optimizer update has already received some attention in the literature. The RPROP algorithm (Riedmiller & Braun, 1993) ignores the magnitude of the gradient and dynamically adapts the per-element magnitude of the update based on observed sign changes. With the goal of reducing communication cost in distributed training of neural networks, Seide et al. (2014) empirically investigate the use of the sign of stochastic gradients. Regarding the variance adaptation, Schaul et al. (2013) derive element-wise step sizes for stochastic gradient descent that have (among other factors) a dependency on the stochastic gradient variance.
75
+
76
+ # 1.4 THE SIGN OF A STOCHASTIC GRADIENT
77
+
78
+ We briefly establish a fact that will be used throughout the paper. The sign of a stochastic gradient $s ( \theta ) = \mathrm { s i g n } ( g ( \theta ) )$ estimates the sign of the true gradient. Its distribution (and thus the quality of this estimate) is fully characterized by the success probabilities $\rho _ { i } : = \mathbf { P } \left[ s ( \theta ) _ { i } = \mathrm { s i g n } ( \nabla \mathcal { L } ( \theta ) _ { i } ) \right]$ . These depend on the distribution of the stochastic gradient. If we assume $g ( \theta )$ to be Gaussian—which is strongly supported by a Central Limit Theorem argument on Eq. (2)—we have
79
+
80
+ $$
81
+ \rho _ { i } : = \mathbf { P } \left[ s ( \theta ) _ { i } = \operatorname { s i g n } ( \nabla \mathcal { L } ( \theta ) _ { i } ) \right] = \frac { 1 } { 2 } + \frac { 1 } { 2 } \operatorname { e r f } \left( \frac { | \nabla \mathcal { L } ( \theta ) _ { i } | } { \sqrt { 2 } \sigma ( \theta ) _ { i } } \right) ,
82
+ $$
83
+
84
+ see $\mathrm { \ S B } . 2$ in the supplements. Furthermore, it is $\mathbf { E } [ s ( \theta ) _ { i } ] = ( 2 \rho _ { i } - 1 ) \operatorname { s i g n } ( \nabla { \mathcal { L } } ( \theta ) _ { i } ) .$
85
+
86
+ # 2 WHY THE SIGN?
87
+
88
+ Can it make sense to ignore the gradient magnitude? We provide some intuition under which circumstances the element-wise sign of a stochastic gradient is a better update direction than the stochastic gradient itself. This question is difficult to tackle in general, which is why we restrict the problem
89
+
90
+ class to the simple, yet insightful, case of stochastic quadratic problems, where we can investigate the effects of curvature properties and its interaction with stochastic noise.
91
+
92
+ Model Problem (Stochastic Quadratic Problem (QP)). Consider the loss function $\ell ( \theta , x ) ~ =$ $0 . 5 ( \theta - x ) ^ { T } Q ( \theta - x )$ with a symmetric positive definite matrix $Q \in \mathbb { R } ^ { d }$ and “data” coming from the distribution $x \sim \dot { \mathcal { N } } ( x ^ { * } , \nu ^ { 2 } I )$ . It is
93
+
94
+ $$
95
+ \mathcal { L } ( \theta ) : = \mathbf { E } _ { x } [ \ell ( \theta , x ) ] = \frac { 1 } { 2 } ( \theta - x ^ { * } ) ^ { T } Q ( \theta - x ^ { * } ) + \frac { \nu ^ { 2 } } { 2 } \operatorname { t r } ( Q ) ,
96
+ $$
97
+
98
+ with $\nabla { \mathcal { L } } ( \theta ) = Q ( \theta - x ^ { * } )$ . Stochastic gradients are given by $g ( \theta ) = Q ( \theta - x ) \sim \mathcal { N } ( x ^ { * } , \nu ^ { 2 } I )$
99
+
100
+ # 2.1 THEORETICAL COMPARISON
101
+
102
+ We want to compare update directions on stochastic QPs in terms of their expected decrease in function value from a single update step. If we update from $\theta$ to $\theta + \alpha z$ , we have
103
+
104
+ $$
105
+ \mathbf { E } [ \mathcal { L } ( \theta + \alpha z ) ] = \mathcal { L } ( \theta ) + \alpha \nabla \mathcal { L } ( \theta ) ^ { T } \mathbf { E } [ z ] + \frac { \alpha ^ { 2 } } { 2 } \mathbf { E } [ z ^ { T } Q z ] .
106
+ $$
107
+
108
+ For this comparison of update directions, we allow for the optimal step size that minimizes Eq. (10), which is easily found to be $\alpha _ { * } = - \nabla \mathcal { L } ( \boldsymbol { \theta } ) ^ { T } \mathbf { E } [ \boldsymbol { z } ] / \mathbf { E } [ \boldsymbol { z } ^ { T } Q \boldsymbol { z } ]$ and yields an expected improvement of
109
+
110
+ $$
111
+ \mathcal { I } ( z ) : = \left| \mathbf { E } [ \mathcal { L } ( \theta + \alpha _ { * } z ) ] - \mathcal { L } ( \theta ) \right| = \frac { ( \nabla \mathcal { L } ( \theta ) ^ { T } \mathbf { E } [ z ] ) ^ { 2 } } { 2 \mathbf { E } [ z ^ { T } Q z ] } .
112
+ $$
113
+
114
+ We find the following expressions/bounds for the improvement of SGD and SSD:
115
+
116
+ $$
117
+ \mathcal { I } ( g ) = \frac { 1 } { 2 } \frac { ( \nabla \mathcal { L } ( \theta ) ^ { T } \nabla \mathcal { L } ( \theta ) ) ^ { 2 } } { \nabla \mathcal { L } ( \theta ) ^ { T } Q \nabla \mathcal { L } ( \theta ) + \nu ^ { 2 } \sum _ { i = 1 } ^ { d } \lambda _ { i } ^ { 3 } } , \quad \mathcal { Z } ( s ) \ge \frac { 1 } { 2 } \frac { \left( \sum _ { i = 1 } ^ { d } ( 2 \rho _ { i } - 1 ) | \nabla \mathcal { L } ( \theta ) _ { i } | \right) ^ { 2 } } { \sum _ { i , j = 1 } ^ { d } | q _ { i j } | }
118
+ $$
119
+
120
+ where the $\lambda _ { i } \in \mathbb { R } _ { + }$ are the eigenvalues of $Q$ with orthonormal eigenvectors $v _ { i } \in \mathbb { R } ^ { d }$ . Derivations can be found in $\mathrm { \ S B . l }$ of the supplements. Comparing these expressions, we make two observations.
121
+
122
+ Firstly, $\mathcal { T } ( s )$ has a dependency on $\textstyle \sum _ { i , j } | q _ { i j } |$ . This quantity relates to the eigenvalues, as well as the orientation of the eigenbasis of $Q$ . By writing $Q$ in its eigendecomposition one finds that $\begin{array} { r } { \sum _ { i , j } | q _ { i j } | \leq \sum _ { i } \lambda _ { i } \| v _ { i } \| _ { 1 } ^ { 2 } } \end{array}$ . If the eigenvectors are perfectly axis-aligned (diagonal $Q$ ), their 1-norms are $\mathbf { \| } v _ { i } \| _ { 1 } = \| v _ { i } \| _ { 2 } = 1$ . It is intuitive that this is the best case for the intrinsically axis-aligned sign update. In general, the 1-norm is only bounded by $\| v _ { i } \| _ { 1 } \leq \sqrt { d } \| v _ { i } \| _ { 2 } = \sqrt { d }$ , suggesting that the sign update will have difficulties with arbitrarily oriented eigenbases. We can alternatively express this matter in terms of “diagonal dominance”. Assuming $Q$ has a percentage $c \in [ 0 , 1 ]$ of its “mass” on the diagonal, i.e., $\begin{array} { r } { \sum _ { i } | \bar { q _ { i i } } | \geq c \sum _ { i , j } | q _ { i j } | } \end{array}$ , we can write
123
+
124
+ $$
125
+ \mathcal { T } ( s ) \geq \frac { 1 } { 2 } \frac { \Big ( \sum _ { i = 1 } ^ { d } ( 2 \rho _ { i } - 1 ) | \nabla \mathcal { L } ( \theta ) _ { i } | \Big ) ^ { 2 } } { c ^ { - 1 } \sum _ { i = 1 } ^ { d } | q _ { i i } | } = \frac { 1 } { 2 } \frac { \Big ( \sum _ { i = 1 } ^ { d } ( 2 \rho _ { i } - 1 ) | \nabla \mathcal { L } ( \theta ) _ { i } | \Big ) ^ { 2 } } { c ^ { - 1 } \sum _ { i = 1 } ^ { d } \lambda _ { i } } .
126
+ $$
127
+
128
+ Becker & LeCun (1988) empirically investigated the diagonal dominance of Hessians in optimization problems arising from neural networks and found relatively high percentages of mass on the diagonals of $c = 0 . 1$ up to $c = 0 . 6$ for the problems they investigated.
129
+
130
+ Secondly, hugely ob $\boldsymbol { \mathcal { T } } ( \boldsymbol { g } )$ contains the constant offset ive for ill-conditioned and no $\nu ^ { 2 } \textstyle \sum _ { i = 1 } ^ { d } \lambda _ { i } ^ { 3 }$ in ts. In nominator, which can become, on the other hand, there is no $\mathcal { T } ( s )$ such interaction between the magnitude of the noise and the eigenspectrum; the noise only manifests in the element-wise success probabilities $\rho _ { i }$ , its effect in the denominator is bounded. A recent paper (Chaudhari et al., 2016) investigated the eigenspectrum in deep learning problems and found it to be very ill-conditioned with the majority of eigenvalues close to zero and a few very large ones.
131
+
132
+ In summary, we can expect the sign update to be beneficial for noisy, ill-conditioned problems with “diagonally dominant” Hessians. There is some (weak) empirical evidence that these conditions might be fulfilled in deep learning problems.
133
+
134
+ ![](images/19e6e17310caf2167b2a57e86acc43783b4c4f1e0c5d730fa1002011c3ff5e79.jpg)
135
+ Figure 2: Performance of SGD and SSD on 100-dimensional stochastic quadratic problems. Rows correspond to different $\mathrm { Q P s }$ : the eigenspectrum is shown and each is used with a randomly rotated and an axis-aligned eigenbasis. Columns correspond to different noise levels. Horizontal axis is number of steps; vertical axis is log function value and is shared per row for comparability.
136
+
137
+ # 2.2 EXPERIMENTAL EVALUATION
138
+
139
+ We verify the above findings on artificially generated stochastic QPs, where all relevant quantities are known analytically and controllable. We control the eigenspectrum by specifying a diagonal matrix $\Lambda$ of eigenvalues: (1) a mildly-conditioned problem with eigenvalues drawn uniformly from [0.1, 1.1] and (2) an ill-conditioned problem with a structured eigenspectrum similar to the one reported for neural networks by Chaudhari et al. (2016) by uniformly drawing $90 \%$ of the eigenvalues from $[ 0 , 1 ]$ and $10 \%$ from [30, 60]. $Q$ is then generated by (1) $Q = \Lambda$ to produce an axis-aligned problem and (2) $Q \ = \ R \mathring { \Lambda } R ^ { \hat { T } }$ with a rotation matrix $R$ drawn uniformly at random (see Diaconis & Shahshahani, 1987). This makes four different matrices, which we consider at noise levels $\nu \in \{ 0 , 0 . 1 , 4 . 0 \}$ . We compare SGD and SSD, both with the optimal step size as derived from Eq. (10), which can be computed exactly in this setting.
140
+
141
+ Figure 2 shows the results, which confirm the theoretical findings. On the well-conditioned, noisefree problem, gradient descent vastly outperforms the sign-based method. Surprisingly, adding even a little noise almost evens out the difference in performance. The orientation of the eigenbasis had little effect on the performance of SSD in the well-conditioned case. On the ill-conditioned problem, the methods work roughly equally well when the eigenbasis is randomly rotated. As predicted, SSD benefits drastically from an axis-aligned eigenbasis (last row), where it clearly outperforms SGD.
142
+
143
+ # 3 VARIANCE-BASED ELEMENT-WISE STEP SIZE ADAPTATION
144
+
145
+ Besides the sign direction, the other defining property of ADAM are variance-based element-wise step sizes. Considering the variance adaptation in isolation from the sign aspect naturally suggests to employ it directly on the stochastic gradient, without taking the sign. In both cases, a motivation arises from the following consideration:
146
+
147
+ Assume we want to update in a direction $p \in \mathbb { R } ^ { d }$ (or $\mathrm { s i g n } ( p ) )$ , but only have access to an unbiased estimate $\hat { p } \in \mathbb { R } ^ { d }$ with $\mathbf { E } [ \hat { p } ] = p$ . We allow for element-wise factors $\gamma \in \mathbb { R } ^ { d }$ , i.e., we update $\gamma \odot \hat { p }$ or $\gamma \odot \mathrm { s i g n } ( \hat { p } )$ . One way to make “optimal” use of these factors is to choose them such as to minimize the expected distance to the desired update direction. Using the squared Euclidean norm as a distance measure, we find the following result.
148
+
149
+ Lemma 1. Let $\hat { p } \in \mathbb { R } ^ { d }$ be a random variable with $\mathbf { E } [ \hat { p } ] = p$ and $\mathbf { v a r } [ p _ { i } ] = \sigma _ { i } ^ { 2 }$ . Then
150
+
151
+ $$
152
+ \operatorname* { m i n } _ { \gamma \in \mathbb { R } ^ { d } } \mathbf { E } [ \| \gamma \odot \hat { p } - p \| _ { 2 } ^ { 2 } ] \quad i s ~ s o l \nu e d b y \quad \gamma _ { i } = \frac { p _ { i } ^ { 2 } } { p _ { i } ^ { 2 } + \sigma _ { i } ^ { 2 } } = \frac { 1 } { 1 + \sigma _ { i } ^ { 2 } / p _ { i } ^ { 2 } }
153
+ $$
154
+
155
+ and
156
+
157
+ $$
158
+ \operatorname* { m i n } _ { \gamma \in \mathbb { R } ^ { d } } \mathbf { E } [ \| \gamma \odot \mathrm { s i g n } ( \hat { p } ) - \mathrm { s i g n } ( p ) \| _ { 2 } ^ { 2 } ] \quad i s s o l \nu e d b y \quad \gamma _ { i } = ( 2 \rho _ { i } - 1 ) ,
159
+ $$
160
+
161
+ where $\rho _ { i } = \mathbf { P } [ \mathrm { s i g n } ( \hat { p } _ { i } ) = \mathrm { s i g n } ( p _ { i } ) ]$ .
162
+
163
+ In the sign case, $\gamma _ { i }$ is proportional to the success probability with $\gamma _ { i } = 1$ if we are certain about the sign $\rho _ { i } = 1 { \ : }$ ) and $\gamma _ { i } = 0$ if we have no information about the sign at all $\rho _ { i } = . 5$ ).
164
+
165
+ # 3.1 VARIANCE ADAPTATION FOR THE SIGN OF A STOCHASTIC GRADIENT
166
+
167
+ Applying Eq. (15) to $\hat { p } = g$ , the optimal variance adaptation factors for the sign of a stochastic gradient are found to be $\gamma _ { i } = 2 \rho _ { i } - 1$ , where $\rho _ { i } = { \bf P } [ \mathrm { s i g n } ( g _ { i } ) = \mathrm { s i g n } ( \nabla { \mathcal { L } } _ { i } ) ]$ . Recall from Eq. (8) that, under the Gaussian assumption, the success probabilities of the sign of a stochastic gradient are $2 \rho _ { i } - 1 = \mathrm { e r f } [ ( \sqrt { 2 } \eta _ { i } ) ^ { - 1 } ]$ . ADAM uses the variance adaptation factors $( 1 + \eta _ { i } ^ { 2 } ) ^ { - 1 / 2 }$ , which turns out to be a close approximation of $\mathrm { e r f } [ ( \sqrt { 2 } \eta _ { i } ) ^ { - 1 } ]$ , as shown in Figure 5 in the supplements. Hence, ADAM can be regarded as an approximate realization of this optimal variance adaptation scheme. We experimented with both variants and found them to have identical effects. The small difference between them can be regarded as insignificant when $\eta$ itself is subject to approximation error. We thus stick to $( 1 + \eta _ { i } ^ { 2 } ) ^ { - 1 / 2 }$ for accordance with ADAM and to avoid the (more costly) error function.
168
+
169
+ # 3.2 STOCHASTIC VARIANCE-ADAPTED GRADIENT (SVAG)
170
+
171
+ Applying Eq. (14) to $\hat { p } = g$ , the optimal variance adaptation factors for SGD are found to be
172
+
173
+ $$
174
+ \gamma _ { i } = \frac { 1 } { 1 + \sigma _ { i } ^ { 2 } / \nabla \mathcal { L } _ { i } ^ { 2 } } = \frac { 1 } { 1 + \eta _ { i } ^ { 2 } } .
175
+ $$
176
+
177
+ This term is known from Schaul et al. (2013), where it appears together with diagonal curvature estimates in element-wise step sizes for SGD. We refer to this method (without curvature estimates) as “Stochastic Variance-Adapted Gradient” (SVAG). A momentum variant will be derived below.
178
+
179
+ Intriguingly, variance adaptation of this form guarantees convergence without manually decreasing the global step size. We recover the $\mathcal { O } ( 1 / t )$ rate of SGD for smooth, strongly convex functions. We emphasize that this result considers an “idealized” version of SVAG with exact $\eta _ { i } ^ { 2 }$ . It is a motivation for this form of variance adaptation, not a statement about the performance with estimated variances.
180
+
181
+ Theorem 1. Let $f$ be $\mu$ -strongly convex and $L$ -smooth. Assume we update $\theta _ { t + 1 } = \theta _ { t } - \alpha ( \gamma _ { t } \odot g _ { t } )$ , where $g _ { t }$ is a stochastic gradient with $\mathbf { E } [ g _ { t } | \theta _ { t } ] = \nabla f ( \theta _ { t } )$ , $\mathbf { v a r } [ g _ { t , i } | \theta _ { t } ] = \sigma _ { t , i } ^ { 2 } .$ , variance adaptation factors $\gamma _ { t , i } = ( 1 + \sigma _ { t , i } ^ { 2 } / \nabla f _ { t , i } ^ { 2 } ) ^ { - 1 }$ , and $\alpha = 1 / L$ . Assume $\mathbf { E } [ \| g _ { t } \| ^ { 2 } ] \leq G ^ { 2 }$ . Then
182
+
183
+ $$
184
+ \mathbf { E } [ f ( \theta _ { t } ) - f _ { * } ] \in \mathcal { O } \left( \frac { 1 } { t } \right) ,
185
+ $$
186
+
187
+ where $f _ { * }$ is the minimum value of $f$ .
188
+
189
+ (Proof in $\ S B . 4 )$
190
+
191
+ # 3.3 ESTIMATING GRADIENT VARIANCE
192
+
193
+ In practice, the relative variance is of course not known and must be estimated. As noted in the $\sigma _ { t , i } ^ { 2 } \approx \widehat { s } _ { t , i } = v _ { t , i } - m _ { t , i } ^ { 2 }$ ains an estimate of the stochastic gradient variance from moving averages,. The underlying assumption is that the function does not change drastically horizon” of the moving average, such that the recent gradients can approximately be considered to be iid draws from the stochastic gradient distribution. An estimate of the relative variance can then be obtained by $( v _ { t } - m _ { t } ^ { 2 } ) / ( m _ { t } ^ { 2 } )$ , as in ADAM.
194
+
195
+ Unlike ADAM we do not use different moving average constants for $m _ { t }$ and $v _ { t }$ . The constant for the moving average should define a time horizon over which the gradients can approximately be considered to come from the same distribution. From this perspective, it is hardly justifiable to use different horizons for the gradient and its square. Furthermore, we found individual moving average constants for $m _ { t }$ and $v _ { t }$ to have only minor effect on the performance of our methods.
196
+
197
+ An alternative variance estimate can be computed locally “within” a single mini-batch. A more detailed discussion of both estimators can be found in $\mathrm { \ S C }$ of the supplements. We have experimented with both estimators and found them to work equally well for our purpose of variance adaptation. We thus stick to moving average-based estimates for the main paper. Appendix D provides details and experimental results for the mini-batch variant.
198
+
199
+ # 3.4 INCORPORATING MOMENTUM
200
+
201
+ When we add momentum—i.e., we want to update in the direction $r _ { t }$ or $\mathrm { s i g n } ( r _ { t } )$ with a momentum term $\begin{array} { r } { r _ { t } = \mu r _ { t - 1 } + g _ { t } = \sum _ { s = 0 } ^ { t } \mu ^ { s } g _ { t - s } . } \end{array}$ —the variance adaptation factors should be determined by the relative variance of $r _ { t }$ , according to Lemma 1. It is
202
+
203
+ $$
204
+ \mathbf { E } [ r _ { t } ] = \sum _ { s = 0 } ^ { t } \mu ^ { s } \nabla { \mathcal { L } } _ { t - s } , \quad \mathbf { v a r } [ r _ { t , i } ] = \sum _ { s = 0 } ^ { t } ( \mu ^ { s } ) ^ { 2 } \mathbf { v a r } [ g _ { t - s , i } ] = \sum _ { s = 0 } ^ { t } \mu ^ { 2 s } \sigma _ { t - s , i } ^ { 2 } .
205
+ $$
206
+
207
+ Replacing $\mathbf { E } [ g _ { t - s } ] \approx m _ { t - s }$ and $\mathbf { v a r } [ g _ { t - s } ] \approx v _ { t - s } - m _ { t - s } ^ { 2 }$ we could compute these quantities. However, this would require two additional moving averages and can thus be discarded as impractical. Fortunately, we can motivate an approximation that does not require any additional memory requirements (see $\mathrm { \ S C ) }$ :
208
+
209
+ $$
210
+ \frac { \mathbf { v a r } [ r _ { t } ] } { \mathbf { E } [ r _ { t } ] ^ { 2 } } \approx \kappa ( \mu , t ) \frac { v _ { t } - m _ { t } ^ { 2 } } { m _ { t } ^ { 2 } } ~ \mathrm { w i t h } ~ \kappa ( \mu , t ) : = \frac { ( 1 - \mu ^ { 2 t } ) ( 1 - \mu ) ^ { 2 } } { ( 1 - \mu ^ { 2 } ) ( 1 - \mu ^ { t } ) ^ { 2 } } .
211
+ $$
212
+
213
+ Note that the correction factor $\kappa ( \mu , t )$ does not appear in ADAM, which updates in the direction $\mathrm { s i g n } ( m _ { t } ) = \mathrm { s i g n } ( r _ { t } )$ but performs variance adaptation based on $( v _ { t } - m _ { t } ^ { 2 } ) \bar { / } m _ { t } ^ { 2 }$ . The supplements contain experiments with a variant of ADAM that includes this correction factor.
214
+
215
+ # 4 EXPERIMENTS
216
+
217
+ We compare momentum-SGD (M-SGD) and ADAM to two new methods: First, we consider M-SSD: stochastic sign descent using a momentum term. The second method is M-SVAG, i.e., SGD with momentum and variance adaptation of the form $( 1 + \eta ^ { 2 } ) ^ { - 1 }$ , where the relative variance of the momentum term is estimated from moving averages according to Eq. (19). These four methods are the four possible recombinations of the sign aspect and the variance adaptation aspect of ADAM, as laid out in Table 1. Algorithms 1 and 2 provide pseudo-code for M-SSD and M-SVAG. For all experiments, we use $\mu = 0 . 9$ for M-SGD, M-SSD and M-SVAG and default parameters $\beta _ { 1 } =$ $0 . 9 , \mathring { \beta _ { 2 } } = 0 . 9 9 9 , \varepsilon = 1 0 ^ { - 8 } ,$ for ADAM. Note that M-SVAG does not use an $\varepsilon$ -parameter, see Alg. 2.
218
+
219
+ # Algorithm 1 M-SSD (Stochastic Sign Descent with Momentum)
220
+
221
+ <table><tr><td colspan="2">Require: initial value 0o,step size α, momentum parameter μ ∈ [0,1], number of steps T</td></tr><tr><td colspan="2">1:Initialize m= O,v = 0</td></tr><tr><td>2: for t =1,...,T do</td><td></td></tr><tr><td>3: 4:</td><td>Compute stochastic gradient g = g(0)</td></tr><tr><td>5:</td><td>Update moving average m ← μm + g</td></tr><tr><td>6: end for</td><td>Updateθ ←θ-α sign(m)</td></tr><tr><td colspan="2"></td></tr></table>
222
+
223
+ # Algorithm 2 M-SVAG (Stochastic Variance-Adapted Gradient with Momentum)
224
+
225
+ Require: initial value $\theta _ { 0 }$ , step size $\alpha$ , momentum parameter $\mu \in [ 0 , 1 ]$ , number of steps $T$
226
+
227
+ 1: Initialize $\tilde { m } = 0$ , $\tilde { v } = 0$
228
+ 2: for $t = 1 , \dots , T$ do
229
+ 3: Compute stochastic gradient $g = g ( \theta )$
230
+ 4: Update moving averages $\tilde { m } \mu \tilde { m } + ( 1 - \mu ) g , \quad \tilde { v } \mu \tilde { v } + ( 1 - \mu ) g ^ { 2 }$
231
+ 5: Bias-correct $\bar { m } = ( 1 \bar { - } \mu ^ { t } ) ^ { - 1 } \tilde { m }$ , $v = ( 1 - \mu ^ { t } ) ^ { - 1 } \tilde { v }$
232
+ 6: Compute relative variance estimate η2 = κ(µ, t) v−m2m2
233
+ 7: Compute variance adaptation factors $\gamma = ( 1 + \eta ^ { 2 } ) ^ { - 1 }$
234
+ 8: Update $\theta \theta - \alpha ( \gamma \overset { \cdot } { \odot } m )$
235
+
236
+ . Eq. (19)
237
+
238
+ # 9: end for
239
+
240
+ We do not use an $\varepsilon$ -parameter as in ADAM. In the (rare) case that $m _ { i } = 0$ for coordinate $i$ , the division by zero in line 6 is caught and the update magnitude will be set to zero in line 8.
241
+
242
+ # 4.1 EXPERIMENTAL SET-UP
243
+
244
+ We tested all methods on three problems: a simple fully-connected neural network on the MNIST data set (LeCun et al., 1998), as well as convolutional neural networks (CNNs) on the CIFAR-10 and CIFAR-100 data sets (Krizhevsky, 2009). On CIFAR-10, we used a simple CNN with three convolutional layers, interspersed with max-pooling, and three fully-connected layers. On CIFAR100 we used the AllCNN architecture of Springenberg et al. (2014) with a total of nine convolutional layers. A complete description of all network architectures has been moved to $\ S \mathbf { A }$ . While MNIST and CIFAR-10 are trained with a constant global step size $( \alpha )$ , we used a fixed decreasing schedule for CIFAR-100, dividing by 10 after $4 0 \mathrm { k }$ and $5 0 \mathrm { k }$ steps (adopted from Springenberg et al., 2014). We used a batch size of 128 on MNIST and 256 on the two CIFAR data sets.
245
+
246
+ Step sizes (initial step sizes in the case of CIFAR-100) were tuned for each method individually by first finding the maximal stable step size by trial and error, then searching downwards over two orders of magnitude (details in $\ S \mathbf { A }$ ). We selected the one that yielded maximal overall test accuracy within the fixed number of training steps. Experiments with the best step size have been replicated ten times with different random seeds and all performance indicators are reported as mean plus/minus one standard deviation.
247
+
248
+ # 4.2 RESULTS
249
+
250
+ Results are shown in Figure 3. On MNIST, ADAM clearly outperforms M-SGD. Interestingly, there is only a very small difference in performance between the two sign-based methods, M-SSD and ADAM. Apparently, the advantage of ADAM over M-SGD on this problem is primarily due to the sign aspect. Going from M-SGD to M-SVAG, gives a considerable boost in performance, but MSVAG is still outperformed by the two sign-based methods.
251
+
252
+ On CIFAR-10, the sign-based methods again have superior performance. Neither M-SSD nor M-SGD can benefit significantly from adding variance adaptation.
253
+
254
+ Finally, the situation is reversed on CIFAR-100, where M-SGD outperforms ADAM. It attains lower minimal loss values (both training and test) and converges faster. This is also reflected in the test accuracies, where M-SGD beats ADAM by almost 10 percentage points. Furthermore, ADAM is much less stable with significantly larger variance in performance. On this problem, variance adaptation has a small but significant positive effect for the sign-based methods as well as for M-SGD. When going from M-SGD to M-SVAG we gain some speed in the initial phase. The difference is later evened out by the manual learning rate decrease (which was necessary, for all methods, to train this architecture to satisfying performance).
255
+
256
+ # 5 DISCUSSION AND CONCLUSION
257
+
258
+ We have argued that ADAM combines two aspects: taking signs and variance adaptation. Our separate analysis of both aspects provides some insight into the inner workings of this method.
259
+
260
+ ![](images/da6602d5d1724210da9fbd5b18e0ee47ec020f1c161f9153c94b4ffc4d6341ed.jpg)
261
+ Figure 3: Experimental results on the three test problems. Plots display training and test loss over the number of steps. Curves for the different optimization methods are color-coded. The shaded area spans plus/minus one standard deviation, obtained from ten replications. The table below contains test accuracies evaluated after the last iteration.
262
+
263
+ Taking the sign can be beneficial, but does not need to be. Our theoretical analysis suggests that it depends on the interplay of stochasticity, the conditioning of the problem, and its “axis-alignment”. Our experiments confirm that sign-based methods work well on some, but not all problems.
264
+
265
+ Variance adaptation can be applied to any stochastic update direction. In our experiments it was beneficial in all cases, but its effect can sometimes be minuscule. M-SVAG, a variance-adapted variant of momentum-SGD, is a useful addition to the practitioner’s toolbox for problems where sign-based methods like ADAM fail. Its memory and computation cost are identical to ADAM and it has two hyper-parameters, the momentum constant $\mu$ and the global step size $\alpha$ . Our TensorFlow (Abadi et al., 2015) implementation of this method will be made available upon publication.
266
+
267
+ # ACKNOWLEDGMENTS
268
+
269
+ We want to thank [names removed] for many helpful discussions.
270
+
271
+ # REFERENCES
272
+
273
+ 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.
274
+
275
+ Lukas Balles, Maren Mahsereci, and Philipp Hennig. Automizing stochastic optimization with gradient variance estimates. In Automatic Machine Learning Workshop at ICML 2017, 2017a.
276
+
277
+ Lukas Balles, Javier Romero, and Philipp Hennig. Coupling adaptive batch sizes with learning rates. In Proceedings of the Thirty-Third Conference on Uncertainty in Artificial Intelligence (UAI), pp. 410–419, 2017b.
278
+
279
+ Sue Becker and Yann LeCun. Improving the convergence of back-propagation learning with second order methods. In Proceedings of the 1988 Connectionist Models Summer School, pp. 29–37, 1988.
280
+
281
+ Pratik Chaudhari, Anna Choromanska, Stefano Soatto, and Yann LeCun. Entropy-SGD: Biasing gradient descent into wide valleys. arXiv preprint arXiv:1611.01838, 2016.
282
+
283
+ Persi Diaconis and Mehrdad Shahshahani. The subgroup algorithm for generating uniform random variables. Probability in the Engineering and Informational Sciences, 1(01):15–32, 1987.
284
+
285
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
286
+
287
+ Diederik Kingma and Jimmy Ba. ADAM: A method for stochastic optimization. The International Conference on Learning Representations (ICLR), 2015.
288
+
289
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
290
+
291
+ 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.
292
+
293
+ Maren Mahsereci and Philipp Hennig. Probabilistic line searches for stochastic optimization. In Advances in Neural Information Processing Systems 28, pp. 181–189, 2015.
294
+
295
+ Maren Mahsereci, Lukas Balles, Christoph Lassner, and Philipp Hennig. Early stopping without a validation set. arXiv preprint arXiv:1703.09580, 2017.
296
+
297
+ Yurii Nesterov. A method of solving a convex programming problem with convergence rate $\mathcal { O } ( 1 / k ^ { 2 } )$ . In Soviet Mathematics Doklady, volume 27, pp. 372–376, 1983.
298
+
299
+ Boris T Polyak. Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 4(5):1–17, 1964.
300
+
301
+ Martin Riedmiller and Heinrich Braun. A direct adaptive method for faster backpropagation learning: The RPROP algorithm. In Neural Networks, 1993., IEEE International Conference on, pp. 586–591. IEEE, 1993.
302
+
303
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics, pp. 400–407, 1951.
304
+
305
+ Tom Schaul, Sixin Zhang, and Yann LeCun. No more pesky learning rates. In Proceedings of the 30th International Conference on Machine Learning (ICML), pp. 343–351, 2013.
306
+
307
+ Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech DNNs. In Fifteenth Annual Conference of the International Speech Communication Association, 2014.
308
+
309
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
310
+
311
+ Tijmen Tieleman and Geoffrey Hinton. RMSPROP: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, Lecture 6.5, 2012.
312
+
313
+ Matthew D Zeiler. ADADELTA: An adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
314
+
315
+ SUPPLEMENTARY MATERIAL
316
+
317
+ A DESCRIPTION OF EXPERIMENTS
318
+
319
+ # A.1 NETWORK ARCHITECTURES
320
+
321
+ MNIST We train a simple fully-connected neural network with three hidden layers of 1000, 500 and 100 units with ReLU activation. The output layer has 10 units with softmax activation. We use the cross-entropy loss function and apply $L _ { 2 }$ -regularization on all weights, but not the biases. We use a batch size of 128. The global learning rate $\alpha$ stays constant.
322
+
323
+ CIFAR-10 The CIFAR-10 data set consists of $3 2 \times 3 2 \mathrm { p x }$ RGB images with one of ten categorical labels. We train a convolutional neural network (CNN) with three convolutional layers (64 filters of size $5 \times 5$ , 96 filters of size $3 \times 3$ , and 128 filters of size $3 \times 3$ ) interspersed with max-pooling over $3 \times 3$ areas with stride 2. Two fully-connected layers with 512 and 256 units follow. We use ReLU activation function for all layers. The output layer has 10 units for the 10 classes of CIFAR-10 with softmax activation. We use the cross-entropy loss function and apply $L _ { 2 }$ -regularization on all weights, but not the biases. During training we perform some standard data augmentation operations (random cropping of sub-images, left-right mirroring, color distortion) on the input images. We use a batch size of 256. The global learning rate $\alpha$ stays constant.
324
+
325
+ CIFAR-100 We use the AllCNN architecture of Springenberg et al. (2014). It consists of seven convolutional layers, some of them with stride, and no pooling layers. The fully-connected layers are replaced with two layers of $1 \times 1$ convolutions with global spatial averaging in the end. ReLU activation function is used in all layers. Details can be found in the original paper. We use the cross-entropy loss function and apply $L _ { 2 }$ -regularization on all weights, but not the biases. We used the same data augmentation operations as for CIFAR-10 and a batch size of 256. The global learning rate $\alpha$ is decreased by a factor of 10 after $4 0 \mathrm { k }$ and $5 0 \mathrm { k }$ steps.
326
+
327
+ # A.2 LEARNING RATE TUNING
328
+
329
+ Learning rates for each optimizer have been tuned by first finding the maximal stable learning rate by trial and error and then searching downwards over two orders of magnitude with learning rates $6 \cdot 1 0 ^ { m }$ , $3 \cdot 1 0 ^ { m }$ , and $1 \cdot 1 0 ^ { m }$ for order of magnitude $m$ . We evaluated loss and accuracy on the full test set at a constant interval and selected the best-performing learning rate for each method in terms of maximally reached test accuracy. Using the best learning rate, we replicated the experiment ten times with different random seeds.
330
+
331
+ # B MATHEMATICAL DETAILS
332
+
333
+ # B.1 DETAILS OF THE ANALYSIS ON STOCHASTIC QPS
334
+
335
+ We derive the expressions for $\mathcal { T } ( s )$ and $\boldsymbol { \mathcal { T } } ( \boldsymbol { g } )$ in Eq. (12). We drop the fixed $\theta$ from the notation for readability. For SGD, we have $\mathbf { E } [ g ] = \nabla \mathcal { L }$ and $\mathbf { E } [ g ^ { T } Q g ] = \nabla \mathcal { L } ^ { \hat { T } } Q \nabla \mathcal { L } + \mathrm { t r } ( Q \mathbf { c o v } [ g ] )$ , which is a general fact for quadratic forms of random variables. For the stochastic QP the gradient covariance is $\mathbf { \bar { c o v } } [ g ] = \nu ^ { 2 } Q \dot { Q }$ , thus $\begin{array} { r } { \mathrm { t r } ( Q \mathbf { c o v } [ g ] ) = \nu ^ { 2 } \mathrm { t r } ( Q Q Q ) = \nu ^ { 2 } \sum _ { i } \lambda _ { i } ^ { 3 } } \end{array}$ . Plugging everything into Eq. (11) yields
336
+
337
+ $$
338
+ \mathcal { T } ( g ) = \frac { ( \nabla \mathcal { L } ^ { T } \nabla \mathcal { L } ) ^ { 2 } } { \nabla \mathcal { L } ^ { T } Q \nabla \mathcal { L } + \nu ^ { 2 } \sum _ { i = 1 } ^ { d } \lambda _ { i } ^ { 3 } } .
339
+ $$
340
+
341
+ For stochastic sign descent, we have $\mathbf { E } [ s _ { i } ] ~ = ~ ( 2 \rho _ { i } ~ - ~ 1 ) \mathrm { s i g n } ( \nabla { \mathcal { L } } _ { i } )$ and thus $\nabla \mathcal { L } ^ { T } \mathbf { E } [ s ] ~ =$ $\begin{array} { r } { \sum _ { i = 1 } ^ { d } \nabla \mathcal { L } _ { i } \mathbf { E } [ s _ { i } ] = \sum _ { i } ( 2 \rho _ { i } - 1 ) | \nabla \mathcal { L } _ { i } | } \end{array}$ . Regarding the denominator, it is
342
+
343
+ $$
344
+ 0 \leq s ^ { T } H s = | s ^ { T } Q s | = \left| \sum _ { i = 1 } ^ { d } q _ { i j } s _ { i } s _ { j } \right| \leq \sum _ { i = 1 } ^ { d } | q _ { i j } | | s _ { i } | | s _ { j } | = \sum _ { i = 1 } ^ { d } | q _ { i j } | .
345
+ $$
346
+
347
+ ![](images/50cd5e3eb94599e4df6f4c2182fdf84af844b55df0e22a53f83f911479f0cbaa.jpg)
348
+ Figure 4: Probability density functions (pdf) of three Gaussian distributions, all with $\mu = 1$ , but different variances $\sigma ^ { 2 } = 0 . 5$ (left), $\sigma ^ { 2 } = \mathrm { { 1 . 0 } }$ (middle), $\sigma ^ { 2 } = 4 . 0$ (right). The shaded area under the curve corresponds to the probability that a sample from the distribution has the opposite sign than its mean. For the Gaussian distribution, this probability is uniquely determined by the fraction $\sigma / | \mu |$ , as shown in Lemma 2.
349
+
350
+ Plugging everything into Eq. (11) yields
351
+
352
+ $$
353
+ \mathcal { T } ( s ) \geq \frac { \left( \sum _ { i = 1 } ^ { d } ( 2 \rho _ { i } - 1 ) | \nabla \mathcal { L } _ { i } | \right) ^ { 2 } } { \sum _ { i = 1 } ^ { d } | q _ { i j } | } .
354
+ $$
355
+
356
+ B.2 SUCCESS PROBABILITIES OF THE SIGN OF A STOCHASTIC GRADIENT
357
+
358
+ We have stated in the main text that the sign of a stochastic gradient, $s ( \theta ) = \mathrm { s i g n } ( g ( \theta ) )$ , has success probabilities
359
+
360
+ $$
361
+ \rho _ { i } = \mathbf { P } [ s ( \theta ) _ { i } = \operatorname { s i g n } ( \nabla { \mathcal { L } } ( \theta ) _ { i } ) ] = { \frac { 1 } { 2 } } + { \frac { 1 } { 2 } } \operatorname { e r f } \left( { \frac { | \nabla { \mathcal { L } } ( \theta ) _ { i } | } { \sqrt { 2 } \sigma ( \theta ) _ { i } } } \right)
362
+ $$
363
+
364
+ under the assumption that $g \sim \mathcal { N } ( \nabla \mathcal { L } , \Sigma )$ . The following Lemma formally proves this statement and Figure 4 provides a pictorial illustration.
365
+
366
+ Lemma 2. If $X \sim { \mathcal { N } } ( \mu , \sigma ^ { 2 } )$ then
367
+
368
+ $$
369
+ \rho = \mathbf { P } [ \operatorname { s i g n } ( X ) = \operatorname { s i g n } ( \mu ) ] = { \frac { 1 } { 2 } } \left( 1 + \operatorname { e r f } \left( { \frac { | \mu | } { \sqrt { 2 } \sigma } } \right) \right) .
370
+ $$
371
+
372
+ Proof. The cumulative density function (cdf) of $X \sim \mathcal { N } ( \mu , \sigma ^ { 2 } )$ is $\mathbf { P } [ X \leq x ] = \Phi ( ( x - \mu ) / \sigma )$ , where $\Phi ( z ) = 0 . 5 ( 1 + \mathrm { e r f } ( z / \sqrt { 2 } ) )$ is the cdf of the standard normal distribution. If $\mu < 0$ , then
373
+
374
+ $$
375
+ \rho = \mathbf { P } [ X < 0 ] = \Phi \left( \frac { 0 - \mu } { \sigma } \right) = \frac { 1 } { 2 } \left( 1 + \operatorname { e r f } \left( \frac { - \mu } { \sqrt { 2 } \sigma } \right) \right) .
376
+ $$
377
+
378
+ If $\mu > 0$ , then
379
+
380
+ $$
381
+ \begin{array} { l } { \displaystyle \rho = \mathbf { P } [ X > 0 ] = 1 - \mathbf { P } [ X \leq 0 ] = 1 - \Phi \left( \frac { 0 - \mu } { \sigma } \right) } \\ { \displaystyle = 1 - \frac { 1 } { 2 } \left( 1 + \mathrm { e r f } \left( \frac { - \mu } { \sqrt { 2 } \sigma } \right) \right) = \frac { 1 } { 2 } \left( 1 + \mathrm { e r f } \left( \frac { \mu } { \sqrt { 2 } \sigma } \right) \right) , } \end{array}
382
+ $$
383
+
384
+ where the last step used the anti-symmetry of the error function.
385
+
386
+ ![](images/c08f2f0fa8bc643522d8443b13fdf2ac0a7fd1d4e227a8dbde42544aa741ee41.jpg)
387
+ Figure 5: Variance adaptation factors as functions of the relative standard deviation $\eta$ . $( 1 + \eta ^ { 2 } ) ^ { - 1 }$ is the optimal variance adaptation factor for SGD (Eq. 16). The optimal factor for the sign of a stochastic gradient is $\mathrm { e r f } ( ( \sqrt { 2 } \eta ) ^ { - 1 } )$ under the Gaussian assumption (Eq. 15). It is closely approximated by $( 1 + \eta ^ { 2 } ) ^ { - 1 / 2 }$ , which is the factor implicitly employed by ADAM (Eq. 6).
388
+
389
+ B.3 DETAILS ON VARIANCE ADAPTATION FACTORS
390
+
391
+ Proof of Lemma $^ { l }$ . Using $\mathbf { E } [ \hat { p } _ { i } ] = p _ { i }$ and ${ \bf E } [ \hat { p } _ { i } ^ { 2 } ] = p _ { i } ^ { 2 } + \sigma _ { i } ^ { 2 }$ , we get
392
+
393
+ $$
394
+ \begin{array} { l } { { \displaystyle { \bf E } [ \| \gamma \odot \hat { p } - p \| _ { 2 } ^ { 2 } ] = \sum _ { i = 1 } ^ { d } { \bf E } [ ( \gamma _ { i } \hat { p } _ { i } - p _ { i } ) ^ { 2 } ] = \sum _ { i = 1 } ^ { d } \gamma _ { i } ^ { 2 } { \bf E } [ \hat { p } _ { i } ^ { 2 } ] - 2 \gamma _ { i } p _ { i } { \bf E } [ \hat { p } _ { i } ] + p _ { i } ^ { 2 } } } \\ { { \displaystyle \quad \quad = \sum _ { i = 1 } ^ { d } \gamma _ { i } ^ { 2 } ( p _ { i } ^ { 2 } + \sigma _ { i } ^ { 2 } ) - 2 \gamma _ { i } p _ { i } ^ { 2 } + p _ { i } ^ { 2 } . } } \end{array}
395
+ $$
396
+
397
+ Setting the derivative w.r.t. $\gamma _ { i }$ to zero, we find the optimal choice
398
+
399
+ $$
400
+ \gamma _ { i } = \frac { p _ { i } ^ { 2 } } { p _ { i } ^ { 2 } + \sigma _ { i } ^ { 2 } } .
401
+ $$
402
+
403
+ Using $\mathbf { E } [ \mathrm { s i g n } ( \hat { p } _ { i } ) ] = ( 2 \rho _ { i } - 1 ) \mathrm { s i g n } ( p _ { i } )$ and $\mathrm { s i g n } ( \cdot ) ^ { 2 } = 1$ , we get
404
+
405
+ $$
406
+ \begin{array} { l l l } { \displaystyle \mathbf { E } [ \| \gamma \odot \mathrm { s i g n } ( \hat { p } ) - \mathrm { s i g n } ( p ) \| _ { 2 } ^ { 2 } ] = \sum _ { i = 1 } ^ { d } \gamma _ { i } ^ { 2 } \mathbf { E } [ \mathrm { s i g n } ( \hat { p } _ { i } ) ^ { 2 } ] - 2 \gamma _ { i } \mathrm { s i g n } ( p _ { i } ) \mathbf { E } [ \mathrm { s i g n } ( \hat { p } _ { i } ) ] + \mathrm { s i g n } ( p _ { i } ) ^ { 2 } } \\ { \displaystyle \qquad = \gamma _ { i } ^ { 2 } - 2 \gamma _ { i } ( 2 \rho _ { i } - 1 ) + 1 } \end{array}
407
+ $$
408
+
409
+ and easily find the optimal choice
410
+
411
+ $$
412
+ \gamma _ { i } = 2 \rho _ { i } - 1 .
413
+ $$
414
+
415
+ by setting the derivative to zero.
416
+
417
+ See Figure 5 for a plot of the variance adaptation factors considered in this paper.
418
+
419
+ # B.4 CONVERGENCE OF IDEALIZED STOCHASTIC VARIANCE-ADAPTED GRADIENT
420
+
421
+ We proof the convergence results for idealized variance-adapted stochastic gradient descent. We have to clarify an aspect that we have glossed over in the main text. A stochastic optimizer generates a discrete stochastic process $\{ \boldsymbol { \theta } _ { t } \} _ { t \in { \mathbb { N } } _ { 0 } }$ . We denote as $\mathbf { E } _ { t } [ \cdot ] = \mathbf { E } [ \cdot | \theta _ { 0 } , \ldots , \theta _ { t } ]$ the conditional expectation given a realization of that process up to time step $t$ . Recall that $\mathbf { E } [ \mathbf { E } _ { t } [ \cdot ] ] = \mathbf { E } [ \cdot ]$ .
422
+
423
+ Proof of Theorem $^ { l }$ . Using the Lipschitz continuity of $\nabla f$ , we can bound $f ( \theta + \Delta \theta ) \leq f ( \theta ) +$ $\begin{array} { r } { \nabla f ( \theta ) ^ { T } \Delta \theta + \frac { L } { 2 } \| \Delta \theta \| ^ { 2 } } \end{array}$ . Hence,
424
+
425
+ $$
426
+ \begin{array} { r l } & { \mathbf { E } _ { t } \big [ f _ { t + 1 } \big ] \leq f _ { t } - \alpha \mathbf { E } _ { t } \big [ \nabla f _ { t } ^ { T } ( \gamma _ { t } \odot g _ { t } ) \big ] + \displaystyle \frac { L \alpha ^ { 2 } } { 2 } \mathbf { E } _ { t } \big [ \| \gamma _ { t } \odot g _ { t } \| ^ { 2 } \big ] } \\ & { \qquad = f _ { t } - \displaystyle \frac { 1 } { L } \sum _ { i = 1 } ^ { d } \gamma _ { t , i } \nabla f _ { t , i } \mathbf { E } [ g _ { t , i } ] + \displaystyle \frac { 1 } { 2 L } \sum _ { i = 1 } ^ { d } \gamma _ { t , i } ^ { 2 } \mathbf { E } _ { t } [ g _ { t , i } ^ { 2 } ] } \\ & { \qquad = f _ { t } - \displaystyle \frac { 1 } { L } \sum _ { i = 1 } ^ { d } \gamma _ { t , i } \nabla f _ { t , i } ^ { 2 } + \displaystyle \frac { 1 } { 2 L } \sum _ { i = 1 } ^ { d } \gamma _ { t , i } ^ { 2 } ( \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } ) . } \end{array}
427
+ $$
428
+
429
+ Plugging in the definition
430
+
431
+ $$
432
+ \gamma _ { t , i } = \frac { \nabla f _ { t , i } ^ { 2 } } { \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } }
433
+ $$
434
+
435
+ and simplifying, we get
436
+
437
+ $$
438
+ \mathbf { E } _ { t } [ f _ { t + 1 } ] \leq f _ { t } - \frac { 1 } { 2 L } \sum _ { i = 1 } ^ { d } \frac { \nabla f _ { t , i } ^ { 2 } } { \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } } \nabla f _ { t , i } ^ { 2 } .
439
+ $$
440
+
441
+ Using Jensen’s inequality4
442
+
443
+ $$
444
+ \begin{array} { r l } & { \displaystyle \sum _ { i = 1 } ^ { d } \frac { \nabla f _ { t , i } ^ { 2 } } { \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } } \nabla f _ { t , i } ^ { 2 } = \| \nabla f _ { t } \| ^ { 2 } \sum _ { i = 1 } ^ { d } \frac { \nabla f _ { t , i } ^ { 2 } } { \| \nabla f _ { t } \| ^ { 2 } } \left( \frac { \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } } { \nabla f _ { t , i } ^ { 2 } } \right) ^ { - 1 } } \\ & { \qquad \geq \| \nabla f _ { t } \| ^ { 2 } \left( \displaystyle \sum _ { i = 1 } ^ { d } \frac { \nabla f _ { t , i } ^ { 2 } } { \| \nabla f _ { t } \| ^ { 2 } } \frac { \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } } { \nabla f _ { t , i } ^ { 2 } } \right) ^ { - 1 } } \\ & { \qquad = \frac { \| \nabla f _ { t } \| ^ { 4 } } { \sum _ { i = 1 } ^ { d } ( \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } ) } \geq \frac { \| \nabla f _ { t } \| ^ { 4 } } { G ^ { 2 } } . } \end{array}
445
+ $$
446
+
447
+ Due to strong convexity, we have $\| \nabla f _ { t } \| ^ { 2 } \geq 2 \mu ( f _ { t } - f _ { * } )$ and can further bound
448
+
449
+ $$
450
+ \sum _ { i = 1 } ^ { d } \frac { \nabla f _ { t , i } ^ { 2 } } { \nabla f _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } } \nabla f _ { t , i } ^ { 2 } \geq \frac { 4 \mu ^ { 2 } ( f _ { t } - f _ { * } ) ^ { 2 } } { G ^ { 2 } } .
451
+ $$
452
+
453
+ Inserting this in (33) and subtracting $f _ { * }$ , we get
454
+
455
+ $$
456
+ \mathbf { E } _ { t } [ f _ { t + 1 } ] - f _ { * } \leq f _ { t } - f _ { * } - \frac { 2 \mu ^ { 2 } } { L G ^ { 2 } } ( f _ { t } - f _ { * } ) ^ { 2 } ,
457
+ $$
458
+
459
+ and, consequently, by total expectation
460
+
461
+ $$
462
+ \begin{array} { l } { { \displaystyle { \bf E } [ f _ { t + 1 } - f _ { * } ] = { \bf E } \left[ { \bf E } _ { t } [ f _ { t + 1 } ] - f _ { * } \right] \leq { \bf E } [ f _ { t } - f _ { * } ] - \frac { 2 \mu ^ { 2 } } { L G ^ { 2 } } { \bf E } [ ( f _ { t } - f _ { * } ) ^ { 2 } ] } \ ~ } \\ { { \displaystyle \phantom { \frac { 1 } { 1 } } \leq { \bf E } [ f _ { t } - f _ { * } ] - \frac { 2 \mu ^ { 2 } } { L G ^ { 2 } } { \bf E } [ f _ { t } - f _ { * } ] ^ { 2 } } , } \end{array}
463
+ $$
464
+
465
+ which we rewrite, using the shorthand $e _ { t } : = \mathbf { E } [ f _ { t } - f _ { * } ]$ , as
466
+
467
+ $$
468
+ 0 \leq e _ { t + 1 } \leq e _ { t } ( 1 - c e _ { t } ) , \quad c = \frac { 2 \mu ^ { 2 } } { L G ^ { 2 } } .
469
+ $$
470
+
471
+ To conclude the proof, we will show that this implies $\textstyle e _ { t } \in { \mathcal { O } } { \bigl ( } { \frac { 1 } { t } } { \bigr ) }$ . Without loss of generality, we assume $e _ { t + 1 } > 0$ and get
472
+
473
+ $$
474
+ e _ { t + 1 } ^ { - 1 } \geq e _ { t } ^ { - 1 } ( 1 - c e _ { t } ) ^ { - 1 } \geq e _ { t } ^ { - 1 } ( 1 + c e _ { t } ) = e _ { t } ^ { - 1 } + c ,
475
+ $$
476
+
477
+ where the second step is due to the simple fact that $( 1 - x ) ^ { - 1 } \geq ( 1 + x )$ for any $x \in [ 0 , 1 )$ . Summing this inequality over $t = 0 , \ldots , T - 1$ yields $e _ { T } ^ { - 1 } \geq e _ { 0 } ^ { - 1 } + T c$ and, thus,
478
+
479
+ $$
480
+ T e _ { T } \le \left( \frac { 1 } { T e _ { 0 } } + c \right) ^ { - 1 } \stackrel { T \to \infty } { \longrightarrow } \frac { 1 } { c } < \infty ,
481
+ $$
482
+
483
+ which shows that $\textstyle e _ { t } \in { \mathcal { O } } { \bigl ( } { \frac { 1 } { t } } { \bigr ) }$ .
484
+
485
+ # C MORE ON GRADIENT VARIANCE ESTIMATION
486
+
487
+ # C.1 ESTIMATES FROM MOVING AVERAGES
488
+
489
+ Iterating the recursive formula for $\tilde { m } _ { t }$ backwards, we get
490
+
491
+ $$
492
+ m _ { t } = \frac { \tilde { m } _ { t } } { 1 - \beta _ { 1 } ^ { t } } = \frac { 1 } { 1 - \beta _ { 1 } ^ { t } } \left( \beta _ { 1 } m _ { t - 1 } + ( 1 - \beta _ { 1 } ) g _ { t } \right) = . . . = \frac { 1 - \beta _ { 1 } } { 1 - \beta _ { 1 } ^ { t } } \sum _ { s = 0 } ^ { t - 1 } \beta _ { 1 } ^ { s } g _ { t - s } .
493
+ $$
494
+
495
+ Hence, $\beta _ { 1 } ) / ( 1 - \beta _ { 1 } ^ { t } )$ $m _ { t }$ is a weighted average of past observed gradients with coefficients , which sum to one, sinus statement holds for $\begin{array} { r } { \sum _ { s = 0 } ^ { t - 1 } \beta _ { 1 } ^ { s } = ( 1 - \beta _ { 1 } ^ { t } ) / ( 1 - \beta _ { 1 } ) } \end{array}$ by the geometric sum formula.itates a variance estimate from $c ( \beta _ { 1 } , t , s ) : = \beta _ { 1 } ^ { s } ( 1 -$ $v _ { t }$
496
+ past gradient observation is to assume that the true gradient does not change drastically over the effective time horizon of the exponential moving average. For mathematical simplicity, we can translate this assumption to mean that, at the $t$ -th step, we treat all $\{ g _ { t - s , i } \mid s = 0 , \ldots , t - 1 \}$ as iid with mean $\nabla { \mathcal { L } } _ { t , i }$ and variance $\sigma _ { t , i } ^ { 2 }$ . This will of course be utterly wrong for gradient observations that are far in the past, but since $c ( \mu , t , s )$ is very small for large $t - s$ , these won’t contribute significantly to the moving average. The moving average constant defines the effective time horizon, for which we implicitly make this assumption.
497
+
498
+ Under this peculiar assumption, $m _ { t }$ and $v _ { t }$ are unbiased estimates of the first and second moment of $g _ { t }$ , respectively:
499
+
500
+ $$
501
+ \begin{array} { r l r } { { \mathbf { E } [ m _ { t , i } ] = \sum _ { s = 0 } ^ { t - 1 } c ( \mu , t , s ) \mathbf { E } [ g _ { t - s , i } ] = \nabla \mathcal { L } _ { t , i } \sum _ { s = 0 } ^ { t - 1 } c ( \mu , t , s ) = \nabla \mathcal { L } _ { t , i } , } } \\ & { } & { \quad \mathbf { E } [ v _ { t , i } ] = \sum _ { s = 0 } ^ { t - 1 } c ( \mu , t , s ) \mathbf { E } [ g _ { t - s , i } ^ { 2 } ] = ( \nabla \mathcal { L } _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } ) \sum _ { s = 0 } ^ { t - 1 } c ( \mu , t , s ) = \nabla \mathcal { L } _ { t , i } ^ { 2 } + \sigma _ { t , i } ^ { 2 } , } \end{array}
502
+ $$
503
+
504
+ motivating $v _ { t } - m _ { t } ^ { 2 }$ as a gradient variance estimate. However, $v _ { \frac { t } { r } } - m _ { t } ^ { 2 }$ is not an unbiased variance estimate due to the fact $\bar { m } _ { t } ^ { 2 }$ is not an unbiased estimate of $\nabla { \mathcal { L } } _ { t } ^ { 2 }$ . The error arising from this bias should generally be dominated by other error sources and will thus be ignored.
505
+
506
+ # C.2 MINI-BATCH ESTIMATES
507
+
508
+ An alternative gradient variance estimate can be obtained locally, within a single mini-batch. The individual gradients $\nabla \ell ( \theta , x _ { k } )$ in a mini-batch are iid random variables and, as noted in the introduction, $\mathbf { v a r } [ g ( \theta ) ] = | \vartheta | ^ { - 1 } \mathbf { v a r } [ \nabla \ell ( \theta , x _ { k } ) ]$ . We can thus estimate $g ( \theta )$ ’s variances by computing the sample variance of the $\{ \nabla \ell ( \theta , x _ { k } ) \} _ { k \in B }$ , then scaling by $| B | ^ { - 1 }$ ,
509
+
510
+ $$
511
+ \hat { s } ( \theta ) = \frac { 1 } { | \mathcal { B } | } \left( \frac { 1 } { | \mathcal { B } | - 1 } \sum _ { k \in \mathcal { B } } \nabla \ell ( \theta , x _ { k } ) ^ { 2 } - g ( \theta ) ^ { 2 } \right) .
512
+ $$
513
+
514
+ Several recent papers (Mahsereci & Hennig, 2015; Balles et al., 2017b; Mahsereci et al., 2017) have used this variance estimate for other aspects of stochastic optimizers. In contrast to $v _ { t } - m _ { t } ^ { 2 }$ , this is an unbiased estimate of the local gradient variance. The (non-trivial) implementation of this estimator for neural networks is described in Balles et al. (2017a).
515
+
516
+ # C.3 RELATIVE VARIANCE OF A MOMENTUM TERM (DERIVATION OF EQ. 19)
517
+
518
+ When estimating the variance with moving averages, we assume that $\mathbf { E } [ g _ { t } ] = m _ { t }$ and $\mathbf { v a r } [ g _ { t } ] =$ $v _ { t } - m _ { t } ^ { 2 }$ . Plugging this into Eq. (18) we can approximate the mean and variance of the momentum term by
519
+
520
+ $$
521
+ \mathbf { E } [ r _ { t } ] ^ { 2 } \approx \left( \sum _ { s = 0 } ^ { t } \mu ^ { s } m _ { t - s } \right) ^ { 2 } , \quad \mathbf { v a r } [ r _ { t } ] \approx \sum _ { s = 0 } ^ { t } \mu ^ { 2 s } ( v _ { t - s } - m _ { t - s } ^ { 2 } ) .
522
+ $$
523
+
524
+ Computing these two expressions would require two more moving averages in addition to $m _ { t }$ and $v _ { t }$ . However, $m _ { t }$ and $v _ { t }$ will change slowly over time and, by using $v _ { t } - m _ { t } ^ { 2 }$ as the variance estimate for
525
+
526
+ $g _ { t }$ , we anyways make the assumption that all gradients in the effective time horizon of the moving average have the same mean and variance. We thus further approximate by replacing $m _ { t - s }$ with $m _ { t }$ and get
527
+
528
+ $$
529
+ \begin{array} { c } { { \displaystyle { \bf E } [ r _ { t } ] ^ { 2 } \approx m _ { t } ^ { 2 } \left( \sum _ { s = 0 } ^ { t } \mu ^ { s } \right) ^ { 2 } = m _ { t } ^ { 2 } \left( \frac { 1 - \mu ^ { t } } { 1 - \mu } \right) ^ { 2 } , } } \\ { { \displaystyle { \bf v a r } [ r _ { t } ] \approx ( v _ { t } - m _ { t } ^ { 2 } ) \sum _ { s = 0 } ^ { t } \mu ^ { 2 s } = ( v _ { t } - m _ { t } ^ { 2 } ) \frac { 1 - \mu ^ { 2 t } } { 1 - \mu ^ { 2 } } . } } \end{array}
530
+ $$
531
+
532
+ The two scalar factors lead to the correction term $\kappa ( \mu , t )$ in Eq. (19).
533
+
534
+ When estimating the gradient variance from the mini-batch (Eq. 44), we can obtain an unbiased estimate of $\mathbf { v a r } [ \bar { \boldsymbol { r } } _ { t } ]$ in Eq. (18) via
535
+
536
+ $$
537
+ \bar { s } _ { t } = \mu ^ { 2 } \bar { s } _ { t - 1 } + \hat { s } _ { t } ,
538
+ $$
539
+
540
+ where $\hat { s } _ { t }$ is given by Eq. (44).
541
+
542
+ # D VARIATIONS OF VARIANCE-ADAPTED METHODS
543
+
544
+ Based on the considerations in Section 3, we examined three more variance-adapted methods. The first is a variation of M-SVAG which estimates stochastic gradient variances locally within the minibatch, as explained in $\mathrm { \displaystyle \ S C } . 2$ . Pseudo-code can be found in Alg. 5. Furthermore, we tested a variant of ADAM that applies the correction factor from Eq. (19) to the estimate of the relative variance of the momentum term. We refer to this method as ADAM\*. Two variants of ADAM\* with the two variance estimates can be found in Algorithms 4 and 5.
545
+
546
+ Require: initial value $\theta _ { 0 }$ , step size $\alpha$ , momentum parameter $\mu \in [ 0 , 1 ]$ , number of steps T
547
+ 1: Initialize $m = 0$ , $\bar { s } = 0$
548
+ 2: for $t = 1 , \dots , T$ do
549
+ 3: Compute stochastic gradient $g ( \theta )$ and variance estimate $\hat { s } ( \theta )$ . Eq. (44)
550
+ 4: Update aggregators $\bar { m } \mu \bar { m } + g ( \theta ) , \quad \bar { s } \mu ^ { 2 } \bar { s } + \hat { s } ( \theta )$
551
+ 5: Compute relative variance estimate $\eta ^ { 2 } = \bar { s } / m ^ { 2 }$
552
+ 6: Compute variance adaptation factors $\gamma = ( 1 + \eta ^ { 2 } ) ^ { - 1 }$
553
+ 7: Update $\theta \theta - \alpha ( \gamma \overset { \cdot } { \odot } m )$
554
+ 8: end for
555
+
556
+ Algorithm 4 ADAM\* (with exp. moving average variance estimates)
557
+
558
+ Require: initial value $\theta _ { 0 }$ , step size $\alpha$ , momentum/averaging constant $\mu \in [ 0 , 1 ]$ , number of step
559
+
560
+ 1: Initialize $m = 0$ , $v = 0$
561
+ 2: for $t = 1 , \dots , T$ do
562
+ 3: Compute stochastic gradient $g = g ( \theta )$
563
+ 4: Update moving averages $m \mu m + ( 1 - \mu ) g , \quad v \mu v + ( 1 - \mu ) g ^ { 2 }$
564
+ 5: Bias-correct $m = ( 1 - \mu ^ { t } ) ^ { - 1 } \tilde { m } , \quad v = ( 1 - \mu ^ { t } ) ^ { - 1 } \tilde { v }$
565
+ 6: Compute relative variance estimate η2 = κ(µ, t) v−m2m2 . Eq. (19)
566
+ 7: Compute variance adaptation factors $\gamma = ( 1 + \eta ^ { 2 } ) ^ { - 1 / 2 }$
567
+ 8: Update $\theta \theta - \alpha ( \gamma \odot \mathrm { s i g n } ( m ) )$
568
+
569
+ # 9: end for
570
+
571
+ This is ADAM $( \beta _ { 1 } = \beta _ { 2 } = \mu , \varepsilon = 0 )$ , expect for the correction factor $\kappa ( \mu , t )$ for the relative variance.
572
+
573
+ ![](images/ea33cd7452c281ad0e1e0feae26418bcae08dc841fbde38062109358cc998549.jpg)
574
+ Figure 6: Comparison of the original ADAM algorithm to the variants in Algs. 4 and 5. Set-up of the plots as in Fig. 3. All three algorithms exhibit very similar performance on both problems.
575
+
576
+ Algorithm 5 ADAM\*-mb (with mini-batch variance estimates)
577
+
578
+ Require: initial value $\theta _ { 0 }$ , step size $\alpha$ , momentum/averaging constant $\mu \in [ 0 , 1 ]$ , number of steps T
579
+ 1: Initialize $m = 0$ , $\bar { s } = 0$
580
+ 2: for $t = 1 , \dots , T$ do
581
+ 3: Compute stochastic gradient $g ( \theta )$ and variance estimate $\hat { s } ( \theta )$ . Eq. (44)
582
+ 4: Update aggregators $\bar { m } \mu \bar { m } + g ( \theta ) , \quad \bar { s } \mu ^ { 2 } \bar { s } + \hat { s } ( \theta )$
583
+ 5: Compute relative variance estimate $\dot { \eta } ^ { 2 } = \bar { s } / m ^ { 2 }$
584
+ 6: Compute variance adaptation factors $\gamma = ( 1 + \eta ^ { 2 } ) ^ { - 1 / 2 }$
585
+ 7: Update $\theta \theta - \alpha ( \gamma \odot \mathrm { s i g n } ( m ) )$
586
+ 8: end for
587
+
588
+ # D.1 EXPERIMENTAL RESULTS
589
+
590
+ We evaluated the variants on the two CIFAR test problems. Figure 6 shows a comparison of the two $\mathbf { A D A M } ^ { * }$ variants with the original ADAM. Figure 7 compares the mini-batch variant of M-SVAG to the one with exponential moving averages.
591
+
592
+ ![](images/06bf29d5a07ec1d70e7a05d48c66b1da35f79b18b7c5bf0a47be2bf43def9d71.jpg)
593
+ Figure 7: Comparison of the two variants of the M-SVAG algorithm. Set-up of the plots as in Fig. 3. Both variants exhibit very similar performance on both problems.
md/train/SkeK3s0qKQ/SkeK3s0qKQ.md ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EPISODIC CURIOSITY THROUGH REACHABILITY
2
+
3
+ Nikolay Savinov∗1 Anton Raichuk∗1 Raphael Marinier¨ ∗1 Damien Vincent ∗1
4
+ Marc Pollefeys 3 Timothy Lillicrap 2 Sylvain Gelly 1
5
+
6
+ 1Google Brain, 2DeepMind, 3ETH Zurich ¨
7
+
8
+ # ABSTRACT
9
+
10
+ Rewards are sparse in the real world and most of today’s reinforcement learning algorithms struggle with such sparsity. One solution to this problem is to allow the agent to create rewards for itself — thus making rewards dense and more suitable for learning. In particular, inspired by curious behaviour in animals, observing something novel could be rewarded with a bonus. Such bonus is summed up with the real task reward — making it possible for RL algorithms to learn from the combined reward. We propose a new curiosity method which uses episodic memory to form the novelty bonus. To determine the bonus, the current observation is compared with the observations in memory. Crucially, the comparison is done based on how many environment steps it takes to reach the current observation from those in memory — which incorporates rich information about environment dynamics. This allows us to overcome the known “couch-potato” issues of prior work — when the agent finds a way to instantly gratify itself by exploiting actions which lead to hardly predictable consequences. We test our approach in visually rich 3D environments in VizDoom, DMLab and MuJoCo. In navigational tasks from VizDoom and DMLab, our agent outperforms the state-of-the-art curiosity method ICM. In MuJoCo, an ant equipped with our curiosity module learns locomotion out of the first-person-view curiosity only. The code is available at https://github.com/google-research/episodic-curiosity.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Many real-world tasks have sparse rewards. For example, animals searching for food may need to go many miles without any reward from the environment. Standard reinforcement learning algorithms struggle with such tasks because of reliance on simple action entropy maximization as a source of exploration behaviour.
15
+
16
+ Multiple approaches were proposed to achieve better explorative policies. One way is to give a reward bonus which facilitates exploration by rewarding novel observations. The reward bonus is summed up with the original task reward and optimized by standard RL algorithms. Such an approach is motivated by neuroscience studies of animals: an animal has an ability to reward itself for something novel – the mechanism biologically built into its dopamine release system. How exactly this bonus is formed remains an open question.
17
+
18
+ Many modern curiosity formulations aim at maximizing “surprise” — inability to predict the future. This approach makes perfect sense but, in fact, is far from perfect. To show why, let us consider a thought experiment. Imagine an agent is put into a 3D maze. There is a precious goal somewhere in the maze which would give a large reward. Now, the agent is also given a remote control to a TV and can switch the channels. Every switch shows a random image (say, from a fixed set of images). The curiosity formulations which optimize surprise would rejoice because the result of the channel switching action is unpredictable. The agent would be drawn to the TV instead of looking for a goal in the environment (this was indeed observed in (Burda et al., 2018a)). So, should we call the channel switching behaviour curious? Maybe, but it is unproductive for the original sparsereward goal-reaching task. What would be a definition of curiosity which does not suffer from such “couch-potato” behaviour?
19
+
20
+ We propose a new curiosity definition based on the following intuition. If the agent knew the observation after changing a TV channel is only one step away from the observation before doing that — it probably would not be so interesting to change the channel in the first place (too easy). This intuition can be formalized as giving a reward only for those observations which take some effort to reach (outside the already explored part of the environment). The effort is measured in the number of environment steps. To estimate it we train a neural network approximator: given two observations, it would predict how many steps separate them. The concept of novelty via reachability is illustrated in Figure 1. To make the description above practically implementable, there is still one piece missing though. For determining the novelty of the current observation, we need to keep track of what was already explored in the environment. A natural candidate for that purpose would be episodic memory: it stores instances of the past which makes it easy to apply the reachability approximator on pairs of current and past observations.
21
+
22
+ ![](images/8bb78acec2571c80946e144fd8c4a2928dad7dead21262892a2878c6a0cba13a.jpg)
23
+ Figure 1: We define novelty through reachability. The nodes in the graph are observations, the edges — possible transitions. The blue nodes are already in memory, the green nodes are reachable from the memory within $k = 2$ steps (not novel), the orange nodes are further away — take more than $k$ steps to reach (novel). In practice, the full possible transition graph is not available, so we train a neural network approximator to predict if the distance in steps between observations is larger or smaller than $k$ .
24
+
25
+ Our method works as follows. The agent starts with an empty memory at the beginning of the episode and at every step compares the current observation with the observations in memory to determine novelty. If the current observation is indeed novel — takes more steps to reach from observations in memory than a threshold — the agent rewards itself with a bonus and adds the current observation to the episodic memory. The process continues until the end of the episode, when the memory is wiped clean.
26
+
27
+ We benchmark our method on a range of tasks from visually rich 3D environments VizDoom, DMLab and MuJoCo. We conduct the comparison with other methods — including the state-of-the-art curiosity method ICM (Pathak et al., 2017) — under the same budget of environment interactions. First, we use the VizDoom environments from prior work to establish that our re-implementation of the ICM baseline is correct — and also demonstrate at least 2 times faster convergence of our method with respect to the baseline. Second, in the randomized procedurally generated environments from DMLab our method turns out to be more robust to spurious behaviours than the method ICM: while the baseline learns a persistent firing behaviour in navigational tasks (thus creating interesting pictures for itself), our method learns a reasonable explorative behaviour. In terms of quantitative evaluation, our method reaches the goal at least 2 times more often in the procedurally generated test levels in DMLab with a very sparse reward. Third, when comparing the behaviour of the agent in the complete absence of rewards, our method covers at least 4 times more area (measured in discrete $( x , y )$ coordinate cells) than the baseline ICM. Fourth, we demonstrate that our curiosity bonus does not significantly deteriorate performance of the plain PPO algorithm (Schulman et al., 2017) in two tasks with dense reward in DMLab. Finally, we demonstrate that an ant in a MuJoCo environment can learn locomotion purely from our curiosity reward computed based on the first-person view.
28
+
29
+ # 2 EPISODIC CURIOSITY
30
+
31
+ We consider an agent which interacts with an environment. The interactions happen at discrete time steps over the episodes of limited duration $T$ . At each time step $t$ , the environment provides the agent with an observation $\mathbf { o } _ { t }$ from the observational space $\mathcal { O }$ (we consider images), samples an action $a _ { t }$ from a set of actions $\mathcal { A }$ using a probabilistic policy $\pi ( \mathbf { o } _ { t } )$ and receives a scalar reward $r _ { t } ~ \in \mathbb { R }$ together with the new observation $\mathbf { o } _ { t + 1 }$ and an end-of-episode indicator. The goal of the agent is to optimize the expectation of the discounted sum of rewards during the episode $\begin{array} { r } { \mathbf { \bar { \boldsymbol { S } } } = \sum _ { t } \gamma ^ { t } \bar { \boldsymbol { r } _ { t } } } \end{array}$ .
32
+
33
+ In this work we primarily focus on the tasks where rewards $r _ { t }$ are sparse — that is, zero for most of the time steps $t$ . Under such conditions commonly used RL algorithms (e.g., PPO Schulman et al. (2017)) do not work well. We further introduce an episodic curiosity (EC) module which alleviates this problem. The purpose of this module is to produce a reward bonus $b _ { t }$ which is further summed up with the task reward $r _ { t }$ to give an augmented reward $\widehat { r } _ { t } = r _ { t } + b _ { t }$ . The augmented reward has a bnice property from the RL point of view — it is a dense reward. Learning with such reward is faster, more stable and often leads to better final performance in terms of the cumulative task reward $S$ .
34
+
35
+ ![](images/f5b26daba6d4f270ed00487ec3e61377a5ec67c3a3888291d596d0792ad828d2.jpg)
36
+ Figure 2: Left: siamese architecture of reachability (R) network. Right: R-network is trained based on a sequence of observations that the agent encounters while acting. The temporally close (within threshold) pairs of observations are positive examples, while temporally far ones — negatives.
37
+
38
+ In the following section we describe the key components of our episodic curiosity module.
39
+
40
+ # 2.1 EPISODIC CURIOSITY MODULE
41
+
42
+ The episodic curiosity (EC) module takes the current observation $\mathbf { o }$ as input and produces a reward bonus $b$ . The module consists of both parametric and non-parametric components. There are two parametric components: an embedding network $E : \mathcal { O } \mathbb { R } ^ { n }$ and a comparator network $C$ : $\mathbb { R } ^ { n } \times \mathbb { R } ^ { n } \to [ 0 , 1 ]$ . Those parametric components are trained together to predict reachability as parts of the reachability network — shown in Figure 2. There are also two non-parametric components: an episodic memory buffer $\mathbf { M }$ and a reward bonus estimation function $B$ . The high-level overview of the system is shown in Figure 3. Next, we give a detailed explanation of all the components.
43
+
44
+ Embedding and comparator networks. Both networks are designed to function jointly for estimating within- $k$ -step-reachability of one observation $\mathbf { o } _ { i }$ from another observation $\mathbf { o } _ { j }$ as parts of a reachability network $\mathbf { \bar { \mathit { R } } } ( \mathbf { o } _ { i } , \mathbf { o } _ { j } ) = \mathbf { \bar { \mathit { C } } } ( E ( \mathbf { o } _ { i } ) , E ( \mathbf { o } _ { j } ) )$ . This is a siamese architecture similar to (Zagoruyko & Komodakis, 2015). The architecture is shown in Figure 2. R-network is a classifier trained with a logistic regression loss: it predicts values close to 0 if probability of two observations being reachable from one another within $k$ steps is low, and values close to 1 when this probability is high. Inside the episodic curiosity the two networks are used separately to save up computation and memory.
45
+
46
+ Episodic memory. The episodic memory buffer $\mathbf { M }$ stores embeddings of past observations from the current episode, computed with the embedding network $E$ . The memory buffer has a limited capacity $K$ to avoid memory and performance issues. At every step, the embedding of the current observation might be added to the memory. What to do when the capacity is exceeded? One solution we found working well in practice is to substitute a random element in memory with the current element. This way there are still more fresh elements in memory than older ones, but the older elements are not totally neglected.
47
+
48
+ Reward bonus estimation module. The purpose of this module is to check for reachable observations in memory and if none is found — assign larger reward bonus to the current time step. The check is done by comparing embeddings in memory to the current embedding via comparator network. Essentially, this check insures that no observation in memory can be reached by taking only a few actions from the current state — our characterization of novelty.
49
+
50
+ # 2.2 BONUS COMPUTATION ALGORITHM.
51
+
52
+ At every time step, the current observation o goes through the embedding network producing the embedding vector ${ \bf e } = E ( { \bf o } )$ . This embedding vector is compared with the stored embeddings in the memory buffer $\mathbf { M } = \left. \mathbf { e } _ { 1 } , \ldots , \mathbf { e } _ { | \mathbf { M } | } \right.$ via the comparator network $C$ where $| \mathbf { M } |$ is the current number of elements in memory. This comparator network fills the reachability buffer with values
53
+
54
+ $$
55
+ c _ { i } = C ( \mathbf { e } _ { i } , \mathbf { e } ) , \quad i = 1 , | \mathbf { M } | .
56
+ $$
57
+
58
+ ![](images/fe553ae84666c820b2b22f915708261f314a64fb08a4e1896ecd8eee94538393.jpg)
59
+ Figure 3: The use of episodic curiosity (EC) module for reward bonus computation. The module take a current observation as input and computes a reward bonus which is higher for novel observations. This bonus is later summed up with the task reward and used for training an RL agent.
60
+
61
+ Then the similarity score between the memory buffer and the current embedding is computed from the reachability buffer as (with a slight abuse of notation)
62
+
63
+ $$
64
+ C ( \mathbf { M } , \mathbf { e } ) = F \left( c _ { 1 } , \ldots , c _ { | \mathbf { M } | } \right) \in [ 0 , 1 ] .
65
+ $$
66
+
67
+ where the aggregation function $F$ is a hyperparameter of our method. Theoretically, $F = { \mathrm { m a x } }$ would be a good choice, however, in practice it is prone to outliers coming from the parametric embedding and comparator networks. Empirically, we found that 90-th percentile works well as a robust substitute to maximum.
68
+
69
+ As a curiosity bonus, we take
70
+
71
+ $$
72
+ b = B ( \mathbf { M } , \mathbf { e } ) = \alpha ( \beta - C ( \mathbf { M } , \mathbf { e } ) ) ,
73
+ $$
74
+
75
+ where $\alpha \in \mathbb { R } ^ { + }$ and $\beta \in \mathbb { R }$ are hyperparameters of our method. The value of $\alpha$ depends on the scale of task rewards — we will discuss how to select it in the experimental section. The value of $\beta$ determines the sign of the reward — and thus could bias the episodes to be shorter or longer. Empirically, $\beta = 0 . 5$ works well for fixed-duration episodes, and $\beta = 1$ is preferred if an episode could have variable length.
76
+
77
+ After the bonus computation, the observation embedding is added to memory if the bonus $b$ is larger than a novelty threshold $b _ { n o v e l t y }$ . This check is necessary for the following reason. If every observation embedding is added to the memory buffer, the observation from the current step will always be reachable from the previous step. Thus, the reward would never be granted. The threshold $b _ { n o v e l t y }$ induces a discretization in the embedding space. Intuitively, this makes sense: only “distinct enough” memories are stored. As a side benefit, the memory buffer stores information with much less redundancy. We refer the reader to the video1 which visualizes the curiosity reward bonus and the memory state during the operation of the algorithm.
78
+
79
+ # 2.3 REACHABILITY NETWORK TRAINING
80
+
81
+ If the full transition graph in Figure 1 was available, there would be no need of a reachability network and the novelty could be computed analytically through the shortest-path algorithm. However, normally we have access only to the sequence of observations which the agent receives while acting. Fortunately, as suggested by (Savinov et al., 2018), even a simple observation sequence graph could still be used for training a reasonable approximator to the real step-distance. This procedure is illustrated in Figure 2. This procedure takes as input a sequence of observations $\mathbf { o } _ { 1 } , \ldots , \mathbf { o } _ { N }$ and forms pairs from those observations. The pairs $( \mathbf { o } _ { i } , \mathbf { o } _ { j } )$ where $| i - j | \leq k$ are taken as positive (reachable) examples while the pairs with $| i - j | > \gamma k$ become negative examples. The hyperparameter $\gamma$ is necessary to create a gap between positive and negative examples. In the end, the network is trained with logistic regression loss to output the probability of the positive (reachable) class.
82
+
83
+ In our work, we have explored two settings for training a reachability network: using a random policy and together with the task-solving policy (online training). The first version generally follows the training protocol proposed by (Savinov et al., 2018). We put the agent into exactly the same conditions where it will be eventually tested: same episode duration and same action set. The agent takes random actions from the action set. Given the environment interaction budget (2.5M 4-repeated steps in DMLab, 300K 4-repeated steps in VizDoom), the agent fills in the replay buffer with observations coming from its interactions with the environment, and forms training pairs by sampling from this replay buffer randomly. The second version collects the data on-policy, and re-trains the reachability network every time after a fixed number of environment interactions is performed. We provide the details of R-network training in the supplementary material.
84
+
85
+ ![](images/7bc1149c05ae19ecbfb228b2f6acd49ac54440234b7b7a2ce2986bf49364efec.jpg)
86
+ Figure 4: Examples of tasks considered in our experiments: (a) VizDoom static maze goal reaching, (b) DMLab randomized maze goal reaching, (c) DMLab key-door puzzle, (d) MuJoCo ant locomotion out of first-person-view curiosity.
87
+
88
+ # 3 EXPERIMENTAL SETUP
89
+
90
+ We test our method in multiple environments from VizDoom (Kempka et al., 2016), DMLab (Beattie et al., 2016) and MuJoCo (Todorov et al., 2012; Schulman et al., 2015). The experiments in $V _ { l Z } .$ - Doom allow us to verify that our re-implementation of the previous state-of-the-art curiosity method ICM (Pathak et al., 2017) is correct. The experiments in DMLab allow us to extensively test the generalization of our method as well as baselines — DMLab provides convenient procedural level generation capabilities which allows us to train and test RL methods on hundreds of levels. The experiments in MuJoCo allow us to show the generality of our method. Due to space limits, the MuJoCo experiments are described in the supplementary material. The examples of tasks are shown in Figure 4.
91
+
92
+ Environments. Both VizDoom and DMLab environments provide rich maze-like 3D environments. The observations are given to the agent in the form of images. For VizDoom, we use $8 4 \times 8 4$ grayscale images as input. For DMLab, we use $8 4 \times 8 4$ RGB images as input. The agent operates with a discrete action set which comprises different navigational actions. For VizDoom, the standard action set consists of 3 actions: move forward, turn left/right. For DMLab, it consists of 9 actions: move forward/backward, turn left/right, strafe left/right, turn left/righ $^ +$ move forward, fire. For both VizDoom and DMLab we use all actions with a repeat of 4, as typical in the prior work. We only use RGB input of the provided RGBD observations and remove all head-on display information from the screen, leaving only the plain first-person view images of the maze. The rewards and episode durations differ between particular environments and will be further specified in the corresponding experimental sections.
93
+
94
+ Basic RL algorithm. We choose the commonly used PPO algorithm from the open-source implementation2 as our basic RL algorithm. The policy and value functions are represented as CNNs to reduce number of hyperparameters — LSTMs are harder to tune and such tuning is orthogonal to the contribution of the paper. We apply PPO to the sum of the task reward and the bonus reward coming from specific curiosity algorithms. The hyperparameters of the PPO algorithm are given in the supplementary material. We use only two sets of hyperparameters: one for all VizDoom environments and the other one for all DMLab environments.
95
+
96
+ Baseline methods. The simplest baseline for our approach is just the basic RL algorithm applied to the task reward. As suggested by the prior work and our experiments, this is a relatively weak baseline in the tasks where reward is sparse.
97
+
98
+ As the second baseline, we take the state-of-the-art curiosity method ICM (Pathak et al., 2017). As follows from the results in (Pathak et al., 2017; Fu et al., 2017), ICM is superior to methods VIME (Houthooft et al., 2016), #Exploration (Tang et al., 2017) and $E X ^ { 2 }$ (Fu et al., 2017) on the curiosity tasks in visually rich 3D environments.
99
+
100
+ ![](images/4b4ec1c71c7a6aeb17662e33b371a1b670e3ba65f63ed9b7b43b2c4515e35f00.jpg)
101
+ Figure 5: Examples of maze types used in our experiments: (a) VizDoom static maze goal reaching, (b) DMLab randomized maze goal reaching, (c) DMLab randomized maze goal reaching with doors.
102
+
103
+ Finally, as a sanity check, we introduce a novel baseline method which we call Grid Oracle. Since we can access current $( x , y )$ coordinates of the agent in all environments, we are able to directly discretize the world in 2D cells and reward the agent for visiting as many cells as possible during the episode (the reward bonus is proportional to the number of cells visited). At the end of the episode, cell visit counts are zeroed. The reader should keep in mind that this baseline uses privileged information not available to other methods (including our own method EC). While this privileged information is not guaranteed to lead to success in any particular RL task, we do observe this baseline to perform strongly in many tasks, especially in complicated DMLab environments. The Grid Oracle baseline has two hyperparameters: the weight for combining Grid Oracle reward with the task reward and the cell size.
104
+
105
+ Hyperparameter tuning. As DMLab environments are procedurally generated, we perform tuning on the validation set, disjoint with the training and test sets. The tuning is done on one of the environments and then the same hyperparameters are re-used for all other environments. VizDoom environments are not procedurally generated, so there is no trivial way to have proper training/validation/test splits — so we tune on the same environment (as typical in the prior RL work for the environments without splits). When tuning, we consider the mean final reward of 10 training runs with the same set of hyperparameters as the objective — thus we do not perform any seed tuning. All hyperparameter values are listed in the supplementary material. Note that although bonus scalar $\alpha$ depends on the range of task rewards, the environments in VizDoom and DMLab have similar ranges within each platform — so our approach with re-using $\alpha$ for multiple environments works.
106
+
107
+ # 4 EXPERIMENTS
108
+
109
+ In this section, we describe the specific tasks we are solving and experimental results for all considered methods on those tasks. There are 4 methods to report: PPO, $\mathrm { P P O } + \mathrm { I C M }$ , PPO $^ +$ Grid Oracle and $\mathrm { P P O } + \mathrm { E C }$ (our method). First, we test static-maze goal reaching in VizDoom environments from prior work to verify that our baseline re-implementation is correct. Second, we test the goal-reaching behaviour in procedurally generated mazes in DMLab. Third, we train no-reward (pure curiosity) maze exploration on the levels from DMLab and report Grid Oracle reward as an approximate measure of the maze coverage. Finally, we demonstrate that our curiosity bonus does not significantly deteriorate performance in two dense reward tasks in DMLab. All the experiments were conducted under the same environment interaction budget for all methods (R-network pre-training is included in this budget). The videos of all trained agents in all environments are available online3.
110
+
111
+ For additional experiments we refer the reader to the supplementary material: there we show that R-network can successfully generalize between environments, demonstrate stability of our method to hyperparameters and present an ablation study.
112
+
113
+ # 4.1 STATIC MAZE GOAL REACHING.
114
+
115
+ The goal of this experiment is to verify our re-implementation of the baseline method is correct. We use the MyWayHome task from VizDoom. The agent has to reach the goal in a static 3D maze in the time limit of 525 4-repeated steps (equivalent to 1 minute). It only gets a reward of $+ 1$ when it reaches the goal (episode ends at that moment), the rest of the time the reward is zero.
116
+
117
+ The task has three sub-tasks (following the setup in (Pathak et al., 2017)): “Dense”, “Sparse” and “Very Sparse”. The layout of the maze is demonstrated in Figure 5(c). The goal is always at the same room but the starting points are different in those sub-tasks. For the “Dense” subtask, the agent starts in one of the random locations in the maze, some of which are close to the goal. In this sub-task, the reward is relatively dense (hence the name): the agent is likely to bump into the goal by a short random walk. Thus, this is an easy task even for standard RL methods. The other two sub-tasks are harder: the agent starts in a medium-distant room from the goal (“Sparse”) or in a very distant room (“Very Sparse”). Those tasks are hard for standard RL algorithms because the probability of bumping into a rewarding state by a random walk is very low.
118
+
119
+ ![](images/7a7f0a2a8c5d62a3afa36a1d440e1c159733fc1f9262137063054b93a4cf2f54.jpg)
120
+ Figure 6: Task reward as a function of training step for VizDoom tasks. Higher is better. We use the offline version of our algorithm and shift the curves for our method by the number of environment steps used to train R-network — so the comparison is fair. We run every method with a repeat of 3 (same as in prior work (Pathak et al., 2017)) and show all runs. No seed tuning is performed.
121
+
122
+ The training curves are shown in Figure 6. By analysing them, we draw a few conclusions. First, our re-implementation of the ICM baseline is correct and the results are in line with those published in (Pathak et al., 2017). Second, our method works on-par with the ICM baseline in terms of final performance, quickly reaching $1 0 0 \%$ success rate in all three sub-tasks. Finally, in terms of convergence speed, our algorithm is significantly faster than the state-of-the-art method ICM — our method reaches $1 0 0 \%$ success rate at least 2 times faster. Note that to make the comparison of the training speed fair, we shift our training curves by the environment interaction budget used for training R-network.
123
+
124
+ # 4.2 PROCEDURALLY GENERATED RANDOM MAZE GOAL REACHING.
125
+
126
+ In this experiment we aim to evaluate maze goal reaching task generalization on a large scale. We train on hundreds of levels and then test also on hundreds of hold-out levels. We use “Explore Goal Locations Large” (we will denote it “Sparse”) and “Explore Obstructed Goals Large” (we will denote it “Sparse $^ +$ Doors”) levels in the DMLab simulator. In those levels, the agent starts in a random location in a randomly generated maze (both layout and textures are randomized at the beginning of the episode). Within the time limit of 1800 4-repeated steps (equivalent to 2 minutes), the agent has to reach the goal as many times as possible. Every time it reaches a goal, it is respawned into another random location in the maze and has to go to the goal again. Every time the goal is reached, the agent gets a reward $+ 1 0$ , the rest of the time the reward is zero. The second level is a variation of the first one with doors which make the paths in the maze longer. The layouts of the levels are demonstrated in Figure 5(b,c).
127
+
128
+ We found out that the standard task “Sparse” is actually relatively easy even for the plain PPO algorithm. The reason is that the agent starting point and the goal are sampled on the map independently of each other — and sometimes both happen to be in the same room which simplifies the task. To test the limits of the algorithms, we create a gap between the starting point and the goal which eliminates same-room initialization. We report the results for both the original task “Sparse” and its harder version “Very Sparse”. Thus, there are overall three tasks considered in this section: “Sparse”, “Very Sparse” and “Sparse $^ +$ Doors”.
129
+
130
+ The results demonstrate that our method can reasonably adapt to ever-changing layouts and textures — see Table 1 and training curves in Figure 7. We outperform the baseline method ICM in all three environments using the same environment interaction budget of 20M 4-repeated steps. The environment “Sparse” is relatively easy and all methods work reasonably. In the “Very Sparse” and “Sparse $^ +$ Doors” settings our advantage with respect to PPO and ICM is more clear. On those levels, the visual inspection of the ICM learnt behaviour reveals an important property of this method: it is confused by the firing action and learns to entertain itself by firing until it runs out of ammunition. A similar finding was reported in a concurrent work (Burda et al., 2018a): the agent was given an action which switched the content on a TV screen in a maze, along with the movement actions. Instead of moving, the agent learns to switch channels forever. While one might intuitively accept such “couch-potato” behaviour in intelligent creatures, it does not need to be a consequence of curious behaviour. In particular, we are not observing such dramatic firing behaviour for our curiosity formulation: according to Figure 1, an observation after firing is still one step away from the one before firing, so it is not novel (note that firing still could happen in practice because of the entropy term in PPO). Thus, our formulation turns out to be more robust than ICM’s prediction error in this scenario. Note that we do not specifically look for an action set which breaks the baseline — just use the standard one for DMLab, in line with the prior work (e.g., (Espeholt et al., 2018)).
131
+
132
+ ![](images/36cc35956581da1d343973680cdeb87e5dffe96d9999679f04ee98cacf28fa1b.jpg)
133
+ Figure 7: Reward as a function of training step for DMLab tasks. Higher is better. “ECO” stands for the online version of our method, which trains R-network and the policy at the same time. We run every method 30 times and show 5 randomly selected runs. No seed tuning is performed.
134
+
135
+ The result of this experiment suggests to look more into how methods behave in extremely-sparse reward scenarios. The limiting case would be no reward at all — we consider it in the next section.
136
+
137
+ # 4.3 NO REWARD/AREA COVERAGE.
138
+
139
+ This experiment aims to quantitatively establish how good our method is in the scenario when no task reward is given. One might question why this scenario is interesting — however, before the task reward is found for the first time, the agent lives in the no-reward world. How it behaves in this case will also determine how likely it is to stumble into the task reward in the first place.
140
+
141
+ We use one of the DMLab levels — “Sparse” from the previous experiment. We modify the task to eliminate the reward and name the new task “No Reward”. To quantify success in this task, we report the reward coming from Grid Oracle for all compared methods. This reward provides a discrete approximation to the area covered by the agent while exploring.
142
+
143
+ The training curves are shown in Figure 7 and the final test results in Table 1. The result of this experiment is that our method and Grid Oracle both work, while the ICM baseline is not working — and the qualitative difference in behaviour is bigger than in the previous experiments. As can be seen from the training curves, after a temporary increase, ICM quality actually decreases over time, rendering a sharp disagreement between the prediction-error-based bonus and the area coverage metric. By looking at the video3, we observe that the firing behaviour of ICM becomes even more prominent, while our method still shows reasonable exploration.
144
+
145
+ Finally, we try to find out if the ICM baseline behaviour above is due to the firing action only. Could it learn exploration of randomized mazes if the Fire action is excluded from the action set? For that purpose, we create a new version of the task — we call it “No Reward - Fire”. This task demonstrates qualitatively similar results to the one with the full action set — see Table 1. By looking at the videos3, we hypothesise that the agent can most significantly change its current view when it is close to the wall — thus increasing one-step prediction error — so it tends to get stuck near “interesting” diverse textures on the walls.
146
+
147
+ The results suggest that in an environment completely without reward, the ICM method will exhaust its curiosity very quickly — passing through a sharp peak and then degrading into undesired behaviour. This observation raises concerns: what if ICM passes the peak before it reaches the first task reward in the cases of real tasks? Supposedly, it would require careful tuning per-game. Furthermore, in some cases, it would take a lot of time with a good exploration behaviour to reach the first reward, which would require to stay at the top performance for longer — which is problematic for the ICM method but still possible for our method.
148
+
149
+ Table 1: Reward in DMLab tasks (mean $\pm$ std) for all compared methods. Higher is better. “ECO” stands for the online version of our method, which trains R-network and the policy at the same time. We report Grid Oracle reward in tasks with no reward. The Grid Oracle method is given for reference — it uses privileged information unavailable to other methods. Results are averaged over 30 random seeds. No seed tuning is performed.
150
+
151
+ <table><tr><td>Method</td><td>Sparse</td><td>Very Sparse</td><td>Sparse+Doors</td><td>No Reward</td><td>No Reward - Fire</td><td>Dense 1</td><td>Dense 2</td></tr><tr><td>PPO</td><td>27.0 ± 5.1</td><td>8.6±4.3</td><td>1.5 ± 0.1</td><td>191 ± 12</td><td>217 ±19</td><td>22.8±0.5</td><td>9.41 ± 0.02</td></tr><tr><td>PPO + ICM</td><td>23.8±2.8</td><td>11.2 ± 3.9</td><td>2.7±0.2</td><td>72±2</td><td>87±3</td><td>20.9±0.6</td><td>9.39 ± 0.02</td></tr><tr><td>PPO + EC (ours)</td><td>26.2 ± 1.9</td><td>24.7 ± 2.2</td><td>8.5±0.6</td><td>475±8</td><td>492 ± 10</td><td>19.9 ± 0.7</td><td>9.53 ± 0.03</td></tr><tr><td>PPO + ECO (ours)</td><td>41.6 ± 1.7</td><td>40.5 ± 1.1</td><td>19.8 ± 0.5</td><td>472±18</td><td>457±32</td><td>22.9 ± 0.4</td><td>9.60 ± 0.02</td></tr><tr><td>PPO + Grid Oracle</td><td>56.7 ± 1.3</td><td>54.3 ±1.2</td><td>29.4± 0.5</td><td>796±2</td><td>795±3</td><td>20.9±0.6</td><td>8.97 ±0.04</td></tr></table>
152
+
153
+ # 4.4 DENSE REWARD TASKS.
154
+
155
+ A desirable property of a good curiosity bonus is to avoid hurting performance in dense-reward tasks (in addition to improving performance for sparse-reward tasks). We test this scenario in two levels in the DMLab simulator: “Rooms Keys Doors Puzzle” (which we denote “Dense 1”) and “Rooms Collect Good Objects Train” (which we denote “Dense $2 ^ { \circ }$ ). In the first task, the agent has to collect keys and reach the goal object behind a few doors openable by those keys. The rewards in this task are rather dense (key collection/door opening is rewarded). In the second task the agent has to collect good objects (give positive reward) and avoid bad objects (give negative reward). The episode lasts for 900 4-repeated steps (equivalent to 1 minute) in both tasks.
156
+
157
+ The results show that our method indeed does not significantly deteriorate performance of plain PPO in those dense-reward tasks — see Table 1. The training curves for “Dense 1” are shown in Figure 7 and for “Dense 2” — in the supplementary material. Note that we use the same bonus weight in this task as in other DMLab tasks before. All methods work similarly besides the Grid Oracle in the “Dense 2” task — which performs slightly worse. Video inspection3 reveals that Grid Oracle — the only method which has ground-truth knowledge about area it covers during training — sometimes runs around excessively and occasionally fails to collect all good objects.
158
+
159
+ # 5 DISCUSSION
160
+
161
+ Our method is at the intersection of multiple topics: curiosity, episodic memory and temporal distance prediction. In the following, we discuss the relation to the prior work on those topics.
162
+
163
+ Curiosity in visually rich 3D environments. Recently, a few works demonstrated the possibility to learn exploration behaviour in visually rich 3D environments like DMLab (Beattie et al., 2016) and VizDoom (Kempka et al., 2016). (Pathak et al., 2017) trains a predictor for the embedding of the next observation and if the reality is significantly different from the prediction — rewards the agent. In that work, the embedding is trained with the purpose to be a good embedding for predicting action taken between observations — unlike an earlier work (Stadie et al., 2015) which obtains an embedding from an autoencoder. It was later shown by (Burda et al., 2018a) that the perceptive prediction approach has a downside — the agent could become a “couch-potato” if given an action to switch TV channels. This observation is confirmed in our experiments by observing a persistent firing behaviour of the ICM baseline in the navigational tasks with very sparse or no reward. By contrast, our method does not show this behaviour. Another work (Fu et al., 2017) trains a temporal distance predictor and then uses this predictor to establish novelty: if the observation is easy to classify versus previous observations, it is novel. This method does not use episodic memory, however, and the predictor is used in way which is different from our work.
164
+
165
+ General curiosity. Curiosity-based exploration for RL has been extensively studied in the literature. For an overview, we refer the reader to the works (Oudeyer & Kaplan, 2009; Oudeyer et al., 2007). The most common practical approaches could be divided into three branches: predictionerror-based, count-based and goal-generation-based. Since the prediction-based approaches were discussed before, in the following we focus on the latter two branches.
166
+
167
+ The count-based approach suggests to keep visit counts for observations and concentrate on visiting states which has been rarely visited before — which bears distant similarity to how we use episodic memory. This idea is natural for discrete observation spaces and has solid theoretical foundations. Its extension to continuous observation spaces is non-trivial, however. The notable step in this direction was taken by works (Bellemare et al., 2016; Ostrovski et al., 2017) which introduce a trained observation density model which is later converted to a function behaving similarly to counts. The way conversion is done has some similarity to prediction-error-based approaches: it is the difference of the density in the example before and after training of this example which is converted to count. The experiments in the original works operate on Atari games (Bellemare et al., 2013) and were not benchmarked on visually rich 3D environments. Another approach (Tang et al., 2017) discretises the continuous observation space by hashing and then uses the count-based approach in this discretised space. This method is appealing in its simplicity, however, the experiments in (Pathak et al., 2017; Fu et al., 2017) show that it does not perform well in visually rich 3D environments. Another line of work, Novelty Search (Lehman & Stanley, 2011) and its recent follow-up (Conti et al., 2018), proposed maintaining an archive of behaviours and comparing current behaviour to those — however, the comparison is done by euclidean distance and behaviours are encoded using coordinates, while we learn the comparison function and only use pixels.
168
+
169
+ Finally, our concept of novelty through reachability is reminiscent of generating the goals which are reachable but not too easy — a well-studied topic in the prior work. The work (Held et al., 2017) uses a GAN to differentiate what is easy to reach from what is not and then generate goals at the boundary. Another work (Baranes & Oudeyer, 2013) defines new goals according to the expected progress the agent will make if it learns to solve the associated task. The recent work (Per´ e et al. ´ , 2018) learns an embedding for the goal space and then samples increasingly difficult goals from that space. In a spirit similar to those works, our method implicitly defines goals that are at least some fixed number of steps away by using the reachability network. However, our method is easier to implement than other goal-generation methods and quite general.
170
+
171
+ Episodic memory. Two recent works (Blundell et al., 2016; Pritzel et al., 2017) were inspired by the ideas of episodic memory in animals and proposed an approach to learn the functioning of episodic memory along with the task for which this memory is applied. Those works are more focused on repeating successful strategies than on exploring environments — and are not designed to work in the absence of task rewards.
172
+
173
+ Temporal distance prediction. The idea to predict the distance between video frames has been studied extensively. Usually this prediction is an auxiliary task for solving another problem. (Sermanet et al., 2017) trains an embedding such that closer in time frames are also closer in the embedding space. Multiple works (Fu et al., 2017; Savinov et al., 2018; Aytar et al., 2018) train a binary classifier for predicting if the distance in time between frames is within a certain threshold or not. While (Sermanet et al., 2017; Aytar et al., 2018) use only the embedding for their algorithms, (Fu et al., 2017; Savinov et al., 2018) also use the classifier trained together with the embedding. As mentioned earlier, (Fu et al., 2017) uses this classifier for density estimation instead of comparison to episodic memory. (Savinov et al., 2018) does compare to the episodic memory buffer but solves a different task — given an already provided exploration video, navigate to a goal — which is complementary to the task in our work.
174
+
175
+ # 6 CONCLUSION
176
+
177
+ In this work we propose a new model of curiosity based on episodic memory and the ideas of reachability. This allows us to overcome the known “couch-potato” issues of prior work and outperform the previous curiosity state-of-the-art method ICM in visually rich 3D environments from VizDoom and DMLab. Our method also allows a MuJoCo ant to learn locomotion purely out of first-personview curiosity. In the future, we want to make policy aware of memory not only in terms of receiving reward, but also in terms of acting. Can we use memory content retrieved based on reachability to guide exploration behaviour in the test time? This could open opportunities to learn exploration in new tasks in a few-shot style — which is currently a big scientific challenge.
178
+
179
+ # ACKNOWLEDGMENTS
180
+
181
+ We would like to thank Olivier Pietquin, Alexey Dosovitskiy, Vladlen Koltun, Carlos Riquelme, Charles Blundell, Sergey Levine and Matthieu Geist for the valuable discussions about our work.
182
+
183
+ # REFERENCES
184
+
185
+ Yusuf Aytar, Tobias Pfaff, David Budden, Tom Le Paine, Ziyu Wang, and Nando de Freitas. Playing hard exploration games by watching youtube. arXiv preprint arXiv:1805.11592, 2018.
186
+
187
+ Adrien Baranes and Pierre-Yves Oudeyer. Active learning of inverse models with intrinsically motivated goal exploration in robots. Robotics and Autonomous Systems, 61(1):49–73, 2013.
188
+
189
+ Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler,¨ Andrew Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, et al. Deepmind lab. ´ arXiv preprint arXiv:1612.03801, 2016.
190
+
191
+ 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.
192
+
193
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013.
194
+
195
+ Charles Blundell, Benigno Uria, Alexander Pritzel, Yazhe Li, Avraham Ruderman, Joel Z Leibo, Jack Rae, Daan Wierstra, and Demis Hassabis. Model-free episodic control. arXiv preprint arXiv:1606.04460, 2016.
196
+
197
+ 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, 2018a.
198
+
199
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018b.
200
+
201
+ 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 novelty-seeking agents. In Advances in Neural Information Processing Systems, 2018.
202
+
203
+ 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.
204
+
205
+ 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.
206
+
207
+ 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. 2577–2587, 2017.
208
+
209
+ David Held, Xinyang Geng, Carlos Florensa, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. arXiv preprint arXiv:1705.06366, 2017.
210
+
211
+ Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Vime: Variational information maximizing exploration. In Advances in Neural Information Processing Systems, pp. 1109–1117, 2016.
212
+
213
+ Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. Viz- ´ doom: A doom-based ai research platform for visual reinforcement learning. In Computational Intelligence and Games (CIG), 2016 IEEE Conference on, pp. 1–8. IEEE, 2016.
214
+
215
+ Joel Lehman and Kenneth O Stanley. Abandoning objectives: Evolution through the search for novelty alone. Evolutionary computation, 2011.
216
+
217
+ Georg Ostrovski, Marc G Bellemare, Aaron van den Oord, and Remi Munos. Count-based explo- ´ ration with neural density models. arXiv preprint arXiv:1703.01310, 2017.
218
+
219
+ Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? a typology of computational approaches. Frontiers in neurorobotics, 1:6, 2009.
220
+
221
+ Pierre-Yves Oudeyer, Frederic Kaplan, and Verena V Hafner. Intrinsic motivation systems for autonomous mental development. IEEE transactions on evolutionary computation, 11(2):265–286, 2007.
222
+
223
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In International Conference on Machine Learning (ICML), volume 2017, 2017.
224
+
225
+ Alexandre Per´ e, S ´ ebastien Forestier, Olivier Sigaud, and Pierre-Yves Oudeyer. Unsupervised learn- ´ ing of goal spaces for intrinsically motivated goal exploration. arXiv preprint arXiv:1803.00781, 2018.
226
+
227
+ Alexander Pritzel, Benigno Uria, Sriram Srinivasan, Adria Puigdomenech, Oriol Vinyals, Demis Hassabis, Daan Wierstra, and Charles Blundell. Neural episodic control. arXiv preprint arXiv:1703.01988, 2017.
228
+
229
+ Nikolay Savinov, Alexey Dosovitskiy, and Vladlen Koltun. Semi-parametric topological memory for navigation. arXiv preprint arXiv:1803.00653, 2018.
230
+
231
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015.
232
+
233
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
234
+
235
+ Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, and Sergey Levine. Time-contrastive networks: Self-supervised learning from video. arXiv preprint arXiv:1704.06888, 2017.
236
+
237
+ Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. arXiv preprint arXiv:1507.00814, 2015.
238
+
239
+ Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, OpenAI Xi Chen, Yan Duan, John Schulman, Filip DeTurck, and Pieter Abbeel. # exploration: A study of count-based exploration for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2753– 2762, 2017.
240
+
241
+ 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, 2012.
242
+
243
+ Sergey Zagoruyko and Nikos Komodakis. Learning to compare image patches via convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4353–4361, 2015.
244
+
245
+ # SUPPLEMENTARY MATERIAL
246
+
247
+ The supplementary material is organized as follows. First, we describe the MuJoCo locomotion experiments. Then we provide training details for R-network. After that, we list hyperparameter values and the details of hyperparameter search for all methods. Then we show experimental results which suggest that R-network can generalize between environments: we transfer one general Rnetwork from all available DMLab30 levels to our tasks of interest and also transfer R-networks between single environments. After that, we present the results from a stability/ablation study which suggests our method is stable with respect to its most important hyperparameters and the components we used in the method are actually necessary for its performance (and measure their influence). Then we demonstrate the robustness of our method to the environments where every state has a stochastic next state. After that, we discuss computational considerations for our method. Finally, we provide the training curves for the “Dense $2 ^ { \circ }$ task in the main text.
248
+
249
+ # S1 MuJoCo ANT LOCOMOTION OUT OF FIRST-PERSON-VIEW CURIOSITY
250
+
251
+ Equipped with our curiosity module, a MuJoCo ant has learned4 to move out of curiosity based on the first-person view5.
252
+
253
+ First, let us describe the setup:
254
+
255
+ • Environment: the standard MuJoCo environment is a plane with a uniform or repetitive texture on it — nothing to be visually curious about. To fix that, we tiled the $4 0 0 \times 4 0 0$ floor into squares of size $4 \times 4$ . Each tile is assigned a random texture from a set of 190 textures at the beginning of every episode. The ant is initialized at a random location in the $2 0 0 \times 2 0 0$ central square of the floor. The episode lasts for 1000 steps (no action repeat is used). If the $z$ -coordinate of the center of mass of the ant is above 1.0 or below 0.2 — the episode ends prematurely (standard termination condition). Observation space: for computing the curiosity reward, we only use a first-person view camera mounted on the ant (that way we can use the same architecture of our curiosity module as in VizDoom and DMLab). For policy, we use the standard body features from Ant-v2 in gym-mujoco6 (joint angles, velocities, etc.).
256
+ • Action space: standard continuous space from Ant-v2 in gym-mujoco.
257
+ • Basic RL solver: PPO (same as in the main text of the paper).
258
+ • Baselines: PPO on task reward, PPO on task reward plus constant reward 1 at every step as a trivial curiosity bonus (which we denote $\mathrm { P P O } { + } 1$ , it optimizes for longer survival).
259
+
260
+ Second, we present quantitative results for the setting with no task reward after 10M training steps in Table S1 (the first row). Our method outperforms the baselines. As seen in the videos7, PPO (random policy) dies quickly, $\mathrm { P P O } { + } 1$ survives for longer but does not move much and our method moves around the environment.
261
+
262
+ Additionally, we performed an experiment with an extremely sparse task reward — which we call “Escape Circle”. The reward is given as follows: 0 reward inside the circle of radius 10, and starting from 10, we give a one-time reward of 1 every time an agent goes through a concentric circle of radius $1 0 + 0 . 5 k$ (for integer $k \geq 0$ ). The results at 10M training steps are shown in Table S1 (the second row). Our method significantly outperforms the baselines (better than the best baseline by a factor of 10).
263
+
264
+ Finally, let us discuss the relation to some other works in the field of learning locomotion from intrinsic reward. The closest work in terms of task setup is the concurrent work (Burda et al., 2018a). The authors demonstrate slow motion8 of the ant learned from pixel-based curiosity only.
265
+
266
+ Other works use state features (joint angles, velocities, etc.) for formulating intrinsic reward, not pixels — which is a different setup. One work in this direction is the concurrent work (Eysenbach et al., 2018) — which also contains a good overview of the literature on intrinsic reward from state features.
267
+
268
+ Table S1: Learning locomotion for MuJoCo Ant. For “No reward”, the task reward is 0 (so plain PPO is a random policy), and Grid Oracle rewards are reported (with cell size 5). Results are averaged over 30 random seeds for “No reward” and over 10 random seeds for “Escape Circle”. No seed tuning is performed.
269
+
270
+ <table><tr><td>Task</td><td>PPO</td><td>PPO+1</td><td>PPO + EC (ours)</td></tr><tr><td>No Reward</td><td>1.4 ± 0.02</td><td>1.7 ± 0.06</td><td>5.0 ± 0.27</td></tr><tr><td>Escape Circle</td><td>0.59 ± 0.54</td><td>0.45 ± 0.39</td><td>6.53 ± 3.57</td></tr></table>
271
+
272
+ # S2 REACHABILITY NETWORK TRAINING DETAILS
273
+
274
+ For training R-network, we use mini-batches of 64 observation pairs (matched within episodes). The training is run for 50K mini-batch iterations for VizDoom and 200K mini-batch iterations for DMLab. At the beginning of every pass through the buffer, we re-shuffle it. We use Adam optimizer with learning rate $\bar { 1 } 0 ^ { - 4 }$ . The R-network uses a siamese architecture with two branches (see Figure 2 in the main text), each branch is Resnet-18 with 512 outputs, with a fully-connected network applied to the concatenated output of the branches. The fully-connected network has four hidden layers with 512 units, batch-normalization and ReLU is applied after each layer besides the last one, which is a softmax layer. Observations are RGB-images with resolution $1 6 0 \times 1 2 0$ pixels.
275
+
276
+ For online training of the R-network, we collect the experience and perform training every 720K 4- repeated environment steps. Every time the experience is collected, we make 10 epochs of training on this experience. Before every epoch, the data is shuffled.
277
+
278
+ # S3 HYPERPARAMETERS
279
+
280
+ The hyperparameters of different methods are given in Table S2 for VizDoom environment, in Table S3 for DMLab environment, and in Tables S4, S5 for MuJoCo Ant environment. The hyperparameters for DMLab are tuned on the “Sparse” environment for all methods — because all methods work reasonably on this environment (it is unfair to tune a method on an environment where it fails and also unfair to tune different methods on different environments). We use the PPO algorithm from the open-source implementation9. For implementation convenience, we scale both the bonus and the task reward (with a single balancing coefficient it would not be possible to turn off one of those rewards).
281
+
282
+ Table S2: Hyper-parameters used for VizDoom environment.
283
+
284
+ <table><tr><td></td><td>PPO</td><td>PPO +ICM</td><td>PPO + EC</td></tr><tr><td>Learning rate</td><td>0.00025</td><td>0.00025</td><td>0.00025</td></tr><tr><td>PPO entropy coefficient</td><td>0.01</td><td>0.01</td><td>0.01</td></tr><tr><td>Task reward scale</td><td>5</td><td>5</td><td>5</td></tr><tr><td>Curiosity bonus scale α</td><td>0</td><td>0.01</td><td>1</td></tr><tr><td>ICM forward inverse ratio</td><td>-</td><td>0.2</td><td>-</td></tr><tr><td>ICM curiosity loss strength</td><td>-</td><td>10</td><td>-</td></tr><tr><td>EC memory size</td><td></td><td>1</td><td>200</td></tr><tr><td>EC reward shift β</td><td></td><td></td><td>0.5</td></tr><tr><td>EC novelty threshold bnovelty</td><td></td><td></td><td>0</td></tr><tr><td>EC aggregation function F</td><td></td><td></td><td>percentile-90</td></tr></table>
285
+
286
+ Table S3: Hyper-parameters used for DMLab environment.
287
+
288
+ <table><tr><td></td><td>PPO</td><td>PPO+ICM</td><td>PPO + Grid Oracle</td><td>PPO + EC</td></tr><tr><td>Learning rate</td><td>0.00019</td><td>0.00025</td><td>0.00025</td><td>0.00025</td></tr><tr><td>PPO entropy coefficient</td><td>0.0011</td><td>0.0042</td><td>0.0066</td><td>0.0021</td></tr><tr><td>Task reward scale</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Curiosity bonus scale α</td><td>0</td><td>0.55</td><td>0.052</td><td>0.030</td></tr><tr><td>Grid Oracle cell size</td><td>-</td><td>=</td><td>30</td><td>-</td></tr><tr><td>ICM forward inverse ratio</td><td>=</td><td>0.96</td><td>-</td><td>-</td></tr><tr><td>ICM curiosity loss strength</td><td></td><td>64</td><td>-</td><td>-</td></tr><tr><td>EC memory size</td><td></td><td>-</td><td></td><td>200</td></tr><tr><td>EC reward shift β</td><td></td><td>-</td><td>1</td><td>0.5</td></tr><tr><td>EC novelty threshold bnovelty</td><td></td><td></td><td></td><td>0</td></tr><tr><td>EC aggregation function F</td><td></td><td></td><td></td><td>percentile-90</td></tr></table>
289
+
290
+ Table S4: Hyper-parameters used for MuJoCo Ant “No Reward” environment. For the $\mathrm { P P O } { + } 1$ baseline, the curiosity reward is substituted by $+ 1$ (optimizes for survival). The curiosity bonus scale is applied to this reward.
291
+
292
+ <table><tr><td></td><td>PPO</td><td>PPO+1</td><td>PPO +EC</td></tr><tr><td>Learning rate</td><td>0.0003</td><td>0.00007</td><td>0.00007</td></tr><tr><td>PPO entropy coefficient</td><td>8e-6</td><td>0.0001</td><td>0.00002</td></tr><tr><td>Task reward scale</td><td>0</td><td>0</td><td>0</td></tr><tr><td>Curiosity bonus scale α</td><td>0</td><td>1</td><td>1</td></tr><tr><td>EC memory size</td><td>-</td><td>1</td><td>1000</td></tr><tr><td>EC reward shift β</td><td></td><td></td><td>1</td></tr><tr><td>EC novelty threshold bnovelty</td><td></td><td></td><td>0</td></tr><tr><td>EC aggregation function F</td><td></td><td></td><td>10th largest</td></tr></table>
293
+
294
+ Table S5: Hyper-parameters used for MuJoCo Ant “Escape Circle” environment. For the $\mathrm { P P O } { + } 1$ baseline, the curiosity reward is substituted by $+ 1$ (optimizes for survival). The curiosity bonus scale is applied to this reward.
295
+
296
+ <table><tr><td></td><td>PPO</td><td>PPO+1</td><td>PPO + EC</td></tr><tr><td>Learning rate</td><td>0.0001</td><td>0.0001</td><td>4.64e-05</td></tr><tr><td>PPO entropy coefficient</td><td>1.21e-06</td><td>1.43e-06</td><td>1.78e-06</td></tr><tr><td>Task reward scale</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Curiosity bonus scale α</td><td>0</td><td>0.85</td><td>0.25</td></tr><tr><td>EC memory size</td><td>1</td><td>-</td><td>1000</td></tr><tr><td>EC reward shift β</td><td></td><td>=</td><td>1</td></tr><tr><td>EC novelty threshold bnovelty</td><td></td><td></td><td>0</td></tr><tr><td>EC aggregation function F</td><td></td><td></td><td>10th largest</td></tr></table>
297
+
298
+ # S4 R-NETWORK GENERALIZATION STUDY
299
+
300
+ One of the promises of our approach is its potential ability to generalize between tasks. In this section we verify if this promise holds.
301
+
302
+ # S4.1 TRAINING R-NETWORK ON ALL DMLab-30 TASKS
303
+
304
+ Could we train a universal R-network for all available levels — and then use this network for all our tasks of interest? Since different games have different dynamics models, the notion of closely reachable or far observations also changes from game to game. Can R-network successfully handle this variability? Table S6 suggests that using a universal R-network slightly hurts the performance compared to using a specialized R-network trained specifically for the task. However, it still definitely helps to get higher reward compared to using the plain PPO. The R-network is trained using 10M environment interactions equally split across all 30 DMLab-30 tasks.
305
+
306
+ Table S6: Reward on the tasks “No Reward” and “Very Sparse” using a universal R-network. Two baselines (PPO and $\mathrm { P P O } + \mathrm { E C }$ with a specialized R-network) are also provided.
307
+
308
+ <table><tr><td>Method</td><td>No Reward</td><td>Very Sparse</td></tr><tr><td>PPO</td><td>191 ±12</td><td>8.6±4.3</td></tr><tr><td>PPO + EC with specialized R-network</td><td>475±8</td><td>24.7 ± 2.2</td></tr><tr><td>PPO + EC with universal R-network</td><td>348±8</td><td>19.3 ± 1.0</td></tr></table>
309
+
310
+ # S4.2 TRAINING R-NETWORK ON ONE LEVEL AND TESTING ON ANOTHER
311
+
312
+ This experiment is similar to the previous one but in a sense is more extreme. Instead of training on all levels (including the levels of interest and other unrelated levels), can we train R-network on just one task and use if for a different task? Table S7 suggests we can obtain reasonable performance by transferring the R-network between similar enough environments. The performance is unsatisfactory only in one case (using the R-network trained on “Dense 2”). Our hypothesis is that the characteristics of the environments are sufficiently different in that case: single room versus maze, static textures on the walls versus changing textures.
313
+
314
+ Table S7: Reward on the environments “No Reward” and “Very Sparse” (columns) when the Rnetwork is trained on different environments (rows). We provide a result with a matching R-network for reference (bottom).
315
+
316
+ <table><tr><td>R-network training environment</td><td>No Reward</td><td>Very Sparse</td></tr><tr><td>Dense 1</td><td>320±5</td><td>18.5 ± 1.4</td></tr><tr><td>Dense 2</td><td>43±2</td><td>0.8 ± 0.5</td></tr><tr><td>Sparse + Doors</td><td>376±7</td><td>16.2 ± 0.7</td></tr><tr><td>Matching environment</td><td>475 ±8</td><td>24.7 ± 2.2</td></tr></table>
317
+
318
+ # S5 STABILITY/ABLATION STUDY
319
+
320
+ The experiments are done both in “No Reward” and “Very Sparse” environments. The “No Reward” environment is useful to avoid the situations where task reward would hide important behavioural differences between different flavors of our method (this “hiding” effect can be easily observed for different methods comparison in the dense reward tasks — but the influence of task reward still remains even in sparser cases). As in the main text, for the “No Reward” task we report the Grid Oracle reward as a discrete approximation to the area covered by the agent trajectories.
321
+
322
+ # S5.1 POSITIVE EXAMPLE THRESHOLD IN R-NETWORK TRAINING
323
+
324
+ Training the R-network requires a threshold $k$ to separate negative from positive pairs. The trained policy implicitly depends on this threshold. Ideally, the policy performance should not be too sensitive to this hyper-parameter. We conduct a study where the threshold is varied from 2 to 10 actions (as in all experiments before, each action is repeated 4 times). Table S8 shows that the EC performance is reasonably robust to the choice of this threshold.
325
+
326
+ Table S8: Reward in the “No Reward” and “Very Sparse“ tasks using different positive example thresholds $k$ when training the R-network.
327
+
328
+ <table><tr><td>Threshold k</td><td>No Reward</td><td>Very Sparse</td></tr><tr><td>2</td><td>378±18</td><td>28.3 ± 1.6</td></tr><tr><td>3</td><td>395 ±10</td><td>20.9 ± 1.6</td></tr><tr><td>4</td><td>412±8</td><td>31.1 ± 1.2</td></tr><tr><td>5</td><td>475±8</td><td>24.7 ± 2.2</td></tr><tr><td>7</td><td>451±4</td><td>23.6 ± 1.0</td></tr><tr><td>10</td><td>455±7</td><td>20.8 ± 0.8</td></tr></table>
329
+
330
+ # S5.2 MEMORY SIZE IN EC MODULE
331
+
332
+ The EC-module relies on an explicit memory buffer to store the embeddings of past observations and define novelty. One legitimate question is to study the impact of the size of this memory buffer on the performance of the EC-module. As observed in table S9, the memory size has little impact on the performance.
333
+
334
+ Table S9: Reward for different values of the memory size for the tasks “No Reward” and “Very Sparse”.
335
+ S5.3 ENVIRONMENT INTERACTION BUDGET FOR TRAINING R-NETWORK
336
+
337
+ <table><tr><td>Memory size</td><td>No Reward</td><td> Very Sparse</td></tr><tr><td>100</td><td>447±6</td><td>19.4 ± 1.9</td></tr><tr><td>200</td><td>475±8</td><td>24.7 ± 2.2</td></tr><tr><td>350</td><td>459±6</td><td>23.5 ± 1.4</td></tr><tr><td>500</td><td>452±6</td><td>23.8± 2.0</td></tr></table>
338
+
339
+ The sample complexity of our EC method includes two parts: the sample complexity to train the Rnetwork and the sample complexity of the policy training. In the worst case – when the R-network does not generalize across environments – the R-network has to be trained for each environment and the total sample complexity is then the sum of the previous two sample complexities. It is then crucial to see how many steps are needed to train R-network such that it can capture the notion of reachability. R-network trained using a number of environment steps as low as 1M already gives good performance, see Table S10.
340
+
341
+ Table S10: Reward of the policy trained on the “No Reward” and “Very Sparse“ tasks with an R-network trained using a varying number of environment interactions (from 100K to 5M).
342
+
343
+ <table><tr><td>Interactions</td><td>No Reward</td><td>Very Sparse</td></tr><tr><td>100K</td><td>357±18</td><td>12.2 ± 1.3</td></tr><tr><td>300K</td><td>335±9</td><td>16.2 ± 0.7</td></tr><tr><td>1M</td><td>383±13</td><td>18.6 ± 0.9</td></tr><tr><td>2.5M</td><td>475±8</td><td>24.7 ± 2.2</td></tr><tr><td>5M</td><td>416±5</td><td>20.7 ± 1.4</td></tr></table>
344
+
345
+ # S5.4 IMPORTANCE OF TRAINING DIFFERENT PARTS OF R-NETWORK
346
+
347
+ The R-network is composed of an Embedding network and a Comparator network. How important is each for the final performance of our method? To establish that, we conduct two experiments. First, we fix the Embedding network at the random initialization and train only the Comparator. Second, we substitute the Comparator network applied to embeddings $\mathbf { e } _ { 1 } , \mathbf { e } _ { 2 }$ with the sigmoid function $\sigma ( \mathbf { e } _ { 1 } ^ { T } \mathbf { e } _ { 2 } )$ and train only the Embedding. According to the results in Table S11, we get a reasonable performance with a random embedding: the results are still better than the plain PPO (but worse than with the complete R-network). However, without the Comparator the quality drops below the plain PPO.
348
+
349
+ ![](images/a248302ba7eb1ac222582a5dd6cdee1baa4afe01d6f60c99d36971f27882c303.jpg)
350
+ Figure S1: Examples of randomized environments: (a) Image Action, (b) Noise.
351
+
352
+ This experiment leads us to two conclusions. First, training the Embedding network is desired but not necessary for our method to work. Second, using the Comparator is essential and cannot be omitted in the current setup. Apparently, predicting reachability requires fine-grained access to both embeddings at the same time — and a simple comparison function does not work.
353
+
354
+ Table S11: Reward on the “No Reward” and “Very Sparse“ tasks using ablated versions of the R-network.
355
+
356
+ <table><tr><td>Method</td><td>No Reward</td><td> Very Sparse</td></tr><tr><td>PPO</td><td>191 ± 12</td><td>8.6 ± 4.3</td></tr><tr><td>PPO + EC with complete R-network</td><td>475±8</td><td>24.7 ± 2.2</td></tr><tr><td>PPO + EC with random Embedding</td><td>392 ±12</td><td>16.2 ± 1.4</td></tr><tr><td>PPO + EC without Comparator network</td><td>48±3</td><td>5.8± 2.4</td></tr></table>
357
+
358
+ # S6 RANDOMIZED ENVIRONMENTS
359
+
360
+ In the main text of the paper we observed how the firing action confused the surprise-based curiosity method ICM. This was a manifestation of the hardness of future prediction performed by ICM. Importantly, there could be more than one reason why future prediction is hard (as observed in the concurrent work (Burda et al., 2018b)): partial observability of the environment, insufficiently rich future prediction model or randomized transitions in the environment. Since our own method EC relies on comparisons to the past instead of predictions of the future, one could expect it to be more robust to those factors (intuitively, comparison to the past is an easier problem). The goal of this section is to provide additional evidence for that.
361
+
362
+ We are going to experiment with one source of future prediction errors which we have used in the thought experiment from the introduction: environment stochasticity. In particular, we analyze how different methods behave when all the states in the environment provide stochastic next state. For that, we create versions of the DMLab environments “Sparse” and “Very Sparse” with added strong source of stochasticity: randomized TV on the head-on display of the agent. It is implemented as follows: the lower right quadrant of the agent’s first person view is occupied with random images. We try a few settings:
363
+
364
+ • “Image Action $k ^ { \prime \prime }$ : there are $k$ images of animals retrieved from the internet, an agent has a special action which changes an image on the TV screen to a random one from this set. An example is shown in Figure S1(a).
365
+ “Noise”: at every step a different noise pattern is shown on the TV screen, independently from agent’s actions. The noise is sampled uniformly from $[ 0 , 2 5 5 ]$ independently for each pixel. An example is shown in Figure S1(b).
366
+ • “Noise Action”: same as “Noise”, but the noise pattern only changes if the agent uses a special action.
367
+
368
+ Table S12: Reward in the randomized-TV versions of DMLab task “Sparse” (mean $\pm$ std) for all compared methods. Higher is better. “Original” stands for the non-randomized standard version of the task which we used in the main text. “ECO” stands for the online version of our method, which trains R-network and the policy at the same time. The Grid Oracle method is given for reference — it uses privileged information unavailable to other methods. Results are averaged over 30 random seeds. No seed tuning is performed.
369
+
370
+ <table><tr><td>Method</td><td colspan="3">Image Action</td><td>Noise</td><td>Noise Action</td><td>Original</td></tr><tr><td></td><td>3</td><td>10</td><td>30</td><td></td><td></td><td></td></tr><tr><td>PPO</td><td>11.5 ± 2.1</td><td>10.9 ± 1.8</td><td>8.5± 1.5</td><td>11.6 ± 1.9</td><td>9.8 ± 1.5</td><td>27.0 ± 5.1</td></tr><tr><td>PPO + ICM</td><td>10.0 ± 1.2</td><td>10.5 ± 1.2</td><td>6.9 ± 1.0</td><td>7.7 ± 1.1</td><td>7.6 ± 1.1</td><td>23.8± 2.8</td></tr><tr><td>PPO + EC (ours)</td><td>19.8 ± 0.7</td><td>15.3 ± 0.4</td><td>13.1 ± 0.3</td><td>18.7±0.8</td><td>14.8± 0.4</td><td>26.2 ± 1.9</td></tr><tr><td>PPO + ECO (ours)</td><td>24.3 ± 2.1</td><td>26.6 ± 2.8</td><td>18.5± 0.6</td><td>28.2 ± 2.4</td><td>18.9 ± 1.9</td><td>41.6 ± 1.7</td></tr><tr><td>PPO + Grid Oracle</td><td>37.7± 0.7</td><td>37.1± 0.7</td><td>37.4± 0.7</td><td>38.8± 0.8</td><td>39.3 ± 0.8</td><td>56.7 ± 1.3</td></tr></table>
371
+
372
+ Table S13: Reward in the randomized-TV versions of DMLab task “Very Sparse” (mean $\pm$ std) for all compared methods. Higher is better. “Original” stands for the non-randomized standard version of the task which we used in the main text. “ECO” stands for the online version of our method, which trains R-network and the policy at the same time. The Grid Oracle method is given for reference — it uses privileged information unavailable to other methods. Results are averaged over 30 random seeds. No seed tuning is performed.
373
+
374
+ <table><tr><td>Method</td><td colspan="3">Image Action</td><td>Noise</td><td>Noise Action</td><td>Original</td></tr><tr><td></td><td>3</td><td>10</td><td>30</td><td></td><td></td><td></td></tr><tr><td>PPO</td><td>6.5 ± 1.6</td><td>8.3±1.8</td><td>6.3 ± 1.8</td><td>8.7 ±1.9</td><td>6.1 ± 1.8</td><td>8.6±4.3</td></tr><tr><td>PPO + ICM</td><td>3.8±0.8</td><td>4.7±0.9</td><td>4.9 ± 0.7</td><td>6.0 ±1.3</td><td>5.7 ± 1.4</td><td>11.2 ± 3.9</td></tr><tr><td>PPO +EC (ours)</td><td>13.8± 0.5</td><td>10.2 ± 0.8</td><td>7.4 ± 0.5</td><td>13.4 ± 0.6</td><td>11.3 ± 0.4</td><td>24.7± 2.2</td></tr><tr><td>PPO + ECO (ours)</td><td>20.5± 1.3</td><td>17.8 ± 0.8</td><td>16.8 ± 1.4</td><td>26.0 ± 1.6</td><td>12.5 ± 1.3</td><td>40.5 ± 1.1</td></tr><tr><td>PPO + Grid Oracle</td><td>35.4± 0.6</td><td>35.9 ± 0.6</td><td>36.3± 0.7</td><td>35.5± 0.6</td><td>35.4 ± 0.8</td><td>54.3 ± 1.2</td></tr></table>
375
+
376
+ The results at 20M 4-repeated environment steps are shown in Tables S12, S13. In almost all cases, the performance of all methods deteriorates because of any source of stochasticity. However, our method turns out to be reasonably robust to all sources of stochasticity and still outperforms the baselines in all settings. The videos10,11 demonstrate that our method still explores the maze reasonably well.
377
+
378
+ # S7 COMPUTATIONAL CONSIDERATIONS
379
+
380
+ The most computationally intensive parts of our algorithm are the memory reachability queries. Reachabilities to past memories are computed in parallel via mini-batching. We have shown the algorithm to work reasonably fast with a memory size of 200. For orders of magnitude larger memory sizes, one would need to better parallelize reachability computations — which should in principle be possible. Memory consumption for the stored memories is very modest $\mathbf { \zeta } _ { 4 0 0 \ K B ) }$ , as we only store 200 of 512-float-embeddings, not the observations.
381
+
382
+ As for the speed comparison between different methods, $\mathrm { P P O } + \mathrm { I C M }$ is $1 . 0 9 \mathbf { x }$ slower than PPO and $\mathrm { P P O } + \mathrm { E C }$ (our method) is $1 . 8 4 \mathbf { x }$ slower than PPO. In terms of the number of parameters, R-network brings 13M trainable variables, while PPO alone was 1.7M and $\mathrm { P P O } + \mathrm { I C M }$ was 2M. That said, there was almost no effort spent on optimizing the pipeline in terms of speed/parameters, so it is likely easy to make improvements in this respect. It is quite likely that a resource-consuming Resnet-18 is not needed for the R-network — a much simpler model may work as well. In this paper, we followed the setup for the R-network from prior work (Savinov et al., 2018) because it was shown to perform well, but there is no evidence that this setup is necessary.
383
+
384
+ # S8 ADDITIONAL DMLab TRAINING CURVES
385
+
386
+ ![](images/66472d7f181a4749164d8c0020144436017f2978d9550d694759779604442b52.jpg)
387
+ Figure S2: Reward as a function of training step for the DMLab task “Dense $2 ^ { \circ }$ . Higher is better. We shift the curves for our method by the number of environment steps used to train R-network — so the comparison between different methods is fair. We run every method 30 times and show 5 randomly selected runs. No seed tuning is performed.
388
+
389
+ We show additional training curves from the main text experimental section in Figure S2.
md/train/SnONpXZ_uQ_/SnONpXZ_uQ_.md ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Graph Models for Retrosynthesis Prediction
2
+
3
+ Vignesh Ram Somnath1
4
+
5
+ Charlotte Bunne1
6
+
7
+ Connor W. Coley2
8
+
9
+ Andreas Krause1 Regina Barzilay3
10
+
11
+ 1Department of Computer Science, ETH 2Department of Chemical Engineering, MIT 3Computer Science and Artificial Intelligence Lab, MIT 1{vsomnath, bunnec, krausea}@ethz.ch, 2ccoley@mit.edu, 3regina@csail.mit.edu
12
+
13
+ # Abstract
14
+
15
+ Retrosynthesis prediction is a fundamental problem in organic synthesis, where the task is to identify precursor molecules that can be used to synthesize a target molecule. A key consideration in building neural models for this task is aligning model design with strategies adopted by chemists. Building on this viewpoint, this paper introduces a graph-based approach that capitalizes on the idea that the graph topology of precursor molecules is largely unaltered during a chemical reaction. The model first predicts the set of graph edits transforming the target into incomplete molecules called synthons. Next, the model learns to expand synthons into complete molecules by attaching relevant leaving groups. This decomposition simplifies the architecture, making its predictions more interpretable, and also amenable to manual correction. Our model achieves a top-1 accuracy of $5 3 . 7 \%$ , outperforming previous template-free and semi-template-based methods.
16
+
17
+ # 1 Introduction
18
+
19
+ Retrosynthesis prediction, first formalized by E. J. Corey [Corey, 1991] is a fundamental problem in organic synthesis that attempts to identify a series of chemical transformations for synthesizing a target molecule. In the single-step formulation, the task is to identify a set of reactant molecules given a target. Beyond simple reactions, many practical tasks involving complex organic molecules are difficult even for expert chemists. As a result, substantial experimental exploration is needed to cover for deficiencies of analytical approaches. This has motivated interest in computer-assisted retrosynthesis [Corey and Wipke, 1969], with a recent surge in machine learning methods [Chen et al., 2019, Coley et al., 2017b, Dai et al., 2019, Zheng et al., 2019, Genheden et al., 2020].
20
+
21
+ Computationally, the main challenge is how to explore the combinatorial space of reactions that can yield the target molecule. Largely, previous methods for retrosynthesis prediction can be divided into template-based [Coley et al., 2017b, Dai et al., 2019, Segler and Waller, 2017] and template-free [Chen et al., 2019, Zheng et al., 2019] approaches. Template-based methods match a target molecule against a large set of templates, which are molecular subgraph patterns that highlight changes during a chemical reaction. Despite their interpretability, these methods fail to generalize to new reactions. Template-free methods bypass templates by learning a direct mapping from the SMILES [Weininger, 1988] representations of the product to reactants. Despite their greater generalization potential, these methods generate reactant SMILES character by character, increasing generation complexity.
22
+
23
+ ![](images/e988f2e4a9f13ae6fa41934806006c24c87183942b7fd7f824274aee3a6237f9.jpg)
24
+ Figure 1: Overview of Our Approach. a. Edit Prediction. We train a model to learn a distribution over possible graph edits. In this case, the correct edit corresponds to breaking the bond marked in red. Applying this edit produces two synthons. b. Synthon Completion. Another model is trained to pick candidate leaving groups (blue) for each synthon from a discrete vocabulary, which are then attached to produce the final reactants.
25
+
26
+ Another important consideration in building retrosynthesis models is aligning model design with strategies adopted by expert chemists. These strategies are influenced by fundamental properties of chemical reactions, independent of complexity level: (i.) the product atoms are always a subset of the reactant atoms1, and (ii.) the molecular graph topology is largely unaltered from products to reactants. For example, in the standard retrosynthesis dataset, only $6 . 3 \%$ of the atoms in the product undergo any change in connectivity.
27
+
28
+ This consideration has received more attention in recent semi-template-based methods [Shi et al., 2020, Yan et al., 2020], that generate reactants from a product in two stages: (i.) first identify intermediate molecules called synthons, (ii.) and then complete synthons into reactants by sequential generation of atoms or SMILES characters.. Our model GRAPHRETRO also uses a similar workflow. However, we avoid sequential generation for completing synthons by instead selecting subgraphs called leaving groups from a precomputed vocabulary. This vocabulary is constructed during preprocessing by extracting subgraphs that differ between a synthon and the corresponding reactant. The vocabulary has a small size (170 for USPTO-50k) indicating remarkable redundancy, while covering $9 9 . 7 \%$ of the test set. Operating at the level of these subgraphs greatly reduces the complexity of reactant generation, with improved empirical performance. This formulation also simplifies our architecture, and makes our predictions more transparent, interpretable and amenable to manual correction.
29
+
30
+ The benchmark dataset for evaluating retrosynthesis models is USPTO-50k [Schneider et al., 2016], which consists of 50000 reactions across 10 reaction classes. The dataset contains an unexpected shortcut towards predicting the edit, in that the product atom with atom-mapping 1 is part of the edit in $7 5 \%$ of the cases, allowing predictions that depend on the position of the atom to overestimate performance. We canonicalize the product SMILES and remap the existing dataset, thereby removing the shortcut. On this remapped dataset, GRAPHRETRO achieves a top-1 accuracy of $5 3 . 7 \%$ when the reaction class is not known, outperforming both template-free and semi-template-based methods.
31
+
32
+ # 2 Related Work
33
+
34
+ Retrosynthesis Prediction Existing machine learning methods for retrosynthesis prediction can be divided into template-based, template-free and recent semi-template-based approaches.
35
+
36
+ Template-Based: Templates are either hand-crafted by experts [Hartenfeller et al., 2011, Szymkuc´ et al., 2016], or extracted algorithmically from large databases Coley et al. [2017a], Law et al. [2009]. Exhaustively applying large template sets is expensive due to the involved subgraph matching procedure. Template-based methods therefore utilize different ways of prioritizing templates, by either learning a conditional distribution over the template set [Segler and Waller, 2017], ranking templates based on molecular similarities to precedent reactions [Coley et al., 2017b] or directly modelling the joint distribution of templates and reactants using logic variables [Dai et al., 2019]. Despite their interpretability, these methods fail to generalize outside their rule set.
37
+
38
+ Template-Free: Template-free methods [Liu et al., 2017, Zheng et al., 2019, Chen et al., 2019] learn a direct transformation from products to reactants using architectures from neural machine translation and a string based representation of molecules called SMILES [Weininger, 1988]. Linearizing molecules as strings does not utilize the inherently rich chemical structure. In addition, the reactant SMILES are generated from scratch, character by character. Attempts have been made to improve validity by adding a syntax correcter [Zheng et al., 2019] and a mixture model to improve diversity of suggestions [Chen et al., 2019], but the performance remains worse than [Dai et al., 2019] on the standard retrosynthesis dataset. Sun et al. [2021] formulate retrosynthesis using energy-based models, with additional parameterizations and loss terms to enforce the duality between forward (reaction prediction) and backward (retrosynthesis) prediction.
39
+
40
+ Semi-Template-Based: Our work is closely related to recently proposed semi-template-based methods [Shi et al., 2020, Yan et al., 2020], which first identify synthons and then expand synthons into reactants through sequential generation using either a graph generative model [Shi et al., 2020] or a Transformer [Yan et al., 2020]. To reduce the complexity of reactant generation, we instead complete synthons using subgraphs called leaving groups selected from a precomputed vocabulary. This allows us to view synthon completion as a classification problem instead of a generative one. We also utilize the dependency graph between possible edits, and update edit predictions using a message passing network (MPN) [Gilmer et al., 2017] on this graph. Both innovations together yield a $4 . 8 \%$ and $3 . 3 \%$ performance improvement respectively over previous semi-template-based methods.
41
+
42
+ Reaction Center Identification The reaction center covers a small number of participating atoms involved in the reaction. Our work is also related to models that predict reaction outcomes by learning to rank atom pairs based on their likelihood to be in the reaction center [Coley et al., 2019, Jin et al., 2017]. The task of identifying the reaction center is related to the step of deriving the synthons in our formulation. Our work departs from [Coley et al., 2019, Jin et al., 2017] as we utilize the property that new bond formations occur rarely $( \sim 0 . 1 \% )$ from products to synthons, allowing us to predict a score only for existing bonds and atoms and reduce prediction complexity from $O ( N ^ { \bar { 2 } } )$ to $O ( N )$ . We also utilize the dependency graph between possible edits, and update edit predictions using a MPN on this graph.
43
+
44
+ Utilizing Substructures Substructures have been utilized in various tasks from sentence generation by fusing phrases to molecule generation and optimization [Jin et al., 2018, 2020]. Our work is closely related to [Jin et al., 2020] which uses precomputed substructures as building blocks for property-conditioned molecule generation. However, instead of precomputing, synthons —analogous building blocks for reactants— are indirectly learnt during training.
45
+
46
+ # 3 Model Design
47
+
48
+ Our approach leverages the property that graph topology is largely unaltered from products to reactants. To achieve this, we first derive suitable building blocks from the product called synthons, and then complete them into valid reactants by adding specific functionalities called leaving groups. These derivations, called edits, are characterized by modifications to bonds or hydrogen counts on atoms. We first train a neural network to predict a score for possible edits (Section 3.1). The edit with the highest score is then applied to the product to obtain synthons. Since the number of unique leaving groups are small, we model leaving group selection as a classification problem over a precomputed vocabulary (Section 3.2). To produce candidate reactants, we attach the predicted leaving group to the corresponding synthon through chemically constrained rules. The overall process is outlined in Figure 1. Before describing the two modules, we introduce relevant preliminaries that set the background for the remainder of the paper.
49
+
50
+ Retrosynthesis Prediction A retrosynthesis pair $R$ is described by a pair of molecular graphs $( \mathcal { G } _ { p } , \mathcal { G } _ { r } )$ , where $\mathcal { G } _ { p }$ are the products and $\mathcal { G } _ { r }$ the reactants. A molecular graph is described as $\mathcal { G } = \mathbf { \bar { \rho } } ( \mathcal { V } , \mathcal { E } )$ with atoms $\nu$ as nodes and bonds $\mathcal { E }$ as edges. Prior work has focused on the single product case, while reactants can have multiple connected components, i.e. $\mathcal { G } _ { r } = \{ \mathcal { G } _ { r _ { c } } \} _ { c = 1 } ^ { C }$ . Retrosynthesis pairs are atom-mapped so that each product atom has a unique corresponding reactant atom. The retrosynthesis task then, is to infer $\{ \mathcal { G } _ { r _ { c } } \} _ { c = 1 } ^ { C }$ given $\mathcal { G } _ { p }$ .
51
+
52
+ Edits Edits consist of (i.) atom pairs $\left\{ \left( a _ { i } , a _ { j } \right) \right\}$ where the bond type changes from products to reactants, and (ii.) atoms $\left\{ { a } _ { i } \right\}$ where the number of hydrogens attached to the atom change from products to reactants. We denote the set of edits by $E$ . Since retrosynthesis pairs in the training set are atom-mapped, edits can be automatically identified by comparing the atoms and atom pairs in the product to their corresponding reactant counterparts.
53
+
54
+ Synthons and Leaving Groups Applying edits $E$ to the product $\mathcal { G } _ { p }$ results in incomplete molecules called synthons. Synthons are analogous to rationales or building blocks, which are expanded into valid reactants by adding specific functionalities called leaving groups that are responsible for its reactivity. We denote synthons by $\mathcal { G } _ { s }$ and leaving groups by $\mathcal { G } _ { l }$ . We further assume that synthons and leaving groups have the same number of connected components as the reactants, i.e $\mathcal { G } _ { s } \doteq \{ \mathcal { G } _ { s _ { c } } \} _ { c = 1 } ^ { C }$ and $\mathcal { G } _ { l } = \{ \mathcal { G } _ { l _ { c } } ^ { \star } \} _ { c = 1 } ^ { C }$ . This assumption holds for $9 9 . 9 7 \%$ reactions in the training set.
55
+
56
+ Formally, our model generates reactants by first predicting the set of edits $E$ that transform $\mathcal { G } _ { p }$ into $\mathcal { G } _ { s }$ , followed by predicting a leaving group $\mathcal { G } _ { l _ { c } }$ to attach to each synthon $\mathcal { G } _ { s _ { c } }$ . The model is defined as
57
+
58
+ $$
59
+ P ( \mathcal G _ { r } | \mathcal G _ { p } ) = \sum _ { E , \mathcal G _ { l } } P ( E | \mathcal G _ { p } ) P ( \mathcal G _ { l } | \mathcal G _ { p } , \mathcal G _ { s } ) ,
60
+ $$
61
+
62
+ where $\mathcal { G } _ { s } , \mathcal { G } _ { r }$ are deterministic given $E , { \mathcal { G } } _ { l }$ , and $\mathcal { G } _ { p }$ .
63
+
64
+ # 3.1 Edit Prediction
65
+
66
+ For a given retrosynthesis pair $R = ( \mathcal G _ { p } , \mathcal G _ { r } )$ , we predict an edit score only for existing bonds and atoms, instead of every atom pair as in [Coley et al., 2019, Jin et al., 2017]. This choice is motivated by the low frequency $( \sim 0 . 1 \% )$ of new bond formations in the training set examples. Coupled with the sparsity of molecular graphs, this reduces the prediction complexity from $O ( N ^ { 2 } )$ to $O ( N )$ for a product with $N$ atoms. Our edit prediction model has variants tailored to single and multiple edit prediction. Since $9 5 \%$ of the training set consists of single edit examples, the remainder of this section describes the setup for single edit prediction. A detailed description of our multiple edit prediction model can be found in Appendix ??.
67
+
68
+ Each bond $( u , v )$ in $\mathcal { G } _ { p }$ is associated with a label $y _ { u v k } \in \{ 0 , 1 \}$ indicating whether its bond type $k$ has changed from the products to reactants. Each atom $u$ is associated with a label $y _ { u } \in \{ 0 , \bar { 1 } \}$ indicating a change in hydrogen count. We predict edit scores using representations that are learnt using a graph encoder.
69
+
70
+ Graph Encoder To obtain atom representations, we use a variant of the message passing network (MPN) described in [Gilmer et al., 2017]. Each atom $u$ has a feature vector $\mathbf { x } _ { u }$ indicating its atom type, degree and other properties. Each bond $( u , v )$ has a feature vector $\mathbf { x } _ { u v }$ indicating its aromaticity, bond type and ring membership. For simplicity, we denote the encoding process by $\mathrm { M P N } ( \cdot )$ and describe architectural details in Appendix ??. The MPN computes atom representations $\{ \mathbf { c } _ { u } | u \in \mathcal { G } \}$ via
71
+
72
+ $$
73
+ \{ \mathbf { c } _ { u } \} = \mathrm { M P N } ( \mathcal { G } , \{ \mathbf { x } _ { u } \} , \{ \mathbf { x } _ { u v } \} _ { v \in \mathcal { N } ( u ) } ) ,
74
+ $$
75
+
76
+ where $\mathcal { N } ( u )$ denotes the neighbors of atom $u$ . The graph representation $\mathbf { c } _ { \mathcal { G } }$ is an aggregation of atom representations, i.e. $\mathbf { c } _ { \mathcal { G } } = \dot { \sum _ { { u } \in \mathcal { V } } } \mathbf { c } _ { u }$ . When $\mathcal { G }$ has connected components $\left\{ { \mathcal { G } } _ { i } \right\}$ , we get a set of graph representations $\left\{ \mathbf { c } _ { \mathcal { G } _ { i } } \right\}$ . For a bond $( u , v )$ , we define its representation $\mathbf { c } _ { u v } = ( \operatorname { A B S } ( \mathbf { c } _ { u } , \mathbf { c } _ { v } ) | | \mathbf { c } _ { u } + \mathbf { c } _ { v } )$ , where ABS denotes absolute difference and $| |$ refers to concatenation. This ensures our representations are permutation invariant. These representations are then used to predict atom and bond edit scores using corresponding neural networks,
77
+
78
+ $$
79
+ \begin{array} { r } { \boldsymbol { s } _ { u } = \mathbf { u _ { a } } ^ { T } \boldsymbol { \tau } ( \mathbf { W _ { a } } \mathbf { c } _ { u } + b ) \quad } \\ { \boldsymbol { s } _ { u v k } = \mathbf { u _ { k } } ^ { T } \boldsymbol { \tau } ( \mathbf { W _ { k } } \mathbf { c } _ { u v } + b _ { k } ) , } \end{array}
80
+ $$
81
+
82
+ where $\tau ( \cdot )$ is the ReLU activation function.
83
+
84
+ Updating Bond Edit Scores Unlike a typical classification problem where the labels are independent, edits can have possible dependencies between each other. For example, bonds part of a stable system such as an aromatic ring have a greater tendency to remain unchanged (label 0). We attempt to leverage such dependencies to update initial edit scores. To this end, we build a graph with bonds $( u , v )$ as nodes, and introduce an edge between bonds sharing an atom. We use another $\mathrm { M P N } ( \cdot )$ on this graph to learn aggregated neighborhood messages $\mathbf { m } _ { u v }$ , and update the edit scores $s _ { u v k }$ in a manner similar to how LSTMs update representations,
85
+
86
+ $$
87
+ \begin{array} { r l } & { f _ { u v k } = \sigma ( \mathbf { W _ { k x } ^ { f } } \mathbf { x } _ { u v } + \mathbf { W _ { k m } ^ { f } } \mathbf { m } _ { u v } ) } \\ & { i _ { u v k } = \sigma ( \mathbf { W _ { k x } ^ { i } } \mathbf { x } _ { u v } + \mathbf { W _ { k m } ^ { i } } \mathbf { m } _ { u v } ) } \\ & { \tilde { m } _ { u v k } = \mathbf { u _ { m } } \tau ( \mathbf { W _ { k x } ^ { m } } \mathbf { x } _ { u v } + \mathbf { W _ { k m } ^ { m } } \mathbf { m } _ { u v } ) } \\ & { \tilde { s } _ { u v k } = f _ { u v k } \cdot s _ { u v k } + i _ { u v k } \cdot \tilde { m } _ { u v k } . } \end{array}
88
+ $$
89
+
90
+ Training We train by minimizing the cross-entropy loss over possible bond and atom edits
91
+
92
+ $$
93
+ \mathcal { L } _ { e } = - \sum _ { ( \mathcal { G } _ { p } , E ) } \left( \sum _ { ( ( u , v ) , k ) \in E } y _ { u v k } \mathrm { l o g } ( \widetilde s _ { u v k } ) + \sum _ { u \in E } y _ { u } \mathrm { l o g } ( s _ { u } ) \right) .
94
+ $$
95
+
96
+ The cross-entropy loss enforces the model to learn a distribution over possible edits instead of reasoning about each edit independently, as with the binary cross entropy loss used in [Jin et al., 2017, Coley et al., 2019].
97
+
98
+ # 3.2 Synthon Completion
99
+
100
+ Synthons are completed into valid reactants by adding specific functionalities called leaving groups. This involves two complementary tasks: (i.) selecting the appropriate leaving group, and (ii.) attaching the leaving group to the synthon. As ground truth leaving groups are not directly provided, we extract the leaving groups and construct a vocabulary $\mathcal { X }$ of unique leaving groups during preprocessing.
101
+
102
+ The vocabulary has a limited size ( $| \mathcal { X } | = 1 7 0$ for a standard dataset with 50, 000 examples, and 72000 synthons) indicating the redundancy of leaving groups used in accomplishing retrosynthetic transformations. This redundancy also allows us to formulate leaving group selection as a classification problem over $\mathcal { X }$ , while retaining the ability to generate diverse reactants using different combinations of leaving groups.
103
+
104
+ Vocabulary Construction Before constructing the vocabulary, we align connected components of synthon and reactant graphs by comparing atom mapping overlaps. Using aligned pairs $\mathcal { G } _ { s _ { c } } =$ $( \gamma _ { s _ { c } } , \mathcal { E } _ { s _ { c } } )$ and $\mathcal { G } _ { r _ { c } } = ( \nu _ { r _ { c } } , \mathcal { E } _ { r _ { c } } )$ as input, the leaving group vocabulary $\mathcal { X }$ is constructed by extracting subgraphs $\mathcal { G } _ { l _ { c } } = ( \nu _ { l _ { c } } , \mathcal { E } _ { l _ { c } } )$ such that $\smash { \gamma _ { l _ { c } } = \gamma _ { r _ { c } } \setminus \gamma _ { s _ { c } } }$ . Atoms $\left\{ { a } _ { i } \right\}$ in the leaving groups that attach to synthons are marked with a special symbol. We also add three tokens to $\mathcal { X }$ namely START, which indicates the start of synthon completion, END, which indicates that there is no leaving group to add and PAD, which is used to handle variable numbers of synthon components in a minibatch.
105
+
106
+ Leaving Group Selection For synthon component $c \leq C$ , where $C$ is the number of connected components in the synthon graph, we use three inputs for leaving group selection – the product representation $\mathbf { c } _ { \mathcal { G } _ { p } }$ , the synthon component representation $\mathbf { c } _ { \mathcal { G } _ { s _ { c } } }$ , and the leaving group representation for the previous synthon component, ${ \bf e } _ { l _ { c - 1 } }$ . The product and synthon representations are learnt using the $\mathrm { M P N } ( \cdot )$ . For each $x _ { i } \in { \mathcal { X } }$ , representations can be learnt by either training independent embedding vectors (ind) or by treating each $x _ { i }$ as a subgraph and using the $\mathrm { M P N } ( \cdot )$ (shared). In the shared setting, we use the same $\mathrm { M P N } ( \cdot )$ as the product and synthons.
107
+
108
+ The leaving group probabilities are then computed by combining $\mathbf { c } _ { \mathcal { G } _ { p } } , \mathbf { c } _ { \mathcal { G } _ { s _ { c } } }$ and $\mathbf { e } _ { l _ { c - 1 } }$ via a single layer neural network and softmax function
109
+
110
+ $$
111
+ \hat { q } _ { l _ { c } } = \mathrm { s o f t m a x } \left( \mathbf { U } \tau \left( \mathbf { W } _ { 1 } \mathbf { c } _ { \mathcal { G } _ { p } } + \mathbf { W } _ { 2 } \mathbf { c } _ { \mathcal { G } _ { s _ { c } } } + \mathbf { W } _ { 3 } \mathbf { e } _ { l _ { \left( c - 1 \right) } } \right) \right) ,
112
+ $$
113
+
114
+ where $\hat { q } _ { l _ { c } }$ is distribution learnt over $\mathcal { X }$ . Using the representation of the previous leaving group ${ \bf e } _ { l _ { c - 1 } }$ allows the model to understand combinations of leaving groups that generate the desired product from the reactants. We also include the product representation $\mathbf { c } _ { \mathcal { G } _ { p } }$ as the synthon graphs are derived from the product graph.
115
+
116
+ Training For step $c$ , given the one hot encoding of the true leaving group $q _ { l _ { c } }$ , we minimize the cross-entropy loss
117
+
118
+ $$
119
+ \mathcal { L } _ { s } = \sum _ { c = 1 } ^ { C } \mathcal { L } ( \hat { q } _ { l _ { c } } , q _ { l _ { c } } ) .
120
+ $$
121
+
122
+ Training utilizes teacher-forcing [Williams and Zipser, 1989] so that the model makes predictions given correct histories. During inference, at every step, we use the representation of leaving group from the previous step with the highest predicted probability.
123
+
124
+ Leaving Group Attachment Attaching leaving groups to synthons is a deterministic process and not learnt during training. The task involves identification of the type of bonds to add between attaching atoms in the leaving group (marked during vocabulary construction), and the atom(s) participating in the edit. These bonds can be inferred by applying the valency constraint, which determines the maximum number of neighbors for each atom. The attachment process does not modify any stereochemistry. Given synthons and leaving groups, the attachment process has a $100 \%$ accuracy. The detailed procedure is described in Appendix ??.
125
+
126
+ # 3.3 Inference
127
+
128
+ Inference is performed using beam search with a log-likelihood scoring function. For a beam width $n$ , we select $n$ edits with highest scores and apply them to the product to obtain $n$ synthons, where each synthon can consist of multiple connected components. The synthons form the nodes for beam search. Each node maintains a cumulative score by aggregating the log-likelihoods of the edit and predicted leaving groups. Leaving group inference starts with a connected component for each synthon, and selects $n$ leaving groups with highest log-likelihoods. From the $n ^ { 2 }$ possibilities, we select $n$ nodes with the highest cumulative scores. This process is repeated until all nodes have a leaving group predicted for each synthon component.
129
+
130
+ # 4 Evaluation
131
+
132
+ Evaluating retrosynthesis models is challenging as multiple sets of reactants can be generated from the same product. To deal with this, previous works [Coley et al., 2017b, Dai et al., 2019] evaluate the ability of the model to recover retrosynthetic strategies recorded in the dataset.
133
+
134
+ Data We use the benchmark dataset USPTO-50k [Schneider et al., 2016] for all our experiments. The dataset contains 50, 000 atom-mapped reactions across 10 reaction classes. We use the same dataset version and splits as provided by [Dai et al., 2019]. The USPTO-50k dataset contains a shortcut in that the product atom with atom-mapping 1 is part of the edit in $\sim 7 5 \%$ of the cases. If the product SMILES is not canonicalized, predictions utilizing operations that depend on the position of the atom or bond will be able to use the shortcut, and overestimate performance. We canonicalize the product SMILES, and reassign atom-mappings to the reactant atoms based on the canonical ordering, which removes the shortcut. Details on the remapping procedure can be found in Appendix ??.
135
+
136
+ Evaluation We use the top- $\mathbf { \nabla } \cdot n$ accuracy $( n = 1 , 3 , 5 , 1 0 )$ ) as our evaluation metric, defined as the fraction of examples where the recorded reactants are suggested by the model with rank $\leq n$ . Following prior work [Coley et al., 2017b, Zheng et al., 2019, Dai et al., 2019], we compute the accuracy by comparing the canonical SMILES of predicted reactants to the ground truth. Atom-mapping is excluded from this comparison, but stereochemistry, which describes the relative orientation of atoms in the molecule, is retained. The evaluation is carried out for two settings, with the reaction class being known or unknown.
137
+
138
+ Table 1: Top- $n$ exact match accuracy. Best values within each section are highlighted in bold.
139
+
140
+ <table><tr><td rowspan="3">Model</td><td colspan="8">Top-n Accuracy (%)</td></tr><tr><td colspan="4">Reaction class known</td><td colspan="4">Reaction class unknown</td></tr><tr><td>1</td><td>3</td><td>5</td><td>10</td><td>1</td><td>3</td><td>5</td><td>10</td></tr><tr><td colspan="9">Template-Based</td></tr><tr><td>RETROSIM [Coley et al.,2017b]</td><td>52.9</td><td>73.8</td><td>81.2</td><td>88.1</td><td>37.3</td><td>54.7</td><td>63.3</td><td>74.1</td></tr><tr><td>NEURALSYM [Segler and Waller,2017]</td><td>55.3</td><td>76.0</td><td>81.4</td><td>85.1</td><td>44.4</td><td>65.3</td><td>72.4</td><td>78.9</td></tr><tr><td>GLN [Dai et ai., 2019]</td><td>64.2</td><td>79.1</td><td>85.2</td><td>90.0</td><td>52.5</td><td>69.0</td><td>75.6</td><td>83.7</td></tr><tr><td>DUALTB [Sun et al.,2021]</td><td>67.7</td><td>84.8</td><td>88.9</td><td>92.0</td><td>55.2</td><td>74.6</td><td>80.5</td><td>86.9</td></tr><tr><td colspan="9">Template-Free</td></tr><tr><td>SCROP [Zheng et al.,2019]</td><td>59.0</td><td>74.8</td><td>78.1</td><td>81.1</td><td>43.7</td><td>60.0</td><td>65.2</td><td>68.7</td></tr><tr><td>LV-TRANSFORMER [Chen et al.,2019]</td><td>-</td><td>-</td><td>-</td><td>-</td><td>40.5</td><td>65.1</td><td>72.8</td><td>79.4</td></tr><tr><td>DUALTF [Sun et al., 2021]</td><td>65.7</td><td>81.9</td><td>84.7</td><td>85.9</td><td>53.6</td><td>70.7</td><td>74.6</td><td>77.0</td></tr><tr><td colspan="9">Semi-Template-Based</td></tr><tr><td>G2Gs [Shi et al.,2020]</td><td>61.0</td><td>81.3</td><td>86.0</td><td>88.7</td><td>48.9</td><td>67.6</td><td>72.5</td><td>75.5</td></tr><tr><td>RETROXPERT [Yan et al.,2020]</td><td>62.1</td><td>75.8</td><td>78.5</td><td>80.9</td><td>50.4</td><td>61.1</td><td>62.3</td><td>63.4</td></tr><tr><td>GRAPHRETRO (ours)</td><td>63.9</td><td>81.5</td><td>85.2</td><td>88.1</td><td>53.7</td><td>68.3</td><td>72.2</td><td>75.5</td></tr></table>
141
+
142
+ Baselines For evaluating overall performance, we compare GRAPHRETRO to nine baselines — four template-based, three template-free, and two semi-template-based methods. These include:
143
+
144
+ Template-Based: RETROSIM Coley et al. [2017b] ranks templates for a given target molecule by computing molecular similarities to precedent reactions. NEURALSYM [Segler and Waller, 2017] trains a model to rank templates given a target molecule. GLN [Dai et al., 2019] models the joint distribution of templates and reactants in a hierarchical fashion using logic variables. DUALTB [Sun et al., 2021] uses an energy-based model formulation for retrosynthesis, with additional parameterizations and loss terms to enforce the duality between forward (reaction prediction) and backward (retrosynthesis prediction). Inference is carried out using reactant candidates obtained by applying an extracted template set to the products.
145
+
146
+ Template-Free: SCROP [Zheng et al., 2019], LV-TRANSFORMER [Chen et al., 2019] and DUALTF [Sun et al., 2021] use the Transformer architecture [Vaswani et al., 2017] to output reactant SMILES given a product SMILES. To improve the validity of their suggestions, SCROP include a second Transformer that functions as a syntax correcter. LV-TRANSFORMER uses a latent variable mixture model to improve diversity of suggestions. DUALTF utilizes additional parameterizations and loss terms to enforce the duality between forward (reaction prediction) and backward (retrosynthesis prediction).
147
+
148
+ Semi-Template-Based: G2GS [Shi et al., 2020] and RETROXPERT [Yan et al., 2020] first identify synthons, and then expand the synthons into reactants by either sequential generation of atoms and bonds (G2Gs), or using the Transformer architecture (RETROXPERT). The training dataset for the Transformer in [Yan et al., 2020] is augmented with incorrectly predicted synthons with the goal of learning a correction mechanism.
149
+
150
+ Results for NEURALSYM are taken from [Dai et al., 2019]. The authors in [Yan et al., 2020] report their performance being affected by the dataset leakage2. Thus, we use the most recent results from their website on the canonicalized dataset. For remaining baselines, we directly use the values reported in their paper. For the synthon completion module, we use the ind configuration given its better empirical performance.
151
+
152
+ # 4.1 Overall Performance
153
+
154
+ Reaction class unknown As shown in Table 1, when the reaction class is unknown, GRAPHRETRO outperforms G2GS by $4 . 8 \%$ and and RETROXPERT by $3 . 3 \%$ in top-1 accuracy. Performance improvements are also seen for larger $n$ , except for $n = 5$ . Barring DUALTB, the top-1 accuracy is also better than other template-free and template-based methods. For larger $n$ , one reason for lower top- $n$ accuracies than most template-based methods is that templates already contain combinations of leaving group patterns. In contrast, our model learns to discover these during training. A second hypothesis to this end is that simply adding log-likelihood scores from edit prediction and synthon completion models may be suboptimal and bias the beam search in the direction of the more dominating term. We leave it to future work to investigate scoring functions that rank the attachment.
155
+
156
+ Reaction class known When the reaction class is known, GRAPHRETRO outperforms G2GS and RETROXPERT by a margin of $3 \%$ and $2 \%$ respectively in top-1 accuracy. GRAPHRETRO also outperforms all the template-free methods in top- $^ n$ accuracy. for GRAPHRETRO are also better than most template-based and template-free methods. When the reaction class is known, RETROSIM and GLN restrict template sets corresponding to the reaction class, thus improving performance. The increased edit prediction performance (Section 4.2) for GRAPHRETRO helps outweigh this factor, achieving comparable or better performance till $n = 5$ .
157
+
158
+ # 4.2 Individual Module Performance
159
+
160
+ To gain more insight into the working of GRAPHRETRO, we evaluate the top- $\boldsymbol { n }$ accuracy $\mathbf { \nabla } _ { n } =$ $1 , 2 , 3 , 5 )$ of edit prediction and synthon completion modules, along with corresponding ablation studies, with results shown in Table 2.
161
+
162
+ Edit Prediction For the edit prediction module, we compare the true edit(s) to top- $\boldsymbol { n }$ edits predicted by the model. We also consider two ablation studies, one where we directly use the initial edit scores without updating them, and the other where we predict edits using atom-pairs instead of existing bonds and atoms. Both design choices lead to improvements in performance, as shown in Table 2. We hypothesize that the larger improvement compared to edit prediction using atom-pairs is due to the easier optimization procedure, with lesser imbalance between labels 1 and 0.
163
+
164
+ Synthon Completion For evaluating the synthon completion module, we first apply the true edits to obtain synthons, and compare the true leaving groups to top- $\mathbf { \nabla } \cdot n$ leaving groups predicted by the model. We test the performance of both the ind and shared configurations. Both configurations perform similarly, and are able to identify $\sim 9 7 \%$ (close to its upper bound of $9 9 . 7 \%$ ) of the true leaving groups in its top-5 choices, when the reaction class is known. The top-1, 3 and 5 accuracies of the synthon completion for unknown reaction classes for G2Gs are $6 1 . 1 \%$ , $8 1 . 5 \%$ and $8 6 . 7 \%$ respectively, while ours are $7 5 . 6 \%$ , $9 2 . 5 \%$ and $9 6 . 1 \%$ , indicating a $10 \%$ performance improvement using a classification formulation over the generative one adopted by G2Gs.
165
+
166
+ Table 2: Performance Study of edit prediction and synthon completion modules
167
+
168
+ <table><tr><td rowspan="3"> Setting</td><td colspan="8">Top-n Accuracy (%)</td></tr><tr><td colspan="4">Reaction class known</td><td colspan="4">Reaction class unknown</td></tr><tr><td>1</td><td>2</td><td>3</td><td>5</td><td>1</td><td>2</td><td>3</td><td>5</td></tr><tr><td>Edit Prediction</td><td>84.6</td><td>92.2</td><td>93.7</td><td>94.5</td><td>70.8</td><td>85.1</td><td>89.5</td><td>92.7</td></tr><tr><td>- without edit score updates</td><td>84.3</td><td>92.1</td><td>93.7</td><td>94.5</td><td>70.1</td><td>84.8</td><td>89.4</td><td>92.6</td></tr><tr><td>- predicting on atom pairs</td><td>81.9</td><td>89.5</td><td>90.9</td><td>92.1</td><td>68.6</td><td>83.2</td><td>88.3</td><td>91.8</td></tr><tr><td>Synthon Completion (ind)</td><td>77.4</td><td>89.5</td><td>94.2</td><td>97.6</td><td>75.6</td><td>87.4</td><td>92.5</td><td>96.1</td></tr><tr><td>Synthon Completion (shared)</td><td>76.9</td><td>89.6</td><td>93.9</td><td>97.4</td><td>74.9</td><td>87.7</td><td>92.9</td><td>96.3</td></tr></table>
169
+
170
+ # 4.3 Example Predictions
171
+
172
+ In Figure 2, we visualize the model predictions and the ground truth for three cases. Figure 2a shows an example where the model identifies both the edits and leaving groups correctly. In Figure 2b, the correct edit is identified but the predicted leaving groups are incorrect. We hypothesize this is due to the fact that in the training set, leaving groups attaching to the carbonyl carbon $\scriptstyle ( \mathbf { C } = \mathbf { O } )$ are small (e.g. -OH, - $\mathrm { - N H _ { 2 } }$ , halides). The true leaving group in this example, however, is large. The model is unable to reason about this and predicts the small leaving group -I. In Figure 2c, the model identifies the edit and consequently the leaving group incorrectly. This highlights a limitation of our model. If the edit is predicted incorrectly, the model cannot suggest the true precursors.
173
+
174
+ # 4.4 Limitations
175
+
176
+ The simplified and interpretable construction of GRAPHRETRO comes with certain limitations. First, the overall performance of the model is limited by the performance of the edit prediction step. If the predicted edit is incorrect, the true reactants cannot be salvaged. This limitation is partly remedied by our model design, that allows for user intervention to correct the edit. Second, our method is reliant on atom-mapping for extracting edits and leaving groups. Extracting edits directly based on substructure matching currently suffer from false positives, and heuristics to correct for these result in correct edits in only ${ \sim } 9 0 \%$ of the cases. Third, our formulation assumes that we have as many synthons as reactants, which is violated in some reactions. We leave it to future work to extend the model to realize a single reactant from multiple synthons, and introduce more chemically meaningful edit correction mechanisms.
177
+
178
+ ![](images/9df65c90e84b75ac55b8dc08692726ee93cf492df4b05d29c79c8c792f98fccd.jpg)
179
+ Figure 2: Example Predictions. The true edit and incorrect edit (if any) are highlighted in green and red respectively. The true and predicted leaving groups are highlighted in blue. a. Correctly predicted example by the model. b. Correctly predicted edit but incorrectly predicted leaving groups. c. Incorrectly predicted edit and leaving group.
180
+
181
+ # 5 Conclusion
182
+
183
+ Previous methods for single-step retrosynthesis either restrict prediction to a template set, are insensitive to molecular graph structure or generate molecules from scratch. We address these shortcomings by introducing a graph-based semi-template-based model inspired by a chemist’s workflow, enhancing the interpretability of retrosynthesis models. Given a target molecule, we first identify synthetic building blocks (synthons) which are then realized into valid reactants, thus avoiding molecule generation from scratch. Our model outperforms previous semi-template-methods by significant margins on the benchmark dataset. Future work aims to extend the model to realize a single reactant from multiple synthons, and introduce more chemically meaningful components to improve the synergy between such tools for retrosynthesis prediction and a practitioner’s expertise.
184
+
185
+ # Acknowledgements
186
+
187
+ This research was supported by the Machine Learning for Pharmaceutical Discovery and Synthesis Consortium at MIT. V.R.S. was also supported by the Zeno Karl Schindler Foundation. C.B. was supported by the Swiss National Science Foundation under the National Center of Competence in Research (NCCR) Catalysis under grant agreement 51NF40 180544. We thank the Leonhard scientific computing cluster at ETH Zürich for providing computational resources.
188
+
189
+ # References
190
+
191
+ B. Chen, T. Shen, T. S. Jaakkola, and R. Barzilay. Learning to Make Generalizable and Diverse Predictions for Retrosynthesis. In Submission, 2019.
192
+ C. W. Coley, R. Barzilay, T. S. Jaakkola, W. H. Green, and K. F. Jensen. Prediction of Organic Reaction Outcomes Using Machine Learning. In ACS Central Science. ACS Publications, 2017a.
193
+ C. W. Coley, L. Rogers, W. H. Green, and K. F. Jensen. Computer-Assisted Retrosynthesis Based on Molecular Similarity. ACS Central Science, 3, 2017b.
194
+ C. W. Coley, W. Jin, L. Rogers, T. F. Jamison, T. S. Jaakkola, W. H. Green, R. Barzilay, and K. F. Jensen. A graph-convolutional neural network model for the prediction of chemical reactivity. Chemical Science, 10, 2019.
195
+ E. Corey and W. T. Wipke. Computer-assisted design of complex organic syntheses. Science, 166 (3902):178–192, 1969.
196
+ E. J. Corey. The Logic of Chemical Synthesis: Multistep Synthesis of Complex Carbogenic Molecules (Nobel Lecture). Angewandte Chemie International Edition, 30, 1991.
197
+ H. Dai, C. Li, C. Coley, B. Dai, and L. Song. Retrosynthesis Prediction with Conditional Graph Logic Network. In Advances in Neural Information Processing Systems (NeurIPS), volume 32, 2019.
198
+ S. Genheden, A. Thakkar, V. Chadimová, J.-L. Reymond, O. Engkvist, and E. Bjerrum. Aizynthfinder: a fast, robust and flexible open-source software for retrosynthetic planning. Journal of cheminformatics, 12(1):1–9, 2020.
199
+ J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural Message Passing for Quantum Chemistry. In International Conference on Machine Learning (ICML), volume 70, 2017.
200
+ M. Hartenfeller, M. Eberle, P. Meier, C. Nieto-Oberhuber, K.-H. Altmann, G. Schneider, E. Jacoby, and S. Renner. A Collection of Robust Organic Synthesis Reactions for In Silico Molecule Design. In Journal of Chemical Information and Modeling, volume 51. ACS Publications, 2011.
201
+ W. Jin, C. Coley, R. Barzilay, and T. Jaakkola. Predicting Organic Reaction Outcomes with WeisfeilerLehman Network. In Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017.
202
+ W. Jin, R. Barzilay, and T. Jaakkola. Junction Tree Variational Autoencoder for Molecular Graph Generation. In International Conference on Machine Learning (ICML), volume 32, 2018.
203
+ W. Jin, R. Barzilay, and T. Jaakkola. Composing Molecules with Multiple Property Constraints. In International Conference on Machine Learning (ICML), 2020.
204
+ J. Law, Z. Zsoldos, A. Simon, D. Reid, Y. Liu, S. Y. Khew, A. P. Johnson, S. Major, R. A. Wade, and H. Y. Ando. Route Designer: A Retrosynthetic Analysis Tool Utilizing Automated Retrosynthetic Rule Generation. Journal of Chemical Information and Modeling, 49, 2009.
205
+ B. Liu, B. Ramsundar, P. Kawthekar, J. Shi, J. Gomes, Q. Luu Nguyen, S. Ho, J. Sloane, P. Wender, and V. Pande. Retrosynthetic Reaction Prediction Using Neural Sequence-to-Sequence Models. In ACS Central Science, volume 3. ACS Publications, 2017.
206
+ N. Schneider, N. Stiefl, and G. A. Landrum. What’s What: The (Nearly) Definitive Guide to Reaction Role Assignment. In Journal of Chemical Information and Modeling, volume 56. ACS Publications, 2016.
207
+ M. H. Segler and M. P. Waller. Neural-Symbolic Machine Learning for Retrosynthesis and Reaction Prediction. Chemistry–A European Journal, 23, 2017.
208
+ C. Shi, M. Xu, H. Guo, M. Zhang, and J. Tang. A graph to graphs framework for retrosynthesis prediction, 2020.
209
+ R. Sun, H. Dai, L. Li, S. Kearnes, and B. Dai. Energy-based view of retrosynthesis, 2021. URL https://openreview.net/forum?id $\equiv$ 0Hj3tFCSjUd.
210
+ S. Szymkuc, E. P. Gajewska, T. Klucznik, K. Molga, P. Dittwald, M. Startek, M. Bajczyk, and ´ B. A. Grzybowski. Computer-assisted synthetic planning: The end of the beginning. Angewandte Chemie International Edition, 55(20):5904–5937, 2016.
211
+ A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is All You Need. In Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017.
212
+ D. Weininger. SMILES, a Chemical Language and Information System. Journal of Chemical Information and Computer Sciences, 28, 1988.
213
+ R. J. Williams and D. Zipser. A Learning Algorithm for Continually Running Fully Recurrent Neural Networks. In Neural Computation, volume 1. MIT Press, 1989.
214
+ C. Yan, Q. Ding, P. Zhao, S. Zheng, J. YANG, Y. Yu, and J. Huang. Retroxpert: Decompose retrosynthesis prediction like a chemist. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 11248–11258. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ 819f46e52c25763a55cc642422644317-Paper.pdf.
215
+ S. Zheng, J. Rao, Z. Zhang, J. Xu, and Y. Yang. Predicting Retrosynthetic Reactions using SelfCorrected Transformer Neural Networks. In Journal of Chemical Information and Modeling. ACS Publications, 2019.
md/train/SyZipzbCb/SyZipzbCb.md ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DISTRIBUTED DISTRIBUTIONAL DETERMINISTIC POLICY GRADIENTS
2
+
3
+ Gabriel Barth-Maron˚, Matthew W. Hoffman˚, David Budden, Will Dabney, Dan Horgan, Dhruva TB, Alistair Muldal, Nicolas Heess, Timothy Lillicrap DeepMind
4
+ London, UK
5
+ {gabrielbm, mwhoffman, budden, wdabney, horgan, dhruvat, alimuldal, heess, countzero}@google.com
6
+
7
+ # ABSTRACT
8
+
9
+ This work adopts the very successful distributional perspective on reinforcement learning and adapts it to the continuous control setting. We combine this within a distributed framework for off-policy learning in order to develop what we call the Distributed Distributional Deep Deterministic Policy Gradient algorithm, D4PG. We also combine this technique with a number of additional, simple improvements such as the use of $N$ -step returns and prioritized experience replay. Experimentally we examine the contribution of each of these individual components, and show how they interact, as well as their combined contributions. Our results show that across a wide variety of simple control tasks, difficult manipulation tasks, and a set of hard obstacle-based locomotion tasks the D4PG algorithm achieves state of the art performance.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The ability to solve complex control tasks with high-dimensional input and action spaces is a key milestone in developing real-world artificial intelligence. The use of reinforcement learning to solve these types of tasks has exploded following the work of the Deep Q Network (DQN) algorithm (Mnih et al., 2015), capable of human-level performance on many Atari games. Similarly, ground breaking achievements have been made in classical games such as Go (Silver et al., 2016). However, these algorithms are restricted to problems with a finite number of discrete actions.
14
+
15
+ In control tasks, commonly seen in the robotics domain, continuous action spaces are the norm. For algorithms such as DQN the policy is only implicitly defined in terms of its value function, with actions selected by maximizing this function. In the continuous control domain this would require either a costly optimization step or discretization of the action space. While discretization is perhaps the most straightforward solution, this can prove a particularly poor approximation in highdimensional settings or those that require finer grained control. Instead, a more principled approach is to parameterize the policy explicitly and directly optimize the long term value of following this policy.
16
+
17
+ In this work we consider a number of modifications to the Deep Deterministic Policy Gradient (DDPG) algorithm (Lillicrap et al., 2015). This algorithm has several properties that make it ideal for the enhancements we consider, which is at its core an off-policy actor-critic method. In particular, the policy gradient used to update the actor network depends only on a learned critic. This means that any improvements to the critic learning procedure will directly improve the quality of the actor updates. In this work we utilize a distributional (Bellemare et al., 2017) version of the critic update which provides a better, more stable learning signal. Such distributions model the randomness due to intrinsic factors, among these is the inherent uncertainty imposed by function approximation in a continuous environment. We will see that using this distributional update directly results in better gradients and hence improves the performance of the learning algorithm.
18
+
19
+ Due to the fact that DDPG is capable of learning off-policy it is also possible to modify the way in which experience is gathered. In this work we utilize this fact to run many actors in parallel, all feeding into a single replay table. This allows us to seamlessly distribute the task of gathering experience, which we implement using the ApeX framework (Horgan et al., 2018). This results in significant savings in terms of wall-clock time for difficult control tasks. We will also introduce a number of small improvements to the DDPG algorithm, and in our experiments will show the individual contributions of each component. Finally, this algorithm, which we call the Distributed Distributional DDPG algorithm (D4PG), obtains state-of-the-art performance across a wide variety of control tasks, including hard manipulation and locomotion tasks.
20
+
21
+ # 1.1 RELATED WORK
22
+
23
+ Historically, estimation of the policy gradient has relied on the likelihood ratio trick (see e.g. Glynn, 1990), more commonly known as REINFORCE (Williams, 1992) in the reinforcement learning community. Modern variants of these so-called “vanilla” policy gradient methods include the work of (Mnih et al., 2016). Alternatively, one can consider second-order or “natural” variants of this objective, a set of techniques that include e.g. the Natural Actor-Critic (Peters & Schaal, 2008) and Trust Region Policy Optimization (TRPO) (Schulman et al., 2015) algorithms. More recently Proximal Policy Optimization (PPO) (Schulman et al., 2017), which can be seen as an approximation of TRPO, has proven very effective in large-scale distributed settings. Often, however, algorithms of this form are restricted to learning on-policy, which can limit both the amount of data-reuse as well as restrict the types of policies that are used for exploration.
24
+
25
+ The Deterministic Policy Gradient (DPG) algorithm (Silver et al., 2014) upon which this work is based starts from a different set of ideas, namely the policy gradient theorem of (Sutton et al., 2000). The deterministic policy gradient theorem builds upon this earlier approach, but replaces the stochastic policy with one that includes no randomness. This approach is particularly important because it had previously been believed that the deterministic policy gradient did not exist in a model-free setting. The form of this gradient is also interesting in that it does not require one to integrate over the action space, and hence may require less samples to learn. DPG was later built upon by Lillicrap et al. (2015) who extended this algorithm and made use of a deep neural network as the function approximator, primarily as a mechanism for extending these results to work with vision-based inputs. Further, this entire endeavor lends itself very readily to an off-policy actorcritic architecture such that the actor’s gradients depend only on derivatives through the learned critic. This means that by improving estimation of the critic one is directly able to improve the actor gradients. Most interestingly, there have also been recent attempts to distribute updates for the DDPG algorithm, (e.g. Popov et al., 2017) and more generally in this work we build on work of (Horgan et al., 2018) for implementing distributed actors.
26
+
27
+ Recently, Bellemare et al. (2017) showed that the distribution over returns, whose expectation is the value function, obeys a distributional Bellman equation. Although the idea of estimating a distribution over returns has been revisited before (Sobel, 1982; Morimura et al., 2010), Bellemare et al. demonstrated that this estimation alone was enough to achieve state-of-the-art results on the Atari 2600 benchmarks. Crucially, this technique achieves these gains by directly improving updates for the critic.
28
+
29
+ # 2 BACKGROUND
30
+
31
+ In this work we consider a standard reinforcement learning setting wherein an agent interacts with an environment in discrete time. At each timestep $t$ the agent makes observations $\bar { \mathbf { x } } _ { t } \in \mathcal { X }$ , takes actions ${ \bf a } _ { t } \in \mathcal A$ , and receives rewards $r ( \mathbf { x } _ { t } , \mathbf { a } _ { t } ) \in \mathbb { R }$ . Although we will in general make no assumptions about the inputs $\mathcal { X }$ , we will assume that the environments considered in this work have real-valued actions $\ b { A } = \mathbb { R } ^ { d }$ .
32
+
33
+ In this standard setup, the agent’s behavior is controlled by a policy $\pi : \mathcal { X } \mathcal { A }$ which maps each observation to an action. The state-action value function, which describes the expected return conditioned on first taking action $\mathbf { a } \in { \mathcal { A } }$ from state $\mathbf { x } \in \mathcal { X }$ and subsequently acting according to $\pi$ , is defined as
34
+
35
+ $$
36
+ \begin{array} { r } { \begin{array} { r } { Q _ { \pi } ( \mathbf { x } , \mathbf { a } ) = \mathbb { E } \Big [ \displaystyle \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( \mathbf { x } _ { t } , \mathbf { a } _ { t } ) \Big ] \quad \mathrm { w h e r e } \quad \mathbf { x } _ { 0 } = \mathbf { x } , \mathbf { a } _ { 0 } = \mathbf { a } , } \\ { \quad \mathbf { x } _ { t } \sim p ( \cdot | \mathbf { x } _ { t - 1 } , \mathbf { a } _ { t - 1 } ) , } \\ { \quad \mathbf { a } _ { t } = \pi ( \mathbf { x } _ { t } ) , } \end{array} } \end{array}
37
+ $$
38
+
39
+ and is commonly used to evaluate the quality of a policy. While it is possible to derive an updated policy directly from $Q _ { \pi }$ , such an approach typically requires maximizing this function with respect to a and is made complicated by the continuous action space. Instead we will consider a parameterized policy $\pi _ { \theta }$ and maximize the expected value of this policy by optimizing $J ( \theta ) \ = \ \mathbb { E } [ Q _ { \pi _ { \theta } } ( \mathbf { x } , \pi _ { \theta } ( \mathbf { \bar { x } } ) ) ]$ . By making use of the deterministic policy gradient theorem (Silver et al., 2014) one can write the gradient of this objective as”
40
+
41
+ $$
42
+ \begin{array} { r } { \nabla _ { \theta } J ( \theta ) \approx \mathbb { E } _ { \rho } \Big [ \nabla _ { \theta } \pi _ { \theta } ( \mathbf { x } ) \nabla _ { \mathbf { a } } Q _ { \pi _ { \theta } } ( \mathbf { x } , \mathbf { a } ) \big | _ { \mathbf { a } = \pi _ { \theta } ( \mathbf { x } ) } \Big ] , } \end{array}
43
+ $$
44
+
45
+ where $\rho$ is the state-visitation distribution associated with some behavior policy. Note that by letting the behavior policy differ from $\pi$ we are able to empirically evaluate this gradient using data gathered off-policy.
46
+
47
+ While the exact gradient given by (2) assumes access to the true value function of the current policy, we can instead approximate this quantity with a parameterized critic $Q _ { w } ( \mathbf { x } , \mathbf { a } )$ . By introducing the Bellman operator
48
+
49
+ $$
50
+ ( \mathcal { T } _ { \pi } Q ) ( \mathbf { x } , \mathbf { a } ) = r ( \mathbf { x } , \mathbf { a } ) + \gamma \mathbb { E } \big [ Q ( \mathbf { x } ^ { \prime } , \pi ( \mathbf { x } ^ { \prime } ) ) \big | \mathbf { x } , \mathbf { a } \big ] ,
51
+ $$
52
+
53
+ whose expectation is taken with respect to the next state $\mathbf { x } ^ { \prime }$ , we can minimize the temporal difference (TD) error, i.e. the difference between the value function before and after applying the Bellman update. Typically the TD error will be evaluated under separate target policy and value networks, i.e. networks with separate parameters $( \theta ^ { \prime } , w ^ { \prime } )$ , in order to stabilize learning. By taking the twonorm of this error we can write the resulting loss as
54
+
55
+ $$
56
+ L ( w ) = \mathbb { E } _ { \rho } \Big [ ( Q _ { w } ( \mathbf { x } , \mathbf { a } ) - ( \mathcal { T } _ { \pi _ { \theta ^ { \prime } } } Q _ { w ^ { \prime } } ) ( \mathbf { x } , \mathbf { a } ) ) ^ { 2 } \Big ] .
57
+ $$
58
+
59
+ In practice we will periodically replace the target networks with copies of the current network weights. Finally, by training a neural network policy using the deterministic policy gradient in (2) and training a deep neural to minimize the TD error in (4) we obtain the Deep Deterministic Policy Gradient (DDPG) algorithm (Lillicrap et al., 2016). Here a sample-based approximation to these gradients is employed by using data gathered in some replay table.
60
+
61
+ # 3 DISTRIBUTED DISTRIBUTIONAL DDPG
62
+
63
+ The approach taken in this work starts from the DDPG algorithm and includes a number of enhancements. These extensions, which we will detail in this section, include a distributional critic update, the use of distributed parallel actors, $N$ -step returns, and prioritization of the experience replay.
64
+
65
+ First, and perhaps most crucially, we consider the inclusion of a distributional critic as introduced in Bellemare et al. (2017). In order to introduce the distributional update we first revisit (1) in terms of the return as a random variable $Z _ { \pi }$ , such that $Q _ { \pi } ( \mathbf { x } , \mathbf { a } ) = \mathbb { E } Z _ { \pi } ( \mathbf { x } , \mathbf { a } )$ . The distributional Bellman operator can be defined as
66
+
67
+ $$
68
+ ( \mathcal { T } _ { \pi } Z ) ( \mathbf { x } , \mathbf { a } ) = r ( \mathbf { x } , \mathbf { a } ) + \gamma \mathbb { E } \big [ Z ( \mathbf { x } ^ { \prime } , \pi ( \mathbf { x } ^ { \prime } ) ) \big | \mathbf { x } , \mathbf { a } \big ] ,
69
+ $$
70
+
71
+ where equality is with respect to the probability law of the random variables; note that this expectation is taken with respect to distribution of $Z$ as well as the transition dynamics.
72
+
73
+ While the definition of this operator looks very similar to the canonical Bellman operator defined in (3), it differs in the types of functions it acts on. The distributional variant takes functions which map from state-action pairs to distributions, and returns a function of the same form. In order to use this function within the context of the actor-critic architecture introduced above, we must parameterize this distribution and define a loss similar to that of Equation 4. We will write the loss as
74
+
75
+ $$
76
+ L ( w ) = \mathbb { E } _ { \rho } \Big [ d ( { \mathcal { T } } _ { \pi _ { \theta ^ { \prime } } } Z _ { w ^ { \prime } } ( \mathbf { x } , \mathbf { a } ) , Z _ { w } ( \mathbf { x } , \mathbf { a } ) ) \Big ]
77
+ $$
78
+
79
+ for some metric $d$ that measures the distance between two distributions. Two components that can have a significant impact on the performance of this algorithm are the specific parameterization used for $\bar { Z } _ { w }$ and the metric $d$ used to measure the distributional TD error. In both cases we will give further details in Appendix A; in the experiments that follow we will use the Categorical distribution detailed in that section.
80
+
81
+ We can complete this distributional policy gradient algorithm by including the action-value distribution inside the actor update from Equation 2. This is done by taking the expectation with respect to the action-value distribution, i.e.
82
+
83
+ $$
84
+ \begin{array} { r l } & { \nabla _ { \boldsymbol { \theta } } J ( \boldsymbol { \theta } ) \approx \mathbb { E } _ { \boldsymbol { \rho } } \Big [ \nabla _ { \boldsymbol { \theta } } \pi _ { \boldsymbol { \theta } } ( \mathbf { x } ) \nabla _ { \mathbf { a } } Q _ { w } ( \mathbf { x } , \mathbf { a } ) \big | _ { \mathbf { a } = \pi _ { \boldsymbol { \theta } } ( \mathbf { x } ) } \Big ] , } \\ & { \qquad = \mathbb { E } _ { \boldsymbol { \rho } } \Big [ \nabla _ { \boldsymbol { \theta } } \pi _ { \boldsymbol { \theta } } ( \mathbf { x } ) \mathbb { E } \big [ \nabla _ { \mathbf { a } } Z _ { w } ( \mathbf { x } , \mathbf { a } ) \big ] \big | _ { \mathbf { a } = \pi _ { \boldsymbol { \theta } } ( \mathbf { x } ) } \Big ] . } \end{array}
85
+ $$
86
+
87
+ # Algorithm 1 D4PG
88
+
89
+ Input: batch size $M$ , trajectory length $N$ , number of actors $K$ , replay size $R$ , exploration constant , initial learning rates $\alpha _ { 0 }$ and $\beta _ { 0 }$
90
+
91
+ 6: Construct the target distributions “ N´1n“0 γnri\`n \` γN Zw1 pxi\`N , πθ1 pxi\`N qq
92
+ 7: Compute the actor and critic updates
93
+
94
+ $$
95
+ \begin{array} { l } { \displaystyle \delta _ { w } = \frac { 1 } { M } \sum _ { i } \nabla _ { w } ( R p _ { i } ) ^ { - 1 } \boldsymbol { d } ( Y _ { i } , Z _ { w } ( \mathbf { x } _ { i } , \mathbf { a } _ { i } ) ) } \\ { \displaystyle \delta _ { \theta } = \frac { 1 } { M } \sum _ { i } \nabla _ { \theta } \pi _ { \theta } ( \mathbf { x } _ { i } ) \left. \mathbb { E } [ \nabla _ { \mathbf { a } } Z _ { w } ( \mathbf { x } _ { i } , \mathbf { a } ) ] \right. _ { \mathbf { a } = \pi _ { \theta } ( \mathbf { x } _ { i } ) } } \\ { \displaystyle \quad \left. \cfrac { \mathrm { ~ \rho ~ } } { \mathrm { ~ \rho ~ } } \right. } \end{array}
96
+ $$
97
+
98
+ : Update network parameters $\theta \gets \theta + \alpha _ { t } \delta _ { \theta }$ , $w \gets w + \beta _ { t } \delta _ { w }$
99
+
100
+ 9: If $t = 0$ mod $t _ { \mathrm { t a r g e t } }$ , update the target networks $( \theta ^ { \prime } , w ^ { \prime } ) ( \theta , w )$
101
+
102
+ 0: If $t = 0$ mod $t _ { \mathrm { a c t o r s } }$ , replicate network weights to the actors
103
+
104
+ 11: end for
105
+ 12: return policy parameters $\theta$
106
+
107
+ # Actor
108
+
109
+ 1: repeat
110
+ 2: Sample action $\mathbf { a } = \pi _ { \boldsymbol { \theta } } ( \mathbf { x } ) + \epsilon \mathcal { N } ( 0 , 1 )$
111
+ 3: Execute action a, observe reward $r$ and state $\mathbf { x } ^ { \prime }$
112
+ 4: Store $( { \bf x } , { \bf a } , r , { \bf x } ^ { \prime } )$ in replay
113
+ 5: until learner finishes
114
+
115
+ As before, this update can be empirically evaluated by replacing the outer expectation with a samplebased approximation.
116
+
117
+ Next, we consider a modification to the DDPG update which utilizes $N$ -step returns when estimating the TD error. This can be seen as replacing the Bellman operator with an $N$ -step variant
118
+
119
+ $$
120
+ ( \mathcal T _ { \pi } ^ { N } Q ) ( { \bf x } _ { 0 } , { \bf a } _ { 0 } ) = r ( { \bf x } _ { 0 } , { \bf a } _ { 0 } ) + \mathbb E \big [ \sum _ { n = 1 } ^ { N - 1 } \gamma ^ { n } r ( { \bf x } _ { n } , { \bf a } _ { n } ) + \gamma ^ { N } Q ( { \bf x } _ { N } , \pi ( { \bf x } _ { N } ) ) \big | { \bf x } _ { 0 } , { \bf a } _ { 0 } \big ]
121
+ $$
122
+
123
+ where the expectation is with respect to the $N$ -step transition dynamics. Although not used by Lillicrap et al. (2016), $N$ -step returns are widely used in the context of many policy gradient algorithms (e.g. Mnih et al., 2016) as well as Q-learning variants (Hessel et al., 2017). This modification can be applied analogously to the distributional Bellman operator in order to make use of it when updating the distributional critic.
124
+
125
+ Finally, we also modify the standard training procedure in order to distribute the process of gathering experience. Note from Equations (2,4) that the actor and critic updates rely entirely on sampling from some state-visitation distribution $\rho$ . We can parallelize this process by using $K$ independent actors, each writing to the same replay table. A learner process can then sample from some replay table of size $R$ and perform the necessary network updates using this data. Additionally sampling can be implemented using non-uniform priorities $p _ { i }$ as in Schaul et al. (2016). Note that this requires the use of importance sampling, implemented by weighting the critic update by a factor of $1 { \bar { / } } R p _ { i }$ . We implement this procedure using the ApeX framework (Horgan et al., 2018) and refer the reader there for more details.
126
+
127
+ Algorithm pseudocode for the D4PG algorithm which includes all the above-mentioned modifications can be found in Algorithm 1. Here the actor and critic parameters are updated using stochastic gradient descent with learning rates, $\alpha _ { t }$ and $\beta _ { t }$ respectively, which are adjusted online using ADAM (Kingma & Ba, 2015). While this pseudocode focuses on the learning process, also shown is pseudocode for actor processes which in parallel fill the replay table with data.
128
+
129
+ ![](images/cad84abe7c40d3060704f8949c7b9a752da8327f6de12c18aba43592d48ab6aa.jpg)
130
+ Figure 1: Architectural variants used for each domain. The left-most set illustrates the actor network and critic torso used for the standard control and manipulation domains. The full critic architecture is completed by feeding the output of the critic torso into a relevant distribution, e.g. the categorical distribution, as defined in Section A. The right half of the figure similarly illustrates the architecture used by the parkour domains.
131
+
132
+ # 4 RESULTS
133
+
134
+ In this section we describe the performance of the D4PG algorithm across a variety of continuous control tasks. To do so, in each environment we run our learning procedure and periodically snapshot the policy in order to test it without exploration noise. We will primarily be interested in the performance as a function of wall clock time, however we will also examine the data efficiency. Most interestingly, from a scientific perspective, we also perform a number of ablations which individually remove components of the D4PG algorithm in order to determine their specific contributions.
135
+
136
+ First, we experiment with and without distributional updates. In this setting we focus on use of a categorical distribution as we found in preliminary experiments that the use of a mixture of Gaussians performed worse and was less stable with respect to hyperparameter values across different tasks; a selection of these runs can be found in Appendix C. Across all tasks—except for one which we will introduce later—we use 51 atoms for the categorical distribution. In what follows we will refer to non-distributional variants of this algorithm as Distributed DDPG (D3PG).
137
+
138
+ Next, we consider prioritized and non-prioritized versions of these algorithm variants. For the nonprioritized variants, transitions are sampled from replay uniformly. For prioritized variants we use the absolute TD-error to sample from replay in the case of D3PG, and for D4PG we use the absolute distributional TD-error as described in Section A. We also vary the trajectory length $N \in \{ 1 , 5 \}$ .
139
+
140
+ In all experiments we use a replay table of size $R = 1 \times 1 0 ^ { 6 }$ and only consider behavior policies which add fixed Gaussian noise $\dot { \epsilon } { \mathcal N } ( 0 , 1 )$ to the current online policy; in all experiments we use a value of $\epsilon = 0 . 3$ . We experimented with correlated noise drawn from an Ornstein-Uhlenbeck process, as suggested by (Lillicrap et al., 2016), however we found this was unnecessary and did not add to performance. For all algorithms we initialize the learning rates for both actor and critic updates to the same value. In the next section we will present a suite of simple control problems for which this value corresponds to $\alpha _ { 0 } = \beta _ { 0 } = 1 \times 1 0 ^ { - 4 }$ ; for the following, harder problems we set this to a smaller value of $\alpha _ { 0 } ^ { \mathrm { { - } } } = \beta _ { 0 } = 5 \times 1 0 ^ { - 5 }$ . Similarly for the control suite we utilize a batch size of $M = 2 5 6$ and for all subsequent problems we will increase this to $M = 5 1 2$ .
141
+
142
+ # 4.1 STANDARD CONTROL SUITE
143
+
144
+ We first consider evaluating performance on a number of simple, physical control tasks by utilizing a suite of benchmark tasks (Tassa et al., 2018) developed in the MuJoCo physics simulator (Todorov et al., 2012). Each task is run for exactly 1000 steps and provides either an immediate dense reward $r _ { t } \in [ 0 , 1 ]$ or sparse reward $r _ { t } \in \{ 0 , 1 \}$ depending on the particular task. For each domain, the inputs presented to the agent consist of reasonably low-dimensional observations, many consisting of physical state, joint angles, etc. These observations range between 6 and 60 dimensions, however note that the difficulty of the task is not immediately associated with its dimensionality. For example the acrobot is one of the lowest dimensional tasks in this suite which, due to its level of controllability, can prove much more difficult to learn than other, higher dimensional tasks. For an illustration of these domains see Figure 9; see Appendix D for more details.
145
+
146
+ ![](images/08ebd135e1f61e73ac160cea282b92bfe75334a0f4699b20be1ed73f0dd625e9.jpg)
147
+ Figure 2: Experimental results across domains in the control suite.
148
+
149
+ For algorithms in these experiments we consider actor and critic architectures of the form given in Figure 1 and for each experiment we use $K = 3 2$ actors. Figure 2 shows the performance of D4PG and its various ablations across the entire suite of control tasks. This set of plots is quite busy, however it serves as a broad set of tasks with which we can obtain a general idea of the algorithms performance. Later experiments on harder domains look more closely at the difference between algorithms. Here we also compare against the canonical (non-distributed) DDPG algorithm as a baseline, shown as a dotted black line. This removes all the enhancements proposed in this paper, and we can see that except on the simplest domain, Cartpole (Swingup), it performs worse than all other methods. This performance disparity worsens as we increase the difficulty of tasks, and hence for further experiments we will drop this line from the plot.
150
+
151
+ Next, across all tasks we see that the best performance is obtained by the full D4PG algorithm (shown in purple and bold). Here we see that the longer unroll length of $N = 5$ is uniformly better (we show these as solid lines), and in particular we sometimes see for both D3PG and D4PG that an unroll length of $N = 1$ (shown as dashed lines) can occasionally result in instability. This is especially apparent in the Cheetah (Walk) and Cartpole (Swingup Sparse) tasks.
152
+
153
+ The next biggest gain is arguably due to the inclusion of the distributional critic update, where it is particularly helpful on the hardest tasks e.g. Humanoid (Run) and Acrobot. The manipulator is also quite difficult among this suite of tasks, and here we see that the inclusion of the distributional update does not help as much as in other tasks, although note that here the D3PG and D4PG variants obtain approximately the same performance. As far as the use of prioritization is concerned, it does not appear to contribute significantly to the performance of D4PG. This is not the case for D3PG, however, which on many tasks is helped significantly by the inclusion of prioritization.
154
+
155
+ ![](images/9ed7390ca0bd378d7d53a8914dc484884e54d52e15b51e221f3ec26d9056fe52.jpg)
156
+ Figure 3: Experimental results for tasks in the manipulation domain.
157
+
158
+ # 4.2 MANIPULATION
159
+
160
+ Next, we consider a set of tasks designed to highlight the ability of the D4PG agent to learn dexterous manipulation. Tasks of this form can prove difficult for many reasons, most notably the higher dimensionality of the control task, intermittent contact dynamics, and potential under-actuation of the manipulator.
161
+
162
+ Here we use a simulated hand model implemented within MuJoCo, consisting of 13 actuators which control 22 degrees of freedom. For these experiments the wrist site is attached to a fixed location in space, about which it is allowed to rotate axially. In particular this allows the hand to pick up objects, rotate into a palm-up position, and manipulate them. We first consider a task in which a cylinder is dropped onto the hand from a random height, and the goal of the task is to catch the falling cylinder. The next task requires the agent to pick up an object from the tabletop and then maneuver it to a target position and orientation. The final task is one wherein a broad cylinder must be rotated inhand in order to match a target orientation. See Appendix E for further details regarding both the model and the tasks. For these tasks we use the same network architectures as in the previous section as well as $K = 6 4$ actors.
163
+
164
+ In Figure 3 we again compare the D4PG algorithm against ablations of its constituent components. Here we split the algorithms between $N = 1$ in the top row and $N = 5$ in the bottom row, and in particular we can see that across all algorithms $N = 5$ is uniformly better. For all tasks, the full D4PG algorithm performs either at the same level or better than other ablations; this is particularly apparent in the $N = 5$ case. Overall the use of priorization never seems to harm D4PG, however it does appear to be of limited additional value. Interestingly this is not necessarily the case with the D3PG variant (i.e. without distributional updates). Here we can see that prioritization sometimes harms the performance of D3PG, and this is very readily seen in the $N = 1$ case where the algorithm can either become unstable, or in the case of the Pickup and Orient task it completely fails to learn.
165
+
166
+ # 4.3 PARKOUR
167
+
168
+ Finally, we consider the parkour domain introduced by (Heess et al., 2017). In this setting the agent controls a simplified robotic walker which is rewarded for forward movement, but is impeded by a number of randomly sampled obstacles; see Figure 4 for a visualization and refer to the earlier work for further details. The first of our experiments considers a two-dimensional walker, i.e. a domain in which the walker is allowed to move horizontally and vertically, but is constrained to a fixed depth position. In this domain the obstacles presented to the agent include gaps in the floor surface, barriers it must jump over, and platforms that it can either run over or underneath. The agent is presented with proprioceptive observations $\mathbf { x } _ { \mathrm { p r o p r i o } } \in \mathbb { R } ^ { 1 9 }$ corresponding to the angles of its limbs and other functions of these quantities. It is also given access to observations $\mathbf { x } _ { \mathrm { t e r r a i n } } \in \mathbb { R } ^ { 1 0 1 }$ which includes features such as a depth map of the upcoming terrain, etc. In order to accommodate these inputs we utilize a network architecture as specified in Figure 1. In particular we make use of a stack of feed-forward layers which process the terrain information to reduce it to a smaller number of hidden units before concatenating with the proporioceptive information for further processing. The actions in this domain take the form of torque controls $\mathbf { a } \in \mathbb { R } ^ { 6 }$ .
169
+
170
+ ![](images/7eb78bca7db3ce270e23c976b1305e4c3d33378edef9e29e2b96058c047028ae.jpg)
171
+ Figure 4: Example frames taken from trained agents running in the two parkour domains.
172
+
173
+ In order to examine the performance of the D4PG algorithm in this setting we consider the ablations of the previous sections and we have further introduced a PPO baseline as utilized in the earlier paper of (Heess et al., 2017). For all algorithms, including PPO, we use $K = 6 4$ actors. These results are shown in Figure 5 in the top row. As before we examine the performance separately for $N = 1$ and $N = 5$ , and again we see that the higher unroll length results in better performance. Note that we show the PPO baseline on both plots for consistency, but in both plots this is the same algorithm, with settings proposed in the earlier paper and unrolls of length 50.
174
+
175
+ Here we again see a clear delineation and clear gains for each of the other algorithm components. The biggest gain comes from the inclusion of the distributional update, which we can see by comparing the non-prioritized D3PG/D4PG variants. We see marginal benefit to using prioritization for D3PG, but this gain disappears when we consider the distributional update. Finally, we can see when comparing to the PPO baseline that this algorithm compares favorably to D3PG in the case of $N = 1$ , however is outperformed by D4PG; when $N = 5$ all algorithms outperform PPO.
176
+
177
+ Next, in the plots shown in Figure 5 on the bottom row we also consider the performance not just in terms of training time, but also in terms of the sample complexity. In order to do so we plot the performance of each algorithm versus the number of actor steps, i.e. the quantity of transitions collected. This is perhaps more favorable to PPO, as the parallel actors considered in this work are not necessarily tuned for sample efficiency. Here we see that PPO is able to out-perform the non-prioritized version of D3PG, and early on in training is favorable compared to the prioritized version, although this trails off. However, we still see significant performance gains by utilizing the distributional updates, both in a prioritized and non-prioritized setting. Interestingly we see that the use of prioritization does not gain much, if any over the non-prioritized D4PG version. Early in the trajectory for $N \ = \ 5$ , in fact, we see that the non-prioritized D4PG exhibits better performance, however later these performance curves level out. With respect to wall-clock time these small differences may be due to small latencies in the scheduling of different runs, as we see that this difference is less for the plot with respect to actor steps.
178
+
179
+ Finally we consider a humanoid walker which is able to move in all three dimensions. The obstacles in this domain consist of gaps in the floor, barriers that must be jumped over, and walls with gaps that allow the agent to run through. For this experiment we utilize the same network architecture as in the previous experiment, except now the observations are of size $\mathbf { x } _ { \mathrm { p r o p r i o } } \in \mathbb { R } ^ { 7 9 }$ and $\mathbf { X } _ { \mathrm { t e r r a i n } } \in \mathbb { R } ^ { 4 6 1 }$ . Again actions are torque controls, but in 21 dimensions. In this task we also increased the number of atoms for the categorical distribution from 51 to 101. This change increases the level of resolution for the distribution in order to keep the resolution roughly consistent with other tasks. This is a much higher dimensional problem than the previous parkour task with a significantly more difficult control task: the walker is more unstable and there are many more ways for the agent to fail than in the previous experiment. The results for this particular domain are displayed in Figure 6, and here we concentrate on performance as a function of wall-clock time, restricted to the previously best performing roll-out length of $N = 5$ . In this setting we see a clear delineation between first the PPO results which are the poorest performing, the D3PG results where the prioritized version has a slight edge, and finally the D4PG results. Interestingly for D4PG we again see as in the twodimensional walker case, the use of prioritization seems to have no benefit, with both versions have almost identical performance curves; in fact the performance here is perhaps even closer than that of the previous set of experiments.
180
+
181
+ ![](images/d04d91404dd0fff45753b756171e9fbf5a79eed30c4d0c0aec9509c3e3d92ef5.jpg)
182
+ Figure 5: Experimental results for the two-dimensional (walker) parkour domain when compared first versus wall-clock time (top) and versus actor steps (bottom).
183
+
184
+ ![](images/63b94a5a33a744bd986ec42c5dac028ce8f4ea2cc594bfe8337f63f49a72c585.jpg)
185
+ Figure 6: Experimental results for the three-dimensional (humanoid) parkour domain.
186
+
187
+ # 5 DISCUSSION
188
+
189
+ In this work we introduced the D4PG, or Distributed Distributional DDPG, algorithm. Our main contributions include the inclusion of a distributional updates to the DDPG algorithm, combined with the use of multiple distributed workers all writing into the same replay table. We also consider a number of other, smaller changes to the algorithm. All of these simple modifications contribute to the overall performance of the D4PG algorithm; the biggest performance gain of these simple changes is arguably the use of $N$ -step returns. Interestingly we found that the use of priority was less crucial to the overall D4PG algorithm especially on harder problems. While the use of prioritization was definitely able to increase the performance of the D3PG algorithm, we found that it can also lead to unstable updates. This was most apparent in the manipulation tasks.
190
+
191
+ Finally, as our results can attest, the D4PG algorithm is capable of state-of-the-art performance on a number of very difficult continuous control problems.
192
+
193
+ # REFERENCES
194
+
195
+ Marc G Bellemare, Will Dabney, and Remi Munos. A distributional perspective on reinforcement ´ learning. In International Conference on Machine Learning, pp. 449–458, 2017.
196
+
197
+ Peter W Glynn. Likelihood ratio gradient estimation for stochastic systems. Communications of the ACM, 33(10):75–84, 1990.
198
+
199
+ Roland Hafner and Martin Riedmiller. Reinforcement learning in feedback control. Machine Learning, 84(1-2):137–169, jul 2011. doi: 10.1007/s10994-011-5235-x.
200
+
201
+ Nicolas Heess, Dhruva TB, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, and David Silver. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
202
+
203
+ Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. arXiv preprint arXiv:1710.02298, 2017.
204
+
205
+ Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado van Hasselt, and David Silver. Distributed prioritized experience replay. International Conference on Learning Representations, 2018.
206
+
207
+ 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 (Applied Physics Laboratory), 30(3):207– 216, 2011.
208
+
209
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
210
+
211
+ Vikash Kumar and Emanuel Todorov. MuJoCo HAPTIX: A virtual reality system for hand manipulation. In IEEE-RAS International Conference on Humanoid Robots, volume 2015-December, pp. 657–663. IEEE, 2015. doi: 10.1109/HUMANOIDS.2015.7363441.
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. arXiv preprint arXiv:1509.02971, 2015.
214
+
215
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. In International Conference on Learning Representations, 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, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
218
+
219
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy P Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, 2016.
220
+
221
+ Tetsuro Morimura, Hirotaka Hachiya, Masashi Sugiyama, Toshiyuki Tanaka, and Hisashi Kashima. Parametric Return Density Estimation for Reinforcement Learning. In Proceedings of the Conference on Uncertainty in Artificial Intelligence (UAI), 2010.
222
+
223
+ Jan Peters and Stefan Schaal. Natural actor-critic. Neurocomputing, 71(7):1180–1190, 2008.
224
+
225
+ Ivaylo Popov, Nicolas Heess, Timothy Lillicrap, Roland Hafner, Gabriel Barth-Maron, Matej Vecerik, Thomas Lampe, Yuval Tassa, Tom Erez, and Martin Riedmiller. Data-efficient deep reinforcement learning for dexterous manipulation. arXiv preprint arXiv:1704.03073, 2017.
226
+
227
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. International Conference on Learning Representations, 2016.
228
+
229
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015.
230
+
231
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
232
+
233
+ David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In International Conference on Machine Learning, 2014.
234
+
235
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
236
+
237
+ Matthew J. Sobel. The variance of discounted markov decision processes. Journal of Applied Probability, 19(04):794–802, 1982.
238
+
239
+ Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in Neural Information Processing Systems, pp. 1057–1063, 2000.
240
+
241
+ Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, Timothy Lillicrap, and Martin Riedmiller. Deepmind control suite, 2018. URL http://arxiv.org/abs/1801.00690.
242
+
243
+ 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.
244
+
245
+ George E Uhlenbeck and Leonard S Ornstein. On the theory of the brownian motion. Physical review, 36(5):823, 1930.
246
+
247
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
248
+
249
+ ![](images/98849cea38df35b1083c9397e9360d4621388c0e1e48c5ba5ff1137a9294a6f4.jpg)
250
+ Figure 7: Output layers corresponding to different distribution parameterizations. From left to right these include the Categorical, Mixture of Gaussians, and finally the standard scalar value function.
251
+
252
+ # A DISTRIBUTIONS AND LOSSES
253
+
254
+ In this section we consider two potential parameterized distributions for D4PG. Parameterized distributions, in this framework, are implemented as a neural network layer mapping the output of the critic torso (see Figure 1) to the parameters of a given distribution (e.g. mean and variance). In what follows we will detail the distributions and their corresponding losses.
255
+
256
+ Categorical Following Bellemare et al. (2017), we first consider the categorical parameterization, a layer whose parameters are the logits $\omega _ { i }$ of a discrete-valued distribution defined over a fixed set of atoms $z _ { i }$ . This distribution has hyperparameters for the number of atoms $\ell$ , and the bounds on the support $( V _ { \mathrm { m i n } } , V _ { \mathrm { m a x } } )$ . Given these, $\begin{array} { r } { \dot { \Delta } = \frac { { { V _ { \mathrm { { m a x } } } } - { V _ { \mathrm { { m i n } } } } } } { { \ell - 1 } } } \end{array}$ corresponds to the distance between atoms, and $z _ { i } = V _ { \operatorname* { m i n } } + i \Delta$ gives the location of each atom. We can then define the action-value distribution as
257
+
258
+ $$
259
+ Z = z _ { i } \quad \mathrm { w . p . } \quad p _ { i } \mathrm { \infty } \exp \{ \omega _ { i } \} .
260
+ $$
261
+
262
+ Observe that this distributional layer simply corresponds to a linear layer from the critic torso to the logits $\omega$ , followed by a softmax activation (see Figure 7, left).
263
+
264
+ However, this distribution is not closed under the Bellman operator defined earlier, due to the fact that adding and scaling these values will no longer lie on the support defined by the atoms. This support is explicitly defined by the $( V _ { \mathrm { m i n } } , V _ { \mathrm { m a x } } )$ hyperparameters. As a result we instead use a projected version of the distributional Bellman operator (Bellemare et al., 2017); see Appendix B for more details. Letting $p ^ { \prime }$ be the probabilities of the projected distributional Bellman operator $\Phi \mathcal { T } _ { \pi }$ applied to some target distribution $Z _ { \mathrm { t a r g e t } }$ , we can write the loss in terms of the cross-entropy
265
+
266
+ $$
267
+ d ( \Phi { \mathcal { T } } _ { \pi } Z _ { \mathrm { t a r g e t } } , Z ) = \sum _ { i = 0 } ^ { \ell - 1 } p _ { i } ^ { \prime } { \frac { \exp \{ \omega _ { i } \} } { \sum _ { j } \exp \{ \omega _ { j } \} } } .
268
+ $$
269
+
270
+ Mixture of Gaussians We can also consider parameterizing the action-value distribution using a mixture of Gaussians; here the random variable $Z$ has density given by
271
+
272
+ $$
273
+ p ( z ) \propto \sum _ { i = 0 } ^ { \ell - 1 } \omega _ { i } \mathcal { N } ( z | \mu _ { i } , \sigma _ { i } ^ { 2 } ) .
274
+ $$
275
+
276
+ Thus, the distribution layer maps, through a linear layer, from the critic torso to the mixture weight $\omega _ { i }$ , mean $\mu _ { i }$ , and variance $\sigma _ { i } ^ { 2 }$ for each mixture component $0 \leqslant i \leqslant \ell - 1$ (see Figure 7, center). We can then specify a loss corresponding to the cross-entropy portion of the KL divergence between two distributions. Given a sample transition $( { \bf x } , { \bf a } , r , { \bf x } ^ { \prime } )$ we can take samples from the target density $z _ { j } \sim p _ { \mathrm { t a r g e t } }$ and approximate the cross-entropy term using
277
+
278
+ $$
279
+ d ( { \mathcal { T } } _ { \pi } Z _ { \mathrm { t a r g e t } } , Z ) \approx \sum _ { j } \log p ( r + \gamma z _ { j } ) .
280
+ $$
281
+
282
+ # B CATEGORICAL PROJECTION OPERATOR
283
+
284
+ The categorical parameterized distribution has finite support. Thus, the result of applying the distributional Bellman equation will generally not coincide with this support. Therefore, some projection
285
+
286
+ ![](images/a94f731f7c5c5e8b7d5572d94a0c96378c6cec861fd576821785439adecadd9e.jpg)
287
+ Figure 8: Results for using a mixture of Gaussians distribution on select control suite tasks. Shown are two learning rates as denoted in the legends as well as Categorical.
288
+
289
+ step is required before minimizing the cross-entropy. The categorical projection of Bellemare et al.ř (2017) is given by $\begin{array} { r } { ( \Phi p ) _ { i } = \sum _ { j = 0 } ^ { \ell - 1 } \bar { h } _ { z _ { i } } ( z _ { j } ) p _ { j } } \end{array}$ , $\forall i$ , where $h$ is a piecewise linear ‘hat’ function,
290
+
291
+ $$
292
+ h _ { z _ { i } } ( z ) = \left\{ \begin{array} { l l } { 1 } & { z \leqslant V _ { \mathrm { m i n } } \mathrm { a n d } i = 0 , } \\ { \frac { z - z _ { i - 1 } } { z _ { i } - z _ { i - 1 } } } & { \mathrm { ~ f o r ~ } z _ { i - 1 } \leqslant z \leqslant z _ { i } , } \\ { \frac { z _ { i + 1 } - z } { z _ { i + 1 } - z _ { i } } } & { \mathrm { ~ f o r ~ } z _ { i } \leqslant z \leqslant z _ { i + 1 } , } \\ { 1 } & { z \geqslant V _ { \mathrm { m a x } } \mathrm { a n d } i = \ell - 1 . } \end{array} \right.
293
+ $$
294
+
295
+ # C MIXTURES OF GAUSSIANS CONTROL SUITE RESULTS
296
+
297
+ In Figure 8 we display results of running D4PG on a selection of control suite tasks using a mixture of Gaussians output distribution for two choices of learning rates. Here the distributional TD loss is minimized using the sample-based KL introduced earlier. While this is definitely a technique that is worth further exploration, we found in initial experiments that this choice of distribution underperformed the Categorical distribution by a fair margin. This lends further credence to the choice of distribution made in (Bellemare et al., 2017).
298
+
299
+ # D CONTROL SUITE DETAILS
300
+
301
+ In this section we provide further details for the control suite domains. In particular see Figure 9 for images of the control suite tasks. The physics state $s$ , action $\mathcal { A }$ , and observation $\mathcal { X }$ dimensionalities for each task are provided in Table 1.
302
+
303
+ # E MANIPULATION DETAILS
304
+
305
+ For the dexterous manipulation tasks we used a simulated model of the Johns Hopkins Modular Prosthetic Limb hand (Johannes et al., 2011) implemented in MuJoCo (Kumar & Todorov, 2015). This anthropomorphic hand has a total of 22 degrees of freedom (19 in the fingers, 3 in the wrist), which are driven by a set of 13 position actuators (PD-controllers). The underactuation of the hand is due to coupling between some of the finger joints. For these experiments the wrist was positioned in a fixed location above a table, such that rotation and flexion about the wrist joints allowed the hand to pick up objects from the table, rotate into a palm-up position, and then manipulate them.
306
+
307
+ We focused on a set of three tasks where the agent must learn to manipulate a cylindrical object (Figure 10). In each of these tasks, the observations contain the positions and velocities of all of the joints in the hand, the current position targets for the actuators in the hand, the position and quaternion of the object being manipulated, and its translational and rotational velocities. The observations given in each task are summarized in Table 2. The agent’s actions are increments applied to the position targets for the actuators.
308
+
309
+ ![](images/80e5fa3b2cbfcdd859c221734df8e61ca5e7ff5eb1e17b3af4945eba95b98417.jpg)
310
+
311
+ Figure 9: Control Suite domains used for benchmarking. Top: acrobot, cartpole, cheetah, finger, fish, hopper. Bottom: humanoid, manipulator, pendulum, reacher, swimmer6, swimmer15, walker.
312
+ Table 1: Domains and tasks in the Control Suite.
313
+
314
+ <table><tr><td>Domain</td><td>Task</td><td>|A</td><td>|S</td><td>x</td></tr><tr><td>acrobot</td><td>swingup swingup_sparse</td><td>1</td><td>4</td><td>6</td></tr><tr><td>cartpole</td><td>swingup swingup_sparse</td><td>1</td><td>4</td><td>5</td></tr><tr><td>cheetah</td><td>walk</td><td>6</td><td>18</td><td>17</td></tr><tr><td>finger</td><td>turn_easy turn_hard</td><td>2</td><td>6</td><td>12</td></tr><tr><td>fish</td><td>upright swim</td><td>5</td><td>27</td><td>24</td></tr><tr><td>hopper</td><td>stand</td><td>4</td><td>14</td><td>15</td></tr><tr><td>humanoid</td><td>stand walk run</td><td>21</td><td>55</td><td>67</td></tr><tr><td>manipulator</td><td>bring_ball</td><td>2</td><td>22</td><td>37</td></tr><tr><td>swimmer</td><td>swimmer6 swimmer15</td><td>5 14</td><td>16 34</td><td>25 61</td></tr></table>
315
+
316
+ Table 2: Observation components given in each of the manipulation tasks, and their corresponding dimensionalities. Here $\mathrm { \ s i n _ { z } }$ , $\mathrm { c o s } _ { \mathrm { z } }$ refers to the sine and cosine of the target frame’s angle of rotation about the $z$ -axis.
317
+
318
+ <table><tr><td rowspan="2" colspan="3"></td><td colspan="3">Task</td></tr><tr><td>Catch</td><td>Pick-up-and-orient</td><td>Rotate-in-hand</td></tr><tr><td rowspan="3">Hand</td><td> joint positions</td><td>22</td><td>√</td><td>√</td><td>√</td></tr><tr><td> joint velocities</td><td>22</td><td>√</td><td>√</td><td>√</td></tr><tr><td> actuator targets</td><td>13</td><td>√</td><td>√</td><td>√</td></tr><tr><td rowspan="3">Object</td><td>position</td><td>3</td><td>√</td><td>√</td><td>√</td></tr><tr><td>quaternion</td><td>4</td><td>√</td><td>√</td><td>&lt;</td></tr><tr><td>velocity</td><td>6</td><td>√</td><td>√</td><td>√</td></tr><tr><td rowspan="3">Target</td><td>position</td><td>3</td><td>1</td><td>√</td><td>1</td></tr><tr><td>quaternion</td><td>4</td><td>1</td><td>√</td><td>1</td></tr><tr><td>sinz, COSz</td><td>2</td><td>1</td><td>1</td><td>√</td></tr><tr><td>Total</td><td></td><td></td><td>70</td><td>77</td><td>72</td></tr></table>
319
+
320
+ ![](images/1fc22329665ff2bb15967cf6a63a440ed1267ae494ff61f9c0a0b4b3ea5e87ee.jpg)
321
+ Figure 10: Sequences of frames illustrating the dexterous manipulation tasks we attempt to solve using D4PG. Top to bottom: ‘catch’, ‘pick-up-and-orient’, ‘rotate-in-hand’. The translucent objects shown in ‘pick-up-and-orient’ and ‘rotate-in-hand’ represent the goal states.
322
+
323
+ In the ‘catch’ task the agent must learn to catch a falling object before it strikes the table below. The position, height, and orientation of the object are randomly initialized at the start of each episode. The reward is given by
324
+
325
+ $$
326
+ r = \psi ( \mathrm { p a l m } _ { \mathrm { h e i g h t } } - \mathrm { o b j } _ { \mathrm { h e i g h t } } ; c , m )
327
+ $$
328
+
329
+ where $\psi ( \epsilon ; c , m )$ is a soft indicator function similar to one described by Hafner & Riedmiller (2011)
330
+
331
+ $$
332
+ \psi ( \epsilon ; c , m ) = \left\{ { \begin{array} { l l } { 1 - \operatorname { t a n h } ( { \frac { w } { m } } \epsilon ) ^ { 2 } } & { { \mathrm { i f ~ } } \epsilon > c , } \\ { 1 } & { { \mathrm { o t h e r w i s e . } } } \end{array} } \right.
333
+ $$
334
+
335
+ Here $w = \operatorname { t a n h } ^ { - 1 } ( { \sqrt { 0 . 9 5 } } )$ , and the tolerance $c$ and margin $m$ parameters are $0 \mathrm { c m }$ and $5 \mathrm { c m }$ respectively. Contact between the object and the table causes the current episode to terminate immediately with no reward, otherwise it will continue until a 500 step limit is reached.
336
+
337
+ In the ‘pick-up-and-orient’ task, the agent must pick up a cylindrical object from the table and maneuver it into a target position and orientation. Both the initial position and orientation of the object, and the position and orientation of the target are randomized between episodes. The reward function consists of two additive components that depend on the distance from the object to the target position, and on the angle between the $z$ -axes of the object and target body frames
338
+
339
+ $$
340
+ r = 0 . 5 \psi ( | | \mathrm { o b j } _ { \mathrm { p o s } } - \mathrm { o b j } _ { \mathrm { p o s } } ^ { \mathrm { t a r g e t } } | | _ { 2 } ; c _ { \mathrm { p o s } } , m _ { \mathrm { p o s } } ) ( 1 + \psi ( \cos ^ { - 1 } ( \mathrm { o b j } _ { \mathrm { z a x i s } } \cdot \mathrm { o b j } _ { \mathrm { z a x i s } } ^ { \mathrm { t a r g e t } } ) ; c _ { \mathrm { o r i } } , m _ { \mathrm { o r i } } ) )
341
+ $$
342
+
343
+ where $c _ { \mathrm { p o s } } { = } 1$ cm, $m _ { \mathrm { p o s } } { = } 5 \mathrm { c m }$ , $c _ { \mathrm { o r i } } { = } 5 ^ { \circ }$ , $m _ { \mathrm { o r i } } { = } 1 0 ^ { \circ }$ . Note that the distance-dependent component of the reward multiplicatively gates the orientation component. This helps to encourage the agent to pick up the object before attempting to orient it to match the target. Each episode has a fixed duration of 500 steps.
344
+
345
+ Finally, in the ‘rotate-in-hand’ task the agent begins with a broad cylinder in its palm, and must rotate it axially in order to match a moving target. This requires dynamically forming and breaking contacts with the object being manipulated. The target angle is initialized uniformly, and then incremented on each time step using temporally correlated noise drawn from an Ornstein-Uhlenbeck process $\scriptstyle \sigma = 0 . 0 2 5 ^ { \circ }$ , $\scriptstyle \theta = 0 . 0 1$ ; Uhlenbeck & Ornstein 1930). The reward consists of two multiplicative components
346
+
347
+ $$
348
+ r = \psi { \bigl ( } \cos ^ { - 1 } ( \mathrm { o b j } _ { \mathrm { y a x i s } } | \times \mathrm { y , ~ o b j } _ { \mathrm { y a x i s } } ^ { \mathrm { t a r g e t } } | \times \mathrm { y } ) { \bigr ) } ; c _ { \mathrm { r o t } } , m _ { \mathrm { r o t } } { \bigr ) } \psi { \bigl ( } \cos ^ { - 1 } ( \mathrm { o b j } _ { \mathrm { z a x i s } } , \mathrm { o b j } _ { \mathrm { z a x i s } } ^ { \mathrm { t a r g e t } } ) ; c _ { \mathrm { o r i } } , m _ { \mathrm { o r i } } { \bigr ) }
349
+ $$
350
+
351
+ where $c _ { \mathrm { r o t } } { = } 5 ^ { \circ }$ , $m _ { \mathrm { r o t } } { = } 4 0 ^ { \circ }$ , $c _ { \mathrm { o r i } } { = } 4 5 ^ { \circ }$ , $m _ { \mathrm { o r i } } { = } 4 5 ^ { \circ }$ , and $| | \mathrm { x y }$ denotes projection onto the global $x y$ plane. The first component provides an incentive to match the axial rotation of the target, and the second component penalizes the agent for allowing the orientation of the cylinder’s long axis to deviate too far from that of the target. The maximum episode duration is 1000 steps, with early termination if the object makes contact with the table.
md/train/Syee1pVtDS/Syee1pVtDS.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/SyfIfnC5Ym/SyfIfnC5Ym.md ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING THE GENERALIZATION OF ADVERSARIAL TRAINING WITH DOMAIN ADAPTATION
2
+
3
+ Chuanbiao Song
4
+ Department of Computer Science
5
+ Huazhong University of Science and Technology
6
+ Wuhan 430074, China
7
+ cbsong@hust.edu.cn
8
+ Kun He∗
9
+ Department of Computer Science
10
+ Huazhong University of Science and Technology
11
+ Wuhan 430074, China
12
+ brooklet60@hust.edu.cn
13
+ Liwei Wang
14
+ Department of Machine Intelligence
15
+ Peking University
16
+ wanglw@pku.edu.cn
17
+ John E. Hopcroft
18
+ Department of Computer Science
19
+ Cornell University
20
+ Ithaca 14850, NY, USA
21
+ jeh@cs.cornell.edu
22
+
23
+ # ABSTRACT
24
+
25
+ By injecting adversarial examples into training data, adversarial training is promising for improving the robustness of deep learning models. However, most existing adversarial training approaches are based on a specific type of adversarial attack. It may not provide sufficiently representative samples from the adversarial domain, leading to a weak generalization ability on adversarial examples from other attacks. Moreover, during the adversarial training, adversarial perturbations on inputs are usually crafted by fast single-step adversaries so as to scale to large datasets. This work is mainly focused on the adversarial training yet efficient FGSM adversary. In this scenario, it is difficult to train a model with great generalization due to the lack of representative adversarial samples, aka the samples are unable to accurately reflect the adversarial domain. To alleviate this problem, we propose a novel Adversarial Training with Domain Adaptation (ATDA) method. Our intuition is to regard the adversarial training on FGSM adversary as a domain adaption task with limited number of target domain samples. The main idea is to learn a representation that is semantically meaningful and domain invariant on the clean domain as well as the adversarial domain. Empirical evaluations on Fashion-MNIST, SVHN, CIFAR-10 and CIFAR-100 demonstrate that ATDA can greatly improve the generalization of adversarial training and the smoothness of the learned models, and outperforms state-of-the-art methods on standard benchmark datasets. To show the transfer ability of our method, we also extend ATDA to the adversarial training on iterative attacks such as PGD-Adversial Training (PAT) and the defense performance is improved considerably.
26
+
27
+ # 1 INTRODUCTION
28
+
29
+ Deep learning techniques have shown impressive performance on image classification and many other computer vision tasks. However, recent works have revealed that deep learning models are often vulnerable to adversarial examples (Szegedy et al., 2014; Goodfellow et al.; Papernot et al., 2016), which are maliciously designed to deceive the target model by generating carefully crafted adversarial perturbations on original clean inputs. Moreover, adversarial examples can transfer across models to mislead other models with a high probability (Papernot et al., 2017; Liu et al., 2017). How to effectively defense against adversarial attacks is crucial for security-critical computer vision systems, such as autonomous driving.
30
+
31
+ As a promising approach, adversarial training defends from adversarial perturbations by training a target classifier with adversarial examples. Researchers have found (Goodfellow et al.; Kurakin et al., 2016b; Madry et al., 2018) that adversarial training could increase the robustness of neural networks. However, adversarial training often obtains adversarial examples by taking a specific attack technique (e.g., FGSM) into consideration, so the defense targeted such attack and the trained model exhibits weak generalization ability on adversarial examples from other adversaries (Kurakin et al., 2016b). Tramer et al. (2018) showed that the robustness of adversarial training can be easily cir- \` cumvented by the attack that combines with random perturbation from other models. Accordingly, for most existing adversarial training methods, there is a risk of overfitting to adversarial examples crafted on the original model with the specific attack.
32
+
33
+ In this paper, we propose a novel adversarial training method that is able to improve the generalization of adversarial training. From the perspective of domain adaptation (DA) (Torralba & Efros, 2011), there is a big domain gap between the distribution of clean examples and the distribution of adversarial examples in the high-level representation space, even though adversarial perturbations are imperceptible to humans. Liao et al. (2018) showed that adversarial perturbations are progressively amplified along the layer hierarchy of neural networks, which maximizes the distance between the original and adversarial subspace representations. In addition, adversarial training simply injects adversarial examples from a specific attack into the training set, but there is still a large sample space for adversarial examples. Accordingly, training with the classification loss on such a training set will probably lead to overfitting on the adversarial examples from the specific attack. Even though Wong & Kolter (2018) showed that adversarial training with iterative noisy attacks has stronger robustness than the adversarial training with single-step attacks, iterative attacks have a large computational cost and there is no theoretical analysis to justify that the adversarial examples sampled in such way could be sufficiently representative for the adversarial domain.
34
+
35
+ Our contributions are focused on how to improve the generalization of adversarial training on the simple yet scalable attacks, such as FGSM (Goodfellow et al.). The key idea of our approach is to formulate the learning procedure as a domain adaptation problem with limited number of target domain samples, where target domain denotes adversarial domain. Specifically, we introduce unsupervised as well as supervised domain adaptation into adversarial training to minimize the gap and increase the similarity between the distributions of clean examples and adversarial examples. In this way, the learned models generalize well on adversarial examples from different $\ell _ { \infty }$ bounded attacks. We evaluate our ATDA method on standard benchmark datasets. Empirical results show that despite a small decay of accuracy on clean data, ATDA significantly improves the generalization ability of adversarial training and has the transfer ability to extend to adversarial training on PGD (Madry et al., 2018).
36
+
37
+ # 2 BACKGROUND AND RELATED WORK
38
+
39
+ In this section, we introduce some notations and provides a brief overview of the current advanced attack methods, as well as the defense methods based on adversarial training.
40
+
41
+ # 2.1 NOTATION
42
+
43
+ Denote the clean data domain and the adversarial data domain by $\mathcal { D }$ and $\mathcal { A }$ respectively, we consider a classifier based on a neural network $f ( \boldsymbol { x } ) : \mathbb { R } ^ { d } \mathbb { R } ^ { k }$ . $f ( x ) { \dot { } }$ outputs the probability distribution for an input $x \in [ 0 , 1 ] ^ { d }$ , and $k$ denotes the number of classes in the classification task. Let $\varphi$ be the mapping at the logits layer (the last neural layer before the final softmax function), so that $f ( x ) = s o f t m a x ( \varphi ( x ) )$ . Let $\epsilon$ be the magnitude of the perturbation. Let $x ^ { a d v }$ be the adversarial image computed by perturbing the original image $x$ . The cost function of image classification is denoted as $J ( x , y )$ . We define the logits as the logits layer representation, and define the logit space as the semantic space of the logits layer representation.
44
+
45
+ We divide attacks into two types: white-box attacks have the complete knowledge of the target model and can fully access the model; black-box attacks have limited knowledge of the target classifier (e.g.,its architecture) but can not access the model weights.
46
+
47
+ # 2.2 ATTACK METHODS
48
+
49
+ We consider four attack methods to generate adversarial examples. For all attacks, the components of adversarial examples are clipped in [0, 1].
50
+
51
+ Fast Gradient Sign Method (FGSM). Goodfellow et al. introduced FGSM to generate adversarial examples by applying perturbations in the direction of the gradient.
52
+
53
+ $$
54
+ \boldsymbol { x } ^ { a d v } = \boldsymbol { x } + \epsilon \cdot \mathrm { s i g n } ( \nabla _ { x } J ( x , \bar { y _ { t r u e } } ) )
55
+ $$
56
+
57
+ As compared with other attack methods, FGSM is a simple, yet fast and efficient adversary. Accordingly, FGSM is particularly amenable to adversarial training.
58
+
59
+ Projected Gradient Descent (PGD). The Projected Gradient Descent (PGD) adversary was introduced by Madry et al. (2018) without random start, which is a stronger iterative variant of FGSM. This method applies FGSM iteratively for $k$ times with a budget $\alpha$ instead of a single step.
60
+
61
+ $$
62
+ x ^ { a d v _ { 0 } } = x
63
+ $$
64
+
65
+ $$
66
+ \begin{array} { c } { { x ^ { a d v _ { t + 1 } } = x ^ { a d v _ { t } } + \alpha \cdot \mathrm { s i g n } ( \nabla _ { x } J ( x ^ { a d v _ { t } } , y _ { t r u e } ) ) } } \\ { { x ^ { a d v _ { t + 1 } } = { \bf c l i p } ( x ^ { a d v _ { t + 1 } } , x ^ { a d v _ { t + 1 } } - \epsilon , x ^ { a d v _ { t + 1 } } + \epsilon ) } } \\ { { x ^ { a d v } = x ^ { a d v _ { k } } } } \end{array}
67
+ $$
68
+
69
+ Here $\mathbf { c l i p } ( \cdot , a , b )$ function forces its input to reside in the range of $[ a , b ]$ . PGD usually yields a higher success rate than FGSM does in the white-box setting but shows weaker capability in the black-box setting.
70
+
71
+ RAND $+$ FGSM $\mathbf { \left( R + F G S M \right) }$ . Tramer et al. (2018) proposed\` $\mathrm { R + F G S M }$ against adversarially trained models by applying a small random perturbation of step size $\alpha$ before applying FGSM.
72
+
73
+ $$
74
+ \begin{array} { c } { x ^ { \prime } = x + \dot { \alpha } \cdot \mathrm { s i g n } ( \mathcal { N } ( \mathbf { 0 } ^ { d } , \mathbf { I } ^ { \dot { d } } ) ) } \\ { x ^ { a d v } = x ^ { \prime } + ( \epsilon - \alpha ) \cdot \mathrm { s i g n } ( \nabla _ { x } J ( x ^ { a d v } , y _ { t r u e } ) ) } \end{array}
75
+ $$
76
+
77
+ Momentum Iterative Method (MIM). MIM (Dong et al., 2018) is a modification of the iterative FGSM and it won the first place of NIPS 2017 Adversarial Attacks Competition. Its basic idea is to utilize the gradients of the previous $t$ steps with a decay factor $\mu$ to update the gradient at step $t + 1$ before applying FGSM with a budget $\alpha$ .
78
+
79
+ $$
80
+ x ^ { a d v _ { 0 } } = x , g _ { 0 } = 0
81
+ $$$$
82
+ \begin{array} { c } { { x ^ { a u v _ { 0 } } = x , g _ { 0 } = 0 } } \\ { { } } \\ { { g _ { t + 1 } = \mu \cdot g _ { t } + \frac { \nabla _ { x } J \left( x ^ { a d v _ { t } } , y _ { t r u e } \right) } { \left\| \nabla _ { x } J \left( x ^ { a d v _ { t } } , y _ { t r u e } \right) \right\| _ { 1 } } } } \\ { { } } \\ { { x ^ { a d v _ { t + 1 } } = x ^ { a d v _ { t } } + \alpha \cdot \mathrm { s i g n } ( g _ { t + 1 } ) } } \\ { { } } \\ { { x ^ { a d v _ { t + 1 } } = \mathbf { c l i p } ( x ^ { a d v _ { t + 1 } } , x ^ { a d v _ { t + 1 } } - \epsilon , x ^ { a d v _ { t + 1 } } + \epsilon ) } } \\ { { x ^ { a d v } = x ^ { a d v _ { k } } } } \end{array}
83
+ $$
84
+
85
+ # 2.3 PROGRESS ON ADVERSARIAL TRAINING
86
+
87
+ An intuitive technique to defend a deep model against adversarial examples is adversarial training, which injects adversarial examples into the training data during the training process. First, Goodfellow et al. proposed to increase the robustness by feeding the model with both original and adversarial examples generated by FGSM and by learning with the modified objective function.
88
+
89
+ $$
90
+ \hat { J } ( x , y _ { t r u e } ) = \alpha J ( x , y _ { t r u e } ) + ( 1 - \alpha ) J ( x + \epsilon \cdot \mathrm { s i g n } ( \nabla _ { x } J ( x , y _ { t r u e } ) ) , y _ { t r u e } )
91
+ $$
92
+
93
+ Kurakin et al. (2016b) scaled the adversarial training to ImageNet (Russakovsky et al., 2015) and showed better results by replacing half the clean example at each batch with the corresponding adversarial examples. Meanwhile, Kurakin et al. (2016b) discovered the label leaking effect and suggested not to use the FGSM defined with respect to the true label $y _ { t r u e }$ . However, their approach has weak robustness to the $\mathrm { R A N D + F G S M }$ adversary. Tramer et al. (2018) proposed an\` ensemble adversarial training to improve robustness on black-box attacks by injecting adversarial examples transferred from a number of fixed pre-trained models into the training data.
94
+
95
+ For adversarial training, another approach is to train only with adversarial examples. Nøkland (2015) proposed a specialization of the method (Goodfellow et al.) that learned only with the objective function of adversarial examples. Madry et al. (2018) demonstrated successful defenses based on adversarial training with the noisy PGD, which randomly initialize an adversarial example within the allowed norm ball before running iterative attack. However, this technique is difficult to scale to large-scale neural networks (Kurakin et al., 2016a) as the iterative attack increases the training time by a factor that is roughly equal to the number of iterative steps. Wong & Kolter (2018) developed a robust training method by linear programming that minimized the loss for the worst case within the perturbation ball around each clean data point. However, their approach achieved high test error on clean data and it is still challenging to scale to deep or wide neural networks.
96
+
97
+ As described above, though adversarial training is promising, it is difficult to select a representative adversary to train on and most existing methods are weak in generalization for various adversaries, as the region of the adversarial examples for each clean data is large and contiguous (Tramer et al., \` 2017; Tabacof & Valle, 2016). Furthermore, generating a representative set of adversarial examples for large-scale datasets is computationally expensive.
98
+
99
+ # 3 ADVERSARIAL TRAINING WITH DOMAIN ADAPTATION
100
+
101
+ In this work, instead of focusing on a better sampling strategy to obtain representative adversarial data from the adversarial domain, we are especially concerned with the problem of how to train with clean data and adversarial examples from the efficient FGSM, so that the adversarially trained model is strong in generalization for different adversaries and has a low computational cost during the training.
102
+
103
+ We propose an Adversarial Training with Domain Adaptation (ATDA) method to defense adversarial attacks and expect the learned models generalize well for various adversarial examples. Our motivation is to treat the adversarial training on FGSM as a domain adaptation task with limited number of target domain samples, where the target domain denotes adversarial domain. We combine standard adversarial training with the domain adaptor, which minimizes the domain gap between clean examples and adversarial examples. In this way, our adversarially trained model is effective on adversarial examples crafted by FGSM but also shows great generalization on other adversaries.
104
+
105
+ # 3.1 DOMAIN ADAPTATION ON LOGIT SPACE
106
+
107
+ # 3.1.1 UNSUPERVISED DOMAIN ADAPTATION
108
+
109
+ Suppose we are given some clean training examples $\{ x _ { i } \}$ $( x _ { i } \in \mathbb { R } ^ { d } )$ with labels $\{ y _ { i } \}$ from the clean data domain $\mathcal { D }$ , and adversarial examples $\left\{ x _ { i } ^ { a d v } \right\} ( x _ { i } ^ { a \setminus v } \in \mathbb { R } ^ { d } )$ from adversarial data domain $\mathcal { A }$ . The adversarial examples are obtained by sampling $( x _ { i } , y _ { t r u e } )$ from , computing small perturbations on $x _ { i }$ to generate adversarial perturbations, and outputting $( x _ { i } ^ { a d v } , y _ { t r u e } )$ .
110
+
111
+ It’s known that there is a huge shift in the distributions of clean data and adversarial data in the high-level representation space. Assume that in the logit space, data from either the clean domain or the adversarial domain follow a multivariate normal distribution, i.e., $\mathcal { D } \sim \mathcal { N } ( \mu _ { \mathcal { D } } , \Sigma _ { \mathcal { D } } ) , \mathcal { A } \sim$ $\mathcal { N } ( \mu _ { \mathcal { A } } , \Sigma _ { \mathcal { A } } )$ . Our goal is to learn the logits representation that minimizes the shift by aligning the covariance matrices and the mean vectors of the clean distribution and the adversarial distribution.
112
+
113
+ To implement the CORrelation ALignment (CORAL), we define a covariance distance between the clean data and the adversarial data as follows.
114
+
115
+ $$
116
+ \mathcal { L } _ { C O R A L } ( \mathcal { D } , \mathcal { A } ) = \frac { 1 } { k ^ { 2 } } \left. C _ { \varphi ( \mathcal { D } ) } - C _ { \varphi ( A ) } \right. _ { \ell _ { 1 } }
117
+ $$
118
+
119
+ where $C _ { \varphi ( \mathcal { D } ) }$ and $C _ { \varphi ( \mathcal { A } ) }$ are the covariance matrices of the clean data and the adversarial data in the logit space respectively, and $\| \cdot \| _ { \ell _ { 1 } }$ denotes the $L _ { 1 }$ norm of a matrix. Note that $\mathcal { L } _ { C O R A L } ( \mathcal { D } , \mathcal { A } )$ is slightly different from the CORAL loss proposed by Sun & Saenko (2016).
120
+
121
+ Similarly, we use the standard distribution distance metric, Maximum Mean Discrepancy (MMD) (Borgwardt et al., 2006), to minimize the distance of the mean vectors of the clean data and the adversarial data.
122
+
123
+ $$
124
+ \mathcal { L } _ { M M D } ( \mathcal { D } , \mathcal { A } ) = \frac { 1 } { k } \left\| \frac { 1 } { | \mathcal { D } | } \sum _ { x \in \mathcal { D } } \varphi ( x ) - \frac { 1 } { | \mathcal { A } | } \sum _ { x ^ { a d v } \in \mathcal { A } } \varphi ( x ^ { a d v } ) \right\| _ { 1 }
125
+ $$
126
+
127
+ The loss function for Unsupervised Domain Adaptation (UDA) can be calculated as follows.
128
+
129
+ $$
130
+ \mathcal { L } _ { U D A } ( \mathcal { D } , A ) = \mathcal { L } _ { C O R A L } ( \mathcal { D } , A ) + \mathcal { L } _ { M M D } ( \mathcal { D } , A )
131
+ $$
132
+
133
+ # 3.1.2 SUPERVISED DOMAIN ADAPTATION
134
+
135
+ Even though the unsupervised domain adaptation achieves perfect confusion alignment, there is no guarantee that samples of the same label from clean domain and adversarial domain would map nearby in the logit space. To effectively utilize the labeled data in the adversarial domain, we introduce a supervised domain adaptation (SDA) by proposing a new loss function, denoted as margin loss, to minimize the intra-class variations and maximize the inter-class variations on samples of different domains. The SDA loss is shown in Eq. (9).
136
+
137
+ $$
138
+ \begin{array} { r l } & { \mathcal { L } _ { S D A } ( \mathcal { D } , \mathcal { A } ) = \mathcal { L } _ { m a r g i n } ( \mathcal { D } , \mathcal { A } ) } \\ & { \quad \quad \quad = \frac { 1 } { ( k - 1 ) ( | \mathcal { D } | + | A | ) } \cdot } \\ & { \quad \quad \quad \displaystyle \sum _ { x \in \mathcal { D } \cup \mathcal { A } \ : c ^ { n } \in C \backslash \{ c _ { y t r u e } \} } s o f t p l u s ( \| \varphi ( x ) - c _ { y _ { t r u e } } \| _ { 1 } - \| \varphi ( x ) - c ^ { n } \| _ { 1 } ) } \end{array}
139
+ $$
140
+
141
+ Here sof tplus denotes a function $l n ( 1 + e x p ( \cdot ) )$ ; $c _ { y _ { t r u e } } \in \mathbb { R } ^ { k }$ denotes the center of $y _ { t r u e }$ class in the logit space; $C = \{ c _ { j } \ | \ j = 1 , 2 , . . . , k \}$ is a set consisting of the logits center for each class, which will be updated as the logits changed. Similar to the center loss (Wen et al., 2016), we update center $c _ { j }$ for each class $j$ :
142
+
143
+ $$
144
+ \Delta c _ { j } ^ { t } = \frac { \sum _ { x \in \mathcal { D } \cup \mathcal { A } } \mathbf { 1 } _ { \mathrm { y _ { t r u e } = j } } \cdot \left( c _ { j } ^ { t } - \varphi ( x ) \right) } { 1 + \sum _ { x \in \mathcal { D } \cup \mathcal { A } } \mathbf { 1 } _ { \mathrm { y _ { t r u e } = j } } }
145
+ $$
146
+
147
+ where $\mathbf { 1 } _ { \mathrm { c o n d i t i o n } } = 1$ if the condition is true, otherwise $\mathbf { 1 } _ { \mathrm { c o n d i t i o n } } = 0$ ; $\alpha$ denotes the learning rate of the centers. During the training process, the logits center for each class can integrate the logits representation from both the clean domain and the adversarial domain.
148
+
149
+ # 3.2 ADVERSARIAL TRAINING
150
+
151
+ For adversarial training, iterative attacks are fairly expensive to compute and single-step attacks are fast to compute. Accordingly, we use a variant of FGSM attack (Kurakin et al., 2016b) that avoids the label leaking effect to generate a new adversarial example $x _ { i } ^ { a d v }$ for each clean example $x _ { i }$ .
152
+
153
+ $$
154
+ \boldsymbol { x } _ { i } ^ { a d v } = \boldsymbol { x } _ { i } + \epsilon \cdot \mathrm { s i g n } ( \nabla _ { \boldsymbol { x } } J ( x _ { i } , y _ { t a r g e t } ) )
155
+ $$
156
+
157
+ where $y _ { t a r g e t }$ denotes the predicted class $\arg \operatorname* { m a x } \{ \varphi ( x _ { i } ) \}$ of the model.
158
+
159
+ However, in this case, the sampled adversarial examples are aggressive but not sufficiently representative due to the fact that the sampled adversarial examples always lie at the boundary of the $\ell _ { \infty }$ ball of radius $\epsilon$ (see Figure 1) and the adversarial examples within the boundary are ignored. For adversarial training, if we train a deep neural network only on the clean data and the adversarial data from the FGSM attack, the adversarially trained model will overfit on these two kinds of data and exhibits weak generalization ability on the adversarial examples sampled from other attacks. From a different perspective, such problem can be viewed as a domain adaptation problem with limited number of labeled target domain samples, as only some special data point can be sampled in the adversarial domain by FGSM adversary.
160
+
161
+ ![](images/6d76daf6b5c79adbc300a71d24eb443091f12ab9d0ce2d8bc271552b22f2d5c1.jpg)
162
+ Figure 1: Illustration of the adversarial sampling by FGSM for $x _ { i } \in \mathbb { R } ^ { 2 }$ . The blue dot (in the center) represents a clean example and the red dots (along the boundary) represent the potential adversarial examples for the clean example.
163
+
164
+ Consequently, it is natural to combine the adversarial training with domain adaptation to improve the generalization ability on adversarial data. We generate new adversarial examples by the variant of FGSM attack shown in Eq. (11), then we use the following loss function to meet the criteria of domain adaptation while training a strong classifier.
165
+
166
+ $$
167
+ \begin{array} { r l } & { \mathcal { L } ( \mathcal { D } , \mathcal { A } ) = \mathcal { L } _ { C } ( \mathcal { D } ) + \mathcal { L } _ { C } ( \mathcal { A } ) + \lambda \cdot \mathcal { L } _ { D A } ( \mathcal { D } , \mathcal { A } ) } \\ & { \quad \quad \quad = \mathcal { L } _ { C } ( \mathcal { D } ) + \mathcal { L } _ { C } ( \mathcal { A } ) + \lambda \cdot ( \mathcal { L } _ { U D A } ( \mathcal { D } , \mathcal { A } ) + \mathcal { L } _ { S D A } ( \mathcal { D } , \mathcal { A } ) ) } \\ & { \quad \quad \quad = \displaystyle \frac { 1 } { m } \sum _ { x \in \mathcal { D } } \mathcal { L } _ { C } ( x | y _ { t r u e } ) + \frac { 1 } { m } \sum _ { x ^ { a d v } \in \mathcal { A } } \mathcal { L } _ { C } ( x ^ { a d v } | y _ { t r u e } ) } \\ & { \quad \quad \quad \quad + \lambda \cdot ( \mathcal { L } _ { C O R A L } ( \mathcal { D } , \mathcal { A } ) + \mathcal { L } _ { M M D } ( \mathcal { D } , \mathcal { A } ) + \mathcal { L } _ { m a r g i n } ( \mathcal { D } , \mathcal { A } ) ) } \end{array}
168
+ $$
169
+
170
+ Here $\lambda$ is the hyper-parameter to balance the regularization term; $m$ is the number of input clean examples; $\mathcal { D }$ indicates the input clean examples $\{ x _ { i } \}$ , and $\mathcal { A }$ the corresponding adversarial examples $\{ x _ { i } ^ { a d \bar { v } } \}$ ; $\mathcal { L } _ { C }$ denotes the classification loss. The training process is summarized in Algorithm 1.
171
+
172
+ Algorithm 1 Adversarial training with domain adaptation on network $f ( \boldsymbol { x } ) : \mathbb { R } ^ { d } \mathbb { R } ^ { k }$ .
173
+ Parameters: Size of the training minibatch is $m$ .
174
+ 1: Randomly initialize network $f ( x )$ and logits centers $\{ c _ { j } \mid j = 1 , 2 , . . . , k \}$ ;
175
+ 2: Number of iterations $t \gets 0$ ;
176
+ 3: repeat
177
+ 4: $t \gets t + 1$ ;
178
+ 5: Read a minibatch of data $\mathcal { D } _ { b } = \{ x _ { 1 } , . . . , x _ { m } \}$ from the training set;
179
+ 6: Use the current state of network $f$ to generate adversarial examples $\mathcal { A } _ { b } = \{ x _ { 1 } ^ { a d v } , . . . , x _ { m } ^ { a d v } \}$ by the FGSM variant that avoids label leaking;
180
+ 7: Extract logits for examples $\mathcal { D } _ { b }$ , $\mathcal { A } _ { b }$ by performing forward-backward propagation from the input layer to the logits layer $\varphi ( x )$ ;
181
+ 8: Update parameters $c _ { j }$ for each class $j$ by $c _ { j } ^ { t + 1 } = c _ { j } ^ { t } - \alpha \cdot \Delta c _ { j } ^ { t }$ ;
182
+ 9: Compute the loss by Eq. (12) and update parameters of network $f$ by back propagation; 10: until the training converges.
183
+
184
+ # 4 EXPERIMENTS
185
+
186
+ In this section, we evaluate our ATDA method on various benchmark datasets to demonstrate the robustness and contrast its performance against other competing methods under different white-box and black-box attacks with bounded $\ell _ { \infty }$ norm. Code for these experiments is available at https: //github.com/JHL-HUST/ATDA.
187
+
188
+ # 4.1 EXPERIMENTAL SETUP
189
+
190
+ Datasets. We consider four popular datasets, namely Fashion-MNIST (Xiao et al., 2017), SVHN (Netzer et al., 2011), CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009). For all experiments, we normalize the pixel values to [0, 1] by dividing 255.
191
+
192
+ Baselines. To evaluate the generalization power on adversarial examples in both the white-box and black-box settings, we report the clean test accuracy, the defense accuracy on FGSM, PGD, $\mathrm { R + F G S M }$ and MIM in the non-targeted way. The common settings for these attacks are shown in Table 5 of the Appendix. We compare our ATDA method with normal training as well as several state-of-the-art adversarial training methods:
193
+
194
+ • Normal Training (NT). Training with cross-entropy loss on the clean training data.
195
+ • Standard Adversarial Training (SAT) (Goodfellow et al.). Training with the cross-entropy on the clean training data and the adversarial examples from the FGSM variant with perturbation $\epsilon$ to avoid label leaking.
196
+ • Ensemble Adversarial Training (EAT) (Tramer et al., 2018). Training with cross-entropy \` on the clean training data and the adversarial examples crafted from the currently trained model and the static pre-trained models by the FGSM variant with the perturbation $\epsilon$ to avoid label leaking.
197
+ • Provably Robust Training (PRT) (Wong & Kolter, 2018). Training with cross-entropy loss on the worst case in the $\ell _ { \infty }$ ball of radius $\epsilon$ around each clean training data point. It could be seen as training with a complicated method of sampling in the $\ell _ { \infty }$ ball of radius $\epsilon$ .
198
+
199
+ Evaluation Setup. For each benchmark dataset, we train a normal model and various adversarial models with perturbation $\epsilon$ on a main model with ConvNet architecture, and evaluate them on various attacks bounded by . Moreover, for Ensemble Adversarial Training (EAT), we use two different models as the static pre-trained models. For black-box attacks, we test trained models on the adversarial examples transferred from a model held out during the training. All experiments are implemented on a single Titan X GPU. For all experiments, we set the hyper-parameter $\lambda$ in Eq. (12) to $1 / 3$ and the hyper-parameter $\alpha$ in Eq. (10) to 0.1. For more details about neural network architectures and training hyper-parameters, see Appendix A. We tune the networks to make sure they work, not to post concentrates on optimizing these settings.
200
+
201
+ # 4.2 COMPARISON OF DEFENSE PERFORMANCE ON ACCURACY
202
+
203
+ We evaluate the defense performance of our ATDA method from the perspective of classification accuracy on various datasets, and compare with the baselines.
204
+
205
+ Evaluation on Fashion-MNIST. The accuracy results on Fashion-MNIST are reported in Table 1a. NT yields the best performance on the clean data, but generalizes poorly on adversarial examples. SAT and EAT overfit on the clean data and the adversarial data from FGSM. PRT achieves lower error against various adversaries, but higher error on the clean data. ATDA achieves stronger robustness against different $\ell _ { \infty }$ bounded adversaries as compared to SAT (adversarial training on FGSM).
206
+
207
+ Evaluation on SVHN. The classification accuracy on SVHN are summarized in Table 1b. PRT seems to degrade the performance on the clean testing data and exhibits weak robustness on various attacks. As compared to SAT, ATDA achieves stronger generalization ability on adversarial examples from various attacks and higher accuracy on the white-box adversaries, at the same time it only loses a negligible performance on clean data.
208
+
209
+ Evaluation on CIFAR-10. Compared with Fashion-MNIST and SVHN, CIFAR-10 is a more difficult dataset for classification. As PRT is challenging and expensive to scale to large neural networks due to its complexity, the results of PRT are not reported. The accuracy results on CIFAR-10 are summarized in Table 1c. ATDA outperforms all the competing methods on most adversaries, despite a slightly lower performance on clean data.
210
+
211
+ Evaluation on CIFAR-100. The CIFAR-100 dataset contains 100 image classes, with 600 images per class. Our goal here is not to achieve state-of-the-art performance on CIFAR-100, but to compare the generalization ability of different training methods on a comparatively large dataset. The results on CIFAR-100 are summarized in Table 1d. Compared to SAT, ATDA achieves better generalization on various adversarial examples and it does not degrade the performance on clean data.
212
+
213
+ In conclusion, the accuracy results provide empirical evidence that ATDA has great generalization ability on different adversaries as compared to SAT and outperforms other competing methods.
214
+
215
+ # 4.3 FURTHER ANALYSIS ON THE DEFENSE PERFORMANCE
216
+
217
+ To further investigate the defence performance of the proposed method, we compute two other metrics: the local loss sensitivity to perturbations and the shift of adversarial data distribution with respect to the clean data distribution.
218
+
219
+ Local Loss Sensitivity. One method to quantify smoothness and generalization to perturbations for models is the local loss sensitivity (Arpit et al., 2017). It is calculated in the clean testing data as follows. The lower the value is, the smoother the loss function is.
220
+
221
+ $$
222
+ \mathcal { S } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \| \nabla _ { \boldsymbol { x } } J ( x _ { i } , y _ { i } ) \| _ { 2 }
223
+ $$
224
+
225
+ The results of the local loss sensitivity for the aforementioned learned models are summarized in Table 2. The results suggest that adversarial training methods do increase the smoothness of the model as compared with the normal training and ATDA performs the best.
226
+
227
+ Distribution Discrepancy. To quantify the dissimilarity of the distributions between the clean data and the adversarial data, we compare our learned logits embeddings with the logits embeddings of the competing methods on Fashion-MNIST. We use t-SNE (Maaten & Hinton, 2008) for the comparison on the training data, testing data and adversarial testing data from the white-box FGSM or PGD. The comparisons are illustrated in Figure 2 and we report the detailed MMD distances across domains in Table 3. Compared with NT, SAT and EAT actually increase the MMD distance across domains of the clean data and the adversarial data. In contrast, PRT and ATDA can learn domain invariance between the clean domain and the adversarial domain. Furthermore, our learned logits representation achieves the best performance on domain invariance.
228
+
229
+ Table 1: The accuracy of defense methods on the testing datasets and the adversarial examples generated by various adversaries.
230
+ (a) On Fashion-MNIST. The magnitude of perturbations is 0.1 in $\ell _ { \infty }$ norm.
231
+
232
+ <table><tr><td></td><td></td><td colspan="4">White-Box Attack (%)</td><td colspan="4">Black-Box Attack (%)</td></tr><tr><td>Defense</td><td>Clean (%)</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td></tr><tr><td>NT</td><td>90.5</td><td>8.3</td><td>0.1</td><td>15.0</td><td>0.1</td><td>52.1</td><td>52.6</td><td>68.2</td><td>44.3</td></tr><tr><td>SAT</td><td>90.9</td><td>88.8</td><td>7.4</td><td>31.2</td><td>9.4</td><td>79.8</td><td>80.1</td><td>81.8</td><td>80.0</td></tr><tr><td>EAT</td><td>90.8</td><td>89.0</td><td>4.3</td><td>31.6</td><td>6.6</td><td>80.8</td><td>81.4</td><td>82.3</td><td>78.8</td></tr><tr><td>PRT</td><td>76.9</td><td>67.4</td><td>66.8</td><td>72.2</td><td>66.7</td><td>75.5</td><td>75.5</td><td>76.4</td><td>75.4</td></tr><tr><td>ATDA</td><td>85.5</td><td>78.2</td><td>68.6</td><td>77.0</td><td>68.8</td><td>83.8</td><td>83.7</td><td>84.5</td><td>83.3</td></tr></table>
233
+
234
+ (b) On SVHN. The magnitude of perturbations is 0.02 in $\ell _ { \infty }$ norm.
235
+
236
+ <table><tr><td rowspan="2">Defense</td><td rowspan="2">Clean (%)</td><td colspan="4">White-Box Attack (%)</td><td colspan="4">Black-Box Attack (%)</td></tr><tr><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td></tr><tr><td>NT</td><td>84.9</td><td>19.6</td><td>3.6</td><td>33.3</td><td>4.6</td><td>64.3</td><td>68.0</td><td>76.5</td><td>64.8</td></tr><tr><td>SAT</td><td>86.6</td><td>52.1</td><td>44.4</td><td>70.4</td><td>46.1</td><td>79.0</td><td>79.7</td><td>83.3</td><td>78.7</td></tr><tr><td>EAT</td><td>88.6</td><td>47.1</td><td>34.4</td><td>67.6</td><td>36.6</td><td>80.4</td><td>81.3</td><td>85.3</td><td>80.2</td></tr><tr><td>PRT</td><td>58.5</td><td>41.7</td><td>41.1</td><td>49.5</td><td>41.2</td><td>53.7</td><td>54.9</td><td>56.1</td><td>54.0</td></tr><tr><td>ATDA</td><td>82.9</td><td>57.2</td><td>53.2</td><td>70.6</td><td>53.9</td><td>75.3</td><td>76.4</td><td>79.5</td><td>75.4</td></tr></table>
237
+
238
+ (c) On CIFAR-10. The magnitude of perturbations is $4 / 2 5 5$ in $\ell _ { \infty }$ norm.
239
+
240
+ <table><tr><td></td><td></td><td colspan="4">White-Box Attack (%)</td><td colspan="4">Black-Box Attack (%)</td></tr><tr><td>Defense</td><td>Clean (%)</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td></tr><tr><td>NT</td><td>86.9</td><td>4.3</td><td>0.5</td><td>19.6</td><td>0.9</td><td>41.3</td><td>23.8</td><td>60.9</td><td>25.8</td></tr><tr><td>SAT</td><td>86.2</td><td>52.4</td><td>49.5</td><td>70.2</td><td>50.5</td><td>80.5</td><td>80.5</td><td>83.5</td><td>80.3</td></tr><tr><td>EAT</td><td>86.0</td><td>46.7</td><td>43.5</td><td>67.5</td><td>44.5</td><td>80.0</td><td>80.1</td><td>83.2</td><td>79.8</td></tr><tr><td>PRT</td><td>-</td><td>1</td><td>-</td><td>1</td><td>-</td><td>-</td><td>1</td><td>-</td><td>1</td></tr><tr><td>ATDA</td><td>84.8</td><td>60.7</td><td>58.1</td><td>73.2</td><td>59.0</td><td>80.7</td><td>80.7</td><td>83.0</td><td>80.6</td></tr></table>
241
+
242
+ (d) On CIFAR-100. The magnitude of perturbations is $4 / 2 5 5$ in $\ell _ { \infty }$ norm.
243
+
244
+ <table><tr><td></td><td></td><td colspan="4">White-Box Attack (%)</td><td colspan="4">Black-Box Attack (%)</td></tr><tr><td>Defense</td><td>Clean (%)</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td></tr><tr><td>NT</td><td>59.0</td><td>0.2</td><td>0.4</td><td>6.1</td><td>0.4</td><td>28.8</td><td>23.8</td><td>41.6</td><td>24.2</td></tr><tr><td>SAT</td><td>58.7</td><td>17.7</td><td>18.0</td><td>34.8</td><td>17.9</td><td>53.2</td><td>53.1</td><td>55.8</td><td>53.0</td></tr><tr><td>EAT</td><td>59.1</td><td>12.5</td><td>13.5</td><td>31.1</td><td>13.2</td><td>52.0</td><td>52.2</td><td>55.7</td><td>51.9</td></tr><tr><td>PRT</td><td>-</td><td>1</td><td>1</td><td>-</td><td>-</td><td>-</td><td>1</td><td>1</td><td>1</td></tr><tr><td>ATDA</td><td>61.6</td><td>29.3</td><td>26.2</td><td>43.0</td><td>27.3</td><td>56.0</td><td>56.0</td><td>58.7</td><td>56.0</td></tr></table>
245
+
246
+ Table 2: The local loss sensitivity analysis for defense methods.
247
+
248
+ <table><tr><td rowspan="2">Dataset</td><td colspan="5">Local loss sensitivity</td></tr><tr><td>NT</td><td>SAT</td><td>EAT</td><td>PRT</td><td>ATDA</td></tr><tr><td>Fashion-MNIST</td><td>5.84</td><td>5.52</td><td>3.24</td><td>0.56</td><td>0.49</td></tr><tr><td>SVHN</td><td>13.48</td><td>2.03</td><td>2.41</td><td>1.79</td><td>1.64</td></tr><tr><td>CIFAR-10</td><td>6.56</td><td>1.61</td><td>2.08</td><td>-</td><td>0.90</td></tr><tr><td>CIFAR-100</td><td>23.16</td><td>7.13</td><td>8.40</td><td>-</td><td>2.67</td></tr></table>
249
+
250
+ # 4.4 ABLATION STUDIES ON ATDA
251
+
252
+ To individually dissect the effectiveness of different components in ATDA (Standard Adversarial Training (SAT), Unsupervised Domain Adaptation (UDA), and Supervised Domain Adaptation (SDA)), we conduct a series of ablation experiments in Figure 3. For each model, we report the average accuracy rates over all white-box attacks and all black-box attacks, respectively. The results illustrate that, by aligning the covariance matrix and mean vector of the clean and adversarial examples, UDA plays a key role in improving the generalization of SAT on various attacks. In general, the aware of margin loss on SDA can also improve the defense quality on standard adversarial training, but the effectiveness is not very stable over all datasets. By combining UDA and SDA together with SAT, our final algorithm ATDA can exhibits stable improvements on the standard adversarial training. In general, the performance of ATDA is slightly better than SAT+UDA.
253
+
254
+ Table 3: The MMD distance across domains in the logit space for defense methods on FashionMNIST. $\mathcal { D }$ denotes the distribution of the clean testing data; $\mathbf { \nabla } A _ { F G S M }$ and $\scriptstyle A _ { P G D }$ denote the distributions of the adversarial testing data generated by the white-box FGSM and PGD, respectively.
255
+
256
+ <table><tr><td rowspan="2">MMD Distance</td><td colspan="5">Defense Method</td></tr><tr><td>NT</td><td>SAT</td><td>EAT</td><td>PRT</td><td>ATDA</td></tr><tr><td>MMD(D,AFGSm)</td><td>2.174</td><td>5.353</td><td>5.120</td><td>0.098</td><td>0.005</td></tr><tr><td>MMD(D,APGD)</td><td>5.287</td><td>2.909</td><td>1.239</td><td>0.101</td><td>0.019</td></tr></table>
257
+
258
+ ![](images/730b9477b91b9877f4826a97e6bb83d64db0372b8edaf244562de95e2a5f7009.jpg)
259
+ Figure 2: t-SNE visualizations for the embeddings of training data, testing data, and adversarial testing data from FGSM and PGD in the logit space for Fashion-MNIST. The first row to the fifth row correspond to NT, SAT, EAT, PRT and ATDA, respectively.
260
+
261
+ ![](images/7c06fc8a62b65c83cecb05b113671b85004a9b0a696f4aba338d1efddbfd0116.jpg)
262
+ Figure 3: Ablation experiments for ATDA to investigate the impact of Standard Adversarial Training (SAT), Unsupervised Domain Adaptation (UDA), and Supervised Domain Adaptation (SDA). We report the average accuracy rates over all white-box attacks and all black-box attacks, respectively.
263
+
264
+ # 4.5 EXTENSION TO PGD-ADVERSARIAL TRAINING
265
+
266
+ ATDA can simply be extended to adversarial training on other adversaries. We now consider to extend the ATDA method to PGD-Adversarial Training (PAT) (Madry et al., 2018): adversarial training on the noisy PGD with perturbation $\epsilon$ . By combining adversarial training on the noisy PGD with domain adaptation, we implement an extension of ATDA for PAT, called PATDA. For the noisy PGD, we set the iterated step $k$ as 10 and the budget $\alpha$ as $\epsilon / 4$ according to Madry et al. (2018).
267
+
268
+ As shown in Table 4, we evaluate the defense performance of PAT and PATDA on various datasets. On Fashion-MNIST, we observe that PATDA fails to increase robustness to most adversaries as compared to PAT. On SVHN, PAT and PATDA fail to converge properly. The results are not surprising, as training with the hard and sufficient adversarial examples (from the noisy PGD) requires the neural networks with more parameters. On CIFAR-10 and CIFAR-100, PATDA achieves stronger robustness to various attacks than PAT. In general, PATDA exhibits stronger robustness to various adversaries as compared to PAT. The results indicate that domain adaptation can be applied flexibly to adversarial training on other adversaries to improve the defense performance.
269
+
270
+ Table 4: The accuracy of PAT and PATDA on the testing datasets and the adversarial examples generated by various adversaries. The magnitude of perturbations in $\ell _ { \infty }$ norm is 0.1 for FashionMNIST, 0.02 for SVHN, and 4/255 for CIFAR-10 and CIFAR-100.
271
+
272
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">Defense</td><td rowspan="2">Clean (%)</td><td colspan="4">White-Box Attack (%)</td><td colspan="4">Black-Box Attack(%)</td></tr><tr><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td><td>FGSM</td><td>PGD</td><td>R+FGSM</td><td>MIM</td></tr><tr><td>Fashion-MNIST</td><td>PAT PATDA</td><td>85.3 83.2</td><td>78.7 77.0</td><td>76.5 75.5</td><td>81.7 79.8</td><td>76.7 75.7</td><td>81.8 84.0</td><td>83.9 81.7</td><td>84.8 82.4</td><td>83.8 81.6</td></tr><tr><td>SVHN</td><td>PAT PATDA</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td><td>19.6 19.6</td></tr><tr><td>CIFAR-10</td><td>PAT PATDA</td><td>83.4 83.4</td><td>55.1 62.2</td><td>53.0 60.2</td><td>70.2 73.4</td><td>53.8 61.0</td><td>79.9 79.9</td><td>80.0 80.1</td><td>81.8 81.7</td><td>79.9 79.9</td></tr><tr><td>CIFAR-100</td><td>PAT PATDA</td><td>55.4 59.4</td><td>26.2 32.5</td><td>24.0 30.9</td><td>38.9 44.9</td><td>24.9 31.5</td><td>52.4 55.3</td><td>52.3 55.2</td><td>54.1 57.4</td><td>52.3 55.1</td></tr></table>
273
+
274
+ # 5 CONCLUSION
275
+
276
+ In this study, we regard the adversarial training as a domain adaptation task with limited number of target labeled data. By combining adversarial training on FGSM adversary with unsupervised and supervised domain adaptation, the generalization ability on adversarial examples from various attacks and the smoothness on the learned models can be highly improved for robust defense. In addition, ATDA can easily be extended to adversarial training on iterative attacks (e.g., PGD) to improve the defense performance. The experimental results on several benchmark datasets suggest that the proposed ATDA and its extension PATDA achieve significantly better generalization results as compared with current competing adversarial training methods.
277
+
278
+ # ACKNOWLEDGMENTS
279
+
280
+ This work is supported by National Natural Science Foundation (61772219).
281
+
282
+ # REFERENCES
283
+
284
+ Devansh Arpit, Stanislaw K. Jastrzebski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S. Kanwal, Tegan Maharaj, Asja Fischer, Aaron C. Courville, Yoshua Bengio, and Simon Lacoste-Julien. A closer look at memorization in deep networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 233–242, 2017.
285
+
286
+ Karsten M Borgwardt, Arthur Gretton, Malte J Rasch, Hans-Peter Kriegel, Bernhard Scholkopf, ¨ and Alex J Smola. Integrating structured biological data by kernel maximum mean discrepancy. Bioinformatics, 22(14):e49–e57, 2006.
287
+
288
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
289
+
290
+ Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
291
+
292
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples (2014). arXiv preprint arXiv:1412.6572.
293
+
294
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
295
+
296
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016a.
297
+
298
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016b.
299
+
300
+ Fangzhou Liao, Ming Liang, Yinpeng Dong, Tianyu Pang, Jun Zhu, and Xiaolin Hu. Defense against adversarial attacks using high-level representation guided denoiser. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1778–1787, 2018.
301
+
302
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In International Conference on Learning Representations(ICLR), 2017.
303
+
304
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
305
+
306
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations(ICLR), 2018.
307
+
308
+ 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.
309
+
310
+ Arild Nøkland. Improving back-propagation by adding an adversarial gradient. arXiv preprint arXiv:1510.04189, 2015.
311
+
312
+ Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387, 2016.
313
+
314
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519, 2017.
315
+
316
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael S. Bernstein, Alexander C. Berg, and Fei-Fei Li. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
317
+
318
+ Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In European Conference on Computer Vision, pp. 443–450, 2016.
319
+ Christian Szegedy, Google Inc, Wojciech Zaremba, Ilya Sutskever, Google Inc, Joan Bruna, Dumitru Erhan, Google Inc, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations(ICLR), 2014.
320
+ Pedro Tabacof and Eduardo Valle. Exploring the space of adversarial images. In 2016 International Joint Conference on Neural Networks (IJCNN), pp. 426–433. IEEE, 2016.
321
+ Antonio Torralba and Alexei A Efros. Unbiased look at dataset bias. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 1521–1528. IEEE, 2011.
322
+ Florian Tramer, Nicolas Papernot, Ian J. Goodfellow, Dan Boneh, and Patrick D. McDaniel. The \` space of transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017.
323
+ Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc- \` Daniel. Ensemble adversarial training: Attacks and defenses. In International Conference on Learning Representations, 2018.
324
+ Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In European Conference on Computer Vision, pp. 499–515, 2016.
325
+ Eric Wong and J. Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018 ¨ , pp. 5283–5292, 2018.
326
+ Yuxin Wu and Kaiming He. Group normalization. arXiv preprint arXiv:1803.08494, 2018.
327
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
328
+
329
+ # A EXPERIMENTAL DETAILS
330
+
331
+ In the appendix, we show all details of the common settings, neural network architectures and training hyper-parameters for the experiments.
332
+
333
+ # A.1 HYPER-PARAMETERS FOR ADVERSARIES.
334
+
335
+ For each dataset, the details about the hyper-parameters of various adversaries are shown in Table 5, where $\epsilon$ denotes the magnitude of adversarial perturbations.
336
+
337
+ Table 5: Common settings of attacks for all experiments
338
+
339
+ <table><tr><td>Attack</td><td>Parameter</td><td>Norm</td></tr><tr><td>FGSM</td><td>N/A</td><td>lo</td></tr><tr><td>PGD</td><td>Iterated step k = 20,α = ∈/10</td><td>l</td></tr><tr><td>R+FGSM</td><td>Random perturbation α = ε/2</td><td>lo</td></tr><tr><td>MIM</td><td>Iterated step k = 10,α= ε/5,μ = 1.0</td><td>l8</td></tr></table>
340
+
341
+ # A.2 NEURAL NETWORK ARCHITECTURES AND TRAINING HYPER-PARAMETERS
342
+
343
+ Fashion-MNIST. In the training phase, we use Adam optimizer with a learning rate of 0.001 and set the batch size to 64. For Fashion-MNIST, the neural network architectures for the main model, the static pre-trained models and the model held out during training are depicted in Table 6. For all adversarial training methods, the magnitude of perturbations is 0.1 in $\ell _ { \infty }$ norm.
344
+
345
+ SVHN. In the training phase, we use Adam optimizer with a learning rate of 0.001 and set the batch size to 32 and use the same architectures as in Fashion-MNIST. For all adversarial training methods, the magnitude of perturbations is 0.02 in $\ell _ { \infty }$ norm.
346
+
347
+ Table 6: Neural network architectures used for the Fashion-MNIST and SVHN datasets. Conv: convolutional layer with Relu, FC: fully connected layer.
348
+
349
+ <table><tr><td>Main model</td><td>Pre-trained modelA</td><td>Pre-trained modelA</td><td>Holdout model</td></tr><tr><td>Conv(16, 4x4)</td><td>Conv(32,5x5)</td><td>Dropout(0.2)</td><td>Conv(64,3x3)</td></tr><tr><td>Conv(32, 4x4)</td><td>Conv(32, 5x5)</td><td>Conv(32,3x3)</td><td>FC(300) + Relu</td></tr><tr><td>FC(100) + Relu</td><td>Dropout(0.1)</td><td>Conv(32, 3x3)</td><td>Dropout(0.5)</td></tr><tr><td>FC(10)</td><td>FC(128) + Relu</td><td>FC(128) + Relu</td><td>FC(300) + Relu</td></tr><tr><td></td><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td></tr><tr><td></td><td>FC(10)</td><td>FC(10)</td><td>FC(10)</td></tr></table>
350
+
351
+ CIFAR-10. In the training phase, we use the same training settings as in SVHN. we use Adam optimizer with a learning rate of 0.001 and set the batch size to 32. In order to enhance the expressive power of deep neural networks, we use Exponential Linear Unit (ELU) (Clevert et al., 2015) as the activation function and introduce Group Normalization (Wu & He, 2018) into the architectures. The neural network architectures for CIFAR-10 are shown in Table 7. For all adversarial training methods, the magnitude of perturbations is $4 / 2 5 5$ in $\ell _ { \infty }$ norm.
352
+
353
+ CIFAR-100. We use the same training settings as in CIFAR-10. For CIFAR-100, the neural network architectures for the main model, the static pre-trained models and the model held out during training are shown in Table 8. For all adversarial training methods, the magnitude of perturbations is $4 / 2 5 5$ in $\ell _ { \infty }$ norm.
354
+
355
+ Table 7: Neural network architectures used for the CIFAR-10 dataset. Conv: convolutional layer with Group Normalization and ELU; GAP: global average pooling.
356
+
357
+ <table><tr><td>Main model</td><td>Pre-trained modelA</td><td>Pre-trained modelb</td><td>Holdout model</td></tr><tr><td>Conv(96, 3x3)</td><td>Conv(96, 5x5)</td><td>Conv(192, 5x5)</td><td>Conv(96, 3x3)</td></tr><tr><td>Conv(96,3x3)</td><td>Conv(96, 1x1)</td><td>Conv(96,1x1)</td><td>Dropout(0.2)</td></tr><tr><td>Conv(96, 3x3)</td><td>MaxPooling(3x3,2)</td><td>MaxPooling(3x3,2)</td><td>Conv(96,3x3) x 2</td></tr><tr><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td></tr><tr><td>Conv(192,3x3) x 3</td><td>Conv(192, 5x5)</td><td>Conv(192, 5x5)</td><td>Conv(192,3x3) x 2</td></tr><tr><td>Dropout(0.5)</td><td>Conv(192,1x1)</td><td>Conv(192,1x1)</td><td>Dropout(0.5)</td></tr><tr><td>Conv(192, 3x3)</td><td>MaxPooling(3x3,2)</td><td>MaxPooling(3x3,2)</td><td>Conv(256, 3x3)</td></tr><tr><td>Conv(192, 1x1)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Conv(256, 1x1)</td></tr><tr><td>Conv(10,1x1)</td><td>Conv(256,3x3)</td><td>Conv(256,3x3)</td><td></td></tr><tr><td>GAP</td><td></td><td></td><td>Conv(10, 1x1)</td></tr><tr><td></td><td>Conv(256, 1x1)</td><td>Conv(256, 1x1)</td><td>GAP</td></tr><tr><td></td><td>Conv(10, 1x1)</td><td>Conv(10, 1x1)</td><td></td></tr><tr><td></td><td>GAP</td><td>GAP</td><td></td></tr></table>
358
+
359
+ Table 8: Neural network architectures used for the CIFAR-100 dataset. Conv: convolutional layer with Group Normalization and ELU; GAP: global average pooling.
360
+
361
+ <table><tr><td>Main model</td><td>Pre-trained modelA</td><td>Pre-trained modelB</td><td>Holdout model</td></tr><tr><td>Conv(96, 3x3)</td><td>Conv(96, 5x5)</td><td>Conv(192, 5x5)</td><td>Conv(96,3x3)</td></tr><tr><td>Conv(96, 3x3)</td><td>Conv(96,1x1)</td><td>Conv(96, 1x1)</td><td>Dropout(0.2)</td></tr><tr><td>Conv(96, 3x3)</td><td>MaxPooling(3x3,2)</td><td>MaxPooling(3x3,2)</td><td>Conv(96,3x3) x 2</td></tr><tr><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td></tr><tr><td>Conv(192,3x3) x 3</td><td>Conv(192, 5x5)</td><td>Conv(192, 5x5)</td><td>Conv(192,3x3) x 2</td></tr><tr><td>Dropout(0.5)</td><td>Conv(192,1x1)</td><td>Conv(192, 1x1)</td><td>Dropout(0.5)</td></tr><tr><td>Conv(192,3x3)</td><td>MaxPooling(3x3,2)</td><td>MaxPooling(3x3,2)</td><td>Conv(256, 3x3)</td></tr><tr><td>Conv(192, 1x1)</td><td>Dropout(0.5)</td><td>Dropout(0.5)</td><td>Conv(256,1x1)</td></tr><tr><td>Conv(100, 1x1)</td><td>Conv(256,3x3)</td><td>Conv(256,3x3)</td><td>Conv(100, 1x1)</td></tr><tr><td>GAP</td><td>Conv(256,1x1)</td><td>Conv(256,1x1)</td><td>GAP</td></tr><tr><td></td><td>Conv(100,1x1)</td><td>Conv(100, 1x1)</td><td></td></tr><tr><td></td><td>GAP</td><td>GAP</td><td></td></tr></table>
md/train/VzuIzbRDrum/VzuIzbRDrum.md ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CSDI: Conditional Score-based Diffusion Models for Probabilistic Time Series Imputation
2
+
3
+ Yusuke Tashiro123\*, Jiaming $\mathbf { S o n g ^ { 1 } }$ , Yang $\mathbf { S o n g ^ { 1 } }$ , Stefano Ermon1
4
+
5
+ 1Department of Computer Science, Stanford University, Stanford, CA, USA 2Mitsubishi UFJ Trust Investment Technology Institute, Tokyo, Japan 3Japan Digital Design, Tokyo, Japan {ytashiro,tsong,songyang,ermon}@cs.stanford.edu
6
+
7
+ # Abstract
8
+
9
+ The imputation of missing values in time series has many applications in healthcare and finance. While autoregressive models are natural candidates for time series imputation, score-based diffusion models have recently outperformed existing counterparts including autoregressive models in many tasks such as image generation and audio synthesis, and would be promising for time series imputation. In this paper, we propose Conditional Score-based Diffusion models for Imputation (CSDI), a novel time series imputation method that utilizes score-based diffusion models conditioned on observed data. Unlike existing score-based approaches, the conditional diffusion model is explicitly trained for imputation and can exploit correlations between observed values. On healthcare and environmental data, CSDI improves by $40 \%$ over existing probabilistic imputation methods on popular performance metrics. In addition, deterministic imputation by CSDI reduces the error by $5 . 2 0 \%$ compared to the state-of-the-art deterministic imputation methods. Furthermore, CSDI can also be applied to time series interpolation and probabilistic forecasting, and is competitive with existing baselines. The code is available at https://github.com/ermongroup/CSDI.
10
+
11
+ # 1 Introduction
12
+
13
+ Multivariate time series are abundant in real world applications such as finance, meteorology and healthcare. These time series data often contain missing values due to various reasons, including device failures and human errors [1, 2, 3]. Since missing values can hamper the interpretation of a time series, many studies have addressed the task of imputing missing values using machine learning techniques [4, 5, 6]. In the past few years, imputation methods based on deep neural networks have shown great success for both deterministic imputation [7, 8, 9] and probabilistic imputation [10]. These imputation methods typically utilize autoregressive models to deal with time series.
14
+
15
+ Score-based diffusion models – a class of deep generative models and generate samples by gradually converting noise into a plausible data sample through denoising – have recently achieved state-ofthe-art sample quality in many tasks such as image generation [11, 12] and audio synthesis [13, 14], outperforming counterparts including autoregressive models. Diffusion models can also be used to impute missing values by approximating the scores of the posterior distribution obtained from the prior by conditioning on the observed values [12, 15, 16]. While these approximations may work well in practice, they do not correspond to the exact conditional distribution.
16
+
17
+ In this paper, we propose CSDI, a novel probabilistic imputation method that directly learns the conditional distribution with conditional score-based diffusion models. Unlike existing score-based approaches, the conditional diffusion model is designed for imputation and can exploit useful information in observed values. We illustrate the procedure of time series imputation with CSDI in
18
+
19
+ ![](images/bbb84b188cfff95d08bdbe5640c15f0c108368c3767bf881aac104206ab4357c.jpg)
20
+ Figure 1: The procedure of time series imputation with CSDI. The reverse process $p _ { \theta }$ gradually converts random noise into plausible time series, conditioned on observed values $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ . Dashed lines in each box represent observed values, which are plotted in order to show the relationship with generated imputation and not included in each ${ \bf x } _ { t } ^ { \mathrm { t a } }$ .
21
+
22
+ Figure 1. We start imputation from random noise on the left of the figure and gradually convert the noise into plausible time series through the reverse process $p _ { \theta }$ of the conditional diffusion model. At each step $t$ , the reverse process removes noise from the output of the previous step $( t + 1 )$ . Unlike existing score-based diffusion models, the reverse process can take observations (on the top left of the figure) as a conditional input, allowing the model to exploit information in the observations for denoising. We utilize an attention mechanism to capture the temporal and feature dependencies of time series.
23
+
24
+ For training the conditional diffusion model, we need observed values (i.e., conditional information) and ground-truth missing values (i.e., imputation targets). However, in practice we do not know the ground-truth missing values, or training data may not contain missing values at all. Then, inspired by masked language modeling, we develop a self-supervised training method that separates observed values into conditional information and imputation targets. We note that CSDI is formulated for general imputation tasks, and is not restricted to time series imputation.
25
+
26
+ Our main contributions are as follows:
27
+
28
+ • We propose conditional score-based diffusion models for probabilistic imputation (CSDI), and implement CSDI for time series imputation. To train the conditional diffusion model, we develop a self-supervised training method. • We empirically show that CSDI improves the continuous ranked probability score (CRPS) by $40 \%$ over existing probabilistic methods on healthcare and environmental data. Moreover, deterministic imputation with CSDI decreases the mean absolute error (MAE) by $5 - 2 0 \%$ compared to the state-of-the-art methods developed for deterministic imputation. • We demonstrate that CSDI can also be applied to time series interpolations and probabilistic forecasting, and is competitive with existing baselines designed for these tasks.
29
+
30
+ # 2 Related works
31
+
32
+ Time series imputations with deep learning Previous studies have shown deep learning models can capture the temporal dependency of time series and give more accurate imputation than statistical methods. A popular approach using deep learning is to use RNNs, including LSTMs and GRUs, for sequence modeling [17, 8, 7]. Subsequent studies combined RNNs with other methods to improve imputation performance, such as GANs [9, 18, 19] and self-training [20]. Among them, the combination of RNNs with attention mechanisms is particularly successful for imputation and interpolation of time series [21, 22]. While these methods focused on deterministic imputation, GP-VAE [10] has been recently developed as a probabilistic imputation method.
33
+
34
+ Score-based generative models Score-based generative models, including score matching with Langevin dynamics [23] and denoising diffusion probabilistic models [11], have outperformed existing methods with other deep generative models in many domains, such as images [23, 11], audio [13, 14], and graphs [24]. Most recently, TimeGrad [25] utilized diffusion probabilistic models for probabilistic time series forecasting. While the method has shown state-of-the-art performance, it cannot be applied to time series imputation due to the use of RNNs to handle past time series.
35
+
36
+ # 3 Background
37
+
38
+ # 3.1 Multivariate time series imputation
39
+
40
+ We consider $N$ multivariate time series with missing values. Let us denote the values of each time series as $\mathbf { X } = \{ x _ { 1 : K , 1 : L } \} \in \mathbb { R } ^ { K \times L }$ where $K$ is the number of features and $L$ is the length of time series. While the length $L$ can be different for each time series, we treat the length of all time series as the same for simplicity, unless otherwise stated. We also denote an observation mask as $\mathbf { M } = \{ m _ { 1 : K , 1 : L } \} \in \{ 0 , 1 \} ^ { \bar { K } \times L }$ where $m _ { k , l } = 0$ if $x _ { k , l }$ is missing, and $m _ { k , l } = 1$ if $x _ { k , l }$ is observed. We assume time intervals between two consecutive data entries can be different, and define the timestamps of the time series as $\mathbf { s } = \{ s _ { 1 : L } \} \in \mathbb { R } ^ { L }$ . In summary, each time series is expressed as $\{ \mathbf { X } , \mathbf { M } , \mathbf { s } \bar \}$ .
41
+
42
+ Probabilistic time series imputation is the task of estimating the distribution of the missing values of $\mathbf { X }$ by exploiting the observed values of $\mathbf { X }$ . We note that this definition of imputation includes other related tasks, such as interpolation, which imputes all features at target time points, and forecasting, which imputes all features at future time points.
43
+
44
+ # 3.2 Denoising diffusion probabilistic models
45
+
46
+ Let us consider learning a model distribution $p _ { \theta } ( \mathbf { x } _ { 0 } )$ that approximates a data distribution $q ( \mathbf { x } _ { 0 } )$ . Let $\mathbf { x } _ { t }$ for $t = 1 , \dots , T$ be a sequence of latent variables in the same sample space as $\mathbf { x } _ { \mathrm { 0 } }$ , which is denoted as $\mathcal { X }$ . Diffusion probabilistic models [26] are latent variable models that are composed of two processes: the forward process and the reverse process. The forward process is defined by the following Markov chain:
47
+
48
+ $$
49
+ q ( \mathbf { x } _ { 1 : T } \mid \mathbf { x } _ { 0 } ) : = \prod _ { t = 1 } ^ { T } q ( \mathbf { x } _ { t } \mid \mathbf { x } _ { t - 1 } ) { \mathrm { ~ w h e r e ~ } } q ( \mathbf { x } _ { t } \mid \mathbf { x } _ { t - 1 } ) : = { \mathcal { N } } \left( { \sqrt { 1 - { \beta _ { t } } } } \mathbf { x } _ { t - 1 } , { \beta _ { t } } \mathbf { I } \right)
50
+ $$
51
+
52
+ and $\beta _ { t }$ is a small positive constant that represents a noise level. Sampling of $\mathbf { x } _ { t }$ has the closed-form written as $q ( \mathbf { x } _ { t } \mid \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { \alpha _ { t } } \mathbf { x } _ { 0 } , ( 1 - \alpha _ { t } ) \mathbf { I } )$ where $\hat { \alpha } _ { t } : = 1 - \beta _ { t }$ and $\textstyle \alpha _ { t } : = \prod _ { i = 1 } ^ { t } { \hat { \alpha } } _ { i }$ . Then, $\mathbf { x } _ { t }$ can be expressed as $\mathbf { x } _ { t } = \sqrt { \alpha _ { t } } \mathbf { x } _ { 0 } + ( 1 - \alpha _ { t } ) \boldsymbol { \epsilon }$ where $\mathbf { \epsilon } \gets \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . On the other hand, the reverse process denoises $\mathbf { x } _ { t }$ to recover $\mathbf { x } _ { \mathrm { 0 } }$ , and is defined by the following Markov chain:
53
+
54
+ $$
55
+ \begin{array} { r l } & { p _ { \theta } ( \mathbf { x } _ { 0 : T } ) : = p ( \mathbf { x } _ { T } ) \displaystyle \prod _ { t = 1 } ^ { T } p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) , \quad \mathbf { x } _ { T } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) , } \\ & { p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) : = \mathcal { N } ( \mathbf { x } _ { t - 1 } ; \pmb { \mu } _ { \theta } ( \mathbf { x } _ { t } , t ) , \sigma _ { \theta } ( \mathbf { x } _ { t } , t ) \mathbf { I } ) . } \end{array}
56
+ $$
57
+
58
+ Ho et al. [11] has recently proposed denoising diffusion probabilistic models (DDPM), which considers the following specific parameterization of $p _ { \theta } ( \mathbf { x } _ { t - 1 } \mathbf { \bar { \rho } } \vert \mathbf { x } _ { t } )$ :
59
+
60
+ $$
61
+ \mu _ { \theta } ( \mathbf { x } _ { t } , t ) = \frac { 1 } { \alpha _ { t } } \left( \mathbf { x } _ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \alpha _ { t } } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \right) , \ \sigma _ { \theta } ( \mathbf { x } _ { t } , t ) = \tilde { \beta } _ { t } ^ { 1 / 2 } \ \mathrm { w h e r e } \ \tilde { \beta } _ { t } = \left\{ \begin{array} { l l } { \frac { 1 - \alpha _ { t - 1 } } { 1 - \alpha _ { t } } \beta _ { t } } & { t > 1 } \\ { \beta _ { 1 } } & { t = 1 } \end{array} \right.
62
+ $$
63
+
64
+ where $\epsilon _ { \theta }$ is a trainable denoising function. We denote $\mu _ { \theta } ( \mathbf { x } _ { t } , t )$ and $\sigma _ { \theta } ( \mathbf { x } _ { t } , t )$ in Eq. (3) as $\mu ^ { \mathrm { D D P M } } ( \mathbf { x } _ { t } , t , \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) )$ and $\sigma ^ { \mathrm { D D P M } } ( \mathbf { x } _ { t } , t )$ , respectively. The denoising function in Eq. (3) also corresponds to a rescaled score model for score-based generative models [23]. Under this parameterization, Ho et al. [11] have shown that the reverse process can be trained by solving the following optimization problem:
65
+
66
+ $$
67
+ \operatorname* { m i n } _ { \theta } \mathcal { L } ( \theta ) : = \operatorname* { m i n } _ { \theta } \mathbb { E } _ { \mathbf { x } _ { 0 } \sim q ( \mathbf { x } _ { 0 } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) , t } | | \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) | | _ { 2 } ^ { 2 } \quad \mathrm { w h e r e } \ \mathbf { x } _ { t } = \sqrt { \alpha _ { t } } \mathbf { x } _ { 0 } + ( 1 - \alpha _ { t } ) \epsilon .
68
+ $$
69
+
70
+ The denoising function $\epsilon _ { \theta }$ estimates the noise vector $\epsilon$ that was added to its noisy input $\mathbf { x } _ { t }$ . This training objective also be viewed as a weighted combination of denoising score matching used for training score-based generative models [23, 27, 12]. Once trained, we can sample $\mathbf { x } _ { \mathrm { 0 } }$ from Eq. (2). We provide the details of DDPM in Appendix A.
71
+
72
+ # 3.3 Imputation with diffusion models
73
+
74
+ Here, we focus on general imputation tasks that are not restricted to time series imputation. Let us consider the following imputation problem: given a sample $\mathbf { x } _ { \mathrm { 0 } }$ which contains missing values, we generate imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } } \in \mathcal { X } ^ { \mathrm { { t a } } }$ by exploiting conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } } \in \mathcal { X } ^ { \mathrm { { c o } } }$ , where $\bar { \mathcal X } ^ { \mathrm { t a } }$ and $\mathcal { X } ^ { \mathrm { c o } }$ are a part of the sample space $\mathcal { X }$ and vary per sample. Then, the goal of probabilistic imputation is to estimate the true conditional data distribution $q ( \mathbf { \bar { x } } _ { 0 } ^ { \mathrm { t a } } \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } )$ with a model distribution $p _ { \theta } ( \mathbf { x } _ { 0 } ^ { \mathrm { { t a } } } \mid \mathbf { x } _ { 0 } ^ { \mathrm { { c o } } } )$ . We typically impute all missing values using all observed values, and set all observed values as $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and all missing values as $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } }$ , respectively. Note that time series imputation in Section 3.1 can be considered as a special case of this task.
75
+
76
+ Let us consider modeling $p _ { \theta } ( \mathbf { x } _ { 0 } ^ { \mathrm { { t a } } } \mid \mathbf { x } _ { 0 } ^ { \mathrm { { c o } } } )$ with a diffusion model. In the unconditional case, the reverse process $p _ { \theta } ( \mathbf { x } _ { 0 : T } )$ is used to define the final data model $p _ { \theta } ( \mathbf { x } _ { 0 } )$ . Then, a natural approach is to extend the reverse process in Eq. (2) to a conditional one:
77
+
78
+ $$
79
+ \begin{array} { r l } & { p _ { \theta } ( \mathbf { x } _ { 0 : T } ^ { \mathrm { t a } } \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) : = p ( \mathbf { x } _ { T } ^ { \mathrm { t a } } ) \displaystyle \prod _ { t = 1 } ^ { T } p _ { \theta } ( \mathbf { x } _ { t - 1 } ^ { \mathrm { t a } } \mid \mathbf { x } _ { t } ^ { \mathrm { t a } } , \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) , \quad \mathbf { x } _ { T } ^ { \mathrm { t a } } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) , } \\ & { p _ { \theta } ( \mathbf { x } _ { t - 1 } ^ { \mathrm { t a } } \mid \mathbf { x } _ { t } ^ { \mathrm { t a } } , \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) : = \mathcal { N } ( \mathbf { x } _ { t - 1 } ^ { \mathrm { t a } } ; \mu _ { \theta } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) , \sigma _ { \theta } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) \mathbf { I } ) . } \end{array}
80
+ $$
81
+
82
+ However, existing diffusion models are generally designed for data generation and do not take conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ as inputs. To utilize diffusion models for imputation, previous studies [12, 15, 16] approximated the conditional reverse process $p _ { \theta } ( \mathbf { x } _ { t - 1 } ^ { \mathrm { { t a } } } \mid \mathbf { x } _ { t } ^ { \mathrm { { t a } } } , \mathbf { x } _ { 0 } ^ { \mathrm { { c o } } } )$ with the reverse process in Eq. (2). With this approximation, in the reverse process they add noise to both the target and the conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ . While this approach can impute missing values, the added noise can harm useful information in the observations. This suggests that modeling $p _ { \theta } ( \mathbf { x } _ { t - 1 } ^ { \mathrm { { t a } } } \mid \mathbf { x } _ { t } ^ { \mathrm { { t a } } } , \mathbf { x } _ { 0 } ^ { \mathrm { { c o } } } )$ without approximations can improve the imputation quality. Hereafter, we call the model defined in Section 3.2 as the unconditional diffusion model.
83
+
84
+ # 4 Conditional score-based diffusion model for imputation (CSDI)
85
+
86
+ In this section, we propose CSDI, a novel imputation method based on a conditional score-based diffusion model. The conditional diffusion model allows us to exploit useful information in observed values for accurate imputation. We provide the reverse process of the conditional diffusion model, and then develop a self-supervised training method. We note that CSDI is not restricted to time series.
87
+
88
+ # 4.1 Imputation with CSDI
89
+
90
+ We focus on the conditional diffusion model with the reverse process in Eq. (5) and aim to model the conditional distribution $p ( \mathbf { x } _ { t - 1 } ^ { \mathrm { t a } } \mid \mathbf { x } _ { t } ^ { \mathrm { t a } } , \mathbf { x } _ { 0 } ^ { \mathrm { c o } } )$ without approximations. Specifically, we extend the parameterization of DDPM in Eq. (3) to the conditional case. We define a conditional denoising function $\epsilon _ { \theta } : ( \mathcal { X } ^ { \mathrm { t a } } \times \mathbb { R } \mid \mathcal { X } ^ { \mathrm { c o } } ) \mathcal { X } ^ { \mathrm { t a } }$ , which takes conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ as inputs. Then, we consider the following parameterization with $\epsilon _ { \theta }$ :
91
+
92
+ $$
93
+ \mu _ { \boldsymbol { \theta } } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) = \mu ^ { \mathrm { D D P M } } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t , \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) ) , \quad \sigma _ { \boldsymbol { \theta } } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) = \sigma ^ { \mathrm { D D P M } } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t )
94
+ $$
95
+
96
+ where $\mu ^ { \mathrm { D D P M } }$ and $\sigma ^ { \mathrm { D D P M } }$ are the functions defined in Section 3.2. Given the function $\epsilon _ { \theta }$ and data $\mathbf { x } _ { \mathrm { 0 } }$ , we can sample $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ using the reverse process in Eq. (5) and Eq. (6). For the sampling, we set all observed values of $\mathbf { x } _ { \mathrm { 0 } }$ as conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and all missing values as imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } }$ Note that the conditional model is reduced to the unconditional one under no conditional observations and can also be used for data generation.
97
+
98
+ # 4.2 Training of CSDI
99
+
100
+ Since Eq. (6) uses the same parameterization as Eq. (3) and the difference between Eq. (3) and Eq. (6) is only the form of $\epsilon _ { \theta }$ , we can follow the training procedure for the unconditional model in Section 3.2. Namely, given conditional observations √ $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ , we sample noisy targets $\mathbf { x } _ { t } ^ { \mathrm { { t a } } } = \sqrt { \alpha _ { t } } \bar { \mathbf { x } } _ { 0 } ^ { \mathrm { { t a } } } + ( 1 - \alpha _ { t } ) \epsilon$ , and train $\epsilon _ { \theta }$ by minimizing the following loss function:
101
+
102
+ $$
103
+ \operatorname* { m i n } _ { \theta } \mathcal { L } ( \theta ) : = \operatorname* { m i n } _ { \theta } \mathbb { E } _ { \mathbf { x } _ { 0 } \sim q ( \mathbf { x } _ { 0 } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) , t } | | ( \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t } ^ { \mathrm { t a } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { c o } } ) ) | | _ { 2 } ^ { 2 }
104
+ $$
105
+
106
+ ![](images/4d4be6e3883b120cb84f7b40b0f097416121248d7d4d14c7bb15628ef851b269.jpg)
107
+ Figure 2: The self-supervised training procedure of CSDI. On the middle left rectangle, the green and white areas represent observed and missing values, respectively. The observed values are separated into red imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ and blue conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ , and used for training of $\epsilon _ { \theta }$ . The colored areas in each rectangle mean the existence of values.
108
+
109
+ Table 1: Imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ and conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ for CSDI at training and sampling.
110
+
111
+ <table><tr><td></td><td> imputation targets xta</td><td>conditional observations xco</td></tr><tr><td>sampling (imputation)</td><td>all missing values</td><td>all observed values</td></tr><tr><td>training</td><td>a subset of the observed values (sampled by a target choice strategy)</td><td>the remaining observed values</td></tr></table>
112
+
113
+ where the dimension of $\epsilon$ corresponds to that of the imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } }$
114
+
115
+ However, this training procedure has an issue. Since we do not know the ground-truth missing values in practice, it is not clear how to select $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ from a training sample $\mathbf { x } _ { \mathrm { 0 } }$ . To address this issue, we develop a self-supervised learning method inspired by masked language modeling [28]. We illustrate the training procedure in Figure 2. Given a sample $\mathbf { x } _ { \mathrm { 0 } }$ , we separate observed values of $\mathbf { x } _ { \mathrm { 0 } }$ into two parts, and set one of them as imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ and the other as conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ . We choose the targets $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } }$ through a target choice strategy, which is discussed in Section 4.3. Then, we sample noisy targets ${ \bf x } _ { t } ^ { \mathrm { t a } }$ and train $\epsilon _ { \theta }$ by solving Eq. (7). We summarize how we set $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } }$ for training and sampling in Table 1. We also provide the algorithm of training and sampling in Appendix B.1.
116
+
117
+ # 4.3 Choice of imputation targets in self-supervised learning
118
+
119
+ In the proposed self-supervised learning, the choice of imputation targets is important. We provide four target choice strategies depending on what is known about the missing patterns in the test dataset. We describe the algorithm for these strategies in Appendix B.2.
120
+
121
+ (1) Random strategy : this strategy is used when we do not know about missing patterns, and randomly chooses a certain percentage of observed values as imputation targets. The percentage is sampled from $[ 0 \% , 1 0 0 \% ]$ to adapt to various missing ratios in the test dataset.
122
+
123
+ (2) Historical strategy: this strategy exploits missing patterns in the training dataset. Given a training sample $\mathbf { x } _ { \mathrm { 0 } }$ , we randomly draw another sample $\tilde { \mathbf { x } } _ { 0 }$ from the training dataset. Then, we set the intersection of the observed indices of $\mathbf { x } _ { \mathrm { 0 } }$ and the missing indices of $\tilde { \mathbf { x } } _ { 0 }$ as imputation targets. The motivation of this strategy comes from structured missing patterns in the real world. For example, missing values often appear consecutively in time series data. When missing patterns in the training and test dataset are highly correlated, this strategy helps the model learn a good conditional distribution.
124
+
125
+ (3) Mix strategy: this strategy is the mix of the above two strategies. The historical strategy may lead to overfitting to missing patterns in the training dataset. The Mix strategy can benefit from generalization by the random strategy and structured missing patterns by the historical strategy.
126
+
127
+ (4) Test pattern strategy: when we know the missing patterns in the test dataset, we just set the patterns as imputation targets. For example, this strategy is used for time series forecasting, since the missing patterns in the test dataset are fixed to given future time points.
128
+
129
+ # 5 Implementation of CSDI for time series imputation
130
+
131
+ ![](images/4ffe055c5adebee89536c944dfe02db241c2cf7a2e7459a190e50b95a8c73a5c.jpg)
132
+ Figure 3: The architecture of 2D attention. Given a tensor with $K$ features, $L$ length, and $C$ channels, the temporal Transformer layer takes tensors with $( 1 , L , C )$ shape as inputs and learns temporal dependency. The feature Transformer layer takes tensors with $( K , 1 , C )$ shape as inputs and learns feature dependency. The output shape of each layer is the same as the input shape.
133
+
134
+ In this section, we implement CSDI for time series imputation. For the implementation, we need the inputs and the architecture of $\epsilon _ { \theta }$ .
135
+
136
+ First, we describe how we process time series data as inputs for CSDI. As defined in Section 3.1, a time series is denoted as $\{ \mathbf { X } , \mathbf { M } , \mathbf { s } \}$ , and the sample space $\mathcal { X }$ of $\mathbf { X }$ is $\mathbb { R } ^ { K \times L }$ . We want to handle X in the sample space $\mathbb { R } ^ { K \times L }$ for learning dependencies in a time series using a neural network, but the conditional denoising function $\epsilon _ { \theta }$ takes inputs ${ \bf x } _ { t } ^ { \mathrm { t a } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ in varying sample spaces that are a part of $\mathcal { X }$ as shown in white areas of ${ \bf x } _ { t } ^ { \mathrm { t a } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ in Figure 2. To address this issue, we adjust the conditional denoising function $\epsilon _ { \theta }$ to inputs in the fixed sample space $\mathbb { R } ^ { K \times L }$ . Concretely, we fix the shape of the inputs ${ \bf x } _ { t } ^ { \mathrm { t a } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ to $( K \times L )$ by applying zero padding to ${ \bf x } _ { t } ^ { \mathrm { t a } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ . In other words, we set zero values to white areas for ${ \bf x } _ { t } ^ { \mathrm { t a } }$ and ${ \bf x } _ { 0 } ^ { \mathrm { c o } }$ in Figure 2. To indicate which indices are padded, we introduce the conditional mask $\mathbf { m } ^ { \mathrm { c o } } \in \{ 0 , 1 \} ^ { K \times L }$ as an additional input to $\epsilon _ { \theta }$ , which corresponds to $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and takes value 1 for indices of conditional observations. For ease of handling, we also fix the output shape in the sample space $\mathbb { R } ^ { K \times L }$ by applying zero padding. Then, the conditional denoising function $\epsilon _ { \theta } ( \mathbf { x } _ { t } ^ { \mathrm { { t a } } } , t \mid \mathbf { x } _ { 0 } ^ { \mathrm { { c o } } } , \mathbf { m } ^ { \mathrm { { c o } } } )$ can be written as $\begin{array} { r } { \overline { { \epsilon } } _ { \theta } : ( \mathbb { R } ^ { K \times L } \times \mathbb { R } ^ { \overline { { } } } \mid \mathbb { R } ^ { K \times L } \times \{ 0 , 1 \} ^ { K \times L } ) \mathbb { R } ^ { K \times \tilde { L } } } \end{array}$ . We discuss the effect of this adjustment on training and sampling in Appendix D.
137
+
138
+ Under the adjustment, we set conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ and imputation targets $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ for time series imputation by following Table 1. At sampling time, since conditional observations $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ are all observed values, we set $\mathbf { m } ^ { \mathrm { c o } } = \mathbf { M }$ and $\begin{array} { r } { \mathbf { x } _ { 0 } ^ { \mathrm { c o } } = \mathbf { m } ^ { \mathrm { c o } } \odot \mathbf { X } } \end{array}$ where $\odot$ represents element-wise products. For training, we sample $\mathbf { x } _ { 0 } ^ { \mathrm { t a } }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { c o } }$ through a target choice strategy, and set the indices of $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ as $\mathbf { m } ^ { \mathrm { c o } }$ . Then, $\mathbf { x } _ { 0 } ^ { \mathrm { { c o } } }$ is written as $\mathbf { x } _ { 0 } ^ { \mathrm { c o } } = \mathbf { m } ^ { \mathrm { c o } } \odot \mathbf { X }$ and $\mathbf { x } _ { 0 } ^ { \mathrm { { t a } } }$ is obtained as $\mathbf { \bar { x } } _ { 0 } ^ { \mathrm { t a } } = \left( \mathbf { M } - \mathbf { m } ^ { \mathrm { c o } } \right) \odot \mathbf { X }$ .
139
+
140
+ Next, we describe the architecture of $\epsilon _ { \theta }$ . We adopt the architecture in DiffWave [13] as the base, which is composed of multiple residual layers with residual channel $C$ . We refine this architecture for time series imputation. We set the diffusion step $T = 5 0$ . We discuss the main differences from DiffWave (see Appendix E.1 for the whole architecture and details).
141
+
142
+ Attention mechanism To capture temporal and feature dependencies of multivariate time series, we utilize a two dimensional attention mechanism in each residual layer instead of a convolution architecture. As shown in Figure 3, we introduce temporal Transformer layer and a feature Transformer layer, which are 1-layer Transformer encoders. The temporal Transformer layer takes tensors for each feature as inputs to learn temporal dependency, whereas the feature Transformer layer takes tensors for each time point as inputs to learn temporal dependency.
143
+
144
+ Note that while the length $L$ can be different for each time series as mentioned in Section 3.1, the attention mechanism allows the model to handle various lengths. For batch training, we apply zero padding to each sequence so that the lengths of the sequences are the same.
145
+
146
+ Side information In addition to the arguments of $\epsilon _ { \theta }$ , we provide some side information as additional inputs to the model. First, we use time embedding of $\mathbf { s } = \left\{ s _ { 1 : L } \right\}$ to learn the temporal dependency. Following previous studies [29, 30], we use 128-dimensions temporal embedding. Second, we exploit categorical feature embedding for $K$ features, where the dimension is 16.
147
+
148
+ # 6 Experimental results
149
+
150
+ In this section, we demonstrate the effectiveness of CSDI for time series imputation. Since CSDI can be applied to other related tasks such as interpolation and forecasting, we also evaluate CSDI for these tasks to show the flexibility of CSDI. Due to the page limitation, we provide the detailed setup for experiments including train/validation/test splits and hyperparameters in Appendix E.2.
151
+
152
+ # 6.1 Time series imputation
153
+
154
+ Dataset and experiment settings We run experiments for two datasets. The first one is the healthcare dataset in PhysioNet Challenge 2012 [1], which consists of 4000 clinical time series with 35 variables for 48 hours from intensive care unit (ICU). Following previous studies [7, 8], we process the dataset to hourly time series with 48 time steps. The processed dataset contains around $80 \%$ missing values. Since the dataset has no ground-truth, we randomly choose $10 / 5 0 / 9 0 \%$ of observed values as ground-truth on the test data.
155
+
156
+ The second one is the air quality dataset [2]. Following previous studies [7, 21], we use hourly sampled PM2.5 measurements from 36 stations in Beijing for 12 months and set 36 consecutive time steps as one time series. There are around $13 \%$ missing values and the missing patterns are not random. The dataset contains artificial ground-truth, whose missing patterns are also structured.
157
+
158
+ For both dataset, we run each experiment five times. As the target choice strategy for training, we adopt the random strategy for the healthcare dataset and the mix of the random and historical strategy for the air quality dataset, based on the missing patterns of each dataset.
159
+
160
+ Results of probabilistic imputation CSDI is compared with three baselines. 1) Multitask GP [31]: the method learns the covariance between timepoints and features simultaneously. 2) GP-VAE [10]: the method showed the state-of-the-art results for probabilistic imputation. 3) V-RIN [32]: a deterministic imputation method that uses the uncertainty quantified by VAE to improve imputation. For V-RIN, we regard the quantified uncertainty as probabilistic imputation. In addition, we compare CSDI with imputation using the unconditional diffusion model in order to show the effectiveness of the conditional one (see Appendix C for training and imputation with the unconditional diffusion model).
161
+
162
+ We first show quantitative results. We adopt the continuous ranked probability score (CRPS) [33] as the metric, which is freuquently used for evaluating probabilistic time series forecasting and measures the compatibility of an estimated probability distribution with an observation. We generate 100 samples to approximate the probability distribution over missing values and report the normalized average of CRPS for all missing values following previous studies [34] (see Appendix E.3 for details of the computation).
163
+
164
+ Table 2: Comparing CRPS for probabilistic imputation baselines and CSDI (lower is better). We report the mean and the standard error of CRPS for five trials.
165
+
166
+ <table><tr><td rowspan="2"></td><td colspan="3">healthcare</td><td rowspan="2"> air quality</td></tr><tr><td>10% missing</td><td>50% missing</td><td>90% missing</td></tr><tr><td>Multitask GP [31]</td><td>0.489(0.005)</td><td>0.581(0.003)</td><td>0.942(0.010)</td><td>0.301(0.003)</td></tr><tr><td>GP-VAE [10]</td><td>0.574(0.003)</td><td>0.774(0.004)</td><td>0.998(0.001)</td><td>0.397(0.009)</td></tr><tr><td>V-RIN [32]</td><td>0.808(0.008)</td><td>0.831(0.005)</td><td>0.922(0.003)</td><td>0.526(0.025)</td></tr><tr><td>unconditional</td><td>0.360(0.007)</td><td>0.458(0.008)</td><td>0.671(0.007)</td><td>0.135(0.001)</td></tr><tr><td>CSDI (proposed)</td><td>0.238(0.001)</td><td>0.330(0.002)</td><td>0.522(0.002)</td><td>0.108(0.001)</td></tr></table>
167
+
168
+ ![](images/69ce72ce314c6286db787f6e6e1f2d44bf21b580f69c761d60844f636f49fdf1.jpg)
169
+ Figure 4: Examples of probabilistic time series imputation for the healthcare dataset with $50 \%$ missing (left) and the air quality dataset (right). The red crosses show the observed values and the blue circles show the ground-truth imputation targets. For each method, median values of imputations are shown as the line and $5 \%$ and $9 5 \%$ quantiles are shown as the shade.
170
+
171
+ Table 2 represents CRPS for each method. CSDI reduces CRPS by $40 \%$ compared to the existing baselines for both datasets. This indicates that CSDI generates more realistic distributions than other methods. We also observe that the imputation with CSDI outperforms that with the unconditional model. This suggests CSDI benefits from explicitly modeling the conditional distribution.
172
+
173
+ We provide imputation examples in Figure 4. For the air quality dataset, CSDI (green solid line) provides accurate imputations with high confidence, while those by GP-VAE (gray dashed line) are far from ground-truth. CSDI also gives reasonable imputations for the healthcare dataset. These results indicate that CSDI exploits temporal and feature dependencies to provide accurate imputations. We give more examples in Appendix G.
174
+
175
+ Table 3: Comparing MAE for deterministic imputation methods and CSDI. We report the mean and the standard error for five trials. The asterisks mean the results of the method are cited from the original paper.
176
+
177
+ <table><tr><td rowspan="2"></td><td colspan="3">healthcare</td><td rowspan="2"> air quality</td></tr><tr><td>10% missing</td><td>50% missing</td><td>90% missing</td></tr><tr><td>V-RIN [32]</td><td>0.271(0.001)</td><td>0.365(0.002)</td><td>0.606(0.006)</td><td>25.4(0.62)</td></tr><tr><td>BRITS[7]</td><td>0.284(0.001)</td><td>0.368(0.002)</td><td>0.517(0.002)</td><td>14.11(0.26)</td></tr><tr><td>BRITS [7] (*)</td><td>0.278</td><td></td><td></td><td>11.56</td></tr><tr><td>GLIMA [21](*)</td><td>0.265</td><td></td><td></td><td>10.54</td></tr><tr><td>RDIS [20]</td><td>0.319(0.002)</td><td>0.419(0.002)</td><td>0.631(0.002)</td><td>22.11(0.35)</td></tr><tr><td>unconditional</td><td>0.326(0.008)</td><td>0.417(0.010)</td><td>0.625(0.010)</td><td>12.13(0.07)</td></tr><tr><td>CSDI (proposed)</td><td>0.217(0.001)</td><td>0.301(0.002)</td><td>0.481(0.003)</td><td>9.60(0.04)</td></tr></table>
178
+
179
+ Results of deterministic imputation We demonstrate that CSDI also provides accurate deterministic imputations, which are obtained as the median of 100 generated samples. We compare CSDI with four baselines developed for deterministic imputation including GLIMA [21], which combined recurrent imputations with an attention mechanism to capture temporal and feature dependencies and showed the state-of-the-art performance. These methods are based on autoregressive models. We use the original implementations except RDIS.
180
+
181
+ We evaluate each method by the mean absolute error (MAE). In Table 3, CSDI improves MAE by $5 \%$ compared to the baselines. This suggests that the conditional diffusion model is effective to learn temporal and feature dependencies for imputation. For the healthcare dataset, the gap between the baselines and CSDI is particularly significant when the missing ratio is small, because more observed values help CSDI capture dependencies.
182
+
183
+ Table 4: Comparing the state-of-the-art interpolation methods with CSDI for the healthcare dataset. We report the mean and the standard error of CRPS for five trials.
184
+
185
+ <table><tr><td></td><td>10% missing</td><td>50% missing</td><td>90% missing</td></tr><tr><td>Latent ODE [35]</td><td>0.700(0.002)</td><td>0.676(0.003)</td><td>0.761(0.010)</td></tr><tr><td>mTANs [22]</td><td>0.526(0.004)</td><td>0.567(0.003)</td><td>0.689(0.015)</td></tr><tr><td>CSDI (proposed)</td><td>0.380(0.002)</td><td>0.418(0.001)</td><td>0.556(0.003)</td></tr></table>
186
+
187
+ # 6.2 Interpolation of irregularly sampled time series
188
+
189
+ Dataset and experiment settings We use the same healthcare dataset as the previous section, but process the dataset as irregularly sampled time series, following previous studies [22, 35]. Since the dataset has no ground-truth, we randomly choose $10 / 5 0 / 9 0 \%$ of time points and use observed values at these time points as ground-truth on the test data. As the target choice strategy for training, we adopt the random strategy, which is adjusted for interpolation so that some time points are sampled.
190
+
191
+ Results We compare CSDI with two baselines including mTANs [22], which utilized an attention mechanism and showed state-of-the-art results for the interpolation of irregularly sampled time series. We generate 100 samples to approximate the probability distribution as with the previous section. The result is shown in Table 4. CSDI outperforms the baselines for all cases.
192
+
193
+ Table 5: Comparing probabilistic forecasting methods with CSDI. We report the mean and the standard error of CRPS-sum for three trials. The baseline results are cited from the original paper. ’TransMAF’ is the abbreviation for ’Transformer MAF’.
194
+
195
+ <table><tr><td></td><td>solar</td><td>electricity</td><td>traffic</td><td>taxi</td><td>wiki</td></tr><tr><td>GP-copula [34]</td><td>0.337(0.024)</td><td>0.024(0.002)</td><td>0.078(0.002)</td><td>0.208(0.183)</td><td>0.086(0.004)</td></tr><tr><td>TransMAF [36]</td><td>0.301(0.014)</td><td>0.021(0.000)</td><td>0.056(0.001)</td><td>0.179(0.002)</td><td>0.063(0.003)</td></tr><tr><td>TLAE [37]</td><td>0.124(0.033)</td><td>0.040(0.002)</td><td>0.069(0.001)</td><td>0.130(0.006)</td><td>0.241(0.001)</td></tr><tr><td>TimeGrad [25]</td><td>0.287(0.020)</td><td>0.021(0.001)</td><td>0.044(0.006)</td><td>0.114(0.020)</td><td>0.049(0.002)</td></tr><tr><td>CSDI (proposed)</td><td>0.298(0.004)</td><td>0.017(0.000)</td><td>0.020(0.001)</td><td>0.123(0.003)</td><td>0.047(0.003)</td></tr></table>
196
+
197
+ # 6.3 Time series Forecasting
198
+
199
+ Dataset and Experiment settings We use five datasets that are commonly used for evaluating probabilistic time series forecasting. Each dataset is composed of around 100 to 2000 features. We predict all features at future time steps using past time series. We use the same prediction steps as previous studies [34, 37]. For the target choice strategy, we adopt the Test pattern strategy.
200
+
201
+ Results We compare CSDI with four baselines. Specifically, TimeGrad [25] combined the diffusion model with a RNN-based encoder. We evaluate each method for CRPS-sum, which is CRPS for the distribution of the sum of all time series across $K$ features and accounts for joint effect (see Appendix E.3 for details).
202
+
203
+ In Table 5, CSDI outperforms the baselines for electricity and traffic datasets, and is competitive with the baselines as a whole. The advantage of CSDI over baselines for forecasting is smaller than that for imputation in Section 6.1. We hypothesize it is because the datasets for forecasting seldom contains missing values and are suitable for existing encoders including RNNs. For imputation, it is relatively difficult for RNNs to handle time series due to missing values.
204
+
205
+ # 7 Conclusion
206
+
207
+ In this paper, we have proposed CSDI, a novel approach to impute multivariate time series with conditional diffusion models. We have shown that CSDI outperforms the existing probabilistic and deterministic imputation methods.
208
+
209
+ There are some interesting directions for future work. One direction is to improve the computation efficiency. While diffusion models generate plausible samples, sampling is generally slower than other generative models. To mitigate the issue, several recent studies leverage an ODE solver to accelerate the sampling procedure [12, 38, 13]. Combining our method with these approaches would likely improve the sampling efficiency.
210
+
211
+ Another direction is to extend CSDI to downstream tasks such as classifications. Many previous studies have shown that accurate imputation improves the performance on downstream tasks [7, 18, 22]. Since conditional diffusion models can learn temporal and feature dependencies with uncertainty, joint training of imputations and downstream tasks using conditional diffusion models would be helpful to improve the performance of the downstream tasks.
212
+
213
+ Finally, although our focus was on time series, it would be interesting to explore CSDI as imputation technique on other modalities.
214
+
215
+ # Acknowledgements and Disclosure of Funding
216
+
217
+ This research was supported by NSF(#1651565, #1522054, #1733686), ONR (N000141912145), AFOSR (FA95501910024), ARO (W911NF-21-1-0125) and Sloan Fellowship.
218
+
219
+ # References
220
+
221
+ [1] Ikaro Silva, George Moody, Daniel J Scott, Leo A Celi, and Roger G Mark. Predicting inhospital mortality of icu patients: The physionet/computing in cardiology challenge 2012. In Computing in Cardiology, pages 245–248. IEEE, 2012.
222
+ [2] Xiuwen Yi, Yu Zheng, Junbo Zhang, and Tianrui Li. ST-MVL: filling missing values in geo-sensory time series data. In Proceedings of International Joint Conference on Artificial Intelligence, pages 2704–2710, 2016.
223
+ [3] Huachun Tan, Guangdong Feng, Jianshuai Feng, Wuhong Wang, Yu-Jin Zhang, and Feng Li. A tensor-based method for missing traffic data completion. Transportation Research Part C: Emerging Technologies, 28:15–27, 2013.
224
+ [4] Fulufhelo V Nelwamondo, Shakir Mohamed, and Tshilidzi Marwala. Missing data: A comparison of neural network and expectation maximization techniques. Current Science, pages 1514–1521, 2007.
225
+ [5] Andrew T Hudak, Nicholas L Crookston, Jeffrey S Evans, David E Hall, and Michael J Falkowski. Nearest neighbor imputation of species-level, plot-scale forest structure attributes from lidar data. Remote Sensing of Environment, 112(5):2232–2245, 2008.
226
+ [6] S van Buuren and Karin Groothuis-Oudshoorn. MICE: Multivariate imputation by chained equations in r. Journal of statistical software, pages 1–68, 2010.
227
+ [7] Wei Cao, Dong Wang, Jian Li, Hao Zhou, Lei Li, and Yitan Li. BRITS: Bidirectional recurrent imputation for time series. In Advances in Neural Information Processing Systems, 2018.
228
+ [8] Zhengping Che, Sanjay Purushotham, Kyunghyun Cho, David Sontag, and Yan Liu. Recurrent neural networks for multivariate time series with missing values. Scientific reports, 8(1):1–12, 2018.
229
+ [9] Yonghong Luo, Xiangrui Cai, Ying Zhang, Jun Xu, and Xiaojie Yuan. Multivariate time series imputation with generative adversarial networks. In Advances in Neural Information Processing Systems, pages 1603–1614, 2018.
230
+ [10] Vincent Fortuin, Dmitry Baranchuk, Gunnar Rätsch, and Stephan Mandt. GP-VAE: Deep probabilistic time series imputation. In International Conference on Artificial Intelligence and Statistics, 2020.
231
+ [11] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, 2020.
232
+
233
+ [12] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021.
234
+
235
+ [13] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. In International Conference on Learning Representations, 2021.
236
+
237
+ [14] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating gradients for waveform generation. In International Conference on Learning Representations, 2021.
238
+
239
+ [15] Zahra Kadkhodaie and Eero P Simoncelli. Solving linear inverse problems using the prior implicit in a denoiser. arXiv preprint arXiv:2007.13640, 2020.
240
+
241
+ [16] Gautam Mittal, Jesse Engel, Hawthorne Curtis, and Ian Simon. Symbolic music generation with diffusion models. arXiv preprint arXiv:2103.16091, 2021.
242
+
243
+ [17] Jinsung Yoon, William R Zame, and Mihaela van der Schaar. Estimating missing data in temporal data streams using multi-directional recurrent neural networks. IEEE Transactions on Biomedical Engineering, 66(5):1477–1490, 2018.
244
+
245
+ [18] Yonghong Luo, Ying Zhang, Xiangrui Cai, and Xiaojie Yuan. E2GAN: End-to-end generative adversarial network for multivariate time series imputation. In Proceedings of International Joint Conference on Artificial Intelligence, pages 3094–3100, 2019.
246
+
247
+ [19] Xiaoye Miao, Yangyang Wu, Jun Wang, Yunjun Gao, Xudong Mao, and Jianwei Yin. Generative semi-supervised learning for multivariate time series imputation. In The Thirty-Fifth AAAI Conference on Artificial Intelligence, 2021.
248
+
249
+ [20] Tae-Min Choi, Ji-Su Kang, and Jong-Hwan Kim. RDIS: Random drop imputation with selftraining for incomplete time series data. In The Thirty-Fifth AAAI Conference on Artificial Intelligence, 2021.
250
+
251
+ [21] Qiuling Suo, Weida Zhong, Guangxu Xun, Jianhui Sun, Changyou Chen, and Aidong Zhang. GLIMA: Global and local time series imputation with multi-directional attention learning. In 2020 IEEE International Conference on Big Data (Big Data), pages 798–807. IEEE, 2020.
252
+
253
+ [22] Satya Narayan Shukla and Benjamin M Marlin. Multi-time attention networks for irregularly sampled time series. In International Conference on Learning Representations, 2021.
254
+
255
+ [23] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, 2019.
256
+
257
+ [24] Chenhao Niu, Yang Song, Jiaming Song, Shengjia Zhao, Aditya Grover, and Stefano Ermon. Permutation invariant graph generation via score-based generative modeling. In International Conference on Artificial Intelligence and Statistics, pages 4474–4484. PMLR, 2020.
258
+
259
+ [25] Kashif Rasul, Calvin Seward, Ingmar Schuster, and Roland Vollgraf. Autoregressive denoising diffusion models for multivariate probabilistic time series forecasting. In International Conference on Machine Learning, 2021.
260
+
261
+ [26] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, 2015.
262
+
263
+ [27] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. In Advances in Neural Information Processing Systems, 2020.
264
+
265
+ [28] 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: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, 2019.
266
+
267
+ [29] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017.
268
+
269
+ [30] Simiao Zuo, Haoming Jiang, Zichong Li, Tuo Zhao, and Hongyuan Zha. Transformer hawkes process. In International Conference on Machine Learning, 2020.
270
+
271
+ [31] Edwin V Bonilla, Kian Ming A Chai, and Christopher KI Williams. Multi-task gaussian process prediction. In Advances in Neural Information Processing Systems, 2008.
272
+
273
+ [32] Ahmad Wisnu Mulyadi, Eunji Jun, and Heung-Il Suk. Uncertainty-aware variational-recurrent imputation network for clinical time series. IEEE Transactions on Cybernetics, 2021. to appear.
274
+
275
+ [33] James E Matheson and Robert L Winkler. Scoring rules for continuous probability distributions. Management science, 22(10):1087–1096, 1976.
276
+
277
+ [34] David Salinas, Michael Bohlke-Schneider, Laurent Callot, Roberto Medico, and Jan Gasthaus. High-dimensional multivariate forecasting with low-rank gaussian copula processes. In Advances in Neural Information Processing Systems, 2019.
278
+
279
+ [35] Yulia Rubanova, Ricky TQ Chen, and David Duvenaud. Latent ordinary differential equations for irregularly-sampled time series. In Advances in Neural Information Processing Systems, 2019.
280
+
281
+ [36] Kashif Rasul, Abdul-Saboor Sheikh, Ingmar Schuster, Urs Bergmann, and Roland Vollgraf. Multi-variate probabilistic time series forecasting via conditioned normalizing flows. In International Conference on Learning Representations, 2021.
282
+
283
+ [37] Nam Nguyen and Brian Quanz. Temporal latent auto-encoder: A method for probabilistic multivariate time series forecasting. In The Thirty-Fifth AAAI Conference on Artificial Intelligence, 2021.
284
+
285
+ [38] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021.
286
+
287
+ [39] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, 2019.
288
+
289
+ [40] Phil Wang. Linear attention transformer. https://github.com/lucidrains/ linear-attention-transformer, 2020.
290
+
291
+ [41] Zhuoran Shen, Mingyuan Zhang, Haiyu Zhao, Shuai Yi, and Hongsheng Li. Efficient attention: Attention with linear complexities. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 3531–3539, 2021.
292
+
293
+ [42] Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, 2021.
294
+
295
+ [43] Jacob R Gardner, Geoff Pleiss, David Bindel, Kilian Q Weinberger, and Andrew Gordon Wilson. Gpytorch: Blackbox matrix-matrix gaussian process inference with gpu acceleration. In Advances in Neural Information Processing Systems, 2018.
296
+
297
+ [44] Alexander Alexandrov, Konstantinos Benidis, Michael Bohlke-Schneider, Valentin Flunkert, Jan Gasthaus, Tim Januschowski, Danielle C. Maddix, Syama Rangapuram, David Salinas, Jasper Schulz, Lorenzo Stella, Ali Caner Türkmen, and Yuyang Wang. GluonTS: Probabilistic and Neural Time Series Modeling in Python. Journal of Machine Learning Research, 21(116):1–6, 2020.
298
+
299
+ [45] Guokun Lai, Wei-Cheng Chang, Yiming Yang, and Hanxiao Liu. Modeling long-and short-term temporal patterns with deep neural networks. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pages 95–104, 2018.
300
+
301
+ # Checklist
302
+
303
+ 1. For all authors...
304
+
305
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We described our proposed method and empirical results in the abstract and introduction.
306
+ (b) Did you describe the limitations of your work? [Yes] We have mentioned some limitations of our work in Section 7.
307
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] Please see Appendix H.
308
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] We have read the guidelines and ensured that our paper conforms to them.
309
+
310
+ 2. If you are including theoretical results...
311
+
312
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
313
+
314
+ 3. If you ran experiments...
315
+
316
+ (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] Please see the abstract.
317
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Please see Section 6 and Appendix E.2.
318
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We gave error bars in figures and the standard errors in tables.
319
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] We did not focus on computational time.
320
+
321
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
322
+
323
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We cited packages we used. We also cited papers which provided datasets.
324
+ (b) Did you mention the license of the assets? [No] We only used open dataset. Please refer to citations for details on licensing.
325
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No] We did not release new assets.
326
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] We only used open dataset.
327
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] The datasets we used are open numerical time series dataset and do not contain personally identifiable information.
328
+
329
+ 5. If you used crowdsourcing or conducted research with human subjects...
330
+
331
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
332
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
333
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/ZD7Ll4pAw7C/ZD7Ll4pAw7C.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/_0kaDkv3dVf/_0kaDkv3dVf.md ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HW-NAS-BENCH: HARDWARE-AWARE NEURAL ARCHITECTURE SEARCH BENCHMARK
2
+
3
+ Chaojian Li, Zhongzhi Yu, Yonggan Fu, Yongan Zhang, Yang Zhao, Haoran You, Qixuan Yu,
4
+ Yue Wang & Yingyan Lin
5
+ Department of Electrical and Computer Engineering
6
+ Rice University
7
+ {cl114,zy42,yf22,yz87,zy34,hy34,qy12,yw68,yingyan.lin}@rice.edu
8
+
9
+ # ABSTRACT
10
+
11
+ HardWare-aware Neural Architecture Search (HW-NAS) has recently gained tremendous attention by automating the design of deep neural networks deployed in more resource-constrained daily life devices. Despite its promising performance, developing optimal HW-NAS solutions can be prohibitively challenging as it requires cross-disciplinary knowledge in the algorithm, micro-architecture, and device-specific compilation. First, to determine the hardware-cost to be incorporated into the NAS process, existing works mostly adopt either pre-collected hardware-cost look-up tables or device-specific hardware-cost models. The former can be time-consuming due to the required knowledge of the device’s compilation method and how to set up the measurement pipeline, while building the latter is often a barrier for non-hardware experts like NAS researchers. Both of them limit the development of HW-NAS innovations and impose a barrier-to-entry to non-hardware experts. Second, similar to generic NAS, it can be notoriously difficult to benchmark HW-NAS algorithms due to their significant required computational resources and the differences in adopted search spaces, hyperparameters, and hardware devices. To this end, we develop HW-NAS-Bench, the first public dataset for HW-NAS research which aims to democratize HW-NAS research to non-hardware experts and make HW-NAS research more reproducible and accessible. To design HW-NAS-Bench, we carefully collected the measured/estimated hardware performance (e.g., energy cost and latency) of all the networks in the search spaces of both NAS-Bench-201 and FBNet, on six hardware devices that fall into three categories (i.e., commercial edge devices, FPGA, and ASIC). Furthermore, we provide a comprehensive analysis of the collected measurements in HW-NAS-Bench to provide insights for HW-NAS research. Finally, we demonstrate exemplary user cases to (1) show that HW-NAS-Bench allows non-hardware experts to perform HW-NAS by simply querying our premeasured dataset and (2) verify that dedicated device-specific HW-NAS can indeed lead to optimal accuracy-cost trade-offs. The codes and all collected data are available at https://github.com/RICE-EIC/HW-NAS-Bench.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The recent performance breakthroughs of deep neural networks (DNNs) have attracted an explosion of research in designing efficient DNNs, aiming to bring powerful yet power-hungry DNNs into more resource-constrained daily life devices for enabling various DNN-powered intelligent functions (Ross, 2020; Liu et al., 2018b; Shen et al., 2020; You et al., 2020a). Among them, HardWareaware Neural Architecture Search (HW-NAS) has emerged as one of the most promising techniques as it can automate the process of designing optimal DNN structures for the target applications, each of which often adopts a different hardware device and requires a different hardware-cost metric (e.g., prioritizes latency or energy). For example, HW-NAS in (Wu et al., 2019) develops a differentiable neural architecture search (DNAS) framework and discovers state-of-the-art (SOTA) DNNs balancing both accuracy and hardware efficiency, by incorporating a loss consisting of both the cross-entropy loss that leads to better accuracy and the latency loss that penalizes the network’s latency on a target device.
16
+
17
+ ![](images/4188dc268cb15f00e2fe476ecbe2199db807c269e72006ebddc40c20057dbf9c.jpg)
18
+ Figure 1: An illustration of our proposed HW-NAS-Bench
19
+
20
+ Despite the promising performance achieved by SOTA HW-NAS, there exist paramount challenges that limit the development of HW-NAS innovations. First, HW-NAS requires the collection of hardware efficiency data corresponding to (all) the networks in the search space. To do so, current practice either pre-collects these data to construct a hardware-cost look-up table or adopts device-specific hardware-cost estimators/models, both of which can be time-consuming to obtain and impose a barrier-to-entry to non-hardware experts. This is because it requires knowledge about device-specific compilation and properly setting up the hardware measurement pipeline to collect hardware-cost data. Second, similar to generic NAS, it can be notoriously difficult to benchmark HW-NAS algorithms due to the required significant computational resources and the differences in their (1) hardware devices, which are specific for HW-NAS, (2) adopted search spaces, and (3) hyperparameters. Such a difficulty is even higher for HW-NAS considering the numerous choices of hardware devices, each of which can favor very different network structures even under the same target hardware efficiency, as discussed in (Chu et al., 2020). While the number of floating-point operations (FLOPs) has been commonly used to estimate the hardware-cost, many works have pointed out that DNNs with fewer FLOPs are not necessarily faster or more efficient (Wu et al., 2019; 2018; Wang et al., 2019b). For example, NasNet-A (Zoph et al., 2018) has a comparable complexity in terms of FLOPs as MobileNetV1 (Howard et al., 2017), yet can have a larger latency than the latter due to NasNet-A (Zoph et al., 2018)’s adopted hardware-unfriendly structure.
21
+
22
+ It is thus imperative to address the aforementioned challenges in order to make HW-NAS more accessible and reproducible to unfold HW-NAS’s full potential. Note that although pioneering NAS benchmark datasets (Ying et al., 2019; Dong & Yang, 2020; Klyuchnikov et al., 2020; Siems et al., 2020; Dong et al., 2020) have made a significant step towards providing a unified benchmark dataset for generic NAS works, all of them either merely provide the latency on server-level GPUs (e.g., GTX 1080Ti) or do not provide any hardware-cost data on real hardware, limiting their applicability to HW-NAS (Wu et al., 2019; Wan et al., 2020; Cai et al., 2018) which primarily targets commercial edge devices, FPGA, and ASIC. To this end, as shown in Figure 1, we develop HW-NAS-Bench and make the following contributions in this paper:
23
+
24
+ • We have developed HW-NAS-Bench, the first public dataset for HW-NAS research aiming to (1) democratize HW-NAS research to non-hardware experts and (2) facilitate a unified benchmark for HW-NAS to make HW-NAS research more reproducible and accessible, covering two SOTA NAS search spaces including NAS-Bench-201 and FBNet, with the former being one of the most popular NAS search spaces and the latter having been shown to be one of the most hardware friendly NAS search spaces. • We provide hardware-cost data collection pipelines for six commonly used hardware devices that fall into three categories (i.e., commercial edge devices, FPGA, and ASIC), in addition to the measured/estimated hardware-cost (e.g., energy cost and latency) on these devices for all the networks in the search spaces of both NAS-Bench-201 and FBNet. • We conduct comprehensive analysis of the collected data in HW-NAS-Bench, such as studying the correlation between the collected hardware-cost and accuracy-cost data of all the networks on the six hardware devices, which provides insights to not only HW-NAS researchers but also DNN accelerator designers. Other researchers can extract useful insights from HW-NAS-Bench that have not been discussed in this work.
25
+
26
+ • We demonstrate exemplary user cases to show: (1) how HW-NAS-Bench can be easily used by non-hardware experts to develop HW-NAS solutions by simply querying the collected data in our HW-NAS-Bench and (2) dedicated device-specific HW-NAS can indeed lead to optimal accuracy-cost trade-offs, demonstrating the great necessity of HW-NAS benchmarks like our proposed HW-NAS-Bench.
27
+
28
+ # 2 RELATED WORKS
29
+
30
+ # 2.1 HARDWARE-AWARE NEURAL ARCHITECTURE SEARCH
31
+
32
+ Driven by the growing demand for efficient DNN solutions, HW-NAS has been proposed to automate the search for efficient DNN structures under the target efficiency constraints (Fu et al., 2020b;a; Zhang et al., 2020). For example, (Tan et al., 2019; Howard et al., 2019; Tan & Le, 2019) adopt reinforcement learning based NAS with a multi-objective reward consisting of both the task performance and efficiency, achieving promising results yet suffering from prohibitive search time/cost. In parallel, (Wu et al., 2019; Wan et al., 2020; Cai et al., 2018; Stamoulis et al., 2019) explore the design space in a differentiable manner following (Liu et al., 2018a) and significantly improve the search efficiency. The promising performance of HW-NAS has motivated a tremendous interest in applying it to more diverse applications (Fu et al., 2020a; Wang et al., 2020a; Marchisio et al., 2020) paired with target hardware devices, e.g., Edge TPU (Xiong et al., 2020) and NPU (Lee et al., 2020), in addition to the widely explored mobile phones.
33
+
34
+ As discussed in (Chu et al., 2020), different hardware devices can favor very different network structures under the same hardware-cost metric, and the optimal network structure can differ significantly when considering different application-driven hardware-cost metrics on the same hardware device. As such, it would ideally lead to the optimal accuracy-cost trade-offs if the HW-NAS design is dedicated for the target device and hardware-cost metrics. However, this requires a good understanding of both device-specific compilation and hardware-cost characterization, imposing a barrier-to-entry to non-hardware experts, such as many NAS researchers, and thus limits the development of optimal HW-NAS results for numerous applications, each of which often prioritizes a different application-driven hardware-cost metric and adopts a different type of hardware devices. As such, our proposed HW-NAS-Bench will make HW-NAS more friendly to NAS researchers, who are often non-hardware experts, as it consists of comprehensive hardware-cost data in a wide range of hardware devices for all the networks in two commonly used SOTA NAS search spaces, expediting the development of HW-NAS innovations.
35
+
36
+ # 2.2 NEURAL ARCHITECTURE SEARCH BENCHMARKS
37
+
38
+ The importance and difficulty of NAS reproducibility and benchmarking has recently gained increasing attention. Pioneering efforts include (Ying et al., 2019; Dong & Yang, 2020; Klyuchnikov et al., 2020; Siems et al., 2020; Dong et al., 2020). Specifically, NAS-Bench-101 (Ying et al., 2019) presents the first large-scale and open-source architecture dataset for NAS, in which the ground truth test accuracy of all the architectures (i.e., 423k) in its search space on CIFAR-10 (Krizhevsky et al., 2009) are provided. Later, NAS-Bench-201 (Dong & Yang, 2020) further extends NAS-Bench-101 to support more NAS algorithm categories (e.g., differentiable algorithms) and more datasets (e.g., CIFAR-100 (Krizhevsky et al., 2009) and ImageNet16-120 (Chrabaszcz et al., 2017)). Most recently, NAS-Bench-301 (Siems et al., 2020) and NATS-Bench (Dong et al., 2020) are developed to support benchmarking NAS algorithms on larger search spaces. However, all of these works either merely provide latency on the server-level GPU (e.g., GTX 1080Ti) or do not consider any hardware-cost data on real hardware at all, limiting their applicability to HW-NAS (Wu et al., 2019; Wan et al., 2020; Cai et al., 2018) that primarily targets commercial edge devices, FPGA (Wang et al., 2020b), and ASIC (Chen et al., 2016; Lin et al., 2017; 2016; Zhao et al., 2020a). This has motivated us to develop the proposed HW-NAS-Bench, which aims to make HW-NAS more accessible especially for non-hardware experts and reproducible.
39
+
40
+ A concurrent work (published after our submission) is BRP-NAS (Chau et al., 2020), which presents a benchmark for the latency of all the networks in NAS-Bench-201 (Dong & Yang, 2020) search space. In comparison, our proposed HW-NAS-Bench includes (1) more device categories (i.e., not only commercial devices, but also FPGA (Wang et al., 2020b) and ASIC (Chen et al., 2016)), (2) more hardware-cost metrics (i.e., not only latency, but also energy), and (3) more search spaces (i.e., not only NAS-Bench-201 (Dong & Yang, 2020) but also FBNet (Wu et al., 2019)). Additionally, we (4) add a detailed description of the pipeline to collect the hardware-cost of various devices and (5) analyze the necessity of device-specific HW-NAS solutions based on our collected data.
41
+
42
+ # 3 THE PROPOSED HW-NAS-BENCH FRAMEWORK
43
+
44
+ # 3.1 HW-NAS-BENCH’S CONSIDERED SEARCH SPACES
45
+
46
+ To ensure a wide applicability, our HW-NAS-Bench considers two representative NAS search spaces: (1) NAS-Bench-201’s cell-based search space and (2) FBNet search space. Both contribute valuable aspects to ensure our goal of constructing a comprehensive HW-NAS benchmark. Specifically, the former enables HW-NAS-Bench to naturally integrate the ground truth accuracy data of all NAS-Bench-201’s considered network architectures, while the latter ensures that HW-NASBench includes the most commonly recognized hardware friendly search space.
47
+
48
+ NAS-Bench-201 Search Space. Inspired from the search space used in the most popular cell-based NAS, NAS-Bench-201 adopts a fixed cell search space, where each architecture consists of a predefined skeleton with a stack of the searched cell that is represented as a densely-connected directed acyclic graph (DAG). Specifically, it considers 4 nodes and 5 representative operation candidates for the operation set, and varies the feature map sizes and the dimensions of the final fully-connected layer to handle its considered three datasets (i.e., CIFAR-10, CIFAR-100 (Krizhevsky et al., 2009), and ImageNet16-120 (Chrabaszcz et al., 2017)), leading to a total of $3 \times 5 ^ { 6 } = 4 6 8 7 5$ architectures. Training log and accuracy are provided for each architecture. However, NAS-Bench-201 can not be directly used for HW-NAS as it only includes theoretical cost metrics (i.e., FLOPs and the number of parameters (#Params)) and the latency on a server-level GPU (i.e., GTX 1080Ti). HW-NASBench enhances NAS-Bench-201 by providing all the 46875 architectures’ measured/estimated hardware-cost on six devices, which are primarily targeted by SOTA HW-NAS works.
49
+
50
+ FBNet Search Space. FBNet (Wu et al., 2019) constructs a layer-wise search space with a fixed macro-architecture, which defines the number of layers and the input/output dimensions of each layer and fixes the first and last three layers with the remaining layers to be searched. In this way, the network architectures in the FBNet (Wu et al., 2019) search space have more regular structures than those in NAS-Bench-201, and have been shown to be more hardware friendly (Fu et al., 2020a; Ma et al., 2018). The 9 considered pre-defined cell candidates and 22 unique positions lead to a total of $9 ^ { 2 2 } \approx 1 0 ^ { 2 1 }$ unique architectures. While HW-NAS researchers can develop their search algorithms on top of the FBNet (Wu et al., 2019) search space, tedious efforts are required to build the hardware-cost look-up tables or models for each target device. HW-NAS-Bench provides the measured/estimated hardware-cost on six hardware devices for all the $1 0 ^ { 2 1 }$ architectures in the FBNet search space, aiming to make HW-NAS research more friendly to non-hardware experts and easier to be benchmarked.
51
+
52
+ # 3.2 HARDWARE-COST COLLECTION PIPELINE AND THE CONSIDERED DEVICES
53
+
54
+ To collect the hardware-cost data for all the architectures in both the NAS-Bench-201 and FBNet search spaces, we construct a generic hardware-cost collection pipeline (see Figure 2) to automate the process. The pipeline mainly consists of the target devices and corresponding deployment tools (e.g., compilers). Specifically, it takes all the networks as its inputs, and then compiles the networks to (1) convert them into the device’s required execution format and (2) optimize the execution flow, the latter of which aims to optimize the hardware performance on the target devices. For example, for collecting the hardware-cost in an Edge GPU, we first set the device in the Max-N mode to fully make use of all available resources following (Wofk et al., 2019), and then set up the embedded power rail monitor (Texas Instruments Inc.) to obtain the real-measured latency and energy via sysfs (Patrick Mochel and Mike Murphy.), averaging over 50 runs. We can see that the hardware-cost collection pipeline requires various hardware domain knowledge, including machine learning development frameworks, device compilation, embedded systems, and device measurements, imposing a barrier-to-entry to non-hardware experts.
55
+
56
+ ![](images/6930869f661da4f5c2287731b45b878afa28f2eaaeea54cc5860b428437743c0.jpg)
57
+ Figure 2: Illustrating the hardware-cost collection pipeline applicable to various hardware devices.
58
+
59
+ Next, we briefly introduce the six considered hardware devices (as summarized in Table 1) and the specific configuration required to collect the hardware-cost data on each device.
60
+
61
+ Edge GPU: NVIDIA Edge GPU Jetson TX2 (Edge GPU) is a commercial device with a 256-core Pascal GPU and a 8GB LPDDR4, targeting IoT applications (NVIDIA Inc., a). When plugging an Edge GPU into the above hardware-cost collection pipeline, we first compile the network architectures in both NAS-Bench-201 and FBNet spaces to (1) convert them to the TensorRT format and (2) optimize the inference implementation within NVIDIA’s recommended TensorRT runtime environment, and then execute them in the Edge GPU to measure the consumed energy and latency.
62
+
63
+ Raspi 4: Raspberry Pi 4 (Raspi 4) is the latest Raspberry Pi device (Raspberry Pi Limited.), consisting of a Broadcom BCM2711 SoC and a 4GB LPDDR4. To collect the hardware-cost operating on it, we compile the architecture candidates to (1) convert them into the TensorFlow Lite (TFLite) (Abadi et al., 2016) format and (2) optimize the implementation using the official interpreter (Google LLC., 2020) in Raspi 4, where the interpreter will be pre-configured.
64
+
65
+ Edge TPU: An Edge TPU Dev Board (Edge TPU) (Google LLC., a) is a dedicated ASIC accelerator developed by Google, targeting Artificial Intelligence (AI) inference for edge applications. Similar to the case when using Raspi 4, all the architectures are converted into the TFLite format. After that, an Edge TPU compiler will be used to convert the pre-built TFLite model into a more compressed format which is compatible to the pre-configured runtime environment in the Edge TPU.
66
+
67
+ Pixel 3: Pixel 3 is one of the latest Pixel mobile phones (Google LLC., e), which are widely used as the target platforms by recent NAS works (Xiong et al., 2020; Howard et al., 2019; Tan et al., 2019). To collect the hardware-cost in Pixel 3, we first convert all the architectures into the TFLite format, then use TFLite’s official benchmark binary file to obtain the latency, when configuring the Pixel 3 device to only use its big cores for reducing the measurement variance as in (Xiong et al., 2020; Tan et al., 2019).
68
+
69
+ ASIC-Eyeriss: For collecting the hardware-cost data in ASIC, we consider a SOTA ASIC accelerator, Eyeriss (Chen et al., 2016). Specifically, we adopt the SOTA ASIC accelerator’s performance simulators: (1) Accelergy (Wu et al., 2019) $+$ Timeloop (Parashar et al., 2019) and (2) DNN-Chip Predictor (Zhao et al., 2020b), both of which automatically identify the optimal algorithm-to-hardware mapping methods for each architecture and then provide the estimated hardware-cost of the network execution in Eyeriss.
70
+
71
+ Table 1: Important details about the six hardware devices considered by our HW-NAS-Bench.
72
+
73
+ <table><tr><td>Devices</td><td>Edge GPU</td><td>Raspi 4</td><td>Edge TPU</td><td>Pixel3</td><td>ASIC-Eyeriss</td><td>FPGA</td></tr><tr><td>Collected Metrics</td><td>Latency (ms) Energy (mJ)</td><td>Latency (ms)</td><td>Latency (ms)</td><td>Latency (ms)</td><td>Latency (ms) Energy (mJ)</td><td>Latency (ms) Energy (mJ)</td></tr><tr><td>Collecting Method</td><td>Measured</td><td>Measured</td><td>Measured</td><td>Measured</td><td>Estimated</td><td>Estimated</td></tr><tr><td>Runtime Environment</td><td>TensorRT</td><td>TensorFlow Lite</td><td>Edge TPU Runtime</td><td>TensorFlow Lite</td><td>Accelergy+Timeloop / DNN-Chip Predictor</td><td>Vivado HLS</td></tr><tr><td>Customizing Hardware?</td><td>X</td><td>×</td><td>X</td><td>X</td><td>√</td><td>√</td></tr><tr><td>Category I</td><td colspan="3">Commercial Edge Devices</td><td></td><td>ASIC</td><td>FPGA</td></tr></table>
74
+
75
+ Table 2: Two types of correlation coefficients (larger means more correlated) between the realmeasured hardware-cost of the whole architectures and the approximated hardware-cost based on 100 randomly sampled architectures from the FBNet search space.
76
+
77
+ <table><tr><td>Correlation Coefficient Types</td><td>Datasets</td><td>Latency on Edge GPU</td><td>Energy on Edge GPU</td><td>Latency on Raspi 4</td><td>Latency on Edge TPU</td><td>Latency on Pixel3</td></tr><tr><td>Pearson Correlation Coefficient</td><td>CIFAR-100 ImageNet</td><td>0.9200 0.8634</td><td>0.9116 0.9640</td><td>0.9219 0.9897</td><td>0.4935 0.7153</td><td>0.9324 0.9162</td></tr><tr><td>Kendall Rank Correlation Coefficient</td><td>CIFAR-100 ImageNet</td><td>0.7373 0.7111</td><td>0.7240 0.8379</td><td>0.7470 0.9163</td><td>0.3551 0.5806</td><td>0.8593 0.8064</td></tr></table>
78
+
79
+ FPGA: FPGA is a widely adopted AI acceleration platform featuring a higher hardware flexibility than ASIC and more decent hardware efficiency than commercial edge devices. To collect hardwarecost data in this platform, we first develop a SOTA chunk based pipeline structure (Shen et al., 2017; Zhang et al., 2020) implementation, compile all the architectures using the standard Vivado HLS toolflow (Xilinx Inc., a), and then obtain the hardware-cost on a Xilinx ZC706 board with a Zynq XC7045 SoC (Xilinx Inc., b).
80
+
81
+ More details about the pipeline for each of the aforementioned devices are provided in the Appendix D for better understanding.
82
+
83
+ In our HW-NAS-Bench, to estimate the hardware-cost of the networks in the FBNet search space (Wu et al., 2019) when being executed on the commercial edge devices (i.e., Edge GPU, Raspi 4, Edge TPU, and Pixel 3), we sum up the hardware-cost of all unique blocks (i.e., “block” in the FBNet space (Wu et al., 2019)) within the network architectures. To validate that such an approximation is close to the corresponding real-measured results, we conduct experiments, as summarized in Table 2, to calculate two types of correlation coefficients between the measured and the approximated hardware-cost based on 100 randomly sampled architectures from the FBNet search space. We can see that our approximated hardware-cost is highly correlated with the real-measured one, except for the case on the Edge TPU, which we conjecture is caused by the adopted in-house Edge TPU compiler (Google LLC., c). More visualization results can be found in the Appendix A.
84
+
85
+ # 4 ANALYSIS ON HW-NAS-BENCH
86
+
87
+ In this section, we provide analysis and visualization of the hardware-cost and corresponding accuracy data (the latter only for architectures in NAS-Bench-201) for all the architectures in the two considered search spaces. Specifically, our analysis and visualization confirm that (1) commonly used theoretical hardware-cost metrics such as FLOPs do not correlate well with the measured/estimated hardware-cost; (2) hardware-cost of the same architectures can differ a lot when executed on different devices; and (3) device-specific HW-NAS is necessary because optimal architectures resulting from HW-NAS targeting on one device can perform poorly in terms of the hardware-cost when being executed on another device.
88
+
89
+ # 4.1 CORRELATION BETWEEN COLLECTED HARDWARE-COST AND THEORETICAL ONES
90
+
91
+ To confirm whether commonly used theoretical hardware-cost metrics align with realmeasured/estimated ones, we summarize the calculated correlation between the collected hardwarecost in our HW-NAS-Bench and the theoretical metrics (i.e., FLOPs and #Params), based on the data for all the architectures in both search spaces on all the six considered hardware devices where a total of four different datasets are involved.
92
+
93
+ Table 3: Kendall Rank Correlation Coefficient between real-measured/estimated hardware-cost and theoretical ones considering the NAS-Bench-201 search space, where coefficients $< 0 . 5$ are bolded.
94
+
95
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">Metrics</td><td colspan="2">Edge GPU</td><td rowspan="2">Raspi 4 Latency</td><td rowspan="2">Edge TPU Latency</td><td rowspan="2">Pixel3 Latency</td><td colspan="2">ASIC-Eyeriss Energy</td><td colspan="2">FPGA</td></tr><tr><td>Latency</td><td>Energy</td><td></td><td>Latency</td><td>Latency</td><td>Energy</td></tr><tr><td>CIFAR-10</td><td>FLOPs #Params</td><td>0.3571 0.3571</td><td>0.4064 0.4064</td><td>0.7394 0.7394</td><td>0.1847 0.1847</td><td>0.6823 0.6823</td><td>0.4178 0.4178</td><td>0.5359 0.5359</td><td>0.8313 0.8313</td><td>0.8313 0.8313</td></tr><tr><td>CIFAR-100</td><td>FLOPs #Params</td><td>0.3589 0.3589</td><td>0.4073 0.4073</td><td>0.7384 0.7384</td><td>0.1851 0.1851</td><td>0.6844 0.6844</td><td>0.4197 0.4197</td><td>0.5360 0.5360</td><td>0.8313 0.8313</td><td>0.8313 0.8313</td></tr><tr><td>ImageNet16-120</td><td>FLOPs #Params</td><td>0.3544 0.3544</td><td>0.3868 0.3868</td><td>0.6303 0.6303</td><td>0.2635 0.2635</td><td>0.7017 0.7017</td><td>0.4166 0.4166</td><td>0.5363 0.5363</td><td>0.9205 0.9205</td><td>0.9205 0.9205</td></tr></table>
96
+
97
+ Table 4: Kendall Rank Correlation Coefficient between real-measured/estimated hardware-cost and theoretical ones considering the FBNet search space, where coefficients $< 0 . 5$ are bolded.
98
+
99
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">Metrics</td><td colspan="2">Edge GPU</td><td rowspan="2">Raspi 4 Latency</td><td rowspan="2">Pixel 3 Latency</td><td colspan="2">ASIC-Eyeriss</td><td colspan="2">FPGA</td></tr><tr><td>Latency</td><td>Energy</td><td>Latency</td><td>Energy</td><td>Latency</td><td>Energy</td></tr><tr><td>CIFAR-100</td><td>FLOPs #Params</td><td>0.0149 -0.0733</td><td>0.1564 0.0202</td><td>0.7713 0.4910</td><td>0.8092 0.3734</td><td>0.8490 0.4297</td><td>0.7854 0.6455</td><td>0.8710 0.5151</td><td>0.8710 0.5151</td></tr><tr><td>ImageNet</td><td>FLOPs #Params</td><td>0.4633 0.0985</td><td>0.6094 0.1840</td><td>0.7531 0.2318</td><td>0.7678 0.2357</td><td>0.8935 0.3202</td><td>0.7970 0.4140</td><td>0.8643 0.4198</td><td>0.8643 0.4198</td></tr></table>
100
+
101
+ As summarized in Tables 3 - 4, commonly used theoretical hardware-cost metrics (i.e., FLOPs and #Params) do not always correlate well with measured/estimated hardware-cost for the architectures in both the NAS-Bench-201 and FBNet spaces. For example, there exists at least one coefficient $< 0 . 5$ on all devices, especially for the cases with real-measured/estimated hardware-cost on commonly considered edge platforms including Edge GPU, Edge TPU, and ASIC-Eyeriss. As such, HW-NAS based on the theoretical hardware-cost might lead to sub-optimal results, motivating HWNAS benchmarks like our HW-NAS-Bench. Note that we consider the Kendall Rank Correlation Coefficients (Abdi, 2007), which is a commonly used correlation coefficient in both recent NAS frameworks and benchmarks (You et al., 2020b; Siems et al., 2020; Yang et al., 2020).
102
+
103
+ # 4.2 CORRELATION AMONG COLLECTED HARDWARE-COST ON DIFFERENT DEVICES
104
+
105
+ To check how much the hardware-cost of the same architectures on different devices correlate, we visualize the correlation between the hardware-cost collected from every two paired devices based on the data for all the architectures in both the NAS-Bench-201 and FBNet search spaces with each of the architectures associated with 9 different hardware-cost metrics.
106
+
107
+ ![](images/5b00a372d68ed46b998416b2c65f7210e4247bee86e06330149e20d42a08d01d.jpg)
108
+ Figure 3: Kendall Rank Correlation Coefficient between real-measured/estimated hardware-cost in different devices considering the NAS-Bench-201 search space.
109
+
110
+ ![](images/1dd2bfb1186711d15a7282746f71350abeb845fe70f66e4fed31092bb8d8c07e.jpg)
111
+ Figure 4: Kendall Rank Correlation Coefficient between real-measured/estimated hardware-cost in different devices considering the FBNet search space.
112
+
113
+ ![](images/00dbdf204f58baf47177a9850fc6de86be428b6a7ae3c8dc0026a669da7e268d.jpg)
114
+ Figure 5: Accuracy vs. hardware-cost on different devices considering NAS-Bench-201, where points in red denote the architectures with the optimal trade-offs between “accuracy on ImageNet16- 120 vs. latency measured on Edge GPU”, of which the architectures represent the ground truth of HW-NAS targeting Edge GPUs.
115
+
116
+ The visualization in Figures 3 - 4 indicates that hardware-cost of the same network architectures can differ a lot when being executed on different devices. More specifically, the correlation coefficients can be as small as -0.00 (e.g., Edge GPU latency vs. ASIC-Eyeriss energy for the architectures in the FBNet search space), which is resulting from the large difference in their underlying (1) hardware micro-architectures and (2) available hardware resources. Thus, the resulting architecture of HW-NAS targeting one device might perform poorly when being executed on other devices, motivating device-specific HW-NAS; Furthermore, it is crucial to develop comprehensive hardwarecost datasets like our HW-NAS-Bench to enable fast development and ensure optimal results of HW-NAS for different applications.
117
+
118
+ # 4.3 OPTIMAL ARCHITECTURES ON DIFFERENT HARDWARE DEVICES
119
+
120
+ To confirm the necessity of performing device-specific HW-NAS from another perspective, we summarize the test accuracy vs. hardware-cost of all the architectures in NAS-Bench-201 considering the ImageNet16-120 dataset, and analyze the architectures with the optimal accuracy-cost trade-offs for different devices.
121
+
122
+ As shown in Figure 5, such optimal architectures for different devices are not the same. For example, the optimal architectures on Edge GPU (marked as red points) can perform poorly in terms of the hardware-cost in other devices, especially in ASIC-Eyeriss and Edge TPU whose hardware-cost exactly has the smallest correlation coefficient with the hardware-cost measured in Edge GPU, which is shown in Figure 3. Again, this set of analysis and visualization confirms that HW-NAS targeting on one device can perform poorly in terms of the hardware-cost when being executed on another device, thus motivating the necessity of device-specific HW-NAS.
123
+
124
+ # 5 USER CASES: BENCHMARK SOTA HW-NAS ALGORITHMS
125
+
126
+ In this section, we will demonstrate the user cases of our HW-NAS-Bench to show (1) how nonhardware experts can use it to develop HW-NAS solutions by simply querying the hardware-cost data and (2) dedicated device-specific HW-NAS can indeed often lead to optimal accuracy-cost trade-offs, again showing the important need for HW-NAS benchmarks like our HW-NAS-Bench to enable more optimal HW-NAS solutions via device-specific HW-NAS.
127
+
128
+ Table 5: Inference accuracy and latency comparison of the optimal architectures resulting from HW-NAS-Bench when targeting different hardware devices.
129
+
130
+ <table><tr><td>Targeted Device in HW-NAS</td><td>Top-1 Acc.(%)</td><td>Latency on Edge GPU (ms)</td><td>Latency on Raspi 4 (ms)</td><td>Latency on FPGA (ms)</td></tr><tr><td>Edge GPU</td><td>74.11</td><td>9.96</td><td>31.01</td><td>20.19</td></tr><tr><td>Raspi 4</td><td>73.46</td><td>13.88</td><td>22.91</td><td>15.39</td></tr><tr><td>FPGA</td><td>73.51</td><td>20.65</td><td>25.43</td><td>13.96</td></tr></table>
131
+
132
+ Benchmark Setting. We adopt a SOTA HW-NAS algorithm, ProxylessNAS (Cai et al., 2018) for this experiment. As an example to use our HW-NAS-Bench, we use ProxylessNAS to search over the FBNet (Wu et al., 2019) search space on CIFAR-100 (Krizhevsky et al., 2009), when targeting different devices in our HW-NAS-Bench by simply querying the corresponding device’s measured/estimated hardware-cost, which has negligible overhead as compared to the HW-NAS algorithm itself, without the need for hardware expertise or knowledge during the whole HW-NAS.
133
+
134
+ # 5.1 OPTIMAL ARCHITECTURES RESULTING FROM DEVICE-SPECIFIC HW-NAS
135
+
136
+ Table 5 illustrates that the searched architectures achieve the lowest latency among all architectures when the target devices of HW-NAS are the same as the one used to measure the architecture’s on-device inference latency. Specifically, when being executed on an Edge GPU, the searched architecture targeting Raspi 4 during HW-NAS leads to about a $5 0 \%$ higher latency, while the searched architecture targeting FPGA during HW-NAS introduces over a $1 0 0 \%$ higher latency, than the architecture specifically target on the Edge GPU during HW-NAS, under the same inference accuracy. This set of experiments shows that non-hardware experts can easily use our HW-NAS-Bench to develop optimal HW-NAS solutions, and demonstrates that device-specific HW-NAS is critical to guarantee the searched architectures’ on-device performance.
137
+
138
+ # 6 CONCLUSION
139
+
140
+ We have developed HW-NAS-Bench, the first public dataset for HW-NAS research aiming to (1) democratize HW-NAS research to non-hardware experts and (2) facilitate a unified benchmark for HW-NAS to make HW-NAS research more reproducible and accessible. Our HW-NAS-Bench covers two representative NAS search spaces, and provides all network architectures’ hardware-cost data on six commonly used hardware devices that fall into three categories (i.e., commercial edge devices, FPGA, and ASIC). Furthermore, we conduct comprehensive analysis of the collected data in HW-NAS-Bench, aiming to provide insights to not only HW-NAS researchers but also DNN accelerator designers. Finally, we demonstrate exemplary user cases of HW-NAS-Bench to show: (1) how HW-NAS-Bench can be easily used by non-hardware experts via simply querying the collected data to develop HW-NAS solutions and (2) dedicated device-specific HW-NAS can indeed lead to optimal accuracy-cost trade-offs, demonstrating the great necessity of HW-NAS benchmarks like our proposed HW-NAS-Bench. It is expected that our HW-NAS-Benchcan significantly expedite and facilitate HW-NAS research innovations.
141
+
142
+ # ACKNOWLEDGEMENT
143
+
144
+ The work is supported by the National Science Foundation (NSF) through the CNS Division of Computer and Network Systems (Award number: 2016727).
145
+
146
+ # REFERENCES
147
+
148
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for large-scale machine learning. In 12th {USENIX} symposium on operating systems design and implementation ({OSDI} 16), pp. 265–283, 2016.
149
+
150
+ Herve Abdi. The kendall rank correlation coefficient. ´ Encyclopedia of Measurement and Statistics. Sage, Thousand Oaks, CA, pp. 508–510, 2007.
151
+
152
+ Junjie Bai, Fang Lu, Ke Zhang, et al. Onnx: Open neural network exchange. https://github. com/onnx/onnx, 2020.
153
+
154
+ Samik Basu, Mahasweta Ghosh, and Soma Barman. Raspberry pi $^ { 3 \mathrm { b + } }$ based smart remote health monitoring system using iot platform. In Proceedings of the 2nd International Conference on Communication, Devices and Computing, pp. 473–484. Springer, 2020.
155
+
156
+ Jacob Benesty, Jingdong Chen, Yiteng Huang, and Israel Cohen. Pearson correlation coefficient. In Noise reduction in speech processing, pp. 1–4. Springer, 2009.
157
+
158
+ Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. arXiv preprint arXiv:1812.00332, 2018.
159
+
160
+ Thomas Chau, Łukasz Dudziak, Mohamed S Abdelfattah, Royson Lee, Hyeji Kim, and Nicholas D Lane. Brp-nas: Prediction-based nas using gcns. Advances in Neural Information Processing Systems, 2020.
161
+
162
+ Y. Chen, T. Krishna, J. Emer, and V. Sze. Eyeriss: An energy-efficient reconfigurable accelerator for deep convolutional neural networks. JSSC 2017, 52(1):127–138, 2017.
163
+
164
+ Yu-Hsin Chen, Joel Emer, and Vivienne Sze. Eyeriss: A spatial architecture for energy-efficient dataflow for convolutional neural networks. ACM SIGARCH Computer Architecture News, 44 (3):367–379, 2016.
165
+
166
+ Yu-Hsin Chen, Tushar Krishna, Joel Emer, and Vivienne Sze. Eyeriss: An EnergyEfficient Reconfigurable Accelerator for Deep Convolutional Neural Networks. In IEEE International Solid-State Circuits Conference, ISSCC 2016, Digest of Technical Papers, pp. 262–263, 2016.
167
+
168
+ Franc¸ois Chollet et al. Keras. https://keras.io, 2015.
169
+
170
+ Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of imagenet as an alternative to the cifar datasets. arXiv preprint arXiv:1707.08819, 2017.
171
+
172
+ Grace Chu, Okan Arikan, Gabriel Bender, Weijun Wang, Achille Brighton, Pieter-Jan Kindermans, Hanxiao Liu, Berkin Akin, Suyog Gupta, and Andrew Howard. Discovering multi-hardware mobile models via architecture search. arXiv preprint arXiv:2008.08178, 2020.
173
+
174
+ Xuanyi Dong and Yi Yang. Nas-bench-201: Extending the scope of reproducible neural architecture search. In International Conference on Learning Representations (ICLR), 2020. URL https: //openreview.net/forum?id ${ . } = { }$ HJxyZkBKDr.
175
+
176
+ Xuanyi Dong, Lu Liu, Katarzyna Musial, and Bogdan Gabrys. Nats-bench: Benchmarking nas algorithms for architecture topology and size. arXiv preprint arXiv:2009.00437, 2020.
177
+
178
+ Yonggan Fu, Wuyang Chen, Haotao Wang, Haoran Li, Yingyan Lin, and Zhangyang Wang. Autogan-distiller: Searching to compress generative adversarial networks. arXiv preprint arXiv:2006.08198, 2020a.
179
+
180
+ Yonggan Fu, Zhongzhi Yu, Yongan Zhang, and Yingyan Lin. Auto-agent-distiller: Towards efficient deep reinforcement learning agents via neural architecture search, 2020b.
181
+
182
+ Lukas Geiger and Plumerai Team. Larq: An open-source library for training binarized neural networks. Journal of Open Source Software, 5(45):1746, January 2020. doi: 10.21105/joss.01746. URL https://doi.org/10.21105/joss.01746.
183
+
184
+ Google LLC. Edge TPU Compiler, a. https://coral.ai/docs/dev-board/ get-started/, accessed 2020-09-01.
185
+ Google LLC. Edge TPU Code Examples, b. https://coral.ai/examples/ #code-examples, accessed 2019-11-21.
186
+ Google LLC. Edge TPU Compiler, c. https://coral.ai/docs/edgetpu/compiler/ #system-requirements, accessed 2020-09-01.
187
+ Google LLC. Edge TPU FAQ, d. https://coral.ai/docs/edgetpu/faq/, accessed 2019-11-21.
188
+ Google LLC. Pixel 3, e. https://g.co/kgs/pVRc1Y, accessed 2020-09-01.
189
+ Google LLC. TensorFlow Lite: Deploy machine learning models on mobile and IoT devices, f. https://www.tensorflow.org/lite, accessed 2019-11-21.
190
+ Google LLC. Tflite python quickstart. https://www.tensorflow.org/lite/guide/ python, 2020.
191
+ Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, et al. Searching for mobilenetv3. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1314–1324, 2019.
192
+ Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
193
+ Nikita Klyuchnikov, Ilya Trofimov, Ekaterina Artemova, Mikhail Salnikov, Maxim Fedorov, and Evgeny Burnaev. Nas-bench-nlp: Neural architecture search benchmark for natural language processing, 2020.
194
+ Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009.
195
+ Jaeseong Lee, Duseok Kang, and Soonhoi Ha. S3nas: Fast npu-aware neural architecture search methodology. arXiv preprint arXiv:2009.02009, 2020.
196
+ Chaojian Li, Tianlong Chen, Haoran You, Zhangyang Wang, and Yingyan Lin. Halo: Hardwareaware learning to optimize. In Proceedings of the European Conference on Computer Vision (ECCV), September 2020.
197
+ Y. Lin, S. Zhang, and N. R. Shanbhag. Variation-tolerant architectures for convolutional neural networks in the near threshold voltage regime. In 2016 IEEE International Workshop on Signal Processing Systems (SiPS), pp. 17–22, 2016. doi: 10.1109/SiPS.2016.11.
198
+ Y. Lin, C. Sakr, Y. Kim, and N. Shanbhag. Predictivenet: An energy-efficient convolutional neural network via zero prediction. In 2017 IEEE International Symposium on Circuits and Systems (ISCAS), pp. 1–4, 2017. doi: 10.1109/ISCAS.2017.8050797.
199
+ Hanxiao Liu, Karen Simonyan, and Yiming Yang. Darts: Differentiable architecture search. arXiv preprint arXiv:1806.09055, 2018a.
200
+ Sicong Liu, Yingyan Lin, Zimu Zhou, Kaiming Nan, Hui Liu, and Junzhao Du. On-demand deep model compression for mobile devices: A usage-driven model selection framework. MobiSys ’18, pp. 389–400. Association for Computing Machinery, 2018b. ISBN 9781450357203.
201
+ Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 116–131, 2018.
202
+ Alberto Marchisio, Andrea Massa, Vojtech Mrazek, Beatrice Bussolino, Maurizio Martina, and Muhammad Shafique. Nascaps: A framework for neural architecture search to optimize the accuracy and hardware efficiency of convolutional capsule networks. arXiv preprint arXiv:2008.08476, 2020.
203
+
204
+ NVIDIA Inc. NVIDIA Jetson TX2, a. https://www.nvidia.com/en-us/ autonomous-machines/embedded-systems/jetson-tx2/, accessed 2020-09-01.
205
+
206
+ NVIDIA Inc. Tensorrt, b.
207
+
208
+ NVIDIA Inc. Benchmark tx2 performance in googlenet with tensorrt, c.
209
+
210
+ Angshuman Parashar, Priyanka Raina, Yakun Sophia Shao, Yu-Hsin Chen, Victor A Ying, Anurag Mukkara, Rangharajan Venkatesan, Brucek Khailany, Stephen W Keckler, and Joel Emer. Timeloop: A systematic approach to dnn accelerator evaluation. In 2019 IEEE international symposium on performance analysis of systems and software (ISPASS), pp. 304–315. IEEE, 2019.
211
+
212
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, highperformance deep learning library. In Advances in neural information processing systems, pp. 8026–8037, 2019.
213
+
214
+ Patrick Mochel and Mike Murphy. sysfs - The filesystem for exporting kernel objects. https://www.kernel.org/doc/Documentation/filesystems/sysfs. txt, accessed 2019-11-21.
215
+
216
+ Raspberry Pi Limited. Raspberry 4. https://www.raspberrypi.org/products/ raspberry-pi-4-model-b/, accessed 2020-09-01.
217
+
218
+ Benjamin Ross. AI at the Edge Enabling a New Generation of Apps, Smart Devices, March 2020. URL https://www.aitrends.com/edge-computing/ ai-at-the-edge-enabling-a-new-generation-of-apps-smart-devices/.
219
+
220
+ Jianghao Shen, Yue Wang, Pengfei Xu, Yonggan Fu, Zhangyang Wang, and Yingyan Lin. Fractional skipping: Towards finer-grained dynamic cnn inference. 2020.
221
+
222
+ Yongming Shen, Michael Ferdman, and Peter Milder. Maximizing cnn accelerator efficiency through resource partitioning. In Proceedings of the 44th Annual International Symposium on Computer Architecture, ISCA ’17, pp. 535–547, New York, NY, USA, 2017. Association for Computing Machinery. ISBN 9781450348928. doi: 10.1145/3079856.3080221. URL https://doi.org/10.1145/3079856.3080221.
223
+
224
+ Mennatullah Siam, Mostafa Gamal, Moemen Abdel-Razek, Senthil Yogamani, Martin Jagersand, and Hong Zhang. A comparative study of real-time semantic segmentation for autonomous driving. In Proceedings of the IEEE conference on computer vision and pattern recognition workshops, pp. 587–597, 2018.
225
+
226
+ Julien Siems, Lucas Zimmer, Arber Zela, Jovita Lukasik, Margret Keuper, and Frank Hutter. Nasbench-301 and the case for surrogate benchmarks for neural architecture search. arXiv preprint arXiv:2008.09777, 2020.
227
+
228
+ Dimitrios Stamoulis, Ruizhou Ding, Di Wang, Dimitrios Lymberopoulos, Bodhi Priyantha, Jie Liu, and Diana Marculescu. Single-path nas: Designing hardware-efficient convnets in less than 4 hours. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 481–497. Springer, 2019.
229
+
230
+ Mingxing Tan and Quoc V Le. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019.
231
+
232
+ Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V Le. Mnasnet: Platform-aware neural architecture search for mobile. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2820–2828, 2019.
233
+
234
+ Texas Instruments Inc. INA3221 Triple-Channel, High-Side Measurement, Shunt and Bus Voltage Monitor. http://www.ti.com/product/INA3221, accessed 2019-11-21.
235
+
236
+ Alvin Wan, Xiaoliang Dai, Peizhao Zhang, Zijian He, Yuandong Tian, Saining Xie, Bichen Wu, Matthew Yu, Tao Xu, Kan Chen, et al. Fbnetv2: Differentiable neural architecture search for spatial and channel dimensions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12965–12974, 2020.
237
+
238
+ Chien-Yao Wang, Hong-Yuan Mark Liao, Ping-Yang Chen, and Jun-Wei Hsieh. Enriching variety of layer-wise learning information by gradient combination. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) Workshops, Oct 2019a.
239
+
240
+ Y. Wang, J. Shen, T. K. Hu, P. Xu, T. Nguyen, R. Baraniuk, Z. Wang, and Y. Lin. Dual dynamic inference: Enabling more efficient, adaptive, and controllable deep inference. IEEE Journal of Selected Topics in Signal Processing, 14(4):623–633, 2020a. doi: 10.1109/JSTSP.2020.2979669.
241
+
242
+ Y. Wang, J. Shen, T. K. Hu, P. Xu, T. Nguyen, R. Baraniuk, Z. Wang, and Y. Lin. Dual dynamic inference: Enabling more efficient, adaptive, and controllable deep inference. IEEE Journal of Selected Topics in Signal Processing, 14(4):623–633, 2020b. doi: 10.1109/JSTSP.2020.2979669.
243
+
244
+ Yue Wang, Ziyu Jiang, Xiaohan Chen, Pengfei Xu, Yang Zhao, Yingyan Lin, and Zhangyang Wang. E2-Train: Training state-of-the-art cnns with over $80 \%$ energy savings. In Advances in Neural Information Processing Systems, pp. 5139–5151, 2019b.
245
+
246
+ Diana Wofk, Fangchang Ma, Tien-Ju Yang, Sertac Karaman, and Vivienne Sze. Fastdepth: Fast monocular depth estimation on embedded systems. In 2019 International Conference on Robotics and Automation (ICRA), pp. 6101–6108. IEEE, 2019.
247
+
248
+ Bichen Wu, Xiaoliang Dai, Peizhao Zhang, Yanghan Wang, Fei Sun, Yiming Wu, Yuandong Tian, Peter Vajda, Yangqing Jia, and Kurt Keutzer. Fbnet: Hardware-aware efficient convnet design via differentiable neural architecture search. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10734–10742, 2019.
249
+
250
+ Junru Wu, Yue Wang, Zhenyu Wu, Zhangyang Wang, Ashok Veeraraghavan, and Yingyan Lin. Deep $k$ -means: Re-training and parameter sharing with harder cluster assignments for compressing deep convolutions. arXiv preprint arXiv:1806.09228, 2018.
251
+
252
+ Yannan N. Wu, Joel S. Emer, and Vivienne Sze. Accelergy: An ArchitectureLevel Energy Estimation Methodology for Accelerator Designs. In IEEE/ACM International Conference On Computer Aided Design (ICCAD), 2019.
253
+
254
+ Qingcheng Xiao, Yun Liang, Liqiang Lu, Shengen Yan, and Yu-Wing Tai. Exploring heterogeneous algorithms for accelerating deep convolutional neural networks on fpgas. In Proceedings of the 54th Annual Design Automation Conference 2017, DAC ’17, New York, NY, USA, 2017. Association for Computing Machinery. ISBN 9781450349277. doi: 10.1145/3061639.3062244. URL https://doi.org/10.1145/3061639.3062244.
255
+
256
+ Xilinx Inc. Vivado High-Level Synthesis, a. https://https://www.xilinx.com/ products/design-tools/vivado/integration/esl-design.html, accessed 2019-09-16.
257
+
258
+ Xilinx Inc. Xilinx zynq-7000 soc zc706 evaluation kit. https://www.xilinx.com/ products/boards-and-kits/ek-z7-zc706-g.html, b. (Accessed on 09/30/2020).
259
+
260
+ Yunyang Xiong, Hanxiao Liu, Suyog Gupta, Berkin Akin, Gabriel Bender, Pieter-Jan Kindermans, Mingxing Tan, Vikas Singh, and Bo Chen. Mobiledets: Searching for object detection architectures for mobile accelerators. arXiv preprint arXiv:2004.14525, 2020.
261
+
262
+ Antoine Yang, Pedro M. Esperanc¸a, and Fabio M. Carlucci. Nas evaluation is frustratingly hard. In International Conference on Learning Representations, 2020. URL https://openreview. net/forum?id ${ . } = { }$ HygrdpVKvr.
263
+
264
+ Xuan Yang, Jing Pu, Blaine Burton Rister, Nikhil Bhagdikar, Stephen Richardson, Shahar Kvatinsky, Jonathan Ragan-Kelley, Ardavan Pedram, and Mark Horowitz. A systematic approach to blocking convolutional neural networks, 2016.
265
+
266
+ Chris Ying, Aaron Klein, Eric Christiansen, Esteban Real, Kevin Murphy, and Frank Hutter. Nasbench-101: Towards reproducible neural architecture search. In International Conference on Machine Learning, pp. 7105–7114, 2019.
267
+
268
+ Haoran You, Xiaohan Chen, Yongan Zhang, Chaojian Li, Sicheng Li, Zihao Liu, Zhangyang Wang, and Yingyan Lin. Shiftaddnet: A hardware-inspired deep network. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 2771–2783. Curran Associates, Inc., 2020a. URL https://proceedings.neurips.cc/paper/2020/file/ 1cf44d7975e6c86cffa70cae95b5fbb2-Paper.pdf.
269
+
270
+ Shan You, Tao Huang, Mingmin Yang, Fei Wang, Chen Qian, and Changshui Zhang. Greedynas: Towards fast one-shot nas with greedy supernet. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1999–2008, 2020b.
271
+
272
+ Chen Zhang, Peng Li, Guangyu Sun, Yijin Guan, Bingjun Xiao, and Jason Cong. Optimizing fpga-based accelerator design for deep convolutional neural networks. In Proceedings of the 2015 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays, FPGA ’15, pp. 161–170, New York, NY, USA, 2015. Association for Computing Machinery. ISBN 9781450333153. doi: 10.1145/2684746.2689060. URL https://doi.org/10.1145/ 2684746.2689060.
273
+
274
+ Jianhao Zhang, Yingwei Pan, Ting Yao, He Zhao, and Tao Mei. dabnn: A super fast inference framework for binary neural networks on arm devices. In Proceedings of the 27th ACM International Conference on Multimedia, pp. 2272–2275, 2019.
275
+
276
+ Xiaofan Zhang, Junsong Wang, Chao Zhu, Yonghua Lin, Jinjun Xiong, Wen-mei Hwu, and Deming Chen. Dnnbuilder: An automated tool for building high-performance dnn hardware accelerators for fpgas. In Proceedings of the International Conference on Computer-Aided Design, ICCAD ’18, New York, NY, USA, 2018. Association for Computing Machinery. ISBN 9781450359504. doi: 10.1145/3240765.3240801. URL https://doi.org/10.1145/ 3240765.3240801.
277
+
278
+ Yongan Zhang, Yonggan Fu, Weiwen Jiang, Chaojian Li, Haoran You, Meng Li, Vikas Chandra, and Yingyan Lin. Dna: Differentiable network-accelerator co-search, 2020.
279
+
280
+ Cheah Wai Zhao, Jayanand Jegatheesan, and Son Chee Loon. Exploring iot application using raspberry pi. International Journal of Computer Networks and Applications, 2(1):27–34, 2015.
281
+
282
+ Y. Zhao, X. Chen, Y. Wang, C. Li, H. You, Y. Fu, Y. Xie, Z. Wang, and Y. Lin. Smartexchange: Trading higher-cost memory storage/access for lower-cost computation. In 2020 ACM/IEEE 47th Annual International Symposium on Computer Architecture (ISCA), pp. 954–967, 2020a. doi: 10.1109/ISCA45697.2020.00082.
283
+
284
+ Y. Zhao, C. Li, Y. Wang, P. Xu, Y. Zhang, and Y. Lin. Dnn-chip predictor: An analytical performance predictor for dnn accelerators with various dataflows and hardware architectures. In ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 1593–1597, 2020b.
285
+
286
+ Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8697–8710, 2018.
287
+
288
+ # A MORE VISUALIZATION ON THE MEASURED HARDWARE-COST FOR THE FBNET SEARCH SPACE
289
+
290
+ ![](images/4b695456533a81e50c852133d9774fcb4a24bb440bfadf5dfd7a190adeac408f.jpg)
291
+ Figure 6: Comparison between the approximated and measured hardware-cost on CIFAR-100 (Top) and ImageNet (Bottom), where the red line indicates the fitting line for all the measured data, and $R ^ { 2 }$ represents the square of the Pearson Correlation Coefficient (Benesty et al., 2009).
292
+
293
+ Fig. 6 shows a comparison between the approximated and measured hardware-cost of randomly sampled 100 architectures when being executed on commercial edge devices using the ImageNet and CIFAR-100 datasets, which verifies that our approximation of summing up the performance of the unique blocks is a simple yet quite accurate for providing the hardware-cost for networks in the FBNet space and is consistent with our observation in Table 2.
294
+
295
+ # B COMPARING THE ESTIMATED COST EXECUTED ON EYERISS USING ACCELERGY $^ +$ TIMELOOP AND DNN-CHIP REDICTOR
296
+
297
+ Both Accelergy (Wu et al., 2019) $+$ Timeloop (Parashar et al., 2019) and DNN-Chip Predictor (Zhao et al., 2020b) are able to simulate the latency and energy cost of Eyeriss (Chen et al., 2016), a SOTA ASIC DNN accelerator, when giving the network architectures. From Table 6, they nearly give the same estimation for the latency and energy cost: specifically, the mean of their differences is $6 . 0 9 6 \%$ , the standard deviation of the differences is $0 . 7 7 9 \%$ , the Pearson correlation coefficient is 0.9998, and the Kendall Rank correlation coefficient is 0.9633, in term of the average performance, when being benchmarked with NAS-Bench-201 on 3 datasets. Therefore, we use the average value of their predictions as the estimated latency and energy on Eyeriss in our proposed HW-NAS-Bench.
298
+
299
+ Table 6: The differences of the hardware-cost estimation given by Accelergy (Wu et al., 2019) $+$ Timeloop (Parashar et al., 2019) and DNN-Chip Predictor (Zhao et al., 2020b), considering NAS-Bench-201 on 3 datasets.
300
+
301
+ <table><tr><td>Datasets</td><td>Hardware-cost</td><td>Mean of Differences</td><td>Standard Deviation ofI Differences</td><td>Pearson Correlation Coefficient</td><td>Kendall Rank Correlation Coefficient</td></tr><tr><td rowspan="2">CIFAR-10</td><td>Latency</td><td>1.648%</td><td>0.642%</td><td>0.9999</td><td>0.9888</td></tr><tr><td>Energy</td><td>10.96%</td><td>1.035%</td><td>0.9997</td><td>0.9374</td></tr><tr><td rowspan="2">CIFAR-100</td><td>Latency</td><td>1.572%</td><td>0.611%</td><td>1.0000</td><td>0.9888</td></tr><tr><td>Energy</td><td>10.93%</td><td>1.029%</td><td>0.9997</td><td>0.9374</td></tr><tr><td rowspan="2">ImageNet16-120</td><td>Latency</td><td>1.338%</td><td>0.520%</td><td>0.9999</td><td>0.9888</td></tr><tr><td>Energy</td><td>10.13%</td><td>0.840%</td><td>0.9998</td><td>0.9388</td></tr><tr><td colspan="2">Average Performance</td><td>6.096%</td><td>0.779%</td><td>0.9998</td><td>0.9633</td></tr></table>
302
+
303
+ Table 7: Left: the marco-architectures of the search space proposed in the FBNet (Wu et al., 2019) for the ImageNet classification; Right: our modified search space to fit the input image size of the CIFAR-100 dataset. In the tables, “TBS” means the layer type needs to be searched and “Stride” denotes the stride of the first block in the stage. Here the modified parameters are emphasized as bold characters.
304
+
305
+ <table><tr><td rowspan=1 colspan=1>Input Shape</td><td rowspan=1 colspan=1>Block</td><td rowspan=1 colspan=1>Filter#</td><td rowspan=1 colspan=1>Block#</td><td rowspan=1 colspan=1>Stride</td></tr><tr><td rowspan=1 colspan=1>224²×3</td><td rowspan=1 colspan=1>3 × 3conv</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>112²× 16</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>112²×16</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>56²×24</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>28²×32</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>14²×64</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>112</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>14² × 112</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>184</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>7²×184</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>352</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=3 colspan=1>7²×3527²×19841504</td><td rowspan=1 colspan=1>1 ×1conv</td><td rowspan=1 colspan=1>1984</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>7×7avgpool</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td><td rowspan=2 colspan=1>1=</td></tr><tr><td rowspan=1 colspan=1>fc</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>1</td></tr></table>
306
+
307
+ <table><tr><td rowspan=1 colspan=1>Input Shape</td><td rowspan=1 colspan=1>Block</td><td rowspan=1 colspan=1>Filter#</td><td rowspan=1 colspan=1>Block#</td><td rowspan=1 colspan=1>Stride</td></tr><tr><td rowspan=1 colspan=1>32²×3</td><td rowspan=1 colspan=1>3×3conv</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>32²×16</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>32²×16</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>32²×24</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>16²×32</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>8²×64</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>112</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>8²×112</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>184</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1>4²×184</td><td rowspan=1 colspan=1>TBS</td><td rowspan=1 colspan=1>352</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=3 colspan=1>4²×3524²×15041504</td><td rowspan=1 colspan=1>1 ×1 conv</td><td rowspan=1 colspan=1>1504</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=2 colspan=1>4×4avgpoolfc</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>=</td></tr></table>
308
+
309
+ # C MINOR MODIFICATIONS ON THE FBNET SEARCH SPACE WHEN BENCHMARKING ON CIFAR-100
310
+
311
+ Here we describe our modification on the FBNet search space when benchmarking on CIFAR-100 (i.e., the setting in Section 5) by comparing the marco-architectures before and after such modification in Table 7.
312
+
313
+ # D DETAILS OF THE PIPELINE USED TO COLLECT HARDWARE-COST DATA
314
+
315
+ # D.1 COLLECT PERFORMANCE ON THE EDGE GPU
316
+
317
+ NVIDIA Edge GPU Jetson TX2 (Edge GPU) (NVIDIA Inc., a) is a commonly used commercial edge device, consisting of a quad-core Arm Cortex-A57, a dual-core NVIDIA Denver2, a 256-core Pascal GPU, and a 8GB 128-bit LPDDR4, for various deep learning applications including classification (Li et al., 2020), segmentation (Siam et al., 2018), and depth estimation (Wofk et al., 2019), targeting IoT, and self-driving environments. Although widely-used TensorFlow (Abadi et al., 2016) and PyTorch (Paszke et al., 2019) can be directly used in Edge GPUs, to achieve faster inference, TensorRT (NVIDIA Inc., b), a $\mathrm { C } { + } { + }$ library for high-performance inference on NVIDIA GPUs, is more commonly used as the runtime environment in Edge GPUs when only benchmarking inference performance (Wang et al., 2019a; NVIDIA Inc., c).
318
+
319
+ We pre-set the Edge GPU to the max-N mode to make full use of the resource on it following (Wofk et al., 2019). When plugging Edge GPUs into the hardware-cost collection pipeline, we first compile the PyTorch implementations of the network architectures in both NAS-Bench-201 and FBNet search spaces to TensorRT format models. In this way, the resulting hardware-cost can benefit from the optimized inference implementation within the TensorRF runtime environment. And then we benchmark the architectures in Edge GPUs to further measure the energy and latency using the sysfs (Patrick Mochel and Mike Murphy.) of the embedded INA3221 (Texas Instruments Inc.) power rails monitor.
320
+
321
+ # D.2 COLLECT PERFORMANCE ON RASPI 4
322
+
323
+ Raspberry Pi 4 (Raspi 4) (Raspberry Pi Limited.) is the latest Raspberry Pi device, which is a popular hardware platform for general purpose IoT applications (Zhao et al., 2015; Basu et al., 2020) and is able to support deep learning applications with specifical framework designs (Google LLC., f; Zhang et al., 2019; Geiger & Team, 2020). We choose the type of Raspi 4 with a Broadcom BCM2711 SoC and a 4GB LPDDR4 (Raspberry Pi Limited.). Similar to Edge GPUs, Raspi 4 can run architectures in the TensorFlow (Abadi et al., 2016), PyTorch (Paszke et al., 2019), or TensorFlow Lite (Google LLC., f) runtime environments. We utilize TensorFlow Lite (Google LLC., f) as it can further boost the inference efficiency.
324
+
325
+ To collect hardware-cost operating on Respi 4, an official TensorFlow Lite interpreter is preconfigured in the Raspi 4, following the settings in (Google LLC., 2020). We benchmark the possible architectures in HW-NAS-Bench on Raspi 4 after compiling them to the TensorFlow Lite (Abadi et al., 2016) format to measure the resulting latency.
326
+
327
+ # D.3 COLLECT PERFORMANCE ON THE EDGE TPU
328
+
329
+ Edge TPU (Google LLC., a) is a series of dedicated ASIC accelerators developed by Google, targeting AI inference at the edge, which can be used for classification, pose estimation, and segmentation (Xiong et al., 2020; Google LLC., b) with extremely high efficiency (e.g., $2 . 3 2 \times$ more efficient than a single SOTA desktop GPU, GTX 2080 Ti, in terms of the number of fixed-point operations per watt (Google LLC., d)). In our proposed collection pipeline, we choose the Dev Board (Google LLC., a) which provides the most functions among all products.
330
+
331
+ To collect hardware-cost in Edge TPUs, all the architectures to be benchmarked will first be converted to the TensorFlow Lite (Google LLC., f) format from their Keras (Chollet et al., 2015) implementation. After that, an in-house compiler (Google LLC., c) will be used to convert the TensorFlow Lite models into a more compressed format. This pipeline uses the least converting tools to make sure that the most operations are supported, as compared to other options (e.g., converting from the PyTorch-ONNX (Bai et al., 2020) implementation). Only the latency is collected on the Edge TPU since it lacks accurate embedded power rails monitor. We do not consider the FBNet’s search space for the Edge TPU, and more details are in the Appendix A.
332
+
333
+ # D.4 COLLECT PERFORMANCE ON PIXEL 3
334
+
335
+ Pixel 3 (Google LLC., e) is one of the latest Pixel mobile phones that are widely used as the target platform by recent NAS works (Xiong et al., 2020; Howard et al., 2019; Tan et al., 2019) and machine learning framework benchmark (Google LLC., f). In our implementation, the Pixel 3 is pre-configured to use its big cores following the setting in (Xiong et al., 2020; Tan et al., 2019). Similar to the case of Raspi 4, we first convert the possible architectures in the search spaces of our proposed HW-NAS-Bench into the TensorFlow Lite format and then use the official benchmark binary files to measure the latency for each architecture.
336
+
337
+ # D.5 COLLECT PERFORMANCE ON ASIC-EYERISS
338
+
339
+ For hardware-cost data collection in ASIC, we consider Eyeriss (ASIC-Eyeriss) which is a SOTA ASIC accelerator (Chen et al., 2016). The Eyeriss chip features 168 processing elements (PEs) which are connected through a configurable dedicated on-chip network into a 2D array. A 128KB SRAM is shared by all PEs and further divided into multiple banks, each of which can be assigned to fit the input feature maps or partial sums. Thanks to these configurable hardware settings, we can adopt the optimal algorithm-to-hardware mappings for different network architectures when being executed on Eyeriss to minimize the energy or latency by maximizing data reuse opportunities for different layers.
340
+
341
+ In order to find the optimal mappings and evaluate the performance metrics on Eyeriss, we adopt SOTA performance simulators for DNN accelerators (1) Accelergy (Wu et al., 2019) $+$ Timeloop (Parashar et al., 2019) and (2) DNN-Chip Predictor (Zhao et al., 2020b). Both of the simulators can characterize the Eyeriss’s micro-architecture, perform mapping exploration, and predict the energy cost and latency metrics. Given the Eyeriss accelerator and layer information (e.g, layer type, feature map size, and kernel size) in both NAS-Bench-201 and FBNet, Accelergy+Timeloop reports the energy cost and latency characterization through an integrated mapper that finds the optimal mapping for such layer when being executed in Eyeriss. The inputs to DNNChip Predictor are the same as those to Accelergy $^ +$ Timeloop, except that we can set the optimization metric as energy/latency/energy-delay product. DNN-Chip Predictor identifies the optimal mapping for the optimization metric and generates the estimated hardware-cost. We report the average prediction from the two simulators as the estimated hardware-cost of Eyeriss, and more details can be found in Appendix B.
342
+
343
+ Table 8: Our implemented FPGA accelerators for HW-NAS-Bench vs. SOTA FPGA accelerators, considering VGG16 on the ImageNet dataset and using Zynq XC70Z45 as the FPGA device.
344
+
345
+ <table><tr><td></td><td>I (Zhang et al., 2018)</td><td>(Xiao et al.,2017)</td><td>Our Implementation</td></tr><tr><td>Resource Utilization</td><td>680/900 DSP</td><td>824/900 DSP</td><td>723/900 DSP</td></tr><tr><td>Performance (GOP/s)</td><td>262</td><td>230</td><td>291</td></tr></table>
346
+
347
+ # D.6 COLLECT PERFORMANCE ON FPGA
348
+
349
+ FPGA is a widely adopted AI acceleration platform which can offer a higher flexibility in terms of the hardware resources for accelerating AI algorithms. For collecting hardware-cost data in FPGA, we construct a SOTA chunk based pipeline structure (Zhang et al., 2018; Shen et al., 2017) as our FPGA implementation. By configuring multiple sub-accelerators (chunks) and assigning different layers to different sub-accelerators(chunks), we can balance the throughput and hardware resource consumption. To further free up our implantation’s potential to reach the performance frontier across different architectures, we additionally configure hardware settings such as the number of PEs, interconnection method of PEs, and tiling/scheduling of the operations, which are commonly adopted by FPGA accelerators (Chen et al., 2017; Zhang et al., 2015; Yang et al., 2016). We then compile all the architectures using the standard Vivado HLS toolflow (Xilinx Inc., a) and obtain the bottleneck latency, the maximum latency across all sub-accelerators (chunks) of the architectures on a Xilinx ZC706 development board with Zynq XC7045 SoC (Xilinx Inc., b).
350
+
351
+ To verify our implementation, we compare our implementation’s performance with SOTA FPGA accelerators (Zhang et al., 2018; Xiao et al., 2017) given the same architecture and dataset as shown in Table 8. We can see that our implementation achieves SOTA performance and thus provides insightful and trusted hardware-cost estimation for the HW-NAS-Bench.
md/train/_mQp5cr_iNy/_mQp5cr_iNy.md ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIALLY GUIDED ACTOR-CRITIC
2
+
3
+ # Johan Ferret∗
4
+
5
+ Yannis Flet-Berliac∗
6
+ Inria, Scool team
7
+ Univ. Lille, CRIStAL, CNRS
8
+ yannis.flet-berliac@inria.fr
9
+
10
+ Google Research, Brain team Inria, Scool team Univ. Lille, CRIStAL, CNRS
11
+
12
+ # Olivier Pietquin
13
+
14
+ Google Research, Brain team
15
+
16
+ Philippe Preux
17
+ Inria, Scool team
18
+ Univ. Lille, CRIStAL, CNRS
19
+
20
+ Matthieu Geist Google Research, Brain team
21
+
22
+ # ABSTRACT
23
+
24
+ Despite definite success in deep reinforcement learning problems, actor-critic algorithms are still confronted with sample inefficiency in complex environments, particularly in tasks where efficient exploration is a bottleneck. These methods consider a policy (the actor) and a value function (the critic) whose respective losses are built using different motivations and approaches. This paper introduces a third protagonist: the adversary. While the adversary mimics the actor by minimizing the KL-divergence between their respective action distributions, the actor, in addition to learning to solve the task, tries to differentiate itself from the adversary predictions. This novel objective stimulates the actor to follow strategies that could not have been correctly predicted from previous trajectories, making its behavior innovative in tasks where the reward is extremely rare. Our experimental analysis shows that the resulting Adversarially Guided Actor-Critic (AGAC) algorithm leads to more exhaustive exploration. Notably, AGAC outperforms current state-of-the-art methods on a set of various hard-exploration and procedurally-generated tasks.
25
+
26
+ # 1 INTRODUCTION
27
+
28
+ Research in deep reinforcement learning (RL) has proven to be successful across a wide range of problems (Silver et al., 2014; Schulman et al., 2016; Lillicrap et al., 2016; Mnih et al., 2016). Nevertheless, generalization and exploration in RL still represent key challenges that leave most current methods ineffective. First, a battery of recent studies (Farebrother et al., 2018; Zhang et al., 2018a; Song et al., 2020; Cobbe et al., 2020) indicates that current RL methods fail to generalize correctly even when agents have been trained in a diverse set of environments. Second, exploration has been extensively studied in RL; however, most hard-exploration problems use the same environment for training and evaluation. Hence, since a well-designed exploration strategy should maximize the information received from a trajectory about an environment, the exploration capabilities may not be appropriately assessed if that information is memorized. In this line of research, we choose to study the exploration capabilities of our method and its ability to generalize to new scenarios. Our evaluation domains will, therefore, be tasks with sparse reward in procedurally-generated environments.
29
+
30
+ In this work, we propose Adversarially Guided Actor-Critic (AGAC), which reconsiders the actor-critic framework by introducing a third protagonist: the adversary. Its role is to predict the actor’s actions correctly. Meanwhile, the actor must not only find the optimal actions to maximize the sum of expected returns, but also counteract the predictions of the adversary. This formulation is lightly inspired by adversarial methods, specifically generative adversarial networks (GANs) (Goodfellow et al., 2014). Such a link between GANs and actor-critic methods has been formalized by Pfau & Vinyals (2016); however, in the context of a third protagonist, we draw a different analogy. The adversary can be interpreted as playing the role of a discriminator that must predict the actions of the actor, and the actor can be considered as playing the role of a generator that behaves to deceive the predictions of the adversary. This approach has the advantage, as with GANs, that the optimization procedure generates a diversity of meaningful data, corresponding to sequences of actions in AGAC.
31
+
32
+ This paper analyses and explores how AGAC explicitly drives diversity in the behaviors of the agent while remaining reward-focused, and to which extent this approach allows to adapt to the evolving state space of procedurally-generated environments where the map is constructed differently with each new episode. Moreover, because stability is a legitimate concern since specific instances of adversarial networks were shown to be prone to hyperparameter sensitivity issues (Arjovsky & Bottou, 2017), we also examine this aspect in our experiments.
33
+
34
+ The contributions of this work are as follow: (i) we propose a novel actor-critic formulation inspired from adversarial learning (AGAC), (ii) we analyse empirically AGAC on key reinforcement learning aspects such as diversity, exploration and stability, (iii) we demonstrate significant gains in performance on several sparse-reward hard-exploration tasks including procedurally-generated tasks.
35
+
36
+ # 2 RELATED WORK
37
+
38
+ Actor-critic methods (Barto et al., 1983; Sutton, 1984) have been extended to the deep learning setting by Mnih et al. (2016), who combined deep neural networks and multiple distributed actors with an actor-critic setting, with strong results on Atari. Since then, many additions have been proposed, be it architectural improvements (Vinyals et al., 2019), better advantage or value estimation (Schulman et al., 2016; Flet-Berliac et al., 2021), or the incorporation of off-policy elements (Wang et al., 2017; Oh et al., 2018; Flet-Berliac & Preux, 2020). Regularization was shown to improve actor-critic methods, either by enforcing trust regions (Schulman et al., 2015; 2017; Wu et al., 2017), or by correcting for off-policiness (Munos et al., 2016; Gruslys et al., 2018); and recent works analyzed its impact from a theoretical standpoint (Geist et al., 2019; Ahmed et al., 2019; Vieillard et al., 2020a;b). Related to our work, Han & Sung (2020) use the entropy of the mixture between the policy induced from a replay buffer and the current policy as a regularizer. To the best of our knowledge, none of these methods explored the use of an adversarial objective to drive exploration.
39
+
40
+ While introduced in supervised learning, adversarial learning (Goodfellow et al., 2015; Miyato et al., 2016; Kurakin et al., 2017) was leveraged in several RL works. Ho & Ermon (2016) propose an imitation learning method that uses a discriminator whose task is to distinguish between expert trajectories and those of the agent while the agent tries to match expert behavior to fool the discriminator. Bahdanau et al. (2019) use a discriminator to distinguish goal states from non-goal states based on a textual instruction, and use the resulting model as a reward function. Florensa et al. (2018) use a GAN to produce sub-goals at the right level of difficulty for the current agent, inducing a form of curriculum. Additionally, Pfau & Vinyals (2016) provide a parallel between GANs and the actor-critic framework.
41
+
42
+ While exploration is driven in part by the core RL algorithms (Fortunato et al., 2018; Han & Sung, 2020; Ferret et al., 2021), it is often necessary to resort to exploration-specific techniques. For instance, intrinsic motivation encourages exploratory behavior from the agent. Some works use state-visitation counts or pseudo-counts to promote exhaustive exploration (Bellemare et al., 2016a), while others use curiosity rewards, expressed in the magnitude of prediction error from the agent, to push it towards unfamiliar areas of the state space (Burda et al., 2018). Ecoffet et al. (2019) propose a technique akin to tree traversal to explore while learning to come back to promising areas. Eysenbach et al. (2018) show that encouraging diversity helps with exploration, even in the absence of reward.
43
+
44
+ Last but not least, generalization is a key challenge in RL. Zhang et al. (2018b) showed that, even when the environment is not deterministic, agents can overfit to their training distribution and that it is difficult to distinguish agents likely to generalize to new environments from those that will not. In the same vein, recent work has advocated using procedurally-generated environments, in which a new instance of the environment is sampled when a new episode starts, to assess generalization capabilities better (Justesen et al., 2018; Cobbe et al., 2020). Finally, methods based on network randomization (Igl et al., 2019), noise injection (Lee et al., 2020), and credit assignment (Ferret et al., 2020) have been proposed to reduce the generalization gap for RL agents.
45
+
46
+ # 3 BACKGROUND AND NOTATIONS
47
+
48
+ We place ourselves in the Markov Decision Processes (Puterman, 1994) framework. A Markov Decision Process (MDP) is a tuple $M = \{ { \mathcal { S } } , { \mathcal { A } } , { \mathcal { P } } , R , \gamma \}$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $\mathcal { P }$ is the transition kernel, $\mathcal { R }$ is the bounded reward function and $\gamma \in [ 0 , 1 )$ is the discount factor. Let $\pi$ denote a stochastic policy mapping states to distributions over actions. We place ourselves in the infinite-horizon setting, i.e., we seek a policy that optimizes $\begin{array} { r } { J ( \pi ) = \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r \left( s _ { t } , a _ { t } \right) ] } \end{array}$ . The value of a state is the quantity $\begin{array} { r } { V ^ { \pi } ( s ) = \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r \left( s _ { t } , a _ { t } \right) | s _ { 0 } = s ] } \end{array}$ t=0 and the value of a state-action pair of performing action $a$ in state $s$ and then following policy is defined as: $\begin{array} { r } { Q ^ { \pi } ( s , a ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r \left( s _ { t } , a _ { t } \right) \vert s _ { 0 } = s , a _ { 0 } = a \right] . } \end{array}$ . The advantage function, which quantifies how an action $a$ is better than the average action in state $s$ , is $A ^ { \pi } ( s , a ) \bar { = } Q ^ { \pi } ( s , a ) - V ^ { \pi } ( \bar { s } )$ . Finally, the entropy $\mathcal { H } ^ { \pi }$ of a policy is calculated as: $\mathcal { H } ^ { \pi } ( s ) = \mathbb { E } _ { \pi ( \cdot | s ) } \left[ - \log \pi ( \cdot | s ) \right]$ .
49
+
50
+ Actor-Critic and Deep Policy Gradients. An actor-critic algorithm is composed of two main components: a policy and a value predictor. In deep RL, both the policy and the value function are obtained via parametric estimators; we denote $\theta$ and $\phi$ their respective parameters. The policy is updated via policy gradient, while the value is usually updated via temporal difference or Monte Carlo rollouts. In practice, for a sequence of transitions $\left\{ s _ { t } , a _ { t } , r _ { t } , s _ { t + 1 } \right\} _ { t \in [ 0 , N ] }$ , we use the following policy gradient loss (including the commonly used entropic penalty):
51
+
52
+ $$
53
+ \mathcal { L } _ { P G } = - \frac { 1 } { N } \sum _ { t ^ { \prime } = t } ^ { t + N } ( A _ { t ^ { \prime } } \log \pi \left( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } , \theta \right) + \alpha \mathcal { H } ^ { \pi } ( s _ { t ^ { \prime } } , \theta ) ) ,
54
+ $$
55
+
56
+ where 2016) $\alpha$ is tfin t: $A _ { t }$ timato, with (Schulman et al.,a fixed hyperpa$\begin{array} { r } { A _ { t } = \sum _ { t ^ { \prime } = t } ^ { t + N } ( \gamma \lambda ) ^ { t ^ { \prime } - t } ( r _ { t ^ { \prime } } + \gamma V _ { \phi _ { \mathrm { o l d } } } ( s _ { t ^ { \prime } + 1 } ) - V _ { \phi _ { \mathrm { o l d } } } ( s _ { t ^ { \prime } } ) ) } \end{array}$ $\lambda$ $V _ { \phi _ { \mathrm { o l d } } }$
57
+ value function, we solve the non-linear regression problem minimizeφ $\begin{array} { r } { \sum _ { t ^ { \prime } = t } ^ { t + N } ( V _ { \phi } ( s _ { t ^ { \prime } } ) - \hat { V } _ { t ^ { \prime } } ) ^ { 2 } } \end{array}$ where
58
+ $\hat { V } _ { t } = A _ { t } + V _ { \phi _ { \mathrm { o l d } } } ( s _ { t ^ { \prime } } )$ .
59
+
60
+ # 4 ADVERSARIALLY GUIDED ACTOR-CRITIC
61
+
62
+ To foster diversified behavior in its trajectories, AGAC introduces a third protagonist to the actor-critic framework: the adversary. The role of the adversary is to accurately predict the actor’s actions, by minimizing the discrepancy between its action distribution $\pi _ { \mathrm { a d v } }$ and the distribution induced by the policy $\pi$ . Meanwhile, in addition to finding the optimal actions to maximize the sum of expected returns, the actor must also counteract the adversary’s predictions by maximizing the discrepancy between $\pi$ and $\pi _ { \mathrm { a d v } }$ (see Appendix B for an illustration). This discrepancy, used as a form of exploration bonus, is defined as the difference of action log-probabilities (see Eq. (1)), whose expectation is the Kullback–Leibler divergence:
63
+
64
+ $$
65
+ D _ { \mathrm { K L } } ( \pi ( \cdot | s ) \| \pi _ { \mathrm { a d v } } ( \cdot | s ) ) = \mathbb { E } _ { \pi ( \cdot | s ) } \left[ \log \pi ( \cdot | s ) - \log \pi _ { \mathrm { a d v } } ( \cdot | s ) \right] .
66
+ $$
67
+
68
+ Formally, for each state-action pair $( s _ { t } , a _ { t } )$ in a trajectory, an action-dependent bonus $\log \pi ( a _ { t } | s _ { t } ) -$ $\log \pi _ { \mathrm { a d v } } \mathbf { \dot { ( } } a _ { t } | s _ { t } )$ is added to the advantage. In addition, the value target of the critic is modified to include the action-independent equivalent, which is the KL-divergence $D _ { \mathrm { K L } } ( \pi ( \cdot | s _ { t } ) \| \pi _ { \mathrm { a d v } } ( \cdot | s _ { t } ) )$ . We discuss the role of these mirrored terms below, and the implications of AGAC’s modified objective from a more theoretical standpoint in the next section. In addition to the parameters $\theta$ (resp. $\theta _ { \mathrm { o l d } }$ the parameter of the policy at the previous iteration) and $\phi$ defined above (resp. $\phi _ { \mathrm { o l d } }$ that of the critic), we denote $\psi$ (resp. $\psi _ { \mathrm { o l d . } }$ ) that of the adversary.
69
+
70
+ AGAC minimizes the following loss:
71
+
72
+ $$
73
+ \mathcal { L } _ { \mathrm { A G A C } } = \mathcal { L } _ { \mathrm { P G } } + \beta _ { V } \mathcal { L } _ { V } + \beta _ { \mathrm { a d v } } \mathcal { L } _ { \mathrm { a d v } } .
74
+ $$
75
+
76
+ In the new objective $\begin{array} { r } { \mathcal { L } _ { P G } = - \frac { 1 } { N } \sum _ { t = 0 } ^ { N } ( A _ { t } ^ { \tt A G A C } \log \pi \left( a _ { t } | s _ { t } , \theta \right) + \alpha \mathcal { H } ^ { \pi } ( s _ { t } , \theta ) ) , } \end{array}$ AGAC modifies $A _ { t }$ as:
77
+
78
+ $$
79
+ A _ { t } ^ { \mathtt { A G A C } } = A _ { t } + c \left( \log \pi ( a _ { t } | s _ { t } , \theta _ { \mathrm { o l d } } ) - \log \pi _ { \mathrm { a d v } } ( a _ { t } | s _ { t } , \psi _ { \mathrm { o l d } } ) \right) ,
80
+ $$
81
+
82
+ with $c$ a varying hyperparameter that controls the dependence on the action log-probability difference. To encourage exploration without preventing asymptotic stability, $c$ is linearly annealed during the course of training. ${ \mathcal { L } } _ { V }$ is the objective function of the critic defined as:
83
+
84
+ $$
85
+ \mathcal { L } _ { V } = \frac { 1 } { N } \sum _ { t = 0 } ^ { N } \left( V _ { \phi } ( s _ { t } ) - \left( \hat { V } _ { t } + c D _ { \mathrm { K L } } ( \pi ( \cdot | s _ { t } , \theta _ { \mathrm { o l d } } ) | | \pi _ { \mathrm { a d v } } ( \cdot | s _ { t } , \psi _ { \mathrm { o l d } } ) ) \right) \right) ^ { 2 } .
86
+ $$
87
+
88
+ Finally, ${ \mathcal { L } } _ { \mathrm { a d v } }$ is the objective function of the adversary:
89
+
90
+ $$
91
+ \mathcal { L } _ { \mathrm { a d v } } = \frac { 1 } { N } \sum _ { t = 0 } ^ { N } D _ { \mathrm { K L } } \big ( \pi \big ( \cdot | s _ { t } , \theta _ { \mathrm { o l d } } \big ) \big | \big | \pi _ { \mathrm { a d v } } \big ( \cdot | s _ { t } , \psi \big ) \big ) .
92
+ $$
93
+
94
+ Eqs. (1), (2) and (3) are the three equations that our method modifies (we color in blue the specific parts) in the traditional actor-critic framework. The terms $\beta _ { V }$ and $\beta _ { \mathrm { a d v } }$ are fixed hyperparameters.
95
+
96
+ Under the proposed actor-critic formulation, the probability of sampling an action is increased if the modified advantage is positive, i.e. (i) the corresponding return is larger than the predicted value and/or (ii) the action log-probability difference is large. More precisely, our method favors transitions whose actions were less accurately predicted than the average action, i.e. $\log \pi ( a | s ) -$ $\begin{array} { r } { \log \pi _ { \mathrm { a d v } } ( a | s ) \geq D _ { \mathrm { K L } } ( \pi ( \cdot | s ) \| \pi _ { \mathrm { a d v } } ( \cdot | s ) ) } \end{array}$ . This is particularly visible for $\lambda 1$ , in which case the generalized advantage is $A _ { t } = G _ { t } - V _ { \phi _ { \mathrm { o l d } } } ( s _ { t } )$ , resulting in the appearance of both aforementioned mirrored terms in the modified advantage:
97
+
98
+ $$
99
+ A _ { t } ^ { \mathtt { A G A C } } = G _ { t } - \hat { V } _ { t } ^ { \phi _ { \mathrm { o d d } } } + c \left( \log \pi ( a _ { t } | s _ { t } ) - \log \pi _ { \mathrm { a d v } } ( a _ { t } | s _ { t } ) - \hat { D } _ { \mathrm { K L } } ^ { \phi _ { \mathrm { o d d } } } ( \pi ( \cdot | s _ { t } ) | | \pi _ { \mathrm { a d v } } ( \cdot | s _ { t } ) ) \right) ,
100
+ $$
101
+
102
+ with KL- $G _ { t }$ the observed return, rgence (estimated co $\hat { V } _ { t } ^ { \phi _ { \mathrm { o l d } } }$ the estents of eturn and from Eq. $\hat { D } _ { \mathrm { K L } } ^ { \phi _ { \mathrm { o l d } } } \big ( \pi \big ( \cdot | s _ { t } \big ) \big | \big | \pi _ { \mathrm { a d v } } \big ( \cdot | s _ { t } \big ) \big )$ the estimated $V _ { \phi _ { \mathrm { o l d } } } ( s _ { t } )$
103
+
104
+ To avoid instability, in practice the adversary is a separate estimator, updated with a smaller learning rate than the actor. This way, it represents a delayed and more steady version of the actor’s policy, which prevents the agent from having to constantly adapt or focus solely on fooling the adversary.
105
+
106
+ # 4.1 BUILDING MOTIVATION
107
+
108
+ In the following, we provide an interpretation of AGAC by studying the dynamics of attraction and repulsion between the actor and the adversary. To simplify, we study the equivalent of AGAC in a policy iteration (PI) scheme. PI being the dynamic programming scheme underlying the standard actor-critic, we have reasons to think that some of our findings translate to the original AGAC algorithm. In PI, the quantity of interest is the action-value, which AGAC would modify as:
109
+
110
+ $$
111
+ Q _ { \pi _ { k } } ^ { \mathtt { A G A C } } = Q _ { \pi _ { k } } + c ( \log \pi _ { k } - \log \pi _ { \mathrm { a d v } } ) ,
112
+ $$
113
+
114
+ with $\pi _ { k }$ the policy at iteration $k$ . Incorporating the entropic penalty, the new policy $\pi _ { k + 1 }$ verifies:
115
+
116
+ $$
117
+ \pi _ { k + 1 } = \underset { \pi } { \arg \operatorname* { m a x } } \ : \mathcal { I } _ { \mathrm { P I } } ( \pi ) = \underset { \pi } { \arg \operatorname* { m a x } } \ : \mathbb { E } _ { s } \mathbb { E } _ { a \sim \pi ( \cdot \vert s ) } [ Q _ { \pi _ { k } } ^ { \mathrm { { A G A C } } } ( s , a ) - \alpha \log \pi ( a \vert s ) ] .
118
+ $$
119
+
120
+ We can rewrite this objective:
121
+
122
+ $$
123
+ \begin{array} { r l } & { \mathcal { T } _ { \mathrm { { p I } } } ( \pi ) = \mathbb { E } _ { s } \mathbb { E } _ { a \sim \pi ( \cdot | s ) } [ Q _ { \pi _ { k } } ^ { \mathrm { { A G } A C } } ( s , a ) - \alpha \log \pi ( a | s ) ] } \\ & { \qquad = \mathbb { E } _ { s } \mathbb { E } _ { a \sim \pi ( \cdot | s ) } [ Q _ { \pi _ { k } } ( s , a ) + c ( \log \pi _ { k } ( a | s ) - \log \pi _ { \mathrm { a d v } } ( a | s ) ) - \alpha \log \pi ( a | s ) ] } \\ & { \qquad = \mathbb { E } _ { s } \mathbb { E } _ { a \sim \pi ( \cdot | s ) } [ Q _ { \pi _ { k } } ( s , a ) + c ( \log \pi _ { k } ( a | s ) - \log \pi ( a | s ) + \log \pi ( a | s ) - \log \pi _ { \mathrm { a d v } } ( a | s ) ) - \alpha \log \mathrm { { g } } } \\ & { \qquad = \mathbb { E } _ { s } \Big [ \mathbb { E } _ { a \sim \pi ( \cdot | s ) } [ Q _ { \pi _ { k } } ( s , a ) ] \underbrace { - c D _ { \mathrm { K L } } ( \pi ( \cdot | s ) | | \pi _ { k } ( \cdot | s ) ) } _ { \pi _ { k } \mathrm { ~ i s ~ a t u r a c i t i v e } } \underbrace { + c D _ { \mathrm { K L } } ( \pi ( \cdot | s ) | | \pi _ { \mathrm { a d v } } ( \cdot | s ) ) } _ { \pi _ { \mathrm { a d v } } \mathrm { ~ i s ~ r e p u l s i v e } } \underbrace { + \alpha \mathcal { H } ( \pi ( \cdot | s ) | | \pi _ { \mathrm { a d v } } ( \cdot | s ) ) } _ { \mathrm { c n ~ t e r ~ i s r e p u l s i n c } } . } \end{array}
124
+ $$
125
+
126
+ Thus, in the PI scheme, AGAC finds a policy that maximizes $Q$ -values, while at the same time remaining close to the current policy and far from a mixture of the previous policies (i.e., $\pi _ { k - 1 }$ , $\pi _ { k - 2 }$ , $\pi _ { k - 3 } , \ldots )$ . Note that we experimentally observe (see Section 5.3) that our method performs better with a smaller learning rate for the adversarial network than that of the other networks, which could imply that a stable repulsive term is beneficial.
127
+
128
+ This optimization problem is strongly concave in $\pi$ (thanks to the entropy term), and is state-wise a Legendre-Fenchel transform. Its solution is given by (see Appendix E for the full derivation):
129
+
130
+ $$
131
+ \pi _ { k + 1 } \propto \left( \frac { \pi _ { k } } { \pi _ { \mathrm { a d v } } } \right) ^ { \frac { c } { \alpha } } \exp \frac { Q _ { \pi _ { k } } } { \alpha } .
132
+ $$
133
+
134
+ This result gives us some insight into the behavior of the objective function. Notably, in our example, if $\pi _ { \mathrm { a d v } }$ is fixed and $c = \alpha$ , we recover a KL-regularized PI scheme (Geist et al., 2019) with the modified reward $r - c \log \pi _ { \mathrm { a d v } }$ .
135
+
136
+ # 4.2 IMPLEMENTATION
137
+
138
+ In all of the experiments, we use PPO (Schulman et al., 2017) as the base algorithm and build on it to incorporate our method. Hence,
139
+
140
+ $$
141
+ \mathcal { L } _ { P G } = - \frac { 1 } { N } \sum _ { t ^ { \prime } = t } ^ { t + N } \operatorname* { m i n } \left( \frac { \pi ( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } , \theta ) } { \pi ( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } , \theta _ { \mathrm { o l d } } ) } A _ { t ^ { \prime } } ^ { \mathrm { R G K } } , \mathrm { c l i p } \left( \frac { \pi ( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } , \theta ) } { \pi ( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } , \theta _ { \mathrm { o l d } } ) } , 1 - \epsilon , 1 + \epsilon \right) A _ { t ^ { \prime } } ^ { \mathrm { R G K } } \right) ,
142
+ $$
143
+
144
+ with $A _ { t ^ { \prime } } ^ { \tt A G A C }$ given in Eq. (1), $N$ the temporal length considered for one update of parameters and $\epsilon$ the clipping parameter. Similar to RIDE (Raileanu & Rocktäschel, 2019), we also discount PPO by episodic state visitation counts, except for VizDoom (cf. Section 5.1). The actor, critic and adversary use the convolutional architecture of the Nature paper of DQN (Mnih et al., 2015) with different hidden sizes (see Appendix D for architecture details). The three neural networks are optimized using Adam (Kingma & Ba, 2015). Our method does not use RNNs in its architecture; instead, in all our experiments, we use frame stacking. Indeed, Hausknecht & Stone (2015) interestingly demonstrate that although recurrence is a reliable method for processing state observation, it does not confer any systematic advantage over stacking observations in the input layer of a CNN. Note that the parameters are not shared between the policy, the critic and the adversary and that we did not observe any noticeable difference in computational complexity when using AGAC compared to PPO. We direct the reader to Appendix C for a list of hyperparameters. In particular, the $c$ coefficient of the adversarial bonus is linearly annealed.
145
+
146
+ At each training step, we perform a stochastic optimization step to minimize $\mathcal { L } _ { \mathtt { A G A C } }$ using stop-gradient:
147
+
148
+ $$
149
+ \begin{array} { r l r l } & { \boldsymbol { \vartheta } \mathrm { A d a m } ( \theta , \nabla _ { \theta } \mathcal { L } _ { P G } , \eta _ { 1 } ) , } & & { \boldsymbol { \phi } \mathrm { A d a m } ( \phi , \nabla _ { \phi } \mathcal { L } _ { V } , \eta _ { 1 } ) , } & & { \boldsymbol { \psi } \mathrm { A d a m } ( \psi , \nabla _ { \psi } \mathcal { L } _ { \sf a d v } , \eta _ { 2 } ) . } \end{array}
150
+ $$
151
+
152
+ # 5 EXPERIMENTS
153
+
154
+ In this section, we describe our experimental study in which we investigate: (i) whether the adversarial bonus alone (e.g. without episodic state visitation count) is sufficient to outperform other methods in VizDoom, a sparse-reward task with high-dimensional observations, (ii) whether AGAC succeeds in partially-observable and procedurally-generated environments with high sparsity in the rewards, compared to other methods, (iii) how well AGAC is capable of exploring in environments without extrinsic reward, (iv) the training stability of our method. In all of the experiments, lines are average performances and shaded areas represent one standard deviation. The code for our method is released at github.com/yfletberliac/adversarially-guided-actor-critic.
155
+
156
+ ![](images/263aa3eeaa25d94147cc96fb59396bbc06f2d865b71d0e66161e08136afe2782.jpg)
157
+ Figure 1: (a,b) Frames from the 3-D navigation task VizdoomMyWayHome. (c) MiniGridKeyCorridorS6R3. (d) MiniGrid-ObstructedMazeFull.
158
+
159
+ Environments. To carefully evaluate the performance of our method, its ability to develop robust exploration strategies and its generalization to unseen states, we choose tasks that have been used in prior work, which are tasks with high-dimensional observations, sparse reward and procedurallygenerated environments. In VizDoom (Kempka et al., 2016), the agent must learn to move along corridors and through rooms without any reward feedback from the 3-D environment. The MiniGrid environments (Chevalier-Boisvert et al., 2018) are a set of challenging partially-observable and sparse-reward gridworlds. In this type of procedurally-generated environments, memorization is impossible due to the huge size of the state space, so the agent must learn to generalize across the different layouts of the environment. Each gridworld has different characteristics: in the MultiRoom tasks, the agent is placed in the first room and should reach a goal placed in the most distant room. In the KeyCorridor tasks, the agent must navigate to pick up an object placed in a room locked by a door whose key is in another room. Finally, in the ObstructedMaze tasks, the agent must pick up a box that is placed in a corner of a 3x3 maze in which the doors are also locked, the keys are hidden in boxes and balls obstruct the doors. All considered environments (see Fig. 1 for some examples) are available as part of OpenAI Gym (Brockman et al., 2016).
160
+
161
+ Baselines. For a fair assessment of our method, we compare to some of the most prominent methods specialized in hard-exploration tasks: RIDE (Raileanu & Rocktäschel, 2019), based on an intrinsic reward associated with the magnitude of change between two consecutive state representations and state visitation, Count as Count-Based Exploration (Bellemare et al., 2016b), which we couple with IMPALA (Espeholt et al., 2018), RND (Burda et al., 2018) in which an exploration bonus is positively correlated to the error of predicting features from the observations and ICM (Pathak et al., 2017), where a module only predicts the changes in the environment that are produced by the actions of the agent. Finally, we compare to most the recent and best performing method at the time of writing in procedurally-generated environments: AMIGo (Campero et al., 2021) in which a goal-generating teacher provides count-based intrinsic goals.
162
+
163
+ 5.1 ADVERSARIALLY-BASED EXPLORATION (NO EPISODIC COUNT)
164
+
165
+ Table 1: Average return in VizDoom at different timesteps.
166
+
167
+ <table><tr><td>Nb.of Timesteps</td><td>2M</td><td>4M</td><td>6M</td><td>8M</td><td>10M</td></tr><tr><td>AGAC</td><td>0.74± 0.05</td><td>0.96 ± 0.001</td><td>0.96 ± 0.001</td><td>0.97 ± 0.001</td><td>0.97 ± 0.001</td></tr><tr><td>RIDE</td><td>0.</td><td>0.</td><td>0.95 ± 0.001</td><td>0.97 ± 0.001</td><td>0.97 ± 0.001</td></tr><tr><td>ICM</td><td>0.</td><td>0.</td><td>0.95 ±0.001</td><td>0.97 ± 0.001</td><td>0.97 ± 0.001</td></tr><tr><td>AMIGo</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td></tr><tr><td>RND</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td></tr><tr><td>Count</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td></tr></table>
168
+
169
+ In this section, we assess the benefits of using an adversarially-based exploration bonus and examine how AGAC performs without the help of count-based exploration. In order to provide a comparison to state-of-the-art methods, we choose VizDoom, a hard-exploration problem used in prior work. In this game, the map consists of 9 rooms connected by corridors where 270 steps separate the initial position of the agent and the goal under an optimal policy. Episodes are terminated either when the agent finds the goal or if the episode exceeds 2100 timesteps. Importantly, while other algorithms (Raileanu & Rocktäschel, 2019; Campero et al., 2021) benefit from count-based exploration, this study has been conducted with our method not benefiting from episodic count whatsoever. Results in Table 1 indicate that AGAC clearly outperforms other methods in sample-efficiency. Only the methods ICM and RIDE succeed in matching the score of AGAC, and with about twice as much transitions $( \sim 3 \mathbf { M }$ vs. 6M). Interestingly, AMIGo performs similarly to Count and RND. We find this result surprising because AMIGo has proven to perform well in the MiniGrid environments. Nevertheless, it appears that concurrent works to ours experienced similar issues with the accompanying implementation1. The results of AGAC support the capabilities of the adversarial bonus and show that it can, on its own, achieve significant gains in performance. However, the VizDoom task is not procedurally-generated; hence we have not evaluated the generalization to new states yet. In the following section, we use MiniGrid to investigate this.
170
+
171
+ # 5.2 HARD-EXPLORATION TASKS WITH PARTIALLY-OBSERVABLE ENVIRONMENTS
172
+
173
+ We now evaluate our method on multiple hard-exploration procedurally-generated tasks from MiniGrid. Details about MiniGrid can be found in Appendix C.1. Fig. 2 indicates that AGAC significantly outperforms other methods on these tasks in sample-efficiency and performance. AGAC also outperforms the current state-of-the-art method, AMIGo, despite the fact that it uses the fully-observable version of MiniGrid. Note that we find the same poor performance results when training AMIGo in MiniGrid, similar to Vizdoom results. For completeness, we also report in Table 2 of Appendix A.1 the performance results with the scores reported in the original papers Raileanu & Rocktäschel (2019) and Campero et al. (2021). We draw similar conclusions: AGAC clearly outperforms the state-of-the-art RIDE, AMIGo, Count, RND and ICM.
174
+
175
+ ![](images/c694a663b7b25ee719de7eb448621e3cb5826c21e451c62ee01f34f8d0c5792f.jpg)
176
+ Figure 2: Performance evaluation of AGAC.
177
+
178
+ In all the considered tasks, the agent must learn to generalize across a very large state space because the layouts are generated procedurally. We consider three main arguments to explain why our method is successful: (i) our method makes use of partial observations: in this context, the adversary has a harder time predicting the actor’s actions; nevertheless, the mistakes of the former benefit the latter in the form of an exploration bonus, which pushes the agent to explore further in order to deceive the adversary, (ii) the exploration bonus (i.e. intrinsic reward) does not dissipate compared to most other methods, as observed in Fig. 9 in Appendix A.4, (iii) our method does not make assumptions about the environment dynamics (e.g., changes in the environment produced by an action as in Raileanu & Rocktäschel (2019)) since this can hinder learning when the space of state changes induced by an action is too large (such as the action of moving a block in ObstructedMaze).
179
+
180
+ In Appendix A.3, we also include experiments in two environments with extremely sparse reward signals: KeyCorridorS8R3 and ObstructedMazeFull. Despite the challenge, AGAC still manages to find rewards and can perform well by taking advantage of the diversified behaviour induced by our method. To the best of our knowledge, no other method ever succeeded to perform well $\mathit { \Theta } > 0$ average return) in those tasks. We think that given more computing time, AGAC’s score could go higher.
181
+
182
+ # 5.3 TRAINING STABILITY
183
+
184
+ ![](images/df1a9efb68034f4a5f52a20d9d5ef22a9514eee7144535790fe25105fc795095.jpg)
185
+ Figure 3: Sensitivity analysis of AGAC in KeyCorridorS4R3.
186
+
187
+ Here we want to analyse the stability of the method when changing hyperparameters. The most important parameters in AGAC are $c$ , the coefficient for the adversarial bonus, and the learning rates ratio $\begin{array} { r } { \nu = \frac { \eta _ { 2 } } { \eta _ { 1 } } } \end{array}$ . We choose KeyCorridorS4R3 as the evaluation task because among all the tasks considered, its difficulty is at a medium level. Fig. 3 shows the learning curves. For readability, we plot the average return only; the standard deviation is sensibly the same for all curves. We observe that deviating from the hyperparameter values found using grid search results in a slower training. Moreover, although reasonable, $c$ appears to have more sensitivity than $\nu$ .
188
+
189
+ ![](images/052df8089e69d4ed8859a825df3b5e90f5f628f6ab3239fa565170ac0833dc68.jpg)
190
+ Figure 5: State visitation heatmaps for RND, Count, a random uniform policy, RIDE, and AGAC trained in a singleton environment (top row) and procedurally-generated environments (bottom row) without extrinsic reward for 10M timesteps in the MultiRoomN10S6 task.
191
+
192
+ # 5.4 EXPLORATION IN REWARD-FREE ENVIRONMENT
193
+
194
+ To better understand the effectiveness of our method and inspect how the agent collects rewards that would not otherwise be achievable by simple exploration heuristics or other methods, we analyze the performance of AGAC in another (procedurally-generated) challenging environment, MultiRoomN10S6, when there is no reward signal, i.e. no extrinsic reward. Beyond the good performance of our method when extrinsic rewards are given to the agent, Fig. 4 indicates that the exploration induced by our method makes the agent succeed in a significant proportion of the episodes: in the configuration “NoExtrinsicReward” the reward signal is not given (the goal is invisible to the agent) and the performance of AGAC stabilizes around an average return of $\sim 0 . 1 5$ . Since the return of an episode is either 0 or 1 (depending on whether the agent reached the goal state or not), and because this value is aggregated across several episodes, the results indicate that reward-free AGAC succeeds in $\sim 1 5 \%$ of the tasks. Comparatively, random agents have a zero average return. This poor performance is in accordance with the results in Raileanu & Rocktäschel (2019) and reflects the complexity of the task: in order to go from one room to another, an agent must perform a specific action to open a door and cross it within the time limit of 200 timesteps. In the following, we visually investigate how different methods explore the environments.
195
+
196
+ ![](images/2b9e22a230d11ca43128f658217d5ed34a847b70794472a70049ba6a59245c82.jpg)
197
+ Figure 4: Average return on N10S6 with and without extrinsic reward.
198
+
199
+ # 5.5 VISUALIZING COVERAGE AND DIVERSITY
200
+
201
+ In this section, we first investigate how different methods explore environments without being guided by extrinsic rewards (the green goal is invisible to the agent) on both procedurally-generated and singleton environments. In singleton environments, an agent has to solve the same task in the same environment/maze in every episode. Fig. 5 shows the state visitation heatmaps (darker areas correspond to more visits) after a training of 10M timesteps. We observe that most of the methods explore inefficiently in a singleton environment and that only RIDE succeeds in reaching the fifth room while AGAC reaches the last (tenth) room. After training the agents in procedurally-generated environments, the methods explore even less efficiently while AGAC succeeds in exploring all rooms.
202
+
203
+ ![](images/79b4e4dfaa987603232a227680bcdf155166caf72f8802e24284152dfcbbd4e8.jpg)
204
+ Figure 6: State visitation heatmaps of the last ten episodes of an agent trained in procedurallygenerated environments without extrinsic reward for 10M timesteps in the MultiRoomN10S6 task. The agent is continuously engaging in new strategies.
205
+
206
+ We now qualitatively study the diversity of an agent’s behavior when trained with AGAC. Fig. 6 presents the state visitation heatmaps of the last ten episodes for an agent trained in procedurallygenerated environments in the MultiRoomN10S6 task without extrinsic reward. The heatmaps correspond to the behavior of the resulting policy, which is still learning from the AGAC objective. Looking at the figure, we can see that the strategies vary at each update with, for example, backand-forth and back-to-start behaviors. Although there are no extrinsic reward, the strategies seem to diversify from one update to the next. Finally, Fig. 7 in Appendix A.2 shows the state visitation heatmaps in a different configuration: when the agent has been trained on a singleton environment in the MultiRoomN10S6 task without extrinsic reward. Same as previously, the agent is updated between each episode. Looking at the figure, we can make essentially the same observations as previously, with a noteworthy behavior in the fourth heatmap of the bottom row where it appears the agent went to the fourth room to remain inside it. Those episodes indicate that, although the agent sees the same environment repeatedly, the successive adversarial updates force it to continuously adapt its behavior and try new strategies.
207
+
208
+ # 6 DISCUSSION
209
+
210
+ This paper introduced AGAC, a modification to the traditional actor-critic framework: an adversary network is added as a third protagonist. The mechanics of AGAC have been discussed from a policy iteration point of view, and we provided theoretical insight into the inner workings of the proposed algorithm: the adversary forces the agent to remain close to the current policy while moving away from the previous ones. In a nutshell, the influence of the adversary makes the actor conservatively diversified.
211
+
212
+ In the experimental study, we have evaluated the adversarially-based bonus in VizDoom and empirically demonstrated its effectiveness and superiority compared to other relevant methods (some benefiting from count-based exploration). Then, we have conducted several performance experiments using AGAC and have shown a significant performance improvement over some of the most popular exploration methods (RIDE, AMIGo, Count, RND and ICM) on a set of various challenging tasks from MiniGrid. These procedurally-generated environments have served another purpose which is to validate the capacity of our method to generalize to unseen scenarios. In addition, the training stability of our method has been studied, showing a greater but acceptable sensitivity for $c$ , the adversarial bonus coefficient. Finally, we have investigated the exploration capabilities of AGAC in a reward-free setting where the agent demonstrated exhaustive exploration through various strategic choices, confirming that the adversary successfully drives diversity in the behavior of the actor.
213
+
214
+ # REFERENCES
215
+
216
+ Zafarali Ahmed, Nicolas Le Roux, Mohammad Norouzi, and Dale Schuurmans. Understanding the impact of entropy on policy optimization. In International Conference on Machine Learning, pp. 151–160, 2019.
217
+
218
+ Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks. In International Conference on Representation Learning, 2017.
219
+
220
+ Dzmitry Bahdanau, Felix Hill, Jan Leike, Edward Hughes, Pushmeet Kohli, and Edward Grefenstette. Learning to understand goal specifications by modelling reward. In International Conference on Learning Representations, 2019.
221
+
222
+ Andrew Barto, Richard Sutton, and Charles Anderson. Neuronlike adaptive elements that can solve difficult learning control problems. IEEE transactions on systems, man, and cybernetics, (5): 834–846, 1983.
223
+
224
+ 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, 2016a.
225
+
226
+ 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, 2016b.
227
+
228
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
229
+
230
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. In International Conference on Learning Representations, 2018.
231
+
232
+ Andres Campero, Roberta Raileanu, Heinrich Küttler, Joshua B. Tenenbaum, Tim Rocktäschel, and Edward Grefenstette. Learning with amigo: Adversarially motivated intrinsic goals. International Conference on Learning Representations, 2021.
233
+
234
+ Maxime Chevalier-Boisvert, Lucas Willems, and Suman Pal. Minimalistic gridworld environment for openai gym. https://github.com/maximecb/gym-minigrid, 2018.
235
+
236
+ Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). In International Conference on Representation Learning, 2016.
237
+
238
+ Karl Cobbe, Chris Hesse, Jacob Hilton, and John Schulman. Leveraging procedural generation to benchmark reinforcement learning. In International Conference on Machine Learning, pp. 2048–2056. PMLR, 2020.
239
+
240
+ Adrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O Stanley, and Jeff Clune. Go-explore: a new approach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019.
241
+
242
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Vlad Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. In International Conference on Machine Learning, pp. 1407–1416, 2018.
243
+
244
+ 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.
245
+
246
+ Jesse Farebrother, Marlos C Machado, and Michael Bowling. Generalization and regularization in dqn. arXiv preprint arXiv:1810.00123, 2018.
247
+
248
+ Johan Ferret, Raphaël Marinier, Matthieu Geist, and Olivier Pietquin. Self-attentional credit assignment for transfer in reinforcement learning. In International Joint Conference on Artificial Intelligence, pp. 2655–2661, 2020.
249
+
250
+ Johan Ferret, Olivier Pietquin, and Matthieu Geist. Self-imitation advantage learning. In International Conference on Autonomous Agents and Multiagent Systems, 2021.
251
+
252
+ Yannis Flet-Berliac and Philippe Preux. Only relevant information matters: Filtering out noisy samples to boost rl. In International Joint Conference on Artificial Intelligence, pp. 2711–2717, 2020.
253
+
254
+ Yannis Flet-Berliac, Reda Ouhamma, Odalric-Ambrym Maillard, and Philippe Preux. Learning value functions in deep policy gradients using residual variance. In International Conference on Learning Representations, 2021.
255
+
256
+ Carlos Florensa, David Held, Xinyang Geng, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. In International Conference on Machine Learning, pp. 1515–1528, 2018.
257
+
258
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alexander Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, Charles Blundell, and Shane Legg. Noisy networks for exploration. In International Conference on Representation Learning, 2018.
259
+
260
+ Matthieu Geist, Bruno Scherrer, and Olivier Pietquin. A theory of regularized markov decision processes. In International Conference on Machine Learning, 2019.
261
+
262
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
263
+
264
+ Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.
265
+
266
+ Audrunas Gruslys, Will Dabney, Mohammad Gheshlaghi Azar, Bilal Piot, Marc Bellemare, and Remi Munos. The reactor: A fast and sample-efficient actor-critic agent for reinforcement learning. In International Conference on Learning Representations, 2018.
267
+
268
+ Seungyul Han and Youngchul Sung. Diversity actor-critic: Sample-aware entropy regularization for sample-efficient exploration. arXiv preprint arXiv:2006.01419, 2020.
269
+
270
+ Matthew Hausknecht and Peter Stone. Deep recurrent q-learning for partially observable mdps. In AAAI Fall Symposium on Sequential Decision Making for Intelligent Agents, 2015.
271
+
272
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
273
+
274
+ Maximilian Igl, Kamil Ciosek, Yingzhen Li, Sebastian Tschiatschek, Cheng Zhang, Sam Devlin, and Katja Hofmann. Generalization in reinforcement learning with selective noise injection and information bottleneck. In Advances in Neural Information Processing Systems, 2019.
275
+
276
+ Niels Justesen, Ruben Rodriguez Torrado, Philip Bontrager, Ahmed Khalifa, Julian Togelius, and Sebastian Risi. Illuminating generalization in deep reinforcement learning through procedural level generation. In NeurIPS Workshop on Deep Reinforcement Learning, 2018.
277
+
278
+ Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. Vizdoom: ´ A doom-based ai research platform for visual reinforcement learning. In IEEE Conference on Computational Intelligence and Games, pp. 1–8. IEEE, 2016.
279
+
280
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Representation Learning, 2015.
281
+
282
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In International Conference on Learning Representations, 2017.
283
+
284
+ Kimin Lee, Kibok Lee, Jinwoo Shin, and Honglak Lee. Network randomization: A simple technique for generalization in deep reinforcement learning. In International Conference on Learning Representations, 2020.
285
+
286
+ Timothy Lillicrap, Jonathan Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. In International Conference on Learning Representations, 2016.
287
+
288
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. In International Conference on Learning Representations, 2016.
289
+
290
+ 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.
291
+
292
+ 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.
293
+
294
+ Rémi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1054–1062, 2016.
295
+
296
+ Junhyuk Oh, Yijie Guo, Satinder Singh, and Honglak Lee. Self-imitation learning. In International Conference on Machine Learning, 2018.
297
+
298
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In International Conference on Machine Learning, pp. 2778–2787, 2017.
299
+
300
+ David Pfau and Oriol Vinyals. Connecting generative adversarial networks and actor-critic methods. arXiv preprint arXiv:1610.01945, 2016.
301
+
302
+ Martin Puterman. Markov Decision Processes. Wiley, 1994. ISBN 978-0471727828.
303
+
304
+ Roberta Raileanu and Tim Rocktäschel. Ride: Rewarding impact-driven exploration for procedurallygenerated environments. In International Conference on Learning Representations, 2019.
305
+
306
+ 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.
307
+
308
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. In International Conference on Learning Representations, 2016.
309
+
310
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
311
+
312
+ David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In International Conference on Machine Learning, 2014.
313
+
314
+ Xingyou Song, Yiding Jiang, Yilun Du, and Behnam Neyshabur. Observational overfitting in reinforcement learning. In International Conference on Learning Representations, 2020.
315
+
316
+ Richard Stuart Sutton. Temporal Credit Assignment in Reinforcement Learning. PhD thesis, University of Massachusetts Amherst, 1984.
317
+
318
+ Nino Vieillard, Tadashi Kozuno, Bruno Scherrer, Olivier Pietquin, Rémi Munos, and Matthieu Geist. Leverage the average: an analysis of regularization in rl. In Advances in Neural Information Processing Systems, 2020a.
319
+
320
+ Nino Vieillard, Olivier Pietquin, and Matthieu Geist. Munchausen reinforcement learning. In Advances in Neural Information Processing Systems, 2020b.
321
+
322
+ Oriol Vinyals, Igor Babuschkin, Wojciech Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David Choi, Richard Powell, Timo Ewalds, Petko Georgiev, Junhyuk Oh, Dan Horgan, Manuel Kroiss, Ivo Danihelka, Aja Huang, Laurent Sifre, Trevor Cai, John Agapiou, Max Jaderberg, and David Silver. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575, 11 2019.
323
+
324
+ Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. In International Conference on Learning Representations, 2017.
325
+
326
+ Yuhuai Wu, Elman Mansimov, Roger B Grosse, Shun Liao, and Jimmy Ba. Scalable trust-region method for deep reinforcement learning using kronecker-factored approximation. In Advances in Neural Information Processing Systems, pp. 5279–5288, 2017.
327
+
328
+ Amy Zhang, Nicolas Ballas, and Joelle Pineau. A dissection of overfitting and generalization in continuous reinforcement learning. arXiv preprint arXiv:1806.07937, 2018a.
329
+
330
+ Chiyuan Zhang, Oriol Vinyals, Remi Munos, and Samy Bengio. A study on overfitting in deep reinforcement learning. arXiv preprint arXiv:1804.06893, 2018b.
331
+
332
+ # A ADDITIONAL EXPERIMENTS
333
+
334
+ # A.1 MINIGRID PERFORMANCE
335
+
336
+ In this section, we report the final performance of all methods considered in the MiniGrid experiments of Fig. 2 with the scores reported in Raileanu & Rocktäschel (2019) and Campero et al. (2021). All methods have a budget of 200M frames.
337
+
338
+ Table 2: Final average performance of all methods on several MiniGrid environments.
339
+
340
+ <table><tr><td>Task</td><td>KC-S4R3</td><td>KC-S5R3</td><td>MR-N10S10</td><td>OM-2Dlhb</td><td>OM-1Q</td><td>OM-2Q</td></tr><tr><td>AGAC</td><td>0.95</td><td>0.93</td><td>0.52</td><td>0.64</td><td>0.78</td><td>0.63</td></tr><tr><td>RIDE</td><td>0.19</td><td>0.</td><td>0.40</td><td>0.</td><td>0.</td><td>0.</td></tr><tr><td>AMIGo</td><td>0.54</td><td>0.</td><td>0.</td><td>0.20</td><td>0.</td><td>0.</td></tr><tr><td>RND</td><td>0.</td><td>0.</td><td>0.</td><td>0.03</td><td>0.</td><td>0.</td></tr><tr><td>Count</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td></tr><tr><td>ICM</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td><td>0.</td></tr></table>
341
+
342
+ A.2 STATE VISITATION HEATMAPS IN SINGLETON ENVIRONMENT WITH NO EXTRINSIC REWARD
343
+
344
+ In this section, we provide additional state visitation heatmaps. The agent has been trained on a singleton environment from the MultiRoomN10S6 task without extrinsic reward. The last ten episodes of the training suggest that although the agent experiences the same maze over and over again, the updates force it to change behavior and try new strategies.
345
+
346
+ ![](images/bdafbf5ffde8d9779028392dcc80b27fab8981f669d6dfdeaf60ea0f5e559087.jpg)
347
+ Figure 7: State visitation heatmaps of the last ten episodes of an agent trained in a singleton environment with no extrinsic reward 10M timesteps in the MultiRoomN10S6 task. The agent is continuously engaging into new strategies.
348
+
349
+ # A.3 (EXTREMELY) HARD-EXPLORATION TASKS WITH PARTIALLY-OBSERVABLE ENVIRONMENTS
350
+
351
+ In this section, we include additional experiments on one of the hardest tasks available in MiniGrid. The first is KeyCorridorS8R3, where the size of the rooms has been increased. In it, the agent has to pick up an object which is behind a locked door: the key is hidden in another room and the agent has to explore the environment to find it. The second, ObstructedMazeFull, is similar to ObstructedMaze4Q, where the agent has to pick up a box which is placed in one of the four corners of a 3x3 maze: the doors are locked, the keys are hidden in boxes and the doors are obstructed by balls. In those difficult tasks, only our method succeeds in exploring well enough to find rewards.
352
+
353
+ ![](images/2c2ebfe32501ea6424be77611fdb79a4abd159715b1b940e6c5d877763053c79.jpg)
354
+ Figure 8: Performance evaluation of AGAC compared to RIDE, AMIGo, Count, RND and ICM on extremely hard-exploration problems.
355
+
356
+ # A.4 MEAN INTRINSIC REWARD
357
+
358
+ In this section, we report the mean intrinsic reward computed for an agent trained in MultiRoomN12S10 to conveniently compare our results with that of Raileanu & Rocktäschel (2019). We observe in Fig. 9 that the intrinsic reward is consistently larger for our method and that, contrary to other methods, does not converge to low values. Please note that, in all considered experiments, the adversarial bonus coefficient $c$ in Eq. 2 and 3 is linearly annealed throughout the training since it is mainly useful at the beginning of learning when the rewards have not yet been met. In the long run, this coefficient may prevent the agent from solving the task by forcing it to always favour exploration over exploitation.
359
+
360
+ ![](images/28473b81bbecae89bf11a7987beadae0deed242b6ba51bdf0240df3613591c4e.jpg)
361
+ Figure 9: Average intrinsic reward for different methods trained in MultiRoomN12S10.
362
+
363
+ ![](images/3ce38e04ad09fb53cf941a1929d15591fb412b83302fde934dd965c50f3e5f5f.jpg)
364
+ Figure 10: A simple schematic illustration of AGAC. Left: the adversary minimizes the KL-divergence with respect to the action probability distribution of the actor. Right: the actor receives a bonus when counteracting the predictions of the adversary.
365
+
366
+ # C EXPERIMENTAL DETAILS AND HYPERPARAMETERS
367
+
368
+ # C.1 MINIGRID SETUP
369
+
370
+ Here, we describe in more details the experimental setup we used in our MiniGrid experiments.
371
+
372
+ There are several different MiniGrid scenarios that we consider in this paper. MultiRoom corresponds to a set of navigation tasks, where the goal is to go from a starting state to a goal state. The notation MultiRoom-N2S4 means that there are 2 rooms in total, and that each room has a maximal side of 4. In order to go from one room to another, the agent must perform a specific action to open a door. Episodes are terminated with zero reward after a maximum of $2 0 \times N$ steps with $N$ the number of rooms. In KeyCorridor, the agent also has to pick up a key, since the goal state is behind a door that only lets it in with the key. The notation KeyCorridor-S3R4 means that there are 4 side corridors, leading to rooms that have a maximal side of 3. The maximum number of steps is 270. In ObstructedMaze, keys are hidden in boxes, and doors are obstructed by balls the agent has to get out of its way. The notation ObstructedMaze-1Dl means that there are two connected rooms of maximal side 6 and 1 door (versus a 3x3 matrix and 2 doors if the leading characters are $2 D$ ), adding $h$ as a suffix places keys in boxes, and adding $b$ as a suffix adds balls in front of doors. Using $Q$ as a suffix is equivalent to using lhb (that is, both hiding keys and placing balls to be moved). The maximum number of steps is 576. ObstructedMazeFull is the hardest configuration for this scenario, since it has the maximal number of keys, balls to move, and doors possible.
373
+
374
+ In each scenario, the agent has access to a partial view of the environment, a $7 \mathrm { x } 7 $ square that includes itself and points in the direction of its previous movement.
375
+
376
+ # C.2 HYPERPARAMETERS
377
+
378
+ In all experiments, we train six different instances of our algorithm with different random seeds. In Table 3, we report the list of hyperparameters.
379
+
380
+ Table 3: Hyperparameters used in AGAC.
381
+
382
+ <table><tr><td>Parameter</td><td>Value</td></tr><tr><td>Horizon T</td><td>2048</td></tr><tr><td>Nb. epochs</td><td>4</td></tr><tr><td>Nb.minibatches</td><td>8</td></tr><tr><td>Nb.frames stacked</td><td>4</td></tr><tr><td>Nonlinearity</td><td>ELU (Clevert et al., 2016)</td></tr><tr><td>Discount γ</td><td>0.99</td></tr><tr><td>GAE parameter 入</td><td>0.95</td></tr><tr><td>PPO clipping parameter e</td><td>0.2</td></tr><tr><td>βv</td><td>0.5</td></tr><tr><td>C c anneal schedule</td><td>4·10-4 (4·10-5 in VizDoom)</td></tr><tr><td></td><td>linear</td></tr><tr><td>βadv</td><td>4·10-5</td></tr><tr><td>Adam stepsize m1</td><td>3·10-4</td></tr><tr><td>Adam stepsize m2</td><td>9.10-5 = 0.3· m1</td></tr></table>
383
+
384
+ # D IMPLEMENTATION DETAILS
385
+
386
+ In Fig. 11 is depicted the architecture of our method.
387
+
388
+ ![](images/166400757cb98035c5bef5beb612bef9f83aa90345f67690ff8af762d98632a2.jpg)
389
+ Figure 11: Artificial neural architecture of the critic, the actor and the adversary.
390
+
391
+ # E PROOF OF SECTION 4.1 RESULTS
392
+
393
+ In this section, we provide a short proof for the result of the optimization problem in Section 4.1. We recall the result here:
394
+
395
+ $$
396
+ \pi _ { k + 1 } = \mathop { \arg \operatorname* { m a x } } _ { \pi } \mathcal { I } _ { \mathrm { P I } } ( \pi ) \propto \left( \frac { \pi _ { k } } { \pi _ { \mathrm { a d v } } } \right) ^ { \frac { c } { \alpha } } \exp \frac { Q _ { \pi _ { k } } } { \alpha } ,
397
+ $$
398
+
399
+ with the objective function:
400
+
401
+ $$
402
+ \begin{array} { r } { \mathcal { I } _ { \mathrm { P I } } ( \pi ) = \mathbb { E } _ { s } \mathbb { E } _ { a \sim \pi ( \cdot | s ) } [ Q _ { \pi _ { k } } ( s , a ) + c ( \log \pi _ { k } ( a | s ) - \log \pi _ { \mathrm { a d v } } ( a | s ) ) - \alpha \log \pi ( a | s ) ] . } \end{array}
403
+ $$
404
+
405
+ Proof. We first consider a simpler optimization problem: a $\because \operatorname { g m a x } _ { \pi } \langle \pi , Q _ { \pi _ { k } } \rangle + \alpha \mathcal { H } ( \pi )$ , whose solution is known (Vieillard et al., 2020a, Appendix A). The expression for the maximizer is the $\alpha$ -scaled softmax:
406
+
407
+ $$
408
+ \pi ^ { * } = \frac { \exp ( \frac { Q _ { \pi _ { k } } } { \alpha } ) } { \langle 1 , \exp ( \frac { Q _ { \pi _ { k } } } { \alpha } ) \rangle } .
409
+ $$
410
+
411
+ We now turn towards the optimization problem of interest, which we can rewrite as:
412
+
413
+ $$
414
+ \underset { \pi } { \arg \operatorname* { m a x } } \langle \pi , Q _ { \pi _ { k } } + c \left( \log \pi _ { k } - \log \pi _ { \mathrm { a d v } } \right) \rangle + \alpha \mathcal { H } ( \pi ) .
415
+ $$
416
+
417
+ By the simple change of variable $\tilde { Q } _ { \pi _ { k } } = Q _ { \pi _ { k } } + c ( \log \pi _ { k } - \log \pi _ { \mathrm { a d v } } )$ , we can reuse the previous solution (replacing $Q _ { \pi _ { k } }$ by $\tilde { Q } _ { \pi _ { k } }$ ). With the simplification:
418
+
419
+ $$
420
+ \exp \frac { Q _ { \pi _ { k } } + c \left( \log \pi _ { k } - \log \pi _ { \mathrm { a d v } } \right) } { \alpha } = \left( \frac { \pi _ { k } } { \pi _ { \mathrm { a d v } } } \right) ^ { \frac { c } { \alpha } } \exp \frac { Q _ { \pi _ { k } } } { \alpha } ,
421
+ $$
422
+
423
+ we obtain the result and conclude the proof.
md/train/kgVJBBThdSZ/kgVJBBThdSZ.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Data Augmentation Can Improve Robustness
2
+
3
+ Sylvestre-Alvise Rebuffi\*, Sven Gowal\*, Dan Calian,
4
+ Florian Stimberg, Olivia Wiles and Timothy Mann DeepMind, London {sylvestre,sgowal}@deepmind.com
5
+
6
+ # Abstract
7
+
8
+ Adversarial training suffers from robust overfitting, a phenomenon where the robust test accuracy starts to decrease during training. In this paper, we focus on reducing robust overfitting by using common data augmentation schemes. We demonstrate that, contrary to previous findings, when combined with model weight averaging, data augmentation can significantly boost robust accuracy. Furthermore, we compare various data augmentations techniques and observe that spatial composition techniques work best for adversarial training. Finally, we evaluate our approach on CIFAR-10 against $\ell _ { \infty }$ and $\ell _ { 2 }$ norm-bounded perturbations of size $\epsilon = 8 / 2 5 5$ and $\epsilon = 1 2 8 / 2 5 5$ , respectively. We show large absolute improvements of $+ 2 . 9 3 \%$ and $+ 2 . 1 6 \%$ in robust accuracy compared to previous state-of-the-art methods. In particular, against $\ell _ { \infty }$ norm-bounded perturbations of size $\epsilon = 8 / 2 5 5$ , our model reaches $6 0 . 0 7 \%$ robust accuracy without using any external data. We also achieve a significant performance boost with this approach while using other architectures and datasets such as CIFAR-100, SVHN and TINYIMAGENET.
9
+
10
+ # 1 Introduction
11
+
12
+ Despite their success, neural networks are not intrinsically robust. In particular, it has been shown that the addition of imperceptible deviations to the input, called adversarial perturbations, can cause neural networks to make incorrect predictions with high confidence [5, 6, 18, 32, 49]. Starting with Szegedy et al. [49], there has been a lot of work on understanding and generating adversarial perturbations [2, 6], and on building defenses that are robust to such perturbations [18, 29, 34, 41]. Unfortunately, many of the defenses proposed in the literature target failure cases found through specific adversaries, and as such they are easily broken by different adversaries [3, 53]. Among successful defenses are robust optimization techniques like the one by Madry et al. [34] that learns robust models by finding worst-case adversarial perturbations at each training step before adding them to the training data. In fact, adversarial training as proposed by Madry et al. is so effective [20] that it is the de facto standard for training adversarially robust neural networks. Indeed, since Madry et al. [34], various modifications to their original implementation have been proposed [20, 27, 40, 44, 57, 63].
13
+
14
+ Notably, Carmon et al. [7], Hendrycks et al. [25], Najafi et al. [36], Uesato et al. [54], Zhai et al. [60] showed that using additional data improves adversarial robustness, while Gowal et al. [20], Rice et al. [44], Wu et al. [56] found that data augmentation techniques did not boost robustness. This dichotomy motivates this paper. In particular, we explore whether it is possible to fix the training procedure such that data augmentation becomes useful in the setting without additional data. By making the observation that model weight averaging (WA) [28] helps robust generalization to a wider extent when robust overfitting is minimized, we propose to combine model weight averaging with data augmentation techniques. Overall, we make the following contributions:
15
+
16
+ • We demonstrate that, when combined with model weight averaging, data augmentation techniques such as Cutout [15], CutMix [58] and MixUp [62] can improve robustness.
17
+
18
+ ![](images/2e0aa00216881a58dabc6b0e427c5044c3decfceb370758e74b519ccf588afed.jpg)
19
+ Figure 1: Robust accuracy of various models submitted to RobustBench [11] against AUTOATTACK [10] on CIFAR-10 with $\ell _ { \infty }$ perturbations of size $8 / 2 5 5$ displayed in publication order. Our method builds on Gowal et al. [20] (shown above with $5 7 . 2 0 \%$ and explores how augmented data can be used to improve robust accuracy by $+ 2 . 8 7 \%$ without using any additional external data.
20
+
21
+ • To the contrary of Gowal et al. [20], Rice et al. [44], Wu et al. [56] which all tried data augmentation techniques without success, we are able to use any of these three aforementioned techniques to obtain new state-of-the-art robust accuracies (see Figure 1). We find CutMix to be the most effective method by reaching a robust accuracy of $6 0 . 0 7 \%$ on CIFAR-10 against $\ell _ { \infty }$ perturbations of size $\epsilon = 8 / 2 5 5$ (an improvement of $+ 2 . 9 3 \%$ upon the state-of-the-art).
22
+
23
+ • We conduct thorough experiments to show that our approach generalizes across architectures, datasets and threat models. We also investigate the trade-off between robust overfitting and underfitting to explain why $M i x U p$ performs worse than spatial composition techniques.
24
+
25
+ • Finally, we provide empirical evidence that weight averaging exploits data augmentation by ensembling model snapshots which have the same total accuracy but differ at the individual prediction level.
26
+
27
+ # 2 Related Work
28
+
29
+ Adversarial $\ell _ { p }$ -norm attacks. Since Szegedy et al. [49] observed that neural networks which achieve high accuracy on test data are highly vulnerable to adversarial examples, the art of crafting increasingly sophisticated adversarial examples has received a lot of attention. Goodfellow et al. [18] proposed the Fast Gradient Sign Method (FGSM) which generates adversarial examples with a single normalized gradient step. It was followed by $\mathrm { R + F G S M }$ [52], which adds a randomization step, and the Basic Iterative Method (BIM) [32], which takes multiple smaller gradient steps.
30
+
31
+ Adversarial training as a defense. The adversarial training procedure [34] feeds adversarially perturbed examples back into the training data. It is widely regarded as one of the most successful method to train robust deep neural networks. It has been augmented in different ways – with changes in the attack procedure (e.g., by incorporating momentum [16]), loss function (e.g., logit pairing [35]) or model architecture (e.g., feature denoising [57]). Another notable work by Zhang et al. [63] proposed TRADES, which balances the trade-off between standard and robust accuracy, and achieved state-of-the-art performance against $\ell _ { \infty }$ norm-bounded perturbations on CIFAR-10. More recently, the work from Rice et al. [44] studied robust overfitting and demonstrated that improvements similar to TRADES could be obtained more easily using classical adversarial training with early stopping. This later study revealed that early stopping was competitive with many other regularization techniques and demonstrated that data augmentation schemes beyond the typical random padding-and-cropping were ineffective on CIFAR-10. Finally, Gowal et al. [20] highlighted how different hyper-parameters (such as network size and model weight averaging) affect robustness. They were able to obtain models that significantly improved upon the state-of-the-art, but lacked a thorough investigation on data augmentation schemes. Similarly to Rice et al. [44], they also make the conclusion that data augmentations beyond random padding-and-cropping do not improve robustness.
32
+
33
+ Data augmentation. Data augmentation has been shown to improve the generalisation of standard (non-robust) training. For image classification tasks, random flips, rotations and crops are commonly used [23]. More sophisticated techniques such as Cutout [15] (which produces random occlusions), CutMix [58] (which replaces parts of an image with another) and MixUp [62] (which linearly interpolates between two images) all demonstrate extremely compelling results. As such, it is rather surprising that they remain ineffective when training adversarially robust networks [20, 44, 56]. In this work, we revisit these common augmentation techniques in the context of adversarial training.
34
+
35
+ # 3 Preliminaries and hypothesis
36
+
37
+ The rest of this manuscript is organized as follows. In this section, we provide an overview of adversarial training and introduce the hypothesis that model weight averaging works better when robust overfitting is reduced. In section 4 we discuss that data augmentations can be used to verify this hypothesis. Finally, we provide thorough experimental results in section 6.
38
+
39
+ # 3.1 Adversarial training
40
+
41
+ Madry et al. [34] formulate a saddle point problem to find model parameters $\pmb { \theta }$ that minimize the adversarial risk:
42
+
43
+ $$
44
+ \underset { \pmb { \theta } } { \arg \operatorname* { m i n } } \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } } \left[ \underset { \delta \in \mathbb { S } } { \operatorname* { m a x } } l ( f ( \pmb { x } + \pmb { \delta } ; \pmb { \theta } ) , y ) \right]
45
+ $$
46
+
47
+ where $\mathcal { D }$ is a data distribution over pairs of examples $_ { \textbf { \em x } }$ and corresponding labels $y$ , $f ( \cdot ; \pmb \theta )$ is a model parametrized by $\theta , l$ is a suitable loss function (such as the $0 - 1$ loss in the context of classification tasks), and $\mathbb { S }$ defines the set of allowed perturbations. For $\ell _ { p }$ norm-bounded perturbations of size $\epsilon$ , the adversarial set is defined as $\mathbb { S } _ { p } = \{ \pmb { \delta } | \| \pmb { \delta } \| _ { p } \le \epsilon \}$ . In the rest of this manuscript, we will use $\epsilon _ { p }$ to denote $\ell _ { p }$ norm-bounded perturbations of size $\epsilon$ (e.g., $\epsilon _ { \infty } = 8 / 2 5 5 )$ . To solve the inner optimization problem, Madry et al. [34] use Projected Gradient Descent (PGD), which replaces the non-differentiable $0 - 1$ loss $l$ with the cross-entropy loss $l _ { \mathrm { c e } }$ and computes an adversarial perturbation $\hat { \pmb { \delta } } = \pmb { \delta } ^ { ( K ) }$ in $K$ gradient ascent steps of size $\alpha$ as
48
+
49
+ $$
50
+ \delta ^ { ( k + 1 ) } \gets \mathrm { p r o j } _ { \mathbb { S } } \Big ( \delta ^ { ( k ) } + \alpha \mathrm { s i g n } \left( \nabla _ { \delta ^ { ( k ) } } l _ { \mathrm { c e } } ( f ( \boldsymbol { x } + \delta ^ { ( k ) } ; \boldsymbol { \theta } ) , y ) \right) \Big )
51
+ $$
52
+
53
+ where $\delta ^ { ( 0 ) }$ is chosen at random within $\mathbb { S }$ , and where $\mathrm { p r o j } _ { \mathbb { A } } ( a )$ projects a point $\textbf { \em a }$ back onto a set A, $\begin{array} { r } { \operatorname { p r o j } _ { \mathbb { A } } ( \pmb { a } ) = \operatorname { a r g m i n } _ { \pmb { a } ^ { \prime } \in \mathbb { A } } \| \pmb { a } - \pmb { a } ^ { \prime } \| _ { 2 } } \end{array}$ . We refer to this inner optimization with $K$ steps as $\mathrm { P G D } ^ { K }$ .
54
+
55
+ # 3.2 Robust overfitting
56
+
57
+ To the contrary of standard training, which often shows no overfitting in practice [61], adversarial training suffers from robust overfitting [44]. Robust overfitting is the phenomenon by which robust accuracy on the test set quickly degrades while it continues to rise on the train set (clean accuracy on both sets continues to improve as well). Rice et al. [44] propose to use early stopping as the main contingency against robust overfitting, and demonstrate that it also allows to train models that are more robust than those trained with other regularization techniques (such as data augmentation or increased $\ell _ { 2 }$ -regularization). They observed that some of these other regularization techniques could reduce the impact of overfitting at the cost of producing models that are over-regularized and lack overall robustness and accuracy. There is one notable exception which is the addition of external data [7, 54]. Figure 2(a) shows how the robust accuracy (evaluated on the test set) evolves as training progresses on CIFAR-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ . Without external data, robust overfitting is clearly visible and appears shortly after the learning rate is dropped (the learning rate is decayed by $1 0 \times$ two-thirds through training in a schedule similar to [44] and commonly used since [34]). Robust overfitting completely disappears when an additional set of 500K pseudo-labeled images (see Carmon et al. [7]) is introduced.
58
+
59
+ # 3.3 Model weight averaging
60
+
61
+ Model weight averaging (WA) [28] can be implemented using an exponential moving average $\pmb { \theta } ^ { \prime }$ of the model parameters $\pmb \theta$ with a decay rate $\tau$ (i.e., $\pmb { \theta } ^ { \prime } \tau \cdot \bar { \pmb { \theta } } ^ { \prime } + ( 1 - \tau ) \cdot \pmb { \theta }$ at each training step). During evaluation, the weighted parameters $\pmb { \theta } ^ { \prime }$ are used instead of the trained parameters $\pmb \theta$ . Chen et al. [8], Gowal et al. [20] discovered that model weight averaging can significantly improve robustness on a wide range of models and datasets. Chen et al. [8] argue (similarly to [56]) that WA leads to a flatter adversarial loss landscape, and thus a smaller robust generalization gap. Gowal et al. [20] also explain that, in addition to improved robustness, WA reduces sensitivity to early stopping. While this is true, it is important to note that WA is still prone to robust overfitting. This is not surprising, since the exponential moving average “forgets” older model parameters as training goes on. Figure 2(b) shows how the robust accuracy evolves as training progresses when using WA. We observe that, after the change of learning rate, the averaged weights are increasingly affected by overfitting, thus resulting in worse robust accuracy for the averaged model.
62
+
63
+ ![](images/47c8698cc257d7bc458bfa3b0ea9ed1de7b2a644577d0882248a814150ffc88b.jpg)
64
+
65
+ (a) Adversarial training with and without additional data from 80M-TI (without WA)
66
+
67
+ ![](images/5c51166b14eebf22c7924ee97702cbac277d6a77a7bfef840a6a4bc13661b9b1.jpg)
68
+ (c) Effect of WA with external data
69
+
70
+ ![](images/644dae8c1bb75851b6017e1f323f3a7de4b61271d0c173261d50a8f3ebaa55ec.jpg)
71
+ (b) Effect of WA without external data
72
+ Figure 2: We compare the robust accuracy against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 of an adversarially trained Wide ResNet (WRN)-28-10. Panel (a) shows the impact of using additional external data from 80M-TI [51] and illustrates robust overfitting. Panel (b) shows the benefit of model weight averaging (WA) despite robust overfitting. Panel (c) shows that WA remains effective and useful even when robust overfitting disappears. The graphs show the evolution of the robust accuracy as training progresses (against $\mathrm { P G D ^ { 4 0 } }$ ). The jump two-thirds through training is due to a drop in learning rate.
73
+
74
+ # 3.4 Hypothesis
75
+
76
+ As WA results in flatter, wider solutions compared to the steep decrease in robust accuracy observed for Stochastic Gradient Descent (SGD) [8], it is natural to ask ourselves whether WA remains useful in cases that do not exhibit robust overfitting. Figure 2(c) shows how the robust accuracy evolves as training progresses when using WA and additional external data (for which standard SGD does not show signs of overfitting). We notice that the robust performance in this setting is not only preserved but even boosted when using WA. Hence, we formulate the hypothesis that model weight averaging helps robustness to a greater extent when robust accuracy between model iterations can be maintained. This hypothesis is also motivated by the observation that WA acts as a temporal ensemble – akin to Fast Geometric Ensembling by Garipov et al. [17] who show that efficient ensembling can be obtained by aggregating multiple checkpoint parameters at different training times. As such, to improve robustness, it is important to ensemble a suite of equally strong and diverse models. Although mildly successful, we note that ensembling has received some attention in the context of adversarial training [39, 48]. In particular, Grefenstette et al. [22], Tramèr et al. [52] found that ensembling could reduce the risk of gradient obfuscation caused by locally non-linear loss surfaces.
77
+
78
+ # 4 Data augmentations
79
+
80
+ Limiting robust overfitting without external data. Rice et al. [44] show that combining data augmentation methods such as Cutout or $M i x U p$ with early stopping does not improve robustness upon early stopping alone. While, these methods do not improve upon the “best” robust accuracy, they reduce the extent of robust overfitting, thus resulting in a slower decrease in robust accuracy compared to classical adversarial training (which uses random crops and weight decay). This can be seen in Figure 3(a) where $M i x U p$ without WA exhibits no decrease in robust accuracy, whereas the robust accuracy of the standard combination of random padding-and-cropping without WA (Pad & Crop) decreases immediately after the change of learning rate.
81
+
82
+ Testing the hypothesis. Since $M i x U p$ preserves robust accuracy while Pad & Crop does not, this comparison can be used to evaluate the hypothesis that WA is more beneficial when the performance between model iterations is maintained. Therefore, we compare in Figure 3(b) the effect of WA on robustness when using $M i x U p$ . We observe that, when using WA, the performance of $M i x U p$ surpasses the performance of Pad & Crop. Indeed, the robust accuracy obtained by the averaged weights of Pad & Crop (in blue) slowly decreases after the change of learning rate, while the one obtained by $M i x U p$ (in green) increases throughout training1. Ultimately, $M i x U p$ with WA obtains a higher robust accuracy despite the fact that the non-averaged $M i x U p$ model has a significantly lower “best” robust accuracy than the non-averaged Pad & Crop model. This finding is notable as it demonstrates for the first time the benefits of data augmentation schemes for adversarial training (this contradicts the findings from three recent publications: [20, 44, 56]).
83
+
84
+ ![](images/1e25326e2ee34f9265746f8c3cac2d671e7c43c29cb4409bb919f1d9519e0e03.jpg)
85
+ Figure 3: Accuracy against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 with and without using model weight averaging (WA) for different data augmentation schemes. The model is a WRN-28-10 and both panels show the evolution of the robust accuracy as training progresses (against $\mathrm { P G D } ^ { 4 0 }$ ). The jump in robust accuracy two-thirds through training is due to a drop in learning rate.
86
+
87
+ Exploring data augmentations. After verifying our hypothesis for $M i x U p$ , we investigate if other augmentations can help maintain robust accuracy and also be combined with WA to improve robustness. We concentrate on the following image patching techniques: Cutout [15] which inserts empty image patches and CutMix [58] which replaces part of an image with another. In section 6, we also evaluate RICAP [50] and SmoothMix [33]. We describe more thoroughly these augmentations in Appendix B where we also study additional augmentations with AutoAugment [12] and RandAugment [13]. Similarly to the analysis done for $M i x U p$ , we report in Figure 3 the robust accuracy obtained by Cutout and CutMix with and without WA throughout training. First, we note that these two techniques achieve a higher “best” robust accuracy than $M i x U p$ , as shown in Figure 3(a). The “best” robust accuracy obtained by Cutout and CutMix is roughly identical to the one obtained by Pad & Crop, which is consistent with the results from Rice et al. [44]. Second, while Cutout suffers from robust overfitting, CutMix does not. Hence, as demonstrated in the previous sections, we expect WA to be more useful with CutMix. Indeed, we observe in Figure 3(b) that the robust accuracy of the averaged model trained with CutMix keeps increasing throughout training and that its maximum value is significantly above the best accuracy reached by the other augmentation methods. In section 6, we conduct thorough evaluations of these methods against stronger attacks.
88
+
89
+ # 5 Experimental setup
90
+
91
+ Architecture. We use WRNs [23, 59] as our backbone network. This is consistent with prior work [20, 34, 44, 54, 63] which use diverse variants of this network family. Furthermore, we adopt the same architecture details as Gowal et al. [20] with Swish/SiLU [24] activation functions. Most of the experiments are conducted on a WRN-28-10 model which has a depth of 28, a width multiplier of 10 and contains 36M parameters. To evaluate the effect of data augmentations on wider and deeper networks, we also run several experiments using WRN-70-16, which contains 267M parameters.
92
+
93
+ Outer minimization. We use TRADES [63] optimized using SGD with Nesterov momentum [37, 42] and a global weight decay of $5 \times 1 0 ^ { - 4 }$ . We train for 400 epochs with a batch size of 512 split over 32 Google Cloud TPU v3 cores [4], and the learning rate is initially set to 0.1 and decayed by a factor 10 two-thirds-of-the-way through training. We scale the learning rates using the linear scaling rule of Goyal et al. [21] (i.e., effective ${ \mathrm { L R } } = \operatorname* { m a x } ( { \mathrm { L R } } \times { \mathrm { b a t c h ~ s i z e } } / 2 5 6 , { \mathrm { L R } } ) )$ . The decay rate of WA is set to $\tau = 0 . 9 9 9$ . With these settings, training a WRN-28-10 takes on average 2.5 hours.
94
+
95
+ Inner minimization. Adversarial examples are obtained by maximizing the Kullback-Leibler divergence between the predictions made on clean inputs and those made on adversarial inputs [63]. This optimization procedure is done using the Adam optimizer [30] for 10 PGD steps. We take an initial step-size of 0.1 which is then decreased to 0.01 after 5 steps.
96
+
97
+ ![](images/e7eead082ef4cff8e8c8a2cb2ba8ffe382b644f3c608e62408d2690013790f86.jpg)
98
+ Figure 4: Clean (without adversarial attacks) accuracy and robust accuracy (against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T }$ ) for a WRN-28-10 trained against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 for different data augmentation techniques. The lines from circles to squares represent the performance change obtained when using WA.
99
+
100
+ ![](images/60abb1d7bdc019f4f8ca3a72bc546010d4cdd009201e13247f605551c2aafaca.jpg)
101
+ Figure 5: The graph shows the robust test accuracy against $\mathrm { P G D } ^ { \mathrm { 4 0 } }$ with $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR10 without using WA as we vary the mixing rate $\alpha$ of $M i x U p$ . We report in the legend the robust accuracy (against $\mathbf { A A + M T }$ after applying weight averaging to the corresponding runs.
102
+
103
+ Evaluation. We follow the evaluation protocol designed by Gowal et al. [20]. Specifically, we train two (and only two) models for each hyperparameter setting, perform early stopping for each model on a separate validation set of 1024 samples using $\mathrm { P G D } ^ { 4 0 }$ similarly to Rice et al. [44] and pick the best model by evaluating the robust accuracy on the same validation set . Finally, we report the robust test accuracy against a mixture of AUTOATTACK [10] and MULTITARGETED [19], which is denoted by $\mathbf { A A } { + } \mathbf { M } \mathbf { T }$ . This mixture consists in completing the following sequence of attacks: AUTOPGD on the cross-entropy loss with 5 restarts and 100 steps, AUTOPGD on the difference of logits ratio loss with 5 restarts and 100 steps and finally MULTITARGETED on the margin loss with 10 restarts and 200 steps. The training curves, such as those visible in Figure 2, are always computed using PGD with 40 steps and the Adam optimizer (with step-size decayed by $1 0 \times$ at step 20 and 30).
104
+
105
+ # 6 Experimental results
106
+
107
+ First, we will investigate which augmentation techniques benefit the most from WA and why. Then, we will generalize our approach to other architecture, threat model and datasets. Finally, we provide empirical evidence showing that WA exploits data augmentation by ensembling model snapshots which differ at the individual prediction level.
108
+
109
+ # 6.1 Comparing data augmentations
110
+
111
+ Here, we compare data augmentations with and without WA. We consider as baseline the Pad & Crop augmentation which reproduces the current state-of-the-art set by Gowal et al. [20]. This augmentation consists in first padding the image by 4 pixels on each side and then taking a random $3 2 \times 3 2$ crop. In Figure 4, we compare this baseline with various data augmentations, MixUp, Cutout, CutMix, $R I C A P$ and SmoothMix. A first cluster (the four top squares), containing RICAP, Cutout, SmoothMix and CutMix, includes the four methods that occlude local information with patching and provide a significant boost upon the baseline with $+ 3 . 0 6 \%$ in robust accuracy for CutMix and an average improvement of $+ 1 . 5 4 \%$ in clean accuracy. The other cluster, with $M i x U p$ , only improves the robust accuracy upon the baseline by a small margin of $+ 0 . 9 1 \%$ . Furthermore, we also point out that Pad & Crop and Cutout, which were the two augmentations suffering from robust overfitting in Figure 3(a), benefit the least of WA in Figure 4 (smaller vertical gains). This is consistent with our hypothesis of section 3 that WA is the most beneficial when robust overfitting is reduced.
112
+
113
+ $M i x U p$ . A possible explanation to the worse performance of $M i x U p$ lies in the fact that $M i x U p$ , which samples the image mixing weight with a beta distribution $\mathrm { B e t a } ( \alpha , \alpha )$ , tends to either produce images that are far from the original data distribution (when $\alpha$ is large) or too close to the original samples (when $\alpha$ is small). In fact, Figure 5, which shows the robust accuracy when training without WA, illustrates the trade-off between robust overfitting and underfitting as increasing $\alpha$ can lead to robust underfitting (red curve) while an $\alpha$ too close to 0 would lead to robust overfitting. More specifically, we show in Figure 6(a) that $M i x U p$ ’s robust accuracy against $\mathbf { A A + M T }$ keeps decreasing as $\alpha$ increases and the best performance with WA is reached at $\alpha = 0 . 2$ , corresponding to blended images close to the original images.
114
+
115
+ ![](images/c8271ea57e61cbc77f42c0570be5754fb0da49fed9941a0e672541dc7d37c85f.jpg)
116
+ Figure 6: Robust test accuracy against $\mathbf { A A + M T }$ with $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 as we vary (a) the mixing rate $\alpha$ of $M i x U p$ , (b) the window length when using Cutout and (c) the window length when using CutMix. The model is a WRN-28-10 and we compare the settings without and with WA. As a reference when training only with Pad & Crop, the same model with WA and without WA reaches $5 4 . 4 4 \%$ and $5 3 . 6 6 \%$ robust accuracy, respectively. Similarly, without any augmentation, the models with WA and without WA achieve $4 9 . 7 4 \%$ and $4 2 . 2 7 \%$ , respectively.
117
+
118
+ Spatial composition techniques. Figure 6(b,c) show the robust test accuracy as we vary the window length of the patches when using Cutout and $C u t M i x ^ { 2 }$ . We observe that these two techniques are the most beneficial when using large window lengths with a peak reached at a length of 20. Hence, contrary to $M i x U p$ , they work best with patched images which greatly differ from the original images. This performance gap between $M i x U p$ and Cutout/CutMix illustrates a notable difference in the use of data augmentation for adversarial training compared to nominal training. Indeed, adversarial training can lead to underfitting. This leads to some augmentation techniques working better than others in the context of adversarial training. This is the case for spatial composition techniques which outperform blending techniques like $M i x U p$ . A possible explanation is that low-level features tend to be destroyed by $M i x U p$ , whereas composition techniques locally maintain these low-level features. Hence, we hypothesize that augmentations designed for robustness need to preserve low-level features. We provide further evidence to support this hypothesis in Appendix B by showing that some components of RandAugment such as Posterize or Invert are detrimental to adversarial robustness.
119
+
120
+ # 6.2 Generalizing to other architectures, threat model and datasets
121
+
122
+ Generalizing to other architectures. Table 1 shows the performance of CutMix and the Pad & Crop baseline when varying the model architecture and size. We experiment with different variants of WideResNet and ResNet. We use WA for both CutMix and the Pad & Crop baseline. We observe that CutMix consistently outperforms the baseline by at least $+ 2 . 9 0 \%$ in robust accuracy across all model sizes for WideResNet and by at least $+ 1 . 7 6 \%$ for ResNet models.
123
+
124
+ Generalizing to another threat model. We extend our evaluation to $\ell _ { 2 }$ -norm bounded perturbations. Table 2 shows the performance of data augmentation on CIFAR-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ and $\epsilon _ { 2 } = 1 2 8 / 2 5 5$ . We observe that using CutMix provides a significant boost in robust accuracy for both threat models with up to $+ 2 . 9 3 \%$ (in the $\ell _ { \infty }$ setting) and $+ 2 . 1 6 \%$ (in the $\ell _ { 2 }$ setting).
125
+
126
+ Generalizing to other datasets. To evaluate the generality of our approach, we evaluate it on CIFAR-100 [31], SVHN [38] and TINYIMAGENET [45] and we report the results in Table 3. First, on CIFAR-100, our best model reaches $3 2 . 4 3 \%$ against AUTOATTACK and improves noticeably on the state-of-the-art by $+ 2 . 4 0 \%$ (in the setting that does not use any external data). Second, on TINYIMAGENET with a WRN-28-10 we obtain a significant $+ 2 . 0 0 \%$ boost for robust accuracy against
127
+
128
+ <table><tr><td>SETUP</td><td colspan="2">lo</td><td colspan="2">l2</td></tr><tr><td></td><td>CLean</td><td>ROBUST</td><td>CLEAN</td><td>ROBUST</td></tr><tr><td colspan="5">WRN-28-10</td></tr><tr><td>Gowal et al.[20] (trained by us)</td><td>84.32%</td><td>54.44%</td><td>88.60%</td><td>72.56%</td></tr><tr><td>Ours (CutMix)</td><td>86.22%</td><td>57.50%</td><td>91.35%</td><td>76.12%</td></tr><tr><td colspan="5">WRN-70-16</td></tr><tr><td>Gowal et al.[20] (trained by us)</td><td>85.29%</td><td>57.14%</td><td>90.90%</td><td>74.50%</td></tr><tr><td>Ours (CutMix)</td><td>87.25%</td><td>60.07%</td><td>92.43%</td><td>76.66%</td></tr></table>
129
+
130
+ Table 2: Clean (without adversarial attacks) accuracy and robust accuracy (against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T } )$ on CIFAR10 as we both test against $\epsilon _ { \infty } = 8 / 2 5 5$ and $\epsilon _ { 2 } =$ $1 2 8 / 2 5 5$ .
131
+
132
+ <table><tr><td>SETUP</td><td colspan="2">PAD&amp;CROP </td><td colspan="2">CUTMIX</td></tr><tr><td></td><td>CLEAN</td><td>ROBUST</td><td>CLEAN</td><td>ROBUST</td></tr><tr><td colspan="5">VARYING THE ARCHITECTURE</td></tr><tr><td>ResNet-18</td><td>83.12%</td><td>50.52%</td><td>80.57%</td><td>52.28%</td></tr><tr><td>ResNet-34</td><td>84.68%</td><td>52.52%</td><td>83.35%</td><td>54.80%</td></tr><tr><td>WRN-28-10</td><td>84.32%</td><td>54.44%</td><td>86.09%</td><td>57.50%</td></tr><tr><td>WRN-34-10</td><td>84.89%</td><td>55.13%</td><td>86.18%</td><td>58.09%</td></tr><tr><td>WRN-34-20</td><td>85.80%</td><td>55.69%</td><td>87.80%</td><td>59.25%</td></tr><tr><td>WRN-70-16</td><td>86.02%</td><td>57.17%</td><td>87.25%</td><td>60.07%</td></tr></table>
133
+
134
+ Table 1: Robust test accuracy (against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T } ,$ ) against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR10 for different architectures. In all cases, we use weight averaging and we compare Pad & Crop and CutMix.
135
+
136
+ Table 3: Clean and robust accuracy $( \mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T }$ and AUTOATTACK for select models) on CIFAR-100, SVHN and TINYIMAGENET against $\epsilon _ { \infty } = 8 / 2 5 5$ obtained by different models (with WA). The ’retrained’ indication means that the models have been retrained according to Gowal et al. [20]’s methodology.
137
+
138
+ <table><tr><td>MODEL</td><td>CLEAN</td><td>AA+MT</td><td>AA</td></tr><tr><td colspan="4">CIFAR-100</td></tr><tr><td>Cui et al.[14] (WRN-34-10)</td><td>60.64%</td><td></td><td>29.33%</td></tr><tr><td>WRN-28-10 (retrained)</td><td>59.05%</td><td>28.75%</td><td>1</td></tr><tr><td>WRN-28-10(CutMix)</td><td>62.97%</td><td>30.50%</td><td>29.80%</td></tr><tr><td>Gowal et al.[20](WRN-70-16)</td><td>60.86%</td><td>30.67%</td><td>30.03%</td></tr><tr><td>WRN-70-16 (retrained)</td><td>59.65%</td><td>30.62%</td><td></td></tr><tr><td>WRN-70-16(CutMix)</td><td>65.76%</td><td>33.24%</td><td>32.43%</td></tr><tr><td colspan="4">SVHN</td></tr><tr><td>WRN-28-10 (retrained)</td><td>92.87%</td><td>56.83%</td><td></td></tr><tr><td>WRN-28-10 (CutMix)</td><td>94.52%</td><td>57.32%</td><td></td></tr><tr><td colspan="4">TINYIMAGENET</td></tr><tr><td>WRN-28-10 (retrained)</td><td>53.27%</td><td>21.83%</td><td></td></tr><tr><td>WRN-28-10(CutMix)</td><td>53.69%</td><td>23.83%</td><td></td></tr></table>
139
+
140
+ $\mathbf { A A } { + } \mathbf { M } \mathbf { T }$ with $\epsilon _ { \infty } = 8 / 2 5 5$ . Finally, on SVHN, our best model reaches $5 7 . 3 2 \%$ against $\mathbf { A A } { + } \mathbf { M } \mathbf { T }$ and improves on the baseline by a smaller margin than on CIFAR-10, CIFAR-100 or TINYIMAGENET. This smaller improvement is expected as $C u t M i x$ is not suited to SVHN because images of SVHN contain multiple digits per image.
141
+
142
+ # 6.3 Empirical elements on how weight averaging exploits data augmentation
143
+
144
+ Motivating model ensembling. First, we show that model ensembling can be used to improve robust accuracy. To do so, we evaluate ensembling early-stopped models which have been trained from scratch independently. We ensemble two early-stopped WRN-28-10 models trained on CIFAR10 with Pad & Crop by taking the average of the two independent models at the prediction level. In spite of this naive ensembling approach, we observe a significant boost in robust performance as this ensemble reaches $5 5 . 6 9 \%$ robust accuracy against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T }$ compared to $5 4 . 4 4 \%$ with a single model. Hence, even a simple ensemble of two independent runs can exploit the variance in individual robust predictions. Actually, the boost in robust accuracy is even stronger when ensembling two early-stopped WRN-28-10 models trained with CutMix as the ensemble reaches $5 6 . 3 5 \%$ robust accuracy which is $+ 3 . 8 2 \%$ better compared to an individual model. Augmentation techniques such as CutMix promote more diversity between runs than Pad & Crop, leading thereby to better robust performance when ensembling. This is further evidence that ensembling by its ability of exploiting the diversity of the models is mainly responsible for robustness improvements.
145
+
146
+ Model ensembling by weight averaging. We would like to ensemble more than two models but it would be inefficient computationally and memory wise to average the predictions of many independently trained models. To circumvent this issue, the naive ensembling approach is replaced by model weight averaging as we exploit the commonly known fact [8, 19, 43] that models trained with adversarial training tend to be locally linear. Indeed, under the assumption of linearity, weight averaging becomes equivalent to model ensembling. Hence, instead of ensembling independently trained models, weight averaging ensembles model iterations obtained during one training run. As discussed in the previous paragraph, model ensembling improves robustness by exploiting the diversity of equally performing models so we need the model iterations used with weight averaging to have similar robust performance but also some diversity in individual robust predictions. As we have previously seen in Figure 3(a), CutMix without weight averaging prevents robust overfitting and leads to a flat robust accuracy after the change of learning rate. Hence, these model snapshots share the same total accuracy but we would like to know if they differ at the individual prediction level. Figure 7 represents the individual robust predictions on test samples for three snapshots taken during training. While these three snapshots roughly have the same number of correctly classified samples, we see that there are on average 888 errors (out of 10k samples) per snapshot which are not made in the other two snapshots. This shows that augmentations which avoid robust overfitting such as CutMix produce diverse and equally performing model iterations, which can be ensembled effectively by model weight averaging, leading thereby to improved robust performance.
147
+
148
+ ![](images/ab8ede7a3170d0523dc470911cef231c56eeef7b87b2770cbcaedd11357b5a0e.jpg)
149
+ Figure 7: The bar plots show the outcome of each individual robust prediction for different snapshots of a same training run of a WRN-28- 10 against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 without model weight averaging. The test sample indices have been re-ordered such as to show contiguous blocks. The plots show a significant variation in individual robust predictions across different snapshots while the total robust accuracy (i.e. the number in parenthesis) remains stable.
150
+
151
+ ![](images/7a5a8b4c60ef947bbc40a26440ff989597a940f9105337650c073148ce165d9e.jpg)
152
+ Figure 8: Robust test accuracy against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T }$ with $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 as we vary the decay rate of the model weight averaging. The model is a WRN-28-10, which is trained either with CutMix or Pad & Crop.
153
+
154
+ The limits when exploiting the diversity between model iterations. When robust overfitting occurs, weight averaging is still helpful but to a lesser extent. In fact, a compromise must be found between the performance boost from ensembling diverse model iterations and the performance loss from incorporating model iterations with degraded performance in the ensemble. We illustrate this point by running an ablation study in Figure 8 measuring the robust accuracy obtained when varying the decay rate $\tau$ of model weight averaging and using either Pad & Crop or CutMix. While for CutMix increasing the weight averaging decay rate (i.e. ensembling more model iterations) always results in better robust performance, we observe that for Pad & Crop the maximum robust performance is obtained at $\tau = 0 . 9 9 2 5$ . When the weight averaging decay rate becomes too large $( \tau > 0 . 9 9 2 5 )$ ), too many model iterations with degraded performance are incorporated in the ensemble, thus hurting the robust performance of the ensemble. Hence, the diversity between model iterations can only compensate up to a certain point for the decrease in robust performance due to robust overfitting.
155
+
156
+ # 7 Conclusion
157
+
158
+ Contrary to previous works [20, 44, 56], which have tried data augmentation techniques to train adversarially robust models without success, we demonstrate that combining data augmentations with model weight averaging can significantly improve robustness. We also provide insights on why weight averaging works better with data augmentations which reduce robust overfitting. We show in fact that model snapshots of a same run have the same total robust accuracy but they greatly differ at the individual prediction level, thus allowing a performance boost when ensembling these snapshots. Code and models are available online at https://github.com/deepmind/deepmind-research/ tree/master/adversarial_robustness.
159
+
160
+ References
161
+ [1] M. Andriushchenko, F. Croce, N. Flammarion, and M. Hein. Square Attack: a query-efficient black-box adversarial attack via random search. Eur. Conf. Comput. Vis., 2020.
162
+ [2] A. Athalye and I. Sutskever. Synthesizing robust adversarial examples. Int. Conf. Mach. Learn., 2018.
163
+ [3] A. Athalye, N. Carlini, and D. Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. Int. Conf. Mach. Learn., 2018.
164
+ [4] J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, and S. WandermanMilne. JAX: composable transformations of Python+NumPy programs, 2018. URL http: //github.com/google/jax.
165
+ [5] N. Carlini and D. Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pages 3–14. ACM, 2017.
166
+ [6] N. Carlini and D. Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy, 2017.
167
+ [7] Y. Carmon, A. Raghunathan, L. Schmidt, J. C. Duchi, and P. S. Liang. Unlabeled data improves adversarial robustness. In Adv. Neural Inform. Process. Syst., 2019.
168
+ [8] T. Chen, Z. Zhang, S. Liu, S. Chang, and Z. Wang. Robust overfitting may be mitigated by properly learned smoothening. In International Conference on Learning Representations, volume 1, 2021.
169
+ [9] F. Croce and M. Hein. Minimally distorted adversarial examples with a fast adaptive boundary attack. arXiv preprint arXiv:1907.02044, 2020. URL https://arxiv.org/pdf/1907.02044.
170
+ [10] F. Croce and M. Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. arXiv preprint arXiv:2003.01690, 2020.
171
+ [11] F. Croce, M. Andriushchenko, V. Sehwag, N. Flammarion, M. Chiang, P. Mittal, and M. Hein. Robustbench: a standardized adversarial robustness benchmark. arXiv preprint arXiv:2010.09670, 2020.
172
+ [12] E. D. Cubuk, B. Zoph, D. Mane, V. Vasudevan, and Q. V. Le. Autoaugment: Learning augmentation policies from data. IEEE Conf. Comput. Vis. Pattern Recog., 2019.
173
+ [13] E. D. Cubuk, B. Zoph, J. Shlens, and Q. V. Le. Randaugment: Practical automated data augmentation with a reduced search space. IEEE Conf. Comput. Vis. Pattern Recog., 2020.
174
+ [14] J. Cui, S. Liu, L. Wang, and J. Jia. Learnable boundary guided adversarial training. arXiv preprint arXiv:2011.11164, 2020. URL https://arxiv.org/pdf/2011.11164.
175
+ [15] T. DeVries and G. W. Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
176
+ [16] Y. Dong, F. Liao, T. Pang, H. Su, J. Zhu, X. Hu, and J. Li. Boosting Adversarial Attacks with Momentum. IEEE Conf. Comput. Vis. Pattern Recog., 2018.
177
+ [17] T. Garipov, P. Izmailov, D. Podoprikhin, D. Vetrov, and A. G. Wilson. Loss surfaces, mode connectivity, and fast ensembling of dnns. arXiv preprint arXiv:1802.10026, 2018. URL https://arxiv.org/pdf/1802.10026.
178
+ [18] I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. Int. Conf. Learn. Represent., 2015.
179
+ [19] S. Gowal, J. Uesato, C. Qin, P.-S. Huang, T. Mann, and P. Kohli. An Alternative Surrogate Loss for PGD-based Adversarial Testing. arXiv preprint arXiv:1910.09338, 2019.
180
+ [20] S. Gowal, C. Qin, J. Uesato, T. Mann, and P. Kohli. Uncovering the limits of adversarial training against norm-bounded adversarial examples. arXiv preprint arXiv:2010.03593, 2020. URL https://arxiv.org/pdf/2010.03593.
181
+ [21] P. Goyal, P. Dollár, R. Girshick, P. Noordhuis, L. Wesolowski, A. Kyrola, A. Tulloch, Y. Jia, and K. He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
182
+ [22] E. Grefenstette, R. Stanforth, B. O’Donoghue, J. Uesato, G. Swirszcz, and P. Kohli. Strength in numbers: Trading-off robustness and computation via adversarially-trained ensembles. arXiv preprint arXiv:1811.09300, 2018. URL https://arxiv.org/pdf/1811.09300.
183
+ [23] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. IEEE Conf. Comput. Vis. Pattern Recog., 2016.
184
+ [24] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
185
+ [25] D. Hendrycks, K. Lee, and M. Mazeika. Using Pre-Training Can Improve Model Robustness and Uncertainty. Int. Conf. Mach. Learn., 2019.
186
+ [26] T. Hennigan, T. Cai, T. Norman, and I. Babuschkin. Haiku: Sonnet for JAX, 2020. URL http://github.com/deepmind/dm-haiku.
187
+ [27] L. Huang, C. Zhang, and H. Zhang. Self-Adaptive Training: beyond Empirical Risk Minimization. arXiv preprint arXiv:2002.10319, 2020.
188
+ [28] P. Izmailov, D. Podoprikhin, T. Garipov, D. Vetrov, and A. G. Wilson. Averaging Weights Leads to Wider Optima and Better Generalization. Uncertainty in Artificial Intelligence, 2018.
189
+ [29] H. Kannan, A. Kurakin, and I. Goodfellow. Adversarial Logit Pairing. arXiv preprint arXiv:1803.06373, 2018.
190
+ [30] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
191
+ [31] A. Krizhevsky, G. Hinton, et al. Learning multiple layers of features from tiny images. 2009.
192
+ [32] A. Kurakin, I. Goodfellow, and S. Bengio. Adversarial examples in the physical world. ICLR workshop, 2016.
193
+ [33] J.-H. Lee, M. Z. Zaheer, M. Astrid, and S.-I. Lee. Smoothmix: a simple yet effective data augmentation to train robust classifiers. IEEE Conf. Comput. Vis. Pattern Recog. Worksh., 2020.
194
+ [34] A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu. Towards deep learning models resistant to adversarial attacks. Int. Conf. Learn. Represent., 2018.
195
+ [35] M. Mosbach, M. Andriushchenko, T. Trost, M. Hein, and D. Klakow. Logit Pairing Methods Can Fool Gradient-Based Attacks. arXiv preprint arXiv:1810.12042, 2018.
196
+ [36] A. Najafi, S.-i. Maeda, M. Koyama, and T. Miyato. Robustness to adversarial perturbations in learning from incomplete data. Adv. Neural Inform. Process. Syst., 2019.
197
+ [37] Y. Nesterov. A method of solving a convex programming problem with convergence rate $o ( 1 / k ^ { 2 } )$ . In Sov. Math. Dokl, 1983.
198
+ [38] Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A. Y. Ng. Reading digits in natural images with unsupervised feature learning. 2011.
199
+ [39] T. Pang, K. Xu, C. Du, N. Chen, and J. Zhu. Improving adversarial robustness via promoting ensemble diversity. Int. Conf. Mach. Learn., 2019.
200
+ [40] T. Pang, X. Yang, Y. Dong, K. Xu, H. Su, and J. Zhu. Boosting Adversarial Training with Hypersphere Embedding. Adv. Neural Inform. Process. Syst., 2020.
201
+ [41] N. Papernot, P. McDaniel, X. Wu, S. Jha, and A. Swami. Distillation as a defense to adversarial perturbations against deep neural networks. IEEE Symposium on Security and Privacy, 2016.
202
+ [42] B. T. Polyak. Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 1964.
203
+ [43] C. Qin, J. Martens, S. Gowal, D. Krishnan, K. Dvijotham, A. Fawzi, S. De, R. Stanforth, and P. Kohli. Adversarial Robustness through Local Linearization. Adv. Neural Inform. Process. Syst., 2019.
204
+ [44] L. Rice, E. Wong, and J. Z. Kolter. Overfitting in adversarially robust deep learning. Int. Conf. Mach. Learn., 2020.
205
+ [45] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 2015.
206
+ [46] S. Santurkar, D. Tsipras, B. Tran, A. Ilyas, L. Engstrom, and A. Madry. Image synthesis with a single (robust) classifier. arXiv preprint arXiv:1906.09453, 2019.
207
+ [47] L. Song, R. Shokri, and P. Mittal. Privacy risks of securing machine learning models against adversarial examples. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, 2019.
208
+ [48] T. Strauss, M. Hanselmann, A. Junginger, and H. Ulmer. Ensemble methods as a defense to adversarial perturbations against deep neural networks. arXiv preprint arXiv:1709.03423, 2017.
209
+ [49] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. Int. Conf. Learn. Represent., 2014.
210
+ [50] R. Takahashi, T. Matsubara, and K. Uehara. Ricap: Random image cropping and patching data augmentation for deep cnns. Asian Conf. Mach. Learn., 2018.
211
+ [51] A. Torralba, R. Fergus, and W. T. Freeman. 80 million tiny images: a large dataset for nonparametric object and scene recognition. IEEE Trans. Pattern Anal. Mach. Intell., 2008.
212
+ [52] F. Tramèr, A. Kurakin, N. Papernot, I. Goodfellow, D. Boneh, and P. McDaniel. Ensemble Adversarial Training: Attacks and Defenses. arXiv preprint arXiv:1705.07204, 2017. URL https://arxiv.org/pdf/1705.07204.
213
+ [53] J. Uesato, B. O’Donoghue, A. v. d. Oord, and P. Kohli. Adversarial Risk and the Dangers of Evaluating Against Weak Attacks. Int. Conf. Mach. Learn., 2018.
214
+ [54] J. Uesato, J.-B. Alayrac, P.-S. Huang, R. Stanforth, A. Fawzi, and P. Kohli. Are labels required for improving adversarial robustness? Adv. Neural Inform. Process. Syst., 2019.
215
+ [55] R. Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
216
+ [56] D. Wu, S.-t. Xia, and Y. Wang. Adversarial weight perturbation helps robust generalization. Adv. Neural Inform. Process. Syst., 2020.
217
+ [57] C. Xie, Y. Wu, L. van der Maaten, A. Yuille, and K. He. Feature denoising for improving adversarial robustness. IEEE Conf. Comput. Vis. Pattern Recog., 2019.
218
+ [58] S. Yun, D. Han, S. J. Oh, S. Chun, J. Choe, and Y. Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. Int. Conf. Comput. Vis., 2019.
219
+ [59] S. Zagoruyko and N. Komodakis. Wide residual networks. Brit. Mach. Vis. Conf., 2016.
220
+ [60] R. Zhai, T. Cai, D. He, C. Dan, K. He, J. Hopcroft, and L. Wang. Adversarially Robust Generalization Just Requires More Unlabeled Data. arXiv preprint arXiv:1906.00555, 2019.
221
+ [61] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. Int. Conf. Learn. Represent., 2017. URL https://openreview. net/pdf?id=Sy8gdB9xx.
222
+
223
+ [62] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. Int. Conf. Learn. Represent., 2018.
224
+
225
+ [63] H. Zhang, Y. Yu, J. Jiao, E. P. Xing, L. E. Ghaoui, and M. I. Jordan. Theoretically Principled Trade-off between Robustness and Accuracy. Int. Conf. Mach. Learn., 2019.
226
+
227
+ # Checklist
228
+
229
+ 1. For all authors...
230
+
231
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We claim that data augmentation can improve adversarial robustness when combined with model weight averaging. Experiments show significant improvements and provide empirical evidence on how weight averaging exploits data augmentation to improve robustness.
232
+ (b) Did you describe the limitations of your work? [Yes] We discuss the limitations of data augmentation in the context of adversarial training. In particular, we show in section 6 with the example of MixUp that there is a trade-off between robust overfitting and underfitting.
233
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] We discuss potential negative societal impacts in the conclusion.
234
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
235
+
236
+ 2. If you are including theoretical results...
237
+
238
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
239
+
240
+ 3. If you ran experiments...
241
+
242
+ (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] The code written in JAX [4] and Haiku [26] is available online at https://github.com/ deepmind/deepmind-research/tree/master/adversarial_robustness.
243
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All training details are in section 5.
244
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] As doing adversarial training with 10 PGD steps is roughly ten times more computationally expensive than nominal training, we do not report error bars. Nevertheless, as a comparison point, we trained ten WRN-28-10 models on CIFAR-10 with Pad & Crop and with CutMix. The resulting robust test accuracies on CIFAR-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ are respectively $5 4 . 4 4 { \pm } 0 . 3 9 \%$ and $5 7 . 5 0 { \pm } 0 . 2 4 \%$ , thus showing a relatively low variance in the results. Furthermore, our best models are well clear of the threshold for statistical significance.
245
+ (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] All details are in section 5.
246
+
247
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
248
+
249
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use CIFAR-10, CIFAR-100, SVHN and TINYIMAGENET.
250
+ (b) Did you mention the license of the assets? [No] Please refer to citations for details on licensing. All datasets are available for non-commercial use.
251
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
252
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
253
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
254
+
255
+ 5. If you used crowdsourcing or conducted research with human subjects...
256
+
257
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
258
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
259
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/np96ge7gz0j/np96ge7gz0j.md ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Projection-free Graph-based Classifier Learning using Gershgorin Disc Perfect Alignment
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 In semi-supervised graph-based binary classifier learning, a subset of known labels
11
+ 2 ${ \hat { x } } _ { i }$ are used to infer unknown labels, assuming that the label signal $\mathbf { x }$ is smooth
12
+ 3 with respect to a similarity graph specified by a Laplacian matrix. When restricting
13
+ 4 labels $x _ { i }$ to binary values, the problem is NP-hard. While a conventional semi
14
+ 5 definite programming (SDP) relaxation can be solved in polynomial time using, for
15
+ 6 example, the alternating direction method of multipliers (ADMM), the complexity
16
+ 7 of iteratively projecting a candidate matrix $\mathbf { M }$ onto the positive semi-definite
17
+ 8 (PSD) cone $\mathbf { M } \succeq 0 \%$ ) remains high. In this paper, leveraging a recent linear
18
+ 9 algebraic theory called Gershgorin disc perfect alignment (GDPA), we propose a
19
+ 10 fast projection-free method by solving a sequence of linear programs (LP) instead.
20
+ 11 Specifically, we first recast the SDP relaxation to its SDP dual, where a feasible
21
+ 12 solution $\textbf { H } \succeq \textbf { 0 }$ can be interpreted as a Laplacian matrix corresponding to a
22
+ 13 balanced signed graph sans the last node. To achieve graph balance, we split the
23
+ 14 last node into two that respectively contain the original positive and negative edges,
24
+ 15 resulting in a new Laplacian $\bar { \bf H }$ . We repose the SDP dual for solution $\bar { \bf H }$ , then
25
+ 16 replace the PSD cone constraint $\bar { \mathbf { H } } \succeq 0$ with linear constraints derived from GDPA—
26
+ 17 sufficient conditions to ensure $\bar { \bf H }$ is PSD—so that the optimization becomes an LP
27
+ 18 per iteration. Finally, we extract predicted labels from our converged LP solution
28
+ 19 $\bar { \bf H }$ . Experiments show that our algorithm enjoyed a $4 0 \times$ speedup on average over
29
+ 20 the next fastest scheme while retaining comparable label prediction performance.
30
+
31
+ # 21 1 Introduction
32
+
33
+ 22 Binary classification—assignment of labels to an $N$ -sample set $\mathbf { x } \in \{ - 1 , 1 \} ^ { N }$ to separate two distinct
34
+ 23 classes—is a basic machine learning problem [1]. One common setting is semi-supervised graph
35
+ 24 classifier learning, where $M$ known labels, $\hat { x } _ { i } , 1 \leq i \leq M$ , are used to infer $N - M$ unknown labels
36
+ 25 $x _ { i }$ , $M + 1 \leq i \leq N$ , in signal $\mathbf { x }$ , assuming that $\mathbf { x }$ is smooth with respect to (w.r.t.) a similarity
37
+ 26 graph $\mathcal { G }$ specified by a graph Laplacian matrix L [2, 3, 4]. This graph-based binary classification
38
+ 27 problem is NP-hard in general [5]. A conventional semi-definite programming (SDP) relaxation [6]
39
+ 28 replaces the binary label constraint with a more relaxed positive semi-definite (PSD) cone constraint
40
+ 29 (i.e., matrix variable M related to $\mathbf { x x } ^ { \top }$ satisfying $\mathbf { M } \succeq 0$ ), and the relaxed problem can be solved in
41
+ 30 polynomial time using, for example, the alternating direction method of multipliers (ADMM) [7].
42
+ 31 However, ADMM still requires projection to the PSD cone $S = \{ \mathbf { M } \mid \mathbf { M } \} \subseteq 0 \}$ per iteration, which is
43
+ 32 expensive $( \mathcal { O } ( N ^ { 3 } ) )$ due to full matrix eigen-decomposition. An alternative approach eliminates the
44
+ 33 binary constraint and minimizes directly a quadratic graph smoothness term called graph Laplacian
45
+ 34 regularization (GLR) $\mathbf { x } ^ { \top } \mathbf { L x }$ [8] for $\mathbf { x } \in \mathbb { R } ^ { \dot { N } }$ , and then rounds $x _ { i }$ ’s to $\{ - 1 , 1 \}$ . However, in general
46
+ 35 spectral methods such as GLR do not have tight performance bounds common in SDP relaxation [9].
47
+ 36 To ensure matrix variable $\mathbf { M }$ is PSD without eigen-decomposition, one naïve approach is to enforce
48
+ 37 linear constraints derived directly from the Gershgorin circle theorem (GCT) [10]. By GCT, every
49
+ 38 real eigenvalue $\lambda$ of a real symmetric matrix $\mathbf { M }$ resides inside at least one Gershgorin disc $\Psi _ { i }$ —
50
+ 39 corresponding to row $i$ of $\mathbf { M }$ —with center $c _ { i } ( \mathbf { M } ) \triangleq M _ { i , i }$ and radius $\begin{array} { r } { r _ { i } ( \mathbf { M } ) \triangleq \sum _ { j \neq i } | M _ { i , j } | } \end{array}$ , i.e.,
51
+
52
+ ![](images/092cf4c7026a85c60129e4dcba8028711d08cc1432d7f0b3b63a362876aef017.jpg)
53
+ Figure 1: Example of a PD matrix M and its similarity transform $\tilde { \mathbf { M } } = \mathbf { S } \mathbf { M } \mathbf { S } ^ { - 1 }$ , and their respective Gershgorin discs $\Psi _ { i }$ . Note that Gershgorin disc left-ends of $\tilde { \textbf { M } }$ are aligned at $\lambda _ { \mathrm { m i n } } ( \mathbf { M } ) = 0 . 1 0 7 8$ .
54
+
55
+ $$
56
+ c _ { i } ( \mathbf { M } ) - r _ { i } ( \mathbf { M } ) \leq \lambda \leq c _ { i } ( \mathbf { M } ) + r _ { i } ( \mathbf { M } ) , \exists i .
57
+ $$
58
+
59
+ 40 The corollary is that the smallest eigenvalue, $\lambda _ { \operatorname* { m i n } } ( \mathbf { M } )$ , of $\mathbf { M }$ is lower-bounded by the smallest Gershgorin disc left-end, denoted by 41 $\lambda _ { \mathrm { m i n } } ^ { - } ( \mathbf { M } )$ , i.e.,
60
+
61
+ $$
62
+ \lambda _ { \operatorname* { m i n } } ^ { - } ( \mathbf { M } ) \triangleq \operatorname* { m i n } _ { i } c _ { i } ( \mathbf { M } ) - r _ { i } ( \mathbf { M } ) \leq \lambda _ { \operatorname* { m i n } } ( \mathbf { M } ) .
63
+ $$
64
+
65
+ 42 Thus, to ensure $\mathbf M \succeq 0$ , one can impose the sufficient condition $\lambda _ { \mathrm { m i n } } ^ { - } ( \mathbf { M } ) \geq 0$ . While replacing
66
+ 43 the PSD cone constraint with a set of $N$ linear constraints, $c _ { i } ( \mathbf { M } ) - r _ { i } ( \mathbf { M } ) \geq 0 , \forall i$ , is attractive
67
+ 44 computationally, GCT lower bound $\lambda _ { \mathrm { m i n } } ^ { - } ( \mathbf { M } )$ tends to be loose. As an example, consider the positive
68
+ 45 definite (PD) matrix $\mathbf { M }$ in Fig. 1(a) with $\lambda _ { \mathrm { m i n } } ( \mathbf { M } ) = 0 . 1 0 7 8$ [11]. The first Gershgorin disc left-end
69
+ 46 is $c _ { 1 } ( \mathbf { M } ) - r _ { 1 } ( \mathbf { M } ) = 2 - 3 = - 1$ , and $\lambda _ { \mathrm { m i n } } ^ { - } ( { \bf M } ) < 0$ . Thus, imposing $\lambda _ { \mathrm { m i n } } ^ { - } ( \mathbf { M } ) \geq 0$ directly would
70
+ 47 unnecessarily restrict the search space and result in a sub-optimal solution to the posed problem.
71
+ 48 A recent linear algebraic theory called Gershgorin disc perfect alignment (GDPA) [11] provides a
72
+ 49 theoretical foundation to tighten the GCT lower bound. Specifically, GDPA states that given a graph
73
+ 50 Laplacian matrix $\mathbf { L }$ corresponding to a balanced signed graph $\mathcal { G }$ [12], one can perform a similarity
74
+ 51 transform1, $\tilde { \mathbf { L } } = \mathbf { S } \mathbf { L } \mathbf { S } ^ { - 1 }$ , where $\mathbf { S } = \mathrm { d i a g } ( v _ { 1 } ^ { - 1 } , \dots , v _ { N } ^ { - 1 } )$ and $\mathbf { v }$ is the first eigenvector of $\mathbf { L }$ , such
75
+ 52 that the Gershgorin disc left-ends of $\tilde { \bf L }$ are exactly aligned at $\lambda _ { \operatorname* { m i n } } ( \mathbf { L } ) = \lambda _ { \operatorname* { m i n } } ( \tilde { \mathbf { L } } )$ . This means that
76
+ 53 transformed $\tilde { \bf L }$ satisfies $\lambda _ { \operatorname* { m i n } } ^ { - } ( \tilde { \mathbf { L } } ) = \lambda _ { \operatorname* { m i n } } ( \tilde { \mathbf { L } } )$ ; i.e., the GCT lower bound is the tightest possible after
77
+ 54 an appropriate similarity transform. Continuing our example, similarity transform $\tilde { \mathbf { M } } = \mathbf { S } \mathbf { M } \mathbf { S } ^ { - 1 }$ of
78
+ 55 M has all its disc left-ends exactly aligned at $\bar { \lambda _ { \operatorname* { m i n } } } ( \mathbf { M } ) = \bar { \lambda _ { \operatorname* { m i n } } } ( \tilde { \mathbf { M } } ) \bar { = } 0 . 1 0 7 8$ .
79
+ 56 Leveraging GDPA, we develop a fast projection-free algorithm for semi-supervised graph classifier
80
+ 57 learning. We first observe that the optimal solution M of the SDP relaxation is an adjacency matrix
81
+ 58 to a balanced signed graph. However, GDPA requires a Laplacian matrix, which has opposite signs in
82
+ 59 the off-diagonal terms to the corresponding adjacency matrix of the same graph. Thus, we convert the
83
+ 60 problem to its SDP dual [13] and interpret the dual variable $\mathbf { H }$ instead as a Laplacian to a balanced
84
+ 61 graph sans the last graph node. To achieve graph balance, we split the last node into two and divide
85
+ 62 the original positive and negative edges among them, resulting in a revised Laplacian $\bar { \bf H }$ . We repose
86
+ 63 the SDP dual problem for solution $\bar { \bf H }$ , then replace the PSD cone constraint $\bar { \mathbf { H } } \succeq 0$ with linear
87
+ 64 constraints derived from GDPA. This changes the optimization to a linear program (LP) per iteration
88
+ 65 that is solved efficiently using fast LP solvers [14]. Finally, we extract prediction labels from our
89
+ 66 converged LP solution $\bar { \bf H }$ . Experiments show that our algorithm enjoyed a $4 0 \times$ speedup on average
90
+ 67 over the next fastest scheme while retaining comparable label prediction performance.
91
+
92
+ # 68 2 Related Work
93
+
94
+ Graph-based classification was first studied almost two decades ago [2, 3, 4]. With the advent of graph signal processing (GSP) [15, 16]—spectral analysis of discrete signals residing on combinatorial graphs—interest in the problem was revived [17, 18, 19]. The problem of learning a similarity graph from data has been extensively studied [20]. We focus instead on the orthogonal problem of predicting binary labels given a similarity graph and a subset of $M$ labels.
95
+
96
+ 1A similarity transform ${ \bf B } = { \bf S } { \bf A } { \bf S } ^ { - 1 }$ and the original matrix A share the same set of eigenvalues [10].
97
+
98
+ 74 The graph-based binary classification problem is NP-hard in general [5]. SDP—useful in approx
99
+ 75 imating various NP-hard problems [13]—provides an intuitive relaxation [6]. An interior point
100
+ 76 method tailored for the slightly more general binary quadratic problem2 (BQP) has complexity
101
+ 77 $\mathcal { O } ( N ^ { 3 . 5 } \log ( 1 / \epsilon ) )$ , where $\epsilon$ is the tolerable error [21]. The complexity was improved to $\mathcal { O } ( \bar { N } ^ { 3 } )$ by
102
+ 78 SDCut [22, 23] via spectrahedron-based relaxation. Replacing PSD cone constraint $\mathbf M \succeq 0$ with a
103
+ 79 factorization $\bar { { \bf M } } = { \bf X } { \bf X } ^ { \top }$ was proposed in [24], but resulted in a non-convex optimization for $\mathbf { X }$ that
104
+ 80 was solved locally via alternating minimization, where in each iteration a matrix inverse of worst-case
105
+ 81 complexity $\mathcal { O } ( N ^ { 3 } )$ was required. More recent first-order methods for SDP such as [7] used ADMM
106
+ 82 [25, 26, 27], but the iterative projection onto PSD cone requires full matrix eigen-decomposition and
107
+ 83 thus expensive. In contrast, leveraging GDPA theory [11], our algorithm is entirely projection-free.
108
+ 84 It is known in graph spectral theory [28] that balanced signed graphs have unique spectral properties
109
+ 85 [29]; for example, the signed graph Laplacian matrix [30] has eigenvalue 0 iff the corresponding
110
+ 86 signed graph is balanced. In contrast, extending the original GCT [10], GDPA [11] states that the
111
+ 87 Gershgorin disc left-ends of a similarity transform $\mathbf { S } \mathbf { M } \bar { \mathbf { S } } ^ { - 1 }$ of graph Laplacian $\mathbf { M }$ to a balanced
112
+ 88 graph can be perfectly aligned at $\lambda _ { \operatorname* { m i n } } ( \mathbf { M } )$ . GDPA theory was developed for metric learning [31]
113
+ 89 to optimize a PD matrix $\mathbf { M }$ given a convex and differentiable objective $Q ( \mathbf { M } )$ so that the optimal
114
+ 90 Mahalanobis distance $( \mathbf { f } _ { i } - \mathbf { f } _ { j } ) ^ { \top } \mathbf { M } ( \mathbf { f } _ { i } - \mathbf { f } _ { j } )$ for feature vectors $\mathbf { f } _ { i }$ and $\mathbf { f } _ { j }$ can be defined. This paper
115
+ 91 leverages GDPA [11] in an entirely different direction for graph-based binary classifier learning.
116
+ 92 Specifically, observing that solution matrix $\mathbf { H }$ to the SDP dual is a Laplacian to a balanced graph $\mathcal { G }$
117
+ 93 sans the last graph node, we augment the last node to obtain an overall balanced graph $\bar { \mathcal { G } }$ , and solve a
118
+ 94 modified SDP dual for Laplacian $\bar { \bf H }$ to $\bar { \mathcal { G } }$ via GDPA linearization.
119
+
120
+ # 95 3 Preliminaries
121
+
122
+ # 96 3.1 Graph Definitions
123
+
124
+ A graph is defined as $\mathcal G ( \nu , \mathcal { E } )$ , with node set $\mathcal { V } = \{ 1 \ldots , N \}$ , and edge set $\mathcal { E } = \{ ( i , j ) \}$ , where $( i , j )$ means nodes $i$ and $j$ are connected with weight $w _ { i , j } \in \mathbb { R }$ . A node $i$ may have self-loop of weights $u _ { i } \in \mathbb { R }$ . Denote by $\mathbf { W }$ the adjacency matrix, where $W _ { i , j } = w _ { i , j }$ and $W _ { i , i } = u _ { i }$ . We assume that edges are undirected, and W is symmetric. Define next the diagonal degree matrix $\mathbf { D }$ , where $\begin{array} { r } { D _ { i , i } = \sum _ { j } W _ { i , j } } \end{array}$ . The combinatorial graph Laplacian matrix [15] is then defined as $\mathbf { L } = \mathbf { D } - \mathbf { W }$ . To account for self-loops, the generalized graph Laplacian matrix is defined as $\mathcal { L } = \mathbf { D } - \mathbf { W } + \mathrm { d i a g } ( \mathbf { W } )$ . Note that any real symmetric matrix can be interpreted as a generalized graph Laplacian matrix.
125
+
126
+ The graph Laplacian regularizer (GLR) [8] that quantifies smoothness of signal 04 $\mathbf { x } \in \mathbb { R } ^ { N }$ w.r.t. graph 105 specified by $\mathcal { L }$ is
127
+
128
+ $$
129
+ \mathbf { x } ^ { \top } { \mathcal { L } } \mathbf { x } = \sum _ { ( i , j ) \in { \mathcal { E } } } w _ { i , j } ( x _ { i } - x _ { j } ) ^ { 2 } + \sum _ { i \in { \mathcal { V } } } u _ { i } x _ { i } ^ { 2 } .
130
+ $$
131
+
132
+ 106 GLR is also the objective of our graph-based classification problem.
133
+
134
+ # 3.2 Iterative GDPA Linearization
135
+
136
+ 108 Denote by $\mathcal { L }$ a generalized graph Laplacian matrix to a balanced and connected signed graph $\mathcal { G }$ (with
137
+ 109 or without self-loops). A balanced graph is a graph with no cycle of odd number of negative edges.
138
+ 110 By Cartwright-Harary Theorem (CHT) [12], a graph is balanced iff nodes can be colored into blue
139
+ 111 and red, such that each positive (negative) edge connects nodes of the same (different) colors. GDPA
140
+ 112 [11] states that a similarity transform $\tilde { \mathcal { L } } = \mathbf { S } \bar { \mathcal { L } } \mathbf { S } ^ { - 1 }$ , where $\mathbf { S } = \mathrm { d i a g } ( v _ { 1 } ^ { - 1 } , \dots , v _ { N } ^ { - 1 } )$ and $\mathbf { v }$ is the first
141
+ 113 eigenvector of $\mathcal { L }$ , has its Gershgorin disc left-ends aligned exactly at $\lambda _ { \operatorname* { m i n } } ( \mathcal { L } )$ , i.e.,
142
+
143
+ $$
144
+ \tilde { \mathcal { L } } _ { i , i } - \sum _ { j \neq i } | \tilde { \mathcal { L } } _ { i , j } | = \mathcal { L } _ { i , i } - \sum _ { j \neq i } | s _ { i } \mathcal { L } _ { i , j } / s _ { j } | = \lambda _ { \operatorname* { m i n } } ( \mathcal { L } ) , \quad \forall i \in \{ 1 , \ldots , N \} .
145
+ $$
146
+
147
+ 114 To solve an optimization of the form $\operatorname* { m i n } _ { \mathcal { L } \succeq 0 } Q ( \mathcal { L } )$ , one can leverage GDPA and optimize iteratively as follows. At iteration 115 $t$ with solution $\textstyle { \mathcal { L } } ^ { t }$ , compute first eigenvector $\mathbf { v } _ { } ^ { t }$ to $\textstyle { \mathcal { L } } ^ { t }$ corresponding to 116 $\lambda _ { \operatorname* { m i n } } ( \mathcal { L } ^ { t } )$ ; extreme eigenvector $\mathbf { v } _ { } ^ { t }$ can be efficiently computed in complexity $\mathcal { O } ( a b )$ using Locally
148
+
149
+ ![](images/3d861cbe17a5498e8e20e1ae3d767ca5dce20bb9871b562d16517660f2d331ad.jpg)
150
+ Figure 2: (a) 3-node line graph example. (b) Ideal solution $\mathbf { M }$ to SDP primal (8) as adjacency matrix. (c) Solution $\mathbf { H }$ to SDP dual (12) as Laplacian matrix. (d) Solution $\bar { \bf H }$ to modified SDP dual (20) as Laplacian matrix. Positive / negative edges are colored in blue / red. Self-loop weight $u 4$ in (c) for node 4 is $u _ { 4 } = y _ { 4 } + z _ { 1 } + z _ { 2 }$ .
151
+
152
+ 117 Optimal Block Preconditioned Conjugate Gradient (LOBPCG) [32], where $a$ is the number of non
153
+ 118 zero entries in $\textstyle { \mathcal { L } } ^ { t }$ and $b$ is the iteration number till convergence3. Define scalars $s _ { i } ^ { t } = 1 / v _ { i } ^ { t } , \forall i$ . Then
154
+ 119 for iteration $t + 1$ , solve the following optimization:
155
+
156
+ $$
157
+ \operatorname* { m i n } _ { \mathcal { L } } Q ( \mathcal { L } ) , ~ \mathrm { s . t . } ~ \mathcal { L } _ { i , i } - \sum _ { j \neq i } | s _ { i } ^ { t } \mathcal { L } _ { i , j } / s _ { j } ^ { t } | \geq 0 , ~ \forall i \in \{ 1 , \ldots , N \} .
158
+ $$
159
+
160
+ 120 Linear constraints in (5) ensure that the similarity transform $\tilde { \mathcal { L } } = \mathbf { S } \mathcal { L } \mathbf { S } ^ { - 1 }$ is PSD by GCT, and hence
161
+ 121 solution $\mathcal { L }$ is PSD. Since scalars $\{ s _ { i } ^ { t } \}$ are computed from first eigenvector $\mathbf { v } ^ { t }$ of $\dot { \mathcal { L } } ^ { t } \succeq 0$ , by GDPA
162
+ 122 $\mathbf { S } \mathcal { L } ^ { t } \mathbf { S } ^ { - 1 }$ has all its disc left-ends aligned exactly at $\lambda _ { \operatorname* { m i n } } ( \mathcal { L } ^ { t } ) \geq \dot { 0 }$ , and hence $\mathcal { L } ^ { t }$ remains feasible at
163
+ 123 iteration $t + 1$ . Thus, objective $Q ( \mathcal { L } ^ { t } )$ is monotonically non-increasing with $t$ , and the algorithm
164
+ 124 converges to a local minimum. We invoke this iteration to solve our posed SDP dual as well.
165
+
166
+ # 125 4 Formulation of Graph-based Classifier Learning
167
+
168
+ 126 We first formulate the graph-based classifier learning problem and relax it to an SDP problem in
169
+ 127 Section 4.1. We then present its SDP dual with dual variable matrix $\mathbf { H }$ in Section 4.2. Finally, we
170
+ 128 interpret $\mathbf { H }$ as a graph Laplacian, and augment its corresponding graph $\mathcal { G }$ to a balanced graph $\bar { \mathcal G }$ for
171
+ 129 GDPA linearization in Section 4.3.
172
+
173
+ # 130 4.1 SDP Primal
174
+
175
+ 131 Given a PSD graph Laplacian matrix $\mathbf { L } \in \mathbb { R } ^ { N \times N }$ of a positive similarity graph $\mathcal { G } ^ { o }$ (i.e., all edge
176
+ 132 weights $w _ { i , j } \geq 0$ ), one can formulate a graph-based binary classification problem as follows:
177
+
178
+ $$
179
+ \operatorname* { m i n } _ { \mathbf { x } } \mathbf { x } ^ { \top } \mathbf { L } \mathbf { x } , ~ \mathrm { s . t . } ~ \left\{ \begin{array} { l l } { x _ { i } ^ { 2 } = 1 , \forall i \in \{ 1 , \dots , N \} } \\ { x _ { i } = \hat { x } _ { i } , \forall i \in \{ 1 , \dots , M \} } \end{array} \right. .
180
+ $$
181
+
182
+ 133 where $\{ \hat { x } _ { i } \} _ { i = 1 } ^ { M }$ are the $M$ known labels. The objective in (6) dictates that signal $\mathbf { x }$ is smooth
183
+ 134 w.r.t. graph $\mathcal { G } ^ { o }$ specified by $\mathbf { L }$ . Because $\mathbf { L }$ is PSD [16], the objective is lower-bounded by 0, i.e.,
184
+ 135 136 $\mathbf { x } ^ { \top } \mathbf { L } \mathbf { x } \geq 0 , \forall \mathbf { x } \in \mathbb { R } ^ { N }$ $x _ { i }$ . The fiin signal $\mathbf { x }$ binary constraint ensureagrees with known labels $\{ \hat { x } _ { i } \} _ { i = 1 } ^ { M }$ $x _ { i } \in \{ - 1 , 1 \}$ . The second constraint
185
+ 137 As an example, consider a 3-node line graph shown in Fig. 2(a), where edges $( 1 , 2 )$ and $( 2 , 3 )$ have
186
+ 138 weights $w _ { 1 , 2 }$ and $w _ { 2 , 3 }$ , respectively. The adjacency matrix W and graph Laplacian matrix $\mathbf { L }$ are:
187
+
188
+ $$
189
+ \mathbf { W } = \left[ \begin{array} { c c c } { 0 } & { w _ { 1 , 2 } } & { 0 } \\ { w _ { 1 , 2 } } & { 0 } & { w _ { 2 , 3 } } \\ { 0 } & { w _ { 2 , 3 } } & { 0 } \end{array} \right] , \qquad \mathbf { L } = \left[ \begin{array} { c c c } { d _ { 1 } } & { - w _ { 1 , 2 } } & { 0 } \\ { - w _ { 1 , 2 } } & { d _ { 2 } } & { - w _ { 2 , 3 } } \\ { 0 } & { - w _ { 2 , 3 } } & { d _ { 3 } } \end{array} \right]
190
+ $$
191
+
192
+ where 139 $\begin{array} { r } { d _ { i } = \sum _ { j \mid ( i , j ) \in \mathcal { E } } w _ { i , j } } \end{array}$ is the degree of node $i$ . Suppose known labels are $\hat { x } _ { 1 } = 1$ and $\hat { x } _ { 2 } = - 1$
193
+
194
+ 140 Due to the binary constraint on $x _ { i }$ ’s, (6) is NP-hard [5]. One can define an SDP relaxation [5] as
195
+ 141 follows. Define first $\mathbf { X } = \mathbf { x } \mathbf { x } ^ { \top }$ and $\mathbf { M } = [ \mathbf { X } \ \mathbf { x } ; \ \mathbf { x } ^ { \top }$ 1]. M is PSD because: i) block [1] is PSD,
196
+ 142 and ii) the Schur complement of block [1] of $\mathbf { M }$ is $\mathbf { X } - \mathbf { x } \mathbf { x } ^ { \top } = \mathbf { 0 }$ , which is also PSD. Thus, the two
197
+ 143 constraints $\mathbf M \succeq 0$ and $\mathbf { r a n k } ( \mathbf { X } ) = 1$ is equivalent to $\mathbf { X } = \mathbf { x } \mathbf { x } ^ { \top }$ , which together with $X _ { i i } = 1 , \forall i$
198
+ 144 implies $x _ { i } ^ { 2 } = 1 , \forall i$ . To convexify the problem, we drop the non-convex rank constraint and write the
199
+ 145 SDP relaxation for optimization variable M as
200
+
201
+ $$
202
+ \operatorname* { m i n } _ { \mathbf { x } , \mathbf { X } } \mathrm { T r } ( \mathbf { L X } ) \mathrm { ~ s . t . ~ } \left\{ \begin{array} { l l } { X _ { i i } = 1 , i \in \{ 1 , \dots , N \} } \\ { \mathbf { M } \triangleq \left[ \begin{array} { l l } { \mathbf { X } } & { \mathbf { x } } \\ { \mathbf { x } ^ { \top } } & { 1 } \end{array} \right] \succeq 0 } \\ { x _ { i } = \hat { x } _ { i } , i \in \{ 1 , \dots , M \} } \end{array} \right.
203
+ $$
204
+
205
+ where 146 $\operatorname { T r } ( \mathbf { x } ^ { \top } \mathbf { L } \mathbf { x } ) = \operatorname { T r } ( \mathbf { L } \mathbf { x } \mathbf { x } ^ { \top } ) = \operatorname { T r } ( \mathbf { L } \mathbf { X } )$ . Because (8) has linear objective and constraints with an 147 additional PSD cone constraint, $\mathbf M \succeq 0$ , it is an SDP problem. We call (8) the SDP primal.
206
+
207
+ 148 Continuing our example, consider ground-truth labels $\mathbf { x } = [ 1 \ \mathbf { \Sigma } - 1 \mathbf { \Sigma } 1 ] ^ { \top }$ for the 3-node graph in Fig. 2(a). The corresponding solution matrix 149 $\mathbf { M } = [ \mathbf { x x } ^ { \top } \mathbf { x } ; \mathbf { x } ^ { \top } \mathbf { 1 } ]$ is
208
+
209
+ $$
210
+ \mathbf { M } = \left[ \begin{array} { c c c c } { 1 } & { - 1 } & { 1 } & { 1 } \\ { - 1 } & { 1 } & { - 1 } & { - 1 } \\ { 1 } & { - 1 } & { 1 } & { 1 } \\ { 1 } & { - 1 } & { 1 } & { 1 } \end{array} \right] .
211
+ $$
212
+
213
+ 150 Observe that M can be interpreted as an adjacency matrix to a balanced signed graph; nodes 1, 3
214
+ 151 and 4 can be colored blue, and node 2 can be colored red, so that positive (negative) edges connect
215
+ 152 only nodes of the same (different) colors. See Fig. 2(b) for an illustration of the corresponding signed
216
+ 153 graph when interpreting M as an adjacency matrix (self-loops are not shown). However, while the
217
+ 154 solution space for the SDP primal (8) exhibits desirable graph balance, GDPA requires instead a
218
+ 155 graph Laplacian matrix to a balanced graph, which has opposite signs in the off-diagonal terms as the
219
+ 156 adjacency matrix. This motivates us to investigate the corresponding SDP dual problem instead.
220
+
221
+ # 157 4.2 SDP Dual
222
+
223
+ 158 We derive the dual problem based on SDP duality theory [13]. We first define
224
+
225
+ $$
226
+ \mathbf { A } _ { i } = \mathrm { d i a g } ( \mathbf { e } _ { N + 1 } ( i ) ) , \quad \mathbf { B } _ { i } = \left[ \begin{array} { c c } { \mathbf { 0 } _ { N \times N } } & { \mathbf { e } _ { N } ( i ) } \\ { \mathbf { e } _ { N } ^ { \top } ( i ) } & { 0 } \end{array} \right] .
227
+ $$
228
+
229
+ 159 where ${ \bf e } _ { N } ( i ) \in \{ 0 , 1 \} ^ { N }$ is a length- $N$ binary canonical vector with a single non-zero entry equals
230
+ 160 to 1 at the $i$ -th entry, $\mathbf { 0 } _ { N \times N }$ is a $N$ -by- $N$ matrix of zeros, and $\operatorname { d i a g } ( \mathbf { v } )$ is a diagonal matrix with
231
+ 161 diagonal entries equal to $\mathbf { v }$ . Note that $\mathbf { A } _ { i }$ and $\mathbf { B } _ { i }$ are symmetric. Next, we collect $M$ known labels
232
+ 162 $\{ \hat { x } _ { i } \bar \} _ { i = 1 } ^ { M }$ into a vector $\mathbf { b } \in \mathbb { R } ^ { M }$ of length $M$ , i.e.,
233
+
234
+ $$
235
+ b _ { i } = 2 \hat { x } _ { i } , ~ \forall i \in \{ 1 , \ldots , M \} .
236
+ $$
237
+
238
+ 163 We now define the SDP dual of (8) as
239
+
240
+ $$
241
+ \operatorname* { m i n } _ { \mathbf { y } , \mathbf { z } } ~ \mathbf { 1 } _ { N + 1 } ^ { \top } \mathbf { y } + \mathbf { b } ^ { \top } \mathbf { z } , ~ \mathrm { s . t . } ~ \mathbf { H } \triangleq \sum _ { i = 1 } ^ { N + 1 } y _ { i } \mathbf { A } _ { i } + \sum _ { i = 1 } ^ { M } z _ { i } \mathbf { B } _ { i } - \mathbf { L } \succeq 0
242
+ $$
243
+
244
+ 164 where $\mathbf { 1 } _ { N }$ is a length- $. N$ vector of ones, and dual variables are $\mathbf { y } \in \mathbb { R } ^ { N + 1 }$ and $\mathbf { z } \in \mathbb { R } ^ { M }$ . Because
245
+ 165 the objective is a minimization, when $b _ { i } < 0$ (i.e., $\hat { x } _ { i } < 0 \AA$ ), the corresponding $z _ { i } \geq 0$ . Similarly, for
246
+ 166 $b _ { i } > 0 , z _ { i } \leq 0 .$ Thus, the signs of variables $z _ { i }$ ’s are known a priori. Without loss of generality, we
247
+ 167 assume $z _ { i } \le 0 , \forall i \in \left\{ 1 , \ldots , M _ { 1 } \right\}$ and $z _ { i } \ge 0 , \forall i \in \{ M _ { 1 } + 1 , \ldots , M \}$ in the sequel.
248
+
249
+ # 4.3 Reformulating the SDP Dual
250
+
251
+ 169 We interpret $\mathbf { H } \in \mathbb { R } ^ { ( N + 1 ) \times ( N + 1 ) }$ in (12) as a graph Laplacian corresponding to a graph $\mathcal { G }$ . However,
252
+ 170 $\mathcal { G }$ is not a balanced signed graph, because of the last row / column in $\mathbf { H }$ . To see this, we write
253
+
254
+ $$
255
+ \mathbf { H } = \left[ \begin{array} { c c } { { \mathcal { L } _ { y } } } & { { \mathbf { g } } } \\ { \mathbf { g } ^ { \top } } & { { y } _ { N + 1 } } \end{array} \right]
256
+ $$
257
+
258
+ where 171 $\mathbf { g } = [ z _ { 1 } \dots z _ { M } \mathbf { 0 } _ { N - M } ^ { \top } ] ^ { \top }$ . Matrix $\mathcal { L } _ { y } \in \mathbb { R } ^ { N \times N }$ , which equals to $\mathcal { L } _ { y } = \mathrm { d i a g } ( y _ { 1 } , \dots , y _ { N } ) + \mathbf { L }$ , is a generalized Laplacian to a 172 $N$ -node positive graph $\mathcal { G } ^ { + }$ . However, node $N + 1$ has both positive
259
+
260
+ and negative edges to 173 $\mathcal { G } ^ { + }$ stemming from negative $z _ { i }$ ’s and positive $z _ { i }$ ’s, respectively. As a result, H 174 is not a Laplacian corresponding to a balanced signed graph.
261
+
262
+ 175 Continuing our 3-node line graph example with Laplacian $\mathbf { L }$ , the corresponding $\mathcal { L } _ { y }$ and $\mathbf { H }$ are
263
+
264
+ $$
265
+ \mathcal { L } _ { y } = \left[ \begin{array} { c c c } { y _ { 1 } + d _ { 1 } } & { - w _ { 1 , 2 } } & { 0 } \\ { - w _ { 1 , 2 } } & { y _ { 2 } + d _ { 2 } } & { - w _ { 2 , 3 } } \\ { 0 } & { - w _ { 2 , 3 } } & { y _ { 3 } + d _ { 3 } } \end{array} \right] , \quad \mathbf { H } = \left[ \begin{array} { c c c c } { y _ { 1 } + d _ { 1 } } & { - w _ { 1 , 2 } } & { 0 } & { z _ { 1 } } \\ { - w _ { 1 , 2 } } & { y _ { 2 } + d _ { 2 } } & { - w _ { 2 , 3 } } & { z _ { 2 } } \\ { 0 } & { - w _ { 2 , 3 } } & { y _ { 3 } + d _ { 3 } } & { 0 } \\ { z _ { 1 } } & { z _ { 2 } } & { 0 } & { y _ { 4 } } \end{array} \right] .
266
+ $$
267
+
268
+ 176 Interpreting $\mathbf { H }$ as a graph Laplacian, node 4 has degree $d _ { 4 } = - z _ { 1 } - z _ { 2 }$ . Thus, $y _ { 4 } = u _ { 4 } + d _ { 4 }$ , and
269
+ 177 self-loop weight for node 4 iss $u _ { 4 } = y _ { 4 } + z _ { 1 } + z _ { 2 }$ . See Fig. 2(c) for an illustration of this graph $\mathcal { G }$ .
270
+
271
+ In graph terminology, node 178 $( N { + } 1 )$ has positive and negative edges, with respective weights $\{ - z _ { i } \} _ { i = 1 } ^ { M _ { 1 } }$ 179 and $\{ - z _ { i } \} _ { i = M _ { 1 } + 1 } ^ { M }$ , to $\mathcal { G } ^ { + }$ , and a self-loop with weight $\begin{array} { r } { u _ { N + 1 } = y _ { N + 1 } + \sum _ { i = 1 } ^ { M } z _ { i } } \end{array}$ . We construct an 180 augmented graph $\bar { \mathcal { G } }$ with $N + 2$ nodes from $\mathcal { G }$ by splitting node $N + 1$ in $\mathcal { G }$ into two in $\bar { \mathcal { G } }$ , dividing 181 positive and negative edges between them. The specific graph construction for $\bar { \mathcal { G } }$ procedure is
272
+
273
+ 1. Construct first $N$ nodes with the same inter-connections as sub-graph $\mathcal { G } ^ { + }$ .
274
+ 2. Construct node $N + 1$ with positive edges $\{ - z _ { i } \} _ { i = 1 } ^ { M _ { 1 } }$ and node $N + 2$ with negative edges $\{ - z _ { i } \} _ { i = M _ { 1 } + 1 } ^ { M }$ to the first $N$ nodes in sub-graph $\mathcal { G } ^ { + }$ 1 .
275
+ 3. Add self-loops for node $N { + 1 }$ and $N { + 2 }$ with respective weights $u _ { N + 1 } / 2 - \epsilon$ and $u _ { N + 1 } / 2 + \epsilon$ , where $\epsilon \in \mathbb { R }$ is a parameter to be discussed.
276
+
277
+ 187 Denote by $\bar { \mathbf { H } } \in \mathbb { R } ^ { ( N + 2 ) \times ( N + 2 ) }$ the graph Laplacian matrix corresponding to $\bar { \mathcal { G } }$ . Continuing our
278
+ 3-node graph example, Fig. 2(d) shows the augmented graph 188 $\bar { \mathcal { G } }$ , and the corresponding $\bar { \bf H }$ is
279
+
280
+ $$
281
+ \bar { \bf H } = \left[ \begin{array} { c c c c c } { y _ { 1 } + d _ { 1 } } & { - w _ { 1 , 2 } } & { 0 } & { z _ { 1 } } & { 0 } \\ { - w _ { 1 , 2 } } & { y _ { 2 } + d _ { 2 } } & { - w _ { 2 , 3 } } & { 0 } & { z _ { 2 } } \\ { 0 } & { - w _ { 2 , 3 } } & { y _ { 3 } + d _ { 3 } } & { 0 } & { 0 } \\ { z _ { 1 } } & { 0 } & { 0 } & { \frac { 1 } { 2 } \big ( y _ { 4 } - z _ { 1 } + z _ { 2 } \big ) - \epsilon } & { 0 } \\ { 0 } & { z _ { 2 } } & { 0 } & { 0 } & { \frac { 1 } { 2 } \big ( y _ { 4 } + z _ { 1 } - z _ { 2 } \big ) + \epsilon } \end{array} \right] .
282
+ $$
283
+
284
+ Spectrally, 189 $\bar { \bf H }$ and $\mathbf { H }$ are related; we prove that $\lambda _ { \operatorname* { m i n } } ( \bar { \bf H } )$ is a lower bound for $\lambda _ { \operatorname* { m i n } } ( \mathbf { H } )$ .
285
+
286
+ Lemma 1. The smallest eigenvalue 190 $\lambda _ { \operatorname* { m i n } } ( \bar { \bf H } )$ of graph Laplacian $\bar { \bf H }$ to augmented graph $\bar { \mathcal { G } }$ is a lower 191 bound for $\lambda _ { \operatorname* { m i n } } ( \mathbf { H } )$ of Laplacian $\mathbf { H }$ to $\mathcal { G }$ , i.e.,
287
+
288
+ $$
289
+ \lambda _ { \operatorname* { m i n } } ( \bar { \mathbf H } ) \leq \lambda _ { \operatorname* { m i n } } ( \mathbf H ) .
290
+ $$
291
+
292
+ 192
293
+
294
+ 193 Proof. Denote by $\mathcal { G }$ the graph represented by generalized graph Laplacian $\mathbf { H }$ , with inter-node
295
+ 194 edge weights $\{ w _ { i j } \}$ and self-loop weights $\{ u _ { i } \}$ . Denote by $\mathbf { \bar { v } } \in \mathbb { R } ^ { N + 1 }$ the first eigenvector of $\mathbf { H }$
296
+ 195 corresponding to the smallest eigenvalue $\lambda _ { \operatorname* { m i n } } ( \mathbf { H } )$ . From (3), GLR of $\mathbf { H }$ computed using $\mathbf { v }$ is
297
+
298
+ $$
299
+ \mathbf { v } ^ { \top } \mathbf { H } \mathbf { v } = \sum _ { ( i , j ) \in { \mathcal { E } } \mid 1 \leq i , j \leq N } w _ { i , j } ( v _ { i } - v _ { j } ) ^ { 2 } - \sum _ { i = 1 } ^ { M } z _ { i } ( v _ { N + 1 } - v _ { i } ) ^ { 2 } + \sum _ { i = 1 } ^ { N } y _ { i } v _ { i } ^ { 2 } + u _ { N + 1 } v _ { N + 1 } ^ { 2 } .
300
+ $$
301
+
302
+ Now construct 196 $\pmb { \alpha } \in \mathbb { R } ^ { N + 2 }$ , where $\mathbf { \delta } \mathbf { \alpha } \mathbf { \alpha } \mathbf { \alpha } = \left[ v _ { 1 } \ldots v _ { N } v _ { N + 1 } v _ { N + 1 } \right] ^ { \top }$ . GLR of $\bar { \bf H }$ computed using $_ { \pmb { \alpha } }$ is
303
+
304
+ $$
305
+ \begin{array} { l } { { \displaystyle { \alpha } ^ { \top } { \bar { \mathbf { H } } } \alpha = \sum _ { ( i , j ) \in \mathcal { E } \mid 1 \leq i , j \leq N } w _ { i , j } ( v _ { i } - v _ { j } ) ^ { 2 } - \sum _ { i = 1 } ^ { M _ { 1 } } z _ { i } ( v _ { N + 1 } - v _ { i } ) ^ { 2 } - \sum _ { i = M _ { 1 } + 1 } ^ { M } z _ { i } ( v _ { N + 1 } - v _ { i } ) ^ { 2 } } } \\ { { \displaystyle ~ + \sum _ { i = 1 } ^ { N } y _ { i } v _ { i } ^ { 2 } + \left( \frac { u _ { N + 1 } } { 2 } - \epsilon \right) v _ { N + 1 } ^ { 2 } + \left( \frac { u _ { N + 1 } } { 2 } + \epsilon \right) v _ { N + 1 } ^ { 2 } . } } \end{array}
306
+ $$
307
+
308
+ Thus, 197 $\mathbf { v } ^ { \top } \mathbf { H } \mathbf { v } = \alpha ^ { \top } \bar { \mathbf { H } } \alpha$ . Since first eigenvector $\mathbf { v }$ minimizes the Rayleigh quotient of $\mathbf { H }$ ,
309
+
310
+ $$
311
+ \lambda _ { \operatorname* { m i n } } ( \mathbf { H } ) = \frac { \mathbf { v } ^ { \top } \mathbf { H } \mathbf { v } } { \mathbf { v } ^ { \top } \mathbf { v } } \overset { ( a ) } { \geq } \frac { \alpha ^ { \top } \bar { \mathbf { H } } \alpha } { \alpha ^ { \top } \alpha } \overset { ( b ) } { \geq } \lambda _ { \operatorname* { m i n } } ( \bar { \mathbf { H } } ) .
312
+ $$
313
+
314
+ 198 $( a )$ holds since $\mathbf { v } ^ { \top } \mathbf { v } \leq \alpha ^ { \top } \alpha$ by construction, and $( b )$ holds since $\begin{array} { r } { \lambda _ { \operatorname* { m i n } } ( \bar { \bf H } ) = \operatorname* { m i n } _ { \bf x } \frac { { \bf x } ^ { \top } \bar { \bf H } { \bf x } } { { \bf x } ^ { \top } { \bf x } } } \end{array}$ .
315
+
316
+ 199 From the proof above, the usefulness of parameter $\epsilon$ becomes clear: the bound $\lambda _ { \operatorname* { m i n } } ( \bar { \mathbf H } ) \leq \lambda _ { \operatorname* { m i n } } ( \mathbf { H } )$
317
+ 200 becomes tight when the last two entries in the first eigenvector of $\bar { \bf H }$ are similar. To promote this, we
318
+ 201 set $\epsilon$ to an appropriate large value, so that the first eigenvector minimizing the Rayleigh quotient of
319
+ 202 $\bar { \bf H }$ would choose similar small values for the last two entries.
320
+ 203 Given Lemma 1, we now reformulate the SDP dual (12) by keeping the same objective but imposing
321
+ 204 PSD cone constraint on $\bar { \bf H }$ instead of $\mathbf { H }$ . Define ${ \bf A } _ { i } ^ { \prime }$ , $\mathbf { B } _ { i } ^ { \prime }$ and $\mathbf { B } _ { i } ^ { \prime \prime }$ similarly to (10) but for a larger
322
+ 205 $( N + 2 )$ -by- $( N + 2 )$ matrix; i.e., $\mathbf { A } _ { i } ^ { \prime } = \mathrm { d i a g } ( \mathbf { e } _ { N + 2 } ( i ) )$ , $\mathbf { B } _ { i } ^ { \prime } \ = \ [ \mathbf { B } _ { i } \ \mathbf { 0 } _ { N + 1 } ; \mathbf { 0 } _ { N + 1 } ^ { \top } \ 0 ]$ , and $\mathbf { B } _ { i } ^ { \prime \prime } =$
323
+ 206 $[ \mathbf { 0 } _ { ( N + 1 ) \times ( N + 1 ) } \mathbf { e } _ { N + 1 } ( i ) ; \mathbf { e } _ { N + 1 } ^ { \top } ( i ) \mathbf { 0 } _ { }$ ]. The reformulated SDP dual is
324
+
325
+ $$
326
+ \begin{array} { l } { \displaystyle \operatorname* { m i n } _ { { \bf y } , { \bf z } } ~ { \bf 1 } _ { N + 1 } ^ { \top } { \bf y } + { \bf b } ^ { \top } { \bf z } , } \\ { \displaystyle \mathrm { s . t . } ~ \bar { \bf H } \triangleq \sum _ { i = 1 } ^ { N } y _ { i } { \bf A } _ { i } ^ { \prime } + \kappa _ { N + 1 } { \bf A } _ { N + 1 } ^ { \prime } + \kappa _ { N + 2 } { \bf A } _ { N + 2 } ^ { \prime } + \sum _ { i = 1 } ^ { M _ { 1 } } z _ { i } { \bf B } _ { i } ^ { \prime } + \sum _ { i = M _ { 1 } + 1 } ^ { M } z _ { i } { \bf B } _ { i } ^ { \prime \prime } - { \bf L } \succeq 0 } \end{array}
327
+ $$
328
+
329
+ 207 where $\begin{array} { r } { \kappa _ { N + 1 } = \frac { u _ { N + 1 } } { 2 } - \sum _ { i = 1 } ^ { M _ { 1 } } z _ { i } - \epsilon } \end{array}$ and $\begin{array} { r } { \kappa _ { N + 2 } = \frac { u _ { N + 1 } } { 2 } - \sum _ { i = M _ { 1 } + 1 } ^ { M } z _ { i } + \epsilon } \end{array}$ . Given $\bar { \bf H }$ is now a
330
+ 208 Laplacian to a balanced graph, we discuss the application of GDPA linearization to solve (20) next.
331
+
332
+ # 09 5 Algorithm Implementation
333
+
334
+ # 5.1 GDPA Linearization
335
+
336
+ 211 We replace the PSD cone constraint on $\bar { \bf H }$ in (20) with $N + 2$ linear constraints via GDPA [11].
337
+ 212 Specifically, at iteration $t$ , we compute first eigenvector $\mathbf { v } ^ { t }$ of solution $\bar { \mathbf { H } } ^ { t }$ using LOBPCG [32]. We
338
+ 213 define scalars $s _ { i } = 1 / v _ { i } ^ { t } , \forall i \in \{ 1 , \top . . . , N + 2 \}$ . Finally, we write $N + 2$ constraints corresponding to
339
+ 214 $\lambda _ { \operatorname* { m i n } } ^ { - } ( \mathbf { S } \bar { \mathbf { H } } \mathbf { S } ^ { - 1 } ) \geq 0$ , where $\mathbf { S } = \mathrm { d i a g } ( s _ { 1 } , \dots , s _ { N + 2 } )$ , i.e.,
340
+
341
+ $$
342
+ \begin{array} { r l } { y _ { i } + d _ { i } - \sum _ { j \neq i } \left| s _ { i } w _ { i , j } / s _ { j } \right| - \left| s _ { i } z _ { i } / s _ { N + 1 } \right| } & { \geq 0 , ~ \forall i \in \{ 1 , \ldots , M _ { 1 } \} } \\ { y _ { i } + d _ { i } - \sum _ { j \neq i } \left| s _ { i } w _ { i , j } / s _ { j } \right| - \left| s _ { i } z _ { i } / s _ { N + 2 } \right| } & { \geq 0 , ~ \forall i \in \{ M _ { 1 } + 1 , \ldots , M \} } \\ { y _ { i } + d _ { i } - \sum _ { j \neq i } \left| s _ { i } w _ { i , j } / s _ { j } \right| } & { \geq 0 , ~ \forall i \in \{ M + 1 , \ldots , N \} } \\ { u _ { N + 1 } / 2 - \epsilon - \sum _ { j = 1 } ^ { M _ { 1 } } \left| s _ { N + 1 } z _ { j } / s _ { j } \right| } & { \geq 0 } \\ { u _ { N + 1 } / 2 + \epsilon - \sum _ { j = M _ { 1 } + 1 } ^ { M } \left| s _ { N + 2 } z _ { j } / s _ { j } \right| } & { \geq 0 } \end{array}
343
+ $$
344
+
345
+ 215 where the indices for summation $\textstyle \sum _ { j \neq i }$ are $\{ 1 , \ldots , N \} \setminus i$ . Note that the absolute value operation
346
+ 216 can be appropriately removed for each term $s _ { i } w _ { i , j } / s _ { j }$ and $s _ { i } z _ { i } / s _ { j }$ , since the signs for $s _ { i }$ , $w _ { i , j }$ and
347
+ 217 $z _ { i }$ are known. Together with linear objective in (20), this constitutes an LP for variables y and $\mathbf { z }$
348
+ 218 solvable using any available fast LP solvers [14]. Compared to SDP primal (8) with a large matrix
349
+ 219 variable $\mathbf { M } \in \mathbf { \bar { \mathbb { R } } } ^ { ( \bar { N } + 1 ) \times ( N + 1 ) }$ , our LP variables, $\mathbf { y } \in \mathbb { R } ^ { N + 1 }$ and $\mathbf { z } \in \mathbb { R } ^ { M }$ , are much smaller.
350
+ 220 A sequence of LPs are solved, each time with scalars $s _ { i }$ ’s updated from computed solution $\bar { \mathbf { H } } ^ { t }$ , until
351
+ 221 convergence. The bulk of the complexity resides in the computation of the first eigenvector $\mathbf { v } ^ { t }$ for
352
+ 222 each LP solution $\bar { \mathbf { H } } ^ { t }$ . LOBPCG is an iterative algorithm that can benefit from warm start [11]: with
353
+ 223 a good initial guess for $\mathbf { v } _ { } ^ { t }$ , the algorithm converges faster. Since $\bar { \mathbf { H } } ^ { t }$ changes gradually through
354
+ 224 our iterations, we use previously computed eigenvector $\mathbf { v } ^ { t - 1 }$ of $\bar { \mathbf { H } } ^ { t - 1 }$ as initial guess for $\mathbf { v } _ { } ^ { t }$ of $\tilde { \mathbf { H } } ^ { t }$ .
355
+ 225 Experiments show that warm start reduces the iteration number till convergence significantly.
356
+
357
+ # 5.2 Initialization & Prediction Label Extraction
358
+
359
+ Our LP in Section 5.1 requires an initial $\bar { \mathbf { H } } ^ { 0 }$ to compute first eigenvector $\mathbf { v } ^ { 0 }$ , so that scalars $\{ s _ { i } \} _ { i = 1 } ^ { N + 2 }$ can be defined for linear constraints in (21). To initialize , we set $\mathbf { y } ^ { 0 } = [ \mathbf { 1 } _ { M } ^ { \top } \mathbf { 0 } _ { N - M } ^ { \top } \mathbf { \bar { \Gamma } } ]$ and $\mathbf { z } ^ { 0 } = [ - \hat { x } _ { 1 } . . . - \hat { x } _ { M } ]$ . Parameter $\epsilon$ is set to $\boldsymbol { \epsilon } ^ { t } = \mathbf { 1 } _ { N + 1 } ^ { \top } \mathbf { y } ^ { t - 1 } + \mathbf { 1 } _ { M } ^ { \top } \mathbf { z } ^ { t - 1 }$ at iteration $t$ . $\bar { \mathbf { H } } ^ { 0 }$ can then be computed using definition of $\bar { \bf H }$ in (20).
360
+
361
+ 231 As similarly done in [5], we extract prediction labels $\mathbf { x } ^ { * } = [ x _ { 1 } \ldots x _ { N } ] ^ { \top }$ from converged LP solution
362
+ 232 $\mathbf { y } ^ { * }$ and $\mathbf { z } ^ { \ast }$ as follows. We first construct $\mathbf { H } ^ { * }$ using $\mathbf { y } ^ { * }$ and $\mathbf { z } ^ { \ast }$ using definition of $\mathbf { H }$ in (12). We then
363
+ 233 compute $\mathbf { x } ^ { * } = \mathrm { s i g n } ( \hat { x } _ { 1 } v _ { 1 } \mathbf { v } )$ , where $v _ { 1 }$ is the first entry of the first eigenvector $\mathbf { v }$ of $\mathbf { H } ^ { * }$ . See [5] for
364
+ 234 details of recovering SDP primal variables from dual variables in BQP.
365
+
366
+ # 6 Experiments
367
+
368
+ # 6.1 Experimental Setup
369
+
370
+ We implemented our GDPA-graph-based classifier learning scheme in Matlab4, and evaluated it in terms of average classification error rate and running time. We compared our algorithm against the following schemes that solve the SDP primal problem (8) directly: i) two primal-dual interior-point solvers for SDP, SeDuMi and MOSEK, both of which are available in CVX with a CVX Professional license [33], ii) an ADMM first-order operator-splitting solver CDCS [26, 27] with an LGPL-3.0 License [34], iii) a spectrahedron-based relaxation solver SDCut [22, 23, 35] that involves L-BFGS-B [36], and iv) a biconvex relaxation solver BCR [24, 37], all of which are implemented in Matlab. In addition, we employed CDCS again to solve our modified SDP dual problem (20).
371
+
372
+ We set the convergence threshold of the first eigenvector solver LOBPCG to be $1 0 ^ { - 4 }$ , with maximum number of iterations 200. We set the convergence threshold of our LP solver to be $1 0 ^ { - 4 }$ also, with maximum number of iterations 100, since first-order methods, i.e., CDCS and SDCut, aim at computing a solution of moderate accuracy [26]. Accordingly, we set the convergence threshold of SeDuMi and MOSEK to be ‘low’, which is approximately equal to $1 0 ^ { - 4 }$ and the lowest precision setting in CVX. We set the convergence thresholds of CDCS and SDCut to be $1 0 ^ { - 3 }$ , the maximum number of ADMM iterations in CDCS to be 1000, the maximum number of iterations for L-BFGS-B in SDCut and the main loop in BCR to be 100, and the Frobenius norm weight in SDCut to be 100. We chose these settings since smaller convergence thresholds and larger number of iterations would cause CDCS, SDCut and BCR to be significantly slower to converge. We used default settings for all remaining solvers. All computations were carried out on a Windows 10 64bit PC with AMD RyzenThreadripper 3960X 24-core processor $3 . 8 0 \mathrm { G H z }$ and 128GB of RAM.
373
+
374
+ We adopted 17 binary datasets that are freely available in UCI [38] and LibSVM [39]. For experimental efficiency, we first performed a $K$ -fold $( K \leq 5 )$ ) split for each dataset with random seed 0, and then created 10 instances of $50 \%$ training- $50 \%$ test split for each fold, with random seeds 1-10 [40]. The above setup resulted in problem sizes from 29 to 400. We applied the following two data normalization schemes for the training/test data: i) a standardization scheme in [41] that first subtracts the mean and divides by the feature-wise standard deviation, and then normalizes to unit length sample-wise, and ii) a min-max scheme [40] that rescales each feature to within 0 and 1. We added $1 0 ^ { - 1 2 }$ noise to the dataset to avoid NaN’s due to data normalization on small samples.
375
+
376
+ # 6.2 Experimental Results
377
+
378
+ Fig. 3 and the first two plots of Fig. 4 show classification error rates and runtime (in log scale) using min-max and standardization data re-scaling strategies for 17 different datasets, respectively. The $x$ -axis of each plot denotes the datasets in ascending order of problem sizes. Each point in the plots denotes the average of $1 0 K$ runs. Fig. 4 (right) shows runtime versus problem size (4 to 24428) using the same dataset cod-rna (freely avaiable in LibSVM [39]). We did not execute SeDuMi, MOSEK, CDCS (8), BCR, SDcut, or CDCS (20) when the problem size was larger than 976.
379
+
380
+ In terms of classification error rate for min-max re-scaling, MOSEK, CDCS (8) and SeDuMi had slightly larger error rates: $3 2 . 5 2 \%$ , $3 2 . 3 8 \%$ and $2 9 . 9 2 \%$ , respectively. GDPA had $2 9 . 1 1 \%$ , which was very close to CDCS (20) at $2 9 . 2 4 \%$ and SDCut at $2 8 . 7 6 \%$ . This shows that our proposed GDPA linearization (21) closely approximated the modified SDP dual (20) in performance. BCR at $2 6 . 8 2 \%$ was roughly $2 \%$ smaller. In the standardization re-scaling case, CDCS (8), MOSEK, and SeDuMi had the largest error rates: $3 2 . 7 5 \%$ , $3 2 . 5 \%$ and $3 1 . 0 \%$ , respectively. GDPA had $2 6 . 8 8 \%$ , close to CDCS (20) at $2 6 . 9 \%$ and SDCut with $2 6 . 8 2 \%$ . BCR at $2 4 . 8 \%$ was again roughly $2 \%$ smaller. By factorizing a PSD matrix $\mathbf { M } = \mathbf { X } \mathbf { X } ^ { \top }$ , BCR avoided any SDP relaxation, which may explain its slightly better performance here. However, BCR solved a non-convex optimization problem converging to a local minimum, and thus occasionally the performance was quite poor (e.g., see sonar in Fig. 3(left)). Overall, all solvers performed similarly given constructed similarity graphs in the two cases.
381
+
382
+ In terms of runtime, BCR was competitive with GDPA when the problem size was small, but GDPA significantly outperformed all competing solvers when the problem size was large. Specifically, the speed gain increased as problem size increased; for madelon with problem size 400, the speedup of
383
+
384
+ 286 GDPA over the next fastest scheme BCR was $3 4 6 \times$ . Fig. 4 (right) also shows that the computation
385
+ 287 time for GDPA increased gracefully as the problem size increased to very large sizes. The reason for
386
+ 288 our dramatic speed gain is the fast computation of first eigenvectors using LOBPCG, which benefited
387
+ 289 from warm start during the LP iterations. In general, GDPA performed fewer than $1 0 \mathrm { ~ L P }$ ’s until
388
+ 290 convergence. In contrast, both CDCS and SDCut required eigen-decomposition of a matrix of size
389
+ 291 $N \times N$ per iteration. Because L described a dense graph in our experiments, the speedup of replacing
390
+ 292 the full eigen-decomposition with simpler first eigenvector computation per iteration was significant.
391
+ 293 For BCR, each iteration required either $N$ -dimensional matrix inversion for a least-squares problem
392
+ 294 or iterative gradient descent, which was computationally expensive as the problem size increased. On
393
+ 295 average, GDPA enjoyed a $4 0 . 9 \times$ speedup over the next fastest solver BCR.
394
+
395
+ ![](images/524c13786bb667eac69dc4f58ac690638cb33a02eca860c3b836f6db34cb0204.jpg)
396
+ Figure 3: Error rates $( \% )$ for min-max (left) and standardization (right) data re-scaling.
397
+
398
+ ![](images/e2b2cdae6c1a43150ce81eb5c712655bf973f52c8269c04cf136a45185c335d4.jpg)
399
+ Figure 4: Runtime (ms) for min-max (left) and standardization (center) data re-scaling on different datasets, and runtime (ms) for variable problem sizes on the same dataset cod-rna (right).
400
+
401
+ # 296 7 Conclusion
402
+
403
+ 297 We propose a fast projection-free algorithm for the graph-based classifier learning problem. The
404
+ 298 key idea is to replace the difficult-to-compute positive semi-definite (PSD) cone constraint with
405
+ 299 linear constraints derived from the recent Gershgorin disc perfect alignment (GDPA) theory, so that
406
+ 300 the optimization can be solved as a sequence of linear programs (LP). Experiments show that our
407
+ 301 algorithm enjoyed a considerable speedup while retaining comparable label prediction performance.
408
+ 302 A graph classifier scalable to very large sizes encourages ubiquitous deployment for wide-ranging
409
+ 303 applications. Negative social impact can result if the tool is misused by enabling classification for
410
+ 304 discriminatory purposes. As an optimization problem, graph-based binary classification is rather
411
+ 305 narrowly defined (though multi-class classification can be implemented as a tree of binary classifiers).
412
+ 306 Furthermore, good performance depends heavily on the construction of a good similarity graph,
413
+ 307 which is outside the scope of this paper. However, we conjecture that the general methodology of
414
+ 308 GDPA linearization can be similarly tailored to other SDP problems with PSD cone constraints. We
415
+ 309 anticipate that speedups in other SDP problems will also be significant.
416
+
417
+ References
418
+ [1] C. M. Bishop, Pattern Recognition and Machine Learning (Information Science and Statistics), Springer-Verlag, Berlin, Heidelberg, 2006.
419
+ [2] D. Zhou, O. Bousquet, T. N. Lal, J. Weston, and B. Scholkopf, “Learning with local and global consistency,” in 16th International Conference on Neural Information Processing (NIPS), Whistler, Canada, December 2003.
420
+ [3] M. Belkin, I. Matveeva, and P. Niyogi, “Regularization and semisupervised learning on large graphs,” in Shawe-Taylor J., Singer Y. (eds) Learning Theory, COLT 2004, Lecture Notes in Computer Science, 2004, vol. 3120, pp. 624–638. [4] A. Guillory and J. Bilmes, “Label selection on graphs,” in Twenty-Third Annual Conference on Neural Information Processing Systems, Vancouver, Canada, December 2009. [5] Z. Luo, W. Ma, A. M. So, Y. Ye, and S. Zhang, “Semidefinite relaxation of quadratic optimization problems,” IEEE Signal Processing Magazine, vol. 27, no. 3, pp. 20–34, 2010.
421
+ [6] Z. Li, J. Liu, and X. Tang, “Pairwise constraint propagation by semidefinite programming for semi-supervised classification,” in ACM International Conferene on Machine Learning, Helsinki, Finland, July 2008.
422
+ [7] B O’Donoghue, E. Chu, N. Parikh nad, and S. Boyd, “Conic optimization via operator splitting and homogeneous self-dual embedding,” in Journal of Optimization Theory and Applications, 2016, vol. 169, no.3, pp. 1042–1068. [8] J. Pang and G. Cheung, “Graph Laplacian regularization for inverse imaging: Analysis in the continuous domain,” in IEEE Transactions on Image Processing, April 2017, vol. 26, no.4, pp. 1770–1785. [9] M. Goemans and D. Williamson, “Improved approximation algorithms for maximum cut and satisfiability problems using semidefinite programming,” J. ACM, vol. 42, no. 6, pp. 1115–1145, Nov. 1995.
423
+ [10] R. S. Varga, Gershgorin and his circles, Springer, 2004.
424
+ [11] C. Yang, G. Cheung, and H. Wei, “Signed graph metric learning via Gershgorin disc perfect alignment,” arXiv, 2021.
425
+ [12] D. Cartwright and F. Harary, “Structural balance: a generalization of Heider’s theory,” in Psychological Review, 1956, vol. 63, no.5, pp. 277–293.
426
+ [13] B. Gartner and J. Matousek, Approximation Algorithms and Semidefinite Programming, Springer, 2012.
427
+ [14] R. Vanderbei, Linear Programming: Foundations and Extensions (5th Edition), Springer Nature, 2021.
428
+ [15] A. Ortega, P. Frossard, J. Kovacevic, J. M. F. Moura, and P. Vandergheynst, “Graph signal processing: Overview, challenges, and applications,” in Proceedings of the IEEE, May 2018, vol. 106, no.5, pp. 808–828.
429
+ [16] G. Cheung, E. Magli, Y. Tanaka, and M. Ng, “Graph spectral image processing,” in Proceedings of the IEEE, May 2018, vol. 106, no.5, pp. 907–930.
430
+ [17] M. Gavish, B. Nadler, and R. Coifman, “Multiscale wavelets on trees, graphs and high dimensional data: Theory and applications to semi-supervised learning,” in 27th International Conference on Machine Learning, Haifa, Israel, June 2010.
431
+ [18] D. Shuman, M. Faraji, and P. Vandergheynst, “Semi-supervised learning with spectral graph wavelets,” in International Conference on Sampling Theory and Applications (SampTA), Singapore, May 2011.
432
+ [19] G. Cheung, W.-T. Su, Y. Mao, and C.-W. Lin, “Robust semisupervised graph classifier learning with negative edge weights,” in IEEE Transactions on Signal and Information Processing over Networks, December 2018, vol. 4, no.4, pp. 712–726.
433
+ [20] X. Dong, D. Thanou, M. Rabbat, and P. Frossard, “Learning graphs from data: A signal representation perspective,” IEEE Signal Processing Magazine, vol. 36, no. 3, pp. 44–63, 2019.
434
+ [21] C. Helmberg, F. Rendl, R. Vanderbei, and H. Wolkowicz, “An interior-point method for semidefinite programming,” in SAIM J. Optim., 1996, vol. 6, no.2, pp. 342–361.
435
+ [22] P. Wang, C. Shen, and A. van den Hengel, “A fast semidefinite approach to solving binary quadratic problems,” in IEEE International Conference on Computer Vision and Pattern Recognition, Portland, OR, June 2013.
436
+ [23] P. Wang, C. Shen, A. Hengel, and P. Torr, “Large-scale binary quadratic optimization using semidefinite relaxation and applications,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 39, no. 3, pp. 470–485, 2017.
437
+ [24] S. Shah et al., “Biconvex relaxation for semidefinite programming in computer vision,” in European Conference on Computer Vision, Amsterdam, the Netherlands, October 2016.
438
+ [25] S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein, “Distributed optimization and statistical learning via the alternating direction method of multipliers,” in Foundations and Trends in Optimization, 2011, vol. 3, no.1, pp. 1–122.
439
+ [26] Y. Zheng, G. Fantuzzi, and A. Papachristodoulou, “Fast ADMM for sum-of-squares programs using partial orthogonality,” IEEE Transactions on Automatic Control, vol. 64, no. 9, pp. 3869–3876, 2019.
440
+ [27] Y. Zheng, G. Fantuzzi, A. Papachristodoulou, P. Goulart, and A. Wynn, “Chordal decomposition in operator-splitting methods for sparse semidefinite programs,” Mathematical Programming, vol. 180, pp. 489—-532, 2020.
441
+ [28] F. Chung, Spectral Graph Theory, American Mathematical Society, 1996.
442
+ [29] T. Dittrich and G. Matz, “Signal processing on signed graphs: Fundamentals and potentials,” in IEEE Signal Processing Magazine, November 2020, vol. 37, no.6, pp. 86–98.
443
+ [30] J. Kunegis, S. Schmidt, A. Lommatzsch, J. Lerner, E. D. Luca, and S. Albayrak, “Spectral analysis of signed graphs for clustering, prediction and visualization,” in SIAM International Conference on Data Mining, Columbus, OH, May 2010.
444
+ [31] Panagiotis Moutafis, Mengjun Leng, and Ioannis A. Kakadiaris, “An overview and empirical comparison of distance metric learning methods,” IEEE Transactions on Cybernetics, vol. 47, no. 3, pp. 612–625, 2017.
445
+ [32] A. V. Knyazev, “Toward the optimal preconditioned eigensolver: Locally optimal block preconditioned conjugate gradient method,” SIAM Journal on Scientific Computing, vol. 23, no. 2, pp. 517–541, 2001.
446
+ [33] “CVX Research,” http://cvxr.com/cvx/, Accessed: 2021-5-28.
447
+ [34] “CDCS implementation,” https://github.com/oxfordcontrol/CDCS, Accessed: 2021-5- 28.
448
+ [35] “SDcut implementation,” https://github.com/chhshen/SDCut, Accessed: 2021-5-28.
449
+ [36] C. Zhu, R. Byrd, P. Lu, and J. Nocedal, “Algorithm 778: L-BFGS-B: Fortran subroutines for large-scale bound-constrained optimization,” ACM Trans. Math. Softw., vol. 23, no. 4, pp. 550–560, Dec. 1997.
450
+ [37] “BCR implementation,” https://github.com/shahsohil/biconvex-relaxation, Accessed: 2021-5-28.
451
+ [38] “UCI machine learning repository,” https://archive.ics.uci.edu/ml/datasets.php, Accessed: 2021-5-28.
452
+ [39] “LibSVM Data: Classification (Binary Class),” https://www.csie.ntu.edu.tw/\~cjlin/ libsvmtools/datasets/binary.html, Accessed: 2021-5-28.
453
+ [40] S. Russell and P. Norvig, Artificial Intelligence: A Modern Approach, Prentice Hall Press, USA, 3rd edition, 2009.
454
+ [41] M. Dong, Y. Wang, X. Yang, and J. Xue, “Learning local metrics and influential regions for classification,” IEEE TPAMI, vol. 42, no. 6, pp. 1522–1529, June 2020.
455
+
456
+ # Checklist
457
+
458
+ 1. For all authors...
459
+
460
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] . The paper proposes a new fast algorithm for the precisely defined graph-based classifier learning problem.
461
+ (b) Did you describe the limitations of your work? [Yes] . In the conclusion, we discussed the limitation of our work: graph-based binary classification is somewhat narrowly defined, compared to the more general semi-definite programming (SDP) problem. However, we conjecture that similar optimization strategies can be customized for other SDP problems, which is left for future work. Moreover, the performance of a graph classifier depends heavily on the construction of a similarity graph, which is outside the scope of this paper.
462
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] . In the conclusion, we discussed potential misuse of graph classifiers that may result in discriminatory classification.
463
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
464
+
465
+ 2. If you are including theoretical results...
466
+
467
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] Assumptions for the original SDP primal problem (8) are stated in Section 4.1. Assumptions for Lemma 1 are stated in Section 4.3.
468
+ (b) Did you include complete proofs of all theoretical results? [Yes] Proof of Lemma 1 is provided in Section 4.3.
469
+
470
+ 3. If you ran experiments...
471
+
472
+ (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] Code, data, and instructions needed to reproduce the main experimental results are available at the link provided in footnote 4 of Section 6.1.
473
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] The convergence thresholds and maximum number of iterations of the core algorithms (if any) in each evaluated method were described in paragraph 2 of Section 6.1.
474
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
475
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We reported the average runtime of each problem for each evaluated method in Fig. 4 of Section 6. We reported the type of resources used in paragraph 2 of Section 6.1.
476
+
477
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
478
+
479
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We included the original papers and URL’s that produced the code packages in paragraph 1 of Section 6.1. We included the URL’s where the datasets are freely available in paragraph 3 of Section 6.1.
480
+ (b) Did you mention the license of the assets? [Yes] We included the license of the code packages used in our experiments in paragraph 1 of Section 6.1.
481
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No] We included all experimented assets in the main body of our paper.
482
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] We described the datasets used in the experiments, which are freely available in the URL’s we provided in [38] and [39] of Section 6.1.
483
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
484
+
485
+ 5. If you used crowdsourcing or conducted research with human subjects...
486
+
487
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
488
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
md/train/r1TA9ZbA-/r1TA9ZbA-.md ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO SEARCH WITH MCTSNET
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Planning problems are among the most important and well-studied problems in artificial intelligence. They are most typically solved by tree search algorithms that simulate ahead into the future, evaluate future states, and back-up those evaluations to the root of a search tree. Among these algorithms, Monte-Carlo tree search (MCTS) is one of the most general, powerful and widely used. A typical implementation of MCTS uses cleverly designed rules, optimised to the particular characteristics of the domain. These rules control where the simulation traverses, what to evaluate in the states that are reached, and how to back-up those evaluations. In this paper we instead learn where, what and how to search. Our architecture, which we call an MCTSnet, incorporates simulation-based search inside a neural network, by expanding, evaluating and backing-up a vector embedding. The parameters of the network are trained end-to-end using gradient-based optimisation. When applied to small searches in the well-known planning problem Sokoban, the learned search algorithm significantly outperformed MCTS baselines.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Many success stories in artificial intelligence are based on the application of powerful tree search algorithms to challenging planning problems (Samuel, 1959; Knuth & Moore, 1975; Jünger et al., 2009). It has been well documented that planning algorithms can be highly optimised by tailoring them to the domain (Schaeffer, 2000). For example, the performance can often be dramatically improved by modifying the rules that select the trajectory to traverse, the states to expand, the evaluation function by which performance is measured, and the backup rule by which those evaluations are propagated up the search tree. Our contribution is a new search algorithm in which all of these steps can be learned automatically and efficiently. Our work fits into a more general trend of learning differentiable versions of algorithms.
12
+
13
+ One particularly powerful and general method for planning is Monte-Carlo tree search (MCTS) (Coulom, 2006; Kocsis & Szepesvári, 2006), as used in the recent AlphaGo program (Silver et al., 2016). A typical MCTS algorithm consists of several phases. First, it simulates trajectories into the future, starting from a root state. Second, it evaluates the performance of leaf states - either using a random rollout, or using an evaluation function such as a ’value network’. Third, it backs-up these evaluations to update internal values along the trajectory, for example by averaging over evaluations.
14
+
15
+ We present a neural network architecture that includes the same processing stages as a typical MCTS, but inside the neural network itself, as a dynamic computational graph. The key idea is to represent the internal state of the search, at each node, by a memory vector. The computation of the network proceeds forwards from the root state, just like a simulation of MCTS, using a simulation policy based on the memory vector to select the trajectory to traverse. The leaf state is then processed by an embedding network to initialize the memory vector at the leaf. The network proceeds backwards up the trajectory, updating the memory at each visited state according to a backup network that propagates from child to parent. Finally, the root memory vector is used to compute an overall prediction of value or action.
16
+
17
+ The major benefit of our planning architecture, compared to more traditional planning algorithms, is that it can be exposed to gradient-based optimisation. This allows us to replace every component of MCTS with a richer, learnable equivalent — while maintaining the desirable structural properties of MCTS such as the use of a model, iterative local computations, and structured memory. We jointly train the parameters of the evaluation network, backup network and simulation policy so as to optimise the overall predictions of the MCTS network (MCTSnet). The majority of the network is fully differentiable, allowing for efficient training by gradient descent. Still, internal action sequences directing the control flow of the network cannot be differentiated, and learning this internal policy presents a challenging credit assignment problem. To address this, we propose a novel, generallyapplicable approximate scheme for credit assignment that leverages the anytime property of our computational graph, allowing us to also effectively learn this part of the search network from data.
18
+
19
+ In the Sokoban domain, a classic planning task (Botea et al., 2003), we justify our network design choices and show that our learned search algorithm is able to outperform various model-free and model-based baselines.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ There has been significant previous work on learning evaluation functions, using supervised learning or reinforcement learning, that are subsequently combined with a search algorithm (Tesauro, 1994; Baxter et al., 1998; Silver et al., 2016). However, the learning process is typically decoupled from the search algorithm, and has no awareness of how the search algorithm will combine those evaluations into an overall decision.
24
+
25
+ Several previous search architectures have learned to tune the parameters of the evaluation function so as to achieve the most effective overall search results given a specified search algorithm. The learning-to-search framework (Chang et al., 2015) learns an evaluation function that is effective in the context of beam search. Samuel’s checkers player (Samuel, 1959), the TD(leaf) algorithm (Baxter et al., 1998; Schaeffer et al., 2001), and the TreeStrap algorithm apply reinforcement learning to find an evaluation function that combines with minimax search to produce an accurate root evaluation (Veness et al., 2009); while comparison training (Tesauro, 1988) applies supervised learning to the same problem; these methods have been successful in chess, checkers and shogi. In all cases the evaluation function is scalar valued.
26
+
27
+ There have been a variety of previous efforts to frame the learning of internal search decisions as a meta-reasoning problem, one which can be optimized directly (Russell, 1995). Kocsis et al. (2005) apply black-box optimisation to learn the meta-parameters controlling an alpha-beta search, but do not learn fine-grained control over the search decisions. Considering action choices at tree nodes as a bandit problem led to the widely used UCT variant of MCTS (Kocsis & Szepesvári, 2006). Hay & Russell (2011) also studied the meta-problem in MCTS, but they only considered a myopic policy without function approximation. Pascanu et al. (2017) also investigate learning-to-plan using neural networks, but their approach is not differentiable, potentially limiting its scalability.
28
+
29
+ Other neural network architectures have also incorporated Monte-Carlo simulations. The I2A architecture (Weber et al., 2017) aggregates the results of several simulations into its network computation. MCTSnets both generalise and extend some ideas behind I2A: introducing a tree structured memory that stores node-specific statistics; and learning the simulation and tree expansion strategy, rather than rolling out each possible action from the root state with a fixed policy. Similar to I2A, the predictron architecture (Silver et al., 2017b) also aggregates over multiple simulations; however, in that case the simulations roll out an implicit transition model, rather than concrete steps from the actual environment.
30
+
31
+ # 3 MCTSNET
32
+
33
+ The MCTSnet architecture may be understood from two distinct but equivalent perspectives. First, it may be understood as a search algorithm with a control flow that closely mirrors the simulationbased tree traversals of MCTS. Second, it may be understood as a neural network represented by a computation graph that processes input states, performs intermediate computations on hidden states, and outputs a final decision. We present each of these perspectives in turn, starting with the original, unmodified search algorithm.
34
+
35
+ # 3.1 MCTS ALGORITHM
36
+
37
+ The goal of planning is to find the optimal strategy that maximises the total reward in an environment defined by a deterministic transition model $s ^ { \prime } = T ( s , a )$ , mapping each state and action to a successor state $s ^ { \prime }$ , and a reward model $r ( s , a )$ , describing the goodness of each transition.
38
+
39
+ MCTS is a simulation-based search algorithm that converges to a solution to the planning problem. At a high level, the idea of MCTS is to maintain statistics at each node, such as the visit count and mean evaluation, and uses these statistics to decide which branches of the tree to visit.
40
+
41
+ MCTS proceeds by running a number of simulations. Each simulation traverses the tree, selecting the most promising child according to the statistics, until a leaf node is reached. The leaf node is then evaluated using a rollout or value-network (Silver et al., 2016). This value is then propagated during a back-up phase that updates statistics of the tree along the traversed path, tracking the visit counts $N ( s )$ , $N ( s , a )$ and mean evaluation $Q ( s , a )$ following from each state $s$ and action $a$ . Search proceeds in an anytime fashion: the statistics gradually become more accurate, and simulations focus on increasingly promising regions of the tree.
42
+
43
+ We now describe a value-network MCTS in more detail. Each simulation from the root state $s _ { A }$ is composed of four stages:
44
+
45
+ Algorithm 1: Value-Network Monte-Carlo Tree Search
46
+
47
+ 1. Initialize simulation time $t = 0$ and current node $s _ { 0 } = s _ { A }$ .
48
+
49
+ 2. Forward simulation from root state. Do until we reach a leaf node $( N ( s _ { t } ) = 0 )$ ):
50
+
51
+ (a) Sample action $a _ { t }$ based on simulation policy, $a _ { t } \sim \tau ( a | s _ { t } , \{ N ( s _ { t } ) , N ( s _ { t } , a ) , Q ( s _ { t } , a ) \} ; \theta _ { s } )$ , (b) the reward $r _ { t } = r ( s _ { t } , a _ { t } )$ and next state $s _ { t + 1 } = T ( s _ { t } , a _ { t } )$ are computed (c) Increment $t$ .
52
+
53
+ 3. Evaluate leaf node $s _ { L }$ found at depth $L$ .
54
+
55
+ (a) Obtain value estimate $V ( s _ { L } )$ , (b) Set $N ( s _ { L } ) = 1$ .
56
+
57
+ 4. Back-up phase from leaf node $s _ { L }$ , for each $t < L$ (a) Set $( s , a ) = ( s _ { t } , a _ { t } )$ . (b) Update $Q ( s , a )$ towards the Monte-Carlo return:
58
+
59
+ $$
60
+ Q ( s , a ) Q ( s , a ) + \frac { 1 } { N ( s , a ) + 1 } ( \sum _ { t ^ { \prime } = t } ^ { L - 1 } \gamma ^ { t ^ { \prime } - t } r _ { t ^ { \prime } } + \gamma ^ { L - t } V ( s _ { L } ) - Q ( s , a ) )
61
+ $$
62
+
63
+ (c) Update visit counts $N ( s )$ and $N ( s , a )$ : $N ( s ) N ( s ) + 1 , N ( s , a ) N ( s , a ) + 1$
64
+
65
+ When the search completes, it selects the action at the root with the most visit counts. The simulation policy $\pi$ is chosen to trade-off exploration and exploitation in the tree. In the UCT variant of MCTS (Kocsis & Szepesvári, 2006), $\pi$ is inspired by the UCB bandit algorithm (Auer, 2002).1
66
+
67
+ # 3.2 MCTSNET: SEARCH ALGORITHM
68
+
69
+ We now present MCTSnet as a generalisation of MCTS in which the statistics being tracked by the search algorithm, the backup update, and the expansion policy, are all learned from data.
70
+
71
+ MCTSnet proceeds by executing simulations that start from the root state $s _ { A }$ . When a simulation reaches a leaf node, that node is expanded and evaluated to produce a value and/or other statistics. The back-up phase then updates statistics in each node traversed during the simulation. Specifically, the parent node statistics are updated to new values that depend on the child values and also on their previous values. Finally, the selected action is chosen according to the statistics at the root of the search tree.
72
+
73
+ Different sub-networks are responsible for each of the components of the search described in the previous paragraph. Internally, these sub-networks manipulate the memory statistics $h$ at each node of the tree, which now have a vector representation, $h \in \mathbb { R } ^ { n }$ . An embedding network $h \epsilon ( s ; \theta _ { e } )$ evaluates the state $s$ and computes initial ’raw’ statistics. A simulation policy $a \sim \pi ( \cdot | h ; \theta _ { s } )$ is used to select actions during each simulation, based on statistics $h$ . A backup network $h _ { \mathrm { p a r e n t } } $ $\beta ( h _ { \mathrm { p a r e n t } } , h _ { \mathrm { c h i l d } } ; \theta _ { b } )$ updates and propagates the statistics up the search tree. Finally, an overall decision (or evaluation) is made by a readout network $a \gets \rho ( h _ { s _ { A } } ; \theta _ { r } )$ .
74
+
75
+ An algorithmic description of the search network follows in Algorithm 2: 2
76
+
77
+ # Algorithm 2: MCTSnet
78
+
79
+ For $m = 1 \ldots M$ , do simulation:
80
+
81
+ 1. Initialize simulation time $t = 0$ and current node $s _ { 0 } = s _ { A }$
82
+
83
+ 2. Forward simulation from root state. Do until we reach a leaf node $( N ( s _ { t } ) = 0 )$ :
84
+
85
+ (a) Sample action $a _ { t }$ based on simulation policy, $a _ { t } \sim \pi ( a | h _ { s _ { t } } ; \theta _ { s } )$ , (b) the reward $r _ { t } = r ( s _ { t } , a _ { t } )$ and next state $s _ { t + 1 } = T ( s _ { t } , a _ { t } )$ are computed (c) Increment $t$ .
86
+
87
+ 3. Evaluate leaf node $s _ { L }$ found at depth $L$ .
88
+
89
+ (a) Initialize node statistics using the embedding network: $h _ { s _ { L } } \epsilon ( s _ { L } ; \theta _ { e } )$
90
+
91
+ 4. Back-up phase from leaf node $s _ { L }$ , for each $t < L$
92
+
93
+ (a) Using the backup network $\beta$ , update the node statistic as a function of its previous statistics and the statistic of its child:
94
+
95
+ $$
96
+ h _ { s _ { t } } \gets \beta ( h _ { s _ { t } } , h _ { s _ { t + 1 } } , r _ { t } , a _ { t } ; \theta _ { b } )
97
+ $$
98
+
99
+ After $M$ simulations, readout network outputs a (real) action distribution from the root memory, $\rho ( h _ { s _ { A } } ; \theta _ { r } )$ .
100
+
101
+ # 3.3 MCTSNET: NEURAL NETWORK ARCHITECTURE
102
+
103
+ We now present MCTSnet as a neural network architecture. The algorithm described above effectively defines a form of tree-structured memory: each node $s _ { k }$ of the tree maintains its own corresponding statistics $h _ { k }$ . The statistics are initialized by the embedding network, but otherwise kept constant until the next time the node is visited. They are then updated using the backup network. For a fixed tree expansion, this allows us to see MCTSnet as a deep residual network with numerous skip connections, as well as a large number of inputs - all corresponding to different potential future states of the environment (these inputs actually are images of the actual input $s _ { A }$ through applications of the transition operator T). We describe MCTSnet again following this different viewpoint in this section.
104
+
105
+ It is useful to introduce an index for the simulation count $m$ , so that the tree memory after simulation $m$ is the set of ${ h _ { s } ^ { m } }$ for all tree nodes $s$ . Conditioned on a tree path $p ^ { m + 1 } = s _ { 0 } , a _ { 0 } , \dot { s } _ { 1 } , a _ { 1 } , \cdots , s _ { L }$ for simulation $m + 1$ , the MCTSnet memory gets updated as follows:
106
+
107
+ 1. For $t = L$ :
108
+
109
+ $$
110
+ h _ { s _ { L } } ^ { m + 1 } \gets \epsilon ( s _ { L } )
111
+ $$
112
+
113
+ 2. For $t < L$ :
114
+
115
+ $$
116
+ h _ { s _ { t } } ^ { m + 1 } \gets \beta ( h _ { s _ { t } } ^ { m } , h _ { s _ { t + 1 } } ^ { m + 1 } , r ( s _ { t } , a _ { t } ) , a _ { t } ; \theta _ { b } )
117
+ $$
118
+
119
+ 3. For all other $s$
120
+
121
+ $$
122
+ h _ { s } ^ { m + 1 } h _ { s } ^ { m } \qquad \mathrm { ( s i m u l a t i o n ~ } m + 1 \mathrm { ~ i s ~ s k i p p e d ) }
123
+ $$
124
+
125
+ The tree path that gates this memory update is sampled as:
126
+
127
+ $$
128
+ \boldsymbol { p } ^ { m + 1 } \sim P ( s _ { 0 } \boldsymbol { a } _ { 0 } \cdot \cdot \cdot \boldsymbol { s } _ { L } | \boldsymbol { h } ^ { m } ) \propto \prod _ { t = 0 } ^ { L - 1 } \pi ( \boldsymbol { a } _ { t } | h _ { s _ { t } } ^ { m } ; \boldsymbol { \theta } _ { s } ) \mathbb { 1 } [ s _ { t + 1 } = T ( s _ { t } , \boldsymbol { a } _ { t } ) ] ,
129
+ $$
130
+
131
+ where $L$ is a random stopping time for the tree path defined by $( N ^ { m } ( s _ { L - 1 } ) > 0 , N ^ { m } ( s _ { L } ) = 0 )$ ). An illustration of this update process is provided in Fig. 1. Note that the computation flow of the MCTS network is not defined by the final tree, but by the order in which nodes are visited (the tree expansion). Furthermore, as defined, MCTSnet is a feed-forward network with single input (the initial state) and single output (the action probabilities). However, thanks to the tree-structured memory, MCTSnet naturally allows for partial replanning, in a fashion similar to MCTS. Assume that from root-state $s _ { A }$ , the MCTS network chooses action $a$ , and transitions (in the real environment) to new state $s _ { A } ^ { \prime }$ . We can initialize the MCTS network for $s _ { A } ^ { \prime }$ as the subtree rooted in $s _ { A } ^ { \prime }$ , and initialize node statistics of the subtree to their previously computed values.
132
+
133
+ ![](images/59437d290723332352361947dc9cb7f775f0ac4b788afa45c9fa0418542b2cb3.jpg)
134
+ Figure 1: This diagram shows an execution of a search with $M = 4$ . (Top) The evolution of the search tree rooted at $s _ { 0 }$ after each simulation, with the last simulation path highlighted in red. (Bottom) The computation graph in MCTSnet resulting from these simulations. Black arrows represent the application of the embedding network $\epsilon ( s )$ to initialize $h$ at tree node s. Red arrows represent the forward tree traversal during a simulation using the simulation policy (based on last memory state) and the environment model until a leaf node is reached. Blue arrows correspond to the backup network $\beta$ , which updates the memory statistics $h$ along the traversed simulation path based on the child statistic and the last updated parent memory (in addition to transition information such as reward). The diagram makes it clear that this backup mechanism can skip over simulations where a particular node was not visited. For example, the fourth simulation updates $h _ { B }$ based on $h _ { B }$ from the second simulation, since $s _ { B }$ was not visited during the third simulation. Finally, the readout network $\rho$ , in green, outputs the action distribution based on the last root memory $h _ { A }$ . An expanded view of simulations is available in the appendix.
135
+
136
+ # 3.4 DESIGN CHOICES
137
+
138
+ We now provide design details for each sub-network in MCTSnet.
139
+
140
+ Backup $\beta$ The backup network contains a gated residual connection, allowing it to selectively ignore information originating from a node’s subtree. It updates $h _ { S }$ as follows:
141
+
142
+ $$
143
+ \beta ( \phi ; \theta _ { b } ) = h _ { s } + g ( \phi ; \theta _ { b } ) f ( \phi ; \theta _ { b } ) ,
144
+ $$
145
+
146
+ where $\phi = ( h _ { s } , h _ { s ^ { \prime } } , r , a )$ and where $g$ is a learned gating function with range $[ 0 , 1 ]$ and $f$ is the learned update function. We justify this architecture in Sec. 4.2, by comparing it to a simpler MLP which maps $\phi$ to the updated value of $h _ { s }$ .
147
+
148
+ Learned simulation policy $\pi$ In its basic, unstructured form, the simulation policy network is a simple MLP $k$ mapping the statistics $h _ { s }$ to the logits $\psi ( s , a )$ , which define $\pi ( a | s ; \bar { \theta } _ { s } ) \overset { \cdot } { \propto } \exp ( \psi ( s , a ) )$ .
149
+
150
+ We consider adding structure by modulating each logit with side-information corresponding to each action. One form of action-specific information is obtained from the child statistic $h _ { T ( s , a ) }$ Another form of information comes from a learned policy prior $\mu$ over actions, with log-probabilities $\psi ( s , a ; \theta _ { p } ) = \log \mu ( s , a ; \theta _ { p } )$ ; as in PUCT (Rosin, 2011). In our case, the policy prior comes from learning a small, model-free residual network on the same data. Combined, we obtain the following modulated network version for the simulation policy logits:
151
+
152
+ $$
153
+ \psi ( s , a ) = w _ { 0 } \psi _ { p } ( s , a ) + w _ { 1 } u \left( k ( h _ { s } ) , h _ { T ( s , a ) } \right) .
154
+ $$
155
+
156
+ embedding $\epsilon$ and readout network $\rho$ The embedding network is a standard residual convolution network. The readout network, $\rho$ , is a simple MLP that transforms a memory vector at the root into the required output format, in this case an action distribution. See appendix for details.
157
+
158
+ # 3.5 TRAINING MCTSNET
159
+
160
+ The readout network of MCTSnet ultimately outputs an overall decision or evaluation from the entire search. This final output may in principle be trained according to any loss function, such as by value-based or policy gradient reinforcement learning.
161
+
162
+ However, in order to focus on the novel aspects of our architecture, we choose to investigate the MCTSnet architecture in a supervised learning setup in which labels are first generated according to a standard, high-quality MCTS, and then an MCTSnet is trained to predict those labels, but using far fewer simulations.
163
+
164
+ Specifically, in our experiments, we first use MCTS, using a value network but no policy prior (Silver et al., 2017a) to generate good quality trajectories. For each real state $s$ encountered in a trajectory, we record the action $a ^ { * }$ the MCTS algorithm ended up taking, to create a dataset of state-action pairs $( s , a ^ { * } )$ . Our objective is to then train MCTSnet to predict the action $a ^ { * }$ from state $s$ . We note that, if this process was iterated, it would be similar to prior policy iteration schemes (Silver et al., 2017a; Anthony et al., 2017).
165
+
166
+ We denote $z _ { m }$ the set of actions sampled stochastically during the $m ^ { \mathrm { t h } }$ simulation; $z _ { \leq m }$ the set of all stochastic actions taken up to simulation $m$ , and $\mathbf { z } = z _ { \leq M }$ the set of all stochastic actions. The number of simulations $M$ is either chosen to be fixed, or taken from a stochastic distribution $p _ { M }$ .
167
+
168
+ After performing the desired number of simulations, the network output is the action probability vector $p _ { \theta } ( a | s , \mathbf { z } )$ . It is a random function of the state $s$ due to the stochastic actions $\mathbf { z }$ . We choose to optimize $p _ { \theta } ( a | s , \mathbf { z } )$ so that the prediction is on average correct, by minimizing the average cross entropy between the prediction and the correct label $a ^ { * }$ . For a pair $( s , a ^ { * } )$ , the loss is:
169
+
170
+ $$
171
+ \begin{array} { r } { \ell ( s , a ^ { * } ) = \operatorname { \mathbb { E } } _ { \mathbf { z } \sim \pi ( \mathbf { z } \mid \mathbf { s } ) } \left[ - \log p _ { \theta } ( a ^ { * } \mid s , \mathbf { z } ) \right] . } \end{array}
172
+ $$
173
+
174
+ This can also be interpreted as a lower-bound on the log-likelihood of the marginal distribution $p _ { \theta } ( a | s ) = \mathbb { E } _ { z \sim \pi ( \mathbf { z } | \mathbf { s } ) } \left( p _ { \theta } ( a | \mathbf { z } , s ) \right)$ .
175
+
176
+ We minimize $l ( s , a ^ { * } )$ by computing a single sample estimate of its gradient (Schulman et al., 2015):
177
+
178
+ $$
179
+ \begin{array} { r } { \nabla _ { \theta } \ell ( s , a ^ { * } ) = - \mathbb { E } _ { z } \left[ \nabla _ { \theta } \log p _ { \theta } ( a ^ { * } | s , \mathbf { z } ) + ( \nabla _ { \theta } \log \pi ( \mathbf { z } | s ; \theta _ { s } ) ) \log p _ { \theta } ( a ^ { * } | s , \mathbf { z } ) \right] . } \end{array}
180
+ $$
181
+
182
+ The first term of the gradient corresponds to the differentiable path of the network as described in section. The second term corresponds to the gradient with respect to the simulation distribution, and uses the REINFORCE or score-function method. In this term, the final log likelihood $\log p _ { \theta } ( a ^ { * } | s , \mathbf { z } )$ plays the role of a ‘reward’ signal: in effect, the quality of the search is determined by the confidence in the correct label (as measured by its log-likelihood); the higher that confidence, the better the tree expansion, and the more the stochastic actions $\mathbf { z }$ that induced that tree expansion will be reinforced. In addition, we follow the common method of adding a neg-entropy regularization term on $\pi ( a | s ; \theta _ { s } )$ to the loss, to prevent premature convergence.
183
+
184
+ # 3.6 A CREDIT ASSIGNMENT TECHNIQUE FOR ANYTIME ALGORITHMS
185
+
186
+ Although it is unbiased, the REINFORCE gradient above has very high variance; this is due to the difficulty of credit assignment in this problem: the number of decisions that contribute to a single decision $a ^ { * }$ is large (between $O ( M \log M )$ and $O ( M ^ { 2 } )$ for $M$ simulations), and understanding how each decision contributed led to a low error through a better tree expansion structure is very intricate.
187
+
188
+ In order to address this issue, we design a novel credit assignment technique for anytime algorithms, by casting the loss minimization for a single example as a sequential decision problem, and using reinforcement learning technique to come up with a family of estimators, allowing us to manipulate the bias-variance trade-off.
189
+
190
+ Consider a general anytime algorithm which, given an initial state $s$ , can run for an arbitrary number of internal steps $M$ — in MCTSnet, these are simulations. For each step $m = 1 \ldots M$ , any number of stochastic decisions (collectively denoted $z _ { m }$ ) may be taken, and at the end of each step, a candidate output distribution $p _ { \theta } ( a | s , z _ { \leq m } )$ may be evaluated against a loss function $\ell$ . The value of the loss at the end of step $m$ is denoted $\ell _ { m } \triangleq \ell ( p _ { \theta } ( a | s , z _ { \leq m } ) )$ . We assume the objective is to maximize the terminal negative loss $- \ell _ { M }$ . Letting $\ell _ { 0 } = 0$ , we rewrite the terminal loss as a telescoping sum:
191
+
192
+ $$
193
+ - \ell _ { M } = - ( \ell _ { M } - \ell _ { 0 } ) = \sum _ { m = 1 \ldots M } - ( \ell _ { m } - \ell _ { m - 1 } ) = \sum _ { m = 1 \ldots M } \bar { r } _ { m } ,
194
+ $$
195
+
196
+ where we define the reward $\bar { r } _ { m }$ as the decrease in loss $- ( \ell _ { m } - \ell _ { m - 1 } )$ obtained during the $m ^ { \mathrm { t h } }$ step. We then define the return $\begin{array} { r } { R _ { m } = \sum _ { m ^ { \prime } \geq m } \bar { r } _ { m ^ { \prime } } } \end{array}$ as the sum of future rewards from step $m$ ; by definition we have $R _ { 1 } = - \ell _ { M }$ .
197
+
198
+ The REINFORCE term of equation (8) can be rewritten:
199
+
200
+ $$
201
+ - \nabla _ { \boldsymbol { \theta } } \log \pi ( \mathbf { z } | s ; \boldsymbol { \theta } _ { s } ) \log p _ { \boldsymbol { \theta } } ( a ^ { * } | s , \mathbf { z } ) = \sum _ { m } \nabla _ { \boldsymbol { \theta } } \log \pi ( z _ { m } | s ; \boldsymbol { \theta } _ { s } ) R _ { 1 } .
202
+ $$
203
+
204
+ Since stochastic variables in $z _ { m }$ can only affect future rewards $r _ { m } ^ { \prime } , m ^ { \prime } \geq m$ , it follows from a classical policy gradient argument that (9) is, in expectation, also equal to:
205
+
206
+ $$
207
+ \sum _ { m } \nabla _ { \theta } \log \pi ( z _ { m } | s , z _ { < m } ; \theta _ { s } ) R _ { m } = - \sum _ { m } \nabla _ { \theta } \log \pi ( z _ { m } | s , z _ { < m } ; \theta _ { s } ) ( \ell _ { M } - \ell _ { m - 1 } ) .
208
+ $$
209
+
210
+ In other words, the stochastic decisions from step $m$ do not simply use the terminal loss as reinforcement signal, but rather the difference between the terminal loss, and the loss computed before step $m$ started (the baseline). This estimate is still unbiased, but has lower variance, especially for the later steps of algorithm. Next, we trade off bias and variance by introducing a discount term $\gamma$ . In essence, for simulation choices $z _ { m }$ , we choose to reward short term improvements more than later ones, since the relation between simulation $m$ and later improvements is harder to ascertain and likely to mostly appear as noise. Letting $\begin{array} { r } { R _ { m } ^ { \gamma } = \sum _ { m ^ { \prime } \geq m } \gamma ^ { m ^ { \prime } - m } r _ { m ^ { \prime } } } \end{array}$ , our final gradient estimate of the MCTSnet loss becomes:
211
+
212
+ $$
213
+ \nabla _ { \theta } l ( s , a ^ { * } ) = \mathbb { E } _ { z } \left[ - \nabla _ { \theta } \log p _ { \theta } ( a ^ { * } | x , z ) + \sum _ { m } \nabla _ { \theta } \log \pi ( z _ { m } | s ; \theta _ { s } ) R _ { m } ^ { \gamma } \right] ,
214
+ $$
215
+
216
+ $R _ { m } ^ { \gamma }$ can be rewritten as the average of future baselined losses $l _ { m + t } - l _ { m - 1 }$ , where $t$ follows a truncated geometric distribution with parameter $\gamma$ and maximum value $M - m$ . Letting $\gamma = 0$ leads to a greedy behavior, where actions of simulation $m$ are only chosen as to maximize the immediate improvement in loss $- ( \ell _ { m } - \ell _ { m - 1 } )$ . This myopic mode is linked to the single-step assumption proposed by Russell & Wefald (1989) in an analog context.
217
+
218
+ # 4 EXPERIMENTS
219
+
220
+ We investigate our architecture in the game of Sokoban, a classic, challenging puzzle game (Botea et al., 2003). As described above, our results are obtained in a supervised training regime. However, we continuously evaluate our network during training by running it as an agent in random Sokoban levels and report its success ratio in solving the levels. Throughout this experimental section, we keep the architecture and size of both embedding and readout network fixed, as detailed in the appendix.
221
+
222
+ # 4.1 MAIN RESULTS
223
+
224
+ ![](images/877f788cdb534b3cc1ba019e87cb2f2c87a32f400103257515a50bf146ebb7cd.jpg)
225
+ Figure 2: Evolution of success ratio in Sokoban during training using a continuous evaluator. MCTSnet (with $M = 2 5$ ) against two model-free copy-model baselines. In one case $M = 2$ ), the copy-model has access to the same number of parameters and the same subnetworks. When $M = 2 5$ , the baseline also matches the amount of computation. We also provide performance of MCTS with UCT with variable number of simulations.
226
+
227
+ We first compare our MCTSnet architecture with $M = 2 5$ simulations to a couple of model-free baselines. To assess whether the MCTSnet leverages the information contained in the simulations (from transition model $T$ and reward function $r$ ), we consider a version of the network that uses a sham environment model where
228
+
229
+ $T ( s , a ) = s$ and $r ( s , a ) = 0$ , but otherwise has identical architecture. For the case $M = 2$ , the baseline has the same number of parameters as MCTSnet, and uses each subnetwork exactly once. We also test this architecture for the case $M = 2 5$ , in which case the model-free baseline has the same number of parameters and can perform the same amount of computation but does not have access to the environment model — it is effectively model-free. We also evaluate a standard model-based method (without learning) in the same environment: MCTS with a pre-learned value function (see appendix for details). When given access to 25 simulations per step, same as MCTSnet, we observe $\approx 3 0 \%$ success ratio for MCTS in Sokoban. It requires 20 more times simulations for this version of MCTS to reach the level of performance of MCTSnet.
230
+
231
+ Overall, MCTSnet performs favorably against both model-based and model-free baselines, see Fig. 2. These comparisons validate two ingredients of our approach. First, the comparison of MCTSnet to its model-free variant confirms that it extracts information contained in states visited (and rewards obtained) during the search - in section 4.3 we show that it is also able to learn nontrivial search policies. Second, at test time, MCTSnet and MCTS both use the same environment model, and therefore have in principle access to the same information. The higher performance of MCTSnet demonstrates the benefits of learning and propagating vector-valued statistics which are richer and more informative than those tracked by MCTS.
232
+
233
+ Using the architecture detailed in Sec. 3.4 and 25 simulations, MCTSnets reach $8 4 \pm 1 \%$ of levels solved3 — close to the $8 7 \%$ obtained in (Weber et al., 2017), although in a different setting (supervised vs reinforcement learning, 1e8 vs. 1e9 environment steps). We now consider more detailed comparisons to justify and understand our different design choices for MCTSnet.
234
+
235
+ # 4.2 LEARNED STATISTICS AND HOW TO PERFORM BACKUPS
236
+
237
+ In this section, we justify the backup network choice made in Sec. 3.4, by comparing the simple MLP version to the gated residual architecture we suggested. We find the gated residual architecture for the backup network to be advantageous both in terms of stability and accuracy. As Fig. 3 illustrates, with $M = 1 0$ simulations, the gated residual version systematically achieves better performance. For larger number of simulations $M > 2 5$ ), we found the non-residual backup network to be simply numerically unstable.
238
+
239
+ ![](images/21dcded222e16cd16fe222360651e6b2b0f57fa6577c800102941fdf3dc68e5b.jpg)
240
+ Figure 3: a) Comparison of backup network architectures. b) Typical evolution of the average gate value in the gated residual backup network. Initially, the gate prefers to minimize the influence of the memory update, it later gradually increases to take into account information from the subtree.
241
+
242
+ This can be explained by a large number of updates being recurrently applied, which can cause divergence when the network has arbitrary form. Instead, the gated network can quickly reduce the influence of the update coming from the subtree, and then slowly depart from the identity skipconnection; typical dynamics for the gate are displayed in Fig. 3-b, which showcases this behavior. For all other experiments, we therefore employed the gated residual backup network in MCTSnet.
243
+
244
+ # 4.3 LEARNING THE SIMULATION POLICY
245
+
246
+ As previously mentioned, learning the simulation policy is challenging because of the noisy estimation of the pseudo-return for the selected sequence z. We investigate the effectiveness of our proposed designs for $\pi$ (see Sec. 3.4) and of our proposed approximate credit assignment scheme for learning its parameters (see Sec. 3.6).
247
+
248
+ Basic setting Despite the estimation issues, we verified that we can nevertheless lift $\pi$ , in its simple form, above the performance of a MCTSnet using a uniform random simulation policy. Note that MCTSnet with a random simulation strategy already performs reasonably since it can still take advantage of the learned statistics, backups, and readout. See blue and red curves in Fig. 4a for a comparison.
249
+
250
+ ![](images/612e92c6fd9a88402b36bdf578df26cfa6edb6a811fb9bf8df0f2075abfbcc18.jpg)
251
+ Figure 4: a) Comparison of different simulation policy strategies in MCTSnet with $M = 2 5$ simulations. b) Effect of different values of $\gamma$ in our approximate credit assignment scheme.
252
+
253
+ Improved credit assignment technique The vanilla gradient in Eq. (8) is enough to learn a simulation policy $\pi$ that performs better than a random search strategy, but it is still hampered by the noisy estimation process of the simulation policy gradient. A more effective search strategy can be learned using our proposed credit assignment scheme in Sec. 3.6 and the modulated policy architecture in Sec. 3.4. To show this, we train MCTSnets for different values of the discount $\gamma$ using the modulated policy architecture. The results in Fig. 4b demonstrate that the value of $\gamma = 1$ , for which the network is optimizing the true loss, is not the ideal choice in MCTSnet. Lower values of $\gamma$ perform better at different stages of training. In late training, when the estimation problem is more stationary, the advantage of $\gamma < 1$ reduces but remains. The best performing MCTSnet architecture is shown in comparison to others in Fig. 4a. We also investigated whether simply providing the policy prior term in Eq. 6 (i.e., setting $w _ { 1 } = 0$ ) could match these results. With the policy prior learned with the right entropy regularization, this is indeed a well-performing simulation policy for MCTSnet with 25 simulations, but it did not match our best performing learned policy.
254
+
255
+ # 4.4 SCALABILITY WITH NUMBER OF SIMULATIONS
256
+
257
+ Thanks to weight sharing, MCTSnets can in principle be run for an arbitrary number of simulations $M \geq 1$ . With larger number of simulations, the search has progressively more opportunities to query the environment model. To check whether our search network could take advantage of this during training, we compare MCTSnet for different number of simulations $M$ , applied during both training and evaluation. In Fig. 5, we find that our approach was able to query and extract relevant information with additional simulations, generally achieving better results with less training steps.
258
+
259
+ ![](images/b1c6628f5fe90490ae687ac2f67c955d1648b200370fe2b0d993d301ac7b5ab6.jpg)
260
+ Figure 5: Performance of MCTSnets trained with different number of simulations $M$ (nsims). Generally, larger searches achieve better results with less training steps.
261
+
262
+ # 5 DISCUSSION
263
+
264
+ cessful search algorithms by framing them as a dynamic computational graph that can be optimized with gradient-based methods. This may be viewed as a first step towards a long-standing AI ambition: meta-reasoning about the internal processing of the agent. In particular, we proposed a neural version of the MCTS algorithm. The aim was to maintain the desirable properties of MCTS while allowing some flexibility to improve on the choice of nodes to expand, the statistics to store in memory, and the way in which they are propagated, all using gradient-based learning. A more pronounced departure from existing search algorithms could also be considered, although this may come at the expense of a harder optimization problem. We have also assumed that the true environment is available as a simulator, but this could also be relaxed: a model of the environment could be learned separately (Weber et al., 2017), or even end-to-end (Silver et al., 2017b). One advantage of this approach is that the search algorithm could learn how to make use of an imperfect model. Although we have focused on a supervised learning setup, our approach could easily be extended to a reinforcement learning setup by leveraging policy iteration with MCTS (Silver et al., 2017a; Anthony et al., 2017). We have focused on small searches, more similar in scale to the plans that are processed by the human brain (Arbib, 2003), than to the massive-scale searches in high-performance games or planning applications. In fact, our learned search performed better than a standard MCTS with more than an order-of-magnitude more computation, suggesting that neural approaches to search may ultimately replace their handcrafted counterparts.
265
+
266
+ # REFERENCES
267
+
268
+ Thomas Anthony, Zheng Tian, and David Barber. Thinking fast and slow with deep learning and tree search. arXiv preprint arXiv:1705.08439, 2017.
269
+
270
+ Michael A Arbib. The handbook of brain theory and neural networks. MIT press, 2003.
271
+
272
+ Peter Auer. Using confidence bounds for exploitation-exploration trade-offs. Journal of Machine Learning Research, 3(Nov):397–422, 2002.
273
+
274
+ Jonathan Baxter, Andrew Tridgell, and Lex Weaver. Knightcap: A chess program that learns by combining td $( \lambda )$ with game-tree search. In Proceedings of the 15th International Conference on Machine Learning, 1998.
275
+
276
+ Adi Botea, Martin Müller, and Jonathan Schaeffer. Using abstraction for planning in sokoban. In Computers and Games, volume 2883, pp. 360, 2003.
277
+
278
+ Kai-Wei Chang, Akshay Krishnamurthy, Alekh Agarwal, Hal Daume, and John Langford. Learning to search better than your teacher. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 2058–2066, 2015.
279
+
280
+ Rémi Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In International conference on computers and games, pp. 72–83. Springer, 2006.
281
+
282
+ Nicholas Hay and Stuart J. Russell. Metareasoning for monte carlo tree search. Technical Report UCB/EECS-2011-119, EECS Department, University of California, Berkeley, 2011.
283
+
284
+ Michael Jünger, Thomas M Liebling, Denis Naddef, George L Nemhauser, William R Pulleyblank, Gerhard Reinelt, Giovanni Rinaldi, and Laurence A Wolsey. 50 years of integer programming 1958-2008: From the early years to the state-of-the-art. Springer Science & Business Media, 2009.
285
+
286
+ Donald E Knuth and Ronald W Moore. An analysis of alpha-beta pruning. Artificial intelligence, 6 (4):293–326, 1975.
287
+
288
+ Levente Kocsis and Csaba Szepesvári. Bandit based monte-carlo planning. In ECML, volume 6, pp. 282–293. Springer, 2006.
289
+
290
+ Levente Kocsis, Csaba Szepesvári, and Mark HM Winands. Rspsa: enhanced parameter optimization in games. In Advances in Computer Games, pp. 39–56. Springer, 2005.
291
+
292
+ Razvan Pascanu, Yujia Li, Oriol Vinyals, Nicolas Heess, Lars Buesing, Sebastien Racanière, David Reichert, Théophane Weber, Daan Wierstra, and Peter Battaglia. Learning model-based planning from scratch. arXiv preprint arXiv:1707.06170, 2017.
293
+
294
+ Christopher D Rosin. Multi-armed bandits with episode context. Annals of Mathematics and Artificial Intelligence, 61(3):203–230, 2011.
295
+
296
+ Stuart Russell. Rationality and intelligence. In Proceedings of the 14th international joint conference on Artificial intelligence-Volume 1, pp. 950–957. Morgan Kaufmann Publishers Inc., 1995.
297
+
298
+ Stuart Russell and Eric Wefald. On optimal game-tree search using rational meta-reasoning. In Proceedings of the 11th international joint conference on Artificial intelligence-Volume 1, pp. 334–340, 1989.
299
+
300
+ AL Samuel. Some studies in machine learning using the game of checkers. IBM Journal of Research and Development, 3(3):210, 1959.
301
+
302
+ Jonathan Schaeffer. The games computers (and people) play. Advances in computers, 52:189–266, 2000.
303
+
304
+ Jonathan Schaeffer, Markian Hlynka, and Vili Jussila. Temporal difference learning applied to a high-performance game-playing program. In Proceedings of the 17th international joint conference on Artificial intelligence-Volume 1, pp. 529–534. Morgan Kaufmann Publishers Inc., 2001.
305
+
306
+ John Schulman, Nicolas Heess, Theophane Weber, and Pieter Abbeel. Gradient estimation using stochastic computation graphs. In Advances in Neural Information Processing Systems, pp. 3528– 3536, 2015.
307
+
308
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
309
+
310
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, et al. Mastering the game of go without human knowledge. Nature, 550:354–359, 2017a.
311
+
312
+ David Silver, Hado van Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel Dulac-Arnold, David Reichert, Neil Rabinowitz, Andre Barreto, et al. The predictron: End-to-end learning and planning. In ICML, 2017b.
313
+
314
+ G. Tesauro. TD-gammon, a self-teaching backgammon program, achieves master-level play. Neural Computation, 6:215–219, 1994.
315
+
316
+ Gerald Tesauro. Connectionist learning of expert preferences by comparison training. In Advances in Neural Information Processing, pp. 99–106, 1988.
317
+
318
+ J. Veness, D. Silver, A. Blair, and W. Uther. Bootstrapping from game tree search. In Advances in Neural Information Processing Systems, pp. 1937–1945, 2009.
319
+
320
+ Théophane Weber, Sébastien Racanière, David P Reichert, Lars Buesing, Arthur Guez, Danilo Jimenez Rezende, Adria Puigdomènech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, et al. Imagination-augmented agents for deep reinforcement learning. arXiv preprint arXiv:1707.06203, 2017.
321
+
322
+ ![](images/38f5911ac1dabdb1306226e3d62242bace2d3f617c79fbe92fdd7084931c1103.jpg)
323
+ Figure 6: This diagram represents three simulations in MCTSnet that visit the tree node marked $\mathbf { x }$ . The leftmost simulation shows the first simulation $m$ during search to visit node $\mathbf { x }$ — when the memory statistic $h _ { \mathbf { x } } ^ { m }$ is initialized by the embedding network. The middle simulation is the second simulation to traverse $\mathbf { x }$ , which may not immediately follow the leftmost simulation. The rightmost simulation is the third simulation to traverse $\mathbf { x }$ ; it is also the final simulation overall, the readout network is employed to output the action distribution from the root memory statistic. This view showcases the skip-connection across simulation times to update the memory vectors. A diagram for a search with only two simulations is presented below.
324
+
325
+ ![](images/2a52ecc3ef4234ce76dfe0559269838eaced495430fe52c111b1e3aa76bcbc69.jpg)
326
+ Figure 7: Diagram illustrating a MCTSnet search with exactly two simulations, using the same color codes for subnetworks as in Fig. 6.
327
+
328
+ # B ARCHITECTURAL CHOICES AND EXPERIMENTAL SETUP
329
+
330
+ For the Sokoban domain, we use $1 0 \times 1 0$ map layout with four boxes and targets. For level generation, we gained access to the level generator described by Weber et al. (2017). We directly provide a symbolic representation of the environment, coded as $1 0 \times 1 0 \times 4$ feature map (with one feature map per type of object: wall, agent, box, target), see Fig. 7 for a visual representation. The training dataset consists of 250000 trajectories of distinct levels; approximately $9 2 \%$ of those levels are solved by the agent; solved levels take on average 60 steps, while unsolved levels are interrupted after 100 steps. We also create a testing set with 2500 trajectories.
331
+
332
+ ![](images/a667821bbc2c8cbc92e56b527ed44842ddd0a090c330922640ee0f7d524b6685.jpg)
333
+ Figure 8: The different elements composing a Sokoban frame.
334
+
335
+ For MCTS (UCT variant), we use a pre-trained value network for leaf evaluation, depth-wise transposition tables to deal with symmetries, and we reuse the relevant search subtree after each real step.
336
+
337
+ # B.1 NETWORK ARCHITECTURE DETAILS
338
+
339
+ Our embedding network $\epsilon$ is a convolution network with 3 residual blocks. Each residual block is composed of two 64-channel convolution layers with $3 { \tt X } 3$ kernels applied with stride 1. The residual blocks are preceded by a convolution layer with the same properties, and followed by a convolution layer of 1x1 kernel to 32 channels. A linear layer maps the final convolutional activations into a 1D vector of size 128.
340
+
341
+ The readout network is a simple MLP with a single hidden layer of size 128. Non-linearities between all layers are ReLus. The policy prior network has a similar architecture to the embedding network, but with 2 residual blocks and 32-channel convolutions.
342
+
343
+ # B.2 TRAINING
344
+
345
+ We train MCTSnet using TensorFlow in an asynchronous distributed fashion. We use a batch of size 1, 32 workers and SGD for optimization with a learning rate of 5e-4.
md/train/r1f78iAcFm/r1f78iAcFm.md ADDED
@@ -0,0 +1,544 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRAPH TRANSFORMATION POLICY NETWORK FOR CHEMICAL REACTION PREDICTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We address a fundamental problem in chemistry known as chemical reaction product prediction. Our main insight is that the input reactant and reagent molecules can be jointly represented as a graph, and the process of generating product molecules from reactant molecules can be formulated as a sequence of graph transformations. To this end, we propose Graph Transformation Policy Network (GTPN) − a novel generic method that combines the strengths of graph neural networks and reinforcement learning to learn the reactions directly from data with minimal chemical knowledge. Compared to previous methods, GTPN has some appealing properties such as: end-to-end learning, and making no assumption about the length or the order of graph transformations. In order to guide model search through the complex discrete space of sets of bond changes effectively, we extend the standard policy gradient loss by adding useful constraints. Evaluation results show that GTPN improves the top-1 accuracy over the current state-of-the-art method by about $3 \%$ on the large USPTO dataset. Our model’s performances and prediction errors are also analyzed carefully in the paper.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Chemical reaction product prediction is a fundamental problem in organic chemistry. It paves the way for planning syntheses of new substances (Chen & Baldi, 2009). For decades, huge effort has been spent to solve this problem. However, most methods still depend on the handcrafted reaction rules (Chen & Baldi, 2009; Kayala & Baldi, 2011; Wei et al., 2016) or heuristically extracted reaction templates (Segler & Waller, 2017; Coley et al., 2017), thus are not well generalizable to unseen reactions.
12
+
13
+ A reaction can be regarded as a set (or unordered sequence) of graph transformations in which reactants represented as molecular graphs are transformed into products by modifying the bonds between some atom pairs (Jochum et al., 1980; Ugi et al., 1979). See Fig. 1 for an illustration. We call an atom pair $( u , v )$ that changes its connectivity during reaction and its new bond $b$ a reaction triple $( u , v , b )$ . The reaction product prediction problem now becomes predicting a set of reaction triples given the input reactants and reagents. We argue that in order to solve this problem well, an intelligent system should have two key capabilities: (a) Understanding the molecular graph structure of the input reactants and reagents so that it can identify possible reactivity patterns (i.e., atom pairs with changing connectivity). (b) Knowing how to choose from these reactivity patterns a correct set of reaction triples to generate the desired products.
14
+
15
+ Recent state-of-the-art methods (Jin et al., 2017; Bradshaw et al., 2018) have built the first capability by leveraging graph neural networks (Duvenaud et al., 2015; Hamilton et al., 2017; Pham et al., 2017; Gilmer et al., 2017). However, these methods are either unaware of the valid sets of reaction triples (Jin et al., 2017) or limited to sequences of reaction triples with a predefined orders (Bradshaw et al., 2018). The main challenge is that the space of all possible configurations of reaction triples is extremely large and non-differentiable. Moreover, a small change in the predicted set of reaction triples can lead to very different reaction products and a little mistake can produce invalid prediction.
16
+
17
+ In this paper, we propose a novel method called Graph Transformation Policy Network (GTPN) that addresses the aforementioned challenges. Our model consists of three main components: a graph neural network (GNN), a node pair prediction network (NPPN) and a policy network (PN). Starting from the initial graph of reactant and reagent molecules, our model iteratively alternates between modeling an input graph using GNN and predicting a reaction triple using NPPN and PN to generate a new intermediate graph as input for the next step until it decides to stop. The final generated graph is considered as the predicted products of the reaction. Importantly, GTPN does not assume any fixed number or any order of bond changes but learn these properties itself. One can view GTPN as a reinforcement learning (RL) agent that operates on a complex and non-differentiable space of sets of reaction triples. To guide our model towards learning a diverse yet robust-to-small-changes policy, we customize our loss function by adding some useful constraints to the standard policy gradient loss (Mnih et al., 2016).
18
+
19
+ ![](images/a12f14d83ce2155ad6d7941ebcf1a5e44c5921b556fe473e90e0c85202a223ba.jpg)
20
+ Figure 1: A sample reaction represented as a set of graph transformations from reactants (leftmost) to products (rightmost). Atoms are labeled with their type (Carbon, Oxygen,...) and their index (1, 2,...) in the molecular graph. The atom pairs that change connectivity and their new bonds (if existed) are highlighted in green. There are two bond changes in this case: 1) The double bond between O:1 and C:2 becomes single. 2) A new single bond between C:2 and C:10 is added.
21
+
22
+ To the best of our knowledge, GTPN is the most generic approach for the reaction product prediction problem so far in the sense that: i) It combines graph neural networks and reinforcement learning into a unified framework and trains everything end-to-end; ii) It does not use any handcrafted or heuristically extracted reaction rules/templates to predict the products. Instead, it automatically learns various types of reactions from the training data and can generalize to unseen reactions; iii) It can interpret how the products are formed via the sequence of reaction triples it generates.
23
+
24
+ We evaluate GTPN on two large public datasets named $U S P T O – I 5 k$ and USPTO. Our method significantly outperforms all baselines in the top-1 accuracy, achieving new state-of-the-art results of $8 2 . 3 9 \%$ and $8 3 . 2 0 \%$ on $U S P T O – I 5 k$ and USPTO, respectively. In addition, we also provide comprehensive analyses about the performance of GTPN and about different types of errors our model could make.
25
+
26
+ # 2 METHOD
27
+
28
+ 2.1 CHEMICAL REACTION AS MARKOV DECISION PROCESS OF GRAPH TRANSFORMATIONS
29
+
30
+ A reaction occurs when reactant molecules interact with each other in the presence (or absence) of reagent molecules to form new product molecules by breaking or adding some of their bonds. Our main insight is that reaction product prediction can be formulated as predicting a sequence of such bond changes given the reactant and reagent molecules as input. A bond change is characterized by the atom pair (where the change happens) and the new bond type (what is the change). We call this atom pair a reaction atom pair and call this atom pair with the new bond type a reaction triple.
31
+
32
+ More formally, we represent the entire system of input reactant and reagent molecules as a labeled graph $\mathcal { G } = ( \dot { \mathcal { V } } , \mathcal { E } )$ with multiple connected components, each of which corresponds to a molecule. Nodes in $\nu$ are atoms labeled with their atomic numbers and edges in $\mathcal { E }$ are bonds labeled with their bond types. Given $\mathcal { G }$ as input, we predict a sequence of reaction triples that transforms $\mathcal { G }$ into a graph of product molecules $\mathcal { G } ^ { \prime }$ .
33
+
34
+ As reactions vary in number of transformation steps, we represent the sequence of reaction triples as $( \xi , u , v , b ) ^ { 0 } , ( \dot { \xi } , u , v , b ) ^ { 1 } , . . . , ( \xi , u , v , b ) ^ { T - 1 }$ or $( \dot { \xi } , \dot { u } , v , b ) ^ { \dot { 0 } : T }$ for short. Here $T$ is the maximum number of steps, $( u , v )$ is a pair of nodes, $b$ is the new edge type of $( u , v )$ , and $\xi$ is a binary signal that indicates the end of the sequence. If the sequence ends at $\dot { T } _ { \mathrm { e n d } } < \dot { T } , \dot { \xi } ^ { 0 } , . . . \xi ^ { \dot { T } _ { \mathrm { c n d } } - 1 }$ will be 1 and $\xi ^ { T _ { \mathrm { e n d } } } , . . . , \xi ^ { T - 1 }$ will be 0. At every step $\tau$ , if $\xi ^ { \tau } = 1$ end , we apply the predicted edge change $( u , v , b ) ^ { \tau }$ on the current graph $\mathcal { G } ^ { \tau }$ to create a new intermediate graph $\mathcal { G } ^ { \tau + 1 }$ as input for the next step $\tau + 1$ . This iterative process of graph transformation can be formulated as a Markov Decision Process (MDP) characterized by a tuple $( S , { \mathcal { A } } , P , R , \gamma )$ , in which $s$ is a set of states, $\mathcal { A }$ is a set of actions, $P$ is a state transition function, $R$ is a reward function, and $\gamma$ is a discount factor. Since the process is finite and contains no loop, we set the discount factor $\gamma$ to be 1. The rest of the MDP tuple are defined as follows:
35
+
36
+ ![](images/1228c94e7af5a5048db2eb5fe16475e451da8a13e5b75b55f27945f853ca3bb0.jpg)
37
+ Figure 2: Workflow of a Graph Transformation Policy Network (GTPN). At every step of the forward pass, our model performs 7 major functions: 1) Computing the atom representation vectors, 2) Computing the most possible $K$ reaction atom pairs, 3) Predicting the continuation signal $\xi$ , 4) Predicting the reaction atom pair $( u , v )$ , 5) Predicting a new bond $b$ of this atom pair, 6) Updating the atom representation vectors, and 7) Updating the recurrent state.
38
+
39
+ • State: A state $s ^ { \tau } \in \boldsymbol { S }$ is an intermediate graph $\mathcal { G } ^ { \tau }$ generated at step $\tau$ $( 0 \leq \tau < T )$ ). When $\tau = 0$ , we denote $s ^ { 0 } = \mathcal { G } ^ { 0 } = \mathcal { G }$ .
40
+ Action: An action $a ^ { \tau } \in { \mathcal { A } }$ performed at step $\tau$ is the tuple $( \xi , u , v , b ) ^ { \tau }$ . The action is composed of three consecutive sub-actions: $\xi ^ { \tau }$ , $( u , v ) ^ { \tau }$ , and $b ^ { \tau }$ . If $\xi ^ { \tau } = 0$ , our model will ignore the next sub-actions $( u , v ) ^ { \tau }$ and $b ^ { \tau }$ , and all the future actions $( \xi , u , v , b ) ^ { \tau + 1 : T }$ . Note that setting $\xi ^ { \tau }$ to be the first sub-action is useful in case a reaction does not happen, i.e., $\xi ^ { 0 } = 0$
41
+ • State Transition: If $\xi ^ { \tau } = 1$ , the current graph $\mathcal { G } ^ { \tau }$ is modified based on the reaction triple $( u , v , b ) ^ { \tau }$ to generate a new intermediate graph $\mathcal { G } ^ { \tau + 1 }$ . We do not incorporate chemical rules such as valency check during state transition because the current bond change may result in invalid intermediate molecules $\mathcal { G } ^ { \tau }$ , but later, other bond changes may compensate it to create the valid final products $\mathcal { G } ^ { T _ { \mathrm { e n d } } }$ . Reward: We use both immediate rewards and delayed rewards to encourage our model to learn the optimal policy faster. At every step $\tau$ , if the model predicts $\xi ^ { \tau }$ , $( u , v ) ^ { \tau }$ or $b ^ { \tau }$ correctly, it will receive a positive reward for each correct sub-action. Otherwise, a negative reward is given. After the prediction process has terminated, if the generated products are exactly the same as the groundtruth products, we give the model a positive reward, otherwise a negative reward. The concrete reward values are provided in Appendix A.3.
42
+
43
+ # 2.2 GRAPH TRANSFORMATION POLICY NETWORK
44
+
45
+ In this section, we describe the architecture of our model − a Graph Transformation Policy Network (GTPN). GTPN has three main components namely a Graph Neural Network (GNN), a Node Pair Prediciton Network (NPPN), and a Policy Network (PN). Each component is responsible for one or several key functions shown in Fig. 2: GNN performs functions 1 and 6; NPPN performs function 2; and PN performs functions 3, 4 and 5. Apart from these components, GTPN also has a Recurrent Neural Network (RNN) to keep track of the past transformations. The hidden state $^ { h }$ of this RNN is used by NPPN and PN to make accurate prediction.
46
+
47
+ # 2.2.1 GRAPH NEURAL NETWORK
48
+
49
+ To model the intermediate graph $\mathcal { G } ^ { \tau }$ at step $\tau$ , we compute the node state vector $\mathbf { \boldsymbol { x } } _ { i } ^ { \tau }$ of every node $i$ in $\mathcal { G } ^ { \tau }$ by using a variant of the Message Passing Neural Networks (Gilmer et al., 2017):
50
+
51
+ $$
52
+ \begin{array} { r l r } { \pmb { x } _ { i } ^ { \tau } } & { = } & { \mathrm { M e s s a g e P a s s i n g } ^ { m } \left( \pmb { x } _ { i } ^ { \tau - 1 } , \pmb { v } _ { i } , \sqrt { \tau } \left( i \right) \right) } \end{array}
53
+ $$
54
+
55
+ where $m$ is the number of message passing steps; ${ \mathbf { } } v _ { i }$ is the feature vector of node $i$ ; $\mathcal { N } ^ { \tau } ( i )$ is the set of all neighbor nodes of node $i$ ; and $\pmb { x } _ { i } ^ { \tau - 1 }$ is the state vector of node $i$ at the previous step. When $\tau = 0$ $\pmb { x } _ { i } ^ { \tau - 1 }$ is initialized from ${ \mathbf { } } v _ { i }$ using a neural network. Details about the MessagePassing $( . )$ function are provided in Appendix A.1.
56
+
57
+ # 2.2.2 NODE PAIR PREDICTION NETWORK
58
+
59
+ In order to predict how likely an atom pair $( i , j )$ of the intermediate graph $\mathcal { G } ^ { \tau }$ will change its bond, we assign $( i , j )$ with a score $s _ { i j } ^ { \tau } \in \mathbb { R }$ . If $s _ { i j } ^ { \tau }$ is high, $( i , j )$ is more probably a reaction atom pair, otherwise, less probably. Similar to (Jin et al., 2017), we use two different networks called “local” network and “global” network for this task. In case of the “local” network, $s _ { i j } ^ { \tau }$ is computed as:
60
+
61
+ $$
62
+ \begin{array} { r c l } { { z _ { i j } ^ { \tau } } } & { { = } } & { { \sigma \left( W _ { 1 } \left[ { { h ^ { \tau } } ^ { - 1 } } , ( { x _ { i } ^ { \tau } } + { { \bf { x } } _ { j } ^ { \tau } } ) , { { e _ { i j } } } \right] + b _ { 1 } \right) } } \\ { { s _ { i j } ^ { \tau } } } & { { = } } & { { f ^ { \mathrm { a t o m p a i r } } \left( { z _ { i j } ^ { \tau } } \right) } } \end{array}
63
+ $$
64
+
65
+ where $f ^ { \mathrm { a t o m } } \operatorname { p a i r }$ is a neural network; $\sigma$ is a nonlinear activation function (e.g., ReLU); $[ . ]$ denotes vector concatenation; $W _ { 1 }$ and $b _ { 1 }$ are parameters; $\pmb { h } ^ { \tau - 1 }$ is the hidden state of the RNN at the previous step; and $e _ { i j }$ is the representation vector of the bond between $( i , j )$ . If there is no bond between $( i , j )$ we assume that its bond type is “NULL”. We consider $z _ { i j }$ as the representation vector for the atom pair $( i , j )$ .
66
+
67
+ The “global” network leverages self-attention (Vaswani et al., 2017; Wang et al., 2018) to detect compatibility between atom $i$ and all other atoms before computing the scores:
68
+
69
+ $$
70
+ \begin{array} { r c l } { { r _ { i j } ^ { \tau } } } & { { = } } & { { \sigma \left( V _ { 1 } \left[ ( { \bf { x } } _ { i } ^ { \tau } + { \bf { x } } _ { j } ^ { \tau } ) , e _ { i j } \right] + c _ { 1 } \right) } } \\ { { a _ { i j } ^ { \tau } } } & { { = } } & { { \mathrm { s o f t m a x } \left( V _ { 2 } r _ { i j } ^ { \tau } + c _ { 2 } \right) } } \\ { { c _ { i } ^ { \tau } } } & { { = } } & { { \displaystyle \sum _ { j \in \mathcal { V } } a _ { i j } { \bf { x } } _ { j } ^ { \tau } } } \\ { { z _ { i j } ^ { \tau } } } & { { = } } & { { \sigma \left( W _ { 1 } \left[ { \bf { h } } ^ { \tau - 1 } , ( { \bf { x } } _ { i } ^ { \tau } + { \bf { x } } _ { j } ^ { \tau } ) , ( c _ { i } ^ { \tau } + c _ { j } ^ { \tau } ) , e _ { i j } \right] + b _ { 1 } \right) } } \\ { { s _ { i j } ^ { \tau } } } & { { = } } & { { f _ { \mathrm { c o m p a i r } } ^ { \mathrm { a t m } } \left( z _ { i j } ^ { \tau } \right) } } \\ { { . } } & { { } } & { { . } } \end{array}
71
+ $$
72
+
73
+ where $a _ { i j }$ is the attention score from node $\imath$ to every other node $j$ ; $c _ { i }$ is the context vector of atom $i$ that summarizes the information from all other atoms.
74
+
75
+ During experiments, we tried both options mentioned above and saw that the “global” network clearly outperforms the “local” network so we set the “global” network as a default module in our model. In addition, since reagents never change their form during a reaction, we explicitly exclude all atom pairs that have either atoms belong to the reagents. This leads to better results than not using reagent information. Detailed analyses are provided in Appendix A.5.
76
+
77
+ Top- $K$ atom pairs Because the number of atom pairs that actually participate in a reaction is very small (usually smaller than 10) compared to the total number of atom pairs of the input molecules (usually hundreds or thousands), it is much more efficient to identify reaction triples from a small subset of highly probable reaction atom pairs. For that reason, we extract $K$ $K \ll | \mathcal { V } | ^ { 2 } )$ atom pairs with the highest scores. Later, we will predict reaction triples taken from these $K$ atom pairs only. We denote the set of top- $K$ atom pairs, their corresponding scores, and representation vectors as $\left\{ ( u _ { k } , v _ { k } ) | k = \overline { { 1 , K } } \right\}$ , $\left\{ \dot { s } _ { u _ { k } v _ { k } } | k = \overline { { 1 , K } } \right\}$ and $Z _ { K } = \mathsf { \bar { \{ } } z _ { u _ { k } v _ { k } } \mathsf { \bar { | } } k = \overline { { 1 , K } } \mathsf \}$ , respectively.
78
+
79
+ # 2.2.3 POLICY NETWORK
80
+
81
+ Predicting continuation signal To account for varying number of transformation steps, PN generates a continuation signal $\xi ^ { \tau } \in \{ 0 , 1 \}$ to indicate whether prediction should continue or terminate.
82
+
83
+ $\xi ^ { \tau }$ is drawn from a Bernoulli distribution:
84
+
85
+ $$
86
+ \begin{array} { l l l } { p \left( \xi ^ { \tau } = 1 \right) } & { = } & { \mathrm { s i g m o i d } \left( f ^ { \mathrm { s i g n a l } } \left( \left[ { h ^ { \tau - 1 } } , g \left( Z _ { K } ^ { \tau } \right) \right] \right) \right) } \end{array}
87
+ $$
88
+
89
+ where $\pmb { h } ^ { \tau - 1 }$ is the previous RNN state; $Z _ { K } ^ { \tau }$ is the set of representation vectors of the top $K$ atom pairs at the current step; $f ^ { \mathrm { s i g n a l } }$ is a neural network; $g$ is a function that maps an unordered set of inputs to an output vector. For simplicity, we use a mean function:
90
+
91
+ $$
92
+ z _ { K } ^ { \tau - 1 } = g \left( Z _ { K } ^ { \tau } \right) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } W z _ { u _ { k } v _ { k } } ^ { \tau - 1 }
93
+ $$
94
+
95
+ Predicting atom pair At the next sub-step, PN predicts which atom pair changes its bond during the reaction by sampling from the top- $K$ atom pairs with probability:
96
+
97
+ $$
98
+ p \left( ( u _ { k } , v _ { k } ) ^ { \tau } \right) = \operatorname { s o f t m a x } _ { K } \left( s _ { u _ { k } v _ { k } } ^ { \tau } \right)
99
+ $$
100
+
101
+ where $s _ { u _ { k } v _ { k } } ^ { \tau }$ is the score of the atom pair $( u _ { k } , v _ { k } ) ^ { \tau }$ computed in Eq. (5). After predicting the atom pair $( u , v ) ^ { \tau }$ , we will mask it to ensure that it could not be in the top $K$ again at future steps.
102
+
103
+ Predicting bond type Given an atom pair $( u , v ) ^ { \tau }$ sampled from the previous sub-step, we predict a new bond type $b ^ { \tau }$ between $u$ and $v$ to get a complete reaction triple $( u , v , b ) ^ { \tau }$ using the probability:
104
+
105
+ $$
106
+ \begin{array} { r } { p ( b ^ { \tau } \vert ( u , v ) ^ { \tau } ) = \mathrm { s o f t m a x } _ { B } ( f ^ { \mathrm { b o n d } } ( [ h ^ { \tau - 1 } , z _ { u v } ^ { \tau } , ( e _ { b } - e _ { b ^ { \mathrm { o l d } } } ) ] ) ) } \end{array}
107
+ $$
108
+
109
+ where $B$ is the total number of bond types; $z _ { u v } ^ { \tau }$ is the representation vector of $( u , v ) ^ { \tau }$ computed in Eq. (4); $b ^ { \mathrm { o l d } }$ is the old bond of $( u , v )$ ; $e _ { b ^ { \mathrm { o l d } } }$ and $e _ { b }$ are the embedding vectors corresponding to the bond type $b ^ { \mathrm { o l d } }$ and $b$ , respectively; and $f ^ { \mathrm { b o n d } }$ is a neural network.
110
+
111
+ # 2.3 UPDATING STATES
112
+
113
+ After predicting a complete reaction triple $( u , v , b ) ^ { \tau }$ , our model updates: i) the new recurrent hidden state $\pmb { h } ^ { \tau }$ , and ii) the new node representation vectors $\pmb { x } _ { i } ^ { \tau + 1 }$ of the new intermediate graph $\mathcal { G } ^ { \tau + 1 }$ for $i \in \nu$ . These updates are presented in Appendix A.2.
114
+
115
+ # 2.4 TRAINING
116
+
117
+ Loss function plays a central role in achieving fast training and high performance. We design the following loss:
118
+
119
+ $$
120
+ { \mathcal { L } } = \lambda _ { 1 } { \mathcal { L } } ^ { \mathrm { { A 2 C } } } + \lambda _ { 2 } { \mathcal { L } } ^ { \mathrm { { v a l u e } } } + \lambda _ { 3 } { \mathcal { L } } ^ { \mathrm { { a t o m p a i r } } } + \lambda _ { 4 } { \mathcal { L } } ^ { \mathrm { { o v e r l e n g t h } } } + \lambda _ { 5 } { \mathcal { L } } ^ { \mathrm { { i n } } \mathrm { { t o p } } K }
121
+ $$
122
+
123
+ where $\mathcal { L } ^ { \mathrm { A 2 C } }$ is the Advantage Actor-Critic (A2C) loss (Mnih et al., 2016) to account for the correct sequence of reaction triples; $\mathcal { L } ^ { \mathrm { v a l u e } }$ is the loss for estimating the value function used in A2C; $\mathcal { L } ^ { \mathrm { a t o m } }$ pair accounts for binary change in the bond of an atom pair; Lover length penalizes long predicted sequences; and $\mathcal { L } ^ { \mathrm { i n t o p } ~ K }$ is the rank loss to force a ground-truth reaction atom pair to appear in the top- $K$ ; and $\lambda _ { 1 } , . . . , \lambda _ { 5 } > 0$ are tunable coefficients. The component losses are explained in the following.
124
+
125
+ # 2.4.1 REACTION TRIPLE LOSS
126
+
127
+ The loss follows a policy gradient method known as Advantage Actor-Critic (A2C):
128
+
129
+ $$
130
+ \begin{array} { r c l } { { \mathcal { L } ^ { \mathrm { A 2 C } } } } & { { = } } & { { \displaystyle - \sum _ { \tau = 0 } ^ { T _ { \mathrm { e n d } } - 1 } \left( A _ { \mathrm { s i g n a l } } ^ { \tau } \log p \left( \xi ^ { \tau } \right) + A _ { \mathrm { a t o m p a i r } } ^ { \tau } \log p \left( \left( u , v \right) ^ { \tau } \right) + A _ { \mathrm { b o n d } } ^ { \tau } \log p \left( b ^ { \tau } \right) \right) } } \\ { { } } & { { } } & { { \displaystyle - A _ { \mathrm { s i g n a l } } ^ { T _ { \mathrm { e n d } } } \log \pi \left( \xi ^ { T _ { \mathrm { e n d } } } \right) } } \end{array}
131
+ $$
132
+
133
+ where $T _ { \mathrm { e n d } }$ is the first step that $\xi = 0$ ; $A _ { \mathrm { s i g n a l } }$ , $A _ { \mathrm { a t o m } \operatorname { p a i r } }$ and $A _ { \mathrm { b o n d } }$ are called advantages. To compute these advantages, we use the unbiased estimations called Temporal Different errors, defined as:
134
+
135
+ $$
136
+ \begin{array} { r l r } { A _ { \mathrm { s i g n a l } } ^ { \tau } } & { = } & { r _ { \mathrm { s i g n a l } } ^ { \tau } + \gamma V _ { \phi } \left( Z _ { K } ^ { \tau + 1 } \right) - V _ { \phi } \left( Z _ { K } ^ { \tau } \right) \quad } \\ { A _ { \mathrm { a t o m p a i r } } ^ { \tau } } & { = } & { r _ { \mathrm { a t o m p a i r } } ^ { \tau } + \gamma V _ { \phi } \left( Z _ { K } ^ { \tau + 1 } \right) - V _ { \phi } \left( Z _ { K } ^ { \tau } \right) \quad } \\ { A _ { \mathrm { b o n d } } ^ { \tau } } & { = } & { r _ { \mathrm { b o n d } } ^ { \tau } + \gamma V _ { \phi } \left( Z _ { K } ^ { \tau + 1 } \right) - V _ { \phi } \left( Z _ { K } ^ { \tau } \right) \quad \quad } \end{array}
137
+ $$
138
+
139
+ where $r _ { \mathrm { s i g n a l } } ^ { \tau }$ , $r _ { \mathrm { a t o m } \ p \mathrm { a i r } } ^ { \tau }$ , $r _ { \mathrm { b o n d } } ^ { \tau }$ are immediate rewards at step $\tau$ ; at the final step $\tau = T _ { \mathrm { e n d } }$ , the model receives additional delayed rewards; $\gamma$ is the discount factor; and $V _ { \phi }$ is the parametric value function. We train $V _ { \phi }$ using the following mean square error loss:
140
+
141
+ $$
142
+ \mathcal { L } ^ { \mathrm { v a l u e } } \ = \ \sum _ { \tau = 0 } ^ { T _ { \mathrm { e n d } } } \left\| V _ { \phi } \left( Z _ { K } ^ { \tau } \right) - R ^ { \tau } \right\| ^ { 2 }
143
+ $$
144
+
145
+ where $R ^ { \tau }$ is the return at step $\tau$ .
146
+
147
+ Episode termination during training Although the loss defined in Eq. (9) is correct, it is not good to use in practice because: i) If our model selects a wrong sub-action at any sub-step of the step Twrong $\mathit { T _ { \mathrm { w r o n g } } } < \mathit { T _ { \mathrm { e n d } } } )$ , the whole predicted sequence will be incorrect regardless of what will be predicted from $T _ { \mathrm { w r o n g } } + 1$ to $T _ { \mathrm { e n d } }$ . Therefore, computing the loss for actions from $T _ { \mathrm { w r o n g } } + 1$ to $T _ { \mathrm { e n d } }$ is redundant. ii) More importantly, the incorrect updates of the graph structure at subsequent steps from $T _ { \mathrm { w r o n g } } + 1$ to $T _ { \mathrm { e n d } }$ will lead to cumulative prediction errors which make the training of our model much more difficult.
148
+
149
+ To resolve this issue, during training, we use a binary vector $\zeta \in \{ 0 , 1 \} ^ { 3 T }$ to keep track of the first wrong sub-action: $\zeta ^ { t } = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } t \leq t _ { \mathrm { f i r s t ~ w r o n g } } } \\ { 0 } & { { \mathrm { i f ~ } } t > t _ { \mathrm { f i r s t ~ w r o n g } } } \end{array} \right. }$ if t ≤ tfirst wrong where tfirst wrong denotes the sub-step at which our model chooses a wrong sub-action the first time. The actor-critic loss in Eq. (9) now becomes:
150
+
151
+ $$
152
+ \mathcal { L } ^ { \mathrm { A 2 C } } = - \sum _ { \tau = 0 } ^ { T } \left( \zeta ^ { \tau } A _ { \mathrm { s i g n a l } } ^ { \tau } \log p \left( \xi ^ { \tau } \right) + \zeta ^ { ( \tau + 1 ) } A _ { \mathrm { a t o m p a i r } } ^ { \tau } \log p \left( ( u , v ) ^ { \tau } \right) + \zeta ^ { ( \tau + 2 ) } A _ { \mathrm { b o n d } } ^ { \tau } \log p \left( b ^ { \tau } \right) \right) .
153
+ $$
154
+
155
+ where $T$ is the maximum number of steps. Similarly, we change the value loss into:
156
+
157
+ $$
158
+ \mathcal { L } ^ { \mathrm { v a l u e } } = \sum _ { \tau = 0 } ^ { T } \zeta ^ { \tau } \left\| V _ { \phi } \left( Z _ { K } ^ { \tau } \right) - R ^ { \tau } \right\| ^ { 2 }
159
+ $$
160
+
161
+ # 2.4.2 REACTION ATOM PAIR LOSS
162
+
163
+ To train our model to assign higher scores to reaction atom pairs and lower to non-reaction atom pairs, we use the following cross-entropy loss function:
164
+
165
+ $$
166
+ \mathcal { L } ^ { \mathrm { a t o m \ p a i r } } = - \sum _ { \tau = 0 } ^ { T _ { \mathrm { \bar { m } s t w o u p } } } \sum _ { i \in \mathcal { V } } \sum _ { j \in \mathcal { V } , j \neq i } \eta _ { i j \tau } \left( y _ { i j } \log p _ { i j } + ( 1 - y _ { i j } ) \log ( 1 - p _ { i j } ) \right)
167
+ $$
168
+
169
+ where $\begin{array} { r } { T _ { \mathrm { f i r s t w r o n g } } = \biggl \lfloor \frac { t _ { \mathrm { f i r s t w r o n g } } } { 3 } \biggr \rfloor ; \eta _ { i j t } \in \{ 0 , 1 \} } \end{array}$ is a mask of the atom pair $( i , j )$ at step $\tau$ ; $y _ { i j } \in \{ 0 , 1 \}$ is the label indicating whether the atom pair $( i , j )$ is a reaction atom pair or not; $p _ { i j } = \mathrm { s i g m o i d } ( s _ { i j } )$ (see Eq. (5)).
170
+
171
+ # 2.4.3 CONSTRAINT ON THE SEQUENCE LENGTH
172
+
173
+ One major difficulty of the chemical reaction prediction problem is to know exactly when to stop prediction so we can make accurate inference. By forcing the model to stop immediately when making wrong prediction, we can prevent cumulative error and significantly reduce variance during training. But it also comes with a cost: The model cannot learn (because it does not have to learn) when to stop. This phenomenon can be visualized easily as the model predicts 1 for the signal at every step $\tau$ during inference. In order to make the model aware of the correct sequence length during training, we define a loss that punishes the model if it produces a longer sequence than the ground truth sequence:
174
+
175
+ <table><tr><td rowspan=1 colspan=2>Dataset</td><td rowspan=1 colspan=1>#reactions</td><td rowspan=1 colspan=1>#changes</td><td rowspan=1 colspan=1>#molecules</td><td rowspan=1 colspan=1>#atoms</td><td rowspan=1 colspan=1>#bonds</td></tr><tr><td rowspan=3 colspan=1>USPTO-15k</td><td rowspan=1 colspan=1>train</td><td rowspan=1 colspan=1>10,500</td><td rowspan=1 colspan=1>111112.3</td><td rowspan=1 colspan=1>112013.6</td><td rowspan=1 colspan=1>41100134.9</td><td rowspan=1 colspan=1>31110134.7</td></tr><tr><td rowspan=1 colspan=1>valid</td><td rowspan=1 colspan=1>1,500</td><td rowspan=1 colspan=1>111112.3</td><td rowspan=1 colspan=1>112013.6</td><td rowspan=1 colspan=1>7194134.5</td><td rowspan=1 colspan=1>5199134.2</td></tr><tr><td rowspan=1 colspan=1>test</td><td rowspan=1 colspan=1>3,000</td><td rowspan=1 colspan=1>111112.3</td><td rowspan=1 colspan=1>111613.6</td><td rowspan=1 colspan=1>7198134.9</td><td rowspan=1 colspan=1>51102134.7</td></tr><tr><td rowspan=3 colspan=1>USPTO</td><td rowspan=1 colspan=1>train</td><td rowspan=1 colspan=1>409,035</td><td rowspan=1 colspan=1>11612.2</td><td rowspan=1 colspan=1>212914.8</td><td rowspan=1 colspan=1>91150139.7</td><td rowspan=1 colspan=1>61165138.6</td></tr><tr><td rowspan=1 colspan=1>valid</td><td rowspan=1 colspan=1>30,000</td><td rowspan=1 colspan=1>11612.2</td><td rowspan=1 colspan=1>212514.8</td><td rowspan=1 colspan=1>91150139.6</td><td rowspan=1 colspan=1>71158138.5</td></tr><tr><td rowspan=1 colspan=1>test</td><td rowspan=1 colspan=1>40.000</td><td rowspan=1 colspan=1>11612.2</td><td rowspan=1 colspan=1>212214.8</td><td rowspan=1 colspan=1>91150139.8</td><td rowspan=1 colspan=1>71162138.7</td></tr></table>
176
+
177
+ Table 1: Statistics of $U S P T O – I 5 k$ and USPTO datasets. “changes” means bond changes, “molecules” means reactants and reagents in a reaction; “atoms” and “bonds” are defined for a molecule. Apart from “#reactions”, other columns are presented in the format “min | max | mean”.
178
+
179
+ $$
180
+ \mathcal { L } ^ { \mathrm { o v e r } \mathrm { l e n g t h } } = - \sum _ { T _ { \mathrm { e n d } } ^ { \mathrm { g t } } \leq \tau < T _ { \mathrm { e n d } } } \log p \left( \xi ^ { \tau } = 0 \right)
181
+ $$
182
+
183
+ wherewhen $T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ end step of the ground-trut. The reason is that forcing nce. with s in Eq. (16) is not applied is not theoretically correct $T _ { \mathrm { e n d } } \leq T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ $\xi ^ { \tau } = 1$ $T _ { \mathrm { e n d } } \leq \tau < T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ because all the signals after $T _ { \mathrm { e n d } }$ are assumed to be 0. The incentive to force $T _ { \mathrm { e n d } }$ close to $T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ when it is smaller than $T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ has already been included in the advantages in Eq. (14).
184
+
185
+ # 2.4.4 CONSTRAINT ON THE TOP- $K$ ATOM PAIRS
186
+
187
+ Ideally, the loss from Eq. (15) pushes a reaction atom pair $( \tilde { u } , \tilde { v } ) ^ { \tau }$ into the top- $K$ atom pairs at each step $\tau < T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ . However, this is not guaranteed, especially when τ $\tau$ comes close to $T _ { \mathrm { e n d } } ^ { \mathrm { g t } }$ . To encourage the ground-truth reaction atom pair with the highest score to appear in the top $K$ , we introduce an additional rank-based loss:
188
+
189
+ $$
190
+ { \mathcal { L } } ^ { \mathrm { i n } \mathrm { t o p } K } = - \sum _ { \tau = 0 } ^ { T _ { \mathrm { f i r s t w r o n g } } } \log p \left( ( { \tilde { u } } , { \tilde { v } } ) ^ { \tau } \operatorname { i n } \mathrm { t o p } K \right)
191
+ $$
192
+
193
+ where $p \left( ( \tilde { u } , \tilde { v } ) ^ { \tau } \right.$ in top $K$ ) is computed as:
194
+
195
+ $$
196
+ \begin{array} { r l r } { p \left( ( \tilde { u } , \tilde { v } ) ^ { \tau } \mathrm { i n } \mathrm { t o p } K \right) } & { = } & { \frac { \exp \left( s _ { \tilde { u } \tilde { v } } ^ { \tau } \right) } { \exp \left( s _ { \tilde { u } \tilde { v } } ^ { \tau } \right) + \sum _ { k = 1 } ^ { K } \exp \left( s _ { u _ { k } v _ { k } } ^ { \tau } \right) } } \end{array}
197
+ $$
198
+
199
+ # 3 EXPERIMENTS
200
+
201
+ # 3.1 DATASET
202
+
203
+ We evaluate our model on two standard datasets USPTO-15k (15K reactions) and USPTO (480K reactions) which have been used in previous works (Jin et al., 2017; Schwaller et al., 2018; Bradshaw et al., 2018). Details about these datasets are given in Table 1. The USPTO dataset contains reactant, reagent and product molecules represented as SMILES strings. Using RDKit1, we convert the SMILES strings into molecule objects and store them as graphs. For each reaction, every atom in the reactant and reagent molecules is identified with a unique “atom map number”. This identity is the same in the products. Using this knowledge, we compare every atom pair in the input molecules with the correspondent in the product molecules to obtain a ground-truth set of reaction triples for training. In USPTO-15k, the ground-truth sets of reaction triples was precomputed by (Jin et al., 2017).
204
+
205
+ <table><tr><td rowspan=2 colspan=1>Model</td><td rowspan=1 colspan=3>USPTO-15k</td><td rowspan=1 colspan=3>USPTO</td></tr><tr><td rowspan=1 colspan=1>C@6</td><td rowspan=1 colspan=1>C@8</td><td rowspan=1 colspan=1>C@10</td><td rowspan=1 colspan=1>C@6</td><td rowspan=1 colspan=1>C@8</td><td rowspan=1 colspan=1>C@10</td></tr><tr><td rowspan=1 colspan=1>WLN* (Jin et al., 2017)</td><td rowspan=1 colspan=1>81.6</td><td rowspan=1 colspan=1>86.1</td><td rowspan=1 colspan=1>89.1</td><td rowspan=1 colspan=1>89.8</td><td rowspan=1 colspan=1>92.0</td><td rowspan=1 colspan=1>93.3</td></tr><tr><td rowspan=1 colspan=1>WLN (Jin et al., 2017)</td><td rowspan=1 colspan=1>88.45</td><td rowspan=1 colspan=1>91.65</td><td rowspan=1 colspan=1>93.34</td><td rowspan=1 colspan=1>90.97</td><td rowspan=1 colspan=1>93.98</td><td rowspan=1 colspan=1>95.26</td></tr><tr><td rowspan=1 colspan=1>CLN (Pham et al., 2017)</td><td rowspan=1 colspan=1>88.68</td><td rowspan=1 colspan=1>91.63</td><td rowspan=1 colspan=1>93.07</td><td rowspan=1 colspan=1>90.72</td><td rowspan=1 colspan=1>93.57</td><td rowspan=1 colspan=1>94.80</td></tr><tr><td rowspan=1 colspan=1>Our GNN</td><td rowspan=1 colspan=1>88.92</td><td rowspan=1 colspan=1>92.00</td><td rowspan=1 colspan=1>93.57</td><td rowspan=1 colspan=1>91.24</td><td rowspan=1 colspan=1>94.17</td><td rowspan=1 colspan=1>95.33</td></tr></table>
206
+
207
+ Table 2: Results for reaction atom pair prediction. $C @ k$ is coverage at $k$ . Best results are highlighted in bold. $\mathrm { W L N ^ { \star } }$ is the original model from (Jin et al., 2017) while WLN is our re-implemented version. Except for $\mathrm { W L N ^ { \star } }$ , other models explicitly use reagent information.
208
+
209
+ ![](images/14668a9481c915b9fba00c8d77e2952ac553712c8edb6065fb0fd1071dd67232.jpg)
210
+ Figure 3: Coverage $@ k$ and Recall $@ k$ with respect to $k$ for the USPTO dataset.
211
+
212
+ # 3.2 REACTION ATOM PAIR PREDICTION
213
+
214
+ In this section, we test our model’s ability to identify reaction atom pairs by formulating it as a ranking problem with the scores computed in Eq. (5). Similar to (Jin et al., 2017), we use Coverage $@ k$ as the evaluation metric, which is the proportion of reactions that have all groundtruth reaction atom pairs appear in the top $k$ predicted atom pairs.
215
+
216
+ We compare our proposed graph neural network (GNN) with Weisfeiler-Lehman Network (WLN) (Jin et al., 2017) and Column Network (CLN) (Pham et al., 2017). Since our GNN explicitly uses reagent information to compute the scores of atom pairs, we modify the implementation of WLN and CLN accordingly for fair comparison. From Table 2, we observe that our GNN clearly outperforms WLN and CLN in all cases. We attribute this improvement to the use of a separate node state vector $\boldsymbol { x } _ { i } ^ { t }$ (different from the node feature vector ${ \mathbf { } } v _ { i }$ ) for updating the structural information of a node (see Eq. (21)). The other two models, on the other hand, only use a single vector to store both the node features and structure, hence, some information may be lost. In addition, using explicit reagent information boosts the prediction accuracy, which improves the WLN by $1 - 7 \%$ depending on the metrics. The presence of reagent information reduces the number of atom pairs to be searched on and contributes to the likelihood of reaction atom pairs. Further results are presented in Appendix A.5.
217
+
218
+ # 3.3 TOP- $K$ ATOM PAIR EXTRACTION
219
+
220
+ The performance of our model depends on the number of selected top atom pairs $K$ . The value of $K$ presents a trade-off between coverage and efficiency. In addition to the metric Coverage $@ k$ in Sec. 3.2, we use Recall $@ k$ which is the proportion of correct atom pairs that appear in top $k$ to find the good $K$ . Fig. 3 shows Coverage $@ k$ and Recall $@ k$ for the USPTO dataset with respect to $k$ . We see that both curves increase rapidly when $k < 1 0$ and stablize when $k > 1 0$ . We also ran experiments with $k = 1 0$ , 15, 20 and observed that their prediction results are quite similar. Hence, in what follows we select $K = 1 0$ for efficiency.
221
+
222
+ Table 3: Results for reaction prediction. $P \ @ k$ is precision at $k$ . State-of-the-art results from (Jin et al., 2017) are written in italic. Results from (Schwaller et al., 2018) are marked with ? and they are computed on a slightly different version of USPTO that contains only single-product reactions. Best results are highlighted in bold. $\diamondsuit$ : With beam search (beam width $= 2 0$ ), $\lessgtr$ : Invalid product removal, ♣: Duplicated product removal.
223
+
224
+ <table><tr><td rowspan=2 colspan=1>Model</td><td rowspan=1 colspan=3>USPTO-15k</td><td rowspan=1 colspan=3>USPTO</td></tr><tr><td rowspan=1 colspan=1>P@1</td><td rowspan=1 colspan=1>P@3</td><td rowspan=1 colspan=1>P@5</td><td rowspan=1 colspan=1>P@1</td><td rowspan=1 colspan=1>P@3</td><td rowspan=1 colspan=1>P@5</td></tr><tr><td rowspan=1 colspan=1>WLDN (Jin et al., 2017)</td><td rowspan=1 colspan=1>76.7</td><td rowspan=1 colspan=1>85.6</td><td rowspan=1 colspan=1>86.8</td><td rowspan=1 colspan=1>79.6</td><td rowspan=1 colspan=1>87.7</td><td rowspan=1 colspan=1>89.2</td></tr><tr><td rowspan=1 colspan=1>Seq2Seq (Schwaller et al., 2018)</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>80.3*</td><td rowspan=1 colspan=1>86.2*</td><td rowspan=1 colspan=1>87.5*</td></tr><tr><td rowspan=1 colspan=1>GTPN</td><td rowspan=1 colspan=1>72.31</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>71.26</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>GTPN</td><td rowspan=1 colspan=1>74.56</td><td rowspan=1 colspan=1>82.62</td><td rowspan=1 colspan=1>84.23</td><td rowspan=1 colspan=1>73.25</td><td rowspan=1 colspan=1>80.56</td><td rowspan=1 colspan=1>83.53</td></tr><tr><td rowspan=1 colspan=1>GTPN4</td><td rowspan=1 colspan=1>74.56</td><td rowspan=1 colspan=1>83.19</td><td rowspan=1 colspan=1>84.97</td><td rowspan=1 colspan=1>73.25</td><td rowspan=1 colspan=1>84.31</td><td rowspan=1 colspan=1>85.76</td></tr><tr><td rowspan=1 colspan=1>GTPN</td><td rowspan=1 colspan=1>82.39</td><td rowspan=1 colspan=1>85.60</td><td rowspan=1 colspan=1>86.68</td><td rowspan=1 colspan=1>83.20</td><td rowspan=1 colspan=1>84.97</td><td rowspan=1 colspan=1>85.90</td></tr><tr><td rowspan=1 colspan=1>GTPN**</td><td rowspan=1 colspan=1>82.39</td><td rowspan=1 colspan=1>85.73</td><td rowspan=1 colspan=1>86.78</td><td rowspan=1 colspan=1>83.20</td><td rowspan=1 colspan=1>86.03</td><td rowspan=1 colspan=1>86.48</td></tr></table>
225
+
226
+ # 3.4 REACTION PRODUCT PREDICTION
227
+
228
+ This experiment validates GTPN on full reaction product prediction against the recent state-of-the-art methods (Jin et al., 2017; Schwaller et al., 2018) using the accuracy metric. The recent method ELECTRO (Bradshaw et al., 2018) is not compatible here because it was only evaluated on a subset of USPTO limited to linear chain topology. Comparison against ELECTRO is reported separately in Appendix A.6. Table 3 shows the prediction results. We produce multiple reaction product candidates by using beam search decoding with beam width $N = 2 0$ . Details about beam search and its behaviors are presented in Appendix A.4.
229
+
230
+ In brief, we compute the normalized-over-length log probabilities of $N$ predicted sequences of reaction triples and sort these values in descending order to get a rank list of $N$ possible reaction outcomes. Given a predicted sequence of reaction triples $( \overline { { u } } , v , b ) ^ { 0 : T }$ , we can generate reaction products from input reactants simply by replacing the old bond of $( u , v ) ^ { \tau }$ with $b ^ { \tau }$ . However, these products are not guaranteed to be valid (e.g., maximum valence constraint violation or aromatic molecules cannot be kekulized) so we post-process the outputs by removing all invalid products. The removal increases the top-1 accuracy by about $8 \%$ and $10 \%$ on $U S P T O – I 5 k$ and USPTO, respectively. Due to the permutation invariance of the predicted sequence of reaction triples, some product candidates are duplicate and will also be removed. This does not lead to any change in $P \ @ { \cal I }$ but slightly improves $P \ @ 3$ and $P \ @ 5$ by about $0 . 5 – 1 \%$ on the two datasets.
231
+
232
+ Overall, GTPN with beam search and post-processing outperforms both WLDN (Jin et al., 2017) and Seq2Seq (Schwaller et al., 2018) in the top-1 accuracy. For the top-3 and top-5, our model’s performance is comparable to WLDN’s on USPTO- $l 5 k$ and is worse than WLDN’s on USPTO. It is not surprising since our model is trained to accurately predict the top-1 outcomes instead of ranking the candidates directly like WLDN. It is important to emphasize that we did not tune the model hyper-parameters when training on USPTO but reused the optimal settings from $U S P T O – I 5 k$ (which is 25 times smaller than USPTO) so the results may not be optimal (see Appendix A.3 for more training detail).
233
+
234
+ # 4 RELATED WORK
235
+
236
+ # 4.1 LEARNING TO PREDICT CHEMICAL REACTION
237
+
238
+ In chemical reaction prediction, machine learning has replaced rule-based methods (Chen & Baldi, 2009) for better generalizability and scalability. Existing machine learning-based techiques are either template-free (Kayala & Baldi, 2011; Jin et al., 2017; Fooshee et al., 2018) and template-based (Wei et al., 2016; Segler & Waller, 2017; Coley et al., 2017). Both groups share the same mechanism: running multiple stages with the aid of reaction templates or rules. For example, in (Wei et al., 2016) the authors proposed a two-stage model that first classifies reactions into different types based on the neural fingerprint vectors (Duvenaud et al., 2015) of reactant and reagent molecules. Then, it applies pre-designed SMARTS transformation on the reactants with respect to the most suitable predicted reaction type to generate the reaction products.
239
+
240
+ The work of (Jin et al., 2017) treats a reaction as a set of bond changes so in the first step, they predict which atom pairs are likely to be reactive using a variant of graph neural networks called Weisfeiler-Lehman Networks (WLNs). In the next step, they do almost the same as (Coley et al., 2017) by modifying the bond type between the selected atom pairs (with chemical rules satisfied) to create product candidates and rank them (with reactant molecules as addition input) using another kind of WLNs called Weifeiler-Lehman Different Networks (WLDNs).
241
+
242
+ To the best of our knowledge, (Jin et al., 2017) is the first work that achieves remarkable results (with the Precision $@ 1$ is about $7 9 . 6 \%$ ) on the large USPTO dataset containing more than 480 thousands reactions. Works of (Nam & Kim, 2016) and (Schwaller et al., 2018) avoid multi-stage prediction by building a seq2seq model that generates the (canonical) SMILES string of the single product from the concatenated SMILES strings of the reactants and reagents in an end-to-end manner. However, their methods cannot deal with sets of reactants/reagents/products properly as well as cannot provide concrete reaction mechanism for every reaction.
243
+
244
+ The most recent work on this topic is (Bradshaw et al., 2018) which solves the reaction prediction problem by predicting a sequence of bond changes given input reactants and reagents represented as graphs. To handle ordering, they only select reactions with predefined topology. Our method, by contrast, is order-free and can be applied to almost any kind of reactions.
245
+
246
+ # 4.2 GRAPH NEURAL NETWORKS FOR MODELING MOLECULES
247
+
248
+ In recent years, there has been a fast development of graph neural networks (GNNs) for modeling molecules. These models are proposed to solve different problems in chemistry including toxicity prediction (Duvenaud et al., 2015), drug activity classification (Shervashidze et al., 2011; Dai et al., 2016; Pham et al., 2018), protein interface prediction (Fout et al., 2017) and drug generation (Simonovsky & Komodakis, 2018; Jin et al., 2018). Most of them can be regarded as variants of message-passing graph neural networks (MPGNNs) (Gilmer et al., 2017).
249
+
250
+ # 4.3 REINFORCEMENT LEARNING FOR STRUCTURAL REASONING
251
+
252
+ Reinforcement learning (RL) has become a standard approach to many structural reasoning problems2 because it allows agents to perform discrete actions. A typical example of using RL for structural reasoning is drug generation (Li et al., 2018; You et al., 2018). Both (Li et al., 2018) and (You et al., 2018) learn the same generative policy whose action set including: i) adding a new atom or a molecular scaffold to the intermediate graph, ii) connecting existing pair of atoms with bonds, and iii) terminating generation. However, (You et al., 2018) uses an adversarial loss to enforce global chemical constraints on the generated molecules as a whole instead of using the common reconstruction loss as in (Li et al., 2018). Other examples are path-based relational reasoning in knowledge graphs (Das et al., 2018) and learning combinatorial optimization over graphs (Khalil et al., 2017).
253
+
254
+ # 5 DISCUSSION
255
+
256
+ We have introduced a novel method named Graph Transformation Policy Network (GTPN) for predicting products of a chemical reaction. GTPN uses graph neural networks to represent input reactant and reagent molecules, and uses reinforcement learning to find an optimal sequence of bond changes that transforms the reactants into products. We train GTPN using the Advantage Actor-Critic (A2C) method with appropriate constraints to account for notable aspects of chemical reaction. Experiments on real datasets have demonstrated the competitiveness of our model.
257
+
258
+ Although the GTPN was proposed to solve the chemical reaction problem, it is indeed generic to solve the graph transformation problem, which can be useful in reasoning about relations (e.g., see (Zambaldi et al., 2018)) and changes in relation. Open rooms include addressing dynamic graphs over time, extending toward full chemical planning and structural reasoning using RL.
259
+
260
+ # REFERENCES
261
+
262
+ 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.
263
+
264
+ John Bradshaw, Matt J Kusner, Brooks Paige, Marwin HS Segler, and José Miguel Hernández-Lobato. Predicting electron paths. arXiv preprint arXiv:1805.10970, 2018.
265
+
266
+ Jonathan H Chen and Pierre Baldi. No electron left behind: a rule-based expert system to predict chemical reactions and reaction mechanisms. Journal of chemical information and modeling, 49 (9):2034–2043, 2009.
267
+
268
+ Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. EMNLP, 2014.
269
+
270
+ Connor W Coley, Regina Barzilay, Tommi S Jaakkola, William H Green, and Klavs F Jensen. Prediction of organic reaction outcomes using machine learning. ACS central science, 3(5): 434–443, 2017.
271
+
272
+ Hanjun Dai, Bo Dai, and Le Song. Discriminative embeddings of latent variable models for structured data. In International Conference on Machine Learning, pp. 2702–2711, 2016.
273
+
274
+ Rajarshi Das, Shehzaad Dhuliawala, Manzil Zaheer, Luke Vilnis, Ishan Durugkar, Akshay Krishnamurthy, Alex Smola, and Andrew McCallum. Go for a walk and arrive at the answer: Reasoning over paths in knowledge bases using reinforcement learning. ICLR, 2018.
275
+
276
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán 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.
277
+
278
+ David Fooshee, Aaron Mood, Eugene Gutman, Mohammadamin Tavakoli, Gregor Urban, Frances Liu, Nancy Huynh, David Van Vranken, and Pierre Baldi. Deep learning for chemical reaction prediction. Molecular Systems Design & Engineering, 2018.
279
+
280
+ Alex Fout, Jonathon Byrd, Basir Shariat, and Asa Ben-Hur. Protein interface prediction using graph convolutional networks. In Advances in Neural Information Processing Systems, pp. 6530–6539, 2017.
281
+
282
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In Proceedings of the International Conference on Machine Learning, 2017.
283
+
284
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Proceedings of Advances in Neural Information Processing Systems, pp. 1025–1035, 2017.
285
+
286
+ 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.
287
+
288
+ Wengong Jin, Connor Coley, Regina Barzilay, and Tommi Jaakkola. Predicting Organic Reaction Outcomes with Weisfeiler-Lehman Network. In Advances in Neural Information Processing Systems, pp. 2604–2613, 2017.
289
+
290
+ Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Junction tree variational autoencoder for molecular graph generation. International Conference on Machine Learning (ICML), 2018.
291
+
292
+ Clemens Jochum, Johann Gasteiger, and Ivar Ugi. The principle of minimum chemical distance (pmcd). Angewandte Chemie International Edition in English, 19(7):495–505, 1980.
293
+
294
+ Matthew A Kayala and Pierre F Baldi. A machine learning approach to predict chemical reactions. In Advances in Neural Information Processing Systems, pp. 747–755, 2011.
295
+
296
+ Elias Khalil, Hanjun Dai, Yuyu Zhang, Bistra Dilkina, and Le Song. Learning combinatorial optimization algorithms over graphs. In Advances in Neural Information Processing Systems, pp. 6348–6358, 2017.
297
+
298
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference on Learning Representations (ICLR), 2015.
299
+
300
+ Yibo Li, Liangren Zhang, and Zhenming Liu. Multi-objective de novo drug design with conditional graph generative model. Journal of Cheminformatics, 10, 2018.
301
+
302
+ 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.
303
+
304
+ Juno Nam and Jurae Kim. Linking the neural machine translation and the prediction of organic chemistry reactions. arXiv preprint arXiv:1612.09529, 2016.
305
+
306
+ Trang Pham, Truyen Tran, Dinh Phung, and Svetha Venkatesh. Column networks for collective classification. In Proceedings of AAAI Conference on Artificial Intelligence, 2017.
307
+
308
+ Trang Pham, Truyen Tran, and Svetha Venkatesh. Graph memory networks for molecular activity prediction. ICPR, 2018.
309
+
310
+ Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. 15th European Semantic Web Conference (ESWC-18), 2018.
311
+
312
+ Philippe Schwaller, Theophile Gaudin, David Lanyi, Costas Bekas, and Teodoro Laino. “found in translation”: Predicting outcome of complex organic chemistry reactions using neural sequence-tosequence models. Chemical Science, 9:6091–6098, 2018.
313
+
314
+ Marwin HS Segler and Mark P Waller. Neural-symbolic machine learning for retrosynthesis and reaction prediction. Chemistry–A European Journal, 23(25):5966–5971, 2017.
315
+
316
+ Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-Lehman graph kernels. Journal of Machine Learning Research, 12(Sep): 2539–2561, 2011.
317
+
318
+ Martin Simonovsky and Nikos Komodakis. GraphVAE: Towards Generation of Small Graphs Using Variational Autoencoders. arXiv preprint arXiv:1802.03480, 2018.
319
+
320
+ Rupesh K Srivastava, Klaus Greff, and Jürgen Schmidhuber. Training very deep networks. In Advances in neural information processing systems, pp. 2377–2385, 2015.
321
+
322
+ Ivar Ugi, Johannes Bauer, Josef Brandt, Josef Friedrich, Johann Gasteiger, Clemens Jochum, and Wolfgang Schubert. New applications of computers in chemistry. Angewandte Chemie International Edition in English, 18(2):111–123, 1979.
323
+
324
+ 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.
325
+
326
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
327
+
328
+ Jennifer N Wei, David Duvenaud, and Alán Aspuru-Guzik. Neural networks for the prediction of organic chemistry reactions. ACS Central Science, 2(10):725–732, 2016.
329
+
330
+ Jiaxuan You, Bowen Liu, Rex Ying, Vijay Pande, and Jure Leskovec. Graph convolutional policy network for goal-directed molecular graph generation. NIPS, 2018.
331
+
332
+ 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.
333
+
334
+ # A APPENDIX
335
+
336
+ # A.1 GRAPH NEURAL NETWORK
337
+
338
+ In this section, we describe our graph neural network (GNN) in detail. Since our GNN does not use the recurrent hidden state $h ^ { \tau }$ , we exclude the time step $\tau$ from our notations for clarity. Instead, we use $t$ to denote a message passing step.
339
+
340
+ # GRAPH NOTATIONS
341
+
342
+ Input to our GNN is a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ in which each node $i \in \nu$ is represented by a node feature vector ${ \mathbf { } } v _ { i }$ and each edge $( i , j ) \in \mathcal { E }$ is represented by an edge feature vector $e _ { i j }$ . For example of molecular graph, the node feature vector ${ \mathbf { } } v _ { i }$ may include chemical information about the atom $i$ such as its type, charge and degree. Similarly, $e _ { i j }$ captures the bond type between the two atoms $i$ and $j$ We denote by $\bar { \mathcal { N } } ( i )$ the set of all neighbor nodes of node $i$ together with their links to node $i$ :
343
+
344
+ $$
345
+ \begin{array} { l l l } { { \mathcal N ( i ) } } & { { \equiv } } & { { \{ ( j , e _ { i j } ) \mid j { \mathrm { ~ i s ~ a ~ n e i g h b o r ~ n o d e ~ o f ~ } } i \} } } \end{array}
346
+ $$
347
+
348
+ If we only care about the neighbor nodes of $i$ not their links, we use the notation $\mathcal { N } _ { \mathrm { n } } ( i )$ defined as:
349
+
350
+ $$
351
+ \begin{array} { l l l } { { \mathcal N } _ { \mathrm { n } } ( i ) } & { \equiv } & { \left\{ j \ | \ j \ \mathrm { i s ~ a ~ n e i g h b o r ~ n o d e ~ o f } \ i \right\} } \end{array}
352
+ $$
353
+
354
+ In addition to ${ \mathbf { } } v _ { i }$ , node $i$ also has a state vector $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ to store information about itself and the surrounding context. This state vector is updated recursively using the neural message passing method (Battaglia et al., 2016; Pham et al., 2017; Hamilton et al., 2017; Gilmer et al., 2017; Schlichtkrull et al., 2018). The initial state $\pmb { x } _ { i } ^ { 0 }$ is the nonlinear mapping of ${ \mathbf { } } v _ { i }$ :
355
+
356
+ $$
357
+ \begin{array} { r c l } { { { \pmb x } _ { i } ^ { 0 } } } & { { = } } & { { \sigma \left( W { { \pmb v } _ { i } } + b \right) } } \end{array}
358
+ $$
359
+
360
+ # COMPUTING NEIGHBOR MESSAGES
361
+
362
+ At the message passing step $t$ , we compute the message $\boldsymbol { m } _ { i j } ^ { t }$ from every neighbor node $j \in \mathcal { N } _ { n } ( i )$ to node $i$ as:
363
+
364
+ $$
365
+ \begin{array} { r c l } { { { \pmb m } _ { i j } ^ { t } } } & { { = } } & { { f \left( { \pmb x } _ { i } ^ { t } , { \pmb x } _ { j } ^ { t } , { \pmb e } _ { i j } \right) } } \\ { { } } & { { = } } & { { \sigma \left( W \left[ { \pmb x } _ { i } ^ { t } , { \pmb x } _ { j } ^ { t } , { \pmb e } _ { i j } \right] + b \right) } } \end{array}
366
+ $$
367
+
368
+ where $[ \cdot ]$ denotes concatenation; and $\sigma$ is a nonlinear function.
369
+
370
+ AGGREGATING NEIGHBOR MESSAGES
371
+
372
+ Then, we aggregate all the messages sent to node $i$ into a single message vector by averaging:
373
+
374
+ $$
375
+ \begin{array} { r c l } { \pmb { m } _ { i } ^ { t } } & { = } & { \displaystyle \frac { 1 } { \vert \mathcal { N } _ { \mathrm { n } } ( i ) \vert } \sum _ { j \in \mathcal { N } _ { \mathrm { n } } ( i ) } \pmb { m } _ { i j } ^ { t } } \end{array}
376
+ $$
377
+
378
+ where $| \mathcal { N } _ { \mathrm { n } } ( i ) |$ is the number of neighbor nodes of node $i$
379
+
380
+ UPDATING NODE STATE
381
+
382
+ Finally, we update the state of node $i$ as follows:
383
+
384
+ $$
385
+ \begin{array} { r c l } { \pmb { x } _ { i } ^ { t + 1 } } & { = } & { g \left( \pmb { x } _ { i } ^ { t } , \pmb { m } _ { i } ^ { t } , \pmb { v } _ { i } \right) } \end{array}
386
+ $$
387
+
388
+ where $g ( . )$ is a Highway Network (Srivastava et al., 2015):
389
+
390
+ $$
391
+ \begin{array} { r c l } { { \pmb x _ { i } ^ { t + 1 } } } & { { = } } & { { \mathrm { H i g h w a y } \left( { \pmb x _ { i } ^ { t } , \pmb m _ { i } ^ { t } , \pmb v _ { i } } \right) } } \\ { { } } & { { = } } & { { { \pmb \alpha } * \tilde { \pmb x } _ { i } ^ { t + 1 } + ( 1 - { \pmb \alpha } ) * { \pmb x } _ { i } ^ { t } } } \end{array}
392
+ $$
393
+
394
+ where $\tilde { \pmb { x } } _ { i } ^ { t + 1 }$ is the nonlinear part which is computed as: $\bar { \pmb { x } } _ { i } ^ { t + 1 } = \sigma \left( \bar { W _ { 1 } } \left[ \pmb { x } _ { i } ^ { t } , \pmb { m } _ { i } ^ { t } , \pmb { v } _ { i } ^ { t } \right] + b _ { 1 } \right)$ and $_ \alpha$ is the gate controlling the flow of information:
395
+
396
+ $$
397
+ \pmb { \alpha } = \mathrm { s i g m o i d } ( W _ { 2 } \left[ \pmb { x } _ { i } ^ { t } , \pmb { m } _ { i } ^ { t } , \pmb { v } _ { i } ^ { t } \right] + b _ { 2 } )
398
+ $$
399
+
400
+ By combining Eqs. (19,20,22) together, one step of message passing update for node $i$ can be written in a generic way as follows:
401
+
402
+ $$
403
+ \pmb { x } _ { i } ^ { t + 1 } = \mathrm { M e s s a g e P a s s i n g } \left( \pmb { x } _ { i } ^ { t } , \pmb { v } _ { i } , \mathcal { N } ( i ) \right)
404
+ $$
405
+
406
+ # A.2 UPDATING STATES
407
+
408
+ UPDATING RNN STATE
409
+
410
+ We keep the old representation of the edge that have been modified in the hidden memory of the RNN as follows:
411
+
412
+ $$
413
+ \begin{array} { r } { \pmb { h } ^ { \tau } = \mathbf { G } \mathbf { R } \mathbf { U } \left( \pmb { h } ^ { \tau - 1 } , \pmb { z } _ { u v } ^ { \tau } \right) } \end{array}
414
+ $$
415
+
416
+ where GRU stands for Gated Recurrent Units (Cho et al., 2014); $\boldsymbol { z } _ { u v } ^ { \tau }$ is the representation vector of the atom pair $( u , v ) ^ { \tau }$ including its old bond (see Eq. 4). Eq. (25) allows the model to keep track of all the changes happening to the graph so far so it can make more accurate prediction later.
417
+
418
+ # UPDATING GRAPH STRUCTURE AND NODE STATES
419
+
420
+ After predicting a reaction triple $( u , v , b ) ^ { \tau }$ at step $\tau$ , we update the graph structure and node states based on the new bond change. First, to update the graph structure, we simply update the neighbor set of $u$ and $v$ with information from the other atom and the new bond type $b$ as follows:
421
+
422
+ $$
423
+ \begin{array} { r l r } { \mathcal { N } ^ { \tau } ( u ) } & { = } & { \left( \mathcal { N } ^ { \tau - 1 } ( u ) \backslash \left( v , b ^ { \mathrm { o l d } } \right) \right) \cup ( v , b ) } \\ { \mathcal { N } ^ { \tau } ( v ) } & { = } & { \left( \mathcal { N } ^ { \tau - 1 } ( v ) \backslash \left( u , b ^ { \mathrm { o l d } } \right) \right) \cup ( u , b ) } \end{array}
424
+ $$
425
+
426
+ Next, to update the node states, our model performs one step of message passing for $u$ and $v$ with their new neighbor sets:
427
+
428
+ $$
429
+ \begin{array} { r l r } { \pmb { x } _ { u } ^ { \tau } } & { = } & { \mathsf { M e s s a g e P a s s i n g } \left( \pmb { x } _ { u } ^ { \tau - 1 } , \pmb { v } _ { u } , \mathcal { N } ^ { \tau } ( u ) \right) } \\ { \pmb { x } _ { v } ^ { \tau } } & { = } & { \mathsf { M e s s a g e P a s s i n g } \left( \pmb { x } _ { v } ^ { \tau - 1 } , \pmb { v } _ { v } , \mathcal { N } ^ { \tau } ( v ) \right) } \end{array}
430
+ $$
431
+
432
+ where the MessagePassing $( . )$ function is defined in Eq. (24). For other nodes in the graph to be aware of the new structures of $u$ and $v$ , we need to perform several message passing steps for all nodes in the graph after Eqs. (28, 29). However, it is very costly to run for every prediction step $\tau$ . Sometimes it is unnecessary since far-away bonds are less likely to be affected by the current bond change (unless the far-way bonds and the new bond are in an aromatic ring). Therefore, in our model, we limit the number of message passing updates for all nodes at step $\tau$ to be 1.
433
+
434
+ # A.3 MODEL CONFIGURATIONS
435
+
436
+ We optimize our model’s hyper-parameters in two stages: First, we tune the hyper-parameters of the GNN and the NPPN for the reaction atom pair prediction task. Then, we fix the optimal settings of the first two components and optimize the hyper-parameters of the PN for the reaction product prediction task.
437
+
438
+ We provide details about the settings that give good results on the USPTO-15k dataset below. With these settings, we trained another model on the USPTO dataset from scratch. Because training on the large dataset such as the USPTO takes time, we did not tune hyper-parameters on the USPTO, eventhough it is possible to increase model sizes for better performance.
439
+
440
+ Unless explicitly stated, all neural networks in our model have 2 layers with the same number of hidden units, ReLU activation and residual connections (He et al., 2016).
441
+
442
+ Table 4: Data types of atom attributes.
443
+
444
+ <table><tr><td rowspan=1 colspan=1>Atom attribute</td><td rowspan=1 colspan=1>Data type</td></tr><tr><td rowspan=1 colspan=1>Degree</td><td rowspan=1 colspan=1>numeric</td></tr><tr><td rowspan=1 colspan=1>Explicit valence</td><td rowspan=1 colspan=1>numeric</td></tr><tr><td rowspan=1 colspan=1>Explicit number of Hs</td><td rowspan=1 colspan=1>numeric</td></tr><tr><td rowspan=1 colspan=1>Charge</td><td rowspan=1 colspan=1>numeric</td></tr><tr><td rowspan=1 colspan=1>Part of a ring</td><td rowspan=1 colspan=1>boolean</td></tr></table>
445
+
446
+ Graph Neural Network (GNN) There are 72 different types of atom depending on their atomic numbers and 5 different types of bond including NULL, SINGLE, DOUBLE, TRIPLE and AROMATIC. The size of embedding vectors for atom and bond are 51 and 21, respectively. Apart from atom type, each atom has 5 more attributes listed in Table 4. These attributes are normalized to the range of [0, 1] and are concatenated to the atom embedding vector to form a final atom feature vector of size 56. The state vector and the neighbor message vector for an atom both have the size of 99. The number of message passing steps is 6.
447
+
448
+ Node Pair Prediction Network (NPPN) This component consists of two parts. The first part computes the representation vector $z _ { i j }$ of an atom pair $( i , j )$ using a neural network with hidden size of 71. The second part maps $z _ { i j }$ to an unnormalized score $s _ { i j }$ using the function $f ^ { \mathrm { a t o m } } \operatorname { p a i r }$ (see Eqs. (3,5)). This function is also a neural network with hidden size of 51.
449
+
450
+ Policy Network (PN) The recurrent network is a GRU (Cho et al., 2014) with 101 hidden units. The value function $V _ { \phi }$ is a neural network with 99 hidden units. The two functions $f ^ { \mathrm { s i g n a l } }$ for computing signal scores (see Eq. (6)) and $f ^ { \mathrm { b o n d } }$ for computing scores over bond types (see Eq. (8)) are neural networks with 81 hidden units.
451
+
452
+ Training At each step, we set the reward to be 1.0 for correct prediction of signal/atom pair/bond type and -1.0 for incorrect prediction. After the prediction sequence is terminated (zero signal was emitted), we check whether the entire set of predicted reaction triples is correct or not. If it is correct, we give the model a reward value of 2.0, otherwise $- 2 . 0$ . From the rewards and estimated values for signal, atom pair and bond type, we define the Advantage Actor Critic loss (A2C) as in Eq. (14). The coefficients of components in the final loss $\mathcal { L }$ are set empirically as follows:
453
+
454
+ $$
455
+ \mathcal { L } = \mathcal { L } ^ { \mathrm { A 2 C } } + 0 . 5 \times \mathcal { L } ^ { \mathrm { v a l u e } } + \mathcal { L } ^ { \mathrm { a t o m p a i r } } + 0 . 2 \times \mathcal { L } ^ { \mathrm { o v e r l e n g t h } } + 0 . 2 \times \mathcal { L } ^ { \mathrm { i n ~ t o p ~ } K }
456
+ $$
457
+
458
+ We trained our model using Adam (Kingma & Ba, 2015) with the initial learning rate of 0.001 for both $U S P T O – I 5 k$ and USPTO. For USPTO-15k, the learning rate will decrease by half if the Precision $@ l$ does not improve on the validation set after 1,000 steps until it reaches the minimum value of $5 \times 1 0 ^ { - 5 }$ . For USPTO, the decay rate is 0.8 after every 500 steps of no improvement until reaching the minimum learning rate is $2 \times 1 0 ^ { - 5 }$ . The maximum number of training iterations is $1 0 ^ { 6 }$ and the batch size is 20.
459
+
460
+ # A.4 DECODING WITH BEAM SEARCH
461
+
462
+ For decoding, our model generates a sequence of reaction triples (including the stop signal) $( \xi , u , v , b )$ by taking the best $( u , v )$ and $b$ at every step until it outputs a zero signal $\xi = 0$ ). In other words, it computes the argmax of $p \left( ( \xi , u , v , b ) ^ { \tau } \mid \mathcal { G } , ( \xi , u , v , b ) ^ { 0 : \tau - 1 } \right)$ at every step $\tau$ . However, this algorithm is not robust for the sequence generation task because just a single error at a step may destroy the entire sequence. To overcome this issue, we employ beam search for decoding.
463
+
464
+ During beam search, we keep track of $N > 1$ best subsequences at every step $\tau$ . $N$ is called beam width. Instead of modeling the conditional distribution of generating an output at the current step $\tau$ , we model the joint distribution of the whole subsequence that has been generated from 0 to $\tau$ :
465
+
466
+ $$
467
+ \begin{array} { r c l } { \log p \left( ( \xi , u , v , b ) ^ { 0 : \tau } | \mathcal { G } \right) } & { = } & { \log p \left( ( \xi , u , v , b ) ^ { \tau } | \mathcal { G } , ( \xi , u , v , b ) ^ { 0 : \tau - 1 } \right) + } \\ & & { \ \log p \left( ( \xi , u , v , b ) ^ { 0 : \tau - 1 } | \mathcal { G } \right) } \end{array}
468
+ $$
469
+
470
+ <table><tr><td rowspan=2 colspan=1>Beam width</td><td rowspan=1 colspan=7>Precision@k</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>15</td><td rowspan=1 colspan=1>20</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>74.49</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>72.21</td><td rowspan=1 colspan=1>80.65</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>72.21</td><td rowspan=1 colspan=1>79.54</td><td rowspan=1 colspan=1>82.29</td><td rowspan=1 colspan=1>84.27</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>72.15</td><td rowspan=1 colspan=1>79.54</td><td rowspan=1 colspan=1>82.19</td><td rowspan=1 colspan=1>83.93</td><td rowspan=1 colspan=1>86.01</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>15</td><td rowspan=1 colspan=1>72.15</td><td rowspan=1 colspan=1>79.54</td><td rowspan=1 colspan=1>82.16</td><td rowspan=1 colspan=1>83.93</td><td rowspan=1 colspan=1>86.11</td><td rowspan=1 colspan=1>86.98</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>74.56</td><td rowspan=1 colspan=1>80.72</td><td rowspan=1 colspan=1>82.62</td><td rowspan=1 colspan=1>84.23</td><td rowspan=1 colspan=1>86.14</td><td rowspan=1 colspan=1>87.04</td><td rowspan=1 colspan=1>87.55</td></tr></table>
471
+
472
+ Table 5: Reaction product prediction results using beam search with different values of beam width on $U S P T O – I 5 k$ .
473
+
474
+ Computing all configurations of $( \xi , u , v , b ) ^ { \tau }$ jointly is very memory demanding, however. Thus, we decompose the first term as follows:
475
+
476
+ $$
477
+ \begin{array} { l l l } { \log p \left( ( \xi , u , v , b ) ^ { \tau } | \mathcal { G } , ( \xi , u , v , b ) ^ { 0 : \tau - 1 } \right) } & { = } & { \log p \left( \xi ^ { \tau } | \mathcal { G } , ( \xi , u , v , b ) ^ { 0 : \tau - 1 } \right) + \mathstrut } \\ & & { \log p \left( ( u , v ) ^ { \tau } | \xi ^ { \tau } , \mathcal { G } , ( \xi , u , v , b ) ^ { 0 : \tau - 1 } \right) + \mathstrut } \\ & & { \log \left( b ^ { \tau } | ( \xi , u , v ) ^ { \tau } , \mathcal { G } , ( \xi , u , v , b ) ^ { 0 : \tau - 1 } \right) } \end{array}
478
+ $$
479
+
480
+ At step $\tau$ , we do beam search for the signal $\xi ^ { \tau }$ , then the atom pair $( u , v ) ^ { \tau }$ and finally the bond type $b ^ { \tau }$ . Algorithm 1 describes beam search in detail. Some notable technicalities are:
481
+
482
+ • We only do beam search for $( u , v )$ and $b$ if the prediction is ongoing, i.e., when $\xi ^ { \tau } = 1$ . To keep track of this, we use a boolean vector $C$ of length $N$ with $C ^ { 0 }$ is initialized to be all true.
483
+ • To avoid beam search favoring short sequences, we normalize the log probability scores over sequence lengths. This is shown in lines 10, 17, 32 and 47
484
+
485
+ # BEAM WIDTH ANALYSIS
486
+
487
+ Table 5 reports how beam width affects the decoding performance on the USPTO-15k dataset.
488
+ Surprisingly, the top-1 accuracy in case of beam width3 of 1 is higher than the those when beam widths range from 2 to 15. It means that large beam width is not always good in our situation.
489
+ However, at beam width of 20, our beam search achieves the best results for different values of $k$ .
490
+ Thus, we set the beam width to 20 in subsequent experiments.
491
+
492
+ # A.5 USING REAGENT INFORMATION EXPLICITLY
493
+
494
+ As can be seen from Table 6, reagent molecules account for about a half of the input molecules on average and $60 \%$ of all reactions containing reagents. It suggests that the proper use of reagent information will lead to better prediction. In our model, before computing the scores for all atom pairs, we append to the representation vector of every atom a binary scalar indicating whether this atom comes from a reagent molecule or not. Then, at the top- $K$ atom pair selection step, we also exclude all atom pairs that have either atoms belong to a reagent molecule. The improvement in prediction accuracy on the validation set of $U S P T O – I 5 k$ is shown in Fig. 4.
495
+
496
+ # A.6 COMPARISON WITH ELECTRO
497
+
498
+ In method Both GTPN and ELECTRO (Bradshaw et al., 2018) are able to explain the mechanism behind a reaction. ELECTRO regards a reaction as an ordered sequence that alternates between removing and adding a single bond. Our model, on the other hand, assumes no specific order of transformations as well as the amount of valences that a bond can change. Thus, our model is more generic than ELECTRO and can cover a much larger set of reactions.
499
+
500
+ <table><tr><td>Algorithm 1 Reaction triple prediction using beam search.</td></tr><tr><td>Input: A multi-graph G consisting of reactant and reagent molecules, number of bond types E, max prediction steps T,beam width N</td></tr><tr><td>1: P0=[(-1,-1,-1,-1),] DThe best N subsequences of(ε,u,v,b)</td></tr><tr><td>2: s0 =[0,..] DThe length-normalized log joint probabilities of the best N subsequences 3: Co=[True,.] DThe continuation indicator of the best N subsequences</td></tr><tr><td>4: Perform L steps of message passing for all nodes using Eq. (1)</td></tr><tr><td>5:x=xii∈V DThe initial states of all nodes before decoding 6: N(i)=N(i) ∀i ∈V DThe initial neighbor set of all nodes before decoding</td></tr><tr><td>7: h° is loaded from the saved model DThe initial RNN hidden state before decoding</td></tr><tr><td>8: for T from 1 to T do</td></tr><tr><td>9: Find the top K atom pairs {(uk, Uk)T |k = 1,K} using Eqs. (4,5)</td></tr><tr><td>10: ST-1:0 = ST-1× T-1 Superscript O denotes the sub-step 0</td></tr><tr><td>PT-1:0 = PT-1;CT-1;0 =CT-1 11:</td></tr><tr><td>12: Beam search for continuation signals</td></tr><tr><td>13:</td></tr><tr><td>14: Rsignal =@ DStores the log joint probabilities for N × 2 possible signals</td></tr><tr><td>15: for n from 1 to N do 16: Computep (|Pn-1:0)usingEq. (6)</td></tr><tr><td>17: AddCT-i0× 1 logp(εT =δ| Pπ-10)+ S-1:0 to Rsignal forδ∈ {True,False}</td></tr><tr><td>18: end for</td></tr><tr><td>19: Sort Rsignal in descending order</td></tr><tr><td>20:</td></tr><tr><td>21:</td></tr><tr><td>22:</td></tr><tr><td>Pr-1;1 =extract (-, 23: CT-1;1 = extract (CT-1;0,[-1;1)</td></tr><tr><td>24: 25:</td></tr><tr><td>26:</td></tr><tr><td></td></tr><tr><td>27: Beam search for atom pairs 28:</td></tr><tr><td>29: Ratom pair = @ DStores the log joint probabilities for N × K possible atom pairs</td></tr><tr><td>30: for n from 1 to N do 31: Compute p (u,u)|Sn,P-1;1) using Eq. (7)</td></tr><tr><td>Add CT-i1 ×1logp((uU)sn,P-1;1)+S-1:1 to Ratompairk ∈1,K 32:</td></tr><tr><td>33: end for</td></tr><tr><td>Sort Ratom pair in descending order 34:</td></tr><tr><td>35:</td></tr><tr><td>36:</td></tr><tr><td>37:</td></tr><tr><td>Pt-1;2 = extract (P-1;1,[-1;2) 38:</td></tr><tr><td>39: CT-1;2 = extract (C-1;1,;2)</td></tr><tr><td>40: = extract (,-1;2)</td></tr><tr><td>41:</td></tr></table>
501
+
502
+ Algorithm 2 Reaction triple prediction using beam search (cont.)
503
+
504
+ <table><tr><td>45:</td><td>for n from1 to N do</td></tr><tr><td>46:</td><td>Compute p (bT 1(E,u,o)n,P-1) using Eq. (8)</td></tr><tr><td>47:</td><td>AddCT-i;2× ↓logp (bT =β|(ξ,u,u),Pπ-1) + S[-1 to Rbond ∀β ∈1,B</td></tr><tr><td>48:</td><td>end for</td></tr><tr><td>49:</td><td> Sort Rbond in descending order</td></tr><tr><td>50:</td><td>ST-1;3 = RO:N Rbond</td></tr><tr><td>51:</td><td></td></tr><tr><td>52:</td><td></td></tr><tr><td>53:</td><td>PT-1;3 = extract (Pr-1;2, [T-1;3)</td></tr><tr><td>54:</td><td>CT-1;3 = extract (CT-1;2, [T-1;3)</td></tr><tr><td>55:</td><td>T = extract (T,IT-1;3)</td></tr><tr><td>56:</td><td>(u,u)T = extract (u,u)T,IT-1;3)</td></tr><tr><td>57:</td><td></td></tr><tr><td>58:</td><td>ST = ST-1;3;CT = CT-1;3</td></tr><tr><td>59:</td><td>P =append(P-1:3,(,u,U,b)n)</td></tr><tr><td>60:</td><td>for n from1 to N do</td></tr><tr><td>61:</td><td>Update the NT(un) and NT(Un) for all n = 1,N using Eqs. (26,27)</td></tr><tr><td>62:</td><td>Update xun and xn using Eq. (1)</td></tr><tr><td>63:</td><td>Perform m steps of message passing for all nodes in the graph</td></tr><tr><td>64:</td><td>Update husing Eq. (25)</td></tr><tr><td>65:</td><td>end for</td></tr><tr><td colspan="2">66: end for Output: PT,ST</td></tr></table>
505
+
506
+ Table 6: Proportion of reactions containing reagents and proportion of reagents over input molecules on USPTO-15k and USPTO.
507
+
508
+ <table><tr><td rowspan=1 colspan=2>Dataset</td><td rowspan=1 colspan=1>%reactionscontaining reagents</td><td rowspan=1 colspan=1>%reagents over input molecules</td></tr><tr><td rowspan=3 colspan=1>USPTO-15k</td><td rowspan=1 colspan=1>train</td><td rowspan=1 colspan=1>63.1%</td><td rowspan=1 colspan=1>41.3%</td></tr><tr><td rowspan=1 colspan=1>valid</td><td rowspan=1 colspan=1>65.3%</td><td rowspan=1 colspan=1>42.3%</td></tr><tr><td rowspan=1 colspan=1>test</td><td rowspan=1 colspan=1>63.6%</td><td rowspan=1 colspan=1>40.9%</td></tr><tr><td rowspan=3 colspan=1>USPTO</td><td rowspan=1 colspan=1>train</td><td rowspan=1 colspan=1>79.7%</td><td rowspan=1 colspan=1>54.0%</td></tr><tr><td rowspan=1 colspan=1>valid</td><td rowspan=1 colspan=1>80.0%</td><td rowspan=1 colspan=1>54.4%</td></tr><tr><td rowspan=1 colspan=1>test</td><td rowspan=1 colspan=1>79.9%</td><td rowspan=1 colspan=1>54.2%</td></tr></table>
509
+
510
+ ![](images/f49e2a5a755feff77e408c1dc8e86781a7fed33932c72027630272324b583ea6.jpg)
511
+ Figure 4: Learning curves of our model with and without using reagent information explicitly on USPTO-15k.
512
+
513
+ Table 7: Results for the reaction prediction task. $P \ @ k$ is the precision at $k$ . Best results are highlighted in bold. Meanings of markers in our model: $\diamondsuit$ : With beam search (beam width $= 2 0$ ), $\spadesuit$ : Invalid product removal, $\mathbf { \hat { \psi } } _ { \mathbf { * } }$ : Duplicate product removal.
514
+
515
+ <table><tr><td rowspan=2 colspan=1>Model</td><td rowspan=1 colspan=3>Processed USPTO</td></tr><tr><td rowspan=1 colspan=1>P@1</td><td rowspan=1 colspan=1>P@3</td><td rowspan=1 colspan=1>P@5</td></tr><tr><td rowspan=1 colspan=1>WLDN (Jin et al., 2017)</td><td rowspan=1 colspan=1>84.0</td><td rowspan=1 colspan=1>91.1</td><td rowspan=1 colspan=1>92.3</td></tr><tr><td rowspan=2 colspan=1>ELECTRO (Bradshaw et al., 2018)GTPN**</td><td rowspan=1 colspan=1>87.0</td><td rowspan=1 colspan=1>94.5</td><td rowspan=1 colspan=1>95.9</td></tr><tr><td rowspan=1 colspan=1>87.35</td><td rowspan=1 colspan=1>90.22</td><td rowspan=1 colspan=1>90.68</td></tr></table>
516
+
517
+ ![](images/aebc50a959e34bea76abae1e557fd21e1b1f51ece918963e01707e0931304628.jpg)
518
+ Figure 5: Performance with respect to different numbers of bond changes. (a) Top-1 accuracy. (b) Errors grouped by length. In (a), blue: all reactions having that sequence length; orange: correct predicted reactions. In (b), red: the predicted sequence is shorter (than the groundtruth sequence); green: the predicted and the groundtruth have the same length; blue: the predicted sequence is longer; number indidate the average length.
519
+
520
+ In performance To do a fair comparison with ELECTRO (Bradshaw et al., 2018), we follow their procedure described in the paper to prepare a new test set that contains only reactions with linear chain topology and single-valence bond changes. It results in 29,808 reactions, close to the reported number of 29,360 in (Bradshaw et al., 2018). We reuse our old model (see Section 3.4) trained on the original USPTO dataset. We also use beam search decoding and post-processing as similar to (Bradshaw et al., 2018). From Table 7, we see that GTPN achieves the highest top-1 accuracy of $8 7 . 3 5 \%$ , outperforming ELECTRO and WLDN by $0 . 3 5 \%$ and $3 \%$ , respectively. For the top-3 and top-5 accuracies, our model, however, does worse than the other two. Especially, while both ELECTRO and WLDN have big jumps from $P \ @ { \cal I }$ to $P ( \omega 3$ with about $7 \%$ improvement, GTPN only has $3 \%$ increase. We conjecture that this problem mainly comes from the fact that GTPN was not optimized on the compatible training and validation sets.
521
+
522
+ # A.7 ERROR ANALYSIS
523
+
524
+ In this section, we analyze several error types that our model makes during prediction. All the results below are computed on the USPTO-15k dataset by using beam search decoding with the beam width $N = 2 0$ and no post-processing.
525
+
526
+ Errors grouped by number of bond changes Fig. 5 shows the top-1 accuracies for reactions with different number of bond changes. Our model performs poorly on reactions with many bond changes. However, those kinds of reactions only accounts for a small proportion in the dataset. From Fig. 5b, we see that the lengths of the error sequences tends to be shorter than the lengths of the groundtruth sequences.
527
+
528
+ Errors caused by signal/atom pair/bond type We define a sub-action causing error as the first sub-action that our model makes a wrong decision. In Fig. 6a, we plot the the proportion of errors with respect to the three kinds of sub-actions. Clearly, atom pair prediction causes the most errors
529
+
530
+ ![](images/4f2ec61d977e14daa78a49521f7d4f16a8bd5f1d149bfd67fb5ba89e7f0dd975.jpg)
531
+
532
+ (a) Proportion of the first incorrect sub-action that our model makes.
533
+
534
+ ![](images/1fa8e0b536b959f903902913cdcd3bc4058776fee20d292f2bb349e260285dcb.jpg)
535
+ (b) Proportion of the incorrect top-1 products that have similar structure to the groundtruth products.
536
+
537
+ Figure 6: Errors grouped by the first incorrect sub-actions (a), and errors caused by symmetric structures (b).
538
+
539
+ (nearly two third). This makes sense because this sub-action is harder than signal prediction and bond type prediction. Therefore, more effort should be put on improving the prediction of atom pairs.
540
+
541
+ Errors caused by symmetry There exists cases in which different sequences of bond changes can result in the same products due to symmetric graph structures. Errors caused by symmetry account for $5 . 7 \%$ of the top-1 errors on the USPTO-15k dataset as shown in Fig. 6b. For better understanding, we provide a short list of wrong reaction triple predictions caused by symmetry in Fig. 7. In this list, the top-1 products (along the second column) are incorrect while the top-2 products (along the third column) are correct though both have the same probability.
542
+
543
+ ![](images/c508e5522ddc1d32c7b23e4219b31cd604fecc99998016a648a66b09069a3155.jpg)
544
+ Figure 7: Visualization of some reactions that cause multiple products with symmetric structures. Each row corresponds to a reaction. The columns, from left to right, show: i) reactant and reagent molecules, ii) incorrect top-1 product molecules, iii) correct top-2 product molecules, and iv) major groundtruth product molecules. All atoms in the first three columns are labeled with their atom map numbers. For the top-1 and top-2 products, we highlight the predicted reaction triples in green and provide the probability of the predicted sequence at the bottom.
md/train/r1ledo0ctX/r1ledo0ctX.md ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONSISTENCY-BASED ANOMALY DETECTION WITH ADAPTIVE MULTIPLE-HYPOTHESES PREDICTIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In one-class-learning tasks, only the normal case can be modeled with data, whereas the variation of all possible anomalies is too large to be described sufficiently by samples. Thus, due to the lack of representative data, the wide-spread discriminative approaches cannot cover such learning tasks, and rather generative models, which attempt to learn the input density of the normal cases, are used. However, generative models suffer from a large input dimensionality (as in images) and are typically inefficient learners. We propose to learn the data distribution more efficiently with a multi-hypotheses autoencoder. Moreover, the model is criticized by a discriminator, which prevents artificial data modes not supported by data, and which enforces diversity across hypotheses. This consistency-based anomaly detection (ConAD) framework allows the reliable identification of outof-distribution samples. For anomaly detection on CIFAR-10, it yields up to $3 . 9 \%$ points improvement over previously reported results. On a real anomaly detection task, the approach reduces the error of the baseline models from $6 . 8 \%$ to $1 . 5 \%$ .
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Anomaly detection classifies a sample as normal or abnormal. In many applications, however, it must be treated as a one-class-learning problem, since the abnormal class cannot be defined sufficiently by samples. Samples of the abnormal class can be extremely rare, or they do not cover the full space of possible anomalies. For instance, in an autonomous driving system, we may have a test case with a bear or a kangaroo on the road. For defect detection in manufacturing, new, unknown production anomalies due to critical changes in the production environment can appear. In medical data analysis, there can be unknown deviations from the healthy state. In all these cases, the well-studied discriminative models, where decision boundaries of classifiers are learned from training samples of all classes, cannot be applied. The decision boundary learning of discriminative models will be dominated by the normal class, which will negatively influence the classification performance.
12
+
13
+ Anomaly detection as one-class learning is typically approached by generative, reconstruction-based methods (Zong et al., 2018) . They approximate the input distribution of the normal cases by parametric models, which allow them to reconstruct input samples from this distribution. At test time, the data log-likelihood serves as an anomaly-score. In the case of high-dimensional inputs, such as images, learning a representative distribution model of the normal class is hard and requires many samples.
14
+
15
+ Typically, an autoencoder-based approach such as the variational autoencoder (Rezende et al., 2014; Kingma & Welling, 2013) is used. Autoencoders tend to produce blurry reconstructions, since they regress the conditional mean, and cannot model multi-modal distributions; see Fig. 1 for an example on a Metal Anomaly dataset. Due to multiple modes in the actual distribution, the approximation with the mean predicts high probabilities in areas not supported by samples. The blurry reconstructions in Fig. 1 should have a low probability and be classified as anomalies, but they have the highest likelihood under the learned autoencoder.
16
+
17
+ Multiple-hypotheses networks could give the model more expressive power Rupprecht et al. (2016a), Chen & Koltun (2017), Ilg et al. (2018), Bhattacharyya et al. (2018). In conjunction with autoencoders, the multiple hypotheses can be realized with a multi-headed decoder. Concretely, each network head may predict a Gaussian density estimate.
18
+
19
+ ![](images/ef470e6280d37f1ec034bda8c0cd78fd1eec2845b39487603649af6ee770a45d.jpg)
20
+ Figure 1: Detection of anomalies on a Metal Anomaly dataset. (a) Test images showing anomalies (black spots). (b) An Autoencoder-based approach produces blurry reconstructions to express model uncertainty (c) Our model: Consistency-based anomaly detection (ConAD) gives the network more expressive power with a multi-headed decoder (also known as multiple-hypotheses networks). The resulting anomaly scores are hence much clearer in our framework ConAD.
21
+
22
+ Multiple-hypotheses networks were not yet applied to anomaly detection due to several difficulties in training these networks to produce a multi-modal distribution consistent with the training distribution. The loosely coupled hypotheses branches are typically learned with a winner-takes-all loss, where all learning signal is transferred to one single best branch. Hence, bad hypotheses branches are not penalized and may support non-existing data regions. The artificial data modes, therefore, cannot be distinguished from normal data. This is an undesired property for anomaly detection and becomes more severe with an increasing number of hypotheses. Furthermore, the majority of multiple-hypotheses-branches tend to concentrate on the most dominant data modes. This hypotheses concentration leads to over-fitting in the neighborhood of dominant modes and under-fitting in underrepresented data regions. This, too, has a negative effect on the estimated anomaly scores.
23
+
24
+ Alternatively, mixture density networks (MDNs) (Bishop, 1994) provide a strict coupling of hypotheses branches. These models learn a conditional Gaussian mixture distribution. Hence, the hypotheses are coupled via mixing coefficients into a single likelihood function. Anomaly scores for new points can be estimated using the data likelihood, as formally defined in Appendix A.
25
+
26
+ Fig. 2 illustrates the different strategies. A single-mode autoencoder (b) fails in case of multi-modal distributions. MDNs (c) in principle can be used for abnormality detection even for multimodal distributions. However, global, multi-modal distribution estimation is a hard learning problem that does not work as perfectly in practice as shown in this illustration. For instance, MDNs tend to suffer from mode collapse in high-dimensional data spaces, i.e., the relevant data modes needed to distinguish rare but normal data from anomalies will be missed. Contrary, Local-outlier-factor operates in images-space directly without training which (1) fails in very high-dimensional spaces (2) is slow at test time.
27
+
28
+ In this work, we adopt multiple-hypotheses networks for anomaly detection to provide a more finegrained description of the data distribution than a single-headed network. Hypotheses are meant to form clusters in the data space and can capture model uncertainty not encoded by the latent code. We reduce the problem of artificial data modes by combining multiple-hypotheses learning with a discriminator D as a critic. The discriminator ensures the consistency of estimated data modes w.r.t. the real data distribution.
29
+
30
+ Moreover, we propose to focus on the local neighborhood and to estimate the fit of a sample to the distribution model based on the distance to the closest cluster. This avoids issues with global distribution estimation methods, such as mode collapse. Hypotheses rather act as local, single mode density estimates and are easier and more sample-efficient to learn than a full multi-modal distribution. Fig. 3c shows our framework applied to a variational autoencoder.
31
+
32
+ We evaluate anomaly detection performance of our approach on CIFAR-10 and a real anomaly image dataset, the ”Metal Anomaly dataset” with images showing a structured metal surface, where anomalies in the form of scratches, dents or texture differences are to be detected. We show that anomaly detection performance with multiple-hypotheses networks is significantly better compared to single-hypotheses networks. On CIFAR-10, our proposed ConAD framework (consistency-based anomaly detection) improves on previously published results. Furthermore, we show a large performance gap between ConAD and Mixture Density networks (MDNs). This indicates that anomaly score estimation based on the global neighborhood (or data likelihood) is inferior to local neighborhood consideration.
33
+
34
+ ![](images/87dd28c912d20d443ecb71ac416daadc4becc6bb6fcb05edd29204e9aa8a4f62.jpg)
35
+ Figure 2: Local and global neighborhood-based anomaly detection: Here, two pixel dimensions (a) with details that are hard to capture in the conditional space are shown. The red dot is a new point. Dark blue indicates high likelihood, black indicates the neighborhood considered. The autoencoder (b) cannot deal with the multi-modal distribution. The mixture density network (c) in principle can do so, but recognition of the sample as a normal case is very brittle and will fail in case of mode collapse. In contrast, Local-Outlier-Factor (d) and our model (e) consider only the local neighborhood for anomaly score estimation and more reliably classify the point. In our model, we encourage multiple hypotheses to cover different modes. In each hypothesis branch, the probability mass is distributed only within the cluster and not beyond.
36
+
37
+ # 2 ONE-CLASS LEARNING FOR ANOMALY DETECTION
38
+
39
+ Traditional one-class learning techniques (Scholkopf et al., 2001; Tax & Duin, 2004; Liu et al., 2008; ¨ 2012; Breunig et al., 2000) often fail in high-dimensional input domain and require careful features selection (Zong et al., 2018) . To cope with high-dimensional domains, typically a reconstructionbased approach is used. This paradigm comprises two steps: (1) during training, learn the normal data distribution and (2) at test time, use the negative likelihood for contaminated data as their anomaly score.
40
+
41
+ Recently, advances in generative modeling such as Generative Adversarial Network (GAN) (Goodfellow et al., 2014) and Variational Autoencoder (VAE) (Rezende et al., 2014; Kingma & Welling, 2013) are used for anomaly detection (Zong et al., 2018; Schlegl et al., 2017; Deecke et al., 2018). However, GAN and VAE approaches have limitations in anomaly detection tasks. The GAN tends to assign less probability mass to real samples while VAE typically regress to the conditional means, which can be seen from the blurry reconstructions. The mean regression in VAE express the model uncertainty and falsify the reconstruction-errors for unseen images.
42
+
43
+ One simple way to address model uncertainty in VAE is giving the decoder additional expressive power with multi-headed decoders. The idea is to approximate multiple conditional modes (dense data regions) by using multiple headed networks. This idea leads to training of multiple networks in Multi-Choice-learning (Dey et al., 2015; Lee et al., 2017; 2016), the estimation of conditional Gaussian Mixture model in Mixture Density Network (MDN) (Bishop, 1994) and multiple-hypotheses predictions (MHP) (Ilg et al., 2018; Chen & Koltun, 2017; Bhattacharyya et al., 2018; Rupprecht et al., 2016a). In MDN, the mixtures are strictly coupled via mixture coefficients while mixtures in MHPs act as loosely coupled local density estimators. In MHP, only the best hypothesis branch will receive a learning signal, that is, if it makes the closest guess to the training sample.
44
+
45
+ For anomaly detection, our model uses MHP-training with VAE to address the model uncertainty directly. In MDN, the anomaly score is proportional to weighted distances to all data modes and in MHP only to closest data mode. To highlight the change in paradigm, we refer to this learning in MHP as consistency-based learning. Samples have a small effect on the loss as long they are close to one single data mode. The learning dynamic in MHP is also different and more efficient than in MDN: the number of samples with a high loss is lower. In this context, we relax the learning objective from density-based to consistency-based learning.
46
+
47
+ ![](images/908bc9f50f411e0e20498711f3e771d5aac935b7a58914460d839641db5eec7a.jpg)
48
+ (a) Single-headed networks (b) Multi-headed networks (c) Multi-headed network with discriminator training
49
+ Figure 3: Illustration of multiple-hypotheses networks compared to single-hyptohesis network.. Our ConAD framework (c), which integrates a discriminator $\mathbf { D }$ to avoid support of non-realistic data modes and foster higher mode coverage with the generated hypotheses.
50
+
51
+ In Local Outlier Factor (LOF) (Breunig et al., 2000), the outlier-score only depends on the local neighborhood. The outlier score proportional to the mean density of neighboring points divided by the local point density. Hence, samples further away do not influence the outlier-score. Motivated by this heuristic, our model employs learning of many loosely decoupled local density estimates with MHP-learning. Our model (1) concentrates only on the closest data mode instead of considering the data likelihood for outlier detection (2) and enables easier learning due to consistency-based learning instead of full density estimation. LOF computes the outlierness only on test-time and in input spaces directly. Contrary, our model first approximate the data manifold and subsequently performs anomaly detection in the input space under the learned model.
52
+
53
+ The MHP-technique has been used for uncertain tasks such as future prediction (Rupprecht et al., 2016b) or optical flow prediction (Ilg et al., 2018). In the simplest form, the multiple networks heads learn from a winner-takes-all (WTA) loss, whereby only the best branch receives the learning signal. Previous works employ loss extension such as the use of a smoothing loss (Ilg et al., 2018) or distribution of learning signal to non-optimal branches (Rupprecht et al., 2016b) to generate diverse and meaningful hypotheses.
54
+
55
+ Compared to our framework, previous MHP-approaches were not developed for distribution learning. There is no explicit mechanism to avoid mode collapse among hypotheses. Furthermore, generated hypotheses could support non-existing data regions, which can be fatal for anomaly detection tasks. Contrary, our framework ConAD employs a discriminator D to assess the quality of the generated hypotheses and to avoid support of non-existent data modes. To reduce hypotheses mode collapse, our model employs hypotheses discrimination. In the spirit of minibatch discrimination (Salimans et al., 2016), D additionally receives pair-wise distances across a batch of hypotheses. Since a batch of real samples is typically diverse, D can detect a homogeneous batch of hypotheses as fake easily.
56
+
57
+ # 3 LEARNING WITH MULTIPLE-HYPOTHESES-PROPOSALS (MHP) NETWORKS FOR ANOMALY DETECTION
58
+
59
+ Typically in distribution learning, Autoencoder-approaches regress the means and produce blurry reconstructions. Therefore, we propose to employ MHP as additional expressive power for the decoder (Fig 3 (a-b)). First, we discuss two possible shortcomings of multiple-hypotheses learning: support of artificial data mode and hypotheses mode collapse. Subsequently, we show how to reduce these effects with discriminator training and hypotheses discrimination $( { \mathrm { F i g ~ } } 3 \ \mathrm { c } )$ .
60
+
61
+ # 3.1 SHORTCOMING OF MULTIPLE-HYPOTHESES LEARNING
62
+
63
+ Support of artificial data mode in one-to-many mapping tasks To understand the shortcomings of learning with multiple-hypotheses-proposals (MHP), first consider a simple one-to-many mapping task from $x$ to $y$ as given in Fig. 4. Unimodal models (i.e., single-headed networks) fail to capture to data distribution.
64
+
65
+ ![](images/2e71b28af27740eb8e0d83eae8659930e8ecbcba7718396e73119258939e9124.jpg)
66
+ Figure 4: Flipped half-moon data-set: mapping from $x$ to $y$ is not unique, e.g. for $x = 0$ , there are four different modes. Left to right: with an increasing number of mixture components in a mixture density network, the data distribution can be modeled increasingly well.
67
+
68
+ Similar to Mixture Density networks, each hypothesis branch in MHP-networks represents a Gaussian density function with a mean and variance. Typically, MHP-networks learns from the winnertakes-all (MHP-WTA) loss in Eq. 1:
69
+
70
+ $$
71
+ L _ { W T A } ( y | x ) = E _ { x _ { i } } \left[ \log p \theta _ { h } ( y | x _ { i } ) \right] \mathbf { s . t . } h = \arg \operatorname* { m a x } _ { j } E _ { x _ { i } } \left[ \log p \theta _ { j } ( y | x _ { i } ) \right]
72
+ $$
73
+
74
+ Whereby $\theta _ { j }$ is the parameter set of hypothesis branch $j$ , $\theta _ { h }$ the best hypothesis concerning data likelihood given a sample $x _ { i }$ . In other words, only the network head with the best-matching hypothesis concerning the training samples receives the learning signal. The best hypothesis is the one with the highest sample likelihood (or minimal distance to sample if the variance is equal for all hypotheses). Additionally, Rupprecht et al. (2016a) proposed a $\epsilon$ -smoothed loss. With this loss, a small $\epsilon$ -ratio of the learning signal is distributed among non-optimal hypotheses branches. We refer to this loss as learning with MHP-loss (Appendix 11).
75
+
76
+ However, learning with MHP or MHP-WTA may result in support of artificial (non-existing) data modes. Fig. 5 illustrates this problem, which we refer to as inconsistency concerning the underlying distribution. In regions where the half-moon abruptly ends, the hypotheses (in MHP and MHPWTA) continue and support non-existing data regions. This inconsistency effect is fatal for anomaly detection. More details can be found in the experiments on the toy dataset in the appendix B. Intuitively, in learning with the winner-takes-all loss, the non-optimal hypotheses are not penalized.
77
+
78
+ ![](images/47bb3f3814a9c629bf32a661661ff1c54dba816941fa43285f1464242ead95ae.jpg)
79
+ Figure 5: Flipped half-moon dataset: conditional prediction of $y$ based on $x$ . Red points are samples from true distribution while blue points represent samples from distributions approximations. Learning with multiple-hypotheses predictions (MHP) loss or $\mathrm { M H P + }$ Winner-takes-all (WTA) loss lead to support of artificial data regions. Our approach ConAD reduces this effect.
80
+
81
+ Therefore they can support artificial data regions without being informed via the learning signal. A more formal discussion can be found in Appendix D.
82
+
83
+ The learning signal distribution with $\epsilon$ -parameter attempts to reduce support of artificial regions. However, finding gowith MHP-WTA. If $\epsilon$ ucial and d, whereby cult. If is the n $\epsilon = 0$ , the MHP loss corresponds to learning of hypotheses branches, all hypotheses $\epsilon = \textstyle { \frac { H - 1 } { H } }$ $H$ will regress to the same conditional mean. A more formal discussion can be found in Appendix E. Additionally, $\epsilon$ is an additional hyper-parameter to be chosen. Choosing proper hyper-parameters in one-class-learning is difficult since there is no anomaly available at training time.
84
+
85
+ Distribution learning with Autoencoder as a one-to-many mapping task Training Autoencoders with likelihood-metric often results in blurry reconstructions. This blurriness is fatal for anomaly detection since it falsifies the reconstructions error. This effect can be understood as a regression to the conditional mean. That means, after training convergence, each point on the learned manifold still represents many different data points in the input space. In other words, the mapping from latent code to input space is a one-to-many mapping.
86
+
87
+ Certainly, in the optimal training case, each point on the data manifold should represent one single input vector. However, this optimality requires either significantly more data to reduce the model uncertainty or powerful encoder network and latent code or both. Contrary, we propose to let the Autoencoder express the model uncertainty with the multiple-hypotheses directly. Hence, the change to Autoencoder is very simple, and no more data is required than before.
88
+
89
+ Mode collapse across hypotheses Furthermore, with the MHP and MHP-WTA learning objective, the hypotheses are encouraged to cover the existing modes. When there are more hypotheses available than data modes, most of the hypotheses will tend to concentrate on the most dominant data modes. This mode collapse can be avoided by enforcing diversity across hypotheses, which is similar to maximizing inter-class variance across clusters defined by the hypotheses.
90
+
91
+ # 3.2 CONSISTENCY-BASED ANOMALY DETECTION (CONAD) WITH MHP AND DISCRIMINATOR D
92
+
93
+ ![](images/88d97c9b6fb55dec26316fb16ad13df28a3244af183ff7530ca67f0818ce91ce.jpg)
94
+ Figure 6: (a) shows a modeling task with one extremely dominant data mode (dense region) and one under-represented mode. (b) shows how multiple-hypotheses predictions are used to cover data modes. Hypotheses tend to concentrate on dominant mode, which leads to over-fitting in this region. (c) Increasing diversity across hypotheses (similar to maximizing inter-class variance) leads to better clusters
95
+
96
+ We propose multiple-hypotheses Variational Autoencoder (VAE) for learning the normal data distribution for anomaly detection tasks. Each hypothesis branch can be seen as a cluster in the data conditional space. Anomalies are detected using the distance to next local clusters, in contrast to distances to all clusters in Mixture Density networks (MDN) (Bishop, 1994). To avoid coverage of non-existing data regions by the hypotheses, we propose to use a discriminator as a critic. Further, we employ hypothesis discrimination to encourage diversity among hypotheses. This constraint is similar to the improvement of inter-class variance among clusters. The details are explained in the following.
97
+
98
+ Learning with multiple-hypotheses predictions (MHP) in Variational Autoencoder In this work, we consider distribution learning in an Autoencoder as a one-to-many-mapping. We propose to let the network express the model uncertainty in the conditional input space with multiple hypotheses predictions (MHP). The hypotheses can be seen as a set of local density estimates (or cluster). In contrast to that, Mixture Density Network (MDN) predicts a Gaussian Mixture model in the conditional space. We refer to this estimate as a global density estimate.
99
+
100
+ ![](images/5e99c51301b75784af1c1c0954f58f283d5a5bc141d997c077bfb0b1e2491d4c.jpg)
101
+ Figure 7: ConAD: our multiple-hypotheses autoencoder and with the training discriminator training.
102
+
103
+ The learning of different hypotheses is performed based on a winner-takes-all-objective as given in Eq. 2.
104
+
105
+ $$
106
+ L _ { W T A } ( x ) = E _ { z _ { i } \sim q _ { \phi } ( z _ { i } | x ) } \left[ \log p \theta _ { h } ( x | z _ { i } ) \right] \ \mathrm { s . t . } \ h = \arg \operatorname* { m a x } _ { j } E _ { z _ { i } \sim q _ { \phi } ( z _ { i } | x ) } \left[ \log p \theta _ { j } ( x | z _ { i } ) \right] \
107
+ $$
108
+
109
+ Whereby $L _ { W T A }$ is the winner-takes-all energy function, $1 \leq j \leq H$ indicates the different hypotheses networks, $z _ { i }$ the respective latent code. To reduce free parameters, hypotheses networks with params $\theta _ { j }$ share all layers but the last output layer. Intuitive, it means that only the best matching hypothesis receives all of the learning signals from the negative log-likelihood (NLL) loss during training.
110
+
111
+ An efficient variant to realize MHP in neural networks is by using multi-headed-networks. In this variant, only the last layer is split to provide different hypotheses. All other layers are shared as shown in Fig. 3c. Our framework is based on the Variational Autoencoder (Kingma & Welling, 2013; Rezende et al., 2014) which provides an effective manifold learning and an efficient inference stage with a parameterized encoder $q _ { \phi }$ .
112
+
113
+ Discriminator D to avoid non-existent mode coverage and mode collapse of hypotheses Hypotheses generated by the MHP-networks could support artificial data regions not covered by real samples due to the WTA loss. To alleviate this, we propose to match the density estimates with MHP to the real underlying density. The auxiliary task is to learn from a symmetric variant of the Kullback-Leibler divergence (KLD). In detail, we employ the Jensen-Shannon divergence (JSD)- metric by using discriminator $\mathbf { D }$ as a critic for generated hypotheses. Fig. 3c illustrates a sample realization with VAE.
114
+
115
+ More concretely, the $\mathrm { D }$ and $\mathbf { G }$ are in a mini-max game in Eq. 3.
116
+
117
+ $$
118
+ \operatorname* { m i n } _ { D } \operatorname* { m a x } _ { G } L _ { D } ( x , z ) = \operatorname* { m i n } _ { D } \operatorname* { m a x } _ { G } \underbrace { - \log ( p _ { D } ( x _ { r e a l } ) ) } _ { L _ { r e a l } } + L _ { f a k e } ( x , z )
119
+ $$
120
+
121
+ $$
122
+ L _ { f a k e } ( x , z ) = \log ( p _ { D } ( \hat { x } _ { z \sim \mathcal { N } ( 0 , 1 ) } ) ) + \log ( p _ { D } ( \hat { x } _ { z \sim \mathcal { N } ( \mu _ { z \mid x } , \Sigma _ { z \mid x } ) } ) ) + \log ( p _ { D } ( \hat { x } _ { \mathrm { b e s t . g u e s } } ) )
123
+ $$
124
+
125
+ In this energy formulation, the standard GAN loss is extended to assure the quality of generated hypotheses. Figure 7 illustrates how samples are fed into the discriminator. Samples labeled as fake are: randomly-sampled images $\hat { x } _ { z \sim \mathcal { N } ( 0 , 1 ) }$ , data reconstruction defined by individual hypotheses $\hat { x } _ { z \sim \mathcal { N } ( \mu _ { z \mid x } , \sum _ { z \mid x } ) }$ , the best combination of hypotheses according to the Winner-takes-all-loss xˆbest guess.
126
+
127
+ Accordingly, the learning objective for the VAE generator becomes:
128
+
129
+ $$
130
+ \displaystyle \operatorname* { m i n } _ { G } L _ { G } = \displaystyle \operatorname* { m i n } _ { G } L _ { W T A } + K L D ( q _ { \phi } ( z | x ) | | \mathcal { N } ( 0 , 1 ) ) - L _ { D }
131
+ $$
132
+
133
+ <table><tr><td rowspan="2">Name</td><td rowspan="2">Problem</td><td rowspan="2">Tasks</td><td rowspan="2">Resolution</td><td colspan="3">Normal data</td><td rowspan="2">Anomaly Test</td></tr><tr><td>Train</td><td>Valid</td><td>Test</td></tr><tr><td>CIFAR-10</td><td>1 vs.9</td><td>10</td><td>32x32</td><td>4500</td><td>500</td><td>1000</td><td>9000</td></tr><tr><td>Metal anomaly</td><td>1 vs. 1</td><td>1</td><td>224x224</td><td>5408</td><td>1352</td><td>1324</td><td>346</td></tr></table>
134
+
135
+ Table 1: Dataset description. Cifar-10 is transformed into 10 anomaly detection tasks, whereby one class is used as the normal class, the remaining classes are the anomalies. Further, note that the train & validation dataset contains only normal data samples. This scenarios resembles the typical situations where anomalies are extremely rare and not available at training time.
136
+
137
+ To address the mode collapse problem of hypotheses, we propose to employ hypotheses discrimination (based on minibatch discrimination (Salimans et al., 2016)). In each batch, the discriminator receives the pair-wise features distance across generated hypotheses. Since batches of real images have large pair-wise distances, the generator has to generate diverse outputs to avoid being detected too easily.
138
+
139
+ In summary, our framework ConAD proposes multiple-hypotheses learning with a VAE, supported by a discriminator D to avoid support of non-existing data modes and foster mode coverage. The local likelihood estimates given by the closest hypothesis are used for anomaly detection.
140
+
141
+ # 4 EXPERIMENTS
142
+
143
+ # 4.1 EXPERIMENTS DESCRIPTIONS
144
+
145
+ In this section, we focus on the evaluation of our approach compared to recent deep learning and non-deep learning techniques for one-class learning tasks. In these tasks, anomalies are extremely rare and hence not available at training time. The main effort comes from the collection of a large dataset to receive anomalies, not from the labeling activity.
146
+
147
+ The details of the proposed framework; consistency-based anomaly detection (ConAD) is explained in the following. A Variational Autoencoder Kingma & Welling (2013) with Gaussian output distribution is employed as a baseline model. The decoder is then extended to a multiple-head-network to support multiple-hypotheses. Each hypothesis itself predicts a Gaussian density estimate. The outputs from the Autoencoders are criticized by a discriminator D. The network architecture follows principles from Radford et al. (2015b) and Springenberg (2015). Fig. 3 c) shows such a network conceptually. The framework can be easily extended to recent advances in deep generative modeling. Quantitative evaluation is done on CIFAR-10 and the Metal Anomaly dataset. The typical 10-way classification task in CIFAR-10 is transformed into 10 one vs. nine anomaly detection tasks. Each class is used as the normal class once; all remaining classes are treated as anomalies. Details can be found in Tab. 1. During model training, only data from the normal data class is used, data from anomalous classes are abandoned. At test time, anomaly detection performance is measured in Area-Under-Curve of Receiver Operating Curve (AUROC) based on normalized negative log likelihood scores given by the training objective.
148
+
149
+ In Tab. 2, we evaluated on CIFAR-10 variants of our multiple-hypotheses approaches including the following energy formulations: MDN (Bishop, 1994), MHP-WTA (Ilg et al., 2018), MHP (Rupprecht et al., 2016a), ConAD, and MDN $^ +$ ConAD. We compare our methods against vanilla VAE (Kingma & Welling, 2013; Rezende et al., 2014) , VAEGAN (Larsen et al., 2015; Dosovitskiy & Brox, 2016), AnoGAN (Schlegl et al., 2017), AdGAN Deecke et al., 2018, OC-Deep-SVDD (Ruff et al., 2018). Traditional approaches considered are: Isolation Forest (Liu et al., 2008; 2012), OCSVM (Scholkopf et al., 2001). The performance of traditional methods suffers due to the curse ¨ of dimensionality (Zong et al., 2018).
150
+
151
+ Furthermore, on the high-dimensional Metal anomaly dataset, we focus only on the evaluation of deep learning techniques. The GAN-techniques proposed by previous work AdGAN & AnoGAN heavily suffer from instability due to pure GAN-training on a small dataset. Hence, their training leads to random anomaly detection performance. Therefore, we only evaluate MHP-based approaches against their uni-modal counterparts (VAE, VAEGAN).
152
+
153
+ Table 2: Anomaly detection on CIFAR-10, performance measured in AUROC. Each class is considered as the normal class once with all other classes being considered as anomalies, resulting in 10 one-vs-nine classification tasks. Performance is averaged for all ten tasks and over three runs each. See appendix for detailed performance. Our approach significantly outperforms previous traditional and deep learning methods.
154
+
155
+ <table><tr><td rowspan="2">KDE-PCA</td><td colspan="4">Traditional models</td><td colspan="3">Deep Learning models</td></tr><tr><td colspan="2">OC-SVM-PCA IF .610</td><td>GMM .558 .585</td><td></td><td>AnoGAN .612</td><td>ADGAN .620</td><td>OC-D-SVDD .632</td></tr><tr><td rowspan="2"></td><td colspan="7">Multiple hypothesis models</td></tr><tr><td>Hypotheses branches</td><td>MHP</td><td>MHP+WTA</td><td></td><td>MDN</td><td>MDN+ConAD</td><td>ConAD</td></tr><tr><td colspan="2">1</td><td></td><td>.610 (= VAE)</td><td></td><td></td><td>.609 (= VAE-GAN)</td><td></td></tr><tr><td colspan="2">2</td><td>.619</td><td></td><td>.622</td><td>.609</td><td>.616</td><td>.643</td></tr><tr><td colspan="2">4</td><td>.619</td><td></td><td>.622</td><td>.610</td><td>.621</td><td>.639</td></tr><tr><td colspan="2">8</td><td>.618</td><td></td><td>.619</td><td>.610</td><td>.623</td><td>.671</td></tr><tr><td colspan="2">16</td><td>.617</td><td></td><td>.620</td><td>.609</td><td>.614</td><td>.659</td></tr></table>
156
+
157
+ <table><tr><td></td><td colspan="5">Multiple hypothesis models</td></tr><tr><td>Hypotheses branches</td><td>MHP</td><td>MHP+WTA</td><td>MDN</td><td>MDN+ConAD</td><td>ConAD</td></tr><tr><td>1</td><td></td><td>.942 (= VAE)</td><td></td><td>.936 (= VAE-GAN)</td><td></td></tr><tr><td>2</td><td>.980</td><td>.980</td><td>.900</td><td>.942</td><td>.985</td></tr><tr><td>4</td><td>.970</td><td>.980</td><td>.910</td><td>.913</td><td>.977</td></tr><tr><td>8</td><td>.950</td><td>.946</td><td>.916</td><td>.943</td><td>.965</td></tr></table>
158
+
159
+ Table 3: Anomaly detection performance on Metal Anomaly dataset. To reduce noisy residuals due to the high-dimensional input domain, only $10 \%$ of maximally abnormal pixels with the highest residuals are summed to form the total anomaly score. AUROC is computed on an unseen test set, a combination of normal and anomaly data. For more detailed results, refer to attachment H. Anomaly detection performance of plain MHP rapidly breaks down with increasing number of hypotheses.
160
+
161
+ # 4.2 CIFAR-10
162
+
163
+ Tab. 2 shows an extensive evaluation of different traditional and deep learning techniques. Results are adapted from Deecke et al. (2018) in which the training and testing scenarios were similar. Refer to Appendix. G for more results. Traditional, non-deep-learning methods only succeed to capture classes with a dominant homogeneous background such as ships, planes, frogs (backgrounds are water, sky, green nature respectively). This issue occurs due to preceding feature projection with PCA, which focuses on dominant axes with large variance. Deecke et al. (2018) reported that even discriminative features from a pretrained AlexNet have no positive effect on anomaly detection performance.
164
+
165
+ In contrast to that, deep learning methods are performing significantly better, even without careful parameter tuning. When the MHP-technique is applied to this task, a performance comparable to previously reported deep learning, but non-MHP results is achieved. Note that having the multiple output distributions is not sufficient to meet high performance: MDNs are performing worse than the local density estimation provided by the MHP-technique. Nevertheless, the best performance is achieved in our ConAD- framework, by utilizing the flexibility of multiple hypotheses more effectively, leading to significantly higher detection performance of up to $5 . 1 \%$ absolute improvement.
166
+
167
+ # 4.3 METAL ANOMALY DATASET
168
+
169
+ Tab.3 shows an evaluation of MHP-methods against density-learning methods such as VAE (Kingma & Welling, 2013), MDN (Bishop, 1994), VAEGAN (Dosovitskiy & Brox, 2016; Larsen et al., 2015). Note that the VAE-GAN model corresponds to our ConAD with a single hypothesis. The VAE corresponds to a single hypothesis variant of MHP, MHP-WTA, and MDN.
170
+
171
+ The significant improvement of up to $4 . 2 \%$ AUROC-score comes from our relaxation of density estimation into local density estimation in the spirit of LOF (Breunig et al., 2000), i.e., each dense data region (mode) receives at least one hypothesis to cover the local density. In a high-dimensional domain such as images, anomaly detection with MDN is worse than with our approach MHP approaches. Consider images with an extremely rare value in one pixel-dimension. The Mixture Density models evaluate likelihood based on all data modes found for this pixel. In contrast to that, MHP-models only considers which data mode is the closest and computes the local likelihood as the anomaly score. The local neighborhood suppresses the over-estimation of anomaly degree compared to a global likelihood.
172
+
173
+ Using the MHP-technique, better performance is already achieved with two hypotheses. However, without the discriminator D, an increasing number of hypotheses rapidly leads to performance breakdown, due to the inconsistency property of generated hypotheses as discussed earlier. Intuitively, additional non-optimal hypotheses are not strongly penalized during training, if they support artificial data regions which are not consistent w.r.t. the real underlying data distribution.
174
+
175
+ With our framework ConAD, anomaly detection performance remains competitive or better even with an increasing number of hypotheses available. The discriminator D makes the framework adaptable to the new dataset and less sensitive to the number of hypotheses to be used.
176
+
177
+ When more hypotheses are used (8), the anomaly detection performance rapidly breaks down. We suggest that the noise is then learned too easily. Consider the extreme case when there are 255 hypotheses available. The Winner-Takes-all-loss will encourage each hypothesis branch to predict a constant image with one value from [0,255]. The discriminator D as a regularizer will try to prevent this effect. That might be a reason why our ConAD has less severe performance breakdown. Our model ConAD is less sensitive to the choice of the hyper-parameter for the number of hypotheses. It also enables better exploitation of the additional expressive power provided by the MHP-technique for new anomaly detection tasks.
178
+
179
+ # 5 CONCLUSION
180
+
181
+ In this work, we propose to employ multiple-hypotheses networks for learning data distributions for anomaly detection tasks. Hypotheses are meant to form clusters in the data space and can easily capture model uncertainty not encoded by the latent code. multiple-hypotheses networks can provide a more fine-grained description of the data distribution and therefore enable also a more fine-grained anomaly detection. Furthermore, to reduce support of artificial data modes by hypotheses learning, we propose using a discriminator D as a critic. The combination of multiple-hypotheses learning with D aims to retain the consistency of estimated data modes w.r.t. the real data distribution. Further, D encourage diversity across hypotheses with hypotheses discrimination. Our framework allows the model to identify out-of-distribution samples reliably.
182
+
183
+ For the anomaly detection task on CIFAR-10, our proposed model results in up to $3 . 9 \%$ points improvement over previously reported results. On a real anomaly detection task, the approach reduces the error of the baseline models from $6 . 8 \%$ to $1 . 5 \%$ .
184
+
185
+ # REFERENCES
186
+
187
+ Fred´ eric Bastien, Pascal Lamblin, Razvan Pascanu, James Bergstra, Ian J. Goodfellow, Arnaud ´ Bergeron, Nicolas Bouchard, and Yoshua Bengio. Theano: new features and speed improvements. Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop, 2012.
188
+
189
+ James Bergstra, Olivier Breuleux, Fred´ eric Bastien, Pascal Lamblin, Razvan Pascanu, Guillaume ´ Desjardins, Joseph Turian, David Warde-Farley, and Yoshua Bengio. Theano: a CPU and GPU math expression compiler. In Proceedings of the Python for Scientific Computing Conference $( S c i P y )$ , June 2010. Oral Presentation.
190
+
191
+ Apratim Bhattacharyya, Bernt Schiele, and Mario Fritz. Accurate and diverse sampling of sequences based on a best of many sample objective. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8485–8493, 2018.
192
+
193
+ Christopher M Bishop. Mixture density networks. Technical report, Citeseer, 1994.
194
+
195
+ Markus M Breunig, Hans-Peter Kriegel, Raymond T $\mathrm { N g }$ , and Jorg Sander. Lof: identifying density- ¨ based local outliers. In ACM sigmod record, volume 29, pp. 93–104. ACM, 2000.
196
+
197
+ Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pp. 1520–1529, 2017.
198
+
199
+ Lucas Deecke, Robert Vandermeulen, Lukas Ruff, Stephan Mandt, and Marius Kloft. Anomaly detection with generative adversarial networks. 2018.
200
+
201
+ Debadeepta Dey, Varun Ramakrishna, Martial Hebert, and J Andrew Bagnell. Predicting multiple structured visual interpretations. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2947–2955, 2015.
202
+
203
+ Sander Dieleman, Jan Schlter, Colin Raffel, Eben Olson, Sren Kaae Snderby, Daniel Nouri, Daniel Maturana, Martin Thoma, Eric Battenberg, Jack Kelly, Jeffrey De Fauw, Michael Heilman, Diogo Moitinho de Almeida, Brian McFee, Hendrik Weideman, Gbor Takcs, Peter de Rivaz, Jon Crall, Gregory Sanders, Kashif Rasul, Cong Liu, Geoffrey French, and Jonas Degrave. Lasagne: First release., August 2015. URL http://dx.doi.org/10.5281/zenodo.27878.
204
+
205
+ Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. In Advances in Neural Information Processing Systems, pp. 658–666, 2016.
206
+
207
+ 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.
208
+
209
+ Eddy Ilg, Ozg ¨ un C¸ ic¸ek, Silvio Galesso, Aaron Klein, Osama Makansi, Frank Hutter, and Thomas ¨ Brox. Uncertainty Estimates with Multi-Hypotheses Networks for Optical Flow. In European Conference on Computer Vision (ECCV), 2018. URL http://lmb.informatik. uni-freiburg.de/Publications/2018/ICKMB18. https://arxiv.org/abs/1802.07095.
210
+
211
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
212
+
213
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
214
+
215
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
216
+
217
+ Kimin Lee, Changho Hwang, KyoungSoo Park, and Jinwoo Shin. Confident multiple choice learning. arXiv preprint arXiv:1706.03475, 2017.
218
+
219
+ Stefan Lee, Senthil Purushwalkam Shiva Prakash, Michael Cogswell, Viresh Ranjan, David Crandall, and Dhruv Batra. Stochastic multiple choice learning for training diverse deep ensembles. In Advances in Neural Information Processing Systems, pp. 2119–2127, 2016.
220
+
221
+ Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation forest. In 2008 Eighth IEEE International Conference on Data Mining, pp. 413–422. IEEE, 2008.
222
+
223
+ Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation-based anomaly detection. ACM Transactions on Knowledge Discovery from Data (TKDD), 6(1):3, 2012.
224
+
225
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. arXiv:1511.06434 [cs], November 2015a. URL http://arxiv.org/abs/1511.06434. arXiv: 1511.06434.
226
+
227
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. arXiv:1511.06434 [cs], November 2015b. URL http://arxiv.org/abs/1511.06434. arXiv: 1511.06434.
228
+
229
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
230
+
231
+ Lukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexander Binder, Emmanuel Muller, and Marius Kloft. Deep one-class classification. In Jennifer Dy and ¨ Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 4393–4402, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/ v80/ruff18a.html.
232
+
233
+ Christian Rupprecht, Iro Laina, Robert DiPietro, Maximilian Baust, Federico Tombari, Nassir Navab, and Gregory D. Hager. Learning in an Uncertain World: Representing Ambiguity Through Multiple Hypotheses. arXiv:1612.00197 [cs], December 2016a. URL http://arxiv.org/ abs/1612.00197. arXiv: 1612.00197.
234
+
235
+ Christian Rupprecht, Iro Laina, Robert DiPietro, Maximilian Baust, Federico Tombari, Nassir Navab, and Gregory D. Hager. Learning in an Uncertain World: Representing Ambiguity Through Multiple Hypotheses. arXiv:1612.00197 [cs], December 2016b. URL http://arxiv.org/ abs/1612.00197. arXiv: 1612.00197.
236
+
237
+ 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.
238
+
239
+ Thomas Schlegl, Philipp Seebock, Sebastian M Waldstein, Ursula Schmidt-Erfurth, and Georg ¨ Langs. Unsupervised anomaly detection with generative adversarial networks to guide marker discovery. In International Conference on Information Processing in Medical Imaging, pp. 146– 157. Springer, 2017.
240
+
241
+ Bernhard Scholkopf, John C Platt, John Shawe-Taylor, Alex J Smola, and Robert C Williamson.¨ Estimating the support of a high-dimensional distribution. Neural computation, 13(7):1443–1471, 2001.
242
+
243
+ Jost Tobias Springenberg. Unsupervised and Semi-supervised Learning with Categorical Generative Adversarial Networks. arXiv:1511.06390 [cs, stat], November 2015. URL http://arxiv. org/abs/1511.06390. arXiv: 1511.06390.
244
+
245
+ David MJ Tax and Robert PW Duin. Support vector data description. Machine learning, 54(1): 45–66, 2004.
246
+
247
+ Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Daeki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly detection. International Conference on Learning Representations., 2018.
248
+
249
+ # A MIXTURE DENSITY NETWORK
250
+
251
+ The Mixture Density networks predict a data conditional Gaussian mixture model (GMM)in the data space. Conditioning means that each latent vector, i.e., a point on the learned manifold is projected back to a GMM in the data space.
252
+
253
+ A GMM learns from the following energy function:
254
+
255
+ $$
256
+ L _ { G M M } ( x ) = - \log \sum _ { h } \alpha _ { h } \mathcal { N } ( x ; \mu _ { h } , \sigma _ { h } )
257
+ $$
258
+
259
+ Whereby $x$ is the input data, $\mu _ { h }$ and $\sigma _ { h }$ parametrize the $h - t h$ Gaussian distribution in the mixture.
260
+ $\alpha _ { h }$ are the mixing coefficients across the individual mixtures.
261
+
262
+ Contrary, a Mixture Density network hat multiple output heads (multiple-hypotheses). The framework extends the GMM-learning by the data conditioning as follows:
263
+
264
+ $$
265
+ L _ { M D N } ( x ) = E _ { z _ { i } \sim q _ { \phi } ( z _ { i } | x ) } \left[ L _ { G M M } ( x | z _ { i } ) \right]
266
+ $$
267
+
268
+ whereby $q _ { \phi }$ is a inference network shared by all individual mixtures. $z$ is the latent code. The hypotheses are coupled into forming a likelihood function by the mixing coefficients $\alpha _ { i }$ .
269
+
270
+ # B MULTIMODAL LEARNING ON THE FLIPPED MOON TOY DATASET
271
+
272
+ ![](images/b2643a46765c721e64f5511bd827f2c3fe35f9377aa933dbe98b529ec2ea3ddb.jpg)
273
+ Figure 8: Flipped half-moon dataset: conditional prediction of $y$ based on $x$ . Red points are samples from true distribution while blue points represent samples from distributions approximations. Learning with multiple-hypotheses predictions (MHP) loss or $\mathrm { M H P } + { \bf \cdot }$ Winner-takes-all (WTA) loss lead to support of artificial data regions. Mixture density networks and our approach ConAD reduces this effect.
274
+
275
+ Fig. 4 shows the flipped half-moon dataset to demonstrate MHP-learning in contrast to unimodal output distribution learning. In this section, Fig 8 shows a qualitative evaluation of different MHPtechniques. This task is a one-to-many mapping from $x$ to $y$ with a discontinuity at the point $x = 0$ and $x = 0 . 5$ .
276
+
277
+ When the local density function abruptly ends, MHP-techniques support artificial data regions since they are not penalized for artificial modes by the objective function as discussed before. We refer to this property as an inconsistency concerning the true underlying distribution. In contrast to that, Mixture Density Networks (MDN) and our ConADs approaches reduce the inconsistencies to the minimum.
278
+
279
+ # C ONE-TO-MANY MAPPING TASKS REQUIRE MULTI-MODALITY
280
+
281
+ Consider a simple toy problem with an observable $x$ and hidden $y$ which is to be predicted and expressed by the conditional distribution $p _ { t r u e } ( y | x )$ such as in Fig. 4. Since the data conditional is multi-modal for some $x$ , an uni-modal output distribution cannot fully capture the underlying distribution. Instead, the bias-free solution for the Mean-Squared-Error-minimizer is the empirical mean $\overline { { y _ { x _ { i } } } }$ of $p _ { t r a i n } ( y | x _ { i } )$ on the training set. However, this learned conditional density does not comply with the underlying distribution: sampled data points fall into the low-likelihood regions under $p _ { t r u e } ( y | x )$ . With increasing number of output hypotheses, the data modes could be gradually captured. For this task, the energy to be minimized is given by the Negative-log-likelihood of the Mixture Density Network (MDN) App. A under a Gaussian Mixture with hypotheses $\mathbf { h }$ in Eq. 9 :
282
+
283
+ $$
284
+ E _ { M D N } ( \Theta ) = - \log L ( \Theta | X ; Y ) = - \log p _ { G M M } ( Y | X , \Theta ) = - \sum _ { i } \sum _ { h } \log \alpha _ { h } p _ { \theta _ { h } } ( y _ { i } | x _ { i } )
285
+ $$
286
+
287
+ with
288
+
289
+ $$
290
+ p _ { \theta _ { h } } ( y _ { i } | x _ { i } , \theta _ { h } ) = \frac { 1 } { \sqrt { 2 \pi } \sigma _ { h } } \exp { - \frac { ( y _ { i } - \mu _ { h } ) ^ { 2 } } { 2 \sigma _ { h } ^ { 2 } } }
291
+ $$
292
+
293
+ # D LEMMA 4.1
294
+
295
+ Given a sufficient number of hypotheses $\mathrm { H } '$ , an optimal solution $\Theta ^ { * }$ for $E _ { W T A } ( \Theta ^ { * } )$ is not unique (permutation is excluded). There exists a $\Theta ^ { ' }$ with $E _ { W T A } ( \Theta ^ { * } ) = E _ { W T A } ( \Theta ^ { ' } )$ which is not consistent w.r.t. the underlying output distribution $p _ { t r a i n } ( y _ { i } | x _ { i } )$ .
296
+
297
+ Proof. : Suppose $c$ is the maximal modes count of the dataset sampled from the real underlying conditional output distribution $p ( y _ { i } | x _ { i } )$ . Since $| \{ ( x _ { i } , y _ { i } ) \} | < \infty { \bar { c ^ { . } } } \infty$ .
298
+
299
+ Suppose $H = c$ , then a trivial optimal solution for $E _ { W T A } ( \Theta _ { H } )$ is found by centering each hypothesis $\mu _ { i k }$ at a different empirical data point $k \ y _ { i k } \ \sim \ ( y _ { i } , x _ { i } )$ and $\sigma _ { i k } \mapsto 0$ . In this case $\operatorname* { l i m } _ { \sigma _ { i k } \mapsto 0 ; \forall i , k } E _ { W T A } ( \widehat { \Theta } _ { H } ) = 0$ .
300
+
301
+ Suppose $H ^ { \prime } > c$ , then a solution $\widehat { \Theta } _ { H ^ { \prime } }$ can be formulated s.t.: $E ( \widehat { \Theta } _ { H } ) = E ( \widehat { \Theta } _ { H ^ { \prime } } )$ .
302
+
303
+ Let $\widehat { \Theta } _ { H ^ { \prime } } = \widehat { \Theta } _ { H } \cup \widehat { \Theta } _ { H + 1 \dots H ^ { \prime } } = \widehat { \Theta } _ { H } \cup \{ \theta _ { h + 1 } \dots \theta _ { h ^ { \prime } } \}$ for some random $\widehat { \Theta } _ { H + 1 \ldots H ^ { \prime } }$ . Due to randomness and without loss of generality, one can assume that $\forall ( x _ { i } , y _ { i } ) , \forall \theta _ { i } \in \Theta _ { H + 1 \dots H ^ { \prime } }$ , $\theta _ { i }$ is not the optimal hypothesis for any training point $( x _ { i } , y _ { i } ) \in D _ { t r a i n }$ .
304
+
305
+ In this case due to the winner-takes-all energy formulation we have:
306
+
307
+ $$
308
+ E _ { W T A } ( \widehat { \theta } _ { H ^ { \prime } } ) = - \sum _ { i } \operatorname* { m a x } _ { 1 \leq h \leq H ^ { \prime } } \log p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) = - \sum _ { i } \operatorname* { m a x } _ { 1 \leq h \leq H } \log p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) = E _ { W T A } ( \widehat { \theta } _ { H } )
309
+ $$
310
+
311
+ So ${ \widehat { \Theta } } _ { H }$ and $\widehat { \Theta } _ { H ^ { \prime } }$ with $H ^ { \prime } > H$ are both solutions to the loss formulation and share the same energy level. The extended hypotheses can support arbitrary artificial data regions without being penalized.
312
+
313
+ # E LEMMA 4.2
314
+
315
+ $$
316
+ E _ { M H P } ( \Theta ) = - \sum _ { i } \sum _ { h } \log \left( p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) \right) * \left\{ \begin{array} { l l } { 1 - \epsilon , p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) \geq p _ { \theta _ { k } } ( y _ { i } | x _ { i } ) , \forall k } \\ { \frac { \epsilon } { H - 1 } , \mathrm { e l s e } } \end{array} \right.
317
+ $$
318
+
319
+ Whereby $x _ { i } , y _ { i }$ is corresponding input-output pairs from the training dataset, $1 \leq h \leq H$ is a hypothesis branch, which is generated by a parametrized neural network with the parameter set $\theta _ { h }$ . Furthermore, $\epsilon$ is a hyperparameter used to distribute the learning signal to the non-optimal hypotheses. $\Theta$ is the collection of all $\theta _ { h }$ .
320
+
321
+ Lemma E.1. Similar to Lemma $D$ , minimizing $E _ { M H P }$ in Eq. 11 might also lead to an inconsistent approximation of the real underlying output distribution.
322
+
323
+ Proof. First, note that $\textstyle { 0 \leq \epsilon \leq \frac { H - 1 } { H } }$ , since −1 $\epsilon < 0$ would push away non-locally optimal hypotheses from the empirical solution, $\epsilon > \frac { H - 1 } { H }$ would penalize the best hypothesis more than others. Both are undesired properties of MHP-learning. First consider the case where $\epsilon \mapsto { \frac { H - 1 } { H } }$ H−1 :
324
+
325
+ $$
326
+ \operatorname* { l i m } _ { \epsilon \mapsto \frac { H - 1 } { H } } E _ { M H P } ( \Theta ) = \sum _ { i } \sum _ { h } \log \left( p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) \right) * \frac { 1 } { H }
327
+ $$
328
+
329
+ $$
330
+ \begin{array} { l } { { \displaystyle \ } } \\ { { \displaystyle \ } = \frac { 1 } { H } \sum _ { h } \left( \sum _ { i } \log \left( p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) \right) \right) } \\ { { \displaystyle \ } } \\ { { \displaystyle \ } = \frac { 1 } { H } \sum _ { h } E _ { \theta _ { h } } } \end{array}
331
+ $$
332
+
333
+ $\forall \boldsymbol { \theta } _ { h }$ and training data points $( x _ { i } , y _ { i k } )$ the optimal least-squares solution is the mean, therefore we have:
334
+
335
+ $$
336
+ \begin{array} { l } { { \theta _ { h } ^ { * } ( y _ { i } | x _ { i } ) = E _ { y _ { i k \sim p ( y | x _ { i } ) } [ y _ { i } ] } } } \\ { { \ = \displaystyle \frac { 1 } { l } \sum _ { i = 1 } ^ { l } y _ { i } ; y _ { i k } \sim p ( y _ { i } | x _ { i } ) } } \end{array}
337
+ $$
338
+
339
+ In this case, all hypotheses are optimized independently and converge to the same solution similar to a single-hypothesis approach. The resulting distribution is inconsistent w.r.t the real output distribution (see Fig. 4 for an example).
340
+
341
+ Now consider $\epsilon \mapsto 1$ :
342
+
343
+ $$
344
+ \begin{array} { l } { \displaystyle \operatorname* { l i m } _ { \epsilon \mapsto 1 } E _ { M H P } ( \Theta ) = - \sum _ { i } \sum _ { h } \log \left( p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) \right) * \left\{ 1 ; \operatorname { i f } \theta _ { h } \mathrm { ~ i s ~ b e s t ~ h y p o t h e s i s } \right. } \\ { \displaystyle = - \sum _ { i } \operatorname* { m a x } _ { 1 \leq h \leq H ^ { \prime } } \log p _ { \theta _ { h } } ( y _ { i } | x _ { i } ) } \\ { \displaystyle = E _ { W T A } ( \Theta ) } \end{array}
345
+ $$
346
+
347
+ In this case $E _ { M H P }$ shares the same inconsistency property with $E _ { W T A }$ . Consequently, choosing $\epsilon \in$ $[ 0 , \frac { H - 1 } { H } ]$ only smoothes the penalty on suboptimal hypotheses. The risk remains that distributions induced by non-optimal hypotheses are beyond the real modes of the underlying distribution.
348
+
349
+ # F EXPERIMENTS DETAILS
350
+
351
+ Network architecture The networks are following DCGAN (Radford et al., 2015a) but only scaled down to support low-resolution of CIFAR-10. Concretely, the decoder (generator) only uses deconvolutional layers. Throughout the network, leaky-relu units are employed. The framework is implemented in Lasagne (Dieleman et al., 2015) /Theano (Bergstra et al., 2010; Bastien et al., 2012).
352
+
353
+ Hypotheses branches are represented as decoder networks heads. Each hypothesis predicts one Gaussian distribution with diagonal co-variance $\Sigma$ and mean . The winner-takes-all loss operates on pixel-level,i.e., for each predicted pixel, there is a single winner across hypotheses. The bestcombined-reconstructions is the combination of winning hypotheses on pixel-level.
354
+
355
+ Training We feed the fake images to the discriminator D, consisting of 4 batches:
356
+
357
+ • real n real images • fake: n random hypotheses from image reconstructions hypotheses branches • fake: n best-combined (based on winner hypotheses) reconstructions • fake: n random sampled images from latent prior $\mathcal { N } ( 0 , 1 )$
358
+
359
+ The batch-size $n$ was set to 64 each on CIFAR-10, 32 on Metal Anomaly. The training was performed with Adam (Kingma & Ba, 2014) with a learning rate of 0.001. Per discriminator training, the generator is trained at most five epochs to balance both players.
360
+
361
+ Table 4: CIFAR-10 anomaly detection: AUROC-performance of different approaches. The column indicates which class was used as in-class data for distribution learning. Note that random performance is at $50 \%$ and higher scores are better. Top-2-methods are marked. Our ConAD approach outperforms traditional methods and vanilla MHP-approaches significantly and can benefit from an increasing number of hypotheses. Furthermore, Mixture Density Networks perform similarly to uni-modal output distributions of VAEs.
362
+
363
+ <table><tr><td>CIFAR-10</td><td>0</td><td>1</td><td>2</td><td>3 4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td></td><td>Mean</td></tr><tr><td>KDE-PCA KDE-Alexnet OC-SVM-PCA</td><td>.705 .559 .666</td><td>.493 .487 .473</td><td>.734 .582 .675</td><td>.522 .531 .530</td><td>.691 .651 .827</td><td>.439 .551 .438</td><td>.771 .613 .787</td><td>.458 .593 .532</td><td>.595 .600 .720</td><td>.490 .529 .453</td><td>.590 .570 .610</td></tr><tr><td>OC-SVM-Alexnet IF GMM AnoGAN ADGAN</td><td>.594 .630 .709 .610</td><td>.540 .379 .443 .565 .529</td><td>.588 .630 .697 .648 .580</td><td>.575 .408 .445 .528 .606</td><td>.753 .764 .761 .670 .607</td><td>.558 .514 .505 .592 .659</td><td>.692 .666 .766 .625 .611</td><td>.547 .480 .496 .576 .630</td><td>.630 .651 .646 .723 .744</td><td>.530 .459 .384 .582 .644</td><td>.601 .558 .585 .612 .62</td></tr><tr><td>VAE VAEGAN OC-D-SVDD</td><td>.632 .771 .762 .617</td><td>.467 .469</td><td>.684 .697</td><td>.538 .520</td><td>.71 .756</td><td>.542 .536</td><td>.642 .588</td><td>.512 .554</td><td>.765 .754</td><td>.467 .460</td><td>.610 .609</td></tr><tr><td>MDN-2</td><td>.761</td><td>.659 .469</td><td>.508 .687</td><td>.591 .538</td><td>.609 .704</td><td>.657 .538</td><td>.677</td><td>.673</td><td>.759</td><td>.731</td><td>.632</td></tr><tr><td>MDN-4</td><td>.769</td><td></td><td></td><td></td><td></td><td></td><td>.632</td><td>.523</td><td>.768</td><td>.467</td><td>.609</td></tr><tr><td>MDN-8</td><td>.762</td><td>.468</td><td>.686</td><td>.535</td><td>.693</td><td>.544</td><td>.635</td><td>.541</td><td>.76</td><td>.469</td><td></td></tr><tr><td></td><td></td><td>.469</td><td>.686</td><td>.533</td><td>.704</td><td></td><td>.633</td><td></td><td>.763</td><td></td><td>.610 .61</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></tr><tr><td>MDN-16</td><td>.762</td><td></td><td></td><td></td><td></td><td>.547</td><td></td><td>.53</td><td></td><td>.473</td><td></td></tr><tr><td></td><td></td><td>.479</td><td>.682</td><td>.528</td><td>.701</td><td>.54</td><td>.635</td><td>.529</td><td>.764</td><td>.469</td><td>.609</td></tr><tr><td>MHP-WTA-2</td><td>.773</td><td>.516</td><td>.68</td><td>.552</td><td></td><td></td><td></td><td></td><td></td><td></td><td>.622</td></tr><tr><td>MHP-WTA-4</td><td></td><td>.539</td><td></td><td></td><td>.695</td><td>.543</td><td>.643</td><td>.555</td><td>.76</td><td>.512</td><td></td></tr><tr><td>MHP-WTA-8</td><td>.778</td><td></td><td>.651</td><td>.567</td><td>.66</td><td>.542</td><td>.635</td><td>.563</td><td>.752</td><td>.541</td><td>.622</td></tr><tr><td></td><td>.761</td><td>.56</td><td>.627</td><td>.588</td><td>.626</td><td>.553</td><td>.614</td><td>.578</td><td>.743</td><td>.548</td><td>.619</td></tr><tr><td>MHP-WTA-16</td><td>.757</td><td>.567</td><td>.609</td><td>.598</td><td>.627</td><td>.56</td><td>.61</td><td>.568</td><td>.738</td><td>.573</td><td>.62</td></tr><tr><td>MHP-2</td><td>.755</td><td>.499</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>MHP-4</td><td></td><td></td><td>.676</td><td>.546</td><td>.693</td><td>.543</td><td>.636</td><td>.577</td><td>.764</td><td>.508</td><td>.619</td></tr><tr><td></td><td>.752</td><td>.51</td><td>.66</td><td>.568</td><td>.677</td><td>.551</td><td>.644</td><td>.56</td><td>.764</td><td>.51</td><td>.619</td></tr><tr><td>MHP-8</td><td>.757</td><td>.54</td><td>.652</td><td>.576</td><td>.648</td><td>.554</td><td>.625</td><td>.547</td><td>.759</td><td>.53</td><td>.618</td></tr><tr><td>MHP-16</td><td>.758</td><td>.539</td><td>.641</td><td>.585</td><td>.646</td><td>.552</td><td>.623</td><td>.545</td><td>.759</td><td>.532</td><td>.617</td></tr><tr><td>MDN+ConAD-2</td><td>.746</td><td>.489</td><td>.686</td><td>.521</td><td>.711</td><td>.525</td><td>.668</td><td>.577</td><td>.765</td><td>.481</td><td>.616</td></tr><tr><td>MDN+ConAD-4</td><td>.762</td><td>.504</td><td>.69</td><td>.524</td><td>.716</td><td>.532</td><td>.659</td><td>.583</td><td>.753</td><td>.489</td><td>.621</td></tr><tr><td>MDN+ConAD-8</td><td>.774</td><td>.483</td><td>.693</td><td>.531</td><td>.722</td><td>.537</td><td>.679</td><td>.54</td><td>.76</td><td>.519</td><td>.623</td></tr><tr><td>MDN+ConAD-16</td><td></td><td></td><td></td><td></td><td></td><td></td><td>.657</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>.736</td><td>.469</td><td>.694</td><td>.522</td><td>.753</td><td>.541</td><td></td><td>.568</td><td>.753</td><td>.454</td><td>.614</td></tr><tr><td>ConAD-2 (ours)</td><td>.773</td><td>.600</td><td>.666</td><td>.562</td><td>.694</td><td>.561</td><td>.706 .801</td><td>.630</td><td>.748</td><td>.499</td><td>.643</td></tr><tr><td>ConAD - 4 (ours)</td><td>.776</td><td>.525</td><td>.663</td><td>.570</td><td>.687</td><td>.541</td><td>.725</td><td>.548</td><td>.741</td><td>.539</td><td>.639</td></tr><tr><td>ConAD - 8 (ours)</td><td>.774</td><td>.652</td><td>.648</td><td>.601</td><td>.670</td><td>.579</td><td>.691</td><td>.662</td><td>.748</td><td>.660</td><td>.671</td></tr><tr><td>ConAD - 16 (ours)</td><td>.772</td><td>.631</td><td>.631</td><td>.615</td><td>.633</td><td>.588</td><td></td><td>.640</td><td>.755</td><td>.637</td><td>.659</td></tr></table>
364
+
365
+ # G CIFAR-RESULTS H METAL ANOMALY DATASET
366
+
367
+ ![](images/ae2c4fae60c6049b75349a2f7fa8ac860d948a5ed41614900280b97924151627.jpg)
368
+ Figure 9: Metal Anomaly dataset. Image reconstructions: reconstructions from uni-modal models are blurry at convergence. Using our ConAD-approach (last two rows), the maximally consistent reconstruction is closer to the original image, capturing many more details needed to differentiate between normal data noise and real anomalies, such as black spots or scratches. The likelihood maximizer in the hypotheses space is much closer to the original and also more realistic. The residuals are significantly clearer for our ConAD-method.
369
+
370
+ Table 5: Anomaly detection performance on the Metal Anomaly dataset, measured in AUROC, showing how different multiple hypothesis approaches perform with increasing number of hypotheses. Vanilla single-hypothesis approaches such as VAE and $\mathrm { V A E { + } G A N }$ under-perform on this task. Even with more sophisticated multi-modal output distribution capacity (MDN), the discriminability is not improved. The integration of MDN into the GAN-framework only slightly improves the results. On the other hand, all other MHP-approaches perform similarly well with $> 9 9 \%$ AUROC (at $1 \%$ of most abnormal pixels considered), which indicates that the task has become easily solvable for these methods.
371
+
372
+ <table><tr><td>Model NLL-All-pixels</td><td>10% abnormal pixels</td><td></td><td>1%-abnormal pixels</td></tr><tr><td>VAE</td><td>.795</td><td>.942</td><td>.977</td></tr><tr><td>VAEGAN (1-hyp)</td><td>.782</td><td>.936</td><td>.978</td></tr><tr><td>MDN-2</td><td>.746</td><td>.900</td><td>.970</td></tr><tr><td>MDN-4</td><td>.765</td><td>.910</td><td>.960</td></tr><tr><td>MDN-8</td><td>.743</td><td>.916</td><td>.975</td></tr><tr><td>MDN+ConAD-2 (ours)</td><td>.810</td><td>.942</td><td>.966</td></tr><tr><td>MDN+ConAD-4 (ours)</td><td>.781</td><td>.913</td><td>.951</td></tr><tr><td>MDN+ConAD-8 (ours)</td><td>.810</td><td>.943</td><td>.978</td></tr><tr><td>MHP-2</td><td>.876</td><td>.980</td><td>.993</td></tr><tr><td>MHP-4</td><td>.834</td><td>.970</td><td>.990</td></tr><tr><td>MHP-8</td><td>.793</td><td>.950</td><td>.984</td></tr><tr><td>MHP-WTA-2</td><td>.851</td><td>.980</td><td>.990</td></tr><tr><td>MHP-WTA-4</td><td>.878</td><td>.980</td><td>.990</td></tr><tr><td>MHP-WTA-8</td><td>.800</td><td>.946</td><td>.981</td></tr><tr><td>ConAD-2 (ours)</td><td>.867</td><td>.985</td><td>.992</td></tr><tr><td>ConAD-4 (ours)</td><td>.812</td><td>.977</td><td>.990</td></tr><tr><td>ConAD-8 (ours)</td><td>.817</td><td>.965</td><td>.987</td></tr></table>
md/train/rk5UYassf/rk5UYassf.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Regularized siamese neural network for unsupervised outlier detection on brain multiparametric magnetic resonance imaging: application to epilepsy lesion screening
2
+
3
+ Zara Alaverdyan
4
+ Univ Lyon, INSA-Lyon, Université Claude Bernard Lyon 1,
5
+ UJM-Saint Etienne, CNRS, Inserm, CREATIS UMR 5220, U1206, F-69621, Lyon, France zaruhi.alaverdyan@creatis.insa-lyon.fr
6
+
7
+ Julien Jung, Romain Bouet Lyon Neuroscience Research Center, CRNL, INSERM U1028, CNRS UMR5292, University Lyon 1, Lyon, France {julien.jung, romain.bouet}@inserm.fr
8
+
9
+ Carole Lartizien
10
+ Univ Lyon, INSA-Lyon, Université Claude Bernard Lyon 1,
11
+ UJM-Saint Etienne, CNRS, Inserm, CREATIS UMR 5220, U1206, F-69621, Lyon, France carole.lartizien@creatis.insa-lyon.fr
12
+
13
+ # Abstract
14
+
15
+ Computer aided diagnosis (CAD) systems are designed to assist clinicians in various tasks, including highlighting abnormal regions in medical images. Common methods exploit supervised learning using annotated data sets and perform classification at voxel-level. However, many pathologies are characterized by subtle lesions that may be located anywhere in the organ of interest, have various shapes, sizes and textures. Acquiring a data set adequately representing the heterogeneity of such pathologies is therefore a major issue. Moreover, when a lesion is not visually detected on a scan, outlining it accurately is not feasible. Performing supervised learning on such labeled data would not be reliable. In this study, we consider the problem of detecting subtle epilepsy lesions in multiparametric (T1w, FLAIR) MRI exams considered as normal (MRI-negative). We cast this problem as an outlier detection problem and build on a previously proposed approach that consists in learning a oc-SVM model for each voxel in the brain volume using a small number of clinically-guided features [1]. Our goal in this study is to make a step forward by replacing the handcrafted features with automatically learnt representations using neural networks. We propose a novel version of siamese networks trained on patches extracted from healthy patients’ scans only. This network, composed of stacked convolutional autoencoders as subnetworks, is regularized by the reconstruction error of the patches. It is designed to map patches centered at the same spatial localization to ’close’ representations with respect to the chosen metric (i.e. cosine) in a latent space. Finally, the middle layer representations of the subnetworks are fed into oc-SVM models at voxel-level. The model is trained on 75 healthy subjects and validated on 21 patients with confirmed epilepsy lesions (with 18 MR negative patients) and shows a promising performance.
16
+
17
+ # 1 Introduction
18
+
19
+ Computer aided diagnosis (CAD) systems have been introduced as to assist clinicians in various tasks such as organ or lesion segmentation, detection of abnormal regions in a medical image, etc. Recent CAD systems for brain pathologies exploit various modalities of neuroimaging data, such as magnetic resonance imaging (MRI) and positron emission tomography (PET). The vast majority of the existing CAD systems are built upon methods developed in supervised settings, using either manually designed features or currently ubiquitous deep learning architectures as in [2, 3, 4, 5]. Such systems benefit from the available data sets (usually) annotated at voxel-level, and output maps where each voxel is characterized either by a class label, a probability or, less commonly, a score discriminating healthy versus pathological voxels. Supervised learning, however, cannot be applied when the number of pathological cases in the training set is not sufficient to account for the complexity of the task. This is often the case when it comes to detecting some brain pathologies such as small vessel diseases (SVD), multiple sclerosis (MS) or epilepsy, when the lesions are subtle and vary largely in terms of shapes and textures. It is not trivial to obtain a well-annotated data set to represent such a variability. To bypass the problem of insufficient labeled data, some authors recently proposed to formulate such lesion detection tasks in semi-supervised settings, by accounting for both labeled and unlabeled data in a deep architecture for MS lesion segmentation [6] or by exploiting weak labels (the number of lesions in a scan) to detect enlarged perivascular spaces in the basal ganglia [7].
20
+
21
+ In this study we propose to tackle the problem of epilepsy lesion detection in patients with MRI negative exams, meaning that the lesions were not visually identified by clinicians on the MR scans. Similarly to the above mentioned lesion detection tasks, most of the current epilepsy detection methods perform supervised learning by leveraging annotated lesions delineated on MRI positive patients (the lesions are visually detected on the scans) [8] or by careful a posteriori re-reading of postsurgical scans of MRI negative patients who had undergone surgery and were seizure-free afterwards [1, 9, 10, 11]. While obtaining accurately labeled data for MRI positive patients is feasible, the real challenge is to extract accurate delineations in MRI negative patients. [11] showed that exploiting ’too generously’ annotated lesions on MRI negative scans as labels for supervised learning methods leads to poor detection rate due to the presence of normal tissue in the areas labeled as pathological. Therefore, some recent methods cast epilepsy lesion detection task as an outlier detection problem [1, 11, 12]. Such an approach solely needs a training set of non-pathological images, hence no labeled data is required. [1] used a small number of features modeling the gray-white matter junction (similarly to [13, 14]) while [12] and [11] derived features from surface based morphometry (SBM). All the latter methods targeted a specific type of epilepsy caused by focal cortical dysplasia (FCD); hence the features were chosen as to provide the most common FCD-characteristics to the models.
22
+
23
+ In this work we build on the method proposed in [1] that learns a one-class SVM (oc-SVM) model for each voxel individually. Our goal is to make a step forward by replacing the handcrafted features with automatically learnt representations using neural networks. Deep learning architectures allow to learn representations that are not limited to the clinically-guided features which have to be designed for each pathology individually; the representations are learnt based on the available data. Moreover, certain architectures provide a convenient framework to learn joint representations of multiparametric/multimodality imaging. Our methodological contribution consists in proposing a variant of siamese neural network designed to learn representations for outlier detection on brain images. The network is composed of stacked convolutional autoencoders and is trained on the patches of healthy brain volumes only, by utilizing a novel loss function adapted to the given context. Such a network allows learning meaningful representations which, coupled with voxel-level oc-SVM classifiers, discriminate various brain abnormalities and can be applied to detect subtle pathologies in general. From the medical application perspective, we attempt to make a step forward in automatically learning representations for epilepsy lesion detection, unlike in the previous studies ([1, 11]). Our approach is not targeted at one specific epilepsy type and thus is more generic and also detects lesions with rather unknown signatures. Moreover, to our knowledge, this is the first study to propose a neural network architecture trained on multiparametric MRI data that can be applied to detect epilepsy lesions.
24
+
25
+ ![](images/379d1acd31862d3fdd86f677c9c5a3757012cdcbec4108d9df3b1da960f0845c.jpg)
26
+ Figure 1: Siamese neural network composed of stacked convolutional autoencoders as sub-networks. The input consists of a pair of patches of 2 different subjects centered at the same spatial localization in the brain. The middle-layer representation is denoted by $g ( x )$ .
27
+
28
+ # 2 Method
29
+
30
+ In this study we propose to use a siamese network to learn patch-level representations in the context of outlier detection. Such an approach is applicable in cases where pathological samples are not available or their number is insufficient to adequately represent the nature of the pathology and hence, supervised learning is not possible.
31
+
32
+ The motivation behind the architecture choice is the following. Our objective is to map the original patches to a space where the patches belonging to different subjects but centered at the same spatial localization are "close" with respect to a chosen metric. We could consider the patches centered at the same voxel as representatives of the same class (hence, "similar" patches). In this case the number of classes would be equal to the number of voxels in a brain volume (around 4 millions) but the number of samples per class would be equal to the number of subjects. The siamese networks have proved to be efficient in similar scenarios [15, 16] where the number of classes is largely greater than the number of samples per class.
33
+
34
+ # 2.1 Regularized siamese neural network for representation learning
35
+
36
+ # 2.1.1 Architecture
37
+
38
+ The proposed architecture is illustrated on figure 1. Our regularized siamese neural network (rSNN) consists of two identical (same architecture, shared parameters) subnetworks - stacked convolutional autoencoders (sCAE) with $K$ hidden layers and a cost module. The input $\mathbf { x }$ of a SCAE is first encoded to a middle-layer representation by a series of convolutional and max-pooling operations and later decoded with a series of deconvolutions and up-poolings to produce a reconstruction $\hat { \bf x }$ of the input. A convolutional layer $l$ is composed of $N _ { l }$ kernels and biases and can be expressed as
39
+
40
+ $$
41
+ \mathbf { H } _ { l } ^ { m } = f ( \mathbf { W } _ { l - 1 } ^ { m } * \mathbf { H } _ { l - 1 } + b _ { l - 1 } ^ { m } )
42
+ $$
43
+
44
+ where $\mathbf { H } _ { l } ^ { m }$ is the $m$ -th feature map of the convolutional layer $l$ , $\mathbf { W } _ { l } ^ { m }$ is the kernel matrix associated with $\mathbf { H } _ { l } ^ { m }$ and $b _ { l } ^ { m }$ is its bias, $f$ is an activation function (usually non-linear). $^ *$ denotes the convolution operation. The parameters are iteratively updated to optimize a loss function that measures the deviation between the output $\hat { \bf x }$ and the input $\mathbf { x }$ .
45
+
46
+ The siamese network receives a pair of patches $\left( \mathbf { x _ { 1 } } , \mathbf { x _ { 2 } } \right)$ at input, then each patch is propagated through the corresponding subnetwork yielding representations $g ( \mathbf { x _ { t } } ) , t \ = \ ( 1 , 2 )$ in the middle layer which are then passed to the loss function $L$ below. It is important to mention that, unlike in the classical siamese frameworks where the network also receives a binary label that stands for the similarity/dissimilarity of the pair, in our application all the considered pairs are ’similar’ and therefore the label is not present in the loss function. The loss function, however, can be easily modified to meet the general setting.
47
+
48
+ # 2.1.2 Loss function
49
+
50
+ Our loss function is designed to maximize the cosine similarity between $g ( \mathbf { x _ { 1 } } )$ and $g ( \mathbf { x _ { 2 } } )$ . In the absence of dissimilar pairs (the notion of dissimilar patches is not defined in our context), it is necessary to add a regularizing term. To this end, we propose to use the mean squared error between the input patches and their reconstructions output by the subnetworks. Without a proper regularization term, the loss function could be driven to 0 by mapping all the patches to a constant value. The proposed loss function for a single pair hence is:
51
+
52
+ $$
53
+ L ( \mathbf { x _ { 1 } } , \mathbf { x _ { 2 } } ; \Theta ) = \sum _ { t = 1 } ^ { 2 } | | \mathbf { x _ { t } } - { \hat { \mathbf { x _ { t } } } } | | _ { 2 } ^ { 2 } - \alpha c o s ( g ( \mathbf { x _ { 1 } } ) , g ( \mathbf { x _ { 2 } } ) )
54
+ $$
55
+
56
+ where $\hat { \mathbf { x } } _ { \mathbf { t } }$ is the reconstructed output of subnetwork $t$ of the patch $\mathbf { x _ { t } }$ while $g ( \mathbf { x _ { t } } )$ is its (vectorized) representation in the middle layer and $\alpha$ is a coefficient that controls the tradeoff between the two terms. $\Theta$ represents the parameter set.
57
+
58
+ # 2.2 Voxel-level outlier detection with oc-SVM classifiers
59
+
60
+ A oc-SVM classifier [17] is an outlier detection method that seeks to find the optimal hyperplane that separates the given points from the origin in a dot product space defined by some kernel function $\phi$ . The corresponding optimization problem is the following:
61
+
62
+ $$
63
+ \begin{array} { l } { \displaystyle \underset { \mathbf { w } , \rho , \xi _ { i } } { \operatorname* { m i n } } \quad \displaystyle \frac { 1 } { 2 } | | \mathbf { w } | | ^ { 2 } - \rho + \frac { 1 } { \nu \mathrm { n } } \sum _ { \mathrm { i } = 1 } ^ { \mathrm { n } } \xi _ { \mathrm { i } } } \\ { \displaystyle \mathrm { s u b j e c t ~ t o } \quad \mathbf { w } \cdot \phi ( \mathbf { x _ { i } } ) \geq \rho - \xi _ { \mathrm { i } } , \xi _ { \mathrm { i } } \geq 0 , \mathrm { i } \in [ 1 , \mathrm { n } ] } \end{array}
64
+ $$
65
+
66
+ where $n$ is the number of training examples, $\mathbf { x _ { i } }$ is the $i$ -th example in the training dataset $X$ , $\xi _ { i }$ -s are slack variables relaxing the inequality constraints as to account for the non-separable classes, w and $\rho$ define the separating hyperplane, $\nu$ is a parameter that sets a boundary to the fraction of outliers allowed. The decision function, then, for an example $\mathbf { x }$ is ${ \bf w } \cdot \phi ( { \bf x } ) - \dot { \rho }$ . This decision function contributes to the signed score output by a oc-SVM model (in a typical scenario examples with negatives scores would be considered outliers).
67
+
68
+ To validate the usefulness of the features learnt by the proposed method, we use the representations in the middle layer of the subnetworks $( g ( \mathbf { x } ) )$ to train oc-SVM classifiers at voxel level. Each voxel is associated with a classifier, hence the number of classifiers is equal to the number of voxels in a volume (around 4 million voxels). For a given voxel $v _ { i }$ , the associated oc-SVM classifier $C _ { i }$ is trained on the matrix $M _ { i } = [ \bf { x _ { i 1 } } , . . . , \bf { x _ { i n } } ]$ where $\mathbf { x _ { i j } }$ is the feature vector corresponding to the patch centered at $v _ { i }$ of subject $j$ and $n$ is the number of subjects.
69
+
70
+ For a new patient, each voxel $v _ { i }$ is matched against the corresponding classifier $C _ { i }$ and is assigned the signed score output by the classifier. This yields a distance map $D _ { p }$ for the given patient.
71
+
72
+ # 2.3 Post-processing
73
+
74
+ For a given patient, the output of the previous step - the distance map $D _ { p }$ - is then post-processed to obtain the final detections. A 3-step post-processing is proposed as follows.
75
+
76
+ The first step consists in normalizing the distance maps with respect to the intra-subject spatial variability. For that purpose, the distance maps of the control subjects are computed by performing a $k$ -fold evaluation of the controls in the training set (i.e. for each fold of normal subjects, the distance maps are obtained with oc-SVMs trained on the remaining subjects). These maps are used to estimate the standard deviation of the normal subjects’ distance distribution at voxel-level. For a given patient $p$ , a new map $\acute { D } _ { p }$ is computed by a voxel-wise division of the output distance map $D _ { p }$ over the estimated standard deviations. The final distance map $F _ { p }$ is then derived by averaging $D _ { p }$ and $\acute { D } _ { p }$ i.e. $\begin{array} { r } { F _ { p } = \frac { 1 } { 2 } ( \frac { D _ { p } } { m a x ( a b s ( D _ { p } ) ) } + \frac { \dot { D } _ { p } } { m a x ( a b s ( \dot { D } _ { p } ) } ) ) } \end{array}$ . The reason behind the additional term is that some zones in the brain have more intra-subject variability than others and therefore are more likely to be considered as anomalies. By weighing them by the standard deviation, the score maps account for this effect. The second step consists in thresholding the $F _ { p }$ map to produce a cluster map. We keep the most negative scores up to the score corresponding to a pre-chosen $p$ -value in the patient’s distance score distribution and apply a 26-connectivity rule to identify connected components which we refer to as clusters. The voxel clusters smaller than a fixed size (here, 82 voxels corresponding to the expected cluster size calculated with the SPM analysis of the T1 MRI data) are discarded. This allows quick elimination of small and very negative clusters which usually represent isolated intensity peaks (the size of the majority of the detected clusters varies between 500 and 1500, this threshold therefore does not affect the performance in any significant way). The clusters are what we refer to as detections by the proposed method. By varying the $p$ -value the number of clusters can be controlled according to a clinician’s needs.
77
+
78
+ The third step consists in ranking the detected clusters to help the analysis of the detections. For each patient individually, a $p$ -value is found that produces at most 15 clusters. Among those, we use the following ranking criterion to assign a rank to a cluster $c _ { i }$
79
+
80
+ $$
81
+ r a n k ( \mathbf { c _ { i } } ) \sim \lambda * \frac { s c o r e ( \mathbf { c _ { i } } ) } { m i n _ { j } s c o r e ( \mathbf { c _ { j } } ) } + ( 1 - \lambda ) * \frac { s i z e ( \mathbf { c _ { i } } ) } { m a x _ { j } s i z e ( \mathbf { c _ { j } } ) }
82
+ $$
83
+
84
+ where $s c o r e ( c _ { i } )$ is the average of the voxel scores in the cluster and $s i z e ( c _ { i } )$ is the number of voxels in the cluster. Such a ranking favors large clusters with the most negative average score. Using this ranking, we keep the top $n$ detections and discard the rest. When there is a significant overlap between a detected cluster and the ground truth for a given patient, we consider the cluster a true positive and false positive otherwise.
85
+
86
+ # 3 Experiments and results
87
+
88
+ # 3.1 Dataset description and pre-processing
89
+
90
+ The study was approved by our institutional review board with approval numbers 2012-A00516-37 and 2014-019 B and a written consent was obtained for all participants.
91
+
92
+ Our database consists of multiparametric (T1-weighted and FLAIR) MR images of 75 healthy subjects and 21 patients. They all had a 3D anatomical T1-weighted brain MRI (TR/TE 2400/3.55; 160 sagittal slices of $1 9 2 \mathrm { ~ x ~ } 1 9 2 \ 1 . 2 \mathrm { m m }$ cubic voxels) and FLAIR (176 sagittal slices of $1 9 6 \times 2 5 6 ~ 1 . 2 \mathrm { m m }$ cubic voxels) on a $1 . 5 \mathrm { T }$ Sonata scanner (Siemens Healthcare, Erlangen, Germany). All the volumes were normalized to the standard brain template of the Montreal Neurological Institute (MNI) [18] using a voxel size of $1 \mathrm { ~ x ~ } 1 \mathrm { ~ x ~ } 1 \mathrm { ~ m m }$ . This processing was performed using the unified segmentation algorithm [19] implemented in SPM12 also correcting for magnetic field inhomogeneities. This spatial normalisation assures a voxel-level correspondence between the subjects. We removed top $1 \%$ intensities and scaled the images between 0 and 1 at image level before feeding the patches to the rSNN.
93
+
94
+ The method has been validated on 21 patients admitted to our clinical center with confirmed medically intractable epileptogenic lesions: 2 of them were visually detected on the patient FLAIR images (but not on T1w images) and only 1 lesion was identified on both T1w and FLAIR scans. The remaining 18 patients are confirmed MR negative patients. The MR negative patients had undertaken surgeries and have been seizure-free since. The ground truth annotations used in the performance evaluation were obtained by outlining the visible zones of the MR positive patients and by combining the information of post-surgical MR images and the resected zones for MR negative patients.
95
+
96
+ # 3.2 Feature extraction with SNN
97
+
98
+ The proposed rSNN consists of two identical subnetworks - stacked convolutional autoencoders with the architecture as in fig. 2. In the mono-modal scenario, they both receive at input $1 5 \mathrm { x } 1 5$ patches extracted from all the available healthy subjects’ volumes of the corresponding modality (T1w or FLAIR) with a stride of 8. In the multi-modal scenario, the input consists of the patches of each modality joint as channels. For each of the patches, a random ’similar pair’ is found among the other subjects yielding in total around 3.5 million pairs. The $\alpha$ parameter in the loss 1 is set to 0 during the first 10 epochs, then grows linearly for 15 epochs until it reaches 0.5 and then plateaus for 5 more epochs. We used ReLU activation function in all the layers except the last one where the sigmoid is used (the input patches are scaled between 0 and 1). The Adam optimizer was used with the learning rate set to 0.001 (the rest of the parameters remained at their default value as implemented in Theano). The architecture itself is not arbitrary. The size of the patches at input was chosen after a number of tested configurations and is justified by the subtle nature of epilepsy lesions. Indeed, larger patch sizes were not successful at detecting subtle lesions. Since the middle-layer representations are used to build oc-SVM models per voxel where the number of samples per model is equal to the number of subjects, having large representation vectors would not be beneficial. As shown on figure 2 the middle layer has 16 feature maps of $2 \mathbf { x } 2$ which, when flattened, yields a 64-dimensional vector.
99
+
100
+ ![](images/8c1689631af765b6514824b37c2b48ac6ee9b2e10d4d832a8dd23349dd997268.jpg)
101
+ Figure 2: rSNN subnetwork architecture for epilepsy lesion detection. $C$ and $D C$ denote convolutional and deconvolutional layers respectively, $M P$ and $U P$ denote Maxpooling and Uppooling. The C and DC layers are denoted with the number of features maps (e.g. 16 for the first C layer) and the kernel size in parenthesis (e.g. 3x3 for the first C layer). With this configuration, the middle-layer is composed of 16 feature maps of size $2 \mathbf { x } 2$ which yields a 64-dimensional representation vector $g ( \mathbf { x } )$ when flattened.
102
+
103
+ # 3.3 oc-SVM classifier design
104
+
105
+ We used oc-SVM classifiers with RBF kernel which gives us two parameters to tune - $\nu$ (upper bound on the fraction of permitted outliers) and $\gamma$ (the kernel parameter). Varying the parameter $\nu$ did not significantly impact the results; the fraction of the outliers is controlled in the post-processing step by the threshold value applied on the distance map. It was set to 0.03 for all the voxels. The $\gamma$ parameter was derived for each voxel $v _ { i }$ individually by estimating the median of the standardized euclidean pairwise distances of the corresponding matrix $M _ { i }$ (see section 2.2) as in [20].
106
+
107
+ # 3.4 Results
108
+
109
+ Below we evaluate the performance of the system on 21 patients with confirmed epilepsy lesions. We first demonstrate the advantage of the multi-modal approach versus mono-modal approaches. Fig. 3 shows the true detection rates among the top $n$ clusters for 3 scenarios - voxel-level outlier detection with T1w-only, FLAIR-only and T1w/FLAIR-trained features, for 3 values of $\lambda$ of expression 3, the trade-off coefficient between the cluster size and average score. It clearly demonstrates that features learnt on the combination of multimodality data outperform the individual modalities. Moreover, the figure shows that ranking the clusters by both their average score and size has an advantage over the individual criteria. With this ranking approach, the multimodal model achieves $62 \%$ of true detections among the top 10 clusters. [11] reports a detection rate of $70 \%$ when individual SBM-based features are used; the results vary between 60 and $70 \%$ when considering combinations of some of these SBM features. 2 of the 3 MR positive lesions were detected among the top 2 clusters. This result is expected considering that visually detected lesions have visible markers that allow to distinguish them easily unlike the MR negative patients whose lesions may be detected along with other outliers of similar ’suspiciousness’.
110
+
111
+ We have also compared the global results of our CAD system to the results obtained with a general linear model (GLM) learned on feature maps derived from T1w images using three settings - 1. junction contrast, 2.extension contrast and 3. the conjunction of both contrasts - for a $p$ -value of 0.001 as done in [1]. These features model the junction between gray and white matters as described in [13, 14]. For a fair comparison, the same clustering and ranking procedures (as described in section 2.3) were applied and only the top 10 clusters were considered. The results are summarized in table 1. While extension contrast detects one additional lesion compared with our mono-modal T1-based approach, the combination of junction and extension contrasts does not achieve our best performance with T1w/FLAIR model. We should also note that without applying the ranking method the original SPM implementation produces much more false positive detections without any significant change in the true positive rate.
112
+
113
+ ![](images/d52c1d823009fafd5fb564e67089e19907bdd7ccc8c2198edcd3710190693a14.jpg)
114
+ Figure 3: The performance of the CAD system. $\mathbf { X }$ -axis: Top $n$ clusters, y-axis: Detection rate among the top $n$ clusters. From left to right: $\lambda = 1$ (score-only), $\lambda = 0 . 5$ (score and size average) and $\lambda = 0$ (size-only) ranking criteria.
115
+
116
+ Table 1: Our system versus GLM model on T1w MRI as implemented in SPM software. First column: the true positive rate; the number of detected patients / total number of patients in parenthesis. Second column: the true positive rate calculated on MRI negative patients only. Third column: the average number of false positive detections per patient.
117
+
118
+ <table><tr><td></td><td>True positive rate</td><td>True positive rate on MR negative patients</td><td>Average # of false positives</td></tr><tr><td>rSNN +oc-SVMon T1 (ranked, top 10)</td><td>0.38 (8/21)</td><td>0.38 (7/18)</td><td>9</td></tr><tr><td>rSNN + oc-SVM on FLAIR (ranked,top 10)</td><td>0.52 (11/21)</td><td>0.5 (9/18)</td><td>9</td></tr><tr><td>rSNN + oc-SVMon T1/FLAIR (ranked,top 10)</td><td>0.62 (13/21)</td><td>0.61 (11/18)</td><td>9</td></tr><tr><td>SPMJunction on T1 (ranked,top 10)</td><td>0.28 (6/21)</td><td>0.27 (5/18)</td><td>9</td></tr><tr><td>SPM Extension on T1 (ranked,top 10)</td><td>0.43 (9/21)</td><td>0.44 (8/18)</td><td>9</td></tr><tr><td>SPM Junction-Extension on T1 (ranked, top 10)</td><td>0.24 (5/21)</td><td>0.22 (4/18)</td><td>9</td></tr></table>
119
+
120
+ ![](images/0f5acdc24796b148a1840d3364e95dcbe798680b3e3996cab22fe1d2aa6836af.jpg)
121
+ Figure 4: CAD system output for patients $A ^ { + }$ , $B ^ { - }$ and $C ^ { - }$ respectively ( $^ +$ stands for MR positive patients, − for MR negative patients). Top row: Transverse slices centered at the lesion locations (highlighted in red circles). Bottom row: Maximum intensity projections (MIP) of the cluster maps overlaid on the MRI transverse slices. The maps show the top 1, top 6 and top 3 clusters, respectively.
122
+
123
+ # 4 Discussion
124
+
125
+ This study presents a novel method to learn representations that can be used in the task of anomaly detection on brain images. We have formulated a regularized siamese network architecture that learns normal brain representations using a set of non-pathological MR volumes. The features learnt with the network do not target specific pathology but rather allow to capture normal variability from a cohort of healthy subjects. The framework allows integrating multiple modalities and we have shown the performance gain obtained by coupling T1w and FLAIR imaging for the task of detecting subtle epilepsy lesions in MRI negative patients. To our knowledge, this is the first attempt to use deep learning for epilepsy lesion detection.
126
+
127
+ Most current studies target a specific type of the pathology, referred to as focal cortical dysplasia (FCD), mainly resulting from a malformation of cortical development and leading to drug-resistant epilepsy lesions. Some of these studies use manually designed features characterizing cortical malformations based on surface based morphometry (SBM) [9, 11, 12]. Others associate these morphometric features to the intensity anomalies in T1w MRI mainly caused by heterotopy lesions [1, 8]. Our method seeks to find more complex features in an unsupervised manner in order to identify lesions with unknown signatures. Naturally, such an approach, when applied to a specific pathology, is likely to produce more false positive detections. Although a fair comparison with published results is difficult because of the differences in the patient groups, results reported in table 1 ( $6 2 \%$ sensitivity for 9 false positives per scan) are of the same order as those reported in recent studies for the difficult task of automated detection in MRI-negative patients. Indeed, the system proposed in [11] based on SBM features coupled with semi-supervised hierarchical conditional random fields achieves $70 \%$ sensitivity on a sample of $2 0 \mathrm { T } 1$ weighted MRI negative patients among the top 10 detections per scan. In [1], a CAD system based on morphometric and intensity features coupled with a oc-SVM classifier allows achieving the same $70 \%$ sensitivity with an average of 4 false positives per scan when evaluated on a small cohort of 8 T1w MRI negative patients.
128
+
129
+ There are different options to improve the diagnostic performance of the proposed system. First, some pathology-specific information could be introduced in the post-processing step, by discarding some of the detected clusters based on shape and/or localization criteria. In the majority of the cases, as shown in figure 4, most of the detected false positive clusters are indeed irregularities that can be easily removed by a trained radiologist. An alternative option is to move towards a semi-supervised setting by enhancing the neural network with a few ’pathological’ patches that could be extracted from MRI positive cases or after a careful analysis of retrospective MRI negative patients, following, for instance, some ideas recently proposed in [21]. More improvement could be achieved by accounting for the complementary information provided by different imaging modalities. T1 and FLAIR modalities, introduced as channels to our network, allowed a significant diagnostic performance gain as shown on figure 3. We expect a further performance gain by exploiting PET imaging as recently demonstrated in [22].
130
+
131
+ Finally, the proposed method is quite straightforward to implement and to apply in daily practice as the output of the system can be obtained under a couple of minutes.
132
+
133
+ # 5 Acknowledgements
134
+
135
+ This work was performed within the framework of the LABEX PRIMES (ANR-11-LABX-0063) of Université de Lyon, within the program "Investissements d’Avenir" (ANR-11-IDEX-0007) operated by the French National Research Agency (ANR). The authors sincerely thank Valentin Hoang for his valuable contribution to the SPM analysis.
136
+
137
+ # References
138
+
139
+ [1] M. El Azami, A. Hammers, J. Jung, N. Costes, R. Bouet, and C. Lartizien, “Detection of lesions underlying intractable epilepsy on t1-weighted mri as an outlier detection problem,” PloS one, vol. 11, no. 9, p. e0161498, 2016.
140
+ [2] P. Moeskops, M. A. Viergever, A. M. Mendrik, L. S. de Vries, M. J. Benders, and I. Išgum, “Automatic segmentation of mr brain images with a convolutional neural network,” IEEE transactions on medical imaging, vol. 35, no. 5, pp. 1252–1261, 2016.
141
+ [3] K. Kamnitsas, C. Ledig, V. F. Newcombe, J. P. Simpson, A. D. Kane, D. K. Menon, D. Rueckert, and B. Glocker, “Efficient multi-scale 3d cnn with fully connected crf for accurate brain lesion segmentation,” Medical Image Analysis, vol. 36, pp. 61 – 78, 2017.
142
+ [4] M. Ghafoorian, N. Karssemeijer, T. Heskes, M. Bergkamp, J. Wissink, J. Obels, K. Keizer, F.-E. de Leeuw, B. van Ginneken, E. Marchiori, and B. Platel, “Deep multi-scale location-aware 3d convolutional neural networks for automated detection of lacunes of presumed vascular origin,” Neuroimage, vol. 14, pp. 391– 399, 2017.
143
+ [5] Q. Dou, H. Chen, L. Yu, L. Zhao, J. Qin, D. Wang, V. Mok, L. Shi, and P.-A. Heng, “Automatic detection of cerebral microbleeds from mr images via 3d convolutional neural networks.,” IEEE transactions on medical imaging, vol. 35, no. 5, pp. 1182–1195, 2016.
144
+ [6] C. Baur, S. Albarqouni, and N. Navab, “Semi-supervised deep learning for fully convolutional networks,” in Medical Image Computing and Computer-Assisted Intervention (MICCAI 2017) (M. Descoteaux, L. Maier-Hein, A. Franz, P. Jannin, D. L. Collins, and S. Duchesne, eds.), (Cham), pp. 311–319, Springer International Publishing, 2017.
145
+ [7] F. Dubost, G. Bortsova, H. Adams, A. Ikram, W. J. Niessen, M. Vernooij, and M. De Bruijne, “Gp-unet: Lesion detection from weak labels with a 3d regression network,” in Medical Image Computing and Computer Assisted Intervention (MICCAI 2017) (M. Descoteaux, L. Maier-Hein, A. Franz, P. Jannin, D. L. Collins, and S. Duchesne, eds.), (Cham), pp. 214–221, Springer International Publishing, 2017.
146
+ [8] R. S. Gill, S.-J. Hong, F. Fadaie, B. Caldairou, B. Bernhardt, N. Bernasconi, and A. Bernasconi, “Automated detection of epileptogenic cortical malformations using multimodal mri,” in Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support, pp. 349–356, Springer, 2017.
147
+ [9] S.-J. Hong, H. Kim, D. Schrader, N. Bernasconi, B. C. Bernhardt, and A. Bernasconi, “Automated detection of cortical dysplasia type ii in mri-negative epilepsy,” Neurology, vol. 83, no. 1, pp. 48–55, 2014.
148
+ [10] B. Ahmed, C. E. Brodley, K. E. Blackmon, R. Kuzniecky, G. Barash, C. Carlson, B. T. Quinn, W. K. Doyle, J. French, O. Devinsky, and T. Thesen, “Cortical feature analysis and machine learning improves detection of "mri-negative" focal cortical dysplasia.,” Epilepsy and behavior, vol. 48, pp. 21–8, 2015.
149
+ [11] B. Ahmed, T. Thesen, K. E. Blackmon, R. Kuzniekcy, O. Devinsky, and C. E. Brodley, “Decrypting "cryptogenic" epilepsy: Semi-supervised hierarchical conditional random fields for detecting cortical lesions in mri-negative patients,” Journal of Machine Learning Research, vol. 17, no. 112, pp. 1–30, 2016.
150
+ [12] T. Thesen, B. T. Quinn, C. Carlson, O. Devinsky, J. DuBois, C. R. McDonald, J. French, R. Leventer, O. Felsovalyi, X. Wang, et al., “Detection of epileptogenic cortical malformations with surface-based mri morphometry,” PloS one, vol. 6, no. 2, p. e16430, 2011.
151
+ [13] H.-J. Huppertz, C. Grimm, S. Fauser, J. Kassubek, I. Mader, A. Hochmuth, J. Spreer, and A. SchulzeBonhage, “Enhanced visualization of blurred gray–white matter junctions in focal cortical dysplasia by voxel-based 3d mri analysis,” Epilepsy research, vol. 67, no. 1-2, pp. 35–50, 2005.
152
+ [14] J. Wagner, B. Weber, H. Urbach, C. E. Elger, and H.-J. Huppertz, “Morphometric mri analysis improves detection of focal cortical dysplasia type ii,” Brain, vol. 134, no. 10, pp. 2844–2854, 2011.
153
+ [15] J. Bromley, J. W. Bentz, L. Bottou, I. Guyon, Y. LeCun, C. Moore, E. Säckinger, and R. Shah, “Signature verification using a "siamese" time delay neural network,” IJPRAI, vol. 7, no. 4, pp. 669–688, 1993.
154
+ [16] S. Chopra, R. Hadsell, and Y. LeCun, “Learning a similarity metric discriminatively, with application to face verification,” in Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, vol. 1, pp. 539–546, IEEE, 2005.
155
+ [17] B. Schölkopf, J. C. Platt, J. Shawe-Taylor, A. J. Smola, and R. C. Williamson, “Estimating the support of a high-dimensional distribution,” Neural computation, vol. 13, no. 7, pp. 1443–1471, 2001.
156
+ [18] J. Mazziotta, A. Toga, A. Evans, P. Fox, J. Lancaster, K. Zilles, R. Woods, T. Paus, G. Simpson, B. Pike, et al., “A probabilistic atlas and reference system for the human brain: International consortium for brain mapping (icbm),” Philosophical Transactions of the Royal Society of London B: Biological Sciences, vol. 356, no. 1412, pp. 1293–1322, 2001.
157
+ [19] J. Ashburner and K. Friston, “Unified segmentation,” Neuroimage, vol. 26, pp. 839–851, 2005.
158
+ [20] B. Caputo, K. Sim, F. Furesjo, and A. Smola, “Appearance-based object recognition using svms: which kernel should i use?,” in Proc of NIPS workshop on Statistical methods for computational experiments in visual processing and computer vision, Whistler, vol. 2002, 2002.
159
+ [21] M. P. Shah, S. N. Merchant, and S. P. Awate, “Abnormality detection using deep neural networks with robust quasi-norm autoencoding and semi-supervised learning,” in IEEE International Symposium on Biomedical Imaging (ISBI 2018), pp. 568–572.
160
+ [22] Y. L. Tan, H. Kim, S. Lee, T. Tihan, L. Ver Hoef, S. G. Mueller, A. J. Barkovich, D. Xu, and R. Knowlton, “Quantitative surface analysis of combined mri and pet enhances detection of focal cortical dysplasias.,” Neuroimage, vol. 166, pp. 10–18, 2018.
md/train/rk5upnsxe/rk5upnsxe.md ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NORMALIZING THE NORMALIZERS: COMPARING AND EXTENDING NETWORK NORMALIZATION SCHEMES
2
+
3
+ Mengye $\mathbf { R e n } ^ { * \dagger }$ , Renjie Liao∗†, Raquel Urtasun†, Fabian H. $\mathbf { S i n z ^ { \ddagger } }$ , Richard S. Zemel†> †University of Toronto, Toronto ON, CANADA ‡Baylor College of Medicine, Houston TX, USA >Canadian Institute for Advanced Research (CIFAR) {mren, rjliao, urtasun}@cs.toronto.edu fabian.sinz@epagoge.de, zemel@cs.toronto.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Normalization techniques have only recently begun to be exploited in supervised learning tasks. Batch normalization exploits mini-batch statistics to normalize the activations. This was shown to speed up training and result in better models. However its success has been very limited when dealing with recurrent neural networks. On the other hand, layer normalization normalizes the activations across all activities within a layer. This was shown to work well in the recurrent setting. In this paper we propose a unified view of normalization techniques, as forms of divisive normalization, which includes layer and batch normalization as special cases. Our second contribution is the finding that a small modification to these normalization schemes, in conjunction with a sparse regularizer on the activations, leads to significant benefits over standard normalization techniques. We demonstrate the effectiveness of our unified divisive normalization framework in the context of convolutional neural nets and recurrent neural networks, showing improvements over baselines in image classification, language modeling as well as super-resolution.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Standard deep neural networks are difficult to train. Even with non-saturating activation functions such as ReLUs (Krizhevsky et al., 2012), gradient vanishing or explosion can still occur, since the Jacobian gets multiplied by the input activation of every layer. In AlexNet (Krizhevsky et al., 2012), for instance, the intermediate activations can differ by several orders of magnitude. Tuning hyperparameters governing weight initialization, learning rates, and various forms of regularization thus become crucial in optimizing performance.
12
+
13
+ In current neural networks, normalization abounds. One technique that has rapidly become a standard is batch normalization (BN) in which the activations are normalized by the mean and standard deviation of the training mini-batch (Ioffe & Szegedy, 2015). At inference time, the activations are normalized by the mean and standard deviation of the full dataset. A more recent variant, layer normalization (LN), utilizes the combined activities of all units within a layer as the normalizer (Ba et al., 2016). Both of these methods have been shown to ameliorate training difficulties caused by poor initialization, and help gradient flow in deeper models.
14
+
15
+ A less-explored form of normalization is divisive normalization (DN) (Heeger, 1992), in which a neuron’s activity is normalized by its neighbors within a layer. This type of normalization is a well established canonical computation of the brain (Carandini & Heeger, 2012) and has been extensively studied in computational neuroscience and natural image modelling (see Section 2). However, with few exceptions (Jarrett et al., 2009; Krizhevsky et al., 2012) it has received little attention in conventional supervised deep learning.
16
+
17
+ Here, we provide a unifying view of the different normalization approaches by characterizing them as the same transformation but along different dimensions of a tensor, including normalization across examples, layers in the network, filters in a layer, or instances of a filter response. We explore the effect of these varieties of normalizations in conjunction with regularization, on the prediction performance compared to baseline models. The paper thus provides the first study of divisive normalization in a range of neural network architectures, including convolutional neural networks (CNNs) and recurrent neural networks (RNNs), and tasks such as image classification, language modeling and image super-resolution. We find that DN can achieve results on par with BN in CNN networks and out-performs it in RNNs and super-resolution, without having to store batch statistics. We show that casting LN as a form of DN by incorporating a smoothing parameter leads to significant gains, in both CNNs and RNNs. We also find advantages in performance and stability by being able to drive learning with higher learning rate in RNNs using DN. Finally, we demonstrate that adding an L1 regularizer on the activations before normalization is beneficial for all forms of normalization.
18
+
19
+ # 2 RELATED WORK
20
+
21
+ In this section we first review related work on normalization, followed by a brief description of regularization in neural networks.
22
+
23
+ # 2.1 NORMALIZATION
24
+
25
+ Normalization of data prior to training has a long history in machine learning. For instance, local contrast normalization used to be a standard effective tool in vision problems (Pinto et al., 2008; Jarrett et al., 2009; Sermanet et al., 2012; Le, 2013). However, until recently, normalization was usually not part of the machine learning algorithm itself. Two notable exceptions are the original AlexNet by Krizhevsky et al. (2012) which includes a divisive normalization step over a subset of features after ReLU at each pixel location, and the work by Jarrett et al. (2009) who demonstrated that a combination of nonlinearities, normalization and pooling improves object recognition in two-stage networks.
26
+
27
+ Recently Ioffe & Szegedy (2015) demonstrated that standardizing the activations of the summed inputs of neurons over training batches can substantially decrease training time in deep neural networks. To avoid covariate shift, where the weight gradients in one layer are highly dependent on previous layer outputs, Batch Normalization (BN) rescales the summed inputs according to their variances under the distribution of the mini-batch data. Specifically, if $z _ { j , n }$ denotes the activation of a neuron $j$ on example $n$ , and $B ( n )$ denotes the mini-batch of examples that contains $n$ , then BN computes an affine function of the activations standardized over each mini-batch:
28
+
29
+ $$
30
+ \tilde { z } _ { n , j } = \gamma \frac { z _ { n , j } - \mathbb { E } [ z _ { j } ] } { \sqrt { \frac { 1 } { | B ( n ) | } ( z _ { n , j } - \mathbb { E } [ z _ { j } ] ) ^ { 2 } } } + \beta \quad \mathbb { E } [ z _ { j } ] = \frac { 1 } { | B ( n ) | } \sum _ { m \in B ( n ) } z _ { m , j }
31
+ $$
32
+
33
+ However, training performance in Batch Normalization strongly depends on the quality of the aquired statistics and, therefore, the size of the mini-batch. Hence, Batch Normalization is harder to apply in cases for which the batch sizes are small, such as online learning or data parallelism. While classification networks can usually employ relatively larger mini-batches, other applications such as image segmentation with convolutional nets use smaller batches and suffer from degraded performance. Moreover, application to recurrent neural networks (RNNs) is not straightforward and leads to poor performance (Laurent et al., 2015).
34
+
35
+ Several approaches have been proposed to make Batch Normalization applicable to RNNs. Cooijmans et al. (2016) and Liao & Poggio (2016) collect separate batch statistics for each time step. However, neither of this techniques address the problem of small batch sizes and it is unclear how to generalize them to unseen time steps.
36
+
37
+ More recently, Ba et al. (2016) proposed Layer Normalization (LN), where the activations are normalized across all summed inputs within a layer instead of within a batch:
38
+
39
+ $$
40
+ \tilde { z } _ { n , j } = \gamma \frac { z _ { n , j } - \mathbb { E } [ z _ { n } ] } { \sqrt { \frac { 1 } { | L ( j ) | } ( z _ { n , j } - \mathbb { E } [ z _ { n } ] ) ^ { 2 } } } + \beta \quad \mathbb { E } [ z _ { n } ] = \frac { 1 } { | L ( j ) | } \sum _ { k \in L ( j ) } z _ { n , k }
41
+ $$
42
+
43
+ where $L ( j )$ contains all of the units in the same layer as $j$ . While promising results have been shown on RNN benchmarks, direct application of layer normalization to convolutional layers often leads to a degradation of performance. The authors hypothesize that since the statistics in convolutional layers can vary quite a bit spatially, normalization with statistics from an entire layer might be suboptimal.
44
+
45
+ Ulyanov et al. (2016) proposed to normalize each example on spatial dimensions but not on channel dimension, and was shown to be effective on image style transfer applications (Gatys et al., 2016).
46
+
47
+ Liao et al. (2016a) proposed to accumulate the normalization statistics over the entire training phase, and showed that this can speed up training in recurrent and online learning without a deteriorating effect on the performance. Since gradients cannot be backpropagated through this normalization operation, the authors use running statistics of the gradients instead.
48
+
49
+ Exploring the normalization of weights instead of activations, Salimans & Kingma (2016) proposed a reparametrization of the weights into a scale independent representation and demonstrated that this can speed up training time.
50
+
51
+ Divisive Normalization (DN) on the other hand modulates the neural activity by the activity of a pool of neighboring neurons (Heeger, 1992; Bonds, 1989). DN is one of the most well studied and widely found transformations in real neural systems, and thus has been called a canonical computation of the brain (Carandini & Heeger, 2012). While the exact form of the transformation can differ, all formulations model the response of a neuron $\tilde { z } _ { j }$ as a ratio between the acitivity in a summation field $A _ { j }$ , and a norm-like function of the suppression field $B _ { j }$
52
+
53
+ $$
54
+ \tilde { z } _ { j } = \gamma \frac { \sum _ { z _ { i } \in A _ { j } } u _ { i } z _ { i } } { \left( \sigma ^ { 2 } + \sum _ { z _ { k } \in B _ { j } } w _ { k } z _ { k } ^ { p } \right) ^ { \frac { 1 } { p } } } ,
55
+ $$
56
+
57
+ where $\{ u _ { i } \}$ are the summation weights and $\{ w _ { k } \}$ the suppression weights.
58
+
59
+ Previous theoretical studies have outlined several potential computational roles for divisive normalization such as sensitivity maximization (Carandini & Heeger, 2012), invariant coding (Olsen et al., 2010), density modelling (Balle et al., 2016), image compression (Malo et al., 2006), distributed ´ neural representations (Simoncelli & Heeger, 1998), stimulus decoding (Ringach, 2009; Froudarakis et al., 2014), winner-take-all mechanisms (Busse et al., 2009), attention (Reynolds & Heeger, 2009), redundancy reduction (Schwartz & Simoncelli, 2001; Sinz & Bethge, 2008; Lyu & Simoncelli, 2008; Sinz & Bethge, 2013), marginalization in neural probabilistic population codes (Beck et al., 2011), and contextual modulations in neural populations and perception (Coen-Cagli et al., 2015; Schwartz et al., 2009).
60
+
61
+ # 2.2 REGULARIZATION
62
+
63
+ Various regularization techniques have been applied to neural networks for the purpose of improving generalization and reduce overfitting. They can be roughly divided into two categories, depending on whether they regularize the weights or the activations.
64
+
65
+ Regularization on Weights: The most common regularizer on weights is weight decay which just amounts to using the L2 norm squared of the weight vector. An L1 regularizer (Goodfellow et al., 2016) on the weights can also be adopted to push the learned weights to become sparse. Scardapane et al. (2016) investigated mixed norms in order to promote group sparsity.
66
+
67
+ Regularization on Activations: Sparsity or group sparsity regularizers on the activations have shown to be effective in the past (Roz, 2008; Kavukcuoglu et al., 2009) and several regularizers have been proposed that act directly on the neural activations. Glorot et al. (2011) add a sparse regularizer on the activations after ReLU to encourage sparse representations. Dropout developed by Srivastava et al. (2014) applies random masks to the activations in order to discourage them to co-adapt. DeCov proposed by Cogswell et al. (2015) tries to minimize the off-diagonal terms of the sample covariance matrix of activations, thus encouraging the activations to be as decorrelated as possible. Liao et al. (2016b) utilize a clustering-based regularizer to encourage the representations to be compact.
68
+
69
+ ![](images/7afa409e91844823c5f5a96c82b15d3ac85cc733e0add770b1f39546280e3fbd.jpg)
70
+ Figure 1: Illustration of different normalization schemes, in a CNN. Each $H \times W$ -sized feature map is depicted as a rectangle; overlays depict instances in the set of $C$ filters; and two examples from a mini-batch of size $N$ are shown, one above the other. The colors show the summation/suppression fields of each scheme.
71
+
72
+ # 3 A UNIFIED FRAMEWORK FOR NORMALIZING NEURAL NETS
73
+
74
+ We first compare the three existing forms of normalization, and show that we can modify batch normalization (BN) and layer normalization (LN) in small ways to make them have a form that matches divisive normalization (DN). We present a general formulation of normalization, where existing normalizations involve alternative schemes of accumulating information. Finally, we propose a regularization term that can be optimized jointly with these normalization schemes to encourage decorrelation and/or improve generalization performance.
75
+
76
+ # 3.1 GENERAL FORM OF NORMALIZATION
77
+
78
+ Without loss of generality, we denote the hidden input activation of one arbitrary layer in a deep neural network as $\mathbf { z } \in \mathbb { R } ^ { \tilde { N } \times L }$ . Here $N$ is the mini-batch size. In the case of a CNN, $L = H \times W \times C$ , where $H , W$ are the height and width of the convolutional feature map and $C$ is the number of filters. For an RNN or fully-connected layers of a neural net, $L$ is the number of hidden units.
79
+
80
+ Different normalization methods gather statistics from different ranges of the tensor and then perform normalization. Consider the following general form:
81
+
82
+ $$
83
+ \begin{array} { l } { \displaystyle z _ { n , j } = \sum _ { i } w _ { i , j } x _ { n , i } + b _ { j } } \\ { \displaystyle v _ { n , j } = z _ { n , j } - \mathbb { E } _ { A _ { n , j } } [ z ] } \\ { \displaystyle \tilde { z } _ { n , j } = \frac { v _ { n , j } } { \sqrt { \sigma ^ { 2 } + \mathbb { E } _ { \mathcal { B } _ { n , j } } [ v ^ { 2 } ] } } } \end{array}
84
+ $$
85
+
86
+ where $A _ { j }$ and $B _ { j }$ are subsets of $z$ and $v$ respectively. $\mathcal { A }$ and $\boldsymbol { B }$ in standard divisive normalization are referred to as summation and suppression fields (Carandini & Heeger, 2012). One can cast each normalization scheme into this general formulation, where the schemes vary based on how they define these two fields. These definitions are specified in Table 1. Optional parameters $\gamma$ and $\beta$ can be added in the form of $\gamma _ { j } \tilde { z } _ { n , j } + \beta _ { j }$ to increase the degree of freedom.
87
+
88
+ Fig. 1 shows a visualization of the normalization field in a 4-D ConvNet tensor setting. Divisive normalization happens within a local spatial window of neurons across filter channels. Here we set $d ( \cdot , \cdot )$ to be the spatial $L _ { \infty }$ distance.
89
+
90
+ # 3.2 NEW MODEL COMPONENTS
91
+
92
+ Smoothing the Normalizers: One obvious way in which the normalization schemes differ is in terms of the information that they combine for normalizing the activations. A second more subtle but important difference between standard BN and LN as opposed to DN is the smoothing term $\sigma$ in the denominator of Eq. (1). This term allows some control of the bias of the variance estimation, effectively smoothing the estimate. This is beneficial because divisive normalization does not utilize information from the mini-batch as in BN, and combines information from a smaller field than LN. A similar but different denominator bias term $\operatorname* { m a x } ( \sigma , c )$ appears in (Jarrett et al., 2009), which is active when the activation variance is small. However, the clipping function makes the transformation not invertible, losing scale information.
93
+
94
+ <table><tr><td>Model</td><td>Range</td><td>Normalizer Bias</td></tr><tr><td>BN</td><td>An,j ={2m,j : m ∈[1,N],j ∈[1,H] × [1,W]} Bn,j = {Um,j : m ∈ [1,N],j ∈[1,H] ×[1,W]}</td><td>g=0</td></tr><tr><td>LN</td><td>An,j ={zn,i :i ∈[1,L]} Bn,j={Un,i : i∈[1,L]}</td><td>σ=0</td></tr><tr><td>DN</td><td>An,j ={2n,i : d(i,j)≤RA} Bn,j = {Un,i : d(i,j)≤RB}</td><td>q≥0</td></tr></table>
95
+
96
+ ![](images/d63310effcc1b91cb115f2cb79a7e41e385d5387bd1dc9b65883bcc9a676fc13.jpg)
97
+ Table 1: Different choices of the summation and suppression fields $\mathcal { A }$ and $\boldsymbol { B }$ , as well as the constant $\sigma$ in the normalizer lead to known normalization schemes in neural networks. $d ( i , j )$ denotes an arbitrary distance between two hidden units $_ { i }$ and $j$ , and $R$ denotes the neighbourhood radius.
98
+ Figure 2: Divisive normalization followed by ReLU can be viewed as a new activation function. Left: Effect of varying $\sigma$ in this activation function. Right: Two units affect each other’s activation in the $\mathrm { D N + }$ ReLU formulation.
99
+
100
+ Moreover, if we take the nonlinear activation function after normalization into consideration, we find that $\sigma$ will change the overall properties of the non-linearity. To illustrate this effect, we use a simple 1-layer network which consists of: two input units, one divisive normalization operator, followed by a ReLU activation function. If we fix one input unit to be 0.5, varying the other one with different values of $\sigma$ produces different output curves (Fig. 2, left). These curves exhibit different non-linear properties compared to the standard ReLU. Allowing the other input unit to vary as well results in different activation functions of the first unit depending on the activity of the second (Fig. 2, right). This illustrates potential benefits of including this smoothing term $\sigma$ , as it effectively modulates the rectified response to vary from a linear to a highly saturated response.
101
+
102
+ In this paper we propose modifications of the standard BN and LN which borrow this additive term $\sigma$ in the denominator from DN. We study the effect of incorporating this smoother in the respective normalization schemes below.
103
+
104
+ L1 regularizer: Filter responses on lower layers in deep neural networks can be quite correlated which might impair the estimate of the variance in the normalizer. More independent representations help disentangle latent factors and boost the networks performance (Higgins et al., 2016). Empirically, we found that putting a sparse (L1) regularizer
105
+
106
+ $$
107
+ \mathcal { L } _ { L 1 } = \alpha \frac { 1 } { N L } \sum _ { n , j } | v _ { n , j } |
108
+ $$
109
+
110
+ on the centered activations $v _ { n , j }$ helps decorrelate the filter responses (Fig. 5). Here, $N$ is the batch size and $L$ is the number of hidden units, and $\mathcal { L } _ { L 1 }$ is the regularization loss which is added to the training loss.
111
+
112
+ A possible explanation for this effect is that the L1 regularizer might have a similar effect as maximum likelihood estimation of an independent Laplace distribution. To see that, let $p _ { v } \left( \mathbf { v } \right) \propto \exp \left( - \left\| \mathbf { v } \right\| _ { 1 } \right)$ and $\mathbf { x } = W ^ { - 1 } \mathbf { v }$ , with $W$ a full rank invertible matrix. Under this model $p _ { x } \left( \mathbf { x } \right) = p _ { v } \left( W \mathbf { x } \right) \left| \operatorname* { d e t } W \right|$ .
113
+
114
+ Then, minimization of the L1 norm of the activations under the volume-conserving constraint det $A =$ const. corresponds to maximum likelihood on that model, which would encourage decorrelated responses. We do not enforce such a constraint, and the filter matrix might even not be invertible. However, the supervised loss function of the network benefits from having diverse non-zero filters. This encourages the network to not collapse filters along the same direction or put them to zero, and might act as a relaxation of the volume-conserving constraint.
115
+
116
+ # 3.3 SUMMARY OF NEW MODELS
117
+
118
+ DN and $\mathbf { D } \mathbf { N } ^ { * }$ : We propose DN as a new local normalization scheme in neural networks. In convolutional layers, it operates on a local spatial window across filter channels, and in fully connected layers it operates on a slice of a hidden state vector. Additionally, $\mathrm { D N ^ { * } }$ has a L1 regularizer on the pre-normalization centered activation $( v _ { n , j } )$ .
119
+
120
+ BN-s and $\mathbf { B N } ^ { * }$ : To compare with DN and $\mathrm { D N ^ { * } }$ , we also propose modifications to original BN: we denote BN-s with $\sigma ^ { 2 }$ in the denominator’s square root, and $\mathbf { B N } ^ { * }$ with the L1 regularizer on top of BN-s.
121
+
122
+ LN-s and $\mathbf { L N ^ { * } }$ : We apply the same changes as from BN to BN-s and $\mathbf { B N } ^ { * }$ . In order to narrow the differences in the normalization schemes down to a few parameter choices, we additionally remove the affine transformation parameters $\gamma$ and $\beta$ from LN such that the difference between $\mathrm { L N ^ { * } }$ and $\mathrm { D N ^ { * } }$ is only the size of the normalization field. $\gamma$ and $\beta$ can really be seen as a separate layer and in practice we find that they do not improve the performance in the presence of $\sigma ^ { 2 }$ .
123
+
124
+ # 4 EXPERIMENTS
125
+
126
+ We evaluate the normalization schemes on three different tasks:
127
+
128
+ CNN image classification: We apply different normalizations on CNNs trained on the CIFAR-10/100 datasets for image recognition, each of which contains 50,000 training images and 10,000 test images. Each image is of size $3 2 \times 3 2 \times 3$ and has been labeled an object class out of 10 or 100 total number of classes.
129
+ RNN language modeling: We apply different normalizations on RNNs trained on the Penn Treebank dataset for language modeling, containing 42,068 training sentences, 3,370 validation sentences, and 3,761 test sentences.
130
+ CNN image super-resolution: We train a CNN on low resolution images and learn cascades of non-linear filters to smooth the upsampled images. We report performance of trained CNN on the standard Set 14 and Berkeley 200 dataset.
131
+
132
+ For each model, we perform a grid search of three or four choices of each hyperparameter including the smoothing constant $\sigma$ , and L1 regularization constant $\alpha$ , and learning rate $\epsilon$ on the validation set.
133
+
134
+ # 4.1 CIFAR EXPERIMENTS
135
+
136
+ We used the standard CNN model provided in the Caffe library. The architecture is summarized in Table 2. We apply normalization before each ReLU function. We implement DN as a convolutional operator, fixing the local window size to $5 \times 5 , 3 \times 3 , 3 \times 3$ for the three convolutional layers in all the CIFAR experiments.
137
+
138
+ We set the learning rate to 1e-3 and momentum 0.9 for all experiments. The learning rate schedule is set to $\{ 5 \mathrm { K } , 3 0 \mathrm { K } , 5 0 \mathrm { K } \}$ for the baseline model and to $\{ 3 0 \mathrm { K } , 5 0 \mathrm { K } , 8 0 \mathrm { K } \}$ for all other models. At every stage we multiply the learning rate by 0.1. Weights are randomly initialized from a zero-mean normal distribution with standard deviation $\{ 1 \mathrm { e } { - } 4 , 1 \mathrm { e } { - } 2 , 1 \mathrm { e } { - } 2 \}$ for the convolutional layers, and $\{ 1 \mathrm { e } \mathrm { - } 1 , 1 \mathrm { e } \mathrm { - } 1 \}$ for fully connected layers. Input images are centered on the dataset image mean.
139
+
140
+ Table 3 summarizes the test performances of $\mathbf { B N } ^ { * }$ , $\mathrm { L N ^ { * } }$ and $\mathrm { D N ^ { * } }$ , compared to the performance of a few baseline models and the standard batch and layer normalizations. We also add standard regularizers to the baseline model: L2 weight decay (WD) and dropout. Adding the smoothing constant and L1 regularization consistently improves the classification performance, especially for the original LN. The modification of LN makes it now better than the original BN, and only slightly worse than $\mathbf { B N } ^ { * }$ . $\mathrm { D N ^ { * } }$ achieves comparable performance to $\mathbf { B N ^ { * } }$ on both datasets, but only relying on a local neighborhood of hidden units.
141
+
142
+ Table 2: CIFAR CNN specification
143
+
144
+ <table><tr><td>Type</td><td>Size</td><td>Kernel</td><td>Stride</td></tr><tr><td>input</td><td>32 × 32×3</td><td>1</td><td>-</td></tr><tr><td>conv +relu</td><td>32 × 32 × 32</td><td>5×5×3×32</td><td>1</td></tr><tr><td>max pool</td><td>16 ×16×32</td><td>3×3</td><td>2</td></tr><tr><td>conv +relu</td><td>16 ×16 × 32</td><td>5×5×32×32</td><td>1</td></tr><tr><td>avg pool</td><td>8×8×32</td><td>3×3</td><td>2</td></tr><tr><td>conv +relu</td><td>8×8×64</td><td>5×5×32×64</td><td>1</td></tr><tr><td>avg pool</td><td>4×4×64</td><td>3×3</td><td>2</td></tr><tr><td>fully conn. linear</td><td>64</td><td></td><td></td></tr><tr><td>fully conn. linear</td><td>10 or 100</td><td></td><td></td></tr></table>
145
+
146
+ Table 3: CIFAR-10/100 experiments
147
+
148
+ <table><tr><td>Model</td><td>CIFAR-10 Acc.</td><td>CIFAR-100 Acc.</td></tr><tr><td>Baseline</td><td>0.7565</td><td>0.4409</td></tr><tr><td>Baseline +WD +Dropout</td><td>0.7795</td><td>0.4179</td></tr><tr><td>BN</td><td>0.7807</td><td>0.4814</td></tr><tr><td>LN</td><td>0.7211</td><td>0.4249</td></tr><tr><td>BN*</td><td>0.8179</td><td>0.5156</td></tr><tr><td>LN*</td><td>0.8091</td><td>0.4957</td></tr><tr><td>DN*</td><td>0.8122</td><td>0.5066</td></tr></table>
149
+
150
+ ResNet Experiments. Residual networks (ResNet) (He et al., 2016), a type of CNN with residual connections between layers, achieve impressive performance on many image classification benchmarks. The original architecture uses BN by default. If we remove BN, the architecture is very difficult to train or converges to a poor solution. We first reproduced the original BN ResNet-32, obtaining $9 2 . 6 \%$ accuracy on CIFAR10, and $6 9 . 8 \%$ on CIFAR-100. Our best DN model achieves $9 1 . 3 \%$ and $6 6 . 6 \%$ , respectively. While this performance is lower than the original BN-ResNet, there is certainly room to improve as we have not performed any hyperparameter optimization. Importantly, the beneficial effects of sigma $( 2 . 5 \%$ gain on CIFAR-100) and the L1 regularizer $( 0 . 5 \% )$ are still found, even in the presence of other regularization techniques such as data augmentation and weight decay in the training.
151
+
152
+ Since the number of sigma hyperparameters scales with the number of layers, we found that setting sigma as a learnable parameter for each layer helps the performance ( $1 . 3 \%$ gain on CIFAR-100). Note that training this parameter is not possible in the formulation by Jarrett et al. (2009). The learned sigma shows a clear trend: it tends to decrease with depth, and in the last convolution layer it approaches 0 (see Fig. 3).
153
+
154
+ ![](images/b4882b3c89c63b0674080200a65977f1e4cf98d6a7049e5afb6bad5d14fc32bf.jpg)
155
+ Figure 3: Input scale $( | x | )$ vs. learned $\sigma$ at each layer, color coded by the layer number in ResNet-32, trained on CIFAR-10 (left), and CIFAR-100 (right).
156
+
157
+ # 4.2 RNN EXPERIMENTS
158
+
159
+ To apply divisive normalization in fully connected layers of RNNs, we consider a local neighborhood in the hidden state vector $\mathbf { h } _ { j - R : j + R }$ , where $R$ is the radius
160
+
161
+ Table 4: PTB Word-level language modeling experiments
162
+
163
+ <table><tr><td>Model</td><td>LSTM</td><td>TanH RNN</td><td>ReLU RNN</td></tr><tr><td>Baseline</td><td>115.720</td><td>149.357</td><td>147.630</td></tr><tr><td>BN</td><td>123.245</td><td>148.052</td><td>164.977</td></tr><tr><td>LN</td><td>119.247</td><td>154.324</td><td>149.128</td></tr><tr><td>BN*</td><td>116.920</td><td>129.155</td><td>138.947</td></tr><tr><td>LN*</td><td>101.725</td><td>129.823</td><td>116.609</td></tr><tr><td>DN*</td><td>102.238</td><td>123.652</td><td>117.868</td></tr></table>
164
+
165
+ of the neighborhood. Although the hidden states are randomly initialized, this structure will impose local competition among the neighbors.
166
+
167
+ $$
168
+ \begin{array} { l } { \displaystyle v _ { j } = z _ { j } - \frac { 1 } { 2 R + 1 } \sum _ { r = - R } ^ { R } z _ { j + r } } \\ { \displaystyle \tilde { z } _ { j } = \frac { v _ { j } } { \sqrt { \sigma ^ { 2 } + \frac { 1 } { 2 R + 1 } \sum _ { r = - R } ^ { R } v _ { j + r } ^ { 2 } } } } \end{array}
169
+ $$
170
+
171
+ We follow Cooijmans et al. (2016)’s batch normalization implementation for RNNs: normalizers are separate for input transformation and hidden transformation. Let $B N ( \cdot ) , L N ( \cdot ) , D N ( \cdot )$ be BatchNorm, LayerNorm and DivNorm, and $g$ be either tanh or ReLU.
172
+
173
+ $$
174
+ \begin{array} { r l } & { \mathbf { h } _ { t + 1 } = g ( W _ { x } \mathbf { x } _ { t } + W _ { h } \mathbf { h } _ { t - 1 } + b ) } \\ & { \mathbf { h } _ { t + 1 } ^ { ( B N ) } = g ( B N ( W _ { x } \mathbf { x } _ { t } + b _ { x } ) + B N ( W _ { h } \mathbf { h } _ { t - 1 } ^ { ( B N ) } + b _ { h } ) ) } \\ & { \mathbf { h } _ { t + 1 } ^ { ( L N ) } = g ( L N ( W _ { x } \mathbf { x } _ { t } + W _ { h } \mathbf { h } _ { t - 1 } ^ { ( L N ) } + b ) ) } \\ & { \mathbf { h } _ { t + 1 } ^ { ( D N ) } = g ( D N ( W _ { x } \mathbf { x } _ { t } + W _ { h } \mathbf { h } _ { t - 1 } ^ { ( D N ) } + b ) ) } \end{array}
175
+ $$
176
+
177
+ Note that in recurrent BN, the additional parameters $\gamma$ and $\beta$ are shared across timesteps whereas the moving averages of batch statistics are not shared. For the LSTM version, we followed the released implementation from the authors of layer normalization 1, and apply LN at the same places as BN and $\mathbf { B N ^ { * } }$ , which is after the linear transformation of $W _ { x } { \bf x }$ and $W _ { h } \mathbf { h }$ individually. For $\mathrm { L N ^ { * } }$ and DN, we modified the places of normalization to be at each non-linearity, instead of jointly with a concatenated vector for different non-linearity. We found that this modification improves the performance and makes the formulation clearer since normalization is always a combined operation with the activation function. We include details of the LSTM implementation in the Appendix.
178
+
179
+ The RNN model is provided by the Tensorflow library (Abadi et al., 2016) and the LSTM version was originally proposed in Zaremba et al. (2014). We used a two-layer stack-RNN of size 400 (vanilla RNN) or 200 (LSTM). $R$ is set to 60 (vanilla RNN) and 30 (LSTM). We tried both tanh and ReLU as the activation function for the vanilla RNN. For unnormalized baselines and BN+ReLU, the initial learning rate is set to 0.1 and decays by half every epoch, starting at the 5th epoch for a maximum of 13 epochs. For the other normalized models, the initial learning rate is set to 1.0 while the schedule is kept the same. Standard stochastic gradient descent is used in all RNN experiments, with gradient clipping at 5.0.
180
+
181
+ Table 4 shows the test set perplexity for LSTM models and vanilla models. Perplexity is defined as $\begin{array} { r } { \mathrm { p p l } = \exp ( - \sum _ { x } \log p ( x ) ) } \end{array}$ . We find that BN and LN alone do not improve the final performance relative to the baseline, but similar to what we see in the CNN experiments, our modified versions $\mathbf { B N } ^ { * }$ and $\mathrm { L N ^ { * } }$ show significant improvements. $\mathbf { B N } ^ { * }$ on RNN is outperformed by both $\mathrm { L N ^ { * } }$ and DN. By applying our normalization, we can improve the vanilla RNN perplexity by $20 \%$ , comparable to an LSTM baseline with the same hidden dimension.
182
+
183
+ Table 5: Average test results of PSNR and SSIM on Set14 Dataset.
184
+
185
+ <table><tr><td>Model</td><td>PSNR (x3)</td><td>SSIM (x3)</td><td>PSNR (x4)</td><td>SSIM (x4)</td></tr><tr><td>Bicubic</td><td>27.54</td><td>0.7733</td><td>26.01</td><td>0.7018</td></tr><tr><td>A+</td><td>29.13</td><td>0.8188</td><td>27.32</td><td>0.7491</td></tr><tr><td>SRCNN</td><td>29.35</td><td>0.8212</td><td>27.53</td><td>0.7512</td></tr><tr><td>BN</td><td>22.31</td><td>0.7530</td><td>21.40</td><td>0.6851</td></tr><tr><td>DN*</td><td>29.38</td><td>0.8229</td><td>27.64</td><td>0.7562</td></tr></table>
186
+
187
+ Table 6: Average test results of PSNR and SSIM on BSD200 Dataset.
188
+
189
+ <table><tr><td>Model</td><td>PSNR (x3)</td><td>SSIM (x3)</td><td>PSNR (x4)</td><td>SSIM (x4)</td></tr><tr><td>Bicubic</td><td>27.19</td><td>0.7636</td><td>25.92</td><td>0.6952</td></tr><tr><td>A+</td><td>27.05</td><td>0.7945</td><td>25.51</td><td>0.7171</td></tr><tr><td>SRCNN</td><td>28.42</td><td>0.8100</td><td>26.87</td><td>0.7378</td></tr><tr><td>BN</td><td>21.89</td><td>0.7553</td><td>21.53</td><td>0.6741</td></tr><tr><td>DN*</td><td>28.44</td><td>0.8110</td><td>26.96</td><td>0.7428</td></tr></table>
190
+
191
+ # 4.3 SUPER RESOLUTION EXPERIMENTS
192
+
193
+ We also evaluate DN on the low-level computer vision problem of single image super-resolution. We adopt the SRCNN model of Dong et al. (2016) as the baseline which consists of 3 convolutional layers and 2 ReLUs. From bottom to top layers, the sizes of the filters are 9, 5, and $5 ^ { 2 }$ . The number of filters are 64, 32, and 1, respectively. All the filters are initialized with zero-mean Gaussian and standard deviation 1e-3. Then we respectively apply batch normalization (BN) and our divisive normalization with L1 regularization $\mathrm { ( D N ^ { * } ) }$ to the convolutional feature maps before ReLUs. We construct the training set in a similar manner as Dong et al. (2016) by randomly cropping 5 million patches (size $3 3 \times 3 3$ ) from a subset of the ImageNet dataset of Deng et al. (2009). We only train our model for 4 million iterations which is less than the one adopted by SRCNN, i.e., 15 million, as the gain of PSNR and SSIM by spending that long time is marginal.
194
+
195
+ We report the average test results, utilizing the standard metrics PSNR and SSIM (Wang et al., 2004), on two standard test datasets Set14 (Zeyde et al., 2010) and BSD200 (Martin et al., 2001). We compare with two state-of-the-art single image super-resolution methods, $\mathbf { A } +$ (Timofte et al., 2013) and SRCNN (Dong et al., 2016). All measures are computed on the Y channel of YCbCr color space. We also provide a visual comparison in Fig. 4.
196
+
197
+ As show in Tables 5 and $6 \mathrm { D N ^ { * } }$ outperforms the strong competitor SRCNN, while BN does not perform well on this task. The reason may be that BN applies the same statistics to all patches of one image which causes some overall intensity shift (see Figs. 4). From the visual comparisons, we can see that our method not only enhances the resolution but also removes artifacts, e.g., the ringing effect in Fig. 4.
198
+
199
+ # 4.4 ABLATION STUDIES AND DISCUSSION
200
+
201
+ Finally, we investigated the differential effects of the $\sigma ^ { 2 }$ term and the L1 regularizer on the performance. We ran ablation studies on CIFAR-10/100 as well as PTB experiments. The results are listed in Table 7.
202
+
203
+ We find that adding the smoothing term $\sigma ^ { 2 }$ and the L1 regularization consistently increases the performance of the models. In the convolutional networks, we find that L1 and $\sigma$ both have similar effects on the performance. L1 seems to be slightly more important. In recurrent networks, $\sigma ^ { 2 }$ has a much more dramatic effect on the performance than the L1 regularizer.
204
+
205
+ Fig. 5 plots randomly sampled pairwise pre-normalization responses (after the linear transform) in the first layer at the same spatial location of the feature map, along with the average pair-wise correlation coefficient (Corr) and mutual information (MI). It is evident that both $\sigma$ and L1 encourages independence of the learned linear filters.
206
+
207
+ ![](images/090b20a24d6ae6c624e15087fab161aaefefe7279354974371ce44562d12e36a.jpg)
208
+ Figure 4: Comparisons at a magnification factor of 4.
209
+
210
+ There are several factors that could explain the improvement in performance. As mentioned above, adding the L1 regularizer on the activations encourages the filter responses to be less correlated. This can increase the robustness of the variance estimate in the normalizer and lead to an improved scaling of the responses to a good regime. Furthermore, adding the smoother to the denominator in the normalizer can be seen as implicitly injecting zero mean noise on the activations. While noise injection would not change the mean, it does add a term to the variance of the data, which is represented by $\sigma ^ { 2 }$ . This term also makes the normalization equation invertible. While dividing by the standard deviation decreases the degrees of freedom in the data, the smoothed normalization equation is fully information preserving. Finally, DN type operations have been shown to decrease the redundancy of filter responses to natural images and sound (Schwartz & Simoncelli, 2001; Sinz & Bethge, 2008; Lyu & Simoncelli, 2008). In combination with the L1 regularizer this could lead to a more independent representation of the data and thereby increase the performance of the network.
211
+
212
+ # 5 CONCLUSIONS
213
+
214
+ We have proposed a unified view of normalization techniques which contains batch and layer normalization as special cases. We have shown that when combined with a sparse regularizer on the activations, our framework has significant benefits over standard normalization techniques. We have demonstrated this in the context of both convolutional neural nets as well as recurrent neural networks. In the future we plan to explore other regularization techniques such as group sparsity. We also plan to conduct a more in-depth analysis of the effects of normalization on the correlations of the learned representations.
215
+
216
+ Table 7: Comparison of standard batch and layer normalation (BN and LN) models, to those with only L1 regularizer $( + \mathrm { L } 1 )$ , only the $\sigma$ smoothing term (-s), and with both $( ^ { \ast } )$ . We also compare divisive normalization with both $\mathrm { ( D N ^ { * } ) }$ , versus with only the smoothing term (DN).
217
+
218
+ <table><tr><td>Model</td><td>CIFAR-10</td><td>CIFAR-100</td><td>LSTM</td><td>Tanh RNN</td><td>ReLU RNN</td></tr><tr><td>Baseline Baseline +L1</td><td>0.7565 0.7839</td><td>0.4409 0.4517</td><td>115.720 111.885</td><td>149.357 143.965</td><td>147.630 148.572</td></tr><tr><td>BN BN+L1 BN-s</td><td>0.7807 0.8067 0.8017 0.8179</td><td>0.4814 0.5100 0.5005 0.5156</td><td>123.245 123.736 123.243 116.920</td><td>148.052 152.777 131.719 129.155</td><td>164.977 166.658 139.159 138.947</td></tr><tr><td>BN* LN LN +L1</td><td>0.7211 0.7994</td><td>0.4249 0.4990</td><td>119.247 116.964</td><td>154.324</td><td>149.128</td></tr><tr><td>LN-s</td><td></td><td></td><td></td><td>152.100</td><td>147.937</td></tr><tr><td></td><td>0.8083</td><td>0.4863</td><td>102.492</td><td>133.812</td><td>118.786</td></tr><tr><td>LN*</td><td>0.8091</td><td>0.4957</td><td>101.725</td><td></td><td></td></tr><tr><td>DN</td><td>0.8058</td><td></td><td></td><td>129.823</td><td>116.609</td></tr><tr><td></td><td></td><td>0.4892</td><td>103.714</td><td>132.143</td><td>118.789</td></tr><tr><td>DN*</td><td>0.8122</td><td>0.5066</td><td>102.238</td><td>123.652</td><td>117.868</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
219
+
220
+ ![](images/b496fa2d7d75c659348112917263aca498f1799a72f90f05b1a97f31a970315e.jpg)
221
+ Figure 5: First layer CNN pre-normalized activation joint histogram
222
+
223
+ Acknowledgements RL is supported by Connaught International Scholarships. FS would like to thank Edgar Y. Walker, Shuang Li, Andreas Tolias and Alex Ecker for helpful discussions. Supported by the Intelligence Advanced Research Projects Activity (IARPA) via Department of Interior/Interior Business Center (DoI/IBC) contract number D16PC00003. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DoI/IBC, or the U.S. Government.
224
+
225
+ # REFERENCES
226
+
227
+ Sparse coding via thresholding and local competition in neural circuits. Neural Computation, 20(10): 2526–63, 2008. ISSN 08997667. doi: 10.1162/neco.2008.03-07-486.
228
+
229
+ Abadi, Mart´ın, Barham, Paul, Chen, Jianmin, Chen, Zhifeng, Davis, Andy, Dean, Jeffrey, Devin, Matthieu, Ghemawat, Sanjay, Irving, Geoffrey, Isard, Michael, Kudlur, Manjunath, Levenberg, Josh, Monga, Rajat, Moore, Sherry, Murray, Derek Gordon, Steiner, Benoit, Tucker, Paul A., Vasudevan, Vijay, Warden, Pete, Wicke, Martin, Yu, Yuan, and Zhang, Xiaoqiang. Tensorflow: A system for large-scale machine learning. CoRR, abs/1605.08695, 2016.
230
+
231
+ Ba, Jimmy Lei, Kiros, Jamie Ryan, and Hinton, Geoffrey E. Layer normalization. CoRR, abs/1607.06450, 2016.
232
+
233
+ Balle, Johannes, Laparra, Valero, and Simoncelli, Eero P. Density modeling of images using a ´ generalized normalization transformation. ICLR, 2016.
234
+
235
+ Beck, J. M., Latham, P. E., and Pouget, A. Marginalization in Neural Circuits with Divisive Normalization. The Journal of neuroscience : the official journal of the Society for Neuroscience, 31(43):15310–9, oct 2011. ISSN 1529-2401. doi: 10.1523/JNEUROSCI.1706-11.2011.
236
+
237
+ Bevilacqua, Marco, Roumy, Aline, Guillemot, Christine, and Morel, Marie-Line Alberi. Lowcomplexity single-image super-resolution based on nonnegative neighbor embedding. In BMVC, 2012.
238
+
239
+ Bonds, A. B. Role of Inhibition in the Specification of Orientation Selectivity of Cells in the Cat Striate Cortex. Visual Neuroscience, 2(01):41–55, 1989.
240
+
241
+ Busse, L., Wade, A. R., and Carandini, M. Representation of Concurrent Stimuli by Population Activity in Visual Cortex. Neuron, 64(6):931–942, dec 2009. ISSN 0896-6273. doi: 10.1016/j. neuron.2009.11.004.
242
+
243
+ Carandini, M. and Heeger, D. J. Normalization as a canonical neural computation. Nature reviews. Neuroscience, 13(1):51–62, nov 2012. ISSN 1471-0048. doi: 10.1038/nrn3136.
244
+
245
+ Coen-Cagli, R., Kohn, A., and Schwartz, O. Flexible gating of contextual influences in natural vision. Nature Neuroscience, 18(11):1648–1655, 2015. ISSN 1097-6256. doi: 10.1038/nn.4128.
246
+
247
+ Cogswell, Michael, Ahmed, Faruk, Girshick, Ross, Zitnick, Larry, and Batra, Dhruv. Reducing overfitting in deep networks by decorrelating representations. ICLR, 2015.
248
+
249
+ Cooijmans, Tim, Ballas, Nicolas, Laurent, Cesar, and Courville, Aaron. Recurrent batch normaliza- ´ tion. CoRR, abs/1603.09025, 2016.
250
+
251
+ Deng, Jia, Dong, Wei, Socher, Richard, Li, Li-Jia, Li, Kai, and Fei-Fei, Li. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
252
+
253
+ Dong, Chao, Loy, Chen Change, He, Kaiming, and Tang, Xiaoou. Image super-resolution using deep convolutional networks. TPAMI, 38(2):295–307, 2016.
254
+
255
+ Froudarakis, Emmanouil, Berens, Philipp, Ecker, Alexander S, Cotton, R James, Sinz, Fabian H, Yatsenko, Dimitri, Saggau, Peter, Bethge, Matthias, and Tolias, Andreas S. Population code in mouse V1 facilitates readout of natural scenes through increased sparseness. Nature neuroscience, 17(6):851–7, apr 2014. ISSN 1546-1726. doi: 10.1038/nn.3707.
256
+
257
+ Gatys, Leon A., Ecker, Alexander S., and Bethge, Matthias. Image style transfer using convolutional neural networks. In CVPR, 2016.
258
+
259
+ Glorot, Xavier, Bordes, Antoine, and Bengio, Yoshua. Deep sparse rectifier neural networks. In AISTATS, 2011.
260
+
261
+ Goodfellow, Ian, Bengio, Yoshua, and Courville, Aaron. Deep learning. Book in preparation for MIT Press, 2016.
262
+
263
+ He, Kaiming, Zhang, Xiangyu, Ren, Shaoqing, and Sun, Jian. Deep residual learning for image recognition. In CVPR, 2016.
264
+ Heeger, D. J. Normalization of cell responses in cat striate cortex. Vis Neurosci, 9(2):181–197, 1992. ISSN 09525238.
265
+ Higgins, I., Matthey, L., Glorot, X., Pal, A., Uria, B., Blundell, C., Mohamed, S., and Lerchner, A. Early Visual Concept Learning with Unsupervised Deep Learning. CoRR, abs/1606.05579, 2016.
266
+ Ioffe, Sergey and Szegedy, Christian. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
267
+ Jarrett, K., Kavukcuoglu, K., Ranzato, M. A., and LeCun, Y. What is the best multi-stage architecture for object recognition? ICCV, 2009.
268
+ Kavukcuoglu, K., Ranzato, M.’A., Fergus, R., and LeCun, Y. Learning invariant features through topographic filter maps. In CVPR Workshops, 2009.
269
+ Krizhevsky, A., Sutskever, I., and Hinton, G. E. ImageNet Classification with Deep Convolutional Neural Networks. NIPS, 2012.
270
+ Laurent, Cesar, Pereyra, Gabriel, Brakel, Phil ´ emon, Zhang, Ying, and Bengio, Yoshua. Batch ´ normalized recurrent neural networks. arXiv preprint arXiv:1510.01378, 2015.
271
+ Le, Quoc V. Building high-level features using large scale unsupervised learning. In 2013 IEEE international conference on acoustics, speech and signal processing, pp. 8595–8598. IEEE, 2013.
272
+ Liao, Q. and Poggio, T. Bridging the Gaps Between Residual Learning, Recurrent Neural Networks and Visual Cortex. CoRR, abs/1604.03640, 2016.
273
+ Liao, Qianli, Kawaguchi, Kenji, and Poggio, Tomaso. Streaming Normalization: Towards Simpler and More Biologically-plausible Normalizations for Online and Recurrent Learning. CoRR, abs/1610.06160, 2016a.
274
+ Liao, Renjie, Schwing, Alexander, Zemel, Richard, and Urtasun, Raquel. Learning deep parsimonious representations. NIPS, 2016b.
275
+ Lyu, Siwei and Simoncelli, Eero P. Reducing statistical dependencies in natural signals using radial Gaussianization. NIPS, 2008.
276
+ Malo, J., Epifanio, I., Navarro, R., and Simoncelli, E. P. Nonlinear image representation for efficient perceptual coding. TIP, 15(1):68–80, 2006.
277
+ Martin, David, Fowlkes, Charless, Tal, Doron, and Malik, Jitendra. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In ICCV, 2001.
278
+ Olsen, S. R, Bhandawat, V., and Wilson, R. I. Divisive Normalization in Olfactory Population Codes. Neuron, 66(2):287–299, 2010. ISSN 10974199. doi: 10.1016/j.neuron.2010.04.009.
279
+ Pinto, N., Cox, D. D., and DiCarlo, J. J. Why is Real-World Visual Object Recognition Hard? PLoS Comput Biol, 4(1):e27, jan 2008. doi: 10.1371/journal.pcbi.0040027.
280
+ Reynolds, J. H. and Heeger, D. J. The normalization model of attention. Neuron, 61(2):168–85, jan 2009. ISSN 1097-4199. doi: 10.1016/j.neuron.2009.01.002.
281
+ Ringach, D. L. Population coding under normalization. Vision Research, 50(22):2223–2232, 2009. ISSN 18785646. doi: 10.1016/j.visres.2009.12.007.
282
+ Salimans, Tim and Kingma, Diederik P. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In NIPS, 2016.
283
+ Scardapane, S., Comminiello, D., Hussain, A., and Uncin, A. Group sparse regularization for deep neural networks. CoRR, abs/1607.00485, 2016.
284
+ Schwartz, O. and Simoncelli, E. P. Natural signal statistics and sensory gain control. Nat Neurosci, 4 (8):819–825, 2001. ISSN 1097-6256. doi: 10.1038/90526.
285
+ Schwartz, O., J., Sejnowski T., and P., Dayan. Perceptual organization in the tilt illusion. Journal of Vision, 9(4):1–20, apr 2009. ISSN 1534-7362.
286
+ Sermanet, P., Chintala, S., and LeCun, Y. Convolutional neural networks applied to house numbers digit classification. Proceedings of International Conference on Pattern Recognition ICPR12, (Icpr):10–13, 2012. ISSN 1051-4651. doi: 10.0/Linux-x86 64.
287
+ Simoncelli, E. P. and Heeger, D. J. A model of neuronal responses in visual area MT. Vision Research, 38(5):743–761, 1998.
288
+ Sinz, Fabian and Bethge, Matthias. Temporal Adaptation Enhances Efficient Contrast Gain Control on Natural Images. PLoS Computational Biology, 9(1):e1002889, jan 2013. ISSN 1553734X.
289
+ Sinz, Fabian H and Bethge, Matthias. The Conjoint Effect of Divisive Normalization and Orientation Selectivity on Redundancy Reduction. In NIPS, 2008.
290
+ Srivastava, Nitish, Hinton, Geoffrey E, Krizhevsky, Alex, Sutskever, Ilya, and Salakhutdinov, Ruslan. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 15(1):1929–1958, 2014.
291
+ Timofte, Radu, De Smet, Vincent, and Van Gool, Luc. Anchored neighborhood regression for fast example-based super-resolution. In ICCV, 2013.
292
+ Ulyanov, Dmitry, Vedaldi, Andrea, and Lempitsky, Victor S. Instance normalization: The missing ingredient for fast stylization. CoRR, abs/1607.08022, 2016.
293
+ Wang, Zhou, Bovik, Alan C, Sheikh, Hamid R, and Simoncelli, Eero P. Image quality assessment: from error visibility to structural similarity. TIP, 13(4):600–612, 2004.
294
+ Zaremba, Wojciech, Sutskever, Ilya, and Vinyals, Oriol. Recurrent neural network regularization. CoRR, abs/1409.2329, 2014.
295
+ Zeyde, Roman, Elad, Michael, and Protter, Matan. On single image scale-up using sparserepresentations. In International conference on curves and surfaces, pp. 711–730. Springer, 2010.
296
+
297
+ # A EFFECT OF SIGMA AND L1 ON CIFAR-10/100 VALIDATION SET
298
+
299
+ We plot the effect of $\sigma$ and L1 regularization on the validation performance in Figure 6. While sigma makes the most contributions to the improvement, L1 also provides much gain for the original version of LN and BN.
300
+
301
+ ![](images/7291f83e4e80e7e313f18c9e4e763eafac2db988ec4317a3768988ec88f1ccce.jpg)
302
+ Figure 6: Validation accuracy on CIFAR-10/100 showing effect of sigma constant (a, b) and L1 regularization (c, d) on BN, LN, and DN
303
+
304
+ # B LSTM IMPLEMENTATION DETAILS
305
+
306
+ In LSTM experiments, we found that have an individual normalizer for each non-linearity (sigmoid and tanh) helps the performance for both LN and DN. Eq. 12-14 are the standard LSTM equations, and let $N$ be the normalizer function, our new normalizer is replacing the nonlinearity with Eq. 15-16. This modification can also be thought as combining normalization and activation as a single activation function.
307
+
308
+ This is different from the released implementation of LN and BN in LSTM, which separately normalized the concatenated vector $W _ { h } \mathbf { h } _ { t - 1 }$ and $W _ { x } { \bf x } _ { t }$ . For all $\mathrm { L N ^ { * } }$ and DN experiments we choose this new formulation, whereas LN experiments are consistent with the released version.
309
+
310
+ $$
311
+ \begin{array} { r c l } { \left( \begin{array} { l } { \mathbf { f } _ { t } } \\ { \mathbf { i } _ { t } } \\ { \mathbf { o } _ { t } } \\ { \mathbf { g } _ { t } } \end{array} \right) } & { = } & { W _ { h } \mathbf { h } _ { t - 1 } + W _ { x } \mathbf { x } _ { t } + \mathbf { b } } \\ { \mathbf { c } _ { t } } & { = } & { \sigma ( \mathbf { f } _ { t } ) \odot \mathbf { c } _ { t - 1 } + \sigma ( \mathbf { i } _ { t } ) \odot \mathrm { t a n h } ( \mathbf { g } _ { t } ) } \\ { \mathbf { h } _ { t } } & { = } & { \sigma ( \mathbf { o } _ { t } ) \odot \mathrm { t a n h } ( \mathbf { c } _ { t } ) } \end{array}
312
+ $$
313
+
314
+ $$
315
+ \begin{array} { r c l } { { \bar { \sigma } ( x ) } } & { { = } } & { { \sigma ( N ( x ) ) } } \\ { { \overline { { { \operatorname { t a n h } } } } ( x ) } } & { { = } } & { { \operatorname { t a n h } ( N ( x ) ) } } \end{array}
316
+ $$
317
+
318
+ # C MORE RESULTS ON IMAGE SUPER-RESOLUTION
319
+
320
+ We include results on another standard dataset Set5 Bevilacqua et al. (2012) in Table 8 and show more visual results in Fig. 7.
321
+
322
+ Table 8: Average test results of PSNR and SSIM on Set5 Dataset.
323
+
324
+ <table><tr><td>Model</td><td>PSNR (x3)</td><td>SSIM (x3)</td><td>PSNR (x4)</td><td>SSIM (x4)</td></tr><tr><td>Bicubic</td><td>30.41</td><td>0.8678</td><td>28.44</td><td>0.8097</td></tr><tr><td>A+</td><td>32.59</td><td>0.9088</td><td>30.28</td><td>0.8603</td></tr><tr><td>SRCNN</td><td>32.83</td><td>0.9087</td><td>30.52</td><td>0.8621</td></tr><tr><td>BN</td><td>22.85</td><td>0.8027</td><td>20.71</td><td>0.7623</td></tr><tr><td>DN*</td><td>32.83</td><td>0.9106</td><td>30.62</td><td>0.8665</td></tr></table>
325
+
326
+ ![](images/37cdbd41975353f8ef2e21b9e74bf13832078e8f467e0dde5fb7f93a4a120796.jpg)
327
+ Figure 7: Comparisons at a magnification factor of 4.
md/train/rkTBjG-AZ/rkTBjG-AZ.md ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEPARCHITECT: AUTOMATICALLY DESIGNING ANDTRAINING DEEP ARCHITECTURES
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In deep learning, performance is strongly affected by the choice of architecture and hyperparameters. While there has been extensive work on automatic hyperparameter optimization for simple spaces, complex spaces such as the space of deep architectures remain largely unexplored. As a result, the choice of architecture is done manually by the human expert through a slow trial and error process guided mainly by intuition. In this paper we describe a framework for automatically designing and training deep models. We propose an extensible and modular language that allows the human expert to compactly represent complex search spaces over architectures and their hyperparameters. The resulting search spaces are treestructured and therefore easy to traverse. Models can be automatically compiled to computational graphs once values for all hyperparameters have been chosen. We can leverage the structure of the search space to introduce different model search algorithms, such as random search, Monte Carlo tree search (MCTS), and sequential model-based optimization (SMBO). We present experiments comparing the different algorithms on CIFAR-10 and show that MCTS and SMBO outperform random search. We also present experiments on MNIST, showing that the same search space achieves near state-of-the-art performance with a few samples. These experiments show that our framework can be used effectively for model discovery, as it is possible to describe expressive search spaces and discover competitive models without much effort from the human expert. Code for our framework and experiments has been made publicly available.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep learning has seen a surge in popularity due to breakthroughs in applications such as computer vision, natural language processing, and reinforcement learning (He et al., 2016; Karpathy & FeiFei, 2015; Silver et al., 2016; Sutskever et al., 2014). An important observation in much of the recent work is that complex architectures are important for achieving high performance (He et al., 2016; Mnih et al., 2013). Larger datasets and more powerful computing infrastructures are likely to increase our ability to effectively train larger, deeper, and more complex architectures. However, improving the performance of a neural network is not as simple as adding more layers or parameters—it often requires clever ideas such as creating more branches (Szegedy et al., 2015) or adding skip connections (He et al., 2016). Even popular techniques such as dropout (Srivastava et al., 2014) and batch normalization (Ioffe & Szegedy, 2015) do not always lead to better performance, and need to be judiciously applied to be helpful.
12
+
13
+ Currently, choosing appropriate values for these architectural hyperparameters requires close supervision by a human expert, in a trial and error manual search process largely guided by intuition. The expert is burdened by having to make the large number of choices involved in the specification of a deep model. Choices interact in non-obvious ways and strongly impact performance. The typical workflow has the expert specify a single model, train it, and compute a validation score. Based on the validation score, previous experience, and information gathered during training, the expert decides if the trained model is satisfactory or not. If the model is considered unsatisfactory, the expert has to think about model variations that may lead to better performance.
14
+
15
+ From the perspective of the expert, it would be convenient to search over architectures automatically, just as we search over simple scalar hyperparameters, such as the learning rate and the regularization coefficient. Ideally, the expert would have control in setting up the search space to incorporate inductive biases about the task being solved and constraints about computational resources. Prior to this work, achieving this goal was hard because expressing model search spaces using general hyperparameter optimization tools requires the human expert to manually distill a set of relevant scalar architectural hyperparameters.
16
+
17
+ The main contributions of our work are
18
+
19
+ 1. a modular, compositional, and extensible language for compactly representing expressive search spaces over models that
20
+
21
+ (a) gives control to the human expert over what model variations to consider; (b) makes it easy to automatically search for performant models in the search space; (c) allows models to be directly compiled to computational graphs without the human expert having to write additional code.
22
+
23
+ 2. model search algorithms that rely on the tree-structured search spaces induced by our language to systematically and efficiently search for performant models; namely, we
24
+
25
+ (a) show that by using constructs in our language, even random search can be effective;
26
+ (b) compare different model search algorithms experimentally, and show that random search is outperformed by algorithms that leverage the structure of the search space to generalize more effectively across different models.
27
+
28
+ The main differences between our work and previous work are that we develop a modular, composable and extensible language, focusing on the problem of searching over deep architectures. This focus allows the expert to compactly set up a search space, search over it, and automatically compile models to their corresponding computational graphs. Our language can be seen as an effort to combine the functionalities of a deep model specification language (e.g., Tensorflow (Abadi et al., 2016)) and a structured hyperparameter search language (e.g., Hyperopt (Yamins et al., 2013)).
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Model search has a long and rich history in machine learning and statistics. There has been a wide variety of theoretical and empirical research in this area (Agarwal et al., 2011; Bergstra et al., 2011; Bergstra & Bengio, 2012; Sabharwal et al., 2015), including Bayesian optimization methods (Hutter et al., 2011; Kandasamy et al., 2015; Snoek et al., 2012). However, conventional methods are primarily designed for searching over hyperparameters living in Euclidean space. Such methods are ill suited in today’s context, where the discrete architectural choices are just as important as the numerical values of the hyperparameters. Searching over architectures using current hyperparameter optimization algorithms requires the expert to distill structural choices into scalar hyperparameters. As a result, typically only a few simple global structural hyperparameters are considered, e.g., the depth of the network or whether to use dropout or not. This constrains the richness of the search space, preventing the expert from finding unexpected model variations leading to better performance; e.g., perhaps dropout is useful only after certain types of layers, or batch normalization only helps in the first half of the network.
33
+
34
+ Architecture search has also been considered under the topic of neuroevolution (Stanley & Miikkulainen, 2002), which uses evolutionary (i.e., genetic) strategies to define and search a space of models. In classical approaches, neuroevolution attempts to jointly choose the topology and the parameters of the architecture using genetic algorithms.
35
+
36
+ Architecture search has received renewed interest recently. Wierstra et al. (2005), Floreano et al. (2008), and Real et al. (2017) use evolutionary algorithms which start from an initial model and evolve it based on its validation performance. Zoph & Le (2017) propose a reinforcement learning procedure based on policy gradient for searching for convolutional and LSTM architectures. Baker et al. (2016) propose a reinforcement learning procedure based on Q-learning for searching for convolutional architectures.
37
+
38
+ Unfortunately all these approaches consider fixed hard-coded model search spaces that do not easily allow the human expert to incorporate inductive biases about the task being solved, making them unsuitable as general tools for architecture search. For example, evolutionary approaches require an encoding for the models in the search space and genetic operators (e.g., mutation and crossover) which generate encodings for new models out of encodings of old ones. These aspects are handcrafted and hard-coded so it is hard for the human expert to change the search space in flexible ways. Perhaps different model encodings or genetic operators can be considered, but these knobs give somewhat loose and indirect control over the model search space. The reinforcement learning approaches considered suffer from similar issues—the search spaces are hard-coded and not easily modifiable. None of these approaches have the compositionality, modularity, and extensibility properties of our language.
39
+
40
+ Bergstra et al. (2011) propose Tree of Parzen Estimators (TPE), which can be used to search over structured hyperparameter spaces, and use it to tune the hyperparameters of a Deep Boltzmann Machine. Yamins et al. (2013) use TPE to search for values of the hyperparameters of a computer vision system, and show that it can find better values than the best ones previously known.
41
+
42
+ TPE is a general hyperparameter search algorithm, and therefore requires considerable effort to use—for any fixed model search space, using TPE requires the human expert to distill the hyperparameters of the search space, express the search space in Hyperopt (Yamins et al., 2013) (an implementation of TPE), and write the code describing how values of the hyperparameters in the search space compile to a computational graph. In contrast, our language is modular and composable in the sense that:
43
+
44
+ 1. search spaces (defined through modules) are constructed compositionally out of simpler search spaces (i.e., simpler modules);
45
+ 2. hyperparameters for composite modules are derived automatically from the hyperparameters of simpler modules;
46
+ 3. once values for all hyperparameters of a module have been chosen, the resulting model can be automatically mapped to a computational graph without the human expert having to write additional code.
47
+
48
+ # 3 ROADMAP TO THE DEEPARCHITECT FRAMEWORK
49
+
50
+ Our framework reduces the problem of searching over models into three modular components: the model search space specification language, the model search algorithm, and the model evaluation algorithm.
51
+
52
+ Model Search Specification Language: The model search space specification language is built around the concept of a modular computational module. This is akin to the concept of a module (Bottou & Gallinari, 1991) used in deep learning frameworks such as Torch (Collobert et al., 2011): by implementing the module interface, the internal implementation becomes irrelevant. These modules allow one to express easily complex design choices such as whether to include a module or not, choose between modules of different types, or choose how many times to repeat a module structure. The main insight is that complex modules can be created compositionally out of simpler ones. The behavior of complex modules is generated automatically out of the behavior of simpler modules. Furthermore, our language is extensible, allowing the implementation of new types of modules by implementing a high-level interface local to the module.
53
+
54
+ Model Search Algorithm: The way the model search space is explored is determined by the model search algorithm. This part of the framework decides how much effort to allocate to each part of the search space based on the performance observed for previous models. The model search algorithm typically requires a model evaluation algorithm that computes the performance of a fully specified model. The search algorithm will then use this information to determine which models to try next. The search algorithm interacts with the search space only through a minimal interface that allows it to traverse the space of models and evaluate models discovered this way. This interface is the same irrespective of the specific search space under consideration. We experiment with different search algorithms, such as Monte Carlo tree search (Browne et al., 2012) and Sequential Model Based Optimization (Hutter et al., 2011).
55
+
56
+ Model Evaluation Algorithm: Having fully specified a model, i.e., having reached a leaf in the tree defined by our model search space, we can evaluate how good this model is according to some criterion defined by the expert. This typically involves training the model on a training set and evaluating it on a validation set. The training procedure often has multiple hyperparameters that can be tuned (e.g., the choice of the optimization algorithm and its hyperparameters, and the learning rate schedule). If the expert does not know how to write down a reasonable training procedure for every model in the search space, the expert can introduce hyperparameters for the evaluation algorithm and search over them using our specification language.
57
+
58
+ Any of the above components can be changed, improved, or extended, while keeping the others fixed. The fact that different components interact only through well-defined interfaces makes it possible to extend and reuse this framework. We believe that DeepArchitect will be an interesting platform for future research in deep learning and hyperparameter tuning for architecture search.
59
+
60
+ # 4 MODEL SEARCH SPACE SPECIFICATION LANGUAGE
61
+
62
+ # 4.1 SEARCH SPACE DEFINITION
63
+
64
+ The computational module is the fundamental unit of our model search space specification language. We define a computational module as a function
65
+
66
+ $$
67
+ f : n \to \left( \mathcal { H } \to ( \mathbb { R } ^ { p } \to ( \mathbb { R } ^ { n } \to \mathbb { R } ^ { m } ) ) \right) ,
68
+ $$
69
+
70
+ where $n$ is the dimensionality of the input, $\mathcal { H }$ is the set of valid values for the hyperparameters, $p$ is the number of parameters, and $m$ is the dimensionality of the output. The set $\mathcal { H }$ can be structured or simply the cross product of scalar hyperparameter sets, i.e., $\mathcal { H } = \mathcal { H } _ { 1 } \times . . . \times \mathcal { H } _ { H }$ , where $H$ is the number of scalar hyperparameters. The set $\mathcal { H }$ is assumed to be discrete in both cases.
71
+
72
+ Definition (1) merits some discussion. For conciseness we have not explicitly represented it, but the number of parameters $p$ and the output dimensionality $m$ can both be functions of the input dimensionality $n$ and the chosen hyperparameter values $h \in \mathcal H$ . For example, an affine module with $h$ dense hidden units has output dimensionality $m = h$ and number of parameters $p = ( n + 1 ) h$ : a weight matrix $W \in \mathbb { R } ^ { h \times n }$ and a bias vector $b \in \mathbb { R } ^ { h }$ . A similar reasoning can be carried out for a convolutional module: the number of parameters $p$ depends on the input dimensionality, the number of filters, and the size of the filters; the dimensionality of the output $m$ depends on the input dimensionality, the number of filters, the size of the filters, the stride, and the padding scheme. The fact that $p$ and $m$ are functions of the input dimensionality and the chosen hyperparameter values is one of the main observations that allows us to do architecture search—once we know the input dimensionality and have fixed values for the hyperparameters, the structure of the computation performed by the module is determined, and this information can be propagated to other modules. We say that a module is fully specified when values for all hyperparameters of the module have been chosen and the input dimensionality is known.
73
+
74
+ We focus on search spaces for architectures that have a single input terminal and a single output terminal. By this, we only mean that the input and output of the module have to be a single tensor of arbitrary order and dimensionality. For example, convolutional modules take as input an order three tensor and return as output an order three tensor, therefore they are single-input single-output modules under our definition. We also assume that the output of a module is used as input to at most a single module, i.e., we assume no output sharing.
75
+
76
+ These restrictions were introduced to simplify exposition. The single-input single-output case with no sharing is simpler to develop and exemplifies the main ideas that allow us to develop a framework for automatic architecture search. The ideas developed in this work extend naturally to the multipleinput multiple-output case with sharing. Additionally, often we can represent modules that are not single-input single-output by defining new modules that encapsulate many signal paths from input to output. For example, a residual module (He et al., 2016) can be treated in our framework by noting that it is single-input before the skip connection split and single-output after the skip connection merge. Many top performing architectures, such as AlexNet (Krizhevsky et al., 2012), VGG (Simonyan & Zisserman, 2014), and ResNet (He et al., 2016), are captured in our language.
77
+
78
+ We distinguish between basic computational modules and composite computational modules. Basic modules do some well defined transformation. Affine, batch normalization, and dropout are examples of basic modules. Composite modules are defined in terms of other (composite or basic) modules, i.e., the instantiation of a composite module takes other modules as arguments. Composite modules may introduce hyperparameters of their own and inherit hyperparameters of the modules taken as arguments. For example, an $\bigcirc \mathtt { r }$ module takes a list of modules and chooses one of the modules to use. It introduces a discrete hyperparameter for which module to use, and chooses values for the hyperparameters of the chosen module; the hyperparameters available are conditional on the choice of the module to use. Most of the representational power of our language arises from the compositionality of composite and basic modules.
79
+
80
+ ![](images/bb872f8c94981e2eaa50d8b197b91805347946a6f3f2ed2d97f86cdfc41dbfaf.jpg)
81
+ Figure 1: (a) A simple search space with 24 different models. (b) A path through the search space encoding a convolutional module with 64 filters of size $3 \times 3$ , with stride 1, followed by batch normalization, ReLU and affine modules. The model does not use dropout. Branches encoding hyperparameters with a single choice were omitted.
82
+
83
+ The ideas developed in this section are perhaps best illustrated with an example. See Figure 1a for the definition of an example search space in LISP-like pseudocode that closely parallels our implementation. The search space, which results from the composition of several modules, and therefore is also a module itself, encodes 24 different models, corresponding to the different 24 possible paths from the root to the leaves of the tree. The space is defined using three composite modules (Concat, MaybeSwap, and Optional) and five basic modules (Conv2D, BatchNormalization, ReLU, Dropout, and Affine). Concat introduces no additional hyperparameters, but it has to specify all the modules that have been delegated to it; MaybeSwap introduces a binary hyperparameter that encodes whether to swap the order of the pair of modules or not; Optional introduces a binary hyperparameter that encodes whether to include the module or not. The behavior of the basic modules in Figure 1a is simple: Conv2D takes lists of possible values for the number of filters, the size of the filters, and the stride; BatchNormalization and ReLU have no hyperparameters; Dropout takes a list for the possible values for the dropout probability; Affine takes a list for the possible values of the number of hidden units.
84
+
85
+ Choosing different values for the hyperparameters of the composite modules may affect the structure of the resulting architecture, while choosing different values for the hyperparameters of the basic modules only affects the structure of the corresponding local transformations. The search space of Figure 1a results from the composition of basic and composite modules; therefore it is a module itself and can be characterized by its input, output, parameters, and hyperparameters. Our set of composite modules in not minimal: e.g., given an Empty basic module, which has no hyperparameters or parameters and simply does the identity transformation, and a Or composite module, which introduces an extra hyperparameter encoding the choice of a specific module in its list, the composite modules Optional and MaybeSwap can be defined as (Optional B) $=$ ( $\bigcirc \mathtt { r }$ Empty B) and (MaybeSwap B1 B2) $=$ (Or (Concat B1 B2), (Concat B2 B1)).
86
+
87
+ # 4.2 SEARCH SPACE TRAVERSAL
88
+
89
+ Given a search space defined by a module, there is an underlying tree over fully specified models: we build this tree by sequentially assigning values to each of the hyperparameters of the module.
90
+
91
+ Each internal node in the tree corresponds to some partial assignment to the hyperparameters of the module, and each terminal node (i.e., each leaf) corresponds to a fully specified model. We can also think about an internal node as corresponding to the state of a module before assigning a value to the next unassigned hyperparameter. The branching factor of a node corresponds to the number of possible values for the hyperparameter under consideration at that node, and traversing a specific edge from that node to a child corresponds to assigning the value encoded by that edge to the hyperparameter under consideration. As a tree has a single path between the root and any leaf, the paths from root to leaves are in one-to-one correspondence with fully specified models. A leaf is reached when there are no hyperparameters left to specify.
92
+
93
+ In Figure 1b we have drawn a path through the search space of Figure 1a from the root (labeled node 0), where all hyperparameters are unassigned, to a terminal node (labeled node 4), where all hyperparameters have been assigned values. Each branch in the tree corresponds to the assignment of some value to some hyperparameter. At node 0, we are choosing between 32 or 64 filters; at node 1, we are choosing between filters of size 3 or 5; at node 2, we are choosing between applying batch normalization before or after ReLU; at node 3, we are choosing whether to do dropout or not. Node 4 is terminal and corresponds to a fully specified model. Decisions at each node are conditional on decisions previously made. Internal nodes with a single child (i.e., branches for hyperparameters with a single possible value) have been collapsed and omitted from Figure 1a. Other paths may have different lengths, e.g., picking a path through the right child of node 3 corresponds to adding a Dropout module, which requires an additional hyperparameter choice for the dropout probability when compared to the path from the root to node 4.
94
+
95
+ Search spaces arising from module composition have their traversal functionality automatically derived from the traversal functionality of their component modules: a basic module knows how to sequentially assign values to its hyperparameters, and a composite module knows how to sequentially assign values to its hyperparameters and call the sequential assignment functionality for its component modules. This is akin to recursive expression evaluation in programming languages.
96
+
97
+ To traverse the search space, i.e., to assign values to all hyperparameters of the module defining the search space, all that it is needed is that each module knows how to sequentially specify itself. Modules resulting from the composition of modules will then be automatically sequentially specifiable. The three local operations that a module needs to implement for traversal are: to test whether it is fully specified (i.e., whether it has reached a leaf yet); if it is not specified, to return which hyperparameter it is specifying and what are the possible values for it; and given a choice for the current hyperparameter under consideration, to traverse the edge to the child of the current node corresponding to chosen value.
98
+
99
+ # 4.3 COMPILATION
100
+
101
+ Once values for all hyperparameters of a module have been chosen, the fully specified model can be automatically mapped to its corresponding computational graph. We call this mapping compilation. This operation only requires that each module knows how to locally map itself to a computational graph: compilation is derived recursively from the compilation of simpler modules. For example, if we know how to compile Conv2D, ReLU, and $\bigcirc \mathtt { r }$ modules, we will automatically be able to compile all modules built from them. This behavior is also similar to recursive expression evaluation in programming languages.
102
+
103
+ # 5 MODEL SEARCH ALGORITHMS
104
+
105
+ In this section, we consider different search algorithms that are built on top of the functionality described above. Some of these algorithms rely on the search space being tree structured. One of the challenges of our setting is that deep models are expensive to train, so unless we have access to extraordinary computational resources, only a moderate number of evaluations will be practical.
106
+
107
+ # 5.1 RANDOM SEARCH
108
+
109
+ Random search is the simplest algorithm that we can consider. At each node of the tree, we choose an outgoing edge uniformly at random, until we reach a leaf node (i.e., a model). Even just random
110
+
111
+ search is interesting, as the model search space specification language allows us to capture expressive structural search spaces. Without our language, randomly selecting an interesting architecture to try would not be possible without considerable effort from the human expert.
112
+
113
+ # 5.2 MONTE CARLO TREE SEARCH
114
+
115
+ Monte Carlo tree search (MCTS) (Browne et al., 2012; Kocsis & Szepesvari, 2006) is an approxi- ´ mate planning technique that has been used effectively in many domains (Silver et al., 2016). Contrary to random search, MCTS uses the information gathered so far to steer its policy towards better performing parts of the search space. MCTS maintains a search tree that is expanded incrementally one node at a time. MCTS uses two policies: a tree policy, which determines the path to be traversed from the root to the frontier of the already expanded tree; and a rollout policy, which determines the path to be traversed from the frontier of the already expanded tree until a leaf is reached. Once a leaf is reached, the model encoded by it is evaluated (e.g., trained on the training set and evaluated on the validation set), and the resulting score is used to update the statistics of the nodes in the currently expanded tree in the path to the leaf. Each node in the expanded tree keeps statistics about the number of times it was visited and the average score of the models that were evaluated in the subtree at that node. The rollout policy is often simple, e.g., the random policy described in Section 5.1.
116
+
117
+ The tree policy typically uses an upper confidence bound (UCB) approach. Let $n$ be the number of visits of a node $v \in \mathcal T$ , where $\tau$ denotes the currently expanded tree, and $n _ { 1 } , \ldots , n _ { b }$ and ${ \bar { X } } _ { 1 } , \dots , { \bar { X } } _ { b }$ be, respectively, the number of visits and the average scores of the $b$ children of $v$ . The tree policy at $x$ chooses to traverse an edge corresponding to a child maximizing the UCB score:
118
+
119
+ $$
120
+ \operatorname* { m a x } _ { i \in \{ 1 , \dots , b \} } { \bar { X } } _ { i } + 2 c \sqrt { \frac { 2 \log n } { n _ { i } } } ,
121
+ $$
122
+
123
+ where $c \in \mathbb { R } _ { + }$ is a constant capturing the trade-off between exploration and exploitation—larger values of $c$ correspond to larger amounts of exploration. If at node $x$ , some of its children have not been added to the tree, there will be some $i \in \{ 1 , \ldots , b \}$ for which $n _ { i } = 0$ ; in this case we define the UCB score to be infinite, and therefore, unexpanded children always take precedence over expanded children. If multiple unexpanded children are available, we expand one uniformly at random.
124
+
125
+ # 5.3 MONTE CARLO TREE SEARCH WITH TREE RESTRUCTURING
126
+
127
+ When MCTS visits a node in the expanded part of the tree, it has to expand all children of that node before expanding any children of its currently expanded children. This is undesirable when there are hyperparameters that can take a large number of related values.
128
+
129
+ We often consider hyperparameters which take numeric values, and similar values result in similar performance. For example, choosing between 64 or 80 filters for a convolutional module might not have a dramatic impact on performance. A way of addressing such hyperparameters is to restructure the branches of the tree by doing bisection. Assume that the set of hyperparameters has a natural ordering. At a node, rather than committing directly to a value of the hyperparameter, we commit sequentially—first we decide if we are choosing a value in the first or second half of the set of hyperparameters, and then we recurse on the chosen half until we have narrow it down to a single value. See an example tree in Figure 2a and the corresponding restructured tree in Figure 2b.
130
+
131
+ Tree restructuring involves a tradeoff between depth and breadth: the tree in Figure 2a has depth 1, while the tree in Figure 2b has depth 3. The restructured tree can have better properties in the sense that there more sharing between different values of the hyperparameters. We could also consider restructured trees with branching factors different than two, again trading off depth and breadth. If the branching factor of the restructured tree is larger than the number of children of the hyperparameter, the restructuring has no effect, i.e., the original and restructured trees are equal. The restructuring operation allows MCTS to effectively consider hyperparameters with a large number of possible values.
132
+
133
+ # 5.4 SEQUENTIAL MODEL BASED OPTIMIZATION
134
+
135
+ MCTS is tabular in the sense that it keeps statistics for each node in the tree. While the restructuring operation described in Section 5.3 increases sharing between different hyperparameter values, it still suffers from the problem that nodes have no way of sharing information other than through common ancestors. This is problematic because differences in hyperparameter values at the top levels of the tree lead to little sharing between models, even if the resulting models happen to be very similar.
136
+
137
+ ![](images/a3f4ace9438913fcb7b6f80a0bfe719b426907201ad9f9f0f978caff30fee613.jpg)
138
+ Figure 2: (a) A tree encoding an hyperparameter and its five possible values. MCTS applied to this tree is sample-inefficient as there is no sharing of information between the different child nodes. (b) The result of restructuring the tree with bisection. MCTS applied to this tree results in more sharing when compared to the original tree. For example, sampling a path reaching node 1 provides information about nodes 1, 2, and 3.
139
+
140
+ Sequential Model Based Optimization (SMBO) (Hutter et al., 2011) allows us to address this problem by introducing a surrogate function which can be used to capture relationships between models and how promising it is to evaluate any specific model. The surrogate function can use expressive features to capture architecture patterns that influence performance, e.g., features about sequences of basic modules that occur in the model.
141
+
142
+ The surrogate function can then be optimized to choose which model to evaluate next. Exactly optimizing the surrogate function over a search space can be difficult as often there is a combinatorially large number of models. To approximately optimize the surrogate function, we do some number of random rollouts from the root of the tree until we hit leaf nodes (i.e., models), we evaluate the surrogate function (i.e., we determine, according to the surrogate function, how promising it is to evaluate that model), and evaluate the model that has the highest score according to the surrogate function. We also introduce an exploratory component where we flip a biased coin and choose between evaluating a random model or evaluating the best model according to the surrogate function. The surrogate function is updated after each evaluation.
143
+
144
+ In our experiments, we use a simple surrogate function: we train a ridge regressor to predict model performance, using the models evaluated so far and their corresponding performances as training data. We only use features based on $n$ -grams of sequences of basic modules, disregarding the values of the hyperparameters. More complex features, surrogate functions, and training losses are likely to lead to better search performance, but we leave these to future work.
145
+
146
+ # 6 MODEL EVALUATION ALGORITHMS
147
+
148
+ As a reminder, once we assign values to all hyperparameters of the module defining the search space, we need to compute a score for the resulting model, i.e., a score for the path from the root to the corresponding leaf encoding the model to evaluate. The specific way to compute scores is defined by the human expert, and it typically amounts to training the model on a training set and evaluating the trained model on a validation set. The score of the model is the resulting validation performance. The training process often has its own hyperparameters, such as: what optimization algorithm to use and its corresponding hyperparameters, the learning rate schedule (e.g., the initial learning rate, the learning rate reduction multiplier, and how many epochs without improving the validation performance the algorithm waits before reducing the learning rate), how many epochs without improving the validation performance the algorithm waits before terminating the training process (i.e., early stopping), and what data augmentation strategies to use and their corresponding hyperparameters. The behavior of the evaluation algorithm with respect to the values of its hyperparameters is defined by the expert for the task being considered, so the compilation step described in Section 4.3 for this functionality has to be implemented by the expert. Nonetheless, these user hyperparameters can be included in the search space and searched over in the same way as the architecture hyperparameters described in Section 4.1.
149
+
150
+ ![](images/6d743b8e33d55a478268550929c1fe86684dcf62792e5b154ba8785db470486f.jpg)
151
+ Figure 3: (a, b) Average maximum validation score achieved as a function of the number of evaluation across five repetitions. The error bars indicate standard error. The range of 64 evaluations is split into two plots for clearer visualization. (c) Percentage of models above a given validation threshold performance. MCTS with bisection and SMBO outperform random search. The error bars have size equal to the standard error.
152
+
153
+ # 7 EXPERIMENTS
154
+
155
+ We illustrate how our framework can be used to search over all hyperparameters of a model, i.e., both architecture and training hyperparameters, using only high-level insights. We choose a search space of deep convolutional models based around the ideas that depth is important, batch normalization helps convergence, and dropout is sometimes helpful. We search over architectures and evaluate our models on CIFAR-10 (Krizhevsky, 2009).
156
+
157
+ The training hyperparameters that we consider are whether to use ADAM or SGD with momentum, the initial learning rate, the learning rate reduction multiplier, and the rate reduction patience, i.e., how many epochs without improvement to wait before reducing the current learning rate. We use standard data augmentation techniques: we zero pad the CIFAR-10 images to size $4 0 \times 4 0 \times 3$ , randomly crop a $3 2 \times 3 2$ portion, and flip horizontally at random. We could search over these too if desired.
158
+
159
+ We compare the search algorithms described in Section 5 in terms of the best model found, according to validation performance, as a function of the number of evaluations. We run each algorithm 5 times, for 64 model evaluations each time. All models were trained for 30 minutes on GeForce GTX 970 GPUs in machines with similar specifications.
160
+
161
+ In Figure 3a and Figure 3b, we see that all search algorithms find performant solutions (around $8 9 \%$ accuracy) after 64 evaluations. In Figure 3a, we see that for fewer than 6 evaluations there is considerable variance between the different algorithms; the more sophisticated model search algorithms are not able to outperform random search with so few evaluations. In Figure 3b, we see that both SMBO and MCTS with bisection eventually outperform random search; MCTS with bisection starts outperforming random search around 32 evaluations, while for SMBO, it happens around 16 evaluations.
162
+
163
+ Surprisingly, MCTS without restructuring does not outperform random search. We think that this is because there are too many possible values for the first few hyperparameters in the tree, so MCTS will not be able to identify and focus on high-performance regions of the search space within the number of evaluations available. MCTS with bisection and SMBO do not suffer from these problems, and therefore can identify and focus on high performance regions of the search space earlier. In addition to achieving a higher top accuracy, MCTS with bisection and SMBO evaluate a larger fraction of high-performance models when compared to random search, as can be seen in Figure 3c.
164
+
165
+ The main goal of the previous experiment is to show that more complex model search algorithms can outperform random search by better leveraging the structure of the search. We are not attempting to achieve state-of-the-art performance. We now show that using the same search space on MNIST with a larger time budget leads to close to state-of-the-art performance. The data augmentation scheme is slightly different, as we no longer randomly flip the image horizontally, but now consider random rotations where the maximum angle of rotation is also added as a hyperparameter to the search space.
166
+
167
+ In this experiment, we randomly sample 16 models in the search space and train them for up to 3 hours or until the validation performance fails to increase for more than 128 epochs. The best model among the models sampled chosen according to validation performance obtained among the 16 sampled models has test accuracy equal to $9 9 . { \bar { 7 } } 2 \%$ , which is close to the single model state-of-theart of $9 9 . 7 7 \%$ (Sato et al., 2015). Additionally, taking a simple majority voting emsemble of the 5 best performing models yielded the same validation accuracy as the best single model and increased test accuracy to $9 9 . 7 5 \%$ . The performance profile of the sampled models and the architecture and hyperparameters of the best model are presented in Appendix A.
168
+
169
+ We can build good ensembles by sampling models in the search space and building an ensemble out of the best ones. It has been observed in the literature that model diversity often improves emsemble performance. Our results suggest that it is possible to define search spaces that work well across a range of tasks, having the potential to significantly reduce the burden on the human expert.
170
+
171
+ # 8 CONCLUSION
172
+
173
+ We described a framework for automatically designing and training deep models. This framework consists of three fundamental components: the model search space specification language, the model search algorithm, and the model evaluation algorithm. The model search space specification language is composable, modular, and extensible, and allows us to easily define expressive search spaces over architectures. The model evaluation algorithm determines how to compute a score for a model in the search space. Models can be automatically compiled to their corresponding computational graphs. Using the model search space specification language and the model evaluation algorithm, we can introduce model search algorithms for exploring the search space. Using our framework, it is possible to do random search over interesting spaces of architectures without much effort from the expert. We also described more complex model search algorithms, such as MCTS, MCTS with tree restructuring, and SMBO. We present experiments on CIFAR-10 comparing different model search algorithms and show that MCTS with tree restructuring and SMBO outperform random search. Code for our framework and experiments has been made publicly available. We hope that this paper will lead to more work and better tools for automatic architecture search.
174
+
175
+ # REFERENCES
176
+
177
+ Martın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv:1603.04467, 2016.
178
+ Alekh Agarwal, John Duchi, Peter Bartlett, and Clement Levrard. Oracle inequalities for computationally budgeted model selection. In Conference on Learning Theory, 2011.
179
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. arXiv:1611.02167, 2016.
180
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. Journal of Machine Learning Research, 13(Feb):281–305, 2012.
181
+ James Bergstra, Remi Bardenet, Yoshua Bengio, and Bal ´ azs K ´ egl. Algorithms for hyper-parameter ´ optimization. In Neural Information Processing Systems, 2011.
182
+ Leon Bottou and Patrick Gallinari. ´ A framework for the cooperation of learning algorithms. 1991.
183
+ Cameron Browne, Edward Powley, Daniel Whitehouse, Simon Lucas, Peter Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. A survey of
184
+
185
+ Monte Carlo tree search methods. IEEE Transactions on Computational Intelligence and AI in Games, 4(1):1–43, 2012.
186
+
187
+ Ronan Collobert, Koray Kavukcuoglu, and Clement Farabet. Torch7: A Matlab-like environment ´ for machine learning. In BigLearn, NIPS Workshop, 2011.
188
+
189
+ Dario Floreano, Peter Durr, and Claudio Mattiussi. Neuroevolution: from architectures to learning. ¨ Evolutionary Intelligence, 1(1):47–62, 2008.
190
+
191
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In International Conference on Artificial Intelligence and Statistics, 2010.
192
+
193
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In International Conference on Computer Vision, 2015.
194
+
195
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Conference on Computer Vision and Pattern Recognition, 2016.
196
+
197
+ Frank Hutter, Holger Hoos, and Kevin Leyton-Brown. Sequential model-based optimization for general algorithm configuration. In International Conference on Learning and Intelligent Optimization, 2011.
198
+
199
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv:1502.03167, 2015.
200
+
201
+ Kirthevasan Kandasamy, Jeff Schneider, and Barnabas P ´ oczos. High dimensional Bayesian opti- ´ misation and bandits via additive models. In International Conference on Machine Learning, 2015.
202
+
203
+ Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In Conference on Computer Vision and Pattern Recognition, 2015.
204
+
205
+ Levente Kocsis and Csaba Szepesvari. Bandit based Monte Carlo planning. In ´ European Conference on Machine Learning, 2006.
206
+
207
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
208
+
209
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton. ImageNet classification with deep convolutional neural networks. In Neural Information Processing Systems, 2012.
210
+
211
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing Atari with deep reinforcement learning. arXiv:1312.5602, 2013.
212
+
213
+ Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. arXiv:1703.01041, 2017.
214
+
215
+ Ashish Sabharwal, Horst Samulowitz, and Gerald Tesauro. Selecting near-optimal learners via incremental data allocation. In AAAI, 2015.
216
+
217
+ Ikuro Sato, Hiroki Nishimura, and Kensuke Yokoi. APAC: Augmented pattern classification with neural networks. arXiv:1505.03229, 2015.
218
+
219
+ David Silver, Aja Huang, Chris Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
220
+
221
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv:1409.1556, 2014.
222
+
223
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical Bayesian optimization of machine learning algorithms. In Neural Information Processing Systems, 2012.
224
+
225
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014.
226
+
227
+ Kenneth Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary Computation, 10(2):99–127, 2002.
228
+
229
+ Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to sequence learning with neural networks. In Neural Information Processing Systems, 2014.
230
+
231
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Conference on Computer Vision and Pattern Recognition, 2015.
232
+
233
+ Daan Wierstra, Faustino Gomez, and Jurgen Schmidhuber. Modeling systems with internal state �� using Evolino. In Proceedings of the 7th Annual Conference on Genetic and Evolutionary Computation, 2005.
234
+
235
+ Daniel Yamins, David Tax, and James Bergstra. Making a science of model search: hyperparameter optimization in hundreds of dimensions for vision architectures. In International Conference on Machine Learning, 2013.
236
+
237
+ Barret Zoph and Quoc Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations, 2017.
238
+
239
+ # A DETAILED EXPERIMENTAL SETUP
240
+
241
+ In Section 7, we considered a search space of deep convolutional models having structural hyperparameters for the depth of the network, whether to apply batch normalization before or after ReLU, and whether to use dropout; hyperparameters for the number and size of the convolutional filters; training hyperparameters for the learning rate schedule. We show in Figure 4 the LISP-like pseudocode for the search space considered in Section 7, and in Figure 5 the corresponding runnable Python implementation in our framework.
242
+
243
+ ![](images/3fca8eca08d3a80a997b55b4924b4900803f668303c0b43409e65dbada73dc48.jpg)
244
+ Figure 4: Specification of the model search space used in Section 7 in LISP-like pseudocode. See Figure 5 for the corresponding runnable Python code.
245
+
246
+ In Figure 4 and Figure 5, to include training hyperparameters in the search space, we concatenate the module that encapsulates the training hyperparameters (the module assigned to MH) and the modules that encapsulate the remaining model hyperparameters (the modules other than MH in the declaration of M).
247
+
248
+ The Python specification of the model search space in Figure 5 is remarkably close in both semantics and length to the LISP-like pseudocode in Figure 4. We omit some hyperparameters in Figure 4 because we did not consider multiple values for them, e.g., for Conv2D modules, we always used same size padding and the initialization scheme described in He et al. (2015).
249
+
250
+ Our implementation has code modularity and reusability benefits. For example, we can define an auxiliary function to instantiate modules and then use it in the instantiation of the module for the complete search space. This is illustrated in Figure 5 with the definition of Module fn and its use in the declaration of M.
251
+
252
+ See Figure 6a for the performance profile of 16 models randomly sampled from the search space in Figure 5. See Figure 6b for the architecture and training hyperparameters of the best model found in the 16 samples.
253
+
254
+ # B LIST OF MODULES
255
+
256
+ We provide a brief description of a representative subset of the types of basic and composite modules that we have implemented in our framework. It is simple to define new modules this list by implementing the module interface described in Section C.
257
+
258
+ # B.1 BASIC MODULES
259
+
260
+ Basic modules take no other modules when instantiated, having only local hyperparameters and parameters.
261
+
262
+ • Affine: Dense affine transformation. Hyperparameters: number of the hidden units and initialization scheme of the parameters. Parameters: dense matrix and bias vector.
263
+
264
+ MH $=$ UserHyperparams([’optimizer_type’, ’learning_rate_init’, ’rate_mult’, ’rate_patience’, ’stop_patience’, ’learning_rate_min’, ’angle_delta’, ’scale_delta’, ’weight_decay_coeff’], [[’adam’, ’sgd_mom’], list( np.logspace(-2, -6, num=32) ), list( np.logspace(-2, np.log10(0.9), num=8) ), range(8, 65, 4), [128], [1e-6], [0, 5, 10, 15, 20, 25, 30, 35], [0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35], [0.0, 1e-6, 1e-5, 1e-4] ])
265
+
266
+ conv_initers $=$ [ kaiming2015delving_initializer_conv(1.0) ] aff_initers $=$ [ xavier_initializer_affine( 1.0 )]
267
+
268
+ def Module_fn(filter_ns, filter_ls, keep_ps, repeat_ns): b $=$ RepeatTied( Concat([ Conv2D(filter_ns, filter_ls, [1], ["SAME"], conv_initers), MaybeSwap_fn( ReLU(), BatchNormalization() ), Optional_fn( Dropout(keep_ps) ) ]), repeat_ns) return b
269
+
270
+ filter_nums $=$ range(48, 129, 16) repeat_nums $= \ [ 2 \star \star$ i for i in xrange(6)] mult_fn $=$ lambda ls, alpha: list(alpha $^ { \star }$ np.array(ls))
271
+
272
+ $\mathrm { ~ \textmu ~ } =$ Concat([MH, Conv2D(filter_nums, [3, 5, 7], [2], ["SAME"], conv_initers), Module_fn(filter_nums, [3, 5], [0.5, 0.9], repeat_nums), Conv2D(filter_nums, [3, 5, 7], [2], ["SAME"], conv_initers), Module_fn(mult_fn(filter_nums, 2), [3, 5], [0.5, 0.9], repeat_nums), Affine([num_classes], aff_initers) ])
273
+
274
+ Figure 5: Runnable specification of the model search space used in Section 7 in our Python implementation of the framework. See Figure 4 for the specification of the same search space in the LISP-like pseudocode used throughout this paper.
275
+
276
+ ![](images/e9dfe1470fda96d5d091cfb2a08416f6aa85abf62b9f987c6fbc047cc64c5627.jpg)
277
+ Figure 6: (a) The performance profile of the 16 sampled models in decreasing order of their validation accuracy. The model with the highest validation accuracy $( 9 9 . 8 0 \% )$ has also the highest test accuracy $( 9 9 . 7 2 \% )$ ). (b) The best performing model found from sampling 16 models of search space in Figure 5 with a random model searcher. The hyperparameters of UserHyperparams are as in the search space in Figure 5. The hyperparameters of the layers are as described in Appendix B. The parameters of the Affine and Conv2d modules were initialized according to Glorot & Bengio (2010) and He et al. (2015), respectively.
278
+
279
+ ( ( ’UserHyperparams’,
280
+ ’adam’,
281
+ 0.003046989570903508,
282
+ 0.24882127247602889,
283
+ 52,
284
+ 128,
285
+ 1e-06,
286
+ 15,
287
+ 0.1,
288
+ 1e-06),
289
+ (’Conv2D’, 80, 7, 2, ’SAME’),
290
+ (’Conv2D’, 96, 3, 1, ’SAME’),
291
+ (’ReLU’,),
292
+ (’BatchNormalization’,),
293
+ (’Dropout’, 0.9),
294
+ (’Conv2D’, 96, 3, 1, ’SAME’),
295
+ (’ReLU’,),
296
+ (’BatchNormalization’,),
297
+ (’Dropout’, 0.9),
298
+ (’Conv2D’, 96, 3, 1, ’SAME’),
299
+ (’ReLU’,),
300
+ (’BatchNormalization’,),
301
+ (’Dropout’, 0.9),
302
+ (’Conv2D’, 96, 3, 1, ’SAME’),
303
+ (’ReLU’,),
304
+ (’BatchNormalization’,),
305
+ (’Dropout’, 0.9),
306
+ (’Conv2D’, 96, 3, 1, ’SAME’),
307
+ (’ReLU’,),
308
+ (’BatchNormalization’,),
309
+ (’Dropout’, 0.9),
310
+ (’Conv2D’, 96, 3, 1, ’SAME’),
311
+ (’ReLU’,),
312
+ (’BatchNormalization’,),
313
+ (’Dropout’, 0.9),
314
+ (’Conv2D’, 96, 3, 1, ’SAME’),
315
+ (’ReLU’,),
316
+ (’BatchNormalization’,),
317
+ (’Dropout’, 0.9),
318
+ (’Conv2D’, 96, 3, 1, ’SAME’),
319
+ (’ReLU’,),
320
+ (’BatchNormalization’,),
321
+ (’Dropout’, 0.9),
322
+ (’Conv2D’, 128, 7, 2, ’SAME’),
323
+ (’Conv2D’, 128, 3, 1, ’SAME’),
324
+ (’BatchNormalization’,),
325
+ (’ReLU’,),
326
+ (’Dropout’, 0.5),
327
+ (’Affine’, 10))
328
+ • ReLU: ReLU nonlinearity. Hyperparameters: none. Parameters: none.
329
+ • Dropout: Dropout. Hyperparameter: dropout probability. Parameters: none.
330
+ • Conv2D: Two-dimensional convolution. Hyperparameters: number of filters, size of the filters, stride, padding scheme, and initialization scheme of the parameters. Parameters: convolutional filters and bias vector.
331
+ • MaxPooling2D: Two-dimensional max pooling. Hyperparameters: size of the filters, stride, and padding scheme. Parameters: none.
332
+ • BatchNormalization: Batch normalization. Hyperparameters: none. Parameters: translation coefficients and scaling coefficients.
333
+ • UserHyperparams: User-defined hyperparameters. Hyperparameters: hyperparameters determined by the user expert. Parameters: none.
334
+ • Empty: Identity. Hyperparameters: none. Parameters: none.
335
+
336
+ # B.2 COMPOSITE MODULES
337
+
338
+ Composite modules take other modules as arguments when instantiated, which we will call submodules. The behavior of a composite module depends on its submodules. The hyperparameters which a composite module has to specify depend on the values of the hyperparameters of the composite module and the hyperparameters of the submodules; e.g., $\bigcirc \mathtt { r }$ takes a list of submodules but it only has to specify the hyperparameters of the submodule that it ends up choosing. A composite module is responsible for specifying its submodules, which is done through calls to the module interfaces of the submodules.
339
+
340
+ • Concat: Takes a list of submodules and connects them in series. Hyperparameters: hyperparameters of the submodules. Parameters: parameters of the submodules.
341
+ • Or: Chooses one of its submodules to use. Hyperparameters: which submodule to use and hyperparameters of the submodule chosen. Parameters: parameters of the submodule chosen.
342
+ • Repeat: Repeats a submodule some number of times, connecting the repetitions in series; values for the hyperparameters of the repetitions are chosen independently. Hyperparameters: number of times to repeat the submodule and hyperparameters of the repetitions of the submodule. Parameters: parameters of the repetitions of the submodule. RepeatTied: Same as Repeat, but values for the hyperparameters of the submodule are chosen once and used for all the submodule repetitions. Hyperparameters: the number of times to repeat the submodule and hyperparameters of the submodule. Parameters: parameters of the repetitions of the submodule. Optional: Takes a submodule and chooses whether to use it or not. Hyperparameters: whether to include the submodule or not and, if included, hyperparameters of the submodule. Parameters: if included, parameters of the submodule. Residual: Takes a submodule and implements a skip connection adding the input and output; if the input and output have different dimensions, they are padded to make addition possible. Hyperparameters: hyperparameters of the submodule. Parameters: parameters of the submodule. MaybeSwap: Takes two submodules and connects them in series, choosing which submodule comes first. Hyperparameters: which of the submodules comes first and hyperparameters of the submodules. Parameters: parameters of the submodules.
343
+
344
+ # C MODULE INTERFACE
345
+
346
+ We describe the module interface as we implemented it in Python. To implement a new type of module, one only needs to implement the module interface.
347
+
348
+ class Module(object): def initialize(self, in_d, scope) def get_outdim(self) def is_specified(self) def get_choices(self) def choose(self, choice_i) def compile(self, in_x, train_feed, eval_feed)
349
+
350
+ Figure 7: Module interface used by all modules irrespective if they are basic or composite. To implement a new type of module, the human expert only needs to implement the module interface.
351
+
352
+ • initialize: Tells a module its input dimensionality. A composite module is responsible for initializing the submodules that it uses.
353
+
354
+ get outdim: Once a module is fully specified, we can determine its output dimensionality by calling get outdim. The output dimensionality is a function of the input dimensionality (which is determined when initialize is called) and the values of the hyperparameters chosen. is specified: Tests whether a module is fully specified. If a module is fully specified, outdim and compile may be called.
355
+ • get choices: Returns a list of the possible values for the hyperparameter currently being specified.
356
+ • choose: Chooses one of the possible values for the hyperparameter being specified. The module assigns the chosen value to that hyperparameter and either transitions to the next hyperparameter to specify or becomes fully specified. The module maintains internally the state of its search process. compile: Creates the computational graph of the model in a deep learning model specification language, such as Tensorflow or PyTorch. For composite modules, compilation can be performed recursively, through calls to the compile functions of its submodules.
357
+
358
+ Composite modules rely on calls to the module interfaces of its submodules to implement their own module interfaces. For example, Concat needs to call out dim for the last submodule of the series connection to determine its own output dimensionality, and needs to call choose on the submodules to specify itself. One of the design choices that make the language modular is the fact that a composite module can implement its own module interface through calls to the module interfaces of its submodules. All information about the specification of a module is local to itself or kept within its submodules.
359
+
360
+ # D BEYOND SINGLE-INPUT SINGLE-OUTPUT MODULES
361
+
362
+ We can define new modules with complex signal paths as long as their existence is encapsulated, i.e., a module may have many signal paths as long they fork from a single input and merge to a single output, as illustrated in Figure 8.
363
+
364
+ ![](images/adc1987400f5aef02f1aba4ccf30c4e0d319f284bd979f6e51eff22d8811b261.jpg)
365
+ Figure 8: A module with many signal paths from input to output. To implement a module, the human expert only needs to implement its module interface. M1, M2, M3, and M4 are arbitrary single-input single-output modules; $g _ { 1 }$ and $g _ { 2 }$ are arbitrary transformations that may have additional hyperparameters. The hyperparameters of $g _ { 1 }$ and $g _ { 2 }$ can be managed internally by NewModule.
366
+
367
+ In Figure 8 there is a single input fed into M1, M2, and M3. M1, M2, M3, M4, M5 are arbitrary single-input single-output submodules of NewModule. The module interface of NewModule can be implemented using the module interfaces of its submodules. Instantiating a module of type NewModule requires submodules for M1, M2, M3, M4, and M5, and potentially lists of possible values for the hyperparameters of $g _ { 1 }$ and $g _ { 2 }$ . A residual module which chooses what type of merging function to apply, e.g., additive or multiplicative, is an example of a module with hyperparameters for the merging functions
368
+
369
+ A module of the type NewModule is fully specified after we choose values for all the hyperparameters of M1, M2, M3, M4, M5, $g _ { 1 }$ , and $g _ { 2 }$ . Testing if M1, M2, M3, M4, and M5 are fully specified can be done by calling is specified on the corresponding submodule.
370
+
371
+ The output dimensionality of NewModule can be computed as a function of the values of the hyperparameters of $g _ { 2 }$ and the output dimensionality of M5 and M4, which can be obtained by calling get outdim. Similarly, for get choices we have to keep track of which hyperparameter we are specifying, which can either come from M1, M2, M3, M4, and M5, or from $g _ { 1 }$ and $g _ { 2 }$ . If we are choosing values for an hyperparameter in M1, M2, M3, M4, and M5 we can call get choices and choose on that submodule, while for the hyperparameters of $g _ { 1 }$ and $g _ { 2 }$ we have to keep track of the state in NewModule. compile is similar in the sense that it is implemented using calls to the compile functionality of the submodules.
md/train/rkesVkHtDr/rkesVkHtDr.md ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # META-LEARNING RUNGE-KUTTA
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Initial value problems, i.e. differential equations with specific, initial conditions, represent a classic problem within the field of ordinary differential equations (ODEs). While the simplest types of ODEs may have closed-form solutions, most interesting cases typically rely on iterative schemes for numerical integration such as the family of Runge-Kutta methods. They are, however, sensitive to the strategy the step size is adapted during integration, which has to be chosen by the experimenter. Here, we show how the design of a step size controller can be cast as a learning problem, allowing deep networks to learn to exploit structure in the initial value problem at hand in an automatic way. The key ingredients for the resulting Meta-Learning Runge-Kutta (MLRK) are the development of a good performance measure and the identification of suitable input features. Traditional approaches suggest the local error estimates as input to the controller. However, by studying the characteristics of the local error function we show that including the partial derivatives of the initial value problem is favorable. Our experiments demonstrate considerable benefits over traditional approaches. In particular, MLRK is able to mitigate sudden spikes in the local error function by a faster adaptation of the step size. More importantly, the additional information in the form of partial derivatives and function values leads to a substantial improvement in performance. The source code can be found at https://www.dropbox.com/sh/ rkctdfhkosywnnx/AABKadysCR8-aHW_0kb6vCtSa?dl $= 0$
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Differential equations in their general form cover an extremely wide variety of disciplines: While many applications are rather intuitive, as for instance simple Newtonian physics and engineering, other more exotic use cases include the governing of price evolution in economics (Black & Scholes, 1973), the study of rates in chemical reactions (Scholz & Scholz, 2014), and the modeling of population growths in biology (Lotka, 1925; Volterra, 1926). In medicine, differential equations may be used to model cancer growth (Ilea et al., 2013), diabetes and the glucose metabolism (Esna-Ashari et al., 2017) as well as for pharmaceutical drug design (Deuflhard, 2000). Recently, differential equations have also been used as a way to design neural networks (Chen et al., 2018). Unfortunately, finding an analytical solution in closed form is in many cases very difficult, if not impossible. Therefore, a variety of numerical integration methods have been developed to obtain accurate, but approximate solutions. Arguably, the most prominent ones are Runge-Kutta methods, a family of integration methods for initial value problems. However, setting up Runge-Kutta involves several design choices, one of which is the step size controller. Using an adaptive step size strategy instead of a constant step size can often increase efficiency by several orders of magnitude, $c . f$ . (Söderlind, 2006). Their performance is hampered by the fact that they only make use of hand-designed features.
12
+
13
+ Contribution. We show how to cast the design of a step size controller for Runge-Kutta as a learning problem, $c . f$ . Fig. 1. The key ingredients of the resulting Meta-Learning Runge-Kutta (MLRK) are the identification of a good performance measure and appropriate inputs.
14
+
15
+ Related Work. Various approaches to control the step sizes in Runge-Kutta methods have been proposed. While some rely on signal processing principles where the goal is to produce a smooth step size sequence in conjunction with acceptable local errors, others are based on the assumption that step sizes should be adapted to a prescribed function of the solution, e.g. to preserve structure in geometric integration (Söderlind, 2006). In this work we will focus on control theoretic approaches which aim to keep the local error associated with a single step close to a tolerance parameter.
16
+
17
+ ![](images/ed560a630f9d0f17b08690c45f047927431bcaa3feb93ba76c4a0095a9d6f2fc.jpg)
18
+ Figure 1: Meta-Learning Runge-Kutta: The model represented by the blue block determines the step size adjustment $\log r _ { n - 1 }$ using a LSTM and a linear layer, $c . f$ . Eq. (10). The Runge-Kutta update then determines the new step size $\log h _ { n } = \log h _ { n - 1 } + \log r _ { n - 1 }$ . The new step size is used to perform the next Runge-Kutta step which computes the approximation $y _ { n + 1 }$ at time step $t _ { n + 1 }$ and an error estimate $\mathrm { e r r } _ { n + 1 }$ according to (12). Then the next input $x _ { n + 1 }$ for the model is computed.
19
+
20
+ Specifically, the design of the step size control algorithm is learned within MLRK. Indeed, casting algorithm design as a learning problem is not new. Andrychowicz et al. (2016) learned a gradientbased optimizer for nonlinear unconstrained optimization problems. Wichrowska et al. (2017) extended this work by introducing a hierarchical RNN architecture which improves the generalization ability of the optimizer. Schramowski et al. (2018) demonstrated the benefit of a learned projectionfree convex optimization algorithm, which relies on conditional gradients. Finally, Chen et al. (2017) cast the design of gradient-free black-bock optimization as a learning problem.
21
+
22
+ Furthermore, other approaches to solve differential equations using neural networks have been proposed, too. Lagaris et al. (1998) suggested to use a feed-forward neural network to approximate the solution of an ordinary or partial differential equation with initial or boundary conditions. Inspired by the Galerkin method, Sirignano & Spiliopoulos (2018) used a deep neural network to directly approximate the solution of a high-dimensional partial differential equation. E & Yu (2018) proposed the Deep Ritz method as a means to solve variational problems that arise from partial differential equations. Han et al. (2018) cast the problem of solving semilinear parabolic partial differential equations as a learning problem by using the reformulation of these differential equations as backward stochastic differential equations. In all of the above approaches, a neural network is used to help approximate the solution of the differential equation. The learning process corresponds to the numerical computation of a solution of the differential equation. In contrast, MLRK learns to improve the numerical integration process itself.
23
+
24
+ We proceed as follows. As the first step, i.e. identifying a good performance measure, we consider the general objective of step size control as well as the simplified and more practical objective that many controllers are based on. Then, we identify useful inputs by analyzing existing step size control algorithms. Furthermore, we show how local information about the ODE can be used as additional favorable inputs. Before concluding, we demonstrate empirically how our proposed controller can be used to improve step size control and investigate the benefit of different inputs.
25
+
26
+ # 2 INITIAL VALUE PROBLEMS AND RUNGE-KUTTA METHODS
27
+
28
+ We give a brief introduction to initial value problems and Runge-Kutta methods, a numerical method for solving these problems. Furthermore, we will recap standard step size controllers and point out their underlying assumptions.
29
+
30
+ Basics of Initial Value Problems and Runge-Kutta Methods. An ordinary differential equation describes a system that depends on one variable, often referred to as time. An initial value problem additionally provides initial values: $y ^ { \prime } = g ( t , y ) , \quad y ( t _ { 0 } ) = y _ { 0 }$ , with a function $g : [ a , b ] \times \mathbb { R } ^ { m } $ $\mathbb { R } ^ { m }$ , $m \in \mathbb { N }$ . As closed-form solutions can be very hard to find, numerical methods such as RungeKutta methods have been developed. Their mathematical underpinning is quite evolved (Butcher, 2008; Hairer et al., 2000; Hairer & Wanner, 2002). A brief recap can be found in the appendix.
31
+
32
+ For iterative solvers, the local truncation error—the error committed in a single step using step size $h$ —constitutes an important tool to control the step size as it allows to access the fitness of a step size.
33
+
34
+ Definition 2.1. The local truncation error in step $n + 1$ is defined as
35
+
36
+ $$
37
+ \mathrm { e r r } _ { n + 1 } ( h ) = \| y ( t _ { n } + h ) - y _ { n + 1 } \| = C ( t _ { n } ) h ^ { p + 1 } + \mathcal { O } ( h ^ { p + 2 } ) ,
38
+ $$
39
+
40
+ where $y _ { n + 1 } = \Phi ( t _ { n } , y _ { n } , h )$ is a single Runge-Kutta step of a $p$ -th order method using step size $h$ . We call $C ( t _ { n } )$ the principal error term.
41
+
42
+ We will also denote the local truncation error as local error and refer to the appendix for simple ways to estimate it. We denote the error estimates as $\operatorname { e r r } _ { n }$ .
43
+
44
+ The Objective of Step Size Control. As numerical integration is used to approximate a solution, high accuracy is a desired property. However, in practice, computational resources might be limited and efficient use of these resources can be crucial in some applications. Hence, an efficient step size controller should maximize the accuracy of the approximate solution while minimizing the computational cost. These are competing goals and require a trade-off, which is achieved by considering the Lagrangian of the error $E ( H )$ and the work cost $W ( H )$ produced by a sequence of step sizes $H \ = \ ( h _ { n } ) _ { n = 0 } ^ { N - 1 }$ , $E ( H ) + \lambda \cdot W ( H )$ . Butcher (2008) uses two integrals describing the error $E ( H )$ and the work cost $W ( H )$ . Under some assumptions one can show that optimal step sizes w.r.t. this objective causes local errors equal to the Lagrange multiplier $\lambda$ , which is often referred to as the tolerance parameter. Namely, we need to assume that the global error is equal to the sum of local errors and all step sizes are small enough so that the loss can be approximated by the integrals suggested by Butcher. However, these are quite strong assumptions. The optimal step size depends on the tolerance parameter, and hence, might be too large. Furthermore, the assumption that the global error is equal to the sum of the local errors is not true in general.
45
+
46
+ Classical Step Size Control. Most common step size control mechanisms aim to keep the local errors equal to a tolerance parameter so that a standard controller is based on the following idea: For a RungeKutta method of order $p$ , the local error for step size $h$ at time $t$ is approximately err $\approx C ( t ) h ^ { p + 1 }$ , and, accordingly, the desired optimal step size $h _ { \mathrm { o p t } }$ is given by $h _ { \mathrm { o p t } } \approx h ( \mathrm { t o l / e r r } ) ^ { \frac { 1 } { p + 1 } }$ . This formula is then used to adapt the step size as
47
+
48
+ $$
49
+ h _ { n + 1 } = r _ { n } h _ { n } , \qquad r _ { n } & = \operatorname* { m a x } \left( \alpha , \operatorname* { m i n } \left( \beta , \gamma \left( { \frac { \mathrm { t o l } } { \mathrm { e r r } _ { n + 1 } } } \right) ^ { \frac { 1 } { p + 1 } } \right) \right) ,
50
+ $$
51
+
52
+ where a safety factor $0 < \gamma < 1$ and a minimal and maximal factor $\alpha , \beta \in \mathbb { R } _ { \ge 0 }$ , $\alpha \leq \beta$ are included to avoid excessive step rejection and ensure a smooth step size control. Söderlind (2002) pointed out that the underlying assumptions of Eq. (2) are rather strong. It assumes slow variations in $C$ and requires $h$ to be sufficiently small so that it exhibits its theoretical asymptotic behavior. Both are not true in general.
53
+
54
+ Control Theory on Step Size Control in Runge-Kutta Methods. Gustafsson et al. (1988) discussed step size control in the context of a proportional-integral-derivative (PID) controller. The classical step size control mechanism in Eq. (2) can be regarded as an I-controller. They then demonstrated the oscillatory behavior of this controller when applied to certain problems. They report the poor stabilizing capability of an I-controller as the origin of these oscillations, which are further accentuated by a large integration gain. To overcome this, they Gustafsson et al. (1988) suggested a PI-controller, which in addition to the integral term used in a standard step size control, also includes a proportional term and can be expressed as
55
+
56
+ $$
57
+ h _ { n + 1 } = r _ { n } h _ { n } , \qquad r _ { n } & = \operatorname* { m a x } \left( \alpha , \operatorname* { m i n } \left( \beta , \gamma \left( { \frac { { \mathrm { t o l ~ } } } { { \mathrm { e r r } } _ { n + 1 } } } \right) ^ { n _ { 1 } } \left( { \frac { { \mathrm { t o l } } } { { \mathrm { e r r } } _ { n } } } \right) ^ { n _ { 2 } } \right) \right) .
58
+ $$
59
+
60
+ A Predictive Controller. Both the classical step size controller, see Eq. (2), and the PI-controller in Eq. (3) rely on the assumption that the local truncation error can be described as a function of $h$ that remains independent of $t$ . This is certainly not true for all cases. Therefore, Gustafsson (1994), e.g., discussed a controller based on a prediction of the principal error term. A simple model that assumes a constant linear trend in $\log C ( t )$ was suggested. Implementing the predicted principal error leads to
61
+
62
+ $$
63
+ h _ { n + 1 } = { \frac { h _ { n } } { h _ { n - 1 } } } \left( { \frac { \mathrm { t o l } } { \mathrm { e r r } _ { n + 1 } } } \right) ^ { n _ { 1 } } \left( { \frac { \mathrm { e r r } _ { n } } { \mathrm { e r r } _ { n + 1 } } } \right) ^ { n _ { 2 } } h _ { n } .
64
+ $$
65
+
66
+ # 3 META-LEARNING RUNGE-KUTTA: NEURAL STEP-SIZE CONTROLLER
67
+
68
+ Step size controllers for Runge-Kutta are typically still designed by hand. Formulas such as Eq. (2), (3) and (4) require parameter fine-tuning. In this work, we take a different tack and instead suggest to replace these hand-designed update rules with a learned controller, hereinafter referred to as optimizer. The key steps to cast the design of a controller as a learning problem is to determine a good performance measure and appropriate inputs.
69
+
70
+ Performance measure. As the first step we need to identify an appropriate performance measure. As discussed, a trade-off between numerical accuracy and computational cost of the solution must be made, e.g. by considering the Lagrangian of error and work cost. The work cost is generally correlated with the number of integration steps. It is crucial to take the length of the integration interval $t _ { n } - t _ { 0 }$ into account as well, which leads to the following performance measure:
71
+
72
+ $$
73
+ l ^ { \mathrm { L a g r a n g e } } ( t _ { n } , y _ { n } , \mathrm { e r r } _ { n } ) = { \frac { \| y ( t _ { n } ) - y _ { n } \| + \mathrm { t o l } \cdot n } { t _ { n } - t _ { 0 } } } .
74
+ $$
75
+
76
+ In contrast, if we follow the concept of most step size controllers, an optimal step size is achieved if the local error is equal to the tolerance, which suggests the performance measure
77
+
78
+ $$
79
+ l ^ { \mathrm { l o c a l } } ( t _ { n } , y _ { n } , \mathbf { e r r } _ { n } ) = \left\| \mathbf { e r r } _ { n } - \mathbf { t o l } \right\| .
80
+ $$
81
+
82
+ Both types of loss functions offer various strengths and weaknesses over one another.
83
+
84
+ The loss Eq. (5) incorporates the essential quantities that an efficient algorithm should minimize. However, the true global error of numerical integration is generally unknown and can only be approximated. In general this can be computationally demanding and as a result make the training process very expensive. Furthermore, when the global error is employed, optimal step sizes may depend on the integration interval as well, e.g. the choice of step size in the first few steps may have different effects on the global error at different points in the integration interval.
85
+
86
+ Classic step size controllers are typically based on local errors alone without regards to global strategies. The objective of these controllers is reflected by the loss Eq. (6). Although this objective minimizes the Lagrangian of the global error and the number of steps only under strong assumptions it does qualify as an appropriate practical objective for step size controllers.The advantage here is that estimates of the local error associated with a step size are available and no additional computation to determine the loss of a step size is required. This allows efficient training even when the analytical solution of an initial value problem is unknown.
87
+
88
+ Input Features. Existing step size controllers rely on error estimates to update the step size. Specifically, $\frac { \mathrm { t o l } } { \mathrm { e r r } _ { n } }$ is important, as evident in Eq. (2), (3) and (4). We intuitively expect a data driven approach to be able to utilize these features. This gives rise to the first set of input features,
89
+
90
+ $$
91
+ \psi \left( \mathrm { e r r } _ { n + 1 } , \cdot \right) = \log \left( \frac { \mathrm { t o l } } { \mathrm { e r r } _ { n + 1 } } \right) .
92
+ $$
93
+
94
+ Here, $\psi \left( \mathrm { e r r } _ { n + 1 } , \cdot \right)$ denotes the input for the optimizer with optional variables. Next, we want to investigate additional input features that may be beneficial. The principal error term as well as higher order terms of the local errors can be expressed with elementary differentials of the ODE, $c . f$ . (Hairer et al., 2000, Section II.3). These elementary differentials are formed of function values and partial derivatives of $g$ and allow a Taylor approximation of the local error function $\operatorname { e r r } _ { n + 1 } ( h ) =$ $\phi ( t _ { n } , h ) h ^ { k + 1 } + \mathcal { O } ( h ^ { k + 2 } )$ , where $\phi ( t _ { n } , h )$ is a polynomial in $h$ with coefficients formed from partial derivatives of $g$ up to order $k > p$ . The roots of the polynomial $\phi ( t _ { n } , h ) h ^ { k + 1 } \ - $ tol approximate the optimal step size. Moreover, it is reasonable to assume that the local error takes values greater tol for some $h > 0$ , implying the existence of real roots. Since the complex roots of polynomials are known to depend continuously on the coefficients of the polynomial, $c . f$ . (Rahman & Schmeisser, 2002, Theorem 1.3.1), it is clear that the optimal step size, a real root of $p ( h )$ , depends continuously on the partial derivatives and function values of $g$ as well as the tolerance tol. From the Universal Approximation Theorem (Hornik, 1991), it then follows that the optimal step size function can be approximated by a neural network with input $\cdot \left( \partial ^ { \alpha } g ( t _ { n } , y _ { n } ) \right) _ { | \alpha | = k } , \ldots , \partial g ( t _ { n } , y _ { n } ) , g ( t _ { n } , y _ { n } ) , \mathrm { t o l }$  . This suggests that the partial derivatives of $g$ can also be an appropriate input for our controller,
95
+
96
+ $$
97
+ \psi \left( { \mathrm { e r r } } _ { n + 1 } , \cdot \right) = \left( \log \left( { \frac { \mathrm { t o l } } { { \mathrm { e r r } } _ { n + 1 } } } \right) , ( \partial ^ { \alpha } g ( t _ { n } , y _ { n } ) ) _ { | \alpha | = p } , \cdot \cdot . . , \partial g ( t _ { n } , y _ { n } ) , g ( t _ { n } , y _ { n } ) \right) .
98
+ $$
99
+
100
+ However, providing partial derivatives requires additional computation whereas the $p$ function values that were computed during the Runge-Kutta step are conveniently available. As a trade-off between “perfect” information in the form of higher order partial derivatives and the computational effort to compute them, we also propose to use the following input:
101
+
102
+ $$
103
+ \psi \left( \mathrm { e r r } _ { n + 1 } , \cdot \right) = \left( \log \left( \frac { \mathrm { t o l } } { \mathrm { e r r } _ { n + 1 } } \right) , g _ { n } ^ { ( 1 ) } , \dots , g _ { n } ^ { ( p ) } \right) ,
104
+ $$
105
+
106
+ $g _ { n } ^ { ( 1 ) } , \ldots , g _ { n } ^ { ( p ) }$ $p$
107
+
108
+ In contrast to the traditional input (7), our novel inputs (8) and (9) both provide local information about the structure of the problem at hand, which allows one to keep the local error close to the tolerance parameter. Moreover, hand-designed controller and existing Runge-Kutta methods do not make use of these information, and it is difficult—if not impossible—to do so. Training an optimizer with input (8) or (9), as shown next, does so automatically and designs novel Runge-Kutta methods.
109
+
110
+ Meta-Learner. With a good performance measure and appropriate inputs at hand, we can now solve the step-size control problem as a meta-learning problem as sketched already in Fig. 1. Let the input for the optimizer be $x _ { n } = \psi \left( \mathrm { e r r } _ { n } , \cdot \right)$ . We parameterize the optimizer $c$ using $\phi$ and update the step size as follows, $\log h _ { n + 1 } = \log h _ { n } + c _ { n } ( \psi ( \mathbf { e r r } _ { n + 1 } , \cdot ) , \phi )$ . An approach in log space has the advantage that that we do not need to constrain the output of $c$ to be positive. Since $c _ { n }$ corresponds to $\log r _ { n }$ , we will adjust the notation in a similar fashion. Due to their natural ability to handle sequential tasks, an LSTM was chosen in our experiments as optimizer $c$ , and its prediction determines the step size which will be used in the next Runge-Kutta iteration. We denote the model of the optimizer, represented by the blue block in Fig. 1, by $m$ , its parameters by $\phi$ and the hidden state by $\hat { h } _ { n }$ . It can be expressed by
111
+
112
+ $$
113
+ \binom { \log r _ { n - 1 } } { \hat { h } _ { n + 1 } } = m \left( x _ { n } , \hat { h } _ { n } , \phi \right) .
114
+ $$
115
+
116
+ The subsequent Runge-Kutta update in the yellow block of Fig. 1 first updates the step size
117
+
118
+ $$
119
+ \log h _ { n } = \log h _ { n - 1 } + \log r _ { n - 1 } ,
120
+ $$
121
+
122
+ and then uses it to execute the next Runge-Kutta step,
123
+
124
+ $$
125
+ t _ { n + 1 } = t _ { n } + h _ { n } , \left( { \begin{array} { c } { y _ { n + 1 } } \\ { \operatorname { e r r } _ { n + 1 } } \end{array} } \right) = \Phi ( t _ { n } , y _ { n } , h _ { n } ) .
126
+ $$
127
+
128
+ Here, $\Phi$ denotes the Runge-Kutta step from $y _ { n }$ to $y _ { n + 1 }$ as well as the error estimate $\mathrm { e r r } _ { n + 1 }$ that is computed during that step. Afterwards, the next input for the model will be computed.
129
+
130
+ Learning Objective. Different initial value problems can require very different step sizes. Using an optimizer that is specialized for a certain class of problems allows to exploit the structure of these problems. The behavior of an initial value problem is described by a function $g$ , therefore we can represent a class of initial value problems with a distribution over the functions $g$ . Thus, an optimizer can be considered optimal for a class of problems, if it minimizes the expected loss:
131
+
132
+ $$
133
+ L ( \phi ) = \mathbb { E } _ { g } \left( \sum _ { n = 1 } ^ { N } l ( t _ { n } , y _ { n } , \mathrm { e r r } _ { n } ) \right) ,
134
+ $$
135
+
136
+ where $t _ { n } , y _ { n } , \mathbf { e r r } _ { n }$ were computed according to Eqs. (10), (11), (12). Here, $l$ denotes the loss function defined for an approximation $y _ { n }$ at time point $t _ { n }$ and the local error estimate $\operatorname { e r r } _ { n }$ . Note that our training loss directly corresponds to the performance measure we are interested in. The model $m$ can then learn the behavior of the given class of problems and use this knowledge to generalize to new examples of the same class and new, unseen classes. Specifically, since the provided performance measure $l$ is differentiable a.e., we can optimize the learning objective Eq. (13) using gradient descent on the parameters $\phi$ . An estimate of the gradient $\frac { \partial L ( \phi ) } { \partial \phi }$ can be computed by sampling a function $g$ from the distribution of the class of initial value problems and applying backpropagation, $c . f$ . (Rumelhart et al., 1986).
137
+
138
+ # 4 EXPERIMENTAL EVIDENCE
139
+
140
+ Our intention here is to investigate the benefits of Meta-Learning Runge-Kutta (MLRK). To this end we conducted experiments with different classes of initial value problems. Specifically, we
141
+
142
+ Table 1: On the test set of class (low-freq), MLRK was considerably faster (less many steps) than the baseline controller on average, while causing only a mildly larger mean global error at the end of the integration interval. Both the baseline controller and MLRK showed a gradually increasing mean global error at the end of the integration interval over the test set consisting of 1500 harmonic oscillators of class (med-freq).
143
+
144
+ <table><tr><td></td><td colspan="4">(low-freq)</td><td colspan="4">(med-freq)</td></tr><tr><td rowspan="2">interval</td><td colspan="2">steps</td><td colspan="2">error</td><td colspan="2">steps</td><td colspan="2">error</td></tr><tr><td>Baseline</td><td>MLRK</td><td>Baseline</td><td>MLRK</td><td>Baseline</td><td>MLRK</td><td>Baseline</td><td>MLRK</td></tr><tr><td></td><td>3.42</td><td>3.15</td><td>0.000004</td><td>0.000009</td><td>26.24</td><td>7.95</td><td>0.001588</td><td>0.008253</td></tr><tr><td></td><td>7.59</td><td>6.05</td><td>0.000017</td><td>0.000119</td><td>87.16</td><td>29.63</td><td>0.001686</td><td>0.011236</td></tr><tr><td></td><td>11.76</td><td>8.22</td><td>0.000032</td><td>0.000366</td><td>148.05</td><td>53.44</td><td>0.001739</td><td>0.012904</td></tr><tr><td>1357</td><td>15.80</td><td>10.23</td><td>0.000048</td><td>0.000668</td><td>208.95</td><td>77.54</td><td>0.001735</td><td>0.014222</td></tr><tr><td>10</td><td>21.92</td><td>13.15</td><td>0.000073</td><td>0.001171</td><td>300.32</td><td>113.82</td><td>0.001816</td><td>0.016546</td></tr></table>
145
+
146
+ (high-freq)
147
+
148
+ <table><tr><td rowspan="2">interval</td><td colspan="2">steps</td><td colspan="2">error</td></tr><tr><td>Baseline</td><td>MLRK</td><td>Baseline</td><td>MLRK</td></tr><tr><td>13</td><td>47.15</td><td>12.08</td><td>0.026415</td><td>0.085082</td></tr><tr><td></td><td>157.58</td><td>53.42</td><td>0.023223</td><td>0.081219</td></tr><tr><td>5</td><td>268.03</td><td>96.48</td><td>0.025230</td><td>0.091109</td></tr><tr><td>7</td><td>378.42</td><td>139.69</td><td>0.026177</td><td>0.094129</td></tr><tr><td>10</td><td>544.05</td><td>204.57</td><td>0.024858</td><td>0.094562</td></tr></table>
149
+
150
+ Table 2: The mean global errors of the baseline stay approximately the same. The optimizer trained on problem instances of class (low-freq) shows only a very gradual increment in the global error on instances of class (high-freq).
151
+
152
+ investigated our suggested loss functions and our theory that suggests that providing higher order partial derivatives of $g$ can be used as a means to anticipate the evolution of the local error and, hence, may lead to an improved performance of the optimizer. For a class of initial value problems we assume a parametric form of $g$ with a distribution over the parameters; details can be found in the appendix. Our datasets are obtained by sampling from these distributions. Finally, we compare our method to the baseline controller given by Eq. (2).
153
+
154
+ Harmonic Oscillator. First, we started with a simple class of ODEs. We trained MLRK on low varied harmonic oscillators. The corresponding results for training on high frequencies are similar and can be found in the appendix. As inputs we only used the error estimates, Eq. (7). We started with the dataset of harmonic oscillators with low frequencies (low-freq): the training set contained 30,000 instances, the validation set and test set each 1,500 instances. To measure the performance we considered the $L _ { 1 }$ -Lagrangian loss Eq. (5) as well as the number of steps needed for an integration interval and the corresponding error separately. Since the Lagrangian represents a trade-off between the two it is a particularly good measure.
155
+
156
+ Fig. 2(a) shows the mean loss during the integration of the test set, which consists of 1500 harmonic oscillators of class (low-freq). The solid lines show the mean loss in step $n$ , the colored areas mark the standard deviation. MLRK achieves a smaller mean loss than the baseline, which confirms its ability to generalize to new problem instances of the same class of problem. When we compare the mean number of steps and the mean global error of MLRK and the baseline controller in Tab. 1, the necessity for a trade-off between the two objectives becomes clear. While the baseline needs on average more steps to complete the integration, it achieves a smaller error, the contrary is true for our optimizer. This makes it hard to compare the two methods based on just these values.
157
+
158
+ Generalization Capability of Optimizer based on Low Frequency Harmonic Oscillators. By evaluating the controller designed by MLRK on different test sets, we investigated its ability to transfer knowledge to problem instances of other classes. Fig. 2(b) shows that MLRK maintains a smaller mean loss on 1500 harmonic oscillators of class (med-freq). These oscillators are both higher in frequency and amplitude than the problem instances contained in the training set. This indicates that MLRK is able to generalize to these problems. Tab. 1 reveals that MLRK uses on average about a third of the integration steps the baseline needs for the tested integration intervals. The resulting mean global errors are indeed larger than those of the baseline controller, but still very reasonable. Moreover, evaluating MLRK on 1500 harmonic oscillators of class (high-freq) showed a mean loss similar to that of the baseline controller in Fig. 2(c). This suggests that MLRK generalizes to problem instances of this class as well. In Tab. 2 we observe a similar situation as in the previous experiment. The global error of the baseline controller stays approximately the same for different interval lengths, while the global error of MLRK increases very gradually, while using only a fraction of iterations.
159
+
160
+ ![](images/8fb302fef67595b67a0a345f7d0de78e1679bb2d3408dd66a2399a0a042beb83.jpg)
161
+ Figure 2: The mean $L _ { 1 }$ -Lagrangian loss (5) of the approximation $( t _ { n } , y _ { n } )$ in step $n$ over three different test sets. (a) MLRK achieved a smaller mean loss, thus, it generalizes well to new problem instances of the same class of problems (low-freq) it was trained on. (b) MLRK achieves a lower loss on instances with both higher amplitude and frequency than the problem instances used during training. Thus, MLRK is able to generalize to different problems. (c) Even on higher frequencies than the ones in (med-freq), MLRK shows a mean loss similar to that of the baseline controller.
162
+
163
+ ![](images/dd80c719431d50131a556ec6d2b4b11a1c8053da5a7a64a8594621926ae0bcef.jpg)
164
+ Figure 3: The mean local error over the test set of van der Pol ODEs for different methods is shown. The optimizer err was trained with input (7), optimizer partial was trained with input (8) and grad was trained with input (9). Providing local information such as those in input (8) and (9) results in increased responsiveness of the optimizer.
165
+
166
+ van der Pol. "I have a theory that whenever you want to get in trouble with a method, look for the van der Pol equation" – P. Zadunaisky, 1982, $c . f$ . (Hairer et al., 2000).
167
+
168
+ Next we conducted an experiment regarding the local $L _ { 1 }$ loss (6). Experiments with harmonic oscillators revealed the optimizers ability to keep the local errors close to the tolerance parameter $( c . f .$ . appendix). Keeping the local error equal to a constant tolerance is not a hard problem for simple harmonic oscillators, therefore we turned towards van der Pol oscillators. We considered the following dataset of van der Pol oscillators of class $\mathbf { v d P } ( 0 , 1 )$ : The training set contained 50,000 instances, the validation set and the test set each 1,500 instances. The local errors of van der Pol oscillators vary drastically $\cdot c . f$ . Fig. 5, appendix). High spikes occur when the solution changes from being driven to being damped. As the behavior of van der Pol equations are more complex compared to harmonic oscillators, we expect that providing additional information about the problem such as partial derivatives or function values of $g$ can be beneficial. To investigate this, we considered MLRK with different inputs. One optimizer is only provided with the error estimate Eq. (7), another is provided with the error estimate and all partial derivatives Eq. (8) and the last is provided with the error estimate and the function evaluations that were computed during the Runge-Kutta step, Eq. (9).
169
+
170
+ The results are summarized in Fig. 3. Using err shows reoccurring high spikes similar to the baseline, although the spikes of the optimizer are lower on average. In contrast, MLRK with additional information on the partial derivatives (partial) shows a much smoother sequence of local errors. This demonstrates that the additional information in the partial derivatives of $g$ improves the ability of MLRK to anticipate the variations of the local errors and respond with adequate step sizes. MLRK with error estimates as well as function values of $g$ (grad) produces a smooth step size sequence similar to the optimizer partial. This shows that the optimizer with additional input-information from $g$ are actually outperforming the baseline. The reoccurring spikes in the local error seem to decrease in amplitude with time. This is largely due to an averaging effect – for different values of $\sigma$ these spikes occur at different integration steps. All three methods reveal a reduction in both the mean number of steps and the mean local errors, $c . f$ . Tab. 3, appendix.
171
+
172
+ ![](images/688744afe207389f2cea3441a67d96af19f602953a92c3e17d919be6f72ee02f.jpg)
173
+ Figure 4: The mean local error over the test set of double pendulums for different methods is shown. The optimizer err was trained with input (7), optimizer partial was trained with input (8) and grad was trained with input (9). In all three cases MLRK is able to reduce the spikes in the local errors drastically, the use of local information reduces the variance of the local errors even further.
174
+
175
+ Double Pendulum. To demonstrate the benefit of MLRK in an application we conducted experiments with double pendulum ODEs $_ { c , f }$ . appendix). The chaotic behaviour of the double pendulum leads to sudden spikes in the local error, a particularly challenging problem for step size controllers. To investigate the ability of MLRK to avoid these spikes by adjusting the step size appropriately, we consider the $L _ { 1 }$ local loss as in the previous experiment and a dataset of double pendulums of class (pendulum). The training set contained 50,000 instances, the validation set and the test set each 1,500 instances. Again, the different inputs Eqs. (7), (8) and (9) were examined.
176
+
177
+ The results are shown in Fig. 4 and reveal the baseline controllers inability to produce steady local errors. Here, the benefit of a learned update rule over a static one becomes evident. The optimizer err that is only provided with the local error estimates is able to reduce the spikes in the local errors to a remarkable degree. Moreover, local information about the problem allows the optimizers partial and grad to reduce the variance in the local errors even further.
178
+
179
+ # 5 CONCLUSION
180
+
181
+ We have shown how to cast the design Runge-Kutta methods for solving initial value problems as a learning problem. We established appropriate performance measures and useful inputs for the controller, which constitute the key ingredients of the resulting Meta-learning Runge-Kutta (MLRK), which learns step size controllers that are specialized to a particular class of initial value problems. Our experimental results demonstrate that MLRK can indeed learn to design novel Runge-Kutta methods that perform better than a hand-designed Runge-Kutta approach. Furthermore, we observed a remarkable degree of generalization to other classes of initial value problems. More importantly, examining the effect of different inputs demonstrated that the additional information contained in the function values and partial derivatives of $g$ leads to a substantial improvement in performance of the automatically designed solvers.
182
+
183
+ There are several interesting avenues for future work. While MLRK generalizes well to problem instances of the same class and even to problems of similar classes, when confronted with a very different type of problem, MLRK does not generalize well yet. Wichrowska et al. (2017) showed how a carefully chosen network architecture and a diverse training set improves generalization of their optimizer to many different classes of optimization problems. A similar approach may lead to improved generalization of MLRK. Another common aspect of Runge-Kutta is the need for step rejection in case the local error exceeds the tolerance. The problem here is that a single large error can in general not be compensated for, even if subsequent step sizes are chosen very small. In this case, a step is usually rejected and repeated using a smaller step size. Here the challenge is to choose a step size small enough to meet the accuracy requirements but at the same time not too small, since the choice of step size influences the entire step size sequence to come.
184
+
185
+ # REFERENCES
186
+
187
+ Marcin Andrychowicz, Masha Denil, Sergio Gómez Colmenarejo, Matthew W. Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 29, pp. 3981–3989, Barcelona, Spain, December 2016.
188
+
189
+ Fischer Black and Myron Scholes. The pricing of options and corporate liabilities. Journal of Political Economy, 81(3):637–654, May–June 1973.
190
+
191
+ John C. Butcher. Numerical Methods for Ordinary Differential Equations. Wiley, Auckland, New Zealand, 2nd edition, 2008.
192
+
193
+ Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David K. Duvenaud. Neural ordinary differential equations. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 31, pp. 6571–6583, Montreal, Canada, December 2018.
194
+
195
+ Yutian Chen, Matthew W. Hoffman, Sergio Gómez Colmenarejo, Misha Denil, Timothy P. Lillicrap, Matt Botvinick, and Nando de Freitas. Learning to learn without gradient descent by gradient descent. In Proceedings of the 34th International Conference on Machine Learning, pp. 748–756, Sydney, Australia, August 2017.
196
+
197
+ Peter Deuflhard. Differential equations in technology and medicine. Computational concepts, adaptive algorithms, and virtual labs. In V. Capasso, H.W. Engl, and J. Periaux (eds.), Computational Mathematics Driven by Industrial Applications, volume 1739 of Lecture Notes in Mathematics, pp. 69–125. Springer, Berlin, Heidelberg, Germany, 2000.
198
+
199
+ Weinan E and Bing Yu. The deep Ritz method: A deep learning-basen numerical algorithm for solving variational problems. Communications in Mathematics and Statistics, 6(1):1–12, March 2018.
200
+
201
+ Mojgan Esna-Ashari, Maryam Zekri, Masood Askari, and Noushin Khalili. Predictive control of the blood glucose level in type I diabetic patient using delay differential equation Wang model. Journal of Medical Signals and Sensors, 7(1):8–20, January–March 2017.
202
+
203
+ Kjell Gustafsson. Control-theoretic techniques for stepsize selection in implicit Runge-Kutta methods. ACM Transactions on Mathematical Software, 20(4):496–517, December 1994.
204
+
205
+ Kjell Gustafsson, Michael Lundh, and Gustaf Söderlind. API stepsize control for the numerical solution of ordinary differential equations. BIT Numerical Mathematics, 28(2):270–287, June 1988.
206
+
207
+ Ernst Hairer and Gerhard Wanner. Solving Ordinary Differential Equations II – Stiff and DifferentialAlgebraic Problems, volume 14 of Springer Series in Computational Mathematics. Springer, Berlin, Heidelberg, Germany, 2nd edition, 2002.
208
+
209
+ Ernst Hairer, Syvert P. Nørsett, and Gerhard Wanner. Solving Ordinary Differential Equations I – Nonstiff Problems, volume 8 of Springer Series in Computational Mathematics. Springer, Berlin, Heidelberg, Germany, 2nd edition, 2000.
210
+
211
+ Jiequn Han, Arnulf Jentzen, and Weinan E. Solving high-dimensional partial differential equations using deep learning. Proceedings of the National Academy of Sciences, 115(34):8505–8510, August 2018.
212
+
213
+ Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural Networks, 4(2): 251–257, 1991.
214
+
215
+ Mihai Ilea, Marius Turnea, and Mariana D. Rotariu. Differential equations with applications in cancer diseases. Medical-Surgical Journal of the Society of Physicians and Naturalists Iasi, 117 (2):572–577, April–June 2013.
216
+
217
+ Isaac E. Lagaris, Aristidis Likas, and Dimitrios I. Fotiadis. Artificial neural networks for solving ordinary and partial differential equations. IEEE Transactions on Neural Networks, 9(5):987–1000, September 1998.
218
+
219
+ Alfred J. Lotka. Elements of physical biology. Nature, 116(2917), September 1925.
220
+
221
+ Qazi Ibadur Rahman and Gerhard Schmeisser. Analytic Theory of Polynomials. Number 26 in London Mathematical Society Monographs. Oxford University Press, Oxford, UK, 2002.
222
+
223
+ David E. Rumelhart, Geoffrey E. Hinton, and Ronald J. Williams. Learning representations by back-propagating errors. Nature, 323(6088):533–536, 1986.
224
+
225
+ Gudrun Scholz and Fritz Scholz. First-order differential equations in chemistry. ChemTexts, 1(1), November 2014.
226
+
227
+ Patrick Schramowski, Christian Bauckhage, and Kristian Kersting. Neural conditional gradients. arXiv:1803.04300, March 2018.
228
+
229
+ Justin Sirignano and Konstantinos Spiliopoulos. DGM: A deep learning algorithm for solving partial differential equations. Journal of Computational Physics, 375:1339–1364, December 2018.
230
+
231
+ Gustaf Söderlind. Automatic control and adaptive time-stepping. Numerical Algorithms, 31(1): 281–310, December 2002.
232
+
233
+ Gustaf Söderlind. Time-step selection algorithms: Adaptivity, control, and signal processing. Applied Numerical Mathematics, 56(3–4):488–502, March–April 2006.
234
+
235
+ Vito Volterra. Variazioni e fluttuazioni del numero d’individui in specie animali conviventi. Memoria della Reale Accademia Nazionale dei Lincei, 2:31–113, 1926.
236
+
237
+ Olga Wichrowska, Niru Maheswaranathan, Matthew W. Hoffman, Sergio Gómez Colmenarejo, Misha Denil, Nando de Freitas, and Jascha Sohl-Dickstein. Learned optimizers that scale and generalize. In Proceedings of the 34th International Conference on Machine Learning, pp. 3751–3760, Sydney, Australia, August 2017.
238
+
239
+ # A APPENDIX
240
+
241
+ RUNGE-KUTTA METHODS
242
+
243
+ The mathematical theory of Runge-Kutta methods is quite evolved. We will only recap a few basics here, for further details see for example (Butcher, 2008; Hairer et al., 2000; Hairer & Wanner, 2002).
244
+
245
+ Definition A.1. Let $s \in \mathbb { N }$ , $a _ { i j } \in \mathbb { R }$ for $i , j \in \{ 1 , \ldots , s \}$ , $c _ { i } \in \mathbb { R }$ for $i \in \{ 1 , \ldots , s \}$ and $b _ { i } \in \mathbb { R }$ for $i \in \{ 1 , \ldots , s \}$ . Let $\boldsymbol { g } : \mathbb { R } \times \mathbb { R } ^ { m } \to \mathbb { R } ^ { m }$ be a function that describes an initial value problem. The method defined by
246
+
247
+ $$
248
+ \begin{array} { c } { { y _ { n + 1 } = y _ { n } + h \displaystyle \sum _ { i = 1 } ^ { s } b _ { i } k _ { i } \nonumber , } } \\ { { { } } } \\ { { k _ { i } = g ( t _ { n } + h c _ { i } , y _ { n } + h \displaystyle \sum _ { j = 1 } ^ { s } a _ { i j } k _ { j } ) \nonumber , } } \end{array}
249
+ $$
250
+
251
+ for step size $h$ is called an $s$ -stage Runge-Kutta method. If $a _ { i j } = 0$ for $i \leq j$ , the method is called explicit, otherwise it is called implicit.
252
+
253
+ Definition A.2. A Runge-Kutta method is of order $p$ if for sufficiently smooth initial value problems
254
+
255
+ $$
256
+ \| y ( t _ { 0 } + h ) - y _ { 1 } \| \leq K h ^ { p + 1 }
257
+ $$
258
+
259
+ holds.
260
+
261
+ Note that a higher order method yields more accurate results, consequently a high order is a desired characteristic of a Runge-Kutta method. However, higher orders can only be achieved by the use of more stages. For an $s \mathrm { . }$ -stage Runge-Kutta method the order $p$ is bounded by the number of stages, $p \leq s$ . Up to order 4 there exist methods with $p = s$ , for order 5 and higher $p$ is strictly smaller than $s , c . f$ . (Butcher, 2008, Theorem 324B). The order of an $s$ -stage Runge-Kutta method depends on the coefficients $a _ { i j }$ , $b _ { i }$ , $c _ { i }$ . Order conditions for these coefficients have been developed, which ensure a certain order of the method.
262
+
263
+ The problem of step size control can be described in the following way: Based on some input values, e.g. $t _ { n } , y _ { n } , \mathbf { e r r } _ { n }$ and possibly additional characteristics of $g$ , we must choose a step size $h _ { n }$ ,which is then used to evaluate $g$ at $p$ different points. These points are determined by $h _ { n }$ , see Definition A.1. The resulting stages in Eq. (15) are then used to compute the approximation $y _ { n + 1 }$ of $y ( t _ { n } + h _ { n } )$ , $c . f$ . Eq. (14). The problem is to choose $h _ { n }$ in a way such that the approximation $y _ { n + 1 }$ fulfills some desired properties. For example we may require that the local error of $y _ { n + 1 }$ is close to some tolerance parameter. In fact, this is the standard objective of most common step size controllers.
264
+
265
+ # ERROR ESTIMATION
266
+
267
+ The local errors are of particular importance for step size control and can fortunately be estimated very efficiently. To that end, we take a look at a simple idea as described in (Butcher, 2008, p. 198): Suppose we have two approximations for $y ( t _ { n } )$ of order $\hat { p }$ and $\tilde { p }$ respectively, that is
268
+
269
+ $$
270
+ \begin{array} { r } { \hat { y } _ { n } = y ( t _ { n } ) + \mathcal { O } ( h ^ { \hat { p } + 1 } ) , } \\ { \tilde { y } _ { n } = y ( t _ { n } ) + \mathcal { O } ( h ^ { \hat { p } + 1 } ) , } \end{array}
271
+ $$
272
+
273
+ where $y ( t )$ is the solution of
274
+
275
+ $$
276
+ y ^ { \prime } ( t ) = g ( t , y ( t ) ) , \quad y ( t _ { n - 1 } ) = y _ { n - 1 } ,
277
+ $$
278
+
279
+ and the step size $h$ that was used to obtain both approximations is given by
280
+
281
+ $$
282
+ h = t _ { n } - t _ { n - 1 } .
283
+ $$
284
+
285
+ If $\hat { p } > \tilde { p }$
286
+
287
+ $$
288
+ \hat { y } _ { n } - \tilde { y } _ { n } = y ( t _ { n } ) - \tilde { y } _ { n } + \mathcal { O } ( h ^ { \tilde { p } + 2 } )
289
+ $$
290
+
291
+ can be used as an approximation for the local truncation error of the $\tilde { p }$ -th order Runge-Kutta method:
292
+
293
+ $$
294
+ \mathrm { e r r } _ { n } ( h ) \approx \| \hat { y } _ { n } - \tilde { y } _ { n } \| .
295
+ $$
296
+
297
+ To obtain error estimates each step has to be carried out with two methods of different orders. Here, the easiest approach is to use two separate Runge-Kutta methods to compute $\hat { y }$ and $\tilde { y }$ , however this is quite costly, especially for implicit methods. A more efficient approach to obtain error estimates are the embedded Runge-Kutta methods. Here both approximation use the same stages $k _ { i }$ in Eq. (15) but two different pairs of coefficients $b _ { i }$ , $\hat { b } _ { i }$ in Eq. (14). By doing so, the stages can be reused and an error estimate can be obtained with a cheap extra linear combination of the $k _ { i }$ ’s. We denote the error estimates by
298
+
299
+ $$
300
+ \mathrm { e r r } _ { n } = \| \hat { y } _ { n } - \tilde { y } _ { n } \| .
301
+ $$
302
+
303
+ # CLASSES OF INITIAL VALUE PROBLEMS
304
+
305
+ For loss functions such as the one in Eq. (5) it is useful to consider initial value problems with known solutions so that we can compare the numerical approximation to the true function values of the solution. For this reason we considere simple harmonic oscillators and linear differential equations with constant coefficients. If we employ loss functions as Eq. (6), local rather than global errors are of interest. For these loss functions it is interesting to consider initial value problems for which the local errors vary drastically during the integration such as van der Pol oscillators.
306
+
307
+ # SIMPLE HARMONIC OSCILLATOR
308
+
309
+ A simple harmonic oscillator is a harmonic oscillator that is neither driven nor damped and can be characterized by
310
+
311
+ $$
312
+ m x ^ { \prime \prime } ( t ) = - k x ( t ) ,
313
+ $$
314
+
315
+ where $m$ is the mass of the oscillator, $x$ the position and $k$ describes the restoring force that is applied, when displaced from its equilibrium position. It can be transformed to
316
+
317
+ $$
318
+ \begin{array} { l } { { \displaystyle y _ { 1 } ^ { \prime } ( t ) = y _ { 2 } ( t ) \ : , } } \\ { { \displaystyle y _ { 2 } ^ { \prime } ( t ) = - \frac { m } { k } y _ { 1 } ( t ) \ : . } } \end{array}
319
+ $$
320
+
321
+ The initial values provide the initial position $x ( t _ { 0 } )$ of $x$ and the initial velocity $x ^ { \prime } ( t _ { 0 } )$
322
+
323
+ $$
324
+ \begin{array} { l } { { y _ { 1 } ( t _ { 0 } ) = x ( t _ { 0 } ) , } } \\ { { y _ { 2 } ( t _ { 0 } ) = x ^ { \prime } ( t _ { 0 } ) . } } \end{array}
325
+ $$
326
+
327
+ The solution of the simple harmonic oscillator takes the form
328
+
329
+ $$
330
+ x ( t ) = A \cos ( \omega t + \varphi ) , \quad \omega = \sqrt { \frac { m } { k } } ,
331
+ $$
332
+
333
+ where $A$ and $\varphi$ are uniquely determined by the initial values. The frequency of the oscillations is determined by $\omega$ , $A$ is the magnitude of the oscillations and $\varphi$ is a phase-shift.
334
+
335
+ A class of this kind of initial value problvalues or alternatively a distribution over , n beand escribed by a distribution over . The following classes of initia $\frac { m } { k }$ and the initialalue problems $A$ $\omega$ $\varphi$
336
+ were used in the experiments
337
+
338
+ $$
339
+ \begin{array} { l c r } { { A \sim U ( 0 , 5 ) , } } \\ { { A \sim U ( 0 , 5 ) , } } \\ { { A \sim U ( 0 , 1 ) , } } \\ { { A \sim U ( 1 , 5 ) , } } \end{array}
340
+ $$
341
+
342
+ $$
343
+ \begin{array} { r l r } & { } & { \omega \sim U ( 0 , 1 0 ) , \quad \varphi \sim U ( 0 , 1 ) , } \\ & { } & { \omega \sim U ( 0 , 2 0 ) , \quad \varphi \sim U ( 0 , 1 ) , } \\ & { } & { \omega \sim U ( 0 , 1 ) , \quad \varphi \sim U ( 0 , 1 ) , } \\ & { } & { \omega \sim U ( 1 , 5 ) , \quad \varphi \sim U ( 0 , 1 ) , } \end{array}
344
+ $$
345
+
346
+ where $U ( a , b )$ denotes the uniform distribution over the interval $[ a , b ]$ .
347
+
348
+ # LINEAR CONSTANT COEFFICIENT
349
+
350
+ A linear differential equation with constant coefficients can be described by
351
+
352
+ $$
353
+ y ^ { \prime } ( t ) = A y ( t ) , \qquad y ( t _ { 0 } ) = y _ { 0 } ,
354
+ $$
355
+
356
+ where $A \in \mathbb { R } ^ { m \times m }$ . The solution of this differential equation is known and can be expressed in terms of the eigenvalues $\lambda _ { 1 } , \ldots , \lambda _ { m }$ with corresponding eigenvectors $v _ { 1 } , \ldots , v _ { m }$ of the matrix $A$ :
357
+
358
+ $$
359
+ y ( t ) = \sum _ { j = 1 } ^ { m } c _ { j } e ^ { \lambda _ { j } t } v _ { j } ,
360
+ $$
361
+
362
+ with coefficients $c _ { j } \in \mathbb { R }$ that are uniquely determined by the initial values $y ( t _ { 0 } ) = y _ { 0 }$ . The initial value problem is stable, if $\mathrm { R e } ( \lambda _ { j } ) < 0$ for all $j \in \{ 1 , \dots , m \}$ and unstable if $\operatorname { R e } ( \lambda _ { j } ) > 0$ for some $j ~ \in ~ \{ 1 , \dots , m \}$ . The oscillatory behavior of the problem is determined by $\mathrm { I m } ( \lambda _ { j } )$ . Note that the simple harmonic oscillators are linear differential equations with constant coefficients, where $A \in \mathbb { R } ^ { 2 \times 2 }$ , $\mathbf { R e } ( \lambda _ { j } ) = 0$ for $j \in \{ 1 , 2 \}$ and $\begin{array} { r } { \mathrm { I m } ( \lambda _ { 1 } ) = - \mathrm { I m } ( \lambda _ { 2 } ) = \sqrt { \frac { m } { k } } i } \end{array}$ .
363
+
364
+ For the experiments we used differential equations with $A \in \mathbb { R } ^ { 3 \times 3 }$ . The matrix $A$ either has three real eigenvalues $\lambda _ { 1 } , \lambda _ { 2 } , \lambda _ { 3 } \ \in \ \mathbb { R }$ or one real eigenvalue $\lambda _ { 1 } \in \mathbb { R }$ and two complex eigenvalues $\lambda _ { 2 } = a + b i , \lambda _ { 3 } = a - b i$ , with $a , b \in \mathbb { R }$ . In this case we choose $c _ { 2 } = c _ { 3 }$ to obtain a real solution. We can specify a class of linear constant coefficient differential equations by a distribution on the eigenvalues of $A$ and the coefficients $c _ { j }$ . The classes that were used for the experiments were described by the distributions
365
+
366
+ $$
367
+ \begin{array} { l } { \lambda _ { 1 } \sim U ( - 2 . 5 , - 0 . 1 ) , } \\ { \lambda _ { 1 } \sim U ( 0 , 1 ) , } \\ { \lambda _ { 1 } \sim U ( - 1 , 0 ) , } \end{array}
368
+ $$
369
+
370
+ $$
371
+ \begin{array} { r } { a \sim U ( - 2 . 5 , - 0 . 1 ) , ~ b \sim U ( 0 , 5 ) , } \\ { a \sim U ( - 2 . 5 , - 0 . 1 ) , ~ b \sim U ( 0 , 5 ) , } \\ { a \sim U ( 0 , 1 ) , ~ b \sim U ( 1 , 2 ) , } \end{array}
372
+ $$
373
+
374
+ where $U ( a , b )$ denotes the uniform distribution on the interval $[ a , b ]$ .
375
+
376
+ ![](images/79a23670bf80941cad59ce436ee56a6428b332fbcee2e05c4ef832814c658452.jpg)
377
+ Figure 5: The upper plot shows the numerically approximated solution $y _ { 1 } ( t )$ of a van der Pol oscillator with $\sigma = 2$ . The lower plot displays the local error estimates for $h \ : = \ : 0 . 1$ . The error estimates show high spikes whenever the solution switches from being driven to being damped.
378
+
379
+ VAN DER POL OSCILLATOR
380
+
381
+ Van der Pol oscillators arise in the study of limit cycles. A van der Pol oscillator can be described by
382
+
383
+ $$
384
+ \begin{array} { l } { { y _ { 1 } ^ { \prime } ( t ) = y _ { 2 } , } } \\ { { y _ { 2 } ^ { \prime } ( t ) = \sigma ( 1 - y _ { 1 } ^ { 2 } ) y _ { 2 } - y _ { 1 } , } } \end{array}
385
+ $$
386
+
387
+ $$
388
+ \begin{array} { r } { y _ { 1 } ( 0 ) = 2 , } \\ { y _ { 2 } ( 0 ) = 0 , } \end{array}
389
+ $$
390
+
391
+ with $\sigma > 0$ . For $\sigma = 2$ an approximate solution is displayed in Figure 5. Small oscillations are amplifies and large oscillations damped, $c . f$ . (Hairer et al., 2000, pp. 111). The local errors of a van der Pol oscillator show high variations. For the experiments we used van der Pol oscillators with the following distributions
392
+
393
+ $$
394
+ \begin{array} { r } { \sigma \sim U ( 0 , 1 ) , } \\ { \sigma \sim U ( 1 , 2 ) . } \end{array}
395
+ $$
396
+
397
+ $$
398
+ \begin{array} { r } { ( \mathrm { v d P } ( 0 , 1 ) ) } \\ { ( \mathrm { v d P } ( 1 , 2 ) ) } \end{array}
399
+ $$
400
+
401
+ # DOUBLE PENDULUM
402
+
403
+ A double pendulum is a pendulum attached to another pendulum, $c . f$ . Fig. 6. The length of the first and second pendulum are given by $L _ { 1 }$ and $L _ { 2 }$ , respectively, their masses by $M _ { 1 }$ and $M _ { 2 }$ and the angle by $\theta _ { 1 }$ and $\theta _ { 2 }$ . The equations of motion for the double pendulum can be written in different forms, we chose the following formulation in terms of the angular acceleration:
404
+
405
+ $$
406
+ \begin{array} { r l } & { { \ddot { \theta } _ { 1 } } = \frac { { M _ { 2 } L _ { 1 } { { \dot { \theta } } _ { 1 } } ^ { 2 } \sin ( { \theta _ { 2 } } - { \theta _ { 1 } } ) \cos ( { \theta _ { 2 } } - { \theta _ { 1 } } ) + { M _ { 2 } } g \sin ( { \theta _ { 2 } } ) \cos ( { \theta _ { 2 } } - { \theta _ { 1 } } ) } } { { L _ { 1 } { { \left( { M _ { 1 } } + { M _ { 2 } } - { M _ { 2 } } \cos ^ { 2 } ( { \theta _ { 2 } } - { \theta _ { 1 } } ) \right) } } } } } \\ & { \qquad + \frac { { M _ { 2 } } { L _ { 2 } { { \dot { \theta } } _ { 2 } } ^ { 2 } \sin ( { \theta _ { 2 } } - { \theta _ { 1 } } ) } - { \left( { M _ { 1 } } + { M _ { 2 } } \right) g \sin ( { \theta _ { 1 } } ) } } { { L _ { 1 } { { \left( { M _ { 1 } } + { M _ { 2 } } - { M _ { 2 } } \cos ^ { 2 } ( { \theta _ { 2 } } - { \theta _ { 1 } } ) \right) } } } } } \\ & { { \ddot { \theta } _ { 2 } } = \frac { { \left( { M _ { 1 } } + { M _ { 2 } } \right) \left( g \sin ( { \theta _ { 1 } } ) \cos ( { \theta _ { 2 } } - { \theta _ { 1 } } ) - { L _ { 1 } } { { \dot { \theta } } _ { 1 } } ^ { 2 } \sin ( { \theta _ { 2 } } - { \theta _ { 1 } } ) - g \sin ( { \theta _ { 2 } } ) \right) } } { { L _ { 2 } { { \left( { M _ { 1 } } + { M _ { 2 } } - { M _ { 2 } } \cos ^ { 2 } ( { \theta _ { 2 } } - { \theta _ { 1 } } ) \right) } } } } } \\ & \qquad - \frac { { M _ { 2 } } { L _ { 2 } { \dot { \theta } } _ { 2 } ^ { 2 } \sin ( { \theta _ { 2 } } - { \theta _ { 1 } } ) \cos ( { \theta _ { 2 } } - { \theta _ { 1 } } ) } } { { L _ { 2 } { \left( { M _ { 1 } } + { M _ { 2 } } - { M _ { 2 } } \cos ^ { 2 } ( { \theta _ { 2 } } - { \theta _ { 1 } } ) \right) } } } \end{array}
407
+ $$
408
+
409
+ The initial angular position and velocity $\theta _ { 1 } , \theta _ { 2 } , { \dot { \theta } } _ { 1 } , { \dot { \theta } } _ { 2 }$ determine the trajectory of the double pendulum. For the experiments we used double pendulums with the following distribution
410
+
411
+ $$
412
+ M _ { 1 } \sim U ( 0 . 5 , 1 ) , M _ { 2 } \sim U ( 0 . 5 , 2 ) , L _ { 1 } \sim U ( 0 . 5 , 1 ) , L _ { 2 } \sim U ( 0 . 5 , 1 ) .
413
+ $$
414
+
415
+ # ADDITIONAL EXPERIMENTS
416
+
417
+ ON VAN DER POL
418
+
419
+ Table 3 shows the mean number of steps, local error and wall clock time over 1500 van der Pol equations of class $( \mathrm { v d P } ( 0 , 1 ) )$ .
420
+
421
+ ![](images/389adf363f00be8443851980f8b81d3ec4fabac4dfbec03b85a8403edc9754e9.jpg)
422
+ Figure 6: A double pendulum is one pendulum attached to another pendulum. The masses $M _ { 1 }$ and $M _ { 2 }$ of these pendulums may vary as do the lengths $L _ { 1 }$ and $L _ { 2 }$ . The initial configuration of angular position and velocity determines the trajectory of the double pendulum.
423
+
424
+ HIGH FREQUENCY HARMONIC OSCILLATORS
425
+
426
+ In this experiment, we trained a controller specialized for simple harmonic oscillators of class (high-freq) which were described in Sec. A. Thus we chose the following datasets:
427
+
428
+ Training set: 30000 Harmonic oscillators of class (high-freq). Validation set: 1000 Harmonic oscillators of class (high-freq). Test set: 1000 Harmonic oscillators of class (high-freq).
429
+
430
+ As loss we chose the $L _ { 1 }$ -Lagrangian Eq. (5). As inputs we used only the error estimates, Eq. (7). The loss of the learned controller and the baseline controller, averaged over the test dataset, is shown in Fig. 7(a). Both controllers are used to execute 100 integration steps for each instance of the test dataset. Subsequently, the loss Eq. (5) is computed for each approximation $( t _ { n } , y _ { n } )$ . The solid lines show the mean loss in step $n$ , the colored areas mark the standard deviation. Here, the loss of our learned controller is on average smaller than the loss of the baseline controller, which demonstrates the controllers generalization capability to new problems of the same class.
431
+
432
+ Tab. 4 summaizres the global error at the end of the integration interval and the number of steps needed during the integration for different interval lengths in range 1 to 10. All values are averaged over the test dataset. Here, the baseline controller needs much more steps than the learned controller, but maintains a smaller error. In fact, the error caused by the baseline is approximately the same for all shown interval lengths, while the error caused by the trained model increases with interval length. This is due to the assumption that the global error is the sum of the local errors. In particular, the loss Eq. (5) rates step size sequences with a higher global error better, if they can balance the higher error by achieving a longer integration interval.
433
+
434
+ While the general assumption that the global error increases with the length of the integration interval is often fulfilled, the specific assumption of a linear accumulation of the global error, as in our loss, is usually not fulfilled. This is a good example for why the assumptions leading to the widely used objective to keep the local errors constant are too strong.
435
+
436
+ Table 3: The mean number of steps, local error and wall clock time over 1500 van der Pol equations are shown for different lengths of the integration interval. Our method err is slightly faster and uses less steps than the baseline while producing smaller local errors during the integration, see also Figure 3. While partial and grad reduce the number of steps even further, wall time is increased. However one can clearly see that partial and grad outperform both the baseline and err regarding the local error.
437
+
438
+ <table><tr><td>int</td><td colspan="4">steps</td></tr><tr><td></td><td>baseline</td><td>err</td><td>partial</td><td>grad</td></tr><tr><td>1</td><td>21.59</td><td>16.42</td><td>12.40</td><td>12.09</td></tr><tr><td>3</td><td>33.74</td><td>29.12</td><td>25.16</td><td>24.74</td></tr><tr><td>5</td><td>45.43</td><td>41.07</td><td>36.42</td><td>36.02</td></tr><tr><td>7</td><td>56.84</td><td>52.57</td><td>48.34</td><td>47.97</td></tr><tr><td>10</td><td>73.46</td><td>69.41</td><td>65.40</td><td>65.04</td></tr><tr><td colspan="5"></td></tr><tr><td></td><td>baseline</td><td>err</td><td>partial</td><td>grad</td></tr><tr><td>1</td><td>7.17e-4</td><td>6.58e-4</td><td>4.01e-4</td><td>3.74e-4</td></tr><tr><td>3</td><td>6.40e-4</td><td>5.45e-4</td><td>2.49e-4</td><td>2.28e-4</td></tr><tr><td>5</td><td>5.18e-4</td><td>4.47e-4</td><td>1.95e-4</td><td>1.75e-4</td></tr><tr><td>7</td><td>4.97e-4</td><td>4.16e-4</td><td>1.57e-4</td><td>1.39e-4</td></tr><tr><td>10</td><td>4.59e-4</td><td>3.82e-4</td><td>1.32e-4</td><td>1.18e-4</td></tr><tr><td colspan="5">int</td></tr><tr><td></td><td>baseline</td><td>err</td><td>partial</td><td>grad</td></tr><tr><td>1</td><td>0.0255</td><td>0.0263</td><td>0.0254</td><td>0.0221</td></tr><tr><td>3</td><td>0.0405</td><td>0.0375</td><td>0.0460</td><td>0.0403</td></tr><tr><td>5</td><td>0.0591</td><td>0.0517</td><td>0.0681</td><td>0.0596</td></tr><tr><td>7</td><td>0.0858</td><td>0.0742</td><td>0.1036</td><td>0.0897</td></tr><tr><td>10</td><td>0.0971</td><td>0.0825</td><td>0.1201</td><td>0.1065</td></tr></table>
439
+
440
+ <table><tr><td rowspan="2">interval</td><td colspan="2">steps</td><td colspan="2">error</td></tr><tr><td>Baseline</td><td>Optimizer</td><td>Baseline</td><td>Optimizer</td></tr><tr><td>1</td><td>45.50</td><td>13.73</td><td>0.023092</td><td>0.030499</td></tr><tr><td>3</td><td>152.11</td><td>43.12</td><td>0.022266</td><td>0.040429</td></tr><tr><td>5</td><td>258.73</td><td>74.40</td><td>0.022731</td><td>0.049529</td></tr><tr><td>7</td><td>365.30</td><td>106.31</td><td>0.022011</td><td>0.055821</td></tr><tr><td>10</td><td>525.18</td><td>154.25</td><td>0.023353</td><td>0.070451</td></tr></table>
441
+
442
+ Table 4: The mean values over the test set consisting of 1000 harmonic oscillators of class (high-freq) are shown. While the baseline needs much more steps than our trained model, it achieves a smaller global error. The global error of the baseline stays approximately the same for all integration intervals.
443
+
444
+ It is also interesting to evaluate the learned controller on other classes of initial value problems. Fig. 7(b) shows the mean loss of the learned controller and the baseline controller over a test set consisting of 1500 harmonic oscillators of class (higher-freq). This class contains oscillators of class (high-freq) but also includes higher frequency ones. The learned controller has a lower mean loss than the baseline controller which indicates that it is able to transfer knowledge from problems of class (high-freq) to problems of class (higher-freq).
445
+
446
+ When we compare the number of steps and the global error at the end of the integration interval, see Tab. 5, we can observe a similar situation as in Tab. 4. The learned controller needs less steps than the baseline controller. The global error however stays approximately the same for the baseline controller while it increases with interval length for the learned controller.
447
+
448
+ ![](images/01b9a89d3e853d783345b125cbc781f04029af741c31aa8bb58f7fd6ebed9798.jpg)
449
+ Figure 7: The red and blue line show the mean loss Eq. (5) of the approximation $( t _ { n } , y _ { n } )$ in step $n$ over the test set. The red and blue area indicate the standard deviation. (a) The learned model LSTM attains a smaller mean loss on new instances of the same class of problems (high-freq) it was trained on, this is especially pronounced in the steps $n \geq 5$ . (b) The test set consists of 1500 harmonic oscillators of class (higher-freq), which means that it also contains higher frequency oscillators. The mean loss of our learned controller is lower than the mean loss of the baseline controller which indicates that our method generalizes to these different problem instances.
450
+
451
+ <table><tr><td rowspan="2">interval</td><td colspan="2">steps</td><td colspan="2">error</td></tr><tr><td>Baseline</td><td>Optimizer</td><td>Baseline</td><td>Optimizer</td></tr><tr><td>1</td><td>116.76</td><td>22.26</td><td>0.453698</td><td>0.511174</td></tr><tr><td>3</td><td>386.40</td><td>75.64</td><td>0.442521</td><td>0.620779</td></tr><tr><td>5</td><td>656.06</td><td>141.29</td><td>0.426773</td><td>0.770457</td></tr><tr><td>7</td><td>925.80</td><td>212.19</td><td>0.418467</td><td>0.925463</td></tr><tr><td>10</td><td>1330.31</td><td>319.85</td><td>0.413902</td><td>1.427778</td></tr></table>
452
+
453
+ Table 5: The mean number of steps and the mean global error at the end of the integration interval was computed over a test set of 1500 harmonic oscillators of class (higher-freq). While the baseline controller needs much more steps than our learned controller, it has on average a lower global error, which stays approximately the same for different interval lengths.
454
+
455
+ # HARMONIC OSCILLATOR
456
+
457
+ We learn a controller optimized for simple harmonic oscillators. We choose the following data sets:
458
+
459
+ Training set: 30000 Harmonic oscillators of class (low-freq).
460
+ Validation set: 1500 Harmonic oscillators of class (low-freq). Test set: 1500 Harmonic oscillators of class (low-freq).
461
+
462
+ First, we evaluate our method on a test set consisting of the same class of initial value problems the controller was trained on. Figure 8(a) shows the mean local error of the learned controller and the baseline on this test set. Both controllers are capable to keep the local errors close to the tolerance. Our method is slightly closer to the tolerance. Next, we evaluate our learned controller on different test sets. When we test the learned controller on harmonic oscillators with higher frequencies and higher amplitude, we find that our method generalizes to these problem instances as well. In fact, both the learned and the baseline controller are able to keep the local errors close to the tolerance as displayed in Figure 8(b). Similar results were found for harmonic oscillators of the class (med-freq). Hence, our learned controller is able to transfer knowledge from oscillators with low frequencies to oscillators with higher frequencies.
463
+
464
+ ![](images/00d42f6fa8372bdd03d979a357f4f6350723ca77bad35f127146478f9ec4a7ad.jpg)
465
+ Figure 8: The mean local error of our learned controller and the baseline controller is shown. (a) Testing on 1500 harmonic oscillators of class (low-freq) shows that both the baseline and the learned controller are able to keep the local errors close to the tolerance. The mean local error of the learned controller is slightly closer to the tolerance. (b) For a test set consisting of 1500 harmonic oscillators of class (high-freq) the two controllers show a similar performance, both are able to keep the local error close to the tolerance. Testing the controllers on problem instances of class (med-freq) yields a similar results.
466
+
467
+ ![](images/81a12dc6aeb497fca2e990f721a990764c5b28cd677f2e2a0cbf3dba85bf4373.jpg)
468
+ Figure 9: The mean local error over different test sets is shown. (a) The test set consists of 1500 linear differential equations with constant coefficients of class (osc-increasing). For these problem instances the learned controller demonstrates its ability to keep the mean local error close to the tolerance. In fact, the local errors of our controller appear to be closer to the tolerance than the local errors of the baseline for some part of the integration. (b) Testing our controller on a set of 1500 van der Pol oscillators of type $( \mathrm { v d P } ( 0 , 1 ) )$ ) reveals a similar performance to that of the baseline controller. Both controllers show high spikes in the local errors. These occur whenever the solution changes from being driven to being damped, see Figure 5.
469
+
470
+ We also want to evaluate the generalization capability of our method to problem instances of different classes of initial value problems. Our method shows an acceptable performance on linear differential equations with constant coefficients of the class (osc-increasing), see Figure 9(a). Here, the performance of our controller is similar to the baseline controller. The learned controller obtains local errors which are closer to the tolerance in some steps. Figure 9(b) shows a similar performance of our controller to the baseline controller on van der Pol oscillators. Both methods show high spikes in the local errors. These occur whenever the solution of a van der Pol oscillator changes from being driven to being damped as demonstrated in Figure 5. Our controller does not react quickly to the sudden changes in the local error of van der Pol equations. This behavior is very different from harmonic oscillators, thus generalization can not be expected.
md/train/rkezdaEtvH/rkezdaEtvH.md ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HYPERBOLIC DISCOUNTING AND LEARNING OVER MULTIPLE HORIZONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Reinforcement learning (RL) typically defines a discount factor $( \gamma )$ as part of the Markov Decision Process. The discount factor values future rewards by an exponential scheme that leads to theoretical convergence guarantees of the Bellman equation. However, evidence from psychology, economics and neuroscience suggests that humans and animals instead have hyperbolic time-preferences $\displaystyle \cdot \frac { 1 } { 1 + k t }$ for $k > 0$ ). Here we extend earlier work of Kurth-Nelson and Redish and propose an efficient deep reinforcement learning agent that acts via hyperbolic discounting and other non-exponential discount mechanisms. We demonstrate that a simple approach approximates hyperbolic discount functions while still using familiar temporal-difference learning techniques in RL. Additionally, and independent of hyperbolic discounting, we make a surprising discovery that simultaneously learning value functions over multiple time-horizons is an effective auxiliary task which often improves over state-of-the-art methods.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The standard treatment of the reinforcement learning (RL) problem is the Markov Decision Process (MDP) which includes a discount factor $0 \leq \gamma \leq 1$ that exponentially reduces the present value of future rewards (Bellman, 1957; Sutton & Barto, 1998). A reward $r _ { t }$ received in $t$ -time steps is devalued to $\gamma ^ { t } r _ { t }$ , a discounted utility model introduced by Samuelson (1937). This establishes a timepreference for rewards realized sooner rather than later. The decision to exponentially discount future rewards by $\gamma$ leads to value functions that satisfy theoretical convergence properties (Bertsekas, 1995). The magnitude of $\gamma$ also plays a role in stabilizing learning dynamics of RL algorithms (Prokhorov & Wunsch, 1997; Bertsekas $\&$ Tsitsiklis, 1996) and has recently been treated as a hyperparameter of the optimization (OpenAI, 2018; Xu et al., 2018).
12
+
13
+ However, both the magnitude and the functional form of this discounting function establish priors over the solutions learned. The magnitude of $\gamma$ chosen establishes an effective horizon for the agent of $1 / ( 1 - \gamma )$ , far beyond which rewards are neglected (Kearns & Singh, 2002). This effectively imposes a time-scale of the environment, which may not be accurate. Further, the exponential discounting of future rewards is consistent with a prior belief that there is a known constant per-time-step hazard rate (Sozou, 1998) or probability of dying of $1 - \gamma$ (Lattimore & Hutter, 2011).
14
+
15
+ Additionally, discounting future values exponentially and according to a single discount factor $\gamma$ does not harmonize with the measured value preferences in humans1 and animals (Mazur, 1985; 1997; Ainslie, 1992; Green & Myerson, 2004; Maia, 2009). A wealth of empirical evidence has been amassed that humans, monkeys, rats and pigeons instead discount future returns hyperbolically, where $\begin{array} { r } { d _ { k } ( t ) = \frac { 1 } { 1 + k t } } \end{array}$ , for some positive $k > 0$ (Ainslie, 1975; 1992; Mazur, 1985; 1997; Frederick et al., 2002; Green et al., 1981; Green & Myerson, 2004).
16
+
17
+ This discrepancy between the time-preferences of animals from the exponential discounted measure of value might be presumed irrational. But Sozou (1998) showed that hyperbolic time-preferences is mathematically consistent with the agent maintaining some uncertainty over the prior belief of the hazard rate in the environment. Hazard rate $h ( t )$ measures the per-time-step risk the agent incurs as it acts in the environment due to a potential early death. Precisely, if $s ( t )$ is the probability that the agent is alive at time a fixed, but potential $t$ then the hazard rate is y unknown hazard rate $\begin{array} { r } { h ( t ) = - \frac { d } { d t } \mathrm { l n } s ( t ) } \end{array}$ . We consider the case where the prior belief of the hazard rate $h ( t ) = \lambda \geq 0$ $p ( \lambda )$ implies a specific discount function Sozou (1998). Under this formalism, the canonical case in RL of discounting future rewards according to $\ b { d } ( t ) = \ b { \gamma } ^ { t }$ is consistent with the belief that there exists a single hazard rate $\lambda = e ^ { - \gamma }$ known with certainty. Further details are available in Appendix A.
18
+
19
+ Common RL environments are also characterized by risk, but often in a narrower sense. In deterministic environments like the original Arcade Learning Environment (ALE) (Bellemare et al., 2013) stochasticity is often introduced through techniques like no-ops (Mnih et al., 2015) and sticky actions (Machado et al., 2018) where the action execution is noisy. Physics simulators may have noise and the randomness of the policy itself induces risk. But even with these stochastic injections the risk to reward emerges in a more restricted sense. In Section 2 we show that a prior distribution reflecting the uncertainty over the hazard rate, has an associated discount function in the sense that an MDP with either this hazard distribution or the discount function, has the same value function for all policies. This equivalence implies that learning policies with a discount function can be interpreted as making them robust to the associated hazard distribution. Thus, discounting serves as a tool to ensure that policies deployed in the real world perform well even under risks they were not trained under.
20
+
21
+ ![](images/84ead8515854eca931ebe7f6dd6bcf4927b892c16484510abaa547fb86c4d542.jpg)
22
+ Figure 1: Hyperbolic versus exponential discounting. Humans and animals often exhibit hyperbolic discounts (blue curve) which have shallower discount declines for large horizons. In contrast, RL agents often optimize exponential discounts (orange curve) which drop at a constant rate regardless of how distant the return.
23
+
24
+ We propose an algorithm that approximates hyperbolic discounting while building on successful Qlearning (Watkins & Dayan, 1992) tools and their associated theoretical guarantees. We show learning many Q-values, each discounting exponentially with a different discount factor $\gamma$ , can be aggregated to approximate hyperbolic (and other non-exponential) discount factors. We demonstrate the efficacy of our approximation scheme in our proposed Pathworld environment which is characterized both by an uncertain per-time-step risk to the agent. Conceptually, Pathworld emulates a foraging environment where an agent must balance easily realizable, small meals versus more distant, fruitful meals. We then consider higher-dimensional deep RL agents in the ALE, where we measure the benefits of hyperbolic discounting. This approximation mirrors the work of Kurth-Nelson & Redish (2009); Redish & Kurth-Nelson (2010) which empirically demonstrates that modeling a finite set of $\mu$ Agents simultaneously can approximate hyperbolic discounting function. Our method then generalizes to other non-hyperbolic discount functions and uses deep neural networks to model the different Q-values from a shared representation.
25
+
26
+ Surprisingly and in addition to enabling new non-exponential discounting schemes, we observe that learning a set of Q-values is beneficial as an auxiliary task (Jaderberg et al., 2016). Adding this multi-horizon auxiliary task often improves over a state-of-the-art baseline, Rainbow (Hessel et al., 2018) in the ALE (Bellemare et al., 2013). This work questions the RL paradigm of learning policies through a single discount function which exponentially discounts future rewards through the following contributions:
27
+
28
+ 1. Hazardous MDPs. We formulate MDPs with hazard present and demonstrate an equivalence between undiscounted values learned under hazards and (potentially nonexponentially) discounted values without hazard.
29
+ 2. Hyperbolic (and other non-exponential)-agent. A practical approach for training an agent which discounts future rewards by a hyperbolic (or other non-exponential) discount function and acts according to this.
30
+ 3. Multi-horizon auxiliary task. A demonstration of multi-horizon learning over many $\gamma$ simultaneously as an effective auxiliary task.
31
+
32
+ # 2 HAZARD IN MDPS
33
+
34
+ To study MDPs with hazard distributions and general discount functions we introduce two modifications. The hazardous MDP now is defined by the tuple $< S , { \mathcal { A } } , R , P , { \mathcal { H } } , d >$ . In standard form, the state space $s$ and the action space $\mathcal { A }$ may be discrete or continuous. The learner observes samples from the environment transition probability $\textstyle P ( s _ { t + 1 } | s _ { t } , a _ { t } )$ for going from $s _ { t } \in S$ to $s _ { t + 1 } \in S$ given $a _ { t } \in \mathcal A$ . We will consider the case where $P$ is a sub-stochastic transition function, which defines an episodic MDP. The environment emits a bounded reward $r : \mathcal { S } \times \mathcal { A } [ r _ { m i n } , r _ { m a x } ]$ on each transition. In this work we consider non-infinite episodic MDPs.
35
+
36
+ The first difference is that at the beginning of each episode, a hazard $\lambda \in [ 0 , \infty )$ is sampled from the hazard distribution $\mathcal { H }$ . This is equivalent to sampling a continuing probability $\gamma = e ^ { - \bar { \lambda } }$ . During the episode, the hazard modified transition function will be $P _ { \lambda }$ , in that $\bar { P } _ { \lambda } ( s ^ { \prime } | s , \bar { a } ) = e ^ { - \lambda } P ( s ^ { \prime } | s , \bar { a } )$ . The second difference is that we now consider a general discount function $d ( t )$ . This differs from the standard approach of exponential discounting in RL with $\gamma$ according to $\dot { d } ( t ) = \gamma ^ { t }$ , which is a special case. This setting makes a close connection to partially observable Markov Decision Process (POMDP) (Kaelbling et al., 1998) where one might consider $\lambda$ as an unobserved variable. However, the classic POMDP definition contains an explicit discount function $\gamma$ as part of its definition which does not appear here.
37
+
38
+ A policy $\pi : { \mathcal { S } } A$ is a mapping from states to actions. The state action value function $Q _ { \pi } ^ { \mathcal { H } , d } ( s , a )$ is the expected discounted rewards after taking action $a$ in state $s$ and then following policy $\pi$ until termination.
39
+
40
+ $$
41
+ Q _ { \pi } ^ { \mathcal { H } , d } ( s , a ) = \mathbb { E } _ { \lambda } \mathbb { E } _ { \pi , P _ { \lambda } } \left[ \sum _ { t = 0 } ^ { \infty } d ( t ) R ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \right]
42
+ $$
43
+
44
+ where $\lambda \sim \mathcal { H }$ and $\mathbb { E } _ { \pi , P _ { \lambda } }$ implies that $s _ { t + 1 } \sim P _ { \lambda } ( \cdot | s _ { t } , a _ { t } )$ and $a _ { t } \sim \pi ( \cdot | s _ { t } )$ .
45
+
46
+ # 2.1 EQUIVALENCE BETWEEN HAZARD AND DISCOUNTING
47
+
48
+ In the hazardous MDP setting we observe the same connections between hazard and discount functions delineated in Appendix A. This expresses an equivalence between the value function of an MDP with a discount and MDP with a hazard distribution.
49
+
50
+ For example, there exists an equivalence between the exponential discount function $d ( t ) = \gamma ^ { t }$ to the undiscounted case where the agent is subject to a $( 1 - \gamma )$ per time-step of dying (Lattimore $\&$ Hutter, 2011). The typical Q-value (left side of Equation 2) is when the agent acts in an environment without hazard $\lambda = 0$ or $\mathcal { H } = \delta ( 0 )$ and discounts future rewards according to $d ( t ) = \gamma ^ { t } = e ^ { - \lambda t }$ which we denote as $Q _ { \pi } ^ { \delta ( 0 ) , \gamma ^ { t } } ( s , a )$ . The alternative Q-value (right side of Equation 2) is when the agent acts under hazard rate $\lambda = - \ln \gamma$ but does not discount future rewards which we denote as $\bar { Q _ { \pi } ^ { \delta ( - \ln \gamma ) , 1 } } ( s , a )$ .
51
+
52
+ $$
53
+ Q _ { \pi } ^ { \delta ( 0 ) , \gamma ^ { t } } ( s , a ) = Q _ { \pi } ^ { \delta ( - \ln \gamma ) , 1 } ( s , a ) \forall \pi , s , a .
54
+ $$
55
+
56
+ where $\delta ( x )$ denotes the Dirac delta distribution at $x$ . This follows from $P _ { \lambda } ( s ^ { \prime } | s , a ) = e ^ { - \lambda } P ( s ^ { \prime } | s , a )$
57
+
58
+ $$
59
+ \begin{array} { r l } { \mathbb { E } _ { \pi , P } \left[ \displaystyle \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \right] = \mathbb { E } _ { \pi , P } \left[ \displaystyle \sum _ { t = 0 } ^ { \infty } e ^ { - \lambda t } R ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \right] } & { } \\ { = \mathbb { E } _ { \pi , P _ { \lambda } } \left[ \displaystyle \sum _ { t = 0 } ^ { \infty } R ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \right] } & { } \end{array}
60
+ $$
61
+
62
+ We also show a similar equivalence between hyperbolic discounting and the specific hazard distribution $\begin{array} { r } { p _ { k } ( \lambda ) = \frac { 1 } { k } \mathrm { e x p } ( - \lambda / \dot { k } ) } \end{array}$ , where again, $\lambda \in [ 0 , \infty )$ in Appendix E.
63
+
64
+ $$
65
+ Q _ { \pi } ^ { \delta ( 0 ) , \Gamma _ { k } } ( s , a ) = Q _ { \pi } ^ { p _ { k } , 1 } ( s , a )
66
+ $$
67
+
68
+ For notational brevity later in the paper, we will omit the explicit hazard distribution $\mathcal { H }$ -superscript if the environment is not hazardous. This formulation builds upon Sozou (1998)’s relate of hazard rate and discount functions and shows that this holds for generalized Q-values in reinforcement learning.
69
+
70
+ # 3 COMPUTING NON-EXPONENTIAL Q-VALUES
71
+
72
+ We now show how one can re-purpose exponentially-discounted Q-values to compute hyperbolic (and other-non-exponential) discounted Q-values. The central challenge with using non-exponential discount strategies is that most RL algorithms use some form of TD learning (Sutton, 1988). This family of algorithms exploits the Bellman equation (Bellman, 1958) which, when using exponential discounting, relates the value function at one state with the value at the following state.
73
+
74
+ $$
75
+ Q _ { \pi } ^ { \gamma ^ { t } } ( s , a ) = \mathbb { E } _ { \pi , P } [ R ( s , a ) + \gamma Q _ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ]
76
+ $$
77
+
78
+ where expectation $\mathbb { E } _ { \pi , P }$ denotes sampling $a \sim \pi ( \cdot | s )$ , $s ^ { \prime } \sim P ( \cdot | s , a )$ , and $a ^ { \prime } \sim \pi ( \cdot | s ^ { \prime } )$ . Being able to reuse TD methods without being constrained to exponential discounting is thus an important challenge. We propose here a scheme to deduce hyperbolic as well as other non-exponentially discounted $Q$ -values when our discount function has a particular form.
79
+
80
+ Lemma 3.1. Let $Q _ { \pi } ^ { \mathcal { H } , \gamma } ( s , a )$ be the state action value function under exponential discounting in a hazardous $M D P < S , A , R , P , \mathcal { H } , \gamma ^ { t } >$ and let $Q _ { \pi } ^ { \mathcal { H } , d } ( s , a )$ refer to the value function in the same MDP except for new discounting $< S , { \mathcal { A } } , R , P , { \mathcal { H } } , d > .$ . If there exists a function $w : [ 0 , 1 ] \to \mathbb { R }$ such that
81
+
82
+ $$
83
+ d ( t ) = \int _ { 0 } ^ { 1 } w ( \gamma ) \gamma ^ { t } d \gamma
84
+ $$
85
+
86
+ which we will refer to as the exponential weighting condition, then
87
+
88
+ $$
89
+ Q _ { \pi } ^ { \mathcal { H } , d } ( s , a ) = \int _ { 0 } ^ { 1 } w ( \gamma ) Q _ { \pi } ^ { \mathcal { H } , \gamma } ( s , a ) d \gamma
90
+ $$
91
+
92
+ Proof. Applying the condition on $d$ ,
93
+
94
+ $$
95
+ \begin{array} { r l } & { \displaystyle { Q _ { \pi } ^ { \mathcal { H } , d } ( s , a ) = \mathbb { E } _ { \lambda } \mathbb { E } _ { \pi , P _ { \lambda } } \left[ \sum _ { t = 0 } ^ { \infty } \left( \int _ { 0 } ^ { 1 } w ( \gamma ) \gamma ^ { t } d \gamma \right) R ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \right] } } \\ & { \quad \quad \quad = \displaystyle { \int _ { 0 } ^ { 1 } \mathbb { E } _ { \lambda } \mathbb { E } _ { \pi , P _ { \lambda } } w ( \gamma ) \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) | s _ { 0 } = s , a _ { 0 } = a \right] d \gamma } } \\ & { \quad \quad \quad = \displaystyle { \int _ { 0 } ^ { 1 } w ( \gamma ) Q _ { \pi } ^ { \mathcal { H } , \gamma } ( s , a ) d \gamma } } \end{array}
96
+ $$
97
+
98
+ The exchange in the above proof is valid if condition is satisfied for hyperbolic discountin $\textstyle \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) < \infty$ . The exponential weightinghat we might want to consider (see Appendix $\mathrm { F }$ for examples). As an example, the hyperbolic discount can be expressed as the integral of a function $f ( \gamma , t )$ for $\gamma = [ 0 , 1 )$ in Equation 9.
99
+
100
+ $$
101
+ \frac { 1 } { k } \int _ { \gamma = 0 } ^ { 1 } \gamma ^ { 1 / k + t - 1 } d \gamma = \frac { 1 } { 1 + k t }
102
+ $$
103
+
104
+ This equationn tells us an integral over a function $\begin{array} { r } { f ( \gamma , t ) = \frac { 1 } { k } \gamma ^ { 1 / k + t - 1 } = w ( \gamma ) \gamma ^ { t } } \end{array}$ yields the desired hyperbolic discount factor $\textstyle \Gamma _ { k } ( t ) = { \frac { 1 } { 1 + k t } }$ . This integral can be derived by Sozou’s Laplace transform of the hazard rate prior $\mathcal { H } = p ( \lambda )$ in Equation 18 and then applying our change of variables $\gamma = e ^ { - \lambda }$ relating RL discount factors to hazard rates. The computation of hyperbolic and other discount functions is demonstrated in detail in Appendix F.
105
+
106
+ This prescription gives us a tool to produce general forms of non-exponentially discounted Q-values using our familiar exponentially discounted $\mathbf { Q }$ -values traditionally learned in RL (Sutton, 1988; Sutton & Barto, 1998).
107
+
108
+ # 4 APPROXIMATING HYPERBOLIC $Q$ -VALUES
109
+
110
+ Section 3 describes an equivalence between hyperbolically-discounted $\mathbf { Q }$ -values and integrals of exponentially-discounted Q-values, however, the method required evaluating an infinite set of value functions. We therefore present a practical approach to approximate discounting $\begin{array} { r } { \Gamma ( \dot { t } ) = \frac { 1 } { 1 + k t } } \end{array}$ using a finite set of functions learned via standard $Q$ -learning (Watkins & Dayan, 1992). To avoid estimating an infinite number of $Q _ { \pi } ^ { \gamma }$ -values we introduce a free hyperparameter $( n _ { \gamma } )$ which is the total number of $Q _ { \pi } ^ { \gamma }$ -values to consider, each with their own $\gamma$ . We use a practically-minded approach to choose $\mathcal { G }$ that emphasizes evaluating larger values of $\gamma$ rather than uniformly choosing points and empirically performs well as seen in Section 5.
111
+
112
+ $$
113
+ \mathcal { G } = [ \gamma _ { 0 } , \gamma _ { 1 } , \cdot \cdot \cdot , \gamma _ { n _ { \gamma } } ]
114
+ $$
115
+
116
+ Our approach is described in Appendix G. Each $Q _ { \pi } ^ { \gamma _ { i } }$ computes the discounted sum of returns according to that specific discount factor $\begin{array} { r } { Q _ { \pi } ^ { \gamma _ { i } } ( s , a ) = \mathbb E _ { \pi } \left[ \sum _ { t } ( \gamma _ { i } ) ^ { t } r _ { t } | s _ { 0 } = s , a _ { 0 } = a \right] } \end{array}$ . We previously proposed two equivalent approaches for computing hyperbolic $\mathrm { Q }$ -values, but for simplicity we consider the one presented in Lemma 3.1. The set of $Q$ -values permits us to estimate the integral through a Riemann sum (Equation 11) which is described in further detail in Appendix I.
117
+
118
+ $$
119
+ \begin{array} { l } { { \displaystyle Q _ { \pi } ^ { \Gamma } ( s , a ) = \int _ { 0 } ^ { 1 } w ( \gamma ) Q _ { \pi } ^ { \gamma } ( s , a ) d \gamma } } \\ { { \displaystyle ~ \approx \sum _ { \gamma _ { i } \in \mathcal { G } } \left( \gamma _ { i + 1 } - \gamma _ { i } \right) w ( \gamma _ { i } ) \ Q _ { \pi } ^ { \gamma _ { i } } ( s , a ) } } \end{array}
120
+ $$
121
+
122
+ where we estimate the integral through a lower bound. We consolidate this entire process in Figure 11 where we show the full process of rewriting the hyperbolic discount rate, hyperbolically-discounted Q-value, the approximation and the instantiated agent. This approach is similar to that of KurthNelson & Redish (2009) where each $\mu .$ Agent models a specific discount factor $\gamma$ . However, this differs in that our final agent computes a weighted average over each Q-value rather than a sampling operation of each agent based on a $\gamma$ -distribution.
123
+
124
+ # 5 HYPERBOLIC RESULTS
125
+
126
+ # 5.1 WHEN TO DISCOUNT HYPERBOLICALLY?
127
+
128
+ The benefits of hyperbolic discounting will be greatest under two conditions: uncertain hazard and non-trivial intertemporal decisions. The first condition can arise under a unobserved hazard-rate variable $\lambda$ drawn independently at the beginning of each episode from $\mathcal { H } = p ( \lambda )$ . The second condition emerges with a choice between a smaller nearby rewards versus larger distant rewards.2 In the absence of both properties we would not expect any advantage to discounting hyperbolically. To see why, if there is a single-true hazard rate $\lambda _ { \mathrm { e n v } }$ , than an optimal $\gamma ^ { * } = e ^ { - \lambda _ { \mathrm { e n v } } }$ exists and future rewards should be discounted exponentially according to it. Further, if there is a single path through the environment with perfect alignment of short- and long-term objectives, all discounting schemes yield the same optimal policy.
129
+
130
+ # 5.2 PATHWORLD EXPERIMENTS
131
+
132
+ We note two sources for discounting rewards in the future: time delay and survival probability (Section 2). In Pathworld we train to maximize hyperbolically discounted returns $( \textstyle \sum _ { t } \Gamma _ { k } ( t ) R ( s _ { t } , a _ { t } ) )$ under no hazard $\mathcal { H } = \delta ( \lambda - 0 ) )$ but then evaluate the undiscounted returns $d ( t ) = 1 . 0 \forall t$ with the paths subject to hazard $\begin{array} { r } { \dot { \mathcal { H } } = \frac { 1 } { k } \mathrm { e x p } { \left( - \lambda / k \right) } } \end{array}$ .
133
+
134
+ Through this procedure, we are able to train an agent that is robust to hazards in the environment. The agent makes one decision in Pathworld (Figure 2): which of the $N$ paths to investigate. Once a path is chosen, the agent continues until it reaches the end or until it dies. This is similar to a multi-armed bandit, with each action subject to dynamic risk. The paths vary quadratically in length with the index $d ( i ) = i ^ { 2 }$ but the rewards increase linearly with the path index $\bar { r ( i ) } = i$ . This presents a non-trivial decision for the agent. At deployment, an unobserved hazard $\lambda \sim \mathcal { H }$ is drawn and the agent is subject to a per-time-step risk of dying of $( 1 - e ^ { - \lambda } )$ . This environment differs from the adjusting-delay procedure presented by Mazur (1987) and then later modified by Kurth-Nelson & Redish (2009). Rather then determining time-preferences through variable-timing of rewards, we determine time-preferences through risk to the reward.
135
+
136
+ ![](images/979c02bd6509d64e60f06d4688c1d7cd3d22f435ba730742e11beb569bbd5750.jpg)
137
+ Figure 2: The Pathworld. Each state (white circle) indicates the accompanying reward $r$ and the distance from the starting state $d$ . From the start state, the agent makes a single action: which which path to follow to the end. Longer paths have a larger rewards at the end, but the agent incurs a higher risk on a longer path.
138
+
139
+ ![](images/8eaec6130e7973fac1942ffb10190b75142ace77c7babe57640fad90581cda99.jpg)
140
+ Figure 3: In each episode of Pathworld an unobserved hazard $\lambda \sim p ( \lambda )$ is drawn and the agent is subject to a total risk of the reward not being realized of (1 − $e ^ { - \lambda } ) ^ { d ( a ) }$ where $d ( a )$ is the path length. When the agent’s hazard prior matches the true hazard distribution, the value estimate agrees well with the theoretical value. Exponentially discounted values fail to approximate the true value (Table 1).
141
+
142
+ <table><tr><td>Discount function</td><td>MSE</td></tr><tr><td>hyperbolic value</td><td>0.002</td></tr><tr><td>γ=0.975</td><td>0.566</td></tr><tr><td>γy=0.95</td><td>1.461</td></tr><tr><td>γ=0.9</td><td>2.253</td></tr><tr><td>γ=0.99</td><td>2.288</td></tr><tr><td>y=0.75</td><td>2.809</td></tr></table>
143
+
144
+ Table 1: The average mean squared error (MSE) over each of the paths in Figure 3 showing that our approximation scheme well-approximates the true valueprofile.
145
+
146
+ Figure 3 validates that our approach well-approximates the true hyperbolic value of each path when the hazard prior matches the true distribution. Agents that discount exponentially according to a single $\gamma$ (the typical case in RL) incorrectly value the paths. We examine further the failure of exponential discounting in this hazardous setting. For this environment, the true hazard parameter in the prior was $k = 0 . 0 5$ (i.e. $\lambda \sim 2 0 \mathrm { e x p } ( - \lambda / 0 . 0 5 ) )$ . Therefore, at deployment, the agent must deal with dynamic levels of risk and faces a non-trivial decision of which path to follow. Even if we tune an agent’s $\gamma = 0 . 9 7 5$ such that it chooses the correct arg-max path, it still fails to capture the functional form (Figure 3) and it achieves a high error over all paths (Table 1). If the arg-max action was not available or if the agent was proposed to evaluate non-trivial intertemporal decisions, it would act sub-optimally. In Appendix B we consider additional experiments where the agent’s prior over hazard more realistically does not exactly match the environment true hazard rate and demonstrate the benefit of appropriate priors.
147
+
148
+ # 5.3 ATARI 2600 EXPERIMENTS
149
+
150
+ With our approach validated in Pathworld, we now move to the high-dimensional environment of Atari 2600, specifically, ALE. We use the Rainbow variant from Dopamine (Castro et al., 2018) which implements three of the six considered improvements from the original paper: distributional RL, predicting n-step returns and prioritized replay buffers. The agent (Figure 4) maintains a shared representation $h ( s )$ of state, but computes $Q$ -value logits for each of the $N \gamma _ { i }$ via $Q _ { \pi } ^ { ( i ) } ( s , a ) =$ $W _ { i } h ( s ) + b _ { i }$ where $W _ { i }$ and $b _ { i }$ are the learnable parameters of the affine transformation for that head. A ReLU-nonlinearity is used within the body of the network (Nair & Hinton, 2010).
151
+
152
+ ![](images/70d88b823a7db631b0c10f40932e1ee4da083bb580175c4b4f22a0db540668ff.jpg)
153
+ Figure 4: Multi-horizon model predicts $Q$ -values for $n _ { \gamma }$ separate discount functions thereby modeling different effective horizons. Each $Q$ -value is a lightweight computation, an affine transformation off a shared representation. By modeling over multiple time-horizons, we now have the option to construct policies that act according to a particular value or a weighted combination.
154
+
155
+ Hyperparameter details are provided in Appendix K and when applicable, they default to the standard Dopamine values. We find strong performance improvements of the hyperbolic agent built on Rainbow (Hyper-Rainbow; blue bars) on a random subset of Atari 2600 games in Figure 5.
156
+
157
+ # 6 MULTI-HORIZON AUXILIARY TASK RESULTS
158
+
159
+ To dissect the Hyper-Rainbow improvements, recognize that two properties from the base Rainbow agent have changed:
160
+
161
+ 1. Behavior policy, $\mu$ . The agent acts according to hyperbolic Q-values computed by our approximation described in Section 4
162
+ 2. Learn over multiple horizons. The agent simultaneously learns Q-values over many $\gamma$ rather than a Q-value for a single $\gamma$
163
+
164
+ On this subset of 19 games, Hyper-Rainbow improves upon 14 games and in some cases, by large margins. But we seek here a more complete understanding of the underlying driver of this improvement in ALE through an ablation study.
165
+
166
+ The second modification can be regarded as introducing an auxiliary task (Jaderberg et al., 2016). Therefore, to attribute the performance of each properly we construct a Rainbow agent augmented with the multi-horizon auxiliary task (referred to as Multi-Rainbow and shown in orange) but have it still act according to the original policy. That is, Multi-Rainbow acts to maximize expected rewards discounted by a fixed $\gamma _ { a c t i o n }$ but now learns over multiple horizons as shown in Figure 4.
167
+
168
+ ![](images/76d1901b93701d7206c9448a46012ca31de0ea167d1b16846795d1f5db3fbd7b.jpg)
169
+ Figure 5: We compare the Hyper-Rainbow (in blue) agent versus the Multi-Rainbow (orange) agent on a random subset of 19 games from ALE (3 seeds each). For each game, the percentage performance improvement for each algorithm against Rainbow is recorded. There is no significant difference whether the agent acts according to hyperbolically-discounted (Hyper-Rainbow) or exponentiallydiscounted (Multi-Rainbow) Q-values suggesting the performance improvement in ALE emerges from the multi-horizon auxiliary task.
170
+
171
+ We find that the Multi-Rainbow agent performs nearly as well on these games, suggesting the effectiveness of this as a stand-alone auxiliary task. This is not entirely unexpected given the rather special-case of hazard exhibited in ALE through sticky-actions (Machado et al., 2018).
172
+
173
+ We examine further and investigate the performance of this auxiliary task across the full Arcade Learning Environment (Bellemare et al., 2017) using the recommended evaluation by (Machado et al., 2018). Doing so we find strong empirical benefits of the multi-horizon auxiliary task over the state-of-the-art Rainbow agent as shown in Figure 6.
174
+
175
+ ![](images/fcb90d365c0f6b6882beafa9244311f1bb2ed5b5985751275e721a9e1eea70b5.jpg)
176
+ Figure 6: Performance improvement over Rainbow using the multi-horizon auxiliary task in Atari Learning Environment (3 seeds each).
177
+
178
+ # 6.1 ANALYSIS AND ABLATION STUDIES
179
+
180
+ To understand the interplay of the multi-horizon auxiliary task with other improvements in deep RL, we test a random subset of 10 Atari 2600 games against improvements in Rainbow (Hessel et al., 2018). On this set of games we measure a consistent improvement with multi-horizon C51 (Multi-C51) in 9 out of the 10 games over the base C51 agent (Bellemare et al., 2017) in Figure 7.
181
+
182
+ Figure 7 indicates that the current implementation of Multi-Rainbow does not generally build successfully on the prioritized replay buffer. On the subset of ten games considered, we find that four out of ten games (Pong, Venture, Gravitar and Zaxxon) are negatively impacted despite (Hessel et al., 2018) finding it to be of considerable benefit and specifically beneficial in three out of these four games (Venture was not considered). The current prioritization scheme simply averaged the temporal-difference errors over all $Q$ -values to establish priority. Alternative prioritization schemes are resulted in comparable performance indicating this is an open issue (Appendix J).
183
+
184
+ ![](images/8ca63310fa8392f6c2efec15a13638e235e8710ac1371171d0aba6c30ddc2469.jpg)
185
+ Figure 7: Measuring the Rainbow improvements on top of the Multi-C51 baseline on a subset of 10 games in the Arcade Learning Environment (3 seeds each). On this subset, we find that the multihorizon auxiliary task interfaces well with n-step methods (top right) but poorly with a prioritized replay buffer (bottom left).
186
+
187
+ # 7 RELATED WORK
188
+
189
+ Hyperbolic discounting in economics. Hyperbolic discounting is well-studied in the field of economics (Sozou, 1998; Dasgupta & Maskin, 2005). Dasgupta and Maskin (2005) proposes a softer interpretation than Sozou (1998) (which produces a per-time-step of death via the hazard rate) and demonstrates that uncertainty over the timing of rewards can also give rise to hyperbolic discounting and preference reversals, a hallmark of hyperbolic discounting. Hyperbolic discounting was initially presumed to not lend itself to TD-based solutions (Daw & Touretzky, 2000) but the field has evolved on this point. Maia (2009) proposes solution directions that find models that discount quasi-hyperbolically even though each learns with exponential discounting (Loewenstein, 1996) but reaffirms the difficulty. Finally, Alexander and Brown (2010) proposes hyperbolically discounted temporal difference (HDTD) learning by making connections to hazard.
190
+
191
+ Behavior RL and hyperbolic discounting in neuroscience. TD-learning has long been used for modeling behavioral reinforcement learning (Montague et al., 1996; Schultz et al., 1997; Sutton & Barto, 1998). TD-learning computes the error as the difference between the expected value and actual value (Sutton & Barto, 1998; Daw, 2003) where the error signal emerges from unexpected rewards. However, these computations traditionally rely on exponential discounting as part of the estimate of the value which disagrees with empirical evidence in humans and animals (Strotz, 1955; Mazur, 1985; 1997; Ainslie, 1975; 1992). Hyperbolic discounting has been proposed as an alternative to exponential discounting though it has been debated as an accurate model (Kacelnik, 1997; Frederick et al., 2002). Naive modifications to TD-learning to discount hyperbolically present issues since the simple forms are inconsistent (Daw & Touretzky, 2000; Redish & Kurth-Nelson, 2010) RL models have been proposed to explain behavioral effects of humans and animals (Fu & Anderson, 2006;
192
+
193
+ Rangel et al., 2008) but Kurth-Nelson & Redish (2009) demonstrated that distributed exponential discount factors can directly model hyperbolic discounting. This work proposes the $\mu .$ Agent, an agent that models the value function with a specific discount factor $\gamma$ . When the distributed set of $\mu .$ Agent’s votes on the action, this was shown to approximate hyperbolic discounting well in the adjusting-delay assay experiments (Mazur, 1987). Using the hazard formulation established in Sozou (1998), we demonstrate how to extend this to other non-hyperbolic discount functions and demonstrate the efficacy of using a deep neural network to model the different Q-values from a shared representation.
194
+
195
+ Towards more flexible discounting in reinforcement learning. RL researchers have recently adopted more flexible versions beyond a fixed discount factor (Feinberg & Shwartz, 1994; Sutton, 1995; Sutton et al., 2011; White, 2017). Optimal policies are studied in Feinberg & Shwartz (1994) where two value functions with different discount factors are used. Introducing the discount factor as an argument to be queried for a set of timescales is considered in both Horde (Sutton et al., 2011) and $\gamma$ -nets (Sherstan et al., 2018). Reinke et al. (2017) proposes the Average Reward Independent Gamma Ensemble framework which imitates the average return estimator. Lattimore and Hutter (2011) generalizes the original discounting model through discount functions that vary with the age of the agent, expressing time-inconsistent preferences as in hyperbolic discounting. The need to increase training stability via effective horizon was addressed in François-Lavet, Fonteneau, and Ernst (2015) who proposed dynamic strategies for the discount factor $\gamma$ . Meta-learning approaches to deal with the discount factor have been proposed in $\mathrm { X u }$ , van Hasselt, and Silver (2018). Finally, Pitis (2019) characterizes rational decision making in sequential processes, formalizing a process that admits a state-action dependent discount rates. Operating over multiple time scales has a long history in RL. Sutton (1995) generalizes the work of Singh (1992) and Dayan and Hinton (1993) to formalize a multi-time scale TD learning model theory. Previous work has been explored on solving MDPs with multiple reward functions and multiple discount factors though these relied on separate transition models (Feinberg & Shwartz, 1999; Dolgov & Durfee, 2005). Edwards, Littman, and Isbell (2015) considers decomposing a reward function into separate components each with its own discount factor. In our work, we continue to model the same rewards, but now model the value over different horizons. Recent work in difficult exploration games demonstrates the efficacy of two different discount factors (Burda et al., 2018) one for intrinsic rewards and one for extrinsic rewards. Finally, and concurrent with this work, Romoff et al. (2019) proposes the $\mathrm { T D } ( \Delta )$ -algorithm which breaks a value function into a series of value functions with smaller discount factors.
196
+
197
+ Auxiliary tasks in reinforcement learning. Finally, auxiliary tasks have been successfully employed and found to be of considerable benefit in RL. Suddarth and Kergosien (1990) used auxiliary tasks to facilitate representation learning. Building upon this, work in RL has consistently demonstrated benefits of auxiliary tasks to augment the low-information coming from the environment through extrinsic rewards (Lample & Chaplot, 2017; Mirowski et al., 2016; Jaderberg et al., 2016; Veeriah et al., 2018; Sutton et al., 2011)
198
+
199
+ # 8 DISCUSSION AND FUTURE WORK
200
+
201
+ This work builds on a body of work that questions one of the basic premises of RL: one should maximize the exponentially discounted returns via a single discount factor. By learning over multiple horizons simultaneously, we have broadened the scope of our learning algorithms. Through this we have shown that we can enable acting according to new discounting schemes and that learning multiple horizons is a powerful stand-alone auxiliary task. Our method well-approximates hyperbolic discounting and performs better in hazardous MDP distributions. This may be viewed as part of an algorithmic toolkit to model alternative discount functions.
202
+
203
+ However, this work still does not fully capture more general aspects of risk since the hazard rate may be a function of time. Further, hazard may not be an intrinsic property of the environment but a joint property of both the policy and the environment. If an agent purses a policy leading to dangerous state distributions then it will naturally be subject to higher hazards and vice-versa - this creates a complicated circular dependency. We would therefore expect an interplay between time-preferences and policy. This is not simple to deal with but recent work proposing state-action dependent discounting (Pitis, 2019) may provide a formalism for more general time-preference schemes.
204
+
205
+ # REFERENCES
206
+
207
+ George Ainslie. Specious reward: a behavioral theory of impulsiveness and impulse control. Psychological bulletin, 82(4):463, 1975.
208
+
209
+ George Ainslie. Picoeconomics: The strategic interaction of successive motivational states within the person. Cambridge University Press, 1992.
210
+
211
+ William H Alexander and Joshua W Brown. Hyperbolically discounted temporal difference learning. Neural computation, 22(6):1511–1527, 2010.
212
+
213
+ Marc G. Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013.
214
+
215
+ Marc G. Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. arXiv preprint arXiv:1707.06887, 2017.
216
+
217
+ Richard Bellman. A markovian decision process. Journal of Mathematics and Mechanics, 6(5): 679–684, 1957.
218
+
219
+ Richard Bellman. On a routing problem. Quarterly of applied mathematics, 16(1):87–90, 1958.
220
+
221
+ Dimitri P Bertsekas. Neuro-dynamic programming: an overview. 1995.
222
+
223
+ Dimitri P Bertsekas and John N Tsitsiklis. Neuro-dynamic programming, volume 5. Athena Scientific Belmont, MA, 1996.
224
+
225
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018.
226
+
227
+ Pablo Samuel Castro, Subhodeep Moitra, Carles Gelada, Saurabh Kumar, and Marc G. Bellemare. Dopamine: A research framework for deep reinforcement learning. CoRR, abs/1812.06110, 2018. URL http://arxiv.org/abs/1812.06110.
228
+
229
+ Partha Dasgupta and Eric Maskin. Uncertainty and hyperbolic discounting. American Economic Review, 95(4):1290–1299, 2005.
230
+
231
+ Nathaniel D Daw. Reinforcement learning models of the dopamine system and their behavioral implications. PhD thesis, Carnegie Mellon University, 2003.
232
+
233
+ Nathaniel D Daw and David S Touretzky. Behavioral considerations suggest an average reward td model of the dopamine system. Neurocomputing, 32:679–684, 2000.
234
+
235
+ Peter Dayan and Geoffrey E Hinton. Feudal reinforcement learning. In Advances in neural information processing systems, pp. 271–278, 1993.
236
+
237
+ Dmitri Dolgov and Edmund Durfee. Stationary deterministic policies for constrained mdps with multiple rewards, costs, and discount factors. Ann Arbor, 1001:48109, 2005.
238
+
239
+ Ashley Edwards, Michael L Littman, and Charles L Isbell. Expressing tasks robustly via multiple discount factors. 2015.
240
+
241
+ Eugene A Feinberg and Adam Shwartz. Markov decision models with weighted discounted criteria. Mathematics of Operations Research, 19(1):152–168, 1994.
242
+
243
+ Eugene A Feinberg and Adam Shwartz. Constrained dynamic programming with two discount factors: Applications and an algorithm. IEEE Transactions on Automatic Control, 44(3):628–631, 1999.
244
+
245
+ Vincent François-Lavet, Raphael Fonteneau, and Damien Ernst. How to discount deep reinforcement learning: Towards new dynamic strategies. arXiv preprint arXiv:1512.02011, 2015.
246
+
247
+ Shane Frederick, George Loewenstein, and Ted O’donoghue. Time discounting and time preference: A critical review. Journal of economic literature, 40(2):351–401, 2002.
248
+
249
+ Wai-Tat Fu and John R Anderson. From recurrent choice to skill learning: A reinforcement-learning model. Journal of experimental psychology: General, 135(2):184, 2006.
250
+
251
+ Leonard Green and Joel Myerson. A discounting framework for choice with delayed and probabilistic rewards. Psychological bulletin, 130(5):769, 2004.
252
+
253
+ Leonard Green, Ewin B Fisher, Steven Perlow, and Lisa Sherman. Preference reversal and self control: Choice as a function of reward amount and delay. Behaviour Analysis Letters, 1981.
254
+
255
+ Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
256
+
257
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
258
+
259
+ Alex Kacelnik. Normative and descriptive models of decision making: time discounting and risk sensitivity. Characterizing human psychological adaptations, 208:51–66, 1997.
260
+
261
+ Leslie Pack Kaelbling, Michael L Littman, and Anthony R Cassandra. Planning and acting in partially observable stochastic domains. Artificial intelligence, 101(1-2):99–134, 1998.
262
+
263
+ Michael Kearns and Satinder Singh. Near-optimal reinforcement learning in polynomial time. Machine learning, 49(2-3):209–232, 2002.
264
+
265
+ Zeb Kurth-Nelson and A David Redish. Temporal-difference reinforcement learning with distributed representations. PLoS One, 4(10):e7362, 2009.
266
+
267
+ Guillaume Lample and Devendra Singh Chaplot. Playing fps games with deep reinforcement learning. 2017.
268
+
269
+ Tor Lattimore and Marcus Hutter. Time consistent discounting. In International Conference on Algorithmic Learning Theory, pp. 383–397. Springer, 2011.
270
+
271
+ George Loewenstein. Out of control: Visceral influences on behavior. Organizational behavior and human decision processes, 65(3):272–292, 1996.
272
+
273
+ Marlos C. Machado, Marc G. Bellemare, Erik Talvitie, Joel Veness, Matthew Hausknecht, and Michael Bowling. Revisiting the Arcade Learning Environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 2018.
274
+
275
+ Tiago V Maia. Reinforcement learning, conditioning, and the brain: Successes and challenges. Cognitive, Affective, & Behavioral Neuroscience, 9(4):343–364, 2009.
276
+
277
+ James E Mazur. Probability and delay of reinforcement as factors in discrete-trial choice. Journal of the Experimental Analysis of Behavior, 43(3):341–351, 1985.
278
+
279
+ James E Mazur. An adjusting procedure for studying delayed reinforcement. 1987.
280
+
281
+ James E Mazur. Choice, delay, probability, and conditioned reinforcement. Animal Learning & Behavior, 25(2):131–147, 1997.
282
+
283
+ Piotr Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andrew J Ballard, Andrea Banino, Misha Denil, Ross Goroshin, Laurent Sifre, Koray Kavukcuoglu, et al. Learning to navigate in complex environments. arXiv preprint arXiv:1611.03673, 2016.
284
+
285
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
286
+
287
+ P Read Montague, Peter Dayan, and Terrence J Sejnowski. A framework for mesencephalic dopamine systems based on predictive hebbian learning. Journal of neuroscience, 16(5):1936–1947, 1996.
288
+
289
+ 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.
290
+
291
+ OpenAI. Openai five. https://blog.openai.com/openai-five/, 2018.
292
+
293
+ Silviu Pitis. Rethinking the Discount Factor in Reinforcement Learning: A Decision Theoretic Approach. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence. AAAI Press, 2019.
294
+
295
+ Danil V Prokhorov and Donald C Wunsch. Adaptive critic designs. IEEE transactions on Neural Networks, 8(5):997–1007, 1997.
296
+
297
+ Antonio Rangel, Colin Camerer, and P Read Montague. A framework for studying the neurobiology of value-based decision making. Nature reviews neuroscience, 9(7):545, 2008.
298
+
299
+ A David Redish and Zeb Kurth-Nelson. Neural models of temporal discounting. 2010.
300
+
301
+ Chris Reinke, Eiji Uchibe, and Kenji Doya. Average reward optimization with multiple discounting reinforcement learners. In International Conference on Neural Information Processing, pp. 789– 800. Springer, 2017.
302
+
303
+ Joshua Romoff, Peter Henderson, Ahmed Touati, Yann Ollivier, Emma Brunskill, and Joelle Pineau. Separating value functions across time-scales. arXiv preprint arXiv:1902.01883, 2019.
304
+
305
+ Paul A Samuelson. A note on measurement of utility. The review of economic studies, 4(2):155–161, 1937.
306
+
307
+ Wolfram Schultz, Peter Dayan, and P Read Montague. A neural substrate of prediction and reward. Science, 275(5306):1593–1599, 1997.
308
+
309
+ Craig Sherstan, James MacGlashan, and Patrick M. Pilarski. Generalizing value estimation over timescal. In FAIM Workshop on Prediction and Generative Modeling in Reinforcement Learning, 2018.
310
+
311
+ Satinder P Singh. Scaling reinforcement learning algorithms by learning variable temporal resolution models. In Machine Learning Proceedings 1992, pp. 406–415. Elsevier, 1992.
312
+
313
+ Peter D Sozou. On hyperbolic discounting and uncertain hazard rates. Proceedings of the Royal Society of London B: Biological Sciences, 265(1409):2015–2020, 1998.
314
+
315
+ Robert Henry Strotz. Myopia and inconsistency in dynamic utility maximization. The Review of Economic Studies, 23(3):165–180, 1955.
316
+
317
+ Steven C Suddarth and YL Kergosien. Rule-injection hints as a means of improving network performance and learning time. In Neural Networks, pp. 120–129. Springer, 1990.
318
+
319
+ Richard S Sutton. Learning to predict by the methods of temporal differences. Machine learning, 3 (1):9–44, 1988.
320
+
321
+ Richard S Sutton. Td models: Modeling the world at a mixture of time scales. In Machine Learning Proceedings 1995, pp. 531–539. Elsevier, 1995.
322
+
323
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. 1998.
324
+
325
+ Richard S Sutton, Joseph Modayil, Michael Delp, Thomas Degris, Patrick M Pilarski, Adam White, and Doina Precup. Horde: A scalable real-time architecture for learning knowledge from unsupervised sensorimotor interaction. In The 10th International Conference on Autonomous Agents and Multiagent Systems-Volume 2, pp. 761–768. International Foundation for Autonomous Agents and Multiagent Systems, 2011.
326
+
327
+ Vivek Veeriah, Junhyuk Oh, and Satinder Singh. Many-goals reinforcement learning. arXiv preprint arXiv:1806.09605, 2018.
328
+
329
+ Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992.
330
+
331
+ Martha White. Unifying task specification in reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3742–3750. JMLR. org, 2017.
332
+
333
+ Zhongwen Xu, Hado van Hasselt, and David Silver. Meta-gradient reinforcement learning. arXiv preprint arXiv:1805.09801, 2018.
334
+
335
+ # A SOZOU (1998): BELIEF OF RISK IMPLIES A DISCOUNT FUNCTION
336
+
337
+ Sozou (1998) formalizes time preferences in which future rewards are discounted based on the probability that the agent will not survive to collect them due to an encountered risk or hazard.
338
+
339
+ Definition A.1. Survival $s ( t )$ is the probability of the agent surviving until time $t$ .
340
+
341
+ $$
342
+ s ( t ) = P ( { \mathrm { a g e n t ~ i s ~ a l i v e } } | { \mathrm { a t ~ t i m e } } t )
343
+ $$
344
+
345
+ A future reward $r _ { t }$ is less valuable presently if the agent is unlikely to survive to collect it. If the agent is risk-neutral, the present value of a future reward $r _ { t }$ received at time- $\cdot t$ should be discounted by the probability that the agent will survive until time $t$ to collect it, $s ( t )$ .3
346
+
347
+ $$
348
+ v ( r _ { t } ) = s ( t ) r _ { t }
349
+ $$
350
+
351
+ Consequently, if the agent is certain to survive, $s ( t ) = 1$ , then the reward is not discounted per Equation 14. From this it is then convenient to define the hazard rate.
352
+
353
+ Definition A.2. Hazard rate $h ( t )$ is the negative rate of change of the log-survival at time $t$
354
+
355
+ $$
356
+ h ( t ) = - { \frac { d } { d t } } { \ln } s ( t )
357
+ $$
358
+
359
+ or equivalently expressed as $\begin{array} { r } { h ( t ) = - \frac { d s ( t ) } { d t } \frac { 1 } { s ( t ) } . } \end{array}$ Therefore the environment is considered hazardous at time $t$ if the log survival is decreasing sharply.
360
+
361
+ Sozou (1998) demonstrates that the prior belief of the risk in the environment implies a specific discounting function. When the risk occurs at a known constant rate than the agent should discount future rewards exponentially. However, when the agent holds uncertainty over the hazard rate then hyperbolic and alternative discounting rates arise.
362
+
363
+ # A.1 KNOWN HAZARD IMPLIES EXPONENTIAL DISCOUNT
364
+
365
+ We recover the familiar exponential discount function in RL based on a prior assumption that the environment has a known constant hazard. Consider a known hazard rate of $h ( t ) = \lambda \geq 0$ . Definition A.2 sets a first order differential equation $\begin{array} { r } { \lambda = - \frac { d } { d t } \mathrm { l n } s ( t ) = - \frac { d s ( t ) } { d t } \frac { 1 } { s ( t ) } } \end{array}$ . The solution for the survival rate is $s ( t ) = e ^ { - \lambda t }$ which can be related to the RL discount factor $\gamma$
366
+
367
+ $$
368
+ s ( t ) = e ^ { - \lambda t } = \gamma ^ { t }
369
+ $$
370
+
371
+ This interprets $\gamma$ as the per-time-step probability of the episode continuing. This also allows us to connect the hazard rate $\lambda \in [ 0 , \infty ]$ to the discount factor $\gamma \in [ 0 , 1 )$ .
372
+
373
+ $$
374
+ \gamma = e ^ { - \lambda }
375
+ $$
376
+
377
+ As the hazard increases $\lambda \infty$ , then the corresponding discount factor becomes increasingly myopic $\gamma 0$ . Conversely, as the environment hazard vanishes, $\lambda 0$ , the corresponding agent becomes increasingly far-sighted $\gamma 1$ . In RL we commonly choose a single $\gamma$ which is consistent with the prior belief that there exists a known constant hazard rate $\lambda = - \mathrm { l n } ( \gamma )$ . We now relax the assumption that the agent holds this strong prior that it exactly knows the true hazard rate. From a Bayesian perspective, a looser prior allows for some uncertainty in the underlying hazard rate of the environment which we will see in the following section.
378
+
379
+ # A.2 UNCERTAIN HAZARD IMPLIES NON-EXPONENTIAL DISCOUNT
380
+
381
+ We may not always be so confident of the true risk in the environment and instead reflect this underlying uncertainty in the hazard rate through a hazard prior $p ( \lambda )$ . Our survival rate is then computed by weighting specific exponential survival rates defined by a given $\lambda$ over our prior $p ( \lambda )$
382
+
383
+ $$
384
+ s ( t ) = \int _ { \lambda = 0 } ^ { \infty } p ( \lambda ) e ^ { - \lambda t } d \lambda
385
+ $$
386
+
387
+ Sozou (1998) shows that under an exponential prior of hazard $\begin{array} { r } { p ( \lambda ) = \frac { 1 } { k } \mathrm { e x p } ( - \lambda / k ) } \end{array}$ the expected survival rate for the agent is hyperbolic
388
+
389
+ $$
390
+ s ( t ) = \frac { 1 } { 1 + k t } \equiv \Gamma _ { k } ( t )
391
+ $$
392
+
393
+ We denote the hyperbolic discount by $\Gamma _ { k } ( t )$ to make the connection to $\gamma$ in reinforcement learning explicit. Further, Sozou (1998) shows that different priors over hazard correspond to different discount functions. We reproduce two figures in Figure 8 showing the correspondence between different hazard rate priors and the resultant discount functions. The common approach in RL is to maintain a delta-hazard (black line) which leads to exponential discounting of future rewards. Different priors lead to non-exponential discount functions.
394
+
395
+ ![](images/883f7df9843c6804ae5dfa938f97279a667794530589e5a9354806c8f8cdabb1.jpg)
396
+ Figure 8: We reproduce two figures from Sozou (1998). There is a correspondence between hazard rate priors and the resulting discount function. In RL, we typically discount future rewards exponentially which is consistent with a Dirac delta prior (black line) on the hazard rate indicating no uncertainty of hazard rate. However, this is a special case and priors with uncertainty over the hazard rate imply new discount functions. All priors have the same mean hazard rate $\mathbb { E } [ p ( \lambda ) ] = 1$ .
397
+
398
+ # B ADDITIONAL PATHWORLD EXPERIMENTS
399
+
400
+ In Figure 9 we consider the case that the agent still holds an exponential prior but has the wrong coefficient $k$ and in Figure 10 we consider the case where the agent still holds an exponential prior but the true hazard is actually drawn from a uniform distribution with the same mean.
401
+
402
+ Through these two validating experiments, we demonstrate the robustness of estimating hyperbolic discounted Q-values in the case when the environment presents dynamic levels of risk and the agent faces non-trivial decisions. Hyperbolic discounting is preferable to exponential discounting even when the agent’s prior does not precisely match the true environment hazard rate distribution, by coefficient (Figure 9) or by functional form (Figure 10).
403
+
404
+ <table><tr><td colspan="2">Discount function</td></tr><tr><td>k=0.05</td><td>MSE 0.002</td></tr><tr><td>k=0.1</td><td>0.493</td></tr><tr><td>k=0.025</td><td>0.814</td></tr><tr><td>k=0.2</td><td>1.281</td></tr></table>
405
+
406
+ ![](images/298368b491e07ddc2b60b2abfedcf1f55fd89daffabf035e55051c3aa17b962d.jpg)
407
+ Figure 9: Case when the hazard coefficient $k$ does not match that environment hazard. Here the true hazard coefficient is $k ~ = ~ 0 . 0 5$ , but we compute values for hyperbolic agents with mismatched priors in range $k = [ 0 . 0 2 5 , 0 . 0 5 , 0 . 1 , 0 . 2 ]$ ]. Predictably, the mismatched priors result in a higher prediction error of value but performs more reliably than exponential discounting, resulting in a cumulative lower error. Numerical results in Table 2.
408
+ Table 2: The average mean squared error (MSE) over each of the paths in Figure 9. As the prior is further away from the true value of $k = 0 . 0 5$ , the error increases. However, notice that the errors for large factor-of-2 changes in $k$ result in generally lower errors than if the agent had considered only a single exponential discount factor $\gamma$ as in Table 1.
409
+
410
+ <table><tr><td>Discount function</td><td>MSE</td></tr><tr><td>hyperbolic value</td><td>0.235</td></tr><tr><td>γ = 0.975</td><td>0.266</td></tr><tr><td>γ = 0.95</td><td>0.470</td></tr><tr><td>γ = 0.99</td><td>4.029</td></tr></table>
411
+
412
+ ![](images/45205e5986afb3b77f83307dfbcdbb41282e9fa667a1bae62ca443c7bd21ec94.jpg)
413
+ Figure 10: If the true hazard rate is now drawn according to a uniform distribution (with the same mean as before) the original hyperbolic discount matches the functional form better than exponential discounting. Numerical results in Table 3.
414
+ Table 3: The average mean squared error (MSE) over each of the paths in Figure 10 when the underlying hazard is drawn according to a uniform distribution. We find that hyperbolic discounting results is more robust to hazards drawn from a uniform distribution than exponential discounting.
415
+
416
+ # C ALTERNATIVE APPROACH TO HYPERBOLIC Q-VALUES
417
+
418
+ # C.1 COMPUTING HYPERBOLIC $Q$ -VALUES
419
+
420
+ Let’s start with the case where we would like to estimate the value function where rewards are discounted hyperbolically instead of the common exponential scheme. We refer to the hyperbolic Q-values as $\dot { Q } _ { \pi } ^ { \mathrm { { r } } }$ below in Equation 21
421
+
422
+ $$
423
+ \begin{array} { l } { { Q _ { \pi } ^ { \Gamma _ { k } } ( s , a ) = \mathbb { E } _ { \pi } \left[ \Gamma _ { k } ( 1 ) R ( s _ { 1 } , a _ { 1 } ) + \Gamma _ { k } ( 2 ) R ( s _ { 2 } , a _ { 2 } ) + \cdot \cdot \cdot \bigg | s , a \right] } } \\ { { \displaystyle \quad = \mathbb { E } _ { \pi } \left[ \sum _ { t } \Gamma _ { k } ( t ) R ( s _ { t } , a _ { t } ) \bigg | s , a \right] } } \end{array}
424
+ $$
425
+
426
+ We may relate the hyperbolic $Q _ { \pi } ^ { \Gamma }$ -value to the values learned through standard $Q$ -learning. To do so, notice that the hyperbolic discount $\Gamma _ { t }$ can be expressed as the integral of a certain function $f ( \gamma , t )$ for $\gamma = [ 0 , 1 )$ in Equation 22.
427
+
428
+ $$
429
+ \int _ { \gamma = 0 } ^ { 1 } \gamma ^ { k t } d \gamma = \frac { 1 } { 1 + k t } = \Gamma _ { k } ( t )
430
+ $$
431
+
432
+ The integral over this specific function $f ( \gamma , t ) = \gamma ^ { k t }$ yields the desired hyperbolic discount factor $\Gamma _ { k } ( t )$ by considering an infinite set of exponential discount factors $\gamma$ over its domain $\gamma \in [ 0 , 1 )$ .
433
+
434
+ Recognize that the integrand $\gamma ^ { k t }$ is the standard exponential discount factor which suggests a connection to standard Q-learning (Watkins & Dayan, 1992). This suggests that if we could consider an infinite set of $\gamma$ then we can combine them to yield hyperbolic discounts for the corresponding time-step $t$ . We build on this idea of modeling many $\gamma$ throughout this work.
435
+
436
+ We employ Equation 22 and return to the task of computing hyperbolic $\mathrm { Q }$ -values $Q _ { \pi } ^ { \Gamma } ( s , a ) ^ { 4 }$
437
+
438
+ $$
439
+ \begin{array} { r l } & { Q _ { \pi } ^ { \Gamma } ( s , a ) = \mathbb { E } _ { \pi } \left[ \displaystyle \sum _ { t } \Gamma _ { k } ( t ) R ( s _ { t } , a _ { t } ) \bigg | s , a \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { \pi } \left[ \displaystyle \sum _ { t } \left( \displaystyle \int _ { \gamma = 0 } ^ { 1 } \gamma ^ { k t } d \gamma \right) R ( s _ { t } , a _ { t } ) \bigg | s , a \right] } \\ & { \quad \quad = \displaystyle \int _ { \gamma = 0 } ^ { 1 } \mathbb { E } _ { \pi } \left[ \displaystyle \sum _ { t } R ( s _ { t } , a _ { t } ) ( \gamma ^ { k } ) ^ { t } \bigg | s , a \right] d \gamma } \\ & { \quad \quad = \displaystyle \int _ { \gamma = 0 } ^ { 1 } Q _ { \pi } ^ { ( \gamma k ) ^ { \dagger } } ( s , a ) d \gamma } \end{array}
440
+ $$
441
+
442
+ where $\Gamma _ { k } ( t )$ has been replaced on the first line by $\scriptstyle \left( \int _ { \gamma = 0 } ^ { 1 } \gamma ^ { k t } d \gamma \right)$ and the exchange is valid if $\textstyle \sum _ { t = 0 } ^ { \infty } \gamma ^ { k t } r _ { t } \ < \ \infty$ . This shows us that we can compute the $Q _ { \pi } ^ { \Gamma }$ -value according to hyperbolic discount factor by considering an infinite set of $Q _ { \pi } ^ { \gamma ^ { k } }$ -values computed through standard $Q$ -learning. Examining further, each $\gamma \in [ 0 , 1 )$ results in TD-errors learned for a new $\gamma ^ { \bar { k } }$ . For values of $k < 1$ , which extends the horizon of the hyperbolic discounting, this would result in larger $\gamma$ .
443
+
444
+ D VISUAL SUMMARY OF APPROACH
445
+
446
+ We summarize our approach for estimating non-exponential discounted Q-values here.
447
+
448
+ # 1.  A hyperbolic discount function
449
+
450
+ 2.  Hyperbolically­discounted Q­values can be expressed as a weighting over exponentially­discounted Q­values using the same weights $w ( \gamma )$ :
451
+
452
+ $$
453
+ \Gamma ( t ) = { \frac { 1 } { 1 + k t } }
454
+ $$
455
+
456
+ can be expressed as a weighting over exponential discount functions $\gamma ^ { t }$
457
+
458
+ $$
459
+ Q _ { \pi } ^ { \Gamma } ( s , a ) = \int _ { \gamma = 0 } ^ { 1 } w ( \gamma ) \ Q _ { \pi } ^ { \gamma } ( s , a ) \ d \gamma
460
+ $$
461
+
462
+ $$
463
+ \Gamma ( t ) = \int _ { \gamma = 0 } ^ { 1 } w ( \gamma ) \ \gamma ^ { t } d \gamma
464
+ $$
465
+
466
+ 4. Where a $Q _ { \pi } ^ { \gamma _ { i } } ( s , a )$ is simultaneously learned for each exponential discount rate $\gamma _ { i } \in \mathcal G$
467
+
468
+ with weights $\begin{array} { r } { w ( \gamma ) = \frac { 1 } { k } \gamma ^ { 1 / k - 1 } } \end{array}$ (see Table 1).
469
+
470
+ 3. The integral in box 2 can be approximated with a Riemann sum over the discrete intervals:⋯
471
+
472
+ $$
473
+ \mathcal { G } = [ \gamma _ { 0 } , \gamma _ { 1 } \cdots \gamma _ { N } ]
474
+ $$
475
+
476
+ $$
477
+ \mathcal { Q } _ { \pi } ^ { \Gamma } ( s , a ) \approx \sum _ { \gamma _ { i } \in \mathcal { G } } ( \gamma _ { i + 1 } - \gamma _ { i } ) \ w ( \gamma _ { i } ) \ Q _ { \pi } ^ { \gamma _ { i } } ( s , a )
478
+ $$
479
+
480
+ ![](images/8f33e6fa4c5c83e56d3533b995119e0bd4eaa9aaa22a444e91d887fe641429e4.jpg)
481
+ Figure 11: Summary of our approach to approximating hyperbolic (and other non-exponential) Q-values via a weighted sum of exponentially-discounted Q-vaulues.
482
+
483
+ Learning simultaneous exponential Q­values are effective auxiliary tasks.
484
+
485
+ # E EQUIVALENCE OF HYPERBOLIC DISCOUNTING AND EXPONENTIALHAZARD
486
+
487
+ Following Section A we also show a similar equivalence between hyperbolic discounting and the specific hazard distribution $\begin{array} { r } { p _ { k } ( \lambda ) = \frac { 1 } { k } \mathbf { e x p } ( - \lambda / \dot { k } ) } \end{array}$ , where again, $\lambda \in [ 0 , \infty )$
488
+
489
+ $$
490
+ \begin{array} { r l } { Q _ { x x } ^ { ( k ) ( 1 ) , \Gamma } ( s , \alpha ) = \mathbb { E } _ { \alpha , \beta } \Bigg [ \displaystyle \sum _ { i = 1 } ^ { \infty } \Gamma _ { k } ( \mathcal { I } ) R ( s , \alpha , \alpha _ { i } ) | s _ { i } = s , a _ { 0 } = \alpha \Bigg ] } \\ & { = \mathbb { E } _ { \alpha , \beta } \Bigg [ \displaystyle \sum _ { i = 1 } ^ { \infty } \Bigg ( \int _ { \lambda = 0 } ^ { \infty } p _ { k } ( \lambda ) e ^ { - \lambda } d \lambda \Bigg ) \prod ( s _ { i } , \alpha ) | s _ { 0 } = s , a _ { 0 } = \alpha \Bigg ] } \\ & { = \int _ { \lambda = 1 } ^ { \infty } p _ { k } ( \lambda ) \mathbb { E } _ { x , \beta _ { 0 } } \Bigg [ \displaystyle \sum _ { i = 0 } ^ { \infty } e ^ { - \lambda } H ( s _ { i } , \alpha _ { i } ) | s _ { 0 } = s , a _ { 0 } = \alpha \Bigg ] d \lambda } \\ & { = \mathbb { E } _ { \lambda \sim p _ { k } ( \lambda ) } \mathbb { E } _ { \gamma _ { 0 } , \gamma _ { 0 } } \Bigg [ \displaystyle \sum _ { i = 0 } ^ { \infty } e ^ { - \lambda } H ( \tilde { s } _ { i } , \alpha _ { i } ) | s _ { 0 } = s , a _ { 0 } = \alpha \Bigg ] } \\ & { = \mathbb { E } _ { \lambda \sim p _ { k } ( \lambda ) } \mathbb { E } _ { \gamma _ { 0 } , \gamma _ { 0 } } \Bigg [ \displaystyle \sum _ { i = 0 } ^ { \infty } H ( s _ { i } , \alpha _ { i } ) | s _ { 0 } = s , a _ { 0 } = \alpha \Bigg ] } \\ & { = \mathbb { E } _ { \lambda \sim p _ { k } ( \lambda ) } \mathbb { E } _ { \gamma _ { 0 } , \gamma _ { 0 } } \Bigg [ \displaystyle \sum _ { i = 0 } ^ { \infty } H ( s _ { i } , \alpha _ { i } ) | s _ { 0 } = s , a _ { 0 } = \alpha \Bigg ] } \\ & { = Q ^ { \alpha , \gamma _ { 1 } } ( s , \alpha ) } \end{array}
491
+ $$
492
+
493
+ Where the first step uses Equation 19. This equivalence implies that discount factors can be used to learn policies that are robust to hazards.
494
+
495
+ # F ALTERNATIVE DISCOUNT FUNCTIONS
496
+
497
+ We expand upon three special cases to see how functions $f ( \gamma , t ) = w ( \gamma ) \gamma ^ { t }$ may be related to different discount functions $d ( t )$ .
498
+
499
+ We summarize in Table 4 how a particular hazard prior $p ( \lambda )$ can be computed via integrating over specific weightings $w ( \gamma )$ and the corresponding discount function.
500
+
501
+ <table><tr><td></td><td>H=p(λ)</td><td>d(t)</td><td>w()</td></tr><tr><td>Dirac Delta Prior</td><td>8(入-k)</td><td>e-kt(=(γk)²)</td><td>1δ(-lnγ -k)</td></tr><tr><td>Exponential Prior</td><td>e-1/</td><td>1 1+kt</td><td>21/k-1</td></tr><tr><td>Uniform Prior</td><td>, ifλ∈[0,k] 0, otherwise</td><td>(1-e-kt)</td><td>{2-1, ifγ∈[e-𝑘,1] {0, otherwise</td></tr></table>
502
+
503
+ Table 4: Different hazard priors $\mathcal { H } = p ( \lambda )$ can be alternatively expressed through weighting exponential discount functions $\gamma ^ { t }$ by $w ( \gamma )$ . This table matches different hazard distributions to their associated discounting function and the weighting function per Lemma 3.1. The typical case in RL is a Dirac Delta Prior over hazard rate $\delta ( \lambda - k )$ . We only show this in detail for completeness; one would not follow such a convoluted path to arrive back at an exponential discount but this approach holds for richer priors. The derivations can be found in the Appendix F.
504
+
505
+ # Three cases:
506
+
507
+ 1. Delta hazard prior: $p ( \lambda ) = \delta ( \lambda - k )$
508
+ 2. Exponential hazard prior: $\begin{array} { r } { p ( \lambda ) = \frac { 1 } { k } e ^ { - \lambda / k } } \end{array}$
509
+ 3. Uniform hazard prior: $\begin{array} { r } { p ( \lambda ) = \frac { 1 } { k } } \end{array}$ for $\lambda \in [ 0 , k ]$
510
+
511
+ For the three cases we begin with the Laplace transform on the prior $\begin{array} { r } { p ( \lambda ) = \int _ { \lambda = 0 } ^ { \infty } p ( \lambda ) e ^ { - \lambda t } d \lambda } \end{array}$ and then chnage the variables according to the relation between $\gamma = e ^ { - \lambda }$ , Equation 17.
512
+
513
+ # F.1 DELTA HAZARD PRIOR
514
+
515
+ A delta prior $p ( \lambda ) = \delta ( \lambda - k )$ on the hazard rate is consistent with exponential discounting.
516
+
517
+ $$
518
+ \begin{array} { c } { { \displaystyle { \int _ { \lambda = 0 } ^ { \infty } p ( \lambda ) e ^ { - \lambda t } d \lambda = \int _ { \lambda = 0 } ^ { \infty } \delta ( \lambda - k ) e ^ { - \lambda t } d \lambda } } } \\ { { = e ^ { - k t } } } \end{array}
519
+ $$
520
+
521
+ where $\delta ( \lambda - k )$ is a Dirac delta function defined over variable $\lambda$ with value $k$ . The change of variable $\gamma = e ^ { - \dot { \lambda } }$ (equivalently $\lambda = - \ln \gamma ,$ ) yields differentials $\begin{array} { r } { d \lambda = - \frac { 1 } { \gamma } d \gamma } \end{array}$ and the limits $\lambda = 0 \gamma = 1$ and $\lambda = \infty \gamma = 0$ . Additionally, the hazard rate value $\lambda = k$ is equivalent to the $\gamma = e ^ { - k }$ .
522
+
523
+ $$
524
+ \begin{array} { l } { d ( t ) = \displaystyle \int _ { \lambda = 0 } ^ { \infty } p ( \lambda ) e ^ { - \lambda t } d \lambda } \\ { \displaystyle \quad = \int _ { \gamma = 1 } ^ { 0 } \delta ( - \ln \gamma - k ) \gamma ^ { t } \left( - \frac { 1 } { \gamma } d \gamma \right) } \\ { \displaystyle \quad = \int _ { \gamma = 0 } ^ { 1 } \delta ( - \ln \gamma - k ) \gamma ^ { t - 1 } d \gamma } \\ { \displaystyle \quad = e ^ { - k t } } \\ { \displaystyle \quad = \gamma _ { k } ^ { k } } \end{array}
525
+ $$
526
+
527
+ where we define a $\gamma _ { k } = e ^ { - k }$ to make the connection to standard RL discounting explicit. Additionally and reiterating, the use of a single discount factor, in this case $\gamma _ { k }$ , is equivalent to the prior that a single hazard exists in the environment.
528
+
529
+ # F.2 EXPONENTIAL HAZARD PRIOR
530
+
531
+ Again, the change of variable $\gamma = e ^ { - \lambda }$ yields differentials $\begin{array} { r } { d \lambda = - \frac { 1 } { \gamma } d \gamma } \end{array}$ and the limits $\lambda = 0 \gamma = 1$ and $\lambda = \infty \gamma = 0$ .
532
+
533
+ $$
534
+ \begin{array} { c } { { \displaystyle { \int _ { \lambda = 0 } ^ { \infty } p ( \lambda ) e ^ { - \lambda t } d \lambda = \int _ { \gamma = 1 } ^ { 0 } p ( - \mathrm { l n } \gamma ) \gamma ^ { t } \left( - \frac { 1 } { \gamma } d \gamma \right) } } } \\ { { = \displaystyle { \int _ { \gamma = 0 } ^ { 1 } p ( - \mathrm { l n } \gamma ) \gamma ^ { t - 1 } d \gamma } } } \end{array}
535
+ $$
536
+
537
+ where $p ( \cdot )$ is the prior. With the exponential prior $\begin{array} { r } { p ( \lambda ) = \frac { 1 } { k } \mathbf { e x p } ( - \lambda / k ) } \end{array}$ and by substituting $\lambda = - \mathrm { l n } \gamma$ we verify Equation 9
538
+
539
+ $$
540
+ \begin{array} { r l } { \displaystyle \int _ { 0 } ^ { 1 } \frac { 1 } { k } \exp ( \ln \gamma / k ) \gamma ^ { t - 1 } d \gamma = \frac { 1 } { k } \int _ { 0 } ^ { 1 } \exp ( \ln \gamma ^ { 1 / k } ) \gamma ^ { t - 1 } d \gamma } & { } \\ { = \frac { 1 } { k } \int _ { 0 } ^ { 1 } \gamma ^ { 1 / k + t - 1 } d \gamma } & { } \\ { = \frac { 1 } { k } \frac { 1 } { k } + t \gamma ^ { 1 / k + t } \bigg \vert _ { \gamma = 0 } ^ { 1 } } & { } \\ { = \frac { 1 } { 1 + k t } } & { } \end{array}
541
+ $$
542
+
543
+ # F.3 UNIFORM HAZARD PRIOR
544
+
545
+ Finally if we hold a uniform prior over hazard, $\frac { 1 } { k }$ for $\lambda \in [ 0 , k ]$ then Sozou (1998) shows the Laplace transform yields
546
+
547
+ $$
548
+ \begin{array} { c } { d ( t ) = \displaystyle \int _ { 0 } ^ { \infty } p ( \lambda ) e ^ { - \lambda t } d \lambda } \\ { \displaystyle = \frac { 1 } { k } \int _ { 0 } ^ { k } e ^ { - \lambda t } d \lambda } \\ { \displaystyle = - \frac { 1 } { k t } e ^ { - \lambda t } \biggl | _ { \lambda = 0 } ^ { k } } \\ { \displaystyle = \frac { 1 } { k t } \left( 1 - e ^ { - k t } \right) } \end{array}
549
+ $$
550
+
551
+ Use the same change of variables to relate this to $\gamma$ . The bounds of the integral become $\lambda = 0 $ γ = 1 and λ = k → γ = e−k.
552
+
553
+ $$
554
+ \begin{array} { l } { d ( t ) = \displaystyle - \frac { 1 } { k } \int _ { \gamma = 1 } ^ { e ^ { - k } } \gamma ^ { t - 1 } d \gamma } \\ { \displaystyle ~ = \frac { 1 } { k t } \gamma ^ { t } \Bigg | _ { \gamma = e ^ { - k } } ^ { 1 } } \\ { \displaystyle ~ = \frac { 1 } { k t } \left( 1 - e ^ { - k t } \right) } \end{array}
555
+ $$
556
+
557
+ which recovers the discounting scheme.
558
+
559
+ # G DETERMINING THE $\gamma$ INTERVAL
560
+
561
+ We provide further detail for which $\gamma$ we choose to model and motivation why. We choose a $\gamma _ { \mathrm { m a x } }$ which is the largest $\gamma$ to learn through Bellman updates. If we are using $k$ as the hyperbolic coefficient in Equation 19 and we are approximating the integral with $n _ { \gamma }$ our $\gamma _ { \mathrm { m a x } }$ would be
562
+
563
+ $$
564
+ \gamma _ { \operatorname* { m a x } } = \left( 1 - b ^ { n _ { \gamma } } \right) ^ { k }
565
+ $$
566
+
567
+ However, allowing $\gamma _ { \operatorname* { m a x } } 1$ get arbitrarily close to 1 may result in learning instabilities Bertsekas (1995). Therefore we compute an exponentiation base of $b = \exp ( \ln ( 1 - \gamma _ { \operatorname* { m a x } } ^ { 1 / k } ) / n _ { \gamma } )$ which bounds our $\gamma _ { \mathrm { m a x } }$ at a known stable value. This induces an approximation error which is described more in Appendix H.
568
+
569
+ # H APPROXIMATION ERRORS
570
+
571
+ Instead of evaluating the upper bound of Equation 9 at 1 we evaluate at $\gamma _ { \mathrm { m a x } }$ which yields $\gamma _ { \operatorname* { m a x } } ^ { k t } / ( 1 { + } k t )$ Our approximation induces an error in the approximation of the hyperbolic discount.
572
+
573
+ This approximation error in the Riemann sum increases as the $\gamma _ { \mathrm { m a x } }$ decreases as evidenced by Figure 12. When the maximum value of $\gamma _ { \mathrm { m a x } } 1$ then the approximation becomes more accurate as supported in Table 5 up to small random errors.
574
+
575
+ # I ESTIMATING HYPERBOLIC COEFFICIENTS
576
+
577
+ As discussed, we can estimate the hyperbolic discount in two different ways. We illustrate the resulting estimates here and resulting approximations. We use lower-bound Riemann sums in both cases for simplicity but more sophisticated integral estimates exist.
578
+
579
+ As noted earlier, we considered two different integrals for computed the hyperbolic coefficients. Under the form derived by the Laplace transform, the integrals are sharply peaked as $\gamma 1$ . The difference in integrals is visually apparent comparing in Figure 13.
580
+
581
+ <table><tr><td colspan="2">Discount function</td></tr><tr><td>max-y=0.999</td><td>MSE 0.002</td></tr><tr><td>max-y=0.9999</td><td>0.003</td></tr><tr><td>max-y=0.99</td><td>0.233</td></tr><tr><td>max-y=0.95</td><td>1.638</td></tr><tr><td>max-y=0.9</td><td>2.281</td></tr></table>
582
+
583
+ ![](images/196e08fb2e9618e1b5564f810709e3f97c27fc6bce2ac77deda937147e664bbf.jpg)
584
+ Figure 12: By instead evaluating our integral up to $\gamma _ { \mathrm { m a x } }$ rather than to 1, we induce an approximation error which increases with $t$ . Numerical results in Table 5.
585
+ Table 5: The average mean squared error (MSE) over each of the paths in Figure 12.
586
+
587
+ ![](images/79d1ecea75c2ec65a4ed15104f82f26850b1f6cb21d334e7cb211c9741bc6077.jpg)
588
+ Figure 13: Comparison of hyperbolic coefficient integral estimation between the two approaches. (a) We approximate the integral of the function $\gamma ^ { k t }$ via a lower estimate of rectangles at specific $\gamma$ -values. The sum of these rectangles approximates the hyperbolic discounting scheme $1 / ( \bar { 1 } + k t )$ for time $t$ . (b) Alternative form for approximating hyperbolic coefficients which is sharply peaked as $\gamma 1$ which led to larger errors in estimation under our initial techniques.
589
+
590
+ # J PERFORMANCE OF DIFFERENT REPLAY BUFFER PRIORITIZATION SCHEME
591
+
592
+ As found through our ablation study in Figure 7, the Multi-Rainbow auxiliary task interacted poorly with the prioritized replay buffer when the TD-errors were averaged evenly across all heads. As an alternative scheme, we considered prioritizing according to the largest $\gamma$ , which is also the $\gamma$ defining the $Q$ -values by which the agent acts.
593
+
594
+ The (preliminary5) results of this new prioritization scheme is in Figure 14.
595
+
596
+ Multi-Rainbow Improvement over Rainbow (prioritize-largest)
597
+
598
+ ![](images/d16eec25ccd08a55e1ed37cee7f5da646c23793f1567d475d9f1f774c6b36c1e.jpg)
599
+ Figure 14: The (preliminary) performance improvement over Rainbow using the multi-horizon auxiliary task in Atari Learning Environment when we instead prioritize according to the TD-errors computed from the largest $\gamma$ (3 seeds each).
600
+
601
+ To this point, there is evidence that prioritizing according to the TD-errors generated by the largest gamma is a better strategy than averaging.
602
+
603
+ # K HYPERPARAMETERS
604
+
605
+ For all our experiments in DQN Mnih et al. (2015), C51 Bellemare et al. (2017) and Rainbow Hessel et al. (2018), we benchmark against the baselines set by Castro et al. (2018) and we use the default hyperparameters for each of the respective algorithms. That is, our Multi-agent uses the same optimization, learning rates, and hyperparameters as it’s base class.
606
+
607
+ Table 6: Configurations for the Multi-C51 and Multi-Rainbow used with Dopamine Castro et al. (2018).
608
+
609
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Runner.sticky_actions</td><td>Sticky actions prob 0.25</td></tr><tr><td>Runner.num_iterations</td><td>200</td></tr><tr><td>Runner.training_steps</td><td>250000</td></tr><tr><td>Runner.evaluation_steps</td><td>125000</td></tr><tr><td>Runner.max_steps_per_episode</td><td>27000</td></tr><tr><td>WrappedPrioritizedReplayBuffer.replay_capacity WrappedPrioritizedReplayBuffer.batch_size</td><td>1000000 32</td></tr><tr><td>RainbowAgent.num_atoms</td><td></td></tr><tr><td>RainbowAgent.vmax</td><td>51 10.</td></tr><tr><td>RainbowAgent.update_horizon</td><td>3</td></tr><tr><td></td><td></td></tr><tr><td>RainbowAgent.min_replay_history</td><td>20000</td></tr><tr><td>RainbowAgent.update_period RainbowAgent.target_update_period</td><td>4</td></tr><tr><td></td><td>8000</td></tr><tr><td>RainbowAgent.epsilon_train</td><td>0.01</td></tr><tr><td>RainbowAgent.epsilon_eval</td><td>0.001</td></tr><tr><td>RainbowAgent.epsilon_decay_period</td><td>250000</td></tr><tr><td>RainbowAgent.replay_scheme</td><td>&#x27;prioritized&#x27;</td></tr><tr><td>RainbowAgent.tf_device</td><td>&#x27;/gpu:0&#x27;</td></tr><tr><td>RainbowAgent.optimizer</td><td>@tf.train.AdamOptimizer()</td></tr><tr><td>tf.train.AdamOptimizer.learning_rate tf.train.AdamOptimizer.epsilon</td><td>0.0000625 0.00015</td></tr><tr><td></td><td></td></tr><tr><td>HyperRainbowAgent.number_of_gamma</td><td>10</td></tr><tr><td>HyperRainbowAgent.gamma_max</td><td>0.99</td></tr><tr><td>HyperRainbowAgent.hyp_exponent</td><td>0.01</td></tr><tr><td>HyperRainbowAgent.acting_policy</td><td>&#x27;largest_gamma&#x27;</td></tr></table>
610
+
611
+ # L AUXILIARY TASK RESULTS
612
+
613
+ Final results of the multi-horizon auxiliary task on Rainbow (Multi-Rainbow) in Table 7.
614
+
615
+ <table><tr><td rowspan="2">Game Name</td><td rowspan="2">DQN</td><td rowspan="2">C51</td><td rowspan="2">Rainbow</td><td rowspan="2">Multi-Rainb</td></tr><tr><td></td></tr><tr><td>AirRaid</td><td>8190.3</td><td>9191.2</td><td>16941.2</td><td>12659.5</td></tr><tr><td>Alien</td><td>2666.0</td><td>2611.4</td><td>3858.9</td><td>3917.2</td></tr><tr><td>Amidar</td><td>1306.0</td><td>1488.2</td><td>2805.7</td><td>2477.0</td></tr><tr><td>Assault</td><td>1661.6</td><td>2079.0</td><td>3815.9</td><td>3415.1</td></tr><tr><td>Asterix</td><td>3772.5</td><td>15289.5</td><td>19789.2</td><td>24385.6</td></tr><tr><td>Asteroids</td><td>844.7</td><td>1241.5</td><td>1524.1</td><td>1654.5</td></tr><tr><td>Atlantis</td><td>935784.0</td><td>894862.0</td><td>890592.0</td><td>923276.7</td></tr><tr><td>BankHeist</td><td>723.5</td><td>863.4</td><td>1209.0</td><td>1132.0</td></tr><tr><td>BattleZone</td><td>20508.5</td><td>28323.2</td><td>42911.1</td><td>38827.1</td></tr><tr><td>BeamRider</td><td>6326.4</td><td>6070.6</td><td>7026.7</td><td>7610.9</td></tr><tr><td>Berzerk</td><td>590.3</td><td>538.3</td><td>864.0</td><td>879.1</td></tr><tr><td>Bowling</td><td>40.3</td><td>49.8</td><td>68.8</td><td>62.9</td></tr><tr><td>Boxing</td><td>83.3</td><td>83.5</td><td>98.8</td><td>99.3</td></tr><tr><td>Breakout</td><td>146.6</td><td>254.1</td><td>123.9</td><td>162.5</td></tr><tr><td>Carnival</td><td>4967.9</td><td>4917.1</td><td>5211.8</td><td>5072.2</td></tr><tr><td>Centipede</td><td>3419.9</td><td>8068.9</td><td>6878.0</td><td>6946.6</td></tr><tr><td>ChopperCommand</td><td>3084.5</td><td>6230.4</td><td>13415.1</td><td>13942.9</td></tr><tr><td>CrazyClimber</td><td>113992.2</td><td>146072.3</td><td>151454.9</td><td>160161.0</td></tr><tr><td>DemonAttack</td><td>7229.2</td><td>8485.1</td><td>19738.0</td><td>14780.9</td></tr><tr><td>DoubleDunk</td><td>-4.5</td><td>2.7</td><td>22.6</td><td>21.9</td></tr><tr><td>ElevatorAction</td><td>2434.3</td><td>73416.0</td><td>81958.0</td><td>85633.3</td></tr><tr><td>Enduro</td><td>895.0</td><td>1652.9</td><td>2290.1</td><td>2337.5</td></tr><tr><td>FishingDerby</td><td>12.4</td><td>16.6</td><td>44.5</td><td>45.1</td></tr><tr><td>Freeway</td><td>26.3</td><td>33.8</td><td>33.8</td><td>33.8</td></tr><tr><td>Frostbite</td><td>1609.6</td><td>4522.8</td><td>8988.5</td><td>7929.7</td></tr><tr><td>Gopher</td><td>6685.8</td><td>8301.1</td><td>11749.6</td><td>13664.6</td></tr><tr><td>Gravitar</td><td>339.1</td><td>709.8</td><td>1293.0</td><td>1638.7</td></tr><tr><td>Hero</td><td>17548.5</td><td>34117.8</td><td>47545.4</td><td>50141.8</td></tr><tr><td>IceHockey</td><td>-5.0</td><td>-3.3</td><td>2.6</td><td>6.3</td></tr><tr><td>Jamesbond</td><td>618.3</td><td>816.5</td><td>1263.8</td><td>773.4</td></tr><tr><td>JourneyEscape</td><td>-2604.2</td><td>-1759.1</td><td>-818.1</td><td>-1002.9</td></tr><tr><td>Kangaroo</td><td>13118.1</td><td>9419.7</td><td>13794.0</td><td>13930.6</td></tr><tr><td>Krull</td><td>6558.0</td><td>7232.3</td><td>6292.5</td><td>6645.7</td></tr><tr><td>KungFuMaster</td><td>26161.2</td><td>27089.5</td><td>30169.6</td><td>31635.2</td></tr><tr><td>MontezumaRevenge</td><td>2.6</td><td>1087.5</td><td>501.3</td><td>800.3</td></tr><tr><td>MsPacman NameThisGame</td><td>3664.0</td><td>3986.2</td><td>4254.2</td><td>4707.3</td></tr><tr><td></td><td>7808.1</td><td>12934.0</td><td>9658.9</td><td>11045.9</td></tr><tr><td>Phoenix</td><td>5893.4</td><td>6577.3</td><td>8979.0</td><td>23720.3</td></tr><tr><td>Pitfall</td><td>-11.8</td><td>-5.3</td><td>0.0</td><td>0.0</td></tr><tr><td>Pong Pooyan</td><td>17.4</td><td>19.7</td><td>20.3</td><td>20.6</td></tr><tr><td>PrivateEye</td><td>3800.8</td><td>3771.2</td><td>6347.7</td><td>4670.0</td></tr><tr><td>Qbert</td><td>2051.8</td><td>19868.5</td><td>21591.4</td><td>888.9</td></tr><tr><td>Riverraid</td><td>11011.4</td><td>11616.6</td><td>19733.2</td><td>20817.4</td></tr><tr><td></td><td>12502.4</td><td>13780.4</td><td>21624.2</td><td>21421.2</td></tr><tr><td>RoadRunner</td><td>40903.3</td><td>49039.8</td><td>56527.4</td><td>55613.0</td></tr><tr><td>Robotank</td><td>62.5</td><td>64.7</td><td>67.9</td><td>67.2</td></tr><tr><td>Seaquest</td><td>2512.4</td><td>38242.7</td><td>11791.5</td><td>64985.0</td></tr><tr><td>Skiing</td><td>-15314.9</td><td>-17996.7</td><td>-17792.9</td><td>-15603.3</td></tr><tr><td>Solaris</td><td>2062.7</td><td>2788.0</td><td>3061.9</td><td>3139.9</td></tr><tr><td>SpaceInvaders</td><td>1976.0</td><td>4781.9</td><td>4927.9</td><td>8802.1</td></tr><tr><td>StarGunner</td><td>47174.3</td><td>35812.4</td><td>58630.5</td><td>72943.2</td></tr><tr><td>Tennis</td><td>-0.0</td><td>22.2</td><td>0.0</td><td>0.0</td></tr><tr><td>TimePilot</td><td>3862.5</td><td>8562.7</td><td>12486.1</td><td>14421.7</td></tr><tr><td>Tutankham</td><td>141.1</td><td>253.1</td><td>255.6</td><td>264.9</td></tr><tr><td>UpNDown</td><td>10977.6</td><td>9844.8</td><td>42572.5</td><td>50862.3</td></tr><tr><td>Venture</td><td>88.0</td><td>1430.7</td><td>1612.4</td><td>1639.9</td></tr><tr><td>VideoPinball</td><td>222710.4</td><td>594468.5</td><td>651413.1</td><td>650701.1</td></tr><tr><td>WizardofWor</td><td>3150.8</td><td>3633.8</td><td>8992.3</td><td>9318.9</td></tr><tr><td>YarsRevenge</td><td>25372.0</td><td>12534.2</td><td>47183.8</td><td>49929.4</td></tr><tr><td>Zaxxon</td><td>5199.9</td><td>7509.8</td><td>15906.2</td><td>21921.3</td></tr></table>
616
+
617
+ Table 7: Multi-Rainbow agent returns versus the DQN, C51 and Rainbow agents of Dopamine Castro et al. (2018).
md/train/ryHlUtqge/ryHlUtqge.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERALIZING SKILLS WITH SEMI-SUPERVISED REINFORCEMENT LEARNING
2
+
3
+ Chelsea $\mathbf { F i n n } \dagger$ , Tianhe $\mathbf { V } \mathbf { u } \dagger$ , Justin $\mathbf { F u } \dagger$ , Pieter Abbeel $^ { \dagger \ddagger }$ , Sergey Levine† † Berkeley AI Research (BAIR), University of California, Berkeley ‡ OpenAI {cbfinn,tianhe.yu,justinfu,pabbeel,svlevine}@berkeley.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Deep reinforcement learning (RL) can acquire complex behaviors from low-level inputs, such as images. However, real-world applications of such methods require generalizing to the vast variability of the real world. Deep networks are known to achieve remarkable generalization when provided with massive amounts of labeled data, but can we provide this breadth of experience to an RL agent, such as a robot? The robot might continuously learn as it explores the world around it, even while it is deployed and performing useful tasks. However, this learning requires access to a reward function, to tell the agent whether it is succeeding or failing at its task. Such reward functions are often hard to measure in the real world, especially in domains such as robotics and dialog systems, where the reward could depend on the unknown positions of objects or the emotional state of the user. On the other hand, it is often quite practical to provide the agent with reward functions in a limited set of situations, such as when a human supervisor is present, or in a controlled laboratory setting. Can we make use of this limited supervision, and still benefit from the breadth of experience an agent might collect in the unstructured real world? In this paper, we formalize this problem setting as semisupervised reinforcement learning (SSRL), where the reward function can only be evaluated in a set of “labeled” MDPs, and the agent must generalize its behavior to the wide range of states it might encounter in a set of “unlabeled” MDPs, by using experience from both settings. Our proposed method infers the task objective in the unlabeled MDPs through an algorithm that resembles inverse RL, using the agent’s own prior experience in the labeled MDPs as a kind of demonstration of optimal behavior. We evaluate our method on challenging, continuous control tasks that require control directly from images, and show that our approach can improve the generalization of a learned deep neural network policy by using experience for which no reward function is available. We also show that our method outperforms direct supervised learning of the reward.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Reinforcement learning (RL) provides a powerful framework for learning behavior from highlevel goals. RL has been combined with deep networks to learn policies for problems such as Atari games (Mnih et al., 2015), simple Minecraft tasks (Oh et al., 2016), and simulated locomotion (Schulman et al., 2015). To apply reinforcement learning (RL) to real-world scenarios, however, the learned policy must be able to handle the variability of the real-world and generalize to scenarios that it has not seen previously. In many such domains, such as robotics and dialog systems, the variability of the real-world poses a significant challenge. Methods for training deep, flexible models combined with massive amounts of labeled data are known to enable wide generalization for supervised learning tasks (Russakovsky et al., 2015). Lifelong learning aims to address this data challenge in the context of RL by enabling the agent to continuously learn as it collects new experiences “on the job,” directly in the real world (Thrun & Mitchell, 1995). However, this learning requires access to a reward function, to tell the agent whether it is succeeding or failing at its task. Although the reward is a high-level supervision signal that is in principle easier to provide than detailed labels, in practice it often depends on information that is extrinsic to the agent and is therefore difficult to measure in the real world. For example, in robotics, the reward may depend on the poses of all of the objects in the environment, and in dialog systems, the reward may depend on the happiness of the user. This reward supervision is practical to measure in a small set of instrumented training scenarios, in laboratory settings, or under the guidance of a human teacher, but quickly becomes impractical to provide continuously to a lifelong learning system, when the agent is deployed in varied and diverse real-world settings.
12
+
13
+ ![](images/f56d4c48e37ccac7e48d7456f17a8bfccbe7bb25b978c67ac9e39a5d12d6973c.jpg)
14
+ Figure 1: We consider the problem of semi-supervised reinforcement learning, where a reward function can be evaluated in some small set of labeled MDPs $\mathcal { M } \in L$ , but the resulting policy must be successful on a larger set of unlabeled MDPs $\mathcal { M } \in L$ for which the reward function is not known. In standard RL, the policy is trained only on the labeled MDPs, while in transfer learning, the policy is finetuned using a known reward function in the unlabeled MDP set. Semi-supervised RL is distinct in that it involves using experience from the unlabeled set without access to the reward function.
15
+
16
+ Conceptually, we might imagine that this challenge should not exist, since reinforcement learning should, at least in principle, be able to handle high-level delayed rewards that can always be measured. For example, a human or animal might have their reward encode some higher-level intrinsic goals such as survival, reproduction, or the absence of pain and hunger. However, most RL methods do not operate at the level of such extremely sparse and high-level rewards, and most of the successes of RL have been in domains with natural sources of detailed external feedback, such as the score in a video game. In most real-world scenarios, such a natural and convenient score typically does not exist. It therefore seems that intelligent agents in the real world should be able to cope with only partial reward supervision, and that algorithms that enable this are of both of practical and conceptual value, since they bring us closer to real-world lifelong reinforcement learning, and can help us understand adaptive intelligent systems that can learn even under limited supervisory feedback. So how can an agent continue to learn in the real world without access to a reward function?
17
+
18
+ In this work, we formalize this as the problem of semi-supervised reinforcement learning, where the agent must perform RL when the reward function is known in some settings, but cannot be evaluated in others. As illustrated in Figure 1, we assume that the agent can first learn in a small range of “labeled” scenarios, where the reward is available, and then experiences a wider range of “unlabeled” scenarios where it must learn to act successfully, akin to lifelong learning in the real world. This problem statement can be viewed as being analogous to the problem of semi-supervised learning, but with the additional complexity of sequential decision making. Standard approaches to RL simply learn a policy in the scenarios where a reward function is available, and hope that it generalizes to new unseen conditions. However, it should be possible to leverage unlabeled experiences to find a more general policy, and to achieve continuous improvement from lifelong real-world experience.
19
+
20
+ Our main contribution is to propose and evaluate the first algorithm for performing semi-supervised reinforcement learning, which we call semi-supervised skill generalization (S3G). Our approach can leverage unlabeled experience to learn a policy that can succeed in a wider variety of scenarios than a policy trained only with labeled experiences. In our method, we train an RL policy in settings where a reward function is available, and then run an algorithm that resembles inverse reinforcement learning, to simultaneously learn a reward and a more general policy in the wider range of unlabeled settings. Unlike traditional applications of inverse RL algorithms, we use roll-outs from the RL policy in the labeled conditions as demonstrations, rather than a human expert, making our method completely autonomous. Although our approach is compatible with any choice of reinforcement learning and inverse reinforcement learning algorithm, we use the guided cost learning method in our experimental evaluation, which allows us to evaluate on high-dimensional, continuous robotic manipulation tasks with unknown dynamics while using a relatively modest number of samples (Finn et al., 2016). We compare our method to two baselines: (a) a policy trained with RL in settings where reward labels are available (as is standard), and (b) a policy trained in the unlabeled settings using a reward function trained to regress to available reward labels. We find that S3G recovers a policy that is substantially more effective than the prior, standard approach in a wide variety of settings, without using any additional labeled information. We also find that, by using an inverse RL objective, our method achieves superior generalization to the reward regression approach.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ Utilizing both labeled and unlabeled data is a well-known technique that can improve learning performance when data is limited (Zhu & Goldberg, 2009). These techniques are especially important in domains where large, supervised datasets are difficult to acquire, but unlabeled data is plentiful. This problem is generally known as semi-supervised learning. Methods for solving this problem often include propagating known labels to the unlabeled examples (Zhu & Ghahramani, 2002) and using regularizing side information (Szummer & Jaakkola, 2002) such as the structure of the data. Semi-supervised learning has been performed with deep models, either by blending unsupervised and supervised objectives (Rasmus et al., 2016; Zhang et al., 2016) or by using generative models, with the labels treated as missing data (Kingma et al., 2014). Semi-supervised learning is particularly relevant in robotics and control, where collecting labeled experience on real hardware is expensive. However, while semi-supervised learning has been successful in domains such as object tracking and detection (Teichman & Thrun, 2007), applications to action and control have not been applied to the objective of the task itself.
25
+
26
+ The generalization capabilities of policies learned through RL (and deep RL) has been limited, as pointed out by Oh et al. Oh et al. (2016). That is, typically the settings under which the agent is tested do not vary from those under which it was trained. We develop a method for generalizing skills to a wider range of settings using unlabeled experience. A related but orthogonal problem is transfer learning (Taylor & Stone, 2009; Barrett et al., 2010), which attempts to use prior experience in one domain to improve training performance in another. Transfer learning has been applied to RL domains for transferring information across environments (Mordatch et al., 2016; Tzeng et al., 2016), robots (Devin et al., 2016), and tasks (Konidaris & Barto, 2006; Stolle & Atkeson, 2007; Dragan et al., 2011; Parisotto et al., 2016; Rusu et al., 2016). The goal of these approaches is typically to utilize experience in a source domain to learn faster or better in the target domain. Unlike most transfer learning scenarios, we assume that supervision cannot be obtained in many scenarios. We are also not concerned with large, systematic domain shift: we assume that the labeled and unlabeled settings come from the same underlying distribution. Note, however, that the method that we develop could be used for transfer learning problems where the state and reward are consistent across domains.
27
+
28
+ To the best of our knowledge, this paper is the first to provide a practical and tractable algorithm for semi-supervised RL with large, expressive function approximators, and illustrate that such learning actually improves the generalization of the learned policy. However, the idea of semi-supervised reinforcement learning procedures has been previously discussed as a compelling research direction by Christiano (2016) and Amodei et al. (2016).
29
+
30
+ To accomplish semi-supervised reinforcement learning, we propose a method that resembles an inverse reinforcement learning (IRL) algorithm, in that it imputes the reward function in the unlabeled settings by learning from the successful trials in the labeled settings. IRL was first introduced by $\mathrm { N g }$ et al. (2000) as the problem of learning reward functions from expert, human demonstrations, typically with the end goal of learning a policy that can succeed from states that are not in the set of demonstrations (Abbeel & Ng, 2004). We use IRL to infer the reward function underlying a policy previously learned in a small set of labeled scenarios, rather than using expert demonstrations. We build upon prior methods, including guided cost learning, which propose to learn a cost and a policy simultaneously (Finn et al., 2016; Ho et al., 2016). Note that the problem that we are considering is distinct from semi-supervised inverse reinforcement learning Audiffren et al. (2015), which makes use of expert and non-expert trajectories for learning. We require a reward function in some instances, rather than expert demonstrations.
31
+
32
+ # 3 SEMI-SUPERVISED REINFORCEMENT LEARNING
33
+
34
+ We first define semi-supervised reinforcement learning. We would like the problem definition to be able to capture situations where supervision, via the reward function, is only available in a small set of labeled Markov decision processes (MDPs), but where we want our agent to be able to continue to learn to perform successfully in a much larger set of unlabeled MDPs, where reward labels are unavailable. For example, if the task corresponds to an autonomous car learning to drive, the labeled MDPs might correspond to a range of closed courses, while the unlabeled MDPs might involve driving on real-world highways and city streets. We use the terms labeled and unlabeled in analogy to semi-supervised learning, but note a reward observation is not as directly informative as a label.
35
+
36
+ Formally, we consider a distribution $p ( \mathcal { M } )$ over undiscounted finite-horizon MDPs, each defined as a 4-tuple $\mathcal { M } _ { i } = ( S , A , T , R )$ over states, actions, transition dynamics (which are generally unknown), and reward. The states and actions may be continuous or discrete, and the reward function $R$ is assumed to the same across MDPs in the distribution $p ( \mathcal { M } )$ . Let $L$ and $U$ denote two sets of MDPs sampled from the distribution $p ( \mathcal { M } )$ . Experience may be collected in both sets of MDPs, but the reward can only be evaluated in the set of labeled MDPs $L$ . The objective is to find a policy $\pi ^ { * }$ that maximizes expected reward in the distribution over MDPs:
37
+
38
+ $$
39
+ \pi ^ { * } = \underset { \pi } { \arg \operatorname* { m a x } } ~ \mathbb { E } _ { \pi , p ( \mathcal { M } ) } \left[ \sum _ { t = 0 } ^ { H } R ( s _ { t } , a _ { t } ) \right] ,
40
+ $$
41
+
42
+ where $H$ denotes the horizon. Note that the notion of finding a policy that succeeds on a distribution of MDPs is very natural in many real-world reinforcement learning problems. For example, in the earlier autonomous driving example, our goal is not to find a policy that succeeds on one particular road or in one particular city, but on all roads that the car might encounter. Note that the problem can also be formalized in terms of a single large MDP with a large diversity of initial states, but viewing the expectation as being over a distribution of MDPs provides a more natural analogue with semi-supervised learning, as we discuss below.
43
+
44
+ In standard semi-supervised learning, it is assumed that the data distribution is the same across both labeled and unlabeled examples, and the amount of labeled data is limited. Similarly, semisupervised reinforcement learning assumes that the labeled and unlabeled MDPs are sampled from the same distribution. In SSRL, however, it is the set of labeled MDPs that is limited, whereas acquiring large amounts of experience within the set of labeled MDPs is permissible, though unlimited experience in the labeled MDPs is not sufficient on its own for good performance on the entire MDP distribution. This is motivated by real-world lifelong learning, where an agent (e.g. a robot) may be initially trained with detailed reward information in a small set of scenarios (e.g. with a human teacher), and is then deployed into a much larger set of scenarios, without reward labels. One natural question is how much variation can exist in the distribution over MDPs. We empirically answer this question in our experimental evaluation in Section 5.
45
+
46
+ The standard paradigm in reinforcement learning is to learn a policy in the labeled MDPs and apply it directly to new MDPs from the same distribution, hoping that the original policy will generalize (Oh et al., 2016). An alternative approach is to train a reward function with supervised learning to regress from the agent’s observations to the reward labels, and then use this reward function for learning in the unlabeled settings. In our experiments, we find that this approach is often more effective because, unlike the policy, the reward function is decoupled from the rest of the MDP, and can thus generalize more readily. The agent can then continue to learn from unlabeled experiences using the learned reward function. However, because the state distributions in the two sets of MDPs may be different, a function approximator trained on the reward function in the labeled MDPs may not necessarily generalize well to the unlabeled one, due to the domain shift. A more effective solution would be to incorporate the unlabeled experience sampled from $U$ when learning the reward. Unlike typical semi-supervised learning, the goal is not to learn the reward labels per se, but to learn a policy that optimizes the reward. By incorporating both labeled and unlabeled experience, we can develop an algorithm that alternates between inferring the reward function and updating the policy, which effectively provides a shaping, or curriculum, for learning to perform well in the unlabeled settings. In the following section, we discuss our proposed algorithm in detail.
47
+
48
+ # 4 SEMI-SUPERVISED SKILL GENERALIZATION
49
+
50
+ We now present our approach for performing semi-supervised reinforcement learning for generalizing previously learned skills. As discussed previously, our goal is to learn a policy that maximizes expected reward in ${ \mathcal { M } } \in U$ , using both unlabeled experience in $U$ and labeled experience in $L$ . We will use the formalism adopted in the previous section; however, note that performing RL in a set of MDPs can be equivalently be viewed as a single MDP with a large diversity of initial conditions.
51
+
52
+ In order to perform semi-supervised reinforcement learning, we use the framework of maximum entropy control (Ziebart, 2010; Kappen et al., 2012), also called linear-solvable MDPs (Dvijotham & Todorov, 2010). This framework is a generalization of the standard reinforcement learning formulation, where instead of optimizing the expected reward, we optimize an entropy-regularized objective of the form
53
+
54
+ $$
55
+ \pi _ { \mathrm { R L } } = \underset { \pi } { \arg \operatorname* { m a x } } \mathbb { E } _ { \pi , \mathcal { M } \in L } \left[ \sum _ { t = 0 } ^ { H } R ( s _ { t } , a _ { t } ) \right] - \mathcal { H } ( \pi ) .
56
+ $$
57
+
58
+ To see that this is a generalization of the standard RL setting, observe that, as the magnitude of the reward increases, the relative weight on the entropy regularizer decreases, so the classic RL objective can be recovered by putting a temperature $\beta$ on the reward, and taking the limit as $\beta \to \infty$ . For finite rewards, this objective encourages policies to take random actions when all options have roughly equal value. Under the optimal policy $\pi _ { \mathrm { R L } }$ , samples with the highest reward $R$ have the highest likelihood, and the likelihood decreases exponentially with decrease in reward. In our work, this framework helps to produce policies in the labeled MDP that are diverse, and therefore better suited for inferring reward functions that transfer effectively to the unlabeled MDP.
59
+
60
+ After training $\pi _ { \mathrm { R L } }$ , we generate a set of samples from $\pi _ { \mathrm { R L } }$ in $L$ , which we denote as $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ . The objective of S3G is to use $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ to find a policy that maximizes expected reward in $U$ ,
61
+
62
+ $$
63
+ \operatorname* { m a x } _ { \theta } \ \mathbb { E } _ { \pi _ { \theta } , \mathcal { M } \in U } \left[ \sum _ { t = 0 } ^ { T } R ( s _ { t } , a _ { t } ) \right] - \mathcal { H } ( \pi _ { \theta } ) ,
64
+ $$
65
+
66
+ where the reward $R$ is not available. By using the agent’s prior experience $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ , as well as unlabeled experience in $U$ , we aim to learn a well-shaped reward function to facilitate learning in $U$ . To do so, S3G simultaneously learns a reward function ${ \tilde { R } } _ { \phi }$ with parameters $\phi$ and optimizes a policy $\pi _ { \theta }$ with parameters $\theta$ in the unlabeled MDP $U$ . This consists of iteratively taking samples ${ \mathcal { D } } _ { \pi _ { \theta } }$ from the current policy $\pi _ { \theta }$ in $U$ , updating the reward ${ \tilde { R } } _ { \phi }$ , and updating the policy $\pi$ using reward values imputed using ${ \tilde { R } } _ { \phi }$ . At the end of the procedure, we end up with a policy $\pi _ { \theta }$ optimized in $U$ . As shown in prior work, this procedure corresponds to an inverse reinforcement learning algorithm that converges to a policy that matches the performance observed in $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ (Finn et al., 2016). We next go over the objectives used for updating the reward and the policy.
67
+
68
+ Reward update: Because of the entropy regularized objective in Equation 1, it follows that the samples $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ are generated from the following maximum entropy distribution (Ziebart, 2010):
69
+
70
+ $$
71
+ p ( \tau ) = \frac { 1 } { Z } \exp ( R ( \tau ) ) ,
72
+ $$
73
+
74
+ where $\tau$ denotes a single trajectory sample $\left\{ s _ { 0 } , a _ { 0 } , s _ { 1 } , a _ { 1 } , . . . , s _ { T } \right\}$ and $\begin{array} { r } { R ( \tau ) = \sum _ { t } R \big ( s _ { t } , a _ { t } \big ) } \end{array}$ . Thus, the objective of the reward optimization phase is to maximize the log likelihood of the agent’s prior experience $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ under this exponential model. The computational challenge here is to estimate the partition function $Z$ which is intractable to compute in high-dimensional spaces. We thus use importance sampling, using samples to estimate the partition function $Z$ as follows:
75
+
76
+ $$
77
+ \mathcal { L } ( \phi ) = \sum _ { \tau \sim \mathcal { D } _ { \pi _ { \mathrm { L } } } } \tilde { R } _ { \phi } ( \tau ) - \log Z ~ \approx \sum _ { \tau \sim \mathcal { D } _ { \pi _ { \mathrm { R } } } } \tilde { R } _ { \phi } ( \tau ) - \log \sum _ { \tau \sim \mathcal { D } _ { \mathrm { s a m p } } } \frac { \exp ( \tilde { R } _ { \phi } ( \tau ) ) } { q ( \tau ) } ,
78
+ $$
79
+
80
+ where $\mathcal { D } _ { \mathrm { s a m p } }$ is the set of samples used for estimating the partition function $Z$ and $q ( \tau )$ is the probability of sampling $\tau$ under the policy it was generated from. Note that the distribution of this set of samples is crucial for effectively estimating $Z$ . The optimal distribution for importance sampling is the one that is proportional to $\dot { q ( \tau ) } \propto | \exp ( \tilde { R } _ { \phi } ( \tau ) ) | = \exp ( \tilde { R } _ { \phi } ( \tau ) )$ . Conveniently, this is also the optimal behavior when the reward function is fully optimized such that $\tilde { R } _ { \phi } \approx R$ . Thus, we adaptively update the policy to minimize the KL-divergence between its own distribution and the distribution induced by the current reward, $\tilde { R } _ { \phi } ( \tau )$ , and use samples from the policy to estimate the partition function. Since the importance sampling estimate of $Z$ will be high variance at the beginning of training when fewer policy samples have been collected, we also use the samples from the RL policy $\pi _ { \mathrm { R L } }$ . Thus we set $\mathcal { D } _ { \mathrm { s a m p } }$ to be $\{ \mathcal { D } _ { \pi _ { \theta } } \cup \mathcal { D } _ { \pi _ { \mathrm { R L } } } \}$ .
81
+
82
+ # Algorithm 1 Semi-Supervised Skill Generalization
83
+
84
+ 0: inputs: Set of unlabeled MDPs $U$ ; reward $R$ for labeled MDPs $\mathcal { M } \in L$
85
+ 1: Optimize $\pi _ { \mathrm { R L } }$ to maximize $R$ in $\mathcal { M } \in L$
86
+ 2: Generate samples $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ from $\pi _ { \mathrm { R L } }$ in $\mathcal { M } \in L$
87
+ 3: Initialize $\mathcal { D } _ { \mathrm { s a m p } } \mathcal { D } _ { \pi _ { \mathrm { R L } } }$
88
+ 4: for iteration $i = 1$ to $I$ do
89
+ 5: Run $\pi _ { \theta }$ in ${ \mathcal { M } } \in U$ to generate samples ${ \mathcal { D } } _ { \pi _ { \theta } }$
90
+ 6: Append samples ${ \mathcal { D } } _ { \mathrm { s a m p } } \gets { \mathcal { D } } _ { \mathrm { s a m p } } \cup { \mathcal { D } } _ { \pi _ { \theta } }$
91
+ 7: Update reward ${ \tilde { R } } _ { \phi }$ according to Equation 3 using $\mathcal { D } _ { \pi _ { \mathrm { R L } } }$ and $\mathcal { D } _ { \mathrm { s a m p } }$
92
+ 8: Update policy $\pi _ { \theta }$ according to Equation 4, using ${ \tilde { R } } _ { \phi }$ and ${ \mathcal { D } } _ { \pi _ { \theta } }$
93
+ 9: end for
94
+ 10: return generalized policy $\pi _ { \theta }$
95
+
96
+ We parameterize the reward using a neural network, and update it using mini-batch stochastic gradient descent, by backpropagating the gradient of the Equation 3 to the parameters of the reward.
97
+
98
+ Policy update: Our goal with the policy is two-fold. First, we of course need a policy that succeeds in MDPs ${ \mathcal { M } } \in U$ . But since the reward in these MDPs is unavailable, the policy must also serve to generate samples for more accurately estimating the partition function in Equation 2, so that the reward update step can improve the accuracy of the estimated reward function. The policy optimization objective to achieve both of these is to maximize the expected reward ${ \tilde { R } } _ { \phi }$ , augmented with an entropy term as before:
99
+
100
+ $$
101
+ \mathcal { L } ( \theta ) = \ \mathbb { E } _ { \pi _ { \theta } , \mathcal { M } \in U } \left[ \sum _ { t = 0 } ^ { T } \tilde { R } _ { \phi } ( s _ { t } , a _ { t } ) \right] - \mathcal { H } ( \pi _ { \theta } )
102
+ $$
103
+
104
+ While we could in principle use any policy optimization method in this step, our prototype uses mirror descent guided policy search (MDGPS), a sample-efficient policy optimization method suitable for training complex neural network policies that has been validated on real-world physical robots (Montgomery & Levine, 2016; Montgomery et al., 2016). We interleave reward function updates using the objective in Equation 3 within the policy optimization method. We describe the policy optimization procedure in detail in Appendix A.
105
+
106
+ The full algorithm is presented in Algorithm 1. Note that this iterative procedure of comparing the current policy to the optimal behavior provides a form of shaping or curriculum to learning. Our method is structured similarly to the recently proposed guided cost learning method (Finn et al., 2016), and inherits its convergence properties and theoretical foundations. Guided cost learning is an inverse RL algorithm that interleaves policy learning and reward learning directly in the target domain, which in our case is the unlabeled MDPs. Unlike guided cost learning, however, the cost (or reward) is not inferred from expert human-provided demonstrations, but from the agent’s own prior experience in the labeled MDPs.
107
+
108
+ # 5 EXPERIMENTAL EVALUATION
109
+
110
+ Since the aim of S3G is to improve the generalization performance of a learned policy by leveraging data from the unlabeled MDPs, our experiments focus on domains where generalization is critical for success. Despite the focus on generalization in many machine learning problems, the generalization capabilities of policies trained with RL have frequently been overlooked. For example, in recent RL benchmarks such as the Arcade Learning Environment (Bellemare et al., 2012) and OpenAI Gym (Brockman et al., 2016), the training conditions perfectly match the testing conditions. Thus, we define our own set of simulated control tasks for this paper, explicitly considering the types of variation that a robot might encounter in the real world. Through our evaluation, we seek to measure how well semi-supervised methods can leverage unlabeled experiences to improve the generalization of a deep neural network policy learned only in only labeled scenarios.
111
+
112
+ Code for reproducing the simulated experiments is available online1. Videos of the learned policies can be viewed at sites.google.com/site/semisupervisedrl.
113
+
114
+ ![](images/8556a0eaf2dd40289c25f21974b75288d55b93d65120bef567e208b9d4732c86.jpg)
115
+ Figure 2: Illustrations of the tasks. For the reacher with vision, the range of the target for the labeled MDPs is shown with a red dotted line, and for the unlabeled MDPs with a green dashed line. For the obstacle and cheetah tasks, we show the highest obstacle height.
116
+
117
+ # 5.1 TASKS
118
+
119
+ Each of the tasks are modeled using the MuJoCo simulator, and involve continuous state and action spaces with unknown dynamics. The task difficulty ranges from simple, low-dimensional problems to tasks with complex dynamics and high-dimensional observations. In each experiment, the reward function is available in some settings but not others, and the unlabeled MDPs generally involve a wider variety of conditions. We visualize the tasks in Figure 2 and describe them in detail below:
120
+
121
+ obstacle navigation / obstacle height: The goal of this task is to navigate a point robot around an obstacle to a goal position in 2D. The observation is the robot’s position and velocity, and does not include the height of the obstacle. The height of the obstacle is 0.2 in the labeled MDP, and 0.5 in the unlabeled MDP.
122
+
123
+ 2-link reacher / mass: This task involves moving the end-effector of a two-link reacher to a specified goal position. The observation is the robot’s joint angles, end-effector pose, and their timederivatives. In the labeled MDPs, the mass of the arm varies between $7 \times 1 0 ^ { - 9 }$ and $7 \times 1 0 ^ { 1 }$ , whereas the unlabeled MDPs involve a range of $7 \times 1 0 ^ { - 9 }$ to $7 \times 1 0 ^ { 3 }$ .
124
+
125
+ 2-link reacher with vision / target position: The task objective is the same as the 2-link reacher, except, in this task, the MDPs involve a wide 2D range of target positions, shown in Figure 2. Instead of passing in the coordinate of the target position, the policy and the reward function receive a raw $6 4 \times 8 0$ RGB image of the environment at the first time step.
126
+
127
+ half-cheetah jump / wall height: In this task, the goal is for a simulated 6-DOF cheetah-like robot with to jump over a wall, with $10 \%$ gravity. The observation is the robot’s joint angles, global pose, and their velocities, for a total dimension of 20. The unlabeled MDP involves jumping over a 0.5 meter wall, compared to the labeled MDP with a 0.2 meter wall. Success is measured based on whether or not the cheetah fully clears the wall. Policies for reward regression, S3G, and oracle were initialized from the RL policy.
128
+
129
+ In all tasks, the continuous action vector corresponds to the torques or forces applied to each of the robot’s joints. For the first three tasks, reaching the goal position within $5 \mathrm { { c m } }$ is considered a success. For the non-visual tasks, the policy was represented using a neural network with 2 hidden layers of 40 units each. The vision task used 3 convolutional layers with 15 filters of size $5 \times 5$ each, followed by the spatial feature point transformation proposed by Levine et al. (2016), and lastly 3 fully-connected layers of 20 units each. The reward function architecture mirrored the architecture as the policy, but using a quadratic norm on the output, as done by Finn et al. (2016).
130
+
131
+ # 5.2 EVALUATION
132
+
133
+ In our evaluation, we compare the performance of S3G to that of (i) the RL policy $\pi _ { \mathrm { R L } }$ , trained only in the labeled MDPs, (ii) a policy learned using a reward function fitted with supervised learning, and (iii) an oracle policy which can access the true reward function in all scenarios. The architecture of the reward function fitted with supervised learning is the same as that used in S3G.
134
+
135
+ To extensively test the generalization capabilities of the policies learned with each method, we measure performance on a wide range of settings that is a superset of the unlabeled and labeled MDPs, as indicated in Figure 3. We report the success rate of policies learned with each method in Table 1, and visualize the generalization performance in the 2-link reacher, cheetah, and obstacle tasks in Figure 3. The sample complexity of each method is reported in Appendix B.
136
+
137
+ ![](images/ceecfb1ee13f08db3dd5e34eb794e859dddda6497b1c7d5cbe2c6fcf516f9335.jpg)
138
+ Figure 3: Generalization capability of the obstacle, 2-link reacher, and half-cheetah tasks as a function of the task variation. Performance for these tasks is averaged over 3 random seeds.
139
+
140
+ In all four tasks, the RL policy $\pi _ { \mathrm { R L } }$ generalizes worse than S3G, which demonstrates that, by using unlabeled experience, we can indeed improve generalization to different masses, target positions, and obstacle sizes. In the obstacle and both reacher tasks, S3G also outperforms reward regression, suggesting that it is also useful to use unlabeled experience to learn the reward.
141
+
142
+ In the obstacle task, the results demonstrate that the reward functions learned using S3G actually produce better generalization in some cases than learning on both the labeled and unlabeled MDPs with full knowledge of the true reward function. While this may at first seem counterintuitive, this agrees with the observation in prior work Guo et al. (2013) that the true reward function is not always the best one when learning with limited samples, computational power, or representational capacity (i.e. because it is not sufficiently shaped). S3G also outperforms the oracle and reward regression in the 2-link reacher task, indicating that the learned reward shaping is also beneficial in that task.
143
+
144
+ For the vision task, the visual features learned via RL in the labeled MDPs were used to initialize the vision layers of the reward and policy. We trained the vision-based reacher with S3G with both end-to-end finetuning of the visual features and with the visual features frozen and only the fully-connected layers trained on the unlabeled MDPs. We found performance to be similar in both cases, suggesting that the visual features learned with RL were good enough, though fine-tuning the features end-to-end with the inverse RL objective did not hurt the performance.
145
+
146
+ # 6 CONCLUSION & FUTURE WORK
147
+
148
+ We presented the first method for semi-supervised reinforcement learning, motivated by real-world lifelong learning. By inferring the reward in settings where one is not available, S3G can improve the generalization of a learned neural network policy trained only in the “labeled” settings. Additionally, we find that, compared to using supervised regression to reward labels, we can achieve higher performance using an inverse RL objective for inferring the reward underlying the agent’s prior experience. Interestingly, this does not directly make use of the reward labels when inferring the reward of states in the unlabeled MDPs, and our results on the obstacle navigation task in fact suggest that the rewards learned with S3G exhibit better shaping.
149
+
150
+ As we discuss previously, the reward and policy optimization methods that we build on in this work are efficient enough to learn complex tasks with hundreds of trials, making them well suited for learning on physical systems such as robots. Indeed, previous work has evaluated similar methods on real physical systems, in the context of inverse RL (Finn et al., 2016) and vision-based policy learning (Levine et al., 2016). Thus, it is likely feasible to apply this method for semi-supervised reinforcement learning on a real robotic system. Applying S3G on physical systems has the potential to enable real-world lifelong learning, where an agent is initialized using a moderate amount of labeled experience in a constrained setting, such as a robot learning a skill for the first time in the lab, and then allowed to explore the real world while continuous improving its capabilities without additional supervision. This type of continuous semi-supervised reinforcement learning has the potential to remove the traditional distinction between a training and test phase for reinforcement learning agents, providing us with autonomous systems that continue to get better with use.
151
+
152
+ # ACKNOWLEDGMENTS
153
+
154
+ The authors would like to thank Anca Dragan for insightful discussions, and Aviv Tamar and Roberto Calandra for helpful feedback on the paper. Funding was provided by the NSF GRFP, the DARPA Simplex program, and Berkeley DeepDrive.
155
+
156
+ # REFERENCES
157
+
158
+ Pieter Abbeel and Andrew Ng. Apprenticeship learning via inverse reinforcement learning. In International Conference on Machine Learning (ICML), 2004.
159
+
160
+ Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mane. Concrete prob- ´ lems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
161
+
162
+ Julien Audiffren, Michal Valko, Alessandro Lazaric, and Mohammad Ghavamzadeh. Maximum entropy semisupervised inverse reinforcement learning. International Joint Conference on Artificial Intelligence (IJCAI), 2015.
163
+
164
+ Samuel Barrett, Matt E. Taylor, and Peter Stone. Transfer learning for reinforcement learning on a physical robot. In Ninth International Conference on Autonomous Agents and Multiagent Systems - Adaptive Learning Agents Workshop (ALA), 2010.
165
+
166
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 2012.
167
+
168
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
169
+
170
+ Paul Christiano. Semi-supervised reinforcement learning. https://medium.com/ai-control/ semi-supervised-reinforcement-learning-cf7d5375197f, 2016.
171
+
172
+ Coline Devin, Abhishek Gupta, Trevor Darrell, Pieter Abbeel, and Sergey Levine. Learning modular neural network policies for multi-task and multi-robot transfer. arXiv preprint arXiv:1609.07088, 2016.
173
+
174
+ Anca Dragan, Geoffrey Gordon, and Siddhartha Srinivasa. Learning from experience in manipulation planning: Setting the right goals. International Symposium on Experimental Robotics (ISER), 2011.
175
+
176
+ Krishnamurthy Dvijotham and Emanuel Todorov. Inverse optimal control with linearly-solvable MDPs. In International Conference on Machine Learning (ICML), 2010.
177
+
178
+ Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. International Conference on Machine Learning (ICML), 2016.
179
+
180
+ Xiaoxiao Guo, Satinder Singh, and Richard L Lewis. Reward mapping for transfer in long-lived agents. In Neural Information Processing Systems (NIPS), 2013.
181
+
182
+ Jonathan Ho, Jayesh K. Gupta, and Stefano Ermon. Model-free imitation learning with policy optimization. International Conference on Machine Learning (ICML), 2016.
183
+
184
+ Hilbert J Kappen, Vicenc¸ Gomez, and Manfred Opper. Optimal control as a graphical model inference problem. ´ Machine learning, 2012.
185
+
186
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Neural Information Processing Systems (NIPS). 2014.
187
+
188
+ George Konidaris and Andrew Barto. Autonomous shaping: Knowledge transfer in reinforcement learning. International Conference on Machine Learning (ICML), 2006.
189
+
190
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research (JMLR), 2016.
191
+
192
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 2015.
193
+
194
+ William Montgomery and Sergey Levine. Guided policy search as approximate mirror descent. Advances in Neural Information Processing Systems (NIPS), 2016.
195
+
196
+ William Montgomery, Anurag Ajay, Chelsea Finn, Pieter Abbeel, and Sergey Levine. Reset-free guided policy search: Efficient deep reinforcement learning with stochastic initial states. arXiv preprint arXiv:1610.01112, 2016.
197
+
198
+ Igor Mordatch, Nikhil Mishra, Clemens Eppner, and Pieter Abbeel. Combining model-based policy search with online model learning for control of physical humanoids. International Conference on Robotics and Automation (ICRA), 2016.
199
+
200
+ Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. International Conference on Machine Learning (ICML), 2000.
201
+
202
+ Junhyuk Oh, Valliappa Chockalingam, Satinder Singh, and Honglak Lee. Control of memory, active perception, and action in minecraft. International Conference on Machine Learning (ICML), 2016.
203
+
204
+ Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Actor-mimic: Deep multitask and transfer reinforcement learning. International Conference on Learning Representations (ICLR), 2016.
205
+
206
+ Antti Rasmus, Harri Valpola, Mikko Honkala, Mathias Berglund, and Tapani Raiko. Semi-supervised learning with ladder networks. Neural Information Processing Systems (NIPS), 2016.
207
+
208
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision (IJCV), 2015.
209
+
210
+ Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy distillation. International Conference on Learning Representations (ICLR), 2016.
211
+
212
+ John Schulman, Sergey Levine, Philipp Moritz, Michael I Jordan, and Pieter Abbeel. Trust region policy optimization. International Conference on Machine Learning (ICML), 2015.
213
+
214
+ Martin Stolle and Christopher G. Atkeson. Knowledge transfer using local features. Approximate Dynamic Programming and Reinforcement Learning (ADPRL), 2007.
215
+
216
+ Martin Szummer and Tommi S Jaakkola. Information regularization with partially labeled data. In Neural Information processing systems (NIPS), 2002.
217
+
218
+ Matthew E. Taylor and Peter Stone. Transfer learning for reinforcement learning domains: A survey. Journal of Machine Learning Research (JMLR), 2009.
219
+
220
+ Alex Teichman and Sebastian Thrun. Tracking-based semi-supervised learning. Robotics: Science and Systems (RSS), 2007.
221
+
222
+ Sebastian Thrun and Tom M Mitchell. Lifelong robot learning. Springer Berlin Heidelberg, 1995.
223
+
224
+ Eric Tzeng, Coline Devin, Judy Hoffman, Chelsea Finn, Pieter Abbeel, Sergey Levine, Kate Saenko, and Trevor Darrell. Adapting deep visuomotor representations with weak pairwise constraints. Workshop on the Algorithmic Foundations of Robotics (WAFR), 2016.
225
+
226
+ Yuting Zhang, Kibok Lee, and Honglak Lee. Augmenting supervised neural networks with unsupervised objectives for large-scale image classification. International Conference on Machine Learning (ICML), 2016.
227
+
228
+ Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. Technical report, 2002.
229
+
230
+ Xiaojin Zhu and Andrew B Goldberg. Introduction to semi-supervised learning. Morgan & Claypool, 2009.
231
+
232
+ Brian Ziebart. Modeling purposeful adaptive behavior with the principle of maximum causal entropy. PhD thesis, Carnegie Mellon University, 2010.
233
+
234
+ # A MIRROR DESCENT GUIDED POLICY SEARCH
235
+
236
+ To optimize policies with S3G, we chose to use mirror-descent guided policy search (MDGPS), for its superior sample efficiency over other policy optimization methods. MDGPS belongs to a class of guided policy search methods, which simplify policy search by decomposing the problem into two phases: a) a trajectory-centric RL phase (C-phase) and b) a supervised learning phase (S-phase). During the C-phase, a trajectory-centric RL method is used to train ”local” controllers for each of M initial positions. In the S-phase, a global policy $\pi _ { \theta } ( a | s )$ is trained using supervised learning to match the output of each of the local policies.
237
+
238
+ MDGPS can be interpreted as an approximate variant of mirror-descent on the expected cost $\begin{array} { r } { J ( \theta ) = \sum _ { t = 1 } ^ { T } \mathbb { E } _ { \pi _ { \theta } ( s _ { t } , a _ { t } ) } [ - R ( s _ { t } , a _ { t } ) ] } \end{array}$ under policy’s trajectory distribution, where $\pi _ { \theta } ( s _ { t } , a _ { t } )$ denotes the marginal of $\begin{array} { r } { \pi _ { \boldsymbol { \theta } } ( \tau ) = p ( s _ { 1 } ) \prod _ { t = 1 } ^ { T } p ( s _ { t + 1 } | s _ { t } , a _ { t } ) \pi ( a _ { t } | s _ { t } ) } \end{array}$ and $\tau = \{ s _ { 1 } , a _ { 1 } , \ldots , s _ { T } , a _ { T } \}$ denotes the trajectory. In the C-phase, we learn new local policies for each initial position, and in the S-phase we project the local policies down to a single global policy $\pi _ { \theta }$ , using KL divergence as the distance metric.
239
+
240
+ To produce local policies, we make use of the iterative linear quadratic regulator (iLQR) algorithm to train time-varying linear-Gaussian controllers. iLQR makes up for its weak representational power by being sample efficient under regimes where it is capable of learning. Usage of iLQR requires a twice-differentiable cost function and linearized dynamics.
241
+
242
+ In order to fit a dynamics model, we use the recent samples to fit a gaussian mixture model (GMM) on $\left( s _ { t } , a _ { t } , s _ { t + 1 } \right)$ tuples. We then use linear regression to fit time-varying linear dynamics of the form $s _ { t + 1 } = F _ { t } s _ { t } + f _ { t }$ on local policy samples from the most recent iteration, using the clusters from the GMM as a normal-inverse Wishart prior.
243
+
244
+ During the C-step, for each initial condition $m$ , we optimize the entropy-augmented of the form, objective constrained against the global policy:
245
+
246
+ $$
247
+ q _ { m } = \underset { q } { \arg \operatorname* { m a x } } \mathbb { E } _ { q , p _ { m } ( s _ { 0 } ) } \left[ \sum _ { t = 0 } ^ { T } R ( s _ { t } , a _ { t } ) \right] - \mathcal { H } ( q ) \mathrm { s . t . } \mathcal { D } _ { K L } ( q | | \pi _ { \theta } ) \leq \varepsilon
248
+ $$
249
+
250
+ Where $R ( s _ { t } , a _ { t } )$ is a twice-differentiable objective such as $L 2$ -distance from a target state.
251
+
252
+ This optimization results in a local time-varying linear-Gaussian controller $q _ { m } ( \mathbf { s } _ { t } | \mathbf { a } _ { t } ) \sim \mathcal { N } ( K _ { m , t } s _ { t } +$ $k _ { m , t } , C _ { m , t } )$ which is executed to obtain supervised learning examples for the S-step.
253
+
254
+ # B SAMPLE COMPLEXITY OF EXPERIMENTS
255
+
256
+ Because we use guided policy search to optimize the policy, we inherit its sample efficiency. In Table 2, we report the number of samples used in both labeled and unlabeled scenarios for all tasks and all methods. Note that the labeled samples used by the oracle are in from the “unlabeled” MDPs $U$ , where we generally assume that reward labels are not available.
257
+
258
+ Table 2: Sample complexity of each experiment. This table records the total number of samples used to train policies in the labeled setting (RL and oracle), and the unlabeled setting (reward regression, S3G). The sample complexity of unlabeled experiments is denoted as (unlabeled samples $^ +$ labeled samples)
259
+
260
+ <table><tr><td></td><td>Labeled</td><td>Unlabeled+Labeled</td><td></td></tr><tr><td></td><td>RL oracle</td><td>reward regression</td><td>S3G</td></tr><tr><td>obstacle 2-link reacher</td><td>250 250</td><td>300+250</td><td>300+250</td></tr><tr><td rowspan="3">2-link reacherwith vision half-cheetah</td><td>200 300</td><td>900+200</td><td>900+200°</td></tr><tr><td>250 650</td><td>1170+250</td><td>1300+250</td></tr><tr><td>600 600</td><td>1400+600</td><td>1400+600</td></tr></table>
md/train/rygunsAqYQ/rygunsAqYQ.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/sMEpviTLi1h/sMEpviTLi1h.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/uY-XMIbyXec/uY-XMIbyXec.md ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data
2
+
3
+ # Qi Zhu∗
4
+
5
+ # Natalia Ponomareva†
6
+
7
+ Jiawei Han∗
8
+
9
+ Bryan Perozzi†
10
+
11
+ \*: University of Illinois Urbana-Champaign †: Google Research \*{qiz3,hanj}@illinois.edu,
12
+ †{nponomareva,bperozzi}@google.com
13
+
14
+ # Abstract
15
+
16
+ There has been a recent surge of interest in designing Graph Neural Networks (GNNs) for semi-supervised learning tasks. Unfortunately this work has assumed that the nodes labeled for use in training were selected uniformly at random (i.e. are an IID sample). However in many real world scenarios gathering labels for graph nodes is both expensive and inherently biased – so this assumption can not be met. GNNs can suffer poor generalization when this occurs, by overfitting to superfluous regularities present in the training data. In this work we present a method, Shift-Robust GNN (SR-GNN), designed to account for distributional differences between biased training data and a graph’s true inference distribution. SR-GNN adapts GNN models to the presence of distributional shift between the nodes labeled for training and the rest of the dataset. We illustrate the effectiveness of SR-GNN in a variety of experiments with biased training datasets on common GNN benchmark datasets for semi-supervised learning, where we see that SRGNN outperforms other GNN baselines in accuracy, addressing at least ${ \sim } 4 0 \%$ of the negative effects introduced by biased training data. On the largest dataset we consider, ogb-arxiv, we observe a $2 \%$ absolute improvement over the baseline and are able to mitigate $30 \%$ of the negative effects from training data bias 1.
17
+
18
+ # 1 Introduction
19
+
20
+ The goal of graph-based semi-supervised learning (SSL) is to use relationships between data (its graph inductive bias), along with a small set of labeled items, to predict the labels for the rest of a dataset. Unsurprisingly, varying exactly which nodes are labeled can have a profound effect on the generalization capability of a SSL classifier. Any bias in the sampling process to select nodes for training can create distributional differences between the training set and the rest of the graph. During inference any portion of the graph can be used, so any uneven labeling for training data can cause training and test data to have different distributions. An SSL classifier may then overfit to training data irregularities, thus hurting the performance at inference time.
21
+
22
+ Recently, GNNs have emerged as a way to combine graph structure with deep neural networks. Surprisingly, most work on semi-supervised learning using GNNs for node classification [15, 11, 1] have ignored this critical problem, and even the most recently proposed GNN benchmarks [12] assume that an independent and identically distributed (IID) sample is possible for training labels.
23
+
24
+ This problem of biased training labels can be quite pronounced when GNNs are applied for semisupervised learning in practice. It commonly happens when the size of the dataset is so large that only a subset of it can afford to be labeled – the exact situation where graph-based SSL is supposed to have a value proposition! While the specific source of bias can vary, we have encountered it in many different settings. For example, sometimes fixed heuristics are used to select a subset of data (which shares some characteristics) for labeling. Other times, human analysts individually choose data items for labeling, using complex domain knowledge. However, even this can be rooted in shared characteristics of data. In yet another scenario, a label source may have some latency, causing a temporal mismatch between the distribution of data at time of labeling and at the time of inference. In all of these cases, the core problem is that the GNN overfits to spurious regularities as the subset of labeled data could not be created in an IID manner.
25
+
26
+ One particular area where this can apply is in the spam and abuse domain, a common area of application for GNNs [18, 10, 33]. However, the labels in these problems usually come from explicit human annotations, which are both sparse (as human labelling is expensive), and also frequently biased. Since spam and abuse problems typically have very imbalanced label distributions (e.g. in many problems there are relatively few abusers – typically less than 1:100), labeling nodes IID results in discovering very few abusive labels. In this case choosing the points to request labels for in an IID manner is simply not a feasible option if one wants to have a reasonable number of data items from the rare class.
27
+
28
+ In this paper, we seek to quantify and address the problem of localized training data in Graph Neural Networks. We frame the problem as that of transfer learning – seeking to transfer the model’s performance from a small biased portion of the graph to the entire graph itself. Our proposed framework for addressing this problem, Shift-Robust GNN (SR-GNN), strives to adapt a biased sample of labeled nodes to more closely conform to the distributional characteristics present in an IID sample of the graph. It can handle two kinds of bias that occur in both deeper GNNs and more recent linearized (shallow) versions of these models.
29
+
30
+ First we consider the case of addressing distributional shift for standard GNN models such as GCNs [15], MPNNs [7], and many more [5]. These models create deep networks which iteratively convolve information over graph structure. SR-GNN addresses this variety of distributional shift via a regularization over the hidden layers of the network. Second, we consider a class of linearized models (APPNP [16], SimpleGCN [34], etc) which decouple GNNs into non-linear feature encoding and linear message passing. These models present an interesting challenge for debiasing, as the graph can introduce bias over the features after all learnable layers. In cases like this, SR-GNN can use an instance reweighting paradigm to ensure that the training examples are as representative as possible over the graph data.
31
+
32
+ We illustrate the effectiveness of our proposed method on both paradigms with an experimental framework that introduces bias to the train/test split in a GNN, which lets us simulate the ‘localized discovery’ pattern observed in real applications on fully-labeled academic datasets. With these experiments we show that that our method SR-GNN can recover at least $40 \%$ of the performance lost when training a GCN on the same biased input.
33
+
34
+ Specifically, our contributions are the following:
35
+
36
+ 1. We provide the first focused discussion on the distributional shift problem in GNNs.
37
+ 2. We propose generalized framework, Shift-Robust GNN (SR-GNN), which can address shift in both shallow and deep GNNs.
38
+ 3. We create an experimental framework which allows for creating biased train/test sets for graph learning datasets.
39
+ 4. We run extensive experiments and analyze the results, proving that our methods can mitigate distributional shift.
40
+
41
+ # 2 Related Work
42
+
43
+ # 2.1 Distributional shift and Domain adaption work
44
+
45
+ Standard learning theory (i.e. PAC, empirical risk minimization, etc.) assumes that training and inference data is drawn from the same distribution, but there are many practical cases where this does not hold. The question of dealing with different distributions has been widely explored as a part of the transfer learning literature. In transfer learning, the domain adaptation problem deals with transferring knowledge from the source domain (used for learning) to the target domain (the ultimate inference distribution).
46
+
47
+ One of the first theoretical works on domain adaptation [3] developed a distance function between a model’s performance on the source and target domains to describe how similar they are. To obtain a final model, training then happens on a reweighed combination of source and target data, where weights are a function of the domain’s distance. Much additional theoretical (e.g. [22]) and practical work expanded this idea and explored models which are co-trained on both source and target data. These models seek to optimize utility while minimizing the distance between extracted features distributions on both domains; this in turn led to the field of Domain Invariant Representation Learning (DIR) [6]. DIR is commonly achieved via co-training on labeled source and (unlabeled) target data. A modification to the loss either uses an adversarial head or adds additional regularizations.
48
+
49
+ More recently, various regularizations using discrepancy measures have been shown to be more stable to hyperparameters and result in better performance than adversarial heads, faster loss convergence and easier training. Maximum mean discrepancy (MMD) [19, 20] is a metric that measures difference between means of distributions in some rich Hilbert kernel space. Central moment discrepancy (CMD) [38] extends this idea and matches means and higher order moments in the original space (without the projection into the kernel). CMD has been shown to produce superior results and is less susceptible to the weight with which CMD regularization is added to the loss [20].
50
+
51
+ It is important to point out that MMD and CMD regularizations are commonly used with non-linear networks on some hidden layer (e.g. on extracted features). For linear models or non-differentiable models, prior work for domain adaptation often employed importance-reweighting instead. To find the appropriate weights, the same MMD distance was often used: in kernel mean matching (KMM) to find the appropriate weights one essentially minimizes MMD distance w.r.t the instance weights [17].
52
+
53
+ # 2.2 GNNs
54
+
55
+ Given a graph $G = \{ V , E , X \}$ , the nodes $V$ are associated with their features $X$ $( X \in \mathbb { R } ^ { | V | \times F } )$ and the set of edges $E$ (i.e. adjacency matrix $A$ , $A \in \mathbb { R } ^ { | V | \times | V | } \mathrm { ~ ; ~ }$ which form connections between them. Graph neural networks [15] are neural networks that operate on both node features and graph structures. The core assumption of GNNs is that the structure of data $( A )$ can provide a useful inductive bias for many modeling problems. GNNs output node representations $Z$ which are used for unsupervised [30] or semi-supervised [15, 11] learning. We denote the labels for SSL as $\{ y _ { i } \}$ .
56
+
57
+ The general architecture $\Phi$ of a GNN consists of $K$ neural network layers which encode the nodes and their neighborhood information using some learnable weights $\theta$ . More specifically the output of layer $k$ of a GNN contains a row $( h _ { i } ^ { k } )$ which can be used as a representation for each node $i$ , i.e. $z _ { i } ^ { k } = h _ { i } ^ { k }$ . Successive layers mix the node representations using graph information, for example:
58
+
59
+ $$
60
+ H ^ { k } = \sigma ( \tilde { A } H ^ { k - 1 } \theta ^ { k } )
61
+ $$
62
+
63
+ where $\tilde { A }$ is an appropriately normalized adjacency matrix2, $\sigma$ is the activation function, and $H ^ { 0 } = X$ .
64
+ For brevity’s sake, we refer to the final latent representations $Z ^ { K }$ simply as $Z$ throughout the work.
65
+
66
+ Although no existing work studies the distributional shift problem in GNNs, transfer learning of GNNs [13, 39] has explored different node-level and graph-level pre-training tasks across different graphs. Alternatively, domain adaption methods have been used to optimize a domain classifier between source and target graphs [21, 35]. In addition, distribution discrepancy minimization (MMD) has been adopted to train network embedding across domains [28]. Other regularizations for the latent state of GNNs have been proposed for domains like fairness [23]. We are the first to notice the importance of distributional shift on the same graph in a realistic setting and analyze its influence on different kinds of GNNs.
67
+
68
+ # 3 Distributional shift in GNNs
69
+
70
+ To learn an SSL classifier, a cross-entropy loss function $l$ is commonly used,
71
+
72
+ $$
73
+ \mathcal { L } = \frac { 1 } { M } \sum _ { i = 1 } ^ { M } l ( y _ { i } , z _ { i } ) ,
74
+ $$
75
+
76
+ where $z _ { i }$ is the node representation for the node $i$ learned from a graph neural network, and $M$ is the number of training examples. When the training and testing data come from the same domain (i.e. $\operatorname* { P r } _ { \operatorname { t r a i n } } ( X , Y ) = \operatorname* { P r } _ { \operatorname { t e s t } } ( X , Y ) )$ , optimizing the cross entropy loss over the training data ensures that a classifier is well-calibrated for performing inference on the testing data.
77
+
78
+ # 3.1 Data shift as representation shift
79
+
80
+ However, a mismatch between the training and testing distributions (i.e. $\operatorname* { P r } _ { \operatorname { t r a i n } } ( X , Y ) \ \neq$
81
+ $\mathrm { P r } _ { \mathrm { t e s t } } ( X , Y ) )$ is a common challenge for machine learning [25, 29].
82
+
83
+ In this paper, we care about the distributional shift between training and test datasets present in $Z$ , the output of the last activated hidden layer. Given that the foundation of standard learning theory assumes $\operatorname* { P r } _ { \mathrm { t r a i n } } ( Y | Z ) = \operatorname* { P r } _ { \mathrm { t e s t } } ( Y | Z )$ , the main cause of distribution shift is the representation shift, i.e. $\operatorname* { P r } _ { \operatorname { t r a i n } } ( Z , Y ) \neq \operatorname* { P r } _ { \operatorname { t e s t } } ( Z , Y ) \operatorname* { P r } _ { \operatorname { t r a i n } } ( Z ) \neq \operatorname* { P r } _ { \operatorname { t e s t } } ( Z )$ . To measure such a shift, discrepancy metrics such as MMD [8] or CMD [37] can be used. CMD measures the direct distance between distributions p and q as the following [37]:
84
+
85
+ $$
86
+ { \bf C M D } = \frac { 1 } { { \left| b - a \right| } } { \left\| { \mathrm { E } \left( { \boldsymbol { p } } \right) - \mathrm { E } \left( { \boldsymbol { q } } \right) } \right\| _ { 2 } } + \sum _ { k = 2 } ^ { \infty } { \frac { 1 } { { \left| b - a \right| } ^ { k } } \| c _ { k } \left( { \boldsymbol { p } } \right) - c _ { k } \left( { \boldsymbol { q } } \right) \| _ { 2 } } ,
87
+ $$
88
+
89
+ where $c _ { k }$ is $k$ -th order moment and $a$ , $b$ denotes the joint distribution support of the distributions. In practice, only a limited number of moments is usually included (e.g. $k { = } 5$ ). In this work we focus on the use of CMD [37] as a distance metric to measure distributions discrepancy for efficiency.
90
+
91
+ ![](images/90b4f24a5a4d2d4bc1eabe302e557fc4bb22f4809bdfd5eb6fb3eb195cb4754f.jpg)
92
+ Figure 1: Distribution shift lowers performance on GNN datasets. For each dataset, we show the performance (F1:y-axis) vs their distribution shift (CMD:x-axis) for 100 biased training set samples .
93
+
94
+ We note that GNNs (Eq (1)) are different from traditional neural networks, where the output for a layer $K$ is defined as $\bar { H } ^ { k } = \sigma ( H ^ { k - 1 } \theta ^ { k } )$ . Instead, the multiplication of the normalized adjacency matrix $( H ^ { k } = \sigma ( \tilde { A } H ^ { k - 1 } \theta ^ { k } ) )$ essentially changes the output distribution of the hidden representation via the graph’s inductive bias. Hence, in a semi-supervised GNN, a biased training sample can lead to large representation shift due to both the graph’s inductive bias in addition to ‘normal’ shift between non-IID sampled feature vectors.
95
+
96
+ Formally, we start the analysis of distributional shift as follows.
97
+
98
+ Definition 3.1 (Distribution shift in GNNs). Assume node representations $Z = \{ z _ { 1 } , z _ { 2 } , . . . , z _ { n } \}$ are given as an output of the last hidden layer of a graph neural network on graph $G$ with n nodes. Given labeled data $\{ ( x _ { i } , y _ { i } ) \}$ of size $M _ { i }$ , the labeled node representation $Z _ { l } = ( z _ { 1 } , \dots , z _ { m } )$ is a subset of the nodes that are labeled, $Z _ { l } \subset Z$ . Assume $Z$ and $Z _ { l }$ are drawn from two probability distributions $p$ and $q$ . The distribution shift in GNNs is then measured via a distance metric $d ( Z , Z _ { l } )$ .
99
+
100
+ Interestingly, it can be empirically shown that the effects of distribution shift due to sample bias directly lower the performance of models. To illustrate this, we plot the distribution shift distance values $\mathbf { \dot { x } }$ -axis) and corresponding model accuracy (y-axis) for three common GNN benchmarks using the classic GCN model [15] in Figure 1. The results demonstrate that the performance of GNNs for node classification on these datasets is inversely related to the magnitude of distributional shift and motivates our investigation into distribution shift.
101
+
102
+ ![](images/17b9bcba345a0a60ec43f83843a23b7ff71d7ee25347df8353e45b02b8be1241.jpg)
103
+ Figure 2: A comparison between a traditional GNN, a linearized GNN and our framework (SR-GNN).
104
+
105
+ # 4 Shift-Robust Graph Neural Networks
106
+
107
+ In this section, we will address the distributional shift problem $( \operatorname* { P r } _ { \operatorname { t r a i n } } ( Z ) \neq \operatorname* { P r } _ { \operatorname { t e s t } } ( Z ) )$ in GNNs by proposing ways to mitigate the shift for two different GNN models (Section 4.1 and 4.2, respectively). Subsequently, we introduce SR-GNN (Fig.2) as a general framework that reduces distributional shifts for both differentiable and non-differentiable (e.g. graph inductive bias) sources simultaneously in Section 4.3.
108
+
109
+ # 4.1 Scenario 1: Traditional GNN models
110
+
111
+ We begin by considering a traditional GNN model $\Phi$ , a learnable function $\mathbf { F }$ with parameters $\Theta$ , over some adjacency matrix $A$ :
112
+
113
+ $$
114
+ \Phi = { \bf F } ( \Theta , Z , A ) .
115
+ $$
116
+
117
+ In the original GCN [15], the graph inductive bias is multiplicative at each layer and gradients are back propagated through all of the layers. In the last activated hidden layers, we denote a bounded node representation3 as $Z \equiv Z _ { k } = \Phi \bar { ( \Theta , Z _ { k - 1 } , A ) } , Z _ { k } \in [ a , b ] ^ { n } , Z _ { 0 } = \dot { X } .$ .
118
+
119
+ Let us denote the training samples as $\{ x _ { i } \} _ { i = 1 } ^ { M }$ , the node representations are $Z _ { \mathrm { t r a i n } } = \{ z _ { i } \} _ { i = 1 } ^ { M }$ . For the test samples, we sample an unbiased IID sample from unlabeled data $X _ { \mathrm { I I D } } = \{ x _ { i } ^ { \prime } \} _ { i = 1 } ^ { M }$ and denote the output representations as $Z _ { \mathrm { I I D } } = \{ z _ { i } ^ { \prime } \} _ { i = 1 } ^ { M }$ .
120
+
121
+ In order to mitigate the distributional shift between training and testing, we propose a regularizer $d : [ a , b ] ^ { n } \times [ a , \bar { b } ] ^ { n } \to \mathbb { R } ^ { + }$ that is added to the cross entropy loss. Since $\Phi$ is fully differentiable, we can use a distributional shift metric as a regularization to directly minimize the discrepancy between a biased and unbiased IID sample like so:
122
+
123
+ $$
124
+ \mathcal { L } = \frac { 1 } { M } \sum _ { i } l ( y _ { i } , z _ { i } ) + \lambda \cdot d ( Z _ { \mathrm { t r a i n } } , Z _ { \mathrm { I I D } } ) .
125
+ $$
126
+
127
+ Here we consider the central moment discrepancy regularizer, $d _ { \mathrm { C M D } }$ :
128
+
129
+ $$
130
+ d _ { \mathrm { C M D } } ( Z _ { \mathrm { t r a i n } } , Z _ { \mathrm { I I D } } ) = \frac { 1 } { b - a } \| { \bf E } ( Z _ { \mathrm { t r a i n } } ) - { \bf E } ( Z _ { \mathrm { I I D } } ) \| + \sum _ { k = 2 } ^ { \infty } \frac { 1 } { | b - a | ^ { k } } \| c _ { k } ( Z _ { \mathrm { t r a i n } } ) - c _ { k } ( Z _ { \mathrm { I I D } } ) \| ,
131
+ $$
132
+
133
+ where $\begin{array} { r } { { \bf E } ( Z ) = \frac { 1 } { M } \sum z _ { i } } \end{array}$ and $c _ { k } ( Z ) = \mathbf { E } ( Z - \mathbf { E } ( Z ) ) ^ { k }$ is the $\mathbf { k }$ -th order moment. In practice, we use moments up to the 5th order.
134
+
135
+ # 4.2 Scenario 2: Linearized GNN Models
136
+
137
+ Another family of recently proposed models for GNNs uses two distinct different functions – one for non-linear feature transformation, and another for a linear graph spreading stage,
138
+
139
+ $$
140
+ \Phi = \mathbf { F _ { 2 } } ( \underbrace { \mathbf { F _ { 1 } } ( \mathbf { A } ) } _ { \begin{array} { c } { \longrightarrow } \end{array} } , \Theta , X ) .
141
+ $$
142
+
143
+ | {z }linear function
144
+
145
+ In such a linearized GNN model, the graph inductive bias is combined with node features by a linear function $\mathbf { F _ { 1 } }$ , which is decoupled from multi-layer neural network feature encoder $\mathbf { F _ { 2 } }$ . SimpleGCN [34] is an example of linearized model when $\mathbf { F _ { 1 } } ( A ) \ : = \ : A ^ { k } X$ . Another branch of linearized models [16, 4, 36] employs personalized pagerank to pre-compute the information diffusion in a graph (i.e. $\mathbf { F _ { 1 } } ( A ) = \alpha ( I - ( 1 - \alpha ) \tilde { A } ) ^ { - 1 } )$ and apply it on encoded node features $F ( \Theta , X )$ .
146
+
147
+ In both models, the graph inductive bias is provided as an input feature to a linear $\mathbf { F _ { 1 } }$ . Unfortunately, as there are no learnable layers at this stage in these models, one can not simply apply the distributional regularizer proposed in the previous section. In this case, we can view training and testing samples as row-wise samples $h _ { i }$ from $\mathbf { F } _ { 1 } ( A )$ . The problem of distribution shift $\operatorname* { P r } _ { \operatorname { t r a i n } } ( \bar { Z } ) \neq \operatorname* { P r } _ { \operatorname { t e s t } } ( \bar { Z } )$ can then be transformed into matching the training and testing graph inductive bias feature space $h _ { i } \in \mathbb { R } ^ { n }$ (where $n$ is the number of the nodes in the graph). Then to generalize from training data to testing, we can adopt an instance reweighting scheme to correct the bias, such that biased training sample $\{ h _ { i } \} _ { i = 1 } ^ { M }$ will be similar to an IID sample $\{ h _ { i } ^ { \prime } \} _ { i = 1 } ^ { M }$ . The resulting cross entropy loss is then
148
+
149
+ $$
150
+ \mathcal { L } = \frac { 1 } { M } \beta _ { i } l ( y _ { i } , \Phi ( h _ { i } ) ) ,
151
+ $$
152
+
153
+ where $\beta _ { i }$ be the weight for each training instance, and $l$ is the cross-entropy loss. We can then compute the optimal $\beta$ via kernel mean matching (KMM) [9] by solving a quadratic problem,
154
+
155
+ $$
156
+ \operatorname* { m i n } _ { \beta _ { i } } \| \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \beta _ { i } \psi ( h _ { i } ) - \frac { 1 } { M ^ { \prime } } \sum _ { i = 1 } ^ { M ^ { \prime } } \psi ( h _ { i } ^ { \prime } ) \| ^ { 2 } , \mathrm { ~ s . t . ~ } B _ { l } \leq \beta < B _ { u }
157
+ $$
158
+
159
+ It tries to match the mean elements in a kernel space $k ( \cdot , \cdot )$ on the domain $\mathbb { R } ^ { n } \times \mathbb { R } ^ { n }$ . Specifically, $\psi : \mathbb { R } ^ { n } \to \mathcal { H }$ denotes the feature map to the reproducing kernel Hilbert space(RKHS) introduced by kernel $k$ . In our experiment, we use a mixture of gaussian kernel $\begin{array} { r } { k ( x , y ) = \sum _ { \alpha _ { i } } \exp ( \alpha _ { i } \| x - } \end{array}$ $y \| _ { 2 } ) , \alpha _ { i } = 1 , 0 . 1 , 0 . 0 1$ . The lower $B _ { l }$ and upper bound $B _ { u }$ constraints are there to make sure that most of the instances get some reasonable weight, as opposed to only a few instances getting non zero weight. In practice, we have multiple classes in the label space. To prevent label imbalance introduced by $\beta$ , we further require that the sum of $\beta$ for a specific class $c$ remains the same before and after the correction, $\begin{array} { r } { \sum _ { i } ^ { M } \beta _ { i } \cdot \mathbb { I } ( l _ { i } = c ) = \sum _ { i } ^ { M } \mathbb { I } ( l _ { i } = c ) , \forall c . } \end{array}$ .
160
+
161
+ # 4.3 Shift-Robust GNN Framework
162
+
163
+ Now we propose Shift-Robust GNN (SR-GNN) - our general training objective for addressing distributional shift in GNNs:
164
+
165
+ $$
166
+ \mathcal { L } _ { \mathrm { S R - G N N } } = \frac { 1 } { M } \beta _ { i } l ( y _ { i } , \Phi ( x _ { i } , A ) ) + \lambda \cdot d ( Z _ { \mathrm { t r a i n } } , Z _ { \mathrm { I I D } } ) .
167
+ $$
168
+
169
+ The framework consists of both a regularization for addressing distributional shift in learnable layers (Section 4.1) and an instance reweighting component which is capable of handling situations where a graph inductive bias is added after feature encoding (Section 4.2).
170
+
171
+ We will now discuss a concrete instance of our framework, by applying it to the APPNP [16] model. The APPNP model is defined as:
172
+
173
+ $$
174
+ \Phi _ { \mathrm { A P P N P } } = \left( ( 1 - \alpha ) ^ { k } \tilde { A } ^ { k } + \alpha \sum _ { i = 0 } ^ { k - 1 } ( 1 - \alpha ) ^ { i } \tilde { A } ^ { i } \right) \underbrace { \mathbf { F } ( \Theta , X ) } _ { \mathrm { , f e a t u r e ~ e n c e d e r } }
175
+ $$
176
+
177
+ It first applies a feature encoder $\mathbf { F }$ on node features $X$ and approximated personalized pagerank matrix linearly. Thereby, we have $h _ { i } = \pi _ { i } ^ { \mathrm { p p r } }$ , where $\pi _ { i } ^ { \mathrm { p p r } }$ is the personalized pagerank vector. For this, we mitigate distributional shifts from graph inductive bias via instance weighting. Moreover, let $Z = \mathbf { F } ( \Theta , \bar { X } )$ and we can further reduce the distributional shifts from non-linear networks by the proposed discrepancy regularizer $d$ . In our experiments, we show the application of SR-GNN on two other representative GNN models: GCN [15] and DGI [32].
178
+
179
+ # 5 Experiments
180
+
181
+ In this section we first describe how we create training set with a controllable amount of bias, then discuss our experiment design, demonstrate the efficacy our proposed framework for handling bias as well as its advantages over domain adaptation baselines, and finally, present a study on sensitivity to the hyperparameters.
182
+
183
+ # 5.1 Biased Training Set Creation
184
+
185
+ In order to study distribution shift in GNNs, we require a repeatable process which can generate graphbiased training sets. The core aspect of creating a biased sample for graph learning tasks requires an efficient method for finding ‘nearby’ nodes in the graph for a particular seed node. In this work, we use the Personalized PageRank (PPR) vectors to find such nearby nodes, $\Pi ^ { \mathrm { p p r } } = ( I - ( 1 - \alpha ) \tilde { A } ) ^ { - 1 }$ . PPR vectors are well suited for this case for a number of reasons. First, several previous studies [36, 16] have shown strong correlations between the information diffusion in GNNs and PPR vectors. Second, a PPR vector can be computed for an individual node in time sublinear to the size of the graph $[ 2 ] - \mathsf { s o }$ biased training samples can be easily generated, even for large datasets. This local algorithm provides a sparse approximation $\Pi ^ { \mathrm { p p r } } ( \epsilon )$ with guaranteed truncation error $\epsilon$ , such that we can efficiently compute the top- $\gamma$ entries of a ppr vector with controllable residuals. Therefore, using PPR we can generate stable localized training data that can effectively challenge GNN models.
186
+
187
+ We obtain a biased sample from our scalable personalized pagerank sampler (PPR-S) as follows. For a certain label ratio $\tau$ , we compute the number of training nodes needed per label in advance. Then we repeatedly randomly select nodes that have enough neighbors in their sparse personalized pagerank vector $\pi _ { i } ^ { \mathrm { p p r } } ( \epsilon )$ . We add both the seed nodes and their neighbors with the same label into the training data until we have enough number of nodes for each label.
188
+
189
+ # 5.2 Experimental settings
190
+
191
+ Datasets. In our experiments, we perform semi-supervised node classification tasks on five popular benchmark datasets: Cora, Citeseer, Pubmed [27], ogb-arxiv [26] and Reddit [11]. We use the same validation and test splits as in the original GCN paper [15] and OGB benchmark. We use the remaining nodes for training. For the unbiased baseline’s performance numbers, we use a random sample from this training data. Similarly, for a biased training sample, we apply our biased sampler PPR-S on the training nodes to obtain a biased training sample and report its performance. The dataset statistics can be found in Appendix A.1.
192
+
193
+ Baselines. Following the two scenarios outlined in Section 4, we consider the following methods to investigate their performance under distributional shifts: (1) Traditional GNN Models: GCN [15], GAT [31], (2) Linearized GNNs: SGC [34] and APPNP [16]. We also include methods based on unsupervised node representation learning (DeepWalk [24] and DGI [32]) as a third category (3). For these methods, we use a linear classifier learned on top of pretrained node embeddings.
194
+
195
+ Scalable biased sampler. Our scalable biased sampler uses Personalized PageRank to efficiently create biased training samples in large graphs. Details are omitted for brevity here, but a full description can be found in Appendix A.2.
196
+
197
+ Our Method. If not otherwise specified, we consider the APPNP [16] instance of Shift-Robust as our base model, and also provide two ablations of it. These ablations independently use the shift-robust techniques introduced in Section 4.1 and 4.2 to validate the effectiveness of SR-GNN.
198
+
199
+ Hyperparameters. The main hyper parameters in our sampler PPR-S are $\alpha = 0 . 1 , \gamma = 1 0 0$ . When the graph is large, we set $\epsilon = 0 . 0 0 1$ in the local algorithm for sparse PPR approximation. In SRGNN, $\lambda = 1 . 0$ is the penalty parameter for the discrepancy regularizer $d$ , the lower bound for the instance weight $B _ { l }$ is 0.2. For all of the GNN methods except DGI, we set the hidden dimension as 32 for Cora, Citeseer, Pubmed and 256 for ogb-arxiv, with a dropout of 0.5. In order to learn effective representations, DGI [32] usually needs a higher dimensional hidden space and so, following the DGI paper we set it as 512 across all of our experiments. We use Adam [14] as an optimizer, and set the learning rate to 0.01 and $L _ { 2 }$ regularization to 5e-4.
200
+
201
+ Table 1: Semi-supervised classification on three different citation networks using biased training samples. Our proposed framework (SR-GNN) outperforms all baselines on biased training input.
202
+
203
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Cora</td><td colspan="3">Citeseer</td><td colspan="3">PubMed</td></tr><tr><td>Micro-F1↑</td><td>Macro-F1个</td><td>△F1↓</td><td>Micro-F1↑</td><td>Macro-F1↑</td><td>△F1↓</td><td>Micro-F1个</td><td>Macro-F1个</td><td>△F1↓</td></tr><tr><td>GCN (IID)</td><td>80.8 ± 1.6</td><td>80.1 ± 1.3</td><td>0</td><td>70.3 �� 1.9</td><td>66.8± 1.3</td><td>0</td><td>79.8 ± 1.4</td><td>78.8 ± 1.4</td><td>0</td></tr><tr><td>Feat.+MLP</td><td>49.7 ± 2.5</td><td>48.3±2.2</td><td>31.1</td><td>55.1± 1.3</td><td>52.7 ±1.3</td><td>25.2</td><td>51.3±2.8</td><td>41.8±6.2</td><td>28.5</td></tr><tr><td>Emb.+MLP</td><td>57.6±3.0</td><td>56.2± 3.0</td><td>23.2</td><td>38.5±1.2</td><td>38.6± 1.1</td><td>31.8</td><td>60.4± 2.1</td><td>56.6± 2.0</td><td>19.4</td></tr><tr><td>DGI</td><td>71.7 ± 4.2</td><td>69.2 ± 3.7</td><td>9.1</td><td>62.6± 1.6</td><td>60.0 ± 1.6</td><td>7.6</td><td>58.0±5.3</td><td>52.4±8.3</td><td>21.8</td></tr><tr><td>GCN</td><td>67.6 ± 3.5</td><td>66.4± 3.0</td><td>13.2</td><td>62.7 ± 1.8</td><td>60.4 ± 1.6</td><td>7.6</td><td>60.6± 3.8</td><td>56.0± 6.0</td><td>19.2</td></tr><tr><td>GAT</td><td>58.4±5.7</td><td>58.5± 5.0</td><td>22.4</td><td>58.0± 3.5</td><td>55.0±2.7</td><td>12.3</td><td>55.2± 3.7</td><td>46.0 ±6.4</td><td>14.6</td></tr><tr><td>SGC</td><td>70.2 ± 3.0</td><td>68.0±3.8</td><td>10.6</td><td>65.4± 0.8</td><td>62.5± 0.8</td><td>4.9</td><td>61.8± 4.5</td><td>57.4±7.2</td><td>18.0</td></tr><tr><td>APPNP</td><td>71.3 ± 4.1</td><td>69.2 ± 3.4</td><td>9.5</td><td>63.4 ± 1.8</td><td>61.2 ± 1.6</td><td>6.9</td><td>63.4 ± 4.2</td><td>58.7 ± 7.0</td><td>16.4</td></tr><tr><td>SR-GNN w.o. IR</td><td>72.1 ± 4.4</td><td>69.8 ± 3.7</td><td>8.7</td><td>63.9 ± 0.7</td><td>61.8 ± 0.6</td><td>6.4</td><td>69.4± 3.4</td><td>67.6±4.0</td><td>10.4</td></tr><tr><td>SR-GNN w.0. Reg.</td><td>72.0±3.2</td><td>69.5± 3.7</td><td>8.8</td><td>66.1 ±0.9</td><td>63.4±0.9</td><td>4.2</td><td>66.4 ± 4.0</td><td>64.0±5.5</td><td>13.4</td></tr><tr><td>SR-GNN (Ours)</td><td>73.5± 3.3</td><td>71.4± 3.5</td><td>7.3</td><td>67.1 ± 0.9</td><td>64.0± 0.9</td><td>3.2</td><td>71.3 ± 2.2</td><td>70.2 ± 2.4</td><td>8.5</td></tr></table>
204
+
205
+ Scalability. In this paper, we introduce two shift-robust techniques for GNN training: discrepancy regularization and instance reweighting. Let $\mathcal { O } ( \Phi )$ be the time some GNN $\Phi$ takes to compute a single node embedding, and $M$ be the number of training examples. The IID sample in Eq (5) introduces $M$ extra forward passes and $2 M$ extra backward propagation in total. Overall, the extra cost is therefore linear to and does not increase the existing asymptotic complexity. The Gaussian kernel computation in Eq (9) (for instance reweighting) takes $\mathcal { \bar { O } } ( \bar { M } ^ { 2 } n )$ time before training, where $h _ { i } \in \mathbb { R } ^ { n }$ . The total complexity of SR-GNN is therefore $\mathcal { O } ( M \Phi + M ^ { 2 } n )$ . Our experiments were run on a single machine with 8 CPU and 1 Nvidia T4 GPU.
206
+
207
+ # 5.3 Experiment results
208
+
209
+ We first show the performance comparison of SR-GNN (ours) and other baselines on three wellknown citation GNN benchmarks in Table 6. We report the Micro-F1, and Macro-F1 for each method. We compare each method trained on a biased sample to a GCN trained on an unbiased sample, and report its performance drop in Micro-F1 (∆F1). We begin by noting that when the training sample is biased, every method suffers a substantial performance drop (as indicated by the column $\Delta \mathsf { F } 1 $ ). However, SR-GNN consistently reduces the influence of distributional shift and decreases the performance drop (∆F1) relative to a GCN model trained on biased input by at least $40 \%$ . We note that on these three datasets, the largest decrease in performance occurs on PubMed, where all of the existing methods experience more than a $10 \%$ absolute drop in their performance due to the biased samples. However we note that in this challenging case, the improvements of SR-GNN against APPNP (base model) also grow when the shift is larger. Finally, we see from the ablation models that the combination of both the regularization and instance reweighting appears to work better than either bias correction on its own. Our results demonstrate that our shift-robust framework is effective at minimizing the effects of distributional shift in GNN training data.
210
+
211
+ On two large benchmarks in Table 2 we see that the performance loss from biased sample is smaller but still significant. Even in a dense network like reddit, the localized training data still affect the GNN model performance. Compared with baselines, SR-GNN can effectively mitigate the $30 \%$ of the negative effect $( \Delta )$ relative to an unbiased GCN. When more training data is provided $( 5 \% )$ we can further minimize this performance gap.
212
+
213
+ Finally, we also study how our Shift-Robust framework can be applied to two other representative models – GCNs [15], and DGI [32]. For the GCN model, we apply the regularized loss from the Equation (4) to the final node representations. For DGI, the embeddings are first trained via unsupervised learning over the entire graph. In this case, as we are optimizing a simple logistic regression over the DGI representations we can use only the instance reweighting regularization from Equation (9). Table 3 confirms that the the Shift-Robust framework successfully improves task performance in the face of biased training labels, and that it can be easily applied to a variety of different GNN models.
214
+
215
+ Table 2: Semi-supervised classification on ogb-arxiv and reddit varying label ratio.
216
+
217
+ <table><tr><td rowspan=3 colspan=1>label(%)Method</td><td rowspan=3 colspan=5>ogb-arxiv 一1% 5%Accuracy △↓ Accuracy一△</td><td rowspan=2 colspan=5>reddit1% 5%</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>5%</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1%</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>△↓</td><td rowspan=1 colspan=2>Accuracy</td><td rowspan=1 colspan=1>一△</td><td rowspan=1 colspan=1>Accuracy</td><td rowspan=1 colspan=1>△←</td><td rowspan=1 colspan=2>Accuracy</td><td rowspan=1 colspan=1>△</td></tr><tr><td rowspan=1 colspan=1>GCN (IID)</td><td rowspan=1 colspan=1>66.0± 0.6</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=2>69.1± 0.6</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>93.8± 0.3</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=2>94.0 ± 0.1</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>Feat.+MLP</td><td rowspan=1 colspan=1>45.5± 0.6</td><td rowspan=1 colspan=1>21.5</td><td rowspan=1 colspan=2>43.7± 0.3</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>46.6±0.6</td><td rowspan=1 colspan=1>47.2</td><td rowspan=1 colspan=2>57.2±0.2</td><td rowspan=1 colspan=1>36.8</td></tr><tr><td rowspan=1 colspan=1>Emb.+MLP</td><td rowspan=1 colspan=1>51.1± 1.3</td><td rowspan=1 colspan=1>14.9</td><td rowspan=1 colspan=2>56.9± 0.8</td><td rowspan=1 colspan=1>13.2</td><td rowspan=1 colspan=1>89.6 ± 0.8</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=2>90.9 ±0.3</td><td rowspan=1 colspan=1>3.1</td></tr><tr><td rowspan=1 colspan=1>DGI</td><td rowspan=1 colspan=1>44.8±3.0</td><td rowspan=1 colspan=1>21.2</td><td rowspan=1 colspan=2>49.7± 3.3</td><td rowspan=1 colspan=1>19.4</td><td rowspan=1 colspan=1>83.7±1.2</td><td rowspan=1 colspan=1>10.1</td><td rowspan=1 colspan=2>85.4±0.6</td><td rowspan=1 colspan=1>8.6</td></tr><tr><td rowspan=1 colspan=1>GCN</td><td rowspan=1 colspan=1>59.3±1.2</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=2>65.3 ± 0.6</td><td rowspan=1 colspan=1>3.8</td><td rowspan=1 colspan=1>89.7±1.0</td><td rowspan=1 colspan=1>4.1</td><td rowspan=1 colspan=2>90.9±0.3</td><td rowspan=1 colspan=1>3.1</td></tr><tr><td rowspan=3 colspan=1>GATSGCAPPNP</td><td rowspan=1 colspan=1>58.6±1.0</td><td rowspan=1 colspan=1>7.4</td><td rowspan=2 colspan=2>63.4 ± 1.064.2 ± 1.3</td><td rowspan=1 colspan=1>5.7</td><td rowspan=1 colspan=1>80.5±5.4</td><td rowspan=1 colspan=1>13.3</td><td rowspan=3 colspan=2>82.0±3.690.6±0.288.9±0.8</td><td rowspan=2 colspan=1>82.0±3.6</td></tr><tr><td rowspan=1 colspan=1>59.0±0.7</td><td rowspan=1 colspan=1>7.0</td><td rowspan=1 colspan=1>64.2 ± 1.3</td><td rowspan=1 colspan=1>4.9</td><td rowspan=1 colspan=1>88.6±1.0</td><td rowspan=2 colspan=1>5.25.4</td></tr><tr><td rowspan=1 colspan=1>59.8± 1.1</td><td rowspan=1 colspan=1>6.2</td><td rowspan=1 colspan=2>65.1 ± 2.6</td><td rowspan=1 colspan=1>4.0</td><td rowspan=1 colspan=1>88.4±1.0</td><td rowspan=1 colspan=1>5.1</td></tr><tr><td rowspan=3 colspan=1>SR-GNN w.o. IRSR-GNN w.0. Reg.SR-GNN (Ours)</td><td rowspan=1 colspan=1>60.6±0.2</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=2>65.1±1.8</td><td rowspan=1 colspan=1>4.0</td><td rowspan=2 colspan=1>90.4± 0.689.4± 0.8</td><td rowspan=3 colspan=1>3.44.42.3</td><td rowspan=3 colspan=2>91.2±0.291.9± 0.192.1± 0.3</td><td rowspan=3 colspan=1>2.82.11.9</td></tr><tr><td rowspan=1 colspan=1>61.0± 0.3</td><td rowspan=1 colspan=1>5.0</td><td rowspan=1 colspan=2>65.8±2.0</td><td rowspan=1 colspan=1>3.3</td></tr><tr><td rowspan=1 colspan=1>61.6±0.6</td><td rowspan=1 colspan=1>4.4</td><td rowspan=1 colspan=2>66.5±0.6</td><td rowspan=1 colspan=1>2.6</td><td rowspan=1 colspan=1>91.5± 0.5</td></tr></table>
218
+
219
+ Table 3: Comparison of baseline and our SR(Shift-Robust) version $\Delta ( \% )$ -relative loss with biased sample) .
220
+
221
+ <table><tr><td></td><td colspan="3">Cora</td><td colspan="3">Citeseer</td><td colspan="3">PubMed</td></tr><tr><td>Method</td><td>Micro-F1↑</td><td>Macro-F1↑|</td><td>△(%)</td><td>Micro-F1个</td><td>Macro-F1↑</td><td>△(%)</td><td>Micro-F1↑</td><td>Macro-F1↑|4</td><td>△(%)</td></tr><tr><td>GCN (IID)</td><td>80.8</td><td>80.1</td><td>0%</td><td>70.3</td><td>66.8</td><td>0%</td><td>79.8</td><td>78.8</td><td>0%</td></tr><tr><td>GCN</td><td>67.6</td><td>66.4</td><td>-12%</td><td>62.7</td><td>60.4</td><td>-8%</td><td>60.6</td><td>56.0</td><td>-19%</td></tr><tr><td>SR-GCN</td><td>69.6</td><td>68.2</td><td>-10%</td><td>64.7</td><td>62.0</td><td>-6%</td><td>67.0</td><td>65.2</td><td>-13%</td></tr><tr><td>DGI (IID)</td><td>80.6</td><td>79.3</td><td>0%</td><td>70.8</td><td>66.7</td><td>0%</td><td>77.6</td><td>77.0</td><td>0%</td></tr><tr><td>DGI</td><td>71.7</td><td>69.2</td><td>-9%</td><td>62.6</td><td>60.0</td><td>-8%</td><td>58.0</td><td>52.4</td><td>-20%</td></tr><tr><td>SR-DGI</td><td>74.3</td><td>72.6</td><td>-6%</td><td>65.8</td><td>62.6</td><td>-6%</td><td>62.0</td><td>57.8</td><td>-16%</td></tr></table>
222
+
223
+ # 5.4 Comparison with other domain invariant learning methods
224
+
225
+ In SR-GNN, we utilize the unlabeled data $Z _ { \mathrm { I I D } }$ sampled from the unifying set of training and test dataset. In domain invariant learning [6, 37], unlabeled data from target domain is also used to regularize latent space between source and target domain. DANN [6] is a method that uses an adversarial domain classifier to encourage similar feature distributions between different domains. In our case, the domains are a biased training data (source) and IID unlabeled data (target). We compare the CMD regularizer and DANN regularizer using the same GNN architectures (i.e. GCN [15], APPNP [16]). The hyper parameter $\lambda$ is used to weight the domain loss and the CMD regularization respectively. We tune this hyper parameter on the validation set and report models’ performance under the best $\lambda$ (1 for Cora and Citeseer, 0.1 for PubMed). In Table 4, as discussed in the related work, the discrepancy measures generally perform better than adversarial domain invariant learning (and CMD has been shown to be less sensitive to the regularizer weight). Especially under semi-supervised setting, the performance of DANN is more sensitive to the domain loss. Notice that CMD (Ours) is the ablation (SR-GNN w.o. IR) in the main paper – we note that we have already shown its performance can be further boosted using instance reweighting.
226
+
227
+ Table 4: Comparison of Domain-Adversarial Neural Network (DANN) and CMD regularizer used in SR-GNN with biased training data.
228
+
229
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Cora</td><td colspan="2">Citeseer</td><td colspan="2">PubMed</td></tr><tr><td>Micro-F1个</td><td>Macro-F1个</td><td>Micro-F1↑</td><td>Macro-F1个</td><td>Micro-F1↑</td><td>Macro-F1个</td></tr><tr><td>GCN</td><td>68.3</td><td>67.2</td><td>62.4</td><td>60.2</td><td>59.2</td><td>53.8</td></tr><tr><td>DANN</td><td>69.8</td><td>68.5</td><td>63.8</td><td>61.0</td><td>64.8</td><td>61.8</td></tr><tr><td>CMD (Ours)</td><td>71.0</td><td>69.4</td><td>65.0</td><td>62.3</td><td>67.5</td><td>66.2</td></tr><tr><td>APPNP</td><td>71.3</td><td>69.2</td><td>63.9</td><td>61.6</td><td>64.8</td><td>60.4</td></tr><tr><td>DANN</td><td>71.6</td><td>69.5</td><td>64.3</td><td>61.8</td><td>67.8</td><td>65.4</td></tr><tr><td>CMD (Ours)</td><td>72.4</td><td>70.1</td><td>65.0</td><td>62.4</td><td>70.4</td><td>68.7</td></tr></table>
230
+
231
+ # 5.5 Parameter sensitivity of SR-GNN
232
+
233
+ In this section we study how varying some of our hyper-parameters affects the performance. We perform 20 runs for each parameter and fix the initialization for all the models per run. Studies on SR-GNN with more layers (deeper models) and different biased samples are in Appendix A.3.
234
+
235
+ Performance with different $\alpha$ in PPR-S. Previously, we set $\alpha = 0 . 1$ in the biased sampler PPR-S. In Figure 3, we vary $\alpha$ between [0.05, 0.3] to evaluate the performance of APPNP and SR-GNN as the bias of the sample changes. While the absolute accuracy varies with different $\alpha$ , SR-GNN consistently beats its base model by a clear margin. The different patterns across three datasets are expected, since as $\alpha$ grows, the PPR-neighbors can have different topological properties and structure.
236
+
237
+ ![](images/324c27b25342da9999e9247bfc99a8107f468b745ea0b5da84089164ced9549a.jpg)
238
+ Figure 3: Varying $\alpha$ of biased sampler on three benchmarks.
239
+
240
+ Performance with different $B _ { l }$ , $\lambda$ in SR-GNN. In our framework, there are three major hyper parameters: the regularization strength $\lambda$ , the number of moments used in CMD $k$ , and the bounds of instance weights: $B _ { l } , B _ { u }$ . In Figure 4a, the performance of SR-GNN with different $k$ and $\lambda$ is reported. Even when only one moment is used for the CMD estimation, the method can still perform well with a reasonable penalty $\lambda$ . We study different choices of $B _ { l }$ (for a constant $B _ { u . }$ ) in Figure 4b. The result shows a smaller $B _ { l }$ is better for training since larger values limit the expressive range.
241
+
242
+ ![](images/d4a243763d44827750c9a39dbdae238f161117fd225379bb0442afdb44661025.jpg)
243
+ Figure 4: Parameter sensitivity of SR-GNN.
244
+
245
+ # 6 Conclusion
246
+
247
+ In this paper we were the first to demonstrate that unbiased training data is very important for performance of GNNs. We argued that biased training data is extremely common in real world scenarios and can arise due to a variety of reasons including: difficulties of labelling large amount of data, the various heuristics or inconsistent techniques that are used to choose nodes for labelling, delayed label assignment, and other constraints from real world problems. We presented a general framework (SR-GNN) that is able to reduce influence of biased training data and can be applied to various types of GNNs, including both deeper GNNs and more recent linearized (shallow) versions of these models. With a number of experiments, we demonstrated both GNNs susceptibility to biased data and the success of our method in mitigating performance drops due to this bias: our method outperforms other GNN baselines on biased data and eliminates between $( 3 0 - 5 0 \% )$ ) of the negative effects introduced by training a GCN on biased training data.
248
+
249
+ However, there is still much to do. For instance, while we have considered the general problem of distributional shift in GNNs, there is much specific work that can (and should) be done in specific domains! Future work in this area should include regularizations to maximize performance for particular kinds of distribution shift (e.g. in spam & abuse detection) and to ensure constraints (e.g. fairness) in the presence of imbalanced training data.
250
+
251
+ # Acknowledgments and Disclosure of Funding
252
+
253
+ Research was supported in part by US DARPA KAIROS Program No. FA8750-19-2-1004, SocialSim Program No. W911NF-17-C-0099, and INCAS Program No. HR001121C0165, National Science Foundation IIS-19-56151, IIS-17-41317, and IIS 17-04532, and the Molecule Maker Lab Institute: An AI Research Institutes program supported by NSF under Award No. 2019897. Any opinions, findings, and conclusions or recommendations expressed herein are those of the authors and do not necessarily represent the views, either expressed or implied, of DARPA or the U.S. Government. We would like to thank AWS Machine Learning Research Awards program for providing computational resources for the experiments in this paper.
254
+
255
+ # References
256
+
257
+ [1] Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Nazanin Alipourfard, Kristina Lerman, Hrayr Harutyunyan, Greg Ver Steeg, and Aram Galstyan. MixHop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In Proceedings of the 36th International Conference on Machine Learning, pages 21–29. PMLR, 2019.
258
+ [2] Reid Andersen, Fan Chung, and Kevin Lang. Local graph partitioning using pagerank vectors. In 2006 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS’06), pages 475–486. IEEE, 2006.
259
+ [3] Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Mach. Learn., 79(1–2):151–175, May 2010.
260
+ [4] Aleksandar Bojchevski, Johannes Klicpera, Bryan Perozzi, Amol Kapoor, Martin Blais, Benedek Rózemberczki, Michal Lukasik, and Stephan Günnemann. Scaling graph neural networks with approximate pagerank. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2464–2473, 2020.
261
+ [5] Ines Chami, Sami Abu-El-Haija, Bryan Perozzi, Christopher Ré, and Kevin Murphy. Machine learning on graphs: A model and comprehensive taxonomy. arXiv preprint arXiv:2005.03675, 2020.
262
+ [6] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franccois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks, 2016.
263
+ [7] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pages 1263–1272. PMLR, 2017.
264
+ [8] Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. The Journal of Machine Learning Research, 13(1):723–773, 2012.
265
+ [9] Arthur Gretton, Alex Smola, Jiayuan Huang, Marcel Schmittfull, Karsten Borgwardt, and Bernhard Schölkopf. Covariate shift by kernel mean matching. Dataset shift in machine learning, 3(4):5, 2009.
266
+ [10] Jonathan Halcrow, Alexandru Mosoi, Sam Ruth, and Bryan Perozzi. Grale: Designing networks for graph learning. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2523–2532, 2020.
267
+ [11] Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pages 1024–1034, 2017.
268
+ [12] Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020.
269
+ [13] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. In International Conference on Learning Representations, 2019.
270
+ [14] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
271
+ [15] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
272
+ [16] Johannes Klicpera, Aleksandar Bojchevski, and Stephan Günnemann. Predict then propagate: Graph neural networks meet personalized pagerank. arXiv preprint arXiv:1810.05997, 2018.
273
+ [17] Wouter M. Kouw. An introduction to domain adaptation and transfer learning. CoRR, abs/1812.11806, 2018.
274
+ [18] Ziqi Liu, Chaochao Chen, Xinxing Yang, Jun Zhou, Xiaolong Li, and Le Song. Heterogeneous graph neural networks for malicious account detection. In Proceedings of the 27th ACM International Conference on Information and Knowledge Management, pages 2077–2085, 2018.
275
+ [19] Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I. Jordan. Learning transferable features with deep adaptation networks. In Proceedings of the 32nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, page 97–105. JMLR.org, 2015.
276
+ [20] Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I. Jordan. Deep transfer learning with joint adaptation networks. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML’17, page 2208–2217. JMLR.org, 2017.
277
+ [21] Xinhong Ma, Tianzhu Zhang, and Changsheng Xu. Gcan: Graph convolutional adversarial network for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8266–8276, 2019.
278
+ [22] Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. Domain adaptation: Learning bounds and algorithms. CoRR, abs/0902.3430, 2009.
279
+ [23] John Palowitch and Bryan Perozzi. Debiasing graph representations via metadata-orthogonal training. In 2020 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM), pages 435–442. IEEE, 2020.
280
+ [24] Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 701–710. ACM, 2014.
281
+ [25] Joaquin Quiñonero-Candela, Masashi Sugiyama, Neil D Lawrence, and Anton Schwaighofer. Dataset shift in machine learning. Mit Press, 2009.
282
+ [26] Marinka Zitnik Yuxiao Dong Hongyu Ren, Bowen Liu Michele Catasta Jure Leskovec, Weihua Hu, and Matthias Fey. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020.
283
+ [27] Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina EliassiRad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
284
+ [28] Xiao Shen, Quanyu Dai, Sitong Mao, Fu-lai Chung, and Kup-Sze Choi. Network together: Node classification via cross-network deep network embedding. IEEE Transactions on Neural Networks and Learning Systems, 2020.
285
+ [29] Hidetoshi Shimodaira. Improving predictive inference under covariate shift by weighting the log-likelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000.
286
+ [30] Anton Tsitsulin, John Palowitch, Bryan Perozzi, and Emmanuel Müller. Graph clustering with graph neural networks. arXiv preprint arXiv:2006.16904, 2020.
287
+ [31] Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018.
288
+ [32] Petar Velickovic, William Fedus, William L Hamilton, Pietro Liò, Yoshua Bengio, and R Devon Hjelm. Deep graph infomax. In International Conference on Learning Representations, 2019.
289
+ [33] Daixin Wang, Jianbin Lin, Peng Cui, Quanhui Jia, Zhen Wang, Yanming Fang, Quan Yu, Jun Zhou, Shuang Yang, and Yuan Qi. A semi-supervised graph attentive network for financial fraud detection. In 2019 IEEE International Conference on Data Mining (ICDM), pages 598–607. IEEE, 2019.
290
+ [34] Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In International conference on machine learning, pages 6861–6871. PMLR, 2019.
291
+ [35] Man Wu, Shirui Pan, Chuan Zhou, Xiaojun Chang, and Xingquan Zhu. Unsupervised domain adaptive graph convolutional networks. In Proceedings of The Web Conference 2020, 2020.
292
+ [36] Louis-Pascal Xhonneux, Meng Qu, and Jian Tang. Continuous graph neural networks. In International Conference on Machine Learning, pages 10432–10441. PMLR, 2020.
293
+ [37] Werner Zellinger, Thomas Grubinger, Edwin Lughofer, Thomas Natschläger, and Susanne Saminger-Platz. Central moment discrepancy (cmd) for domain-invariant representation learning. arXiv preprint arXiv:1702.08811, 2017.
294
+ [38] Werner Zellinger, Bernhard A. Moser, Thomas Grubinger, Edwin Lughofer, Thomas Natschläger, and Susanne Saminger-Platz. Robust unsupervised domain adaptation for neural networks via moment alignment. Information Sciences, 483:174–191, May 2019.
295
+ [39] Qi Zhu, Carl Yang, Yidan Xu, Haonan Wang, Chao Zhang, and Jiawei Han. Transfer learning of graph neural networks with ego-graph information maximization. In NeurIPS, 2021.
md/train/vllRjSTWcLs/vllRjSTWcLs.md ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Rethinking Space-Time Networks with Improved Memory Coverage for Efficient Video Object Segmentation
2
+
3
+ Ho Kei Cheng† University of Illinois Urbana-Champaign hokeikc2@illinois.edu
4
+
5
+ Yu-Wing Tai
6
+ Kuaishou
7
+ Technology
8
+ yuwing@gmail.com
9
+
10
+ Chi-Keung Tang The Hong Kong University of Science and Technology cktang@cs.ust.hk
11
+
12
+ # Abstract
13
+
14
+ This paper presents a simple yet effective approach to modeling space-time correspondences in the context of video object segmentation. Unlike most existing approaches, we establish correspondences directly between frames without reencoding the mask features for every object, leading to a highly efficient and robust framework. With the correspondences, every node in the current query frame is inferred by aggregating features from the past in an associative fashion. We cast the aggregation process as a voting problem and find that the existing inner-product affinity leads to poor use of memory with a small (fixed) subset of memory nodes dominating the votes, regardless of the query. In light of this phenomenon, we propose using the negative squared Euclidean distance instead to compute the affinities. We validate that every memory node now has a chance to contribute, and experimentally show that such diversified voting is beneficial to both memory efficiency and inference accuracy. The synergy of correspondence networks and diversified voting works exceedingly well, achieves new state-of-the-art results on both DAVIS and YouTubeVOS datasets while running significantly faster at $^ { 2 0 + }$ FPS for multiple objects without bells and whistles.
15
+
16
+ # 1 Introduction
17
+
18
+ Video object segmentation (VOS) aims to identify and segment target instances in a video sequence. This work focuses on the semi-supervised setting where the first-frame segmentation is given and the algorithm needs to infer the segmentation for the remaining frames. This task is an extension of video object tracking [1, 2], requiring detailed object masks instead of simple bounding boxes. A high-performing algorithm should be able to delineate an object from the background or other distractors (e.g., similar instances) under partial or complete occlusion, appearance changes, and object deformation [3].
19
+
20
+ Most current methods either fit a model using the initial segmentation [4, 5, 6, 7, 8, 9] or leverage temporal propagation [10, 11, 12, 13, 14, 15, 16], particularly with spatio-temporal matching [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]. Space-Time Memory networks [18] are especially popular recently due to its high performance and simplicity – many variants [22, 16, 23, 21, 24, 28, 29, 30], including competitions’ winners [31, 32], have been developed to improve the speed, reduce memory usage, or to regularize the memory readout process of STM.
21
+
22
+ In this work, we aim to subtract from STM to arrive at a minimalistic form of matching networks, dubbed Space-Time Correspondence Network (STCN) 1. Specifically, we start from the basic premise that correspondences are target-agnostic. Instead of building a specific memory bank and therefore affinity for every object in the video as in STM, we build a single affinity matrix using only RGB relations. For querying, each target object passes through the same affinity matrix for feature transfer. This is not only more efficient but also more robust – the model is forced to learn all object relations beyond just the labeled ones. With the learned affinity, the algorithm can propagate features from the first frame to the rest of the video sequence, with intermediate features stored as memory.
23
+
24
+ While STCN already reaches state-of-the-art performance and speed in this simple form, we further probe into the inner workings of the construction of affinities. Traditionally, affinities are constructed from dot products followed by a softmax as in attention mechanisms [18, 33]. This however implicitly encoded “confidence” (magnitude) with high-confidence points dominating the affinities all the time, regardless of query features. Some memory nodes will therefore be always suppressed, and the (large) memory bank will be underutilized, reducing effective diversity and robustness. We find this to be harmful, and propose using the negative squared Euclidean distance as a similarity measure with an efficient implementation instead. Though simple, this small change ensures that every memory node has a chance to contribute significantly (given the right query), leading to better performance, higher robustness, and more efficient use of memory.
25
+
26
+ Our contribution is three-fold:
27
+
28
+ • We propose STCN with direct image-to-image correspondence that is simpler, more efficient, and more effective than STM.
29
+ • We examine the affinity in detail, and propose using L2 similarity in place of dot product for a better memory coverage, where every memory node contributes instead of just a few.
30
+ • The synergy of the above two results in a simple and strong method, which suppresses previous state-of-the-art performance without additional complications while running fast at $^ { 2 0 + }$ FPS.
31
+
32
+ # 2 Related Works
33
+
34
+ Correspondence Learning Finding correspondences is one of the most fundamental problems in computer vision. Local correspondences have been used heavily in optical flow [34, 35, 36] and object tracking [37, 38, 39] with fast running time and high performance. More explicit correspondence learning has also been achieved with deep learning [40, 41, 42].
35
+
36
+ Few-shots learning can be considered as a matching problem where the query is compared with every element in the support set [43, 44, 45, 46]. Typical approaches use a Siamese network [47] and compare the embedded query/support features using a similarity measure such as cosine similarity [43], squared Euclidean distance [48], or even a learned function [49]. Our task can also be formulated as a few-shots problem, where our memory bank acts as the support set. This connection helps us with the choice of similarity function, albeit we are dealing with a million times more pointwise comparisons.
37
+
38
+ Video Object Segmentation Early VOS methods [4, 5, 50] employ online first-frame finetuning which is very slow in inference and have been gradually phased out. Faster approaches have been proposed such as a more efficient online learning algorithm [8, 6, 7], MRF graph inference [51], temporal CNN [52], capsule routing [53], tracking [11, 13, 15, 54, 55, 56, 57], embedding learning [10, 58, 59] and space-time matching [17, 18, 19, 20]. Embedding learning bears a high similarity to space-time matching, both attempting to learn a deep feature representation of an object that remains consistent across a video. Usually embedding learning methods are more constrained [10, 58], adopting local search window and hard one-to-one matching.
39
+
40
+ We are particularly interested in the class of Space-Time Memory networks (STM) [18] which are the backbone for many follow-up state-of-the-art VOS methods. STM constructs a memory bank for each object in the video, and matches every query frame to the memory bank to perform “memory readout”. Newly inferred frames can be added to the memory, and then the algorithm propagates forward in time. Derivatives either apply STM at other tasks [21, 60], improve the training data or augmentation policy [21, 22], augment the memory readout process [16, 21, 22, 24, 28], use optical flow [29], or reduce the size of the memory bank by limiting its growth [23, 30]. MAST [61] is an adjacent research that focused on unsupervised learning with a photometric reconstruction loss. Without the input mask, they use Siamese networks on RGB images to build the correspondence out of necessity. In this work, we deliberately build such connections and establish that building correspondences between images is a better choice, even when input masks are available, rather than a concession.
41
+
42
+ We propose to overhaul STM into STCN where the construction of affinity is redefined to be between frames only. We also take a close look at the similarity function, which has always been the dot product in all STM variants, make changes and comparisons according to our findings. The resultant framework is both faster and better while still principled. STCN is even fundamentally simpler than STM, and we hope that STCN can be adopted as the new and efficient backbone for future works.
43
+
44
+ # 3 Space-Time Correspondence Networks (STCN)
45
+
46
+ Given a video sequence and the first-frame annotation, we process the frames sequentially and maintain a memory bank of features. For each query frame, we extract a key feature which is compared with the keys in the memory bank, and retrieve corresponding value features from memory using key affinities as in STM [18].
47
+
48
+ ![](images/34d3120c9edd09edfc84a96a19bf7049cd284a0bec343bbc927b48cbda2d2d98.jpg)
49
+ Figure 1: Left: The general framework of the popularly used Space-Time Memory (STM) networks, ignoring fine-level variations. Objects are encoded separately, and affinities are specific to each object. Right: Our proposed Space-Time Correspondence Networks (STCN). We use Siamese key encoders to compute affinity directly from RGB images, making it more robust and efficient. Note that the query key can be cached and reused later as a memory key (unlike in STM) as it is independent of the mask.
50
+
51
+ # 3.1 Feature Extraction
52
+
53
+ Figure 1 illustrates the overall flow of STCN. While STM [18] parameterizes a Query Encoder (image as input) and a Memory Encoder (image and mask as input) with two ResNet50 [62], we instead construct a Key Encoder (image as input) and a Value Encoder (image and mask as input) with a ResNet50 and a ResNet18 respectively. Thus, unlike in STM [18], the key features (and thus the resultant affinity) can be extracted independently without the mask, computed only once for each frame, and symmetric between memory and query.2 The rationales are 1) Correspondences (key features) are more difficult to extract than value, hence a deeper network, and 2) Correspondences should exist between frames in a video, and there is little reason to introduce the mask as a distraction. From another perspective, we are using a Siamese structure [47] which is widely adopted in few-shots learning [63, 49] for computing the key features, as if our memory bank is the few-shots support set. As the key features are independent of the mask, we can reuse the “query key” later as a “memory key” if we decide to turn the query frame into a memory frame during propagation (strategy to be discussed in Section 3.3). This means the key encoder is used exactly once per image in the entire process, despite the two appearances in Figure 1 (which is for brevity).
54
+
55
+ Architecture. Following the STM practice [18], we take res4 features with stride 16 from the base ResNets as our backbone features and discard res5. A $3 \times 3$ convolutional layer without non-linearity is used as a projection head from the backbone feature to either the key space ( $C ^ { k }$ dimensional) or the value space $C ^ { v }$ dimensional). We set $C ^ { v }$ to be 512 following STM and discuss the choice of $C ^ { k }$ in Section 4.1.
56
+
57
+ Feature reuse. As seen from Figure 1, both the key encoder and the value encoder are processing the same frame, albeit with different inputs. It is natural to reuse features from the key encoder (with fewer inputs and a deeper network) at the value encoder. To avoid bloating the feature dimensions and for simplicity, we concatenate the last layer features from both encoders (before the projection head) and process them with two ResBlocks [62] and a CBAM block3 [64] as the final value output.
58
+
59
+ # 3.2 Memory Reading and Decoding
60
+
61
+ Given $T$ memory frames and a query frame, the feature extraction step would generate the followings: memory key $\mathbf { k } ^ { M } \in \mathbb { R } ^ { C ^ { k } \times T H W }$ , memory value $\mathbf { v } ^ { M } \in \mathbb { R } ^ { C ^ { v } \times T H W }$ , and query key $\mathbf { k } ^ { Q } \in \mathbb { R } ^ { C ^ { k } \times H W }$ , where H and W are (stride 16) spatial dimensions. Then, for any similarity measure c : RCk × $c : \mathbb { R } ^ { C ^ { k } } \times \mathbb { R } ^ { C ^ { k } } $ $\mathbb { R }$ , we can compute the pairwise affinity matrix $\mathbf { S }$ and the softmax-normalized affinity matrix $\mathbf { W }$ , where S $, \mathbf { W } \in \dot { \mathbb { R } } ^ { T H W \times \dot { H } W }$ with:
62
+
63
+ $$
64
+ { \bf S } _ { i j } = c ( { \bf k } _ { i } ^ { M } , { \bf k } _ { j } ^ { Q } ) \qquad { \bf W } _ { i j } = \frac { \exp { ( { \bf S } _ { i j } ) } } { \sum _ { n } { ( \exp { ( { \bf S } _ { n j } ) } ) } } ,
65
+ $$
66
+
67
+ where $\mathbf { k } _ { i }$ denotes the feature vector at the $i$ -th position. The similarities are normalized by $\sqrt { C ^ { k } }$ as in standard practice [18, 33] and is not shown for brevity. In STM [18], the dot product is used as $c$ Memory reading regularization like KMN [22] or top- $k$ filtering [21] can be applied at this step.
68
+
69
+ With the normalized affinity matrix $\mathbf { W }$ , the aggregated readout feature $\mathbf { v } ^ { Q } \in \mathbb { R } ^ { C ^ { v } \times H W }$ for the query frame can be computed as a weighted sum of the memory features with an efficient matrix multiplication:
70
+
71
+ $$
72
+ \begin{array} { r } { \mathbf { v } ^ { Q } = \mathbf { v } ^ { M } \mathbf { W } , } \end{array}
73
+ $$
74
+
75
+ which is then passed to the decoder for mask generation.
76
+
77
+ In the case of multi-object segmentation, only Equation 2 has to be repeated as W is defined between image features only, and thus is the same for different objects. In the case of STM [18], W must be recomputed instead. Detailed running time analysis can be found in Section 6.2.
78
+
79
+ Decoder. Our decoder structure stays close to that of the STM [18] as it is not the focus of this paper. Features are processed and upsampled at a scale of two gradually with higher-resolution features from the key encoder incorporated using skip-connections. The final layer of the decoder produces a stride 4 mask which is bilinearly upsampled to the original resolution. In the case of multiple objects, soft aggregation [18] of the output masks is used.
80
+
81
+ # 3.3 Memory Management
82
+
83
+ So far we have assumed the existence of a memory bank of size $T$ . Here, we will describe the construction of the memory bank. For each memory frame, we store two items: memory key and memory value. Note that all memory frames (except the first one) are once query frames. The memory key is simply reused from the query key, as described in Section 3.1 without extra computation. The memory value is computed after mask generation of that frame, independently for each object as the value encoder takes both the image and the object mask as inputs.
84
+
85
+ STM [18] consider every fifth query frame as a memory frame, and the immediately previous frame as a temporary memory frame to ensure accurate matching. In the case of STCN, we find that it is unnecessary, and in fact harmful, to include the last frame as temporary memory. This is a direct consequence of using shared key encoders – 1) key features are sufficiently robust to match well without the need for close-range (temporal) propagation, and 2) the temporary memory key would otherwise be too similar to that of the query, as the image context usually changes smoothly and we do not have the encoding noises resultant from distinct encoders, leading to drifting.4 This modification also reduces the number of calls to the value encoder, contributing a significant speedup.
86
+
87
+ Table 1: Performance comparison between STM and STCN under different memory configurations on the DAVIS 2017 validation set [65].
88
+
89
+ <table><tr><td rowspan="2"></td><td colspan="2">STM</td><td colspan="2">STCN</td></tr><tr><td>Every 5th + Last</td><td>Every 5th only </td><td>Every 5th + Last</td><td>Every 5th only</td></tr><tr><td>J&amp;F</td><td>82.7</td><td>81.0</td><td>83.1</td><td>85.4</td></tr><tr><td>FPS</td><td>12.3</td><td>16.7</td><td>15.4</td><td>20.2</td></tr></table>
90
+
91
+ Table 1 tabulates the performance comparisons between STM and STCN. For a video of length $L$ with $m \geq 1$ objects, and a final memory bank of size $T < L$ , STM [18] would need to invoke the memory encoder and compute the affinity $m L$ times. Our proposed STCN, on the other hand, only invokes the value encoder $m T$ times and computes the affinity $L$ times. It is therefore evident that STCN is significantly faster. Section 6.2 provides a breakdown of running time.
92
+
93
+ # 4 Computing Affinity
94
+
95
+ The similarity function $c : \mathbb { R } ^ { C ^ { k } } \times \mathbb { R } ^ { C ^ { k } } \to \mathbb { R }$ plays a crucial role in both STM and STCN, as it supports the construction of affinity that is central to both correspondences and memory reading. It also has to be fast and memory-efficient as there can be up to 50M pairwise relations $( T H W \times H W )$ to compute for just one query frame.
96
+
97
+ To recap, we need to compute the similarity between a memory key $\mathbf { k } ^ { M } \in \mathbb { R } ^ { C ^ { k } \times H W }$ and a query key $\mathbf { k } ^ { Q } \in \mathbb { R } ^ { C ^ { k } \times H W }$ . The resultant pairwise affinity matrix is denoted as $\mathbf { S } \in \mathbb { R } ^ { T H W \times H W }$ , with $\mathbf { S } _ { i j } = c ( \mathbf { k } _ { i } ^ { M } , \mathbf { k } _ { j } ^ { Q } )$ denoting the similarity between $\mathbf { k } _ { i } ^ { M }$ (the memory feature vector at the $i$ -th position) and $\mathbf { k } _ { j } ^ { Q }$ (the query feature vector at the $j$ -th position).
98
+
99
+ In the case of dot product, it can be implemented very efficiently with a matrix multiplication:
100
+
101
+ $$
102
+ \mathbf { S } _ { i j } ^ { \mathrm { d o t } } = \mathbf { k } _ { i } ^ { M } \cdot \mathbf { k } _ { j } ^ { Q } \qquad \Rightarrow \qquad \mathbf { S } ^ { \mathrm { d o t } } = \left( \mathbf { k } ^ { M } \right) ^ { T } \mathbf { k } ^ { Q }
103
+ $$
104
+
105
+ In the following, we will also discuss the use of cosine similarity and negative squared Euclidean distance as similarity functions. They are defined as (with efficient implementation discussed later):
106
+
107
+ $$
108
+ \mathbf { S } _ { i j } ^ { \mathrm { c o s } } = \frac { \mathbf { k } _ { i } ^ { M } \cdot \mathbf { k } _ { j } ^ { Q } } { \left\| \mathbf { k } _ { i } ^ { M } \right\| _ { 2 } \times \left\| \mathbf { k } _ { j } ^ { Q } \right\| _ { 2 } } \qquad \mathbf { S } _ { i j } ^ { \mathrm { L 2 } } = - \left\| \mathbf { k } _ { i } ^ { M } - \mathbf { k } _ { j } ^ { Q } \right\| _ { 2 } ^ { 2 }
109
+ $$
110
+
111
+ For brevity, we will use the shorthand “L2” or “L2 similarity” to denote the negative squared Euclidean distance in the rest of the paper. The ranges for dot product, cosine similarity and L2 similarity are $( - \infty , \infty )$ , $[ - 1 , 1 ]$ , and $( - \infty , 0 ]$ respectively. Note that cosine similarity has a limited range. Non-related points are encouraged to have a low similarity score through back-propagation such that they have a close-to-zero affinity (Eq. 1), and thus no value is propagated (Eq. 2).
112
+
113
+ # 4.1 A Closer Look at the Affinity
114
+
115
+ The affinity matrix is core to STCN and deserves close attention. Previous works [18, 21, 22, 23, 24], almost by default, use the dot product as the similarity function – but is this a good choice?
116
+
117
+ Cosine similarity computes the angle between two vectors and is often regarded as the normalized dot product. Reversely, we can consider dot product as a scaled version of cosine similarity, with the scale equals to the product of vectors’ norms. Note that this is query-agnostic, meaning that every similarity with a memory key $\mathbf { k } _ { i } ^ { M }$ will be scaled by its norm. If we cast the aggregation process (Eq. 2) as voting with similarity representing the weights, memory keys with large magnitudes will predominately suppress any representation from other memory nodes.
118
+
119
+ Figure 2 visualizes this phenomenon in a 2D feature space. For dot product, only a subset of points (labeled as triangles) has a chance to contribute the most for any query. Outliers (top-right red) can suppress existing clusters; clusters with dominant value in one dimension (top-left cyan) can suppress other clusters; some points may be able to contribute the most in a region even it is outside of the region (bottom-right beige). These undesirable situations will however not happen if the proposed L2 similarity is used: a Voronoi diagram [66] is formed and every memory point can be fully utilized, leading to a diversified, queryspecific voting mechanism with ease.
120
+
121
+ Figure 3 shows a closer look at the same problem with soft weights. With dot product, the blue/green point has low weights for every possible query in the first quadrant while a smooth transition is created with our proposed L2 similarity. Note that cosine similarity has the same benefits, but its limited range $[ - 1 , 1 ]$ means that an extra softmax temperature hyperparameter is required to shape the affinity distribution, or one more parameter to tune. L2 works well without extra temperature tuning in our experiments.
122
+
123
+ ![](images/85c612c1417c295449077b1f5b10298a127f21cb1e0f8ccce53ff2cc79ff656e.jpg)
124
+ Figure 2: Regions are colored as the “most similar” point under a measure. Left: Dot product; right: L2 similarity.
125
+
126
+ ![](images/4ac22e17c8ad47f6fa57e87c08cd25985158a51a114b24ae89615ef513bd4476.jpg)
127
+ Figure 3: Visualization of the softmax contributions from three points. Left: Dot product; right: L2 similarity.
128
+
129
+ Connection to self-attention, and whether some points are more important than others. Dotproducts have been used extensively in self-attention models [33, 67, 68]. One way to look at the dot-product affinity positively is to consider the points with large magnitudes as more important – naturally they should enjoy a higher influence. Admittedly, this is probably true in NLP [33] where a stop word (“the”) is almost useless compared to a noun (“London”) or in video classification [67] where the foreground human is far more important than a pixel in the plain blue sky. This is however not true for STCN where pixels are more or less equal. It is beneficial to match every pixel in the query frame accurately, including the background (also noted by [10]). After all, if we can know that a pixel is part of the background, we would also know that it does not belong to the foreground. In fact, we find STCN can track the background fairly well (floor, lake, etc.) even when it is never explicitly trained to do so. The notion of relative importance therefore does not generally apply in our context.
130
+
131
+ Efficient implementation. The naïve implementation of negative squared Euclidean distance in Eq. 4 needs to materialize a $C ^ { k } \times T H W ^ { \mathbf { \hat { \nu } } } \times H W$ element-wise difference matrix which is then squared and summed. This process is much slower than simple dot product and cannot be run on the same hardware. A simple decomposition greatly simplifies the implementation, as noted in [69]:
132
+
133
+ $$
134
+ \mathbf { S } _ { i j } ^ { \mathbf { L } 2 } = - \left\| \mathbf { k } _ { i } ^ { M } - \mathbf { k } _ { j } ^ { Q } \right\| _ { 2 } ^ { 2 } = 2 \mathbf { k } _ { i } ^ { M } \cdot \mathbf { k } _ { j } ^ { Q } - \left\| \mathbf { k } _ { i } ^ { M } \right\| _ { 2 } ^ { 2 } - \left\| \mathbf { k } _ { j } ^ { Q } \right\| _ { 2 } ^ { 2 }
135
+ $$
136
+
137
+ which has only slightly more computation than the baseline dot product, and can be implemented with standard matrix operations. In fact, we can further drop the last term as softmax is invariant to translation in the target dimension (details in the supplementary material). For cosine similarity, we first normalize the input vectors, then compute dot product. Table 2 tabulates the actual computational and memory costs.
138
+
139
+ # 4.2 Experimental Verification
140
+
141
+ Here, we verify three claims: 1) the aforementioned phenomenon does happen in a high-dimension key space for real-data and a fully-trained model; 2) using L2 similarity diversifies the voting; 3) L2 similarity brings about higher efficiency and performance.
142
+
143
+ Affinity distribution. We verify the first two claims by training two different models with dot product and L2 similarity respectively as the similarity function and plot the maximum contribution given by each memory node in its lifetime. We use the same setting for the two models and report the distribution on the DAVIS 2017 [65] dataset.
144
+
145
+ ![](images/20466405f829cea9fe78bb766259729256e3a5385ef434da1072cbc7673c1041.jpg)
146
+ Figure 4 shows the pertinent distributions. Under the L2 similarity measure, a lot more memory nodes contribute a fair share. Specifically, around $3 \%$ memory nodes never contribute more than $1 \%$ weight under dot product while only $0 . 0 6 \%$ suffer the same fate with L2. Under dot product, $31 \%$ memory nodes contribute less than $10 \%$ weight at best while the same only happen for $7 \%$ of the memory with L2 similarity. To measure the distribution inequality, we additionally compute the Gini coefficient [70] (the higher it is, the more unequal the distribution). The Gini coefficient for dot product is 44.0, while the Gini coefficient for L2 similarity is much lower at 31.8.
147
+ Figure 4: The curves show the number of memory nodes that have contributed above a certain threshold at least once.
148
+
149
+ Performance and efficiency. Next, we show that using L2 similarity does improve performance with negligible overhead. We compare three similarity measures: dot product, cosine similarity, and L2 similarity. For cosine similarity, we use a softmax temperature of 0.01 while a default temperature of 1 is used for both dot product and L2 similarity. This scaling is crucial for cosine similarity only since it is the only one with a limited output range $[ - 1 , 1 ]$ . Searching for an extra hyperparameter is computationally demanding – we simply picked one that converges fairly quickly without collapsing. Table 2 tabulates the main results.
150
+
151
+ Interestingly, we find that reducing the key space dimension $( C ^ { k } )$ is beneficial to both cosine similarity and L2 similarity but not dot product. This can be explained in the context of Section $4 . 1 -$ the network needs more dimensions so that it can spread the memory key features out to save them from being suppressed by high-magnitude points. Cosine similarity and L2 similarity do not suffer from this problem and can utilize the full key space. The reduced key space in turn benefits memory efficiency and improves running time.
152
+
153
+ Table 2: Performance comparison between different similarity functions and key space dimensionality $( C ^ { k } )$ in STCN on the DAVIS 2017 validation set [65]. The number of floating-point operations (FLOPs) are computed for Eq. 3 and Eq. 4 only with $T = 1 0$ . L2 works the best with a reduced key space and a small computational overhead.
154
+
155
+ <table><tr><td>Similarity function</td><td>Ck</td><td>J&amp;F</td><td>#FLOPs (G)</td><td>Size of keys (MB)</td></tr><tr><td>Dot product</td><td>128</td><td>84.1</td><td>6.26</td><td>8.70</td></tr><tr><td>Cosine similarity</td><td>128</td><td>82.6</td><td>6.26</td><td>8.70</td></tr><tr><td>L2 similarity</td><td>128</td><td>85.0</td><td>6.33</td><td>8.70</td></tr><tr><td>Dot product</td><td>64</td><td>83.2</td><td>3.13</td><td>4.35</td></tr><tr><td>Cosine similarity</td><td>64</td><td>83.4</td><td>3.13</td><td>4.35</td></tr><tr><td>L2 similarity</td><td>64</td><td>85.4</td><td>3.20</td><td>4.35</td></tr></table>
156
+
157
+ # 5 Implementation Details
158
+
159
+ Models are trained with two 11GB 2080Ti GPUs with the Adam optimizer [71] using PyTorch [72]. Following previous practices [18, 21], we first pretrain the model on static image datasets [73, 74, 75, 76, 77] with synthetic deformation then perform main training on YouTubeVOS [78] and DAVIS [3, 65]. We also experimented with the synthetic dataset BL30K [79, 80] proposed in [21] which is not used unless otherwise specified. We use a batch size of 16 during pretraining and a batch size of 8 during main training. Pre-training takes about 36 hours and main training takes around 16 hours with batchnorm layers frozen during training following [18]. Bootstrapped cross entropy is used following [21]. The full set of hyperparameters can be found in the open-sourced code.
160
+
161
+ In each iteration, we pick three temporally ordered frames (with the ground-truth mask for the first frame) from a video to form a training sample [18]. First, we predict the second frame using the first frame as memory. The prediction will be saved as the second memory frame, and then the third frame will be predicted using the union of the first and the second frame. The temporal distance between the frames will first gradually increase from 5 to 25 as a curriculum learning schedule and anneal back to 5 towards the end of training. This process follows the implementation of MiVOS [21].
162
+
163
+ For memory-read augmentation, we experimented with kernelized memory reading [22] and top- $k$ filtering [21]. We find that top- $k$ works well universally and improves running time while kernelized memory reading is slower and does not always help. We find that $k = 2 0$ always works better for STCN (original paper uses $k = 5 0$ ) and we adopt top- $k$ filtering in all our experiments with $k = 2 0$ . For fairness, we also re-run all experiments in MiVOS [21] with $k = 2 0$ , and pick the best result in their favor. We use L2 similarity with $C ^ { k } = 6 4$ in all experiments unless otherwise specified.
164
+
165
+ For inference, a 2080Ti GPU is used with full floating point precision for a fair running time comparison. We memorize every 5th frame and no temporary frame is used as discussed in Section 3.3.
166
+
167
+ # 6 Experiments
168
+
169
+ We mainly conduct experiments in the DAVIS 2017 validation [65] set and the YouTubeVOS 2018 [78] validation set. For completeness, we also include results in the single object DAVIS 2016 validation [3] set and the expanded YouTubeVOS 2019 [78] validation set. Results for the DAVIS 2017 test-dev [65] set are included in the supplementary material. We first conduct quantitative comparisons with previous methods, and then analyze the running time for each component in STCN. For reference, we also present results without pretraining on stataic images. Ablation studies have been included in previous sections (Table 1 and Table 2).
170
+
171
+ # 6.1 Evaluations
172
+
173
+ Table 3 tabulates the comparisons of STCN with previous methods in semi-supervised video object segmentation benchmarks. For DAVIS 2017 [65], we compare the standard metrics: region similarity $\mathcal { I }$ , contour accuracy $\mathcal { F }$ , and their average $\mathcal { T } \& \mathcal { F }$ . For YouTubeVOS [78], we report $\mathcal { I }$ and $\mathcal { F }$ for both seen and unseen categories, and the averaged overall score $\mathcal { G }$ . For comparing the speed, we compute the multi-object FPS that is the total number of output frames divided by the total processing time for the entire DAVIS 2017 [65] validation set. We either copy the FPS directly from papers/project websites, or estimate based on their single object inference FPS (simply labeled as $< ^ { 5 }$ ). We use $4 8 0 \mathrm { p }$ resolution videos for both DAVIS and YouTubeVOS. Table 4, 5, 6, and 7 tabulate additional results. For the interactive setting, we replace the propagation module of MiVOS [21] with STCN.
174
+
175
+ Visualizations. Figure 6 visualizes the learned correspondences. Note that our correspondences are general and mask-free, naturally associating every pixel (including background bystanders) even when it is only trained with foreground masks. Figure 7 visualizes our semi-supervised mask propagation results with the last row being a failure case (Section 7).
176
+
177
+ Leaderboard results. Our method is also very competitive on the public VOS challenge leaderboard [78]. Methods on the leaderboard are typically cutting-edge, with engineering extensions like deeper network, multi-scale inference, and model ensemble. They usually represent the highest achievable performance at the time. On the latest YouTubeVOS 2019 validation split [78], our base model $( 8 4 . 2 \mathcal { G } )$ outperforms the previous challenge winner [32] (based on STM [18], $8 2 . 0 \mathcal { G } ,$ by a large margin. With ensemble and multi-scale testing (details in the supplementary material), our method is ranked first place $( 8 6 . 7 \mathcal { G } )$ at the time of submission on the still active leaderboard.
178
+
179
+ # 6.2 Running Time Analysis
180
+
181
+ Here, we analyze the running time of each component in STM and STCN on DAVIS 2017 [65]. For a fair comparison, we use our own implementation of STM, enabled top- $k$ filtering [21], and set $C ^ { k } = 6 4$ for both methods such that all the speed improvements come from the fundamental differences between STM and STCN. Our affinity matching time is lower because we compute a single affinity between raw images while STM [18] compute one for every object. Our value encoder takes much less time than the memory encoder in STM [18] because of our light network, feature reuse, and robust memory bank/management as discussed in Section 3.3.
182
+
183
+ ![](images/89a35847b37f478010454e025f80b2632afe824314b17113d6ef63cdf069a911.jpg)
184
+ Figure 5: Average running time of each component in STM and STCN.
185
+
186
+ Table 3: Comparisons between different methods on DAVIS 2017 and YouTubeVOS 2018 validation sets. Subscripts $S$ and $U$ denote seen or unseen respectively. FPS is measured for multi-object scenarios and is measured on DAVIS 2017. Methods are ranked by YouTubeVOS performance; STM is re-timed on our hardware (see supplementary material); our model is the fastest among methods that are better than STM [18]; \* denotes contemporary work.
187
+
188
+ <table><tr><td rowspan="2">Method</td><td colspan="5">YouTubeVOS 2018 [78]</td><td colspan="4">DAVIS 2017 [65]</td></tr><tr><td>g</td><td>Js</td><td>Fs</td><td>Ju</td><td>Fu</td><td>J&amp;F</td><td>J</td><td>F</td><td>FPS</td></tr><tr><td>OSMN[8]</td><td>51.2</td><td>60.0</td><td>60.1</td><td>40.6</td><td>44.0</td><td>54.8</td><td>52.5</td><td>57.1</td><td>&lt;7.1</td></tr><tr><td>RGMP [55]</td><td>53.8</td><td>59.5</td><td>=</td><td>45.2</td><td>1</td><td>66.7</td><td>64.8</td><td>68.6</td><td>&lt;7.7</td></tr><tr><td>RVOS[12]</td><td>56.8</td><td>63.6</td><td>67.2</td><td>45.5</td><td>51.0</td><td>50.3</td><td>48.0</td><td>52.6</td><td>&lt;15</td></tr><tr><td>Track-Seg [54]</td><td>63.6</td><td>67.1</td><td>70.2</td><td>55.3</td><td>61.7</td><td>72.3</td><td>68.6</td><td>76.0</td><td>&lt;39</td></tr><tr><td>PReMVOS [81]</td><td>66.9</td><td>71.4</td><td>75.9</td><td>56.5</td><td>63.7</td><td>77.8</td><td>73.9</td><td>81.7</td><td>&lt;0.03</td></tr><tr><td>TVOS [82]</td><td>67.8</td><td>67.1</td><td>69.4</td><td>63.0</td><td>71.6</td><td>72.3</td><td>69.9</td><td>74.7</td><td>37</td></tr><tr><td>FRTM-VOS [6]</td><td>72.1</td><td>72.3</td><td>76.2</td><td>65.9</td><td>74.1</td><td>76.7</td><td>1</td><td>1</td><td>&lt;21.9</td></tr><tr><td>GC [24]</td><td>73.2</td><td>72.6</td><td>68.9</td><td>75.6</td><td>75.7</td><td>71.4</td><td>69.3</td><td>73.5</td><td>&lt;25</td></tr><tr><td>SwiftNet* [30]</td><td>77.8</td><td>77.8</td><td>81.8</td><td>72.3</td><td>79.5</td><td>81.1</td><td>78.3</td><td>83.9</td><td>25</td></tr><tr><td>STM[18]</td><td>79.4</td><td>79.7</td><td>84.2</td><td>72.8</td><td>80.9</td><td>81.8</td><td>79.2</td><td>84.3</td><td>10.2</td></tr><tr><td>AFB-URR[23]</td><td>79.6</td><td>78.8</td><td>83.1</td><td>74.1</td><td>82.6</td><td>74.6</td><td>73.0</td><td>76.1</td><td>4</td></tr><tr><td>GraphMem[16]</td><td>80.2</td><td>80.7</td><td>85.1</td><td>74.0</td><td>80.9</td><td>82.8</td><td>80.2</td><td>85.2</td><td>5</td></tr><tr><td>MiVOS* [21]</td><td>80.4</td><td>80.0</td><td>84.6</td><td>74.8</td><td>82.4</td><td>83.3</td><td>80.6</td><td>85.9</td><td>11.2</td></tr><tr><td>CFBI[10]</td><td>81.4</td><td>81.1</td><td>85.8</td><td>75.3</td><td>83.4</td><td>81.9</td><td>79.1</td><td>84.6</td><td>5.9</td></tr><tr><td>KMN[22]</td><td>81.4</td><td>81.4</td><td>85.6</td><td>75.3</td><td>83.3</td><td>82.8</td><td>80.0</td><td>85.6</td><td>&lt;8.4</td></tr><tr><td>RMNet*[29]</td><td>81.5</td><td>82.1</td><td>85.7</td><td>75.7</td><td>82.4</td><td>83.5</td><td>81.0</td><td>86.0</td><td>&lt;11.9</td></tr><tr><td>LWL [7]</td><td>81.5</td><td>80.4</td><td>84.9</td><td>76.4</td><td>84.4</td><td>81.6</td><td>79.1</td><td>84.1</td><td>&lt;6.0</td></tr><tr><td>CFBI+* [83]</td><td>82.0</td><td>81.2</td><td>86.0</td><td>76.2</td><td>84.6</td><td>82.9</td><td>80.1</td><td>85.7</td><td>5.6</td></tr><tr><td>LCM* [28]</td><td>82.0</td><td>82.2</td><td>86.7</td><td>75.7</td><td>83.4</td><td>83.5</td><td>80.5</td><td>86.5</td><td>~9.2</td></tr><tr><td>Ours</td><td>83.0</td><td>81.9</td><td>86.5</td><td>77.9</td><td>85.7</td><td>85.4</td><td>82.2</td><td>88.6</td><td>20.2</td></tr><tr><td>MiVOS*[21] + BL30K Ours +BL30K</td><td>82.6 84.3</td><td>81.1 83.2</td><td>85.6 87.9</td><td>77.7 79.0</td><td>86.2 87.3</td><td>84.5 85.3</td><td>81.7 82.0</td><td>87.4</td><td>11.2</td></tr></table>
189
+
190
+ ![](images/0c2526ce8ca45ab9ca5422616a63e9ebec9e443d6aabd859cf7cee21a45f697e.jpg)
191
+ Figure 6: Visualization of the correspondences. Labels are hand-picked in the source frame (leftmost) and are propagated to the rest directly without intermediate memory. We label all the peaks (e.g., the two yellow diamonds representing the front/back wheel – our algorithm cannot distinguish them). The bystander in white (labeled with an orange crescent) is occluded in the last frame and the resultant affinity does not have a distinct peak (not labeled).
192
+
193
+ # 7 Limitations
194
+
195
+ To alienate our method from other possible enhancement, we only use fundamentally simple global matching. Like STM [18], we have no notion of temporal consistency as we do not employ local matching [58, 10, 17] or optical flow [29]. This means we may incorrectly segment objects that are far away with similar appearance. One such failure case is shown on the last row of Figure 7. We expect that given our framework’s simplicity, our method can be readily extended to include temporal consistency consideration for further improvement.
196
+
197
+ # 8 Conclusion
198
+
199
+ We present STCN, a simple, effective, and efficient framework for video object segmentation. We propose to use direct image-to-image correspondence for efficiency and more robust matching, and examine the inner workings of affinity in details $^ { - \mathbf { L } 2 }$ similarity is proposed as a result of our observations. With its clear technical advantages, We hope that STCN can serve as a new baseline backbone for future contributions.
200
+
201
+ Table 4: Results on the DAVIS 2016 validation set.
202
+
203
+ <table><tr><td>Method</td><td>J&amp;F</td><td>J</td><td>F</td></tr><tr><td>OSMN [8]</td><td>73.5</td><td>74.0</td><td>72.9</td></tr><tr><td>MaskTrack [15]</td><td>77.6</td><td>79.7</td><td>75.4</td></tr><tr><td>OSVOS [5]</td><td>80.2</td><td>79.8</td><td>80.6</td></tr><tr><td>FAVOS [14]</td><td>81.0</td><td>82.4</td><td>79.5</td></tr><tr><td>FEELVOS[58]</td><td>81.7</td><td>81.1</td><td>82.2</td></tr><tr><td>RGMP [55]</td><td>81.8</td><td>81.5</td><td>82.0</td></tr><tr><td>Track-Seg [54]</td><td>83.1</td><td>82.6</td><td>83.6</td></tr><tr><td>FRTM-VOS [6]</td><td>83.5</td><td>=</td><td>-</td></tr><tr><td>CINN [51]</td><td>84.2</td><td>83.4</td><td>85.0</td></tr><tr><td>OnAVOS [50]</td><td>85.5</td><td>86.1</td><td>84.9</td></tr><tr><td>PReMVOS[81]</td><td>86.8</td><td>84.9</td><td>88.6</td></tr><tr><td>GC [24]</td><td>86.8</td><td>87.6</td><td>85.7</td></tr><tr><td>RMNet [29]</td><td>88.8</td><td>88.9</td><td>88.7</td></tr><tr><td>STM[18]</td><td>89.3</td><td>88.7</td><td>89.9</td></tr><tr><td>CFBI[10]</td><td>89.4</td><td>88.3</td><td>90.5</td></tr><tr><td>CFBI+ [83]</td><td>89.9</td><td>88.7</td><td>91.1</td></tr><tr><td>MiVOS [21]</td><td>90.0</td><td>88.9</td><td>91.1</td></tr><tr><td>SwiftNet [30]</td><td>90.4</td><td>90.5</td><td>90.3</td></tr><tr><td>KMN [22]</td><td>90.5</td><td>89.5</td><td>91.5</td></tr><tr><td>LCM [28]</td><td>90.7</td><td>91.4</td><td>89.9</td></tr><tr><td>Ours</td><td>91.6</td><td>90.8</td><td>92.5</td></tr><tr><td>MiVOS [21] + BL30K</td><td>91.0</td><td>89.6</td><td>92.4</td></tr><tr><td>Ours+BL30K</td><td>91.7</td><td>90.4</td><td>93.0</td></tr></table>
204
+
205
+ Table 5: Results on the YouTubeVOS 2019 validation set.
206
+
207
+ <table><tr><td>Method</td><td>9</td><td></td><td></td><td>Js Fs Ju Ju</td></tr><tr><td>MiVOS [21]</td><td>80.3</td><td>79.3 83.7</td><td>75.3</td><td>82.8</td></tr><tr><td>CFBI[10]</td><td>81.0 80.6</td><td>85.1</td><td>75.2</td><td>83.0</td></tr><tr><td>Ours</td><td>82.7 81.1</td><td>85.4</td><td>78.2</td><td>85.9</td></tr><tr><td>MiVOS[21] + BL30K 82.4 80.6 84.7 78.1</td><td></td><td></td><td></td><td>86.4</td></tr><tr><td>Ours +BL30K</td><td>84.2</td><td>82.6 87.0</td><td>79.4 87.7</td><td></td></tr></table>
208
+
209
+ Table 6: Results on the DAVIS interactive track [65]. BL30K [21] used for both MiVOS and ours.
210
+
211
+ <table><tr><td>Method</td><td>AUC-J&amp;F</td><td>J&amp;F@60s</td><td>Time (s)</td></tr><tr><td>ATNet [84]</td><td>80.9</td><td>82.7</td><td>55+</td></tr><tr><td>STM [85]</td><td>80.3</td><td>84.8</td><td>37</td></tr><tr><td>GIS [86]</td><td>85.6</td><td>86.6</td><td>34</td></tr><tr><td>MiVOS [21]</td><td>87.9</td><td>88.5</td><td>12</td></tr><tr><td>Ours</td><td>88.4</td><td>88.8</td><td>7.3</td></tr></table>
212
+
213
+ Table 7: Effects of pretraining on static images/maintraining on the DAVIS 2017 validation set.
214
+
215
+ <table><tr><td></td><td>J&amp;F</td><td>J</td><td>F</td></tr><tr><td>Pre-training only</td><td>75.8</td><td>73.1</td><td>78.6</td></tr><tr><td>Main training only</td><td>82.5</td><td>79.3</td><td>85.7</td></tr><tr><td>Both</td><td>85.4</td><td>82.2</td><td>88.6</td></tr></table>
216
+
217
+ ![](images/94e37f4502159e43cad81f95b2efe5f2ac0471328649960cf9653bf5649ea78d.jpg)
218
+ Figure 7: Visualization of semi-supervised VOS results with the first column being the reference masks to be propagated. The first two examples show comparisons of our method with STM [18] and MiVOS [21]. In the second example, zoom-ins inset (orange) are shown with the corresponding ground-truths inset (green) to highlight their differences. The last row shows a failure case: we cannot distinguish the real duck from the duck picture, as no temporal consistency clue is used in our method.
219
+
220
+ Broader Impacts Malicious use of VOS software can bring potential negative societal impacts, including but not limited to unauthorized mass surveillance or privacy infringing human/vehicle tracking. We believe that the task itself is neutral with positive uses as well, such as video editing for amateurs or making safe self-driving cars.
221
+
222
+ # Acknowledgment
223
+
224
+ This research is supported in part by Kuaishou Technology and the Research Grant Council of the Hong Kong SAR under grant no. 16201818.
225
+
226
+ # References
227
+
228
+ [1] Anton Milan, Laura Leal-Taixé, Ian Reid, Stefan Roth, and Konrad Schindler. MOT16: A benchmark for multi-object tracking. In arXiv preprint arXiv:1603.00831, 2016.
229
+ [2] Achal Dave, Tarasha Khurana, Pavel Tokmakov, Cordelia Schmid, and Deva Ramanan. Tao: A large-scale benchmark for tracking any object. In European Conference on Computer Vision, 2020.
230
+ [3] Federico Perazzi, Jordi Pont-Tuset, Brian McWilliams, Luc Van Gool, Markus Gross, and Alexander Sorkine-Hornung. A benchmark dataset and evaluation methodology for video object segmentation. In CVPR, 2016.
231
+ [4] K-K Maninis, Sergi Caelles, Yuhua Chen, Jordi Pont-Tuset, Laura Leal-Taixé, Daniel Cremers, and Luc Van Gool. Video object segmentation without temporal information. In PAMI, 2018.
232
+ [5] 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.
233
+ [6] Andreas Robinson, Felix Jaremo Lawin, Martin Danelljan, Fahad Shahbaz Khan, and Michael Felsberg. Learning fast and robust target models for video object segmentation. In CVPR, 2020.
234
+ [7] Goutam Bhat, Felix Järemo Lawin, Martin Danelljan, Andreas Robinson, Michael Felsberg, Luc Van Gool, and Radu Timofte. Learning what to learn for video object segmentation. In ECCV, 2020.
235
+ [8] Linjie Yang, Yanran Wang, Xuehan Xiong, Jianchao Yang, and Aggelos K Katsaggelos. Efficient video object segmentation via network modulation. In CVPR, 2018.
236
+ [9] Tim Meinhardt and Laura Leal-Taixé. Make one-shot video object segmentation efficient again. 2020.
237
+ [10] Zongxin Yang, Yunchao Wei, and Yi Yang. Collaborative video object segmentation by foregroundbackground integration. In ECCV, 2020.
238
+ [11] Won-Dong Jang and Chang-Su Kim. Online video object segmentation via convolutional trident network. In CVPR, 2017.
239
+ [12] Carles Ventura, Miriam Bellver, Andreu Girbau, Amaia Salvador, Ferran Marques, and Xavier Giro-i Nieto. Rvos: End-to-end recurrent network for video object segmentation. In CVPR, 2019.
240
+ [13] Qiang Wang, Li Zhang, Luca Bertinetto, Weiming Hu, and Philip HS Torr. Fast online object tracking and segmentation: A unifying approach. In CVPR, 2019.
241
+ [14] Jingchun Cheng, Yi-Hsuan Tsai, Wei-Chih Hung, Shengjin Wang, and Ming-Hsuan Yang. Fast and accurate online video object segmentation via tracking parts. In CVPR, 2018.
242
+ [15] Federico Perazzi, Anna Khoreva, Rodrigo Benenson, Bernt Schiele, and Alexander Sorkine-Hornung. Learning video object segmentation from static images. In CVPR, 2017.
243
+ [16] 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.
244
+ [17] Yuan-Ting Hu, Jia-Bin Huang, and Alexander G Schwing. Videomatch: Matching based video object segmentation. In ECCV, 2018.
245
+ [18] Seoung Wug Oh, Joon-Young Lee, Ning Xu, and Seon Joo Kim. Video object segmentation using space-time memory networks. In ICCV, 2019.
246
+ [19] Xuhua Huang, Jiarui Xu, Yu-Wing Tai, and Chi-Keung Tang. Fast video object segmentation with temporal aggregation network and dynamic template matching. In CVPR, 2020.
247
+ [20] Ziqin Wang, Jun Xu, Li Liu, Fan Zhu, and Ling Shao. Ranet: Ranking attention network for fast video object segmentation. In ICCV, 2019.
248
+ [21] Ho Kei Cheng, Yu-Wing Tai, and Chi-Keung Tang. Modular interactive video object segmentation: Interaction-to-mask, propagation and difference-aware fusion. In CVPR, 2021.
249
+ [22] Hongje Seong, Junhyuk Hyun, and Euntai Kim. Kernelized memory network for video object segmentation. In ECCV, 2020.
250
+ [23] Yongqing Liang, Xin Li, Navid Jafari, and Jim Chen. Video object segmentation with adaptive feature bank and uncertain-region refinement. In NeurIPS, 2020.
251
+ [24] Yu Li, Zhuoran Shen, and Ying Shan. Fast video object segmentation using the global context module. In ECCV, 2020.
252
+ [25] Yuan-Ting Hu, Jia-Bin Huang, and Alexander Schwing. Maskrnn: Instance level video object segmentation. In NIPS, 2017.
253
+ [26] Joakim Johnander, Martin Danelljan, Emil Brissman, Fahad Shahbaz Khan, and Michael Felsberg. A generative appearance model for end-to-end video object segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8953–8962, 2019.
254
+ [27] Xiaoxiao Li and Chen Change Loy. Video object segmentation with joint re-identification and attentionaware mask propagation. In ECCV, 2018.
255
+ [28] Li Hu, Peng Zhang, Bang Zhang, Pan Pan, Yinghui Xu, and Rong Jin. Learning position and target consistency for memory-based video object segmentation. In CVPR, 2021.
256
+ [29] Haozhe Xie, Hongxun Yao, Shangchen Zhou, Shengping Zhang, and Wenxiu Sun. Efficient regional memory network for video object segmentation. 2021.
257
+ [30] Haochen Wang, Xiaolong Jiang, Haibing Ren, Yao Hu, and Song Bai. Swiftnet: Real-time video object segmentation. In CVPR, 2021.
258
+ [31] Peng Zhang, Li Hu, Bang Zhang, and Pan Pan. Spatial constrained memory network for semi-supervised video object segmentation. CVPR Workshops, 2020.
259
+ [32] Zhishan Zhou, Lejian Ren, Pengfei Xiong, Yifei Ji, Peisen Wang, Haoqiang Fan, and Si Liu. Enhanced memory network for video segmentation. In ICCV Workshops, 2019.
260
+ [33] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017.
261
+ [34] Simon Baker and Iain Matthews. Lucas-kanade 20 years on: A unifying framework. 2004.
262
+ [35] Alexey Dosovitskiy, Philipp Fischer, Eddy Ilg, Philip Hausser, Caner Hazirbas, Vladimir Golkov, Patrick Van Der Smagt, Daniel Cremers, and Thomas Brox. Flownet: Learning optical flow with convolutional networks. In ICCV, 2015.
263
+ [36] Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz. PWC-Net: CNNs for optical flow using pyramid, warping, and cost volume. In CVPR, 2018.
264
+ [37] João F Henriques, Rui Caseiro, Pedro Martins, and Jorge Batista. High-speed tracking with kernelized correlation filters. In PAMI, 2014.
265
+ [38] Luca Bertinetto, Jack Valmadre, Joao F Henriques, Andrea Vedaldi, and Philip HS Torr. Fully-convolutional siamese networks for object tracking. In ECCV, 2016.
266
+ [39] Bo Li, Junjie Yan, Wei Wu, Zheng Zhu, and Xiaolin Hu. High performance visual tracking with siamese region proposal network. In CVPR, 2018.
267
+ [40] Jonathan Long, Ning Zhang, and Trevor Darrell. Do convnets learn correspondence? In NIPS, 2014.
268
+ [41] Kai Han, Rafael S Rezende, Bumsub Ham, Kwan-Yee K Wong, Minsu Cho, Cordelia Schmid, and Jean Ponce. Scnet: Learning semantic correspondence. In ICCV, 2017.
269
+ [42] Ignacio Rocco, Relja Arandjelovic, and Josef Sivic. End-to-end weakly-supervised semantic alignment. In ´ CVPR, 2018.
270
+ [43] Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In NIPS, 2016.
271
+ [44] Qi Fan, Wei Zhuo, Chi-Keung Tang, and Yu-Wing Tai. Few-shot object detection with attention-rpn and multi-relation detector. In CVPR, 2020.
272
+ [45] Christian Simon, Piotr Koniusz, Richard Nock, and Mehrtash Harandi. Adaptive subspaces for few-shot learning. In CVPR, 2020.
273
+ [46] Kaixin Wang, Jun Hao Liew, Yingtian Zou, Daquan Zhou, and Jiashi Feng. Panet: Few-shot image semantic segmentation with prototype alignment. In ICCV, 2019.
274
+ [47] Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Säckinger, and Roopak Shah. Signature verification using a "siamese" time delay neural network. In NIPS, 1993.
275
+ [48] Jake Snell, Kevin Swersky, and Richard S Zemel. Prototypical networks for few-shot learning. In NIPS, 2017.
276
+ [49] Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In CVPR, 2018.
277
+ [50] Paul Voigtlaender and Bastian Leibe. Online adaptation of convolutional neural networks for video object segmentation. In BMVC, 2017.
278
+ [51] Linchao Bao, Baoyuan Wu, and Wei Liu. Cnn in mrf: Video object segmentation via inference in a cnn-based higher-order spatio-temporal mrf. In CVPR, 2018.
279
+ [52] Kai Xu, Longyin Wen, Guorong Li, Liefeng Bo, and Qingming Huang. Spatiotemporal cnn for video object segmentation. In CVPR, 2019.
280
+ [53] Kevin Duarte, Yogesh S. Rawat, and Mubarak Shah. Capsulevos: Semi-supervised video object segmentation using capsule routing. In ICCV, 2019.
281
+ [54] Xi Chen, Zuoxin Li, Ye Yuan, Gang Yu, Jianxin Shen, and Donglian Qi. State-aware tracker for real-time video object segmentation. In CVPR, 2020.
282
+ [55] Seoung Wug Oh, Joon-Young Lee, Kalyan Sunkavalli, and Seon Joo Kim. Fast video object segmentation by reference-guided mask propagation. In CVPR, 2018.
283
+ [56] Lu Zhang, Zhe Lin, Jianming Zhang, Huchuan Lu, and You He. Fast video object segmentation via dynamic targeting network. In ICCV, 2019.
284
+ [57] Ping Hu, Gang Wang, Xiangfei Kong, Jason Kuen, and Yap-Peng Tan. Motion-guided cascaded refinement network for video object segmentation. In CVPR, 2018.
285
+ [58] 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.
286
+ [59] Yuhua Chen, Jordi Pont-Tuset, Alberto Montes, and Luc Van Gool. Blazingly fast video object segmentation with pixel-wise metric learning. In CVPR, 2018.
287
+ [60] Seoung Wug Oh, Joon-Young Lee, Ning Xu, and Seon Joo Kim. Space-time memory networks for video object segmentation with user guidance. 2020.
288
+ [61] Zihang Lai, Erika Lu, and Weidi Xie. Mast: A memory-augmented self-supervised tracker. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6479–6488, 2020.
289
+ [62] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
290
+ [63] Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML deep learning workshop, 2015.
291
+ [64] Sanghyun Woo, Jongchan Park, Joon-Young Lee, and In So Kweon. Cbam: Convolutional block attention module. In ECCV, 2018.
292
+ [65] Jordi Pont-Tuset, Federico Perazzi, Sergi Caelles, Pablo Arbeláez, Alexander Sorkine-Hornung, and Luc Van Gool. The 2017 davis challenge on video object segmentation. In arXiv:1704.00675, 2017.
293
+ [66] Mark De Berg, Marc Van Kreveld, Mark Overmars, and Otfried Schwarzkopf. Computational geometry. In Computational geometry. Springer, 1997.
294
+ [67] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018.
295
+ [68] Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. In NIPS, 2019.
296
+ [69] Hyunjik Kim, George Papamakarios, and Andriy Mnih. The lipschitz constant of self-attention. In arXiv preprint arXiv:2006.04710, 2020.
297
+ [70] Robert I Lerman and Shlomo Yitzhaki. A note on the calculation and interpretation of the gini index. Economics Letters, 15(3-4):363–368, 1984.
298
+ [71] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
299
+ [72] 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 NIPS, 2019.
300
+ [73] Lijun Wang, Huchuan Lu, Yifan Wang, Mengyang Feng, Dong Wang, Baocai Yin, and Xiang Ruan. Learning to detect salient objects with image-level supervision. In CVPR, 2017.
301
+ [74] Jianping Shi, Qiong Yan, Li Xu, and Jiaya Jia. Hierarchical image saliency detection on extended cssd. In TPAMI, 2015.
302
+ [75] Yi Zeng, Pingping Zhang, Jianming Zhang, Zhe Lin, and Huchuan Lu. Towards high-resolution salient object detection. In ICCV, 2019.
303
+ [76] Ho Kei Cheng, Jihoon Chung, Yu-Wing Tai, and Chi-Keung Tang. Cascadepsp: Toward class-agnostic and very high-resolution segmentation via global and local refinement. In CVPR, 2020.
304
+ [77] Xiang Li, Tianhan Wei, Yau Pun Chen, Yu-Wing Tai, and Chi-Keung Tang. Fss-1000: A 1000-class dataset for few-shot segmentation. In CVPR, 2020.
305
+ [78] Ning Xu, Linjie Yang, Yuchen Fan, Dingcheng Yue, Yuchen Liang, Jianchao Yang, and Thomas Huang. Youtube-vos: A large-scale video object segmentation benchmark. In ECCV, 2018.
306
+ [79] Angel Xuan Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, Jianxiong Xiao, Li Yi, and Fisher Yu. ShapeNet: An Information-Rich 3D Model Repository. In arXiv:1512.03012, 2015.
307
+ [80] Maximilian Denninger, Martin Sundermeyer, Dominik Winkelbauer, Youssef Zidan, Dmitry Olefir, Mohamad Elbadrawy, Ahsan Lodhi, and Harinandan Katam. Blenderproc. In arXiv:1911.01911, 2019.
308
+ [81] Jonathon Luiten, Paul Voigtlaender, and Bastian Leibe. Premvos: Proposal-generation, refinement and merging for video object segmentation. In ACCV, 2018.
309
+ [82] Yizhuo Zhang, Zhirong Wu, Houwen Peng, and Stephen Lin. A transductive approach for video object segmentation. In CVPR, 2020.
310
+ [83] Zongxin Yang, Yunchao Wei, and Yi Yang. Collaborative video object segmentation by multi-scale foreground-background integration. In PAMI, 2021.
311
+ [84] Yuk Heo, Yeong Jun Koh, and Chang-Su Kim. Interactive video object segmentation using global and local transfer modules. In ECCV, 2020.
312
+ [85] Seoung Wug Oh, Joon-Young Lee, Ning Xu, and Seon Joo Kim. Space-time memory networks for video object segmentation with user guidance. In TPAMI, 2020.
313
+ [86] Yuk Heo, Yeong Jun Koh, and Chang-Su Kim. Guided interactive video object segmentation using reliability-based attention maps. In CVPR, 2021.
314
+ [87] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. BMVC, 2016.
315
+ [88] Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017.
316
+ [89] Fred L. Bookstein. Principal warps: Thin-plate splines and the decomposition of deformations. PAMI, 1989.
md/train/yT7-k6Q6gda/yT7-k6Q6gda.md ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CATASTROPHIC FISHER EXPLOSION: EARLY PHASE FISHER MATRIX IMPACTS GENERALIZATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The early phase of training has been shown to be important in two ways for deep neural networks. First, the degree of regularization in this phase significantly impacts the final generalization. Second, it is accompanied by a rapid change in the local loss curvature influenced by regularization choices. Connecting these two findings, we show that stochastic gradient descent (SGD) implicitly penalizes the trace of the Fisher Information Matrix (FIM) from the beginning of training. We argue it is an implicit regularizer in SGD by showing that explicitly penalizing the trace of the FIM can significantly improve generalization. We further show that the early value of the trace of the FIM correlates strongly with the final generalization. We highlight that in the absence of implicit or explicit regularization, the trace of the FIM can increase to a large value early in training, to which we refer as catastrophic Fisher explosion. Finally, to gain insight into the regularization effect of penalizing the trace of the FIM, we show that it limits memorization by reducing the learning speed of examples with noisy labels more than that of the clean examples, and 2) trajectories with a low initial trace of the FIM end in flat minima, which are commonly associated with good generalization.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Implicit regularization in gradient-based training of deep neural networks (DNNs) remains relatively poorly understood, despite being considered a critical component in their empirical success (Neyshabur, 2017; Zhang et al., 2016; Jiang et al., 2020b). Recent work suggests that the early phase of training of DNNs might hold the key to understanding these implicit regularization effects. Golatkar et al. (2019); Keskar et al. (2017); Sagun et al. (2018); Achille et al. (2019) show that by introducing regularization later, a drop in performance due to lack of regularization in this phase is hard to recover from, while on the other hand, removing regularization after the early phase has a relatively small effect on the final performance.
12
+
13
+ Other works show that the early phase of training also has a dramatic effect on the trajectory in terms of properties such as the local curvature of the loss surface or the gradient norm (Jastrzebski et al., 2020; Frankle et al., 2020). In particular, Achille et al. (2019); Jastrz˛ebski et al. (2019); Golatkar et al. (2019); Lewkowycz et al. (2020); Leclerc & Madry (2020) independently suggest that rapid changes in the local curvature of the loss surface in the early phase critically affects the final generalization. Closely related to our work, Lewkowycz et al. (2020); Jastrz˛ebski et al. (2019) show that using a large learning rate has a dramatic effect on the early optimization trajectory in terms of the loss curvature. These observations lead to a question: what is the mechanism by which regularization in the early phase impacts the optimization trajectory and generalization? We investigate this question mainly through the lens of the Fisher Information Matrix (FIM), a matrix that can be seen as approximating the local curvature of the loss surface in DNNs (Martens, 2020; Thomas et al., 2020).
14
+
15
+ Our main contribution is to show that the implicit regularization effect of using a large learning rate or a small batch size can be modeled as an implicit penalization of the trace of the FIM $( \mathrm { T r } ( \mathbf { F } ) )$ from the very beginning of training. We demonstrate on image classification tasks that the value of $\operatorname { T r } ( \mathbf { F } )$ early in training correlates with the final generalization performance across settings with different learning rates or batch sizes. We then show evidence that explicitly regularizing $\operatorname { T r } ( \mathbf { F } )$ (which we call Fisher penalty) significantly improves generalization in training with a sub-optimal learning rate. On the other hand, growth of $\operatorname { T r } ( \mathbf { F } )$ early in training, which may occur in practice when using a relatively small learning rate, coincides with poor generalization. We call this phenomenon the catastrophic Fisher explosion. Figure 1 illustrates this effect on the TinyImageNet dataset (Le & Yang, 2015).
16
+
17
+ ![](images/e3ebeb7411d3dac8e18f12947af3479c29c6a9c5d44a902b8fa594ef7e2f9627.jpg)
18
+ Figure 1: The catastrophic Fisher explosion phenomenon demonstrated for Wide ResNet trained using stochastic gradient descent on the TinyImageNet dataset. Training is done with either a learning rate optimized using grid search $\zeta _ { 1 1 } = 0 . 0 3 1 6$ , red), or a small learning rate $\dot { \eta } _ { 2 } = 0 . 0 0 1$ , blue). Training with $\eta _ { 2 }$ leads to large overfitting (left) and a sharp increase in the trace of the Fisher Information Matrix (FIM, middle). The trace of the FIM is closely related to the gradient norm (right).
19
+
20
+ ![](images/b2020287c1e9258742e6bcdd95efaf2a185f4d7d2886a57b79aa11e4b6f1b047.jpg)
21
+ Figure 2: Association between the value of $\operatorname { T r } ( \mathbf { F } )$ in the initial phase of training $( \mathrm { { T r } ( { F _ { i } } ) } )$ and test accuracy on ImageNet, CIFAR-10 and CIFAR-100 datasets. Each point corresponds to multiple seeds and a specific value of learning rate. $\operatorname { T r } ( \mathbf { F _ { i } } )$ is recorded during the early phase of training (2-7 epochs, see the main text for details). The plots show that early $\operatorname { T r } ( \mathbf { F } )$ is predictive of final generalization. Analogous results illustrating the influence of batch size are shown in Appendix A.1
22
+
23
+ Our second contribution is an analysis of why implicitly or explicitly regularizing $\operatorname { T r } ( \mathbf { F } )$ impacts generalization. We reveal two effects of implicit or explicit regularization of $\operatorname { T r } ( \mathbf { F } )$ : (1) penalizing ${ \bar { \mathrm { T r } } } ( \mathbf { F } )$ discourages memorizing noisy labels, (2) small $\operatorname { T r } ( \mathbf { F } )$ in the early phase of training biases optimization towards a flat minimum, as characterized by the trace of the Hessian.
24
+
25
+ # 2 IMPLICIT AND EXPLICIT REGULARIZATION OF THE FIM
26
+
27
+ Fisher Information Matrix Consider a probabilistic classification model $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } )$ , where $\pmb { \theta }$ denotes its parameters. Let $\ell ( x , y ; \theta )$ be the cross-entropy loss function calculated for input $_ { \textbf { \em x } }$ and label $y$ . Let bject $\begin{array} { r } { g ( \pmb { x } , y ; \pmb { \theta } ) = \frac { \partial } { \partial \pmb { \theta } } \ell ( \pmb { x } , y ; \pmb { \theta } ) } \end{array}$ denote the gradient Information Matrix mputed for an example defined as $( { \pmb x } , y )$ . The central $\mathbf { F }$
28
+
29
+ $$
30
+ \mathbf { F } ( \pmb { \theta } ) = \mathbb { E } _ { \pmb { x } \sim \mathcal { X } , \hat { \pmb { y } } \sim p _ { \theta } ( y | \pmb { x } ) } [ g ( \pmb { x } , \hat { y } ) g ( \pmb { x } , \hat { y } ) ^ { T } ] ,
31
+ $$
32
+
33
+ where the expectation is often approximated using the empirical distribution $\hat { \mathcal X }$ induced by the training set. We denote its trace by $\operatorname { T r } ( \mathbf { F } )$ . Later, we also look into the Hessian $\begin{array} { r } { { \bf H } ( \pmb \theta ) = \frac { \partial ^ { 2 } } { \partial \pmb \theta ^ { 2 } } \ell ( \pmb x , y ; \pmb \theta ) } \end{array}$ . We denote its trace by $\mathrm { T r } ( \mathbf { H } )$ .
34
+
35
+ The FIM can be seen as an approximation to the Hessian (Martens, 2020). In particular, as $p ( \boldsymbol { y } | \mathbf { x } ; \boldsymbol { \theta } ) \hat { p } ( \boldsymbol { y } | \mathbf { x } )$ , where $\hat { p } ( y | \mathbf x )$ is the empirical label distribution, the FIM converges to the
36
+
37
+ Hessian. Thomas et al. (2020) showed on image classifications tasks that $\operatorname { T r } ( \mathbf { H } ) \approx \operatorname { T r } ( \mathbf { F } )$ along the optimization trajectory, which we also evidence in Appendix F.
38
+
39
+ Fisher Penalty Several studies have presented evidence that the early phase has a drastic effect on the trajectory in terms of the local curvature of the loss surface (Achille et al., 2019; Jastrz˛ebski et al., 2019; Gur-Ari et al., 2018; Lewkowycz et al., 2020; Leclerc & Madry, 2020). In particular, Lewkowycz et al. (2020); Jastrz˛ebski et al. (2019) show that using a large learning rate in stochastic gradient descent biases training towards low curvature regions of the loss surface very early in training. For example, using a large learning rate in SGD was shown to result in a rapid decay of $\mathrm { T r } ( \mathbf { H } )$ along the optimization trajectory Jastrz˛ebski et al. (2019).
40
+
41
+ Our main contribution is to propose and investigate a specific mechanism by which using a large learning rate or a small batch size implicitly influences final generalization. Our first insight is to shift the focus from studying the Hessian, to studying properties of the FIM. Concretely, we hypothesize that using a large learning rate or a small batch size improves generalization by implicitly penalizing $\operatorname { T r } ( \mathbf { F } )$ from the very beginning of training.
42
+
43
+ The benefit of studying the FIM is that it can be directly and efficiently manipulated during training. In order to study the effect of implicit regularization of $\operatorname { T r } ( \mathbf { F } )$ , we introduce a regularizer, which we refer to as Fisher penalty, explicitly penalizing $\operatorname { T r } ( \mathbf { F } )$ . We derive this regularizer in the following way. First, we note that $\operatorname { T r } ( \mathbf { F } )$ can be written as $\begin{array} { r } { \mathrm { T r } ( \mathbf { F } ) = \mathbb { E } _ { \boldsymbol { x } \sim \mathcal { X } , \hat { \boldsymbol { y } } \sim p _ { \boldsymbol { \theta } } ( \boldsymbol { y } \vert \mathbf { x } ) } \left[ \Vert \frac { \partial } { \partial \boldsymbol { \theta } } \boldsymbol { \ell } ( \mathbf { x } , \hat { \boldsymbol { y } } ) \Vert _ { 2 } ^ { 2 } \right] . } \end{array}$
44
+
45
+ To regularize $\operatorname { T r } ( \mathbf { F } )$ , we add the following term to the loss function:
46
+
47
+ $$
48
+ \ell ^ { \prime } ( x _ { 1 : B } , y _ { 1 : B } ; \pmb \theta ) = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \ell ( { \pmb x } _ { i } , y _ { i } ; \pmb \theta ) + \alpha \left\| \frac { 1 } { B } \sum _ { i = 1 } ^ { B } g ( { \pmb x } _ { i } , \hat { y } _ { i } ) \right\| ^ { 2 } ,
49
+ $$
50
+
51
+ where $\left( \pmb { x } _ { 1 : B } , \pmb { y } _ { 1 : B } \right)$ is a mini-batch, $\hat { y } _ { i }$ is sampled from $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } _ { i } )$ , and $\alpha$ is a hyperparameter. We refer to this regularizer as Fisher penalty. The formulation is based on the empirical observation that $\begin{array} { r l } & { \left\| \frac { 1 } { B } \sum _ { i = 1 } ^ { B } g ( \pmb { x } _ { i } , \hat { y } _ { i } ) \right\| ^ { 2 } } \end{array}$ 2 and $\operatorname { T r } ( \mathbf { F } )$ correlate well during training. Crucially, this allows us to reduce the added computational cost of Fisher penalty to that of a single additional backpropagation call (Drucker & Le Cun, 1992). Finally, we compute the gradient of the second term only every 10 optimization steps, and in a given iteration use the most recently computed gradient. We discuss these approximations in detail in Appendix C.
52
+
53
+ Catastrophic Fisher Explosion To illustrate the concepts mentioned in this section, we train a Wide ResNet model (depth 44, width 3) (Zagoruyko & Komodakis, 2016) on the TinyImageNet dataset with SGD and two different learning rates. We illustrate in Figure 1 that the small learning rate leads to dramatic overfitting, which coincides with a sharp increase in $\operatorname { T r } ( \mathbf { F } )$ in the early phase of training. We also show in Appendix D that these effects cannot be explained by the difference in learning speed between runs with smaller and learning rates. We call this phenomenon the catastrophic Fisher explosion.
54
+
55
+ # 3 EARLY-PHASE $\mathrm { T r } ( \mathbf F )$ CORRELATES WITH FINAL GENERALIZATION
56
+
57
+ Using a large learning rate $( \eta )$ or a small batch size $( S )$ in SGD steers optimization to a lower curvature region of the loss surface. However, it remains a hotly debated topic whether this explains their strong regularization effect (Dinh et al., 2017; He et al., 2019; Maddox et al., 2020; Tsuzuku et al., 2019; Yoshida & Miyato, 2017). We begin by studying the connection between $\operatorname { T r } ( \mathbf { F } )$ and generalization in experiments across which we vary $\eta$ or $S$ in SGD.
58
+
59
+ Experimental setup We run our experiments in two settings: (1) ResNet-18 with Fixup He et al. (2015); Zhang et al. (2019) trained on the ImageNet dataset (Deng et al., 2009), (2) ResNet-26 initialized with Arpit et al. (2019) trained on the CIFAR-10 and CIFAR-100 datasets (Krizhevsky, 2009). We train each architecture using SGD, with various values of $\eta , S .$ , and random seed.
60
+
61
+ We define $\operatorname { T r } ( \mathbf { F _ { i } } )$ as $\operatorname { T r } ( \mathbf { F } )$ during the initial phase of training. The early-phase $\operatorname { T r } ( \mathbf { F } )$ is measured when the training loss crosses a task-specific threshold $\epsilon$ . For ImageNet, we use learning rates 0.001,
62
+
63
+ Table 1: Using a 10-30x smaller learning rate (Baseline) results in up to $9 \%$ degradation in test accuracy on popular image classification benchmarks (c.f. to optimal $\eta ^ { * }$ ). Adding Fisher penalty (FP) substantially improves generalization and closes the gap to $\eta ^ { * }$ . We do not use data augmentation with CIFAR-10 and CIFAR-100 to ensure that using a small learning rate does not lead to under-fitting.
64
+
65
+ <table><tr><td>Setting</td><td>m*</td><td>Baseline</td><td>GPx</td><td>GP</td><td>FP</td><td>GPr</td></tr><tr><td>WResNet/TinyImageNet (aug.)</td><td>54.67%</td><td>52.57%</td><td>52.79%</td><td>56.44%</td><td>56.73%</td><td>55.41%</td></tr><tr><td>DenseNet/C100(w/o aug.)</td><td>66.09%</td><td>58.51%</td><td>62.12%</td><td>64.42%</td><td>66.41%</td><td>66.39%</td></tr><tr><td>VGG11/C100 (w/o aug.)</td><td>45.86%</td><td>36.86%</td><td>45.26%</td><td>47.35%</td><td>49.87%</td><td>48.26%</td></tr><tr><td>WResNet/C100 (w/o aug.)</td><td>53.96%</td><td>46.38%</td><td>58.68%</td><td>57.68%</td><td>57.05%</td><td>58.15%</td></tr><tr><td>SimpleCNN/C10(w/o aug.)</td><td>76.94%</td><td>71.32%</td><td>75.68%</td><td>75.73%</td><td>79.66%</td><td>79.76%</td></tr></table>
66
+
67
+ 0.01, 0.1, and $\epsilon = 3 . 5$ . For CIFAR-10, we use learning rates 0.007, 0.01, 0.05, and $\epsilon = 1 . 2$ . For CIFAR-100, we use learning rates 0.001, 0.005, 0.01, and $\epsilon = 3 . 5$ . In all cases, training loss reaches $\epsilon$ between 2 and 7 epochs across different hyper-parameter settings. We repeat similar experiments for different batch sizes in Appendix A.1. The remaining training details can be found in Appendix G.1.
68
+
69
+ Results Figure 2 shows the correlation between $\operatorname { T r } ( \mathbf { F _ { i } } )$ and test accuracy across runs with different learning rates. We show results for CIFAR-10 and CIFAR-100 when varying the batch size in Figure 7 in the Appendix. We find that $\mathrm { { T r } ( \mathbf { F _ { i } } ) }$ correlates well with the final generalization in our setting, which provides initial evidence for the importance of $\operatorname { T r } ( \mathbf { F } )$ . It also serves as a stepping stone towards developing a more granular understanding of the role of implicit regularization of $\operatorname { T r } ( \mathbf { F } )$ in the following sections.
70
+
71
+ # 4 FISHER PENALTY
72
+
73
+ To better understand the significance of the identified correlation between $\operatorname { T r } ( \mathbf { F _ { i } } )$ and generalization, we now run experiments in which we directly penalize $\operatorname { T r } ( \mathbf { F } )$ . We focus our attention on the identified effect of high learning rate on $\operatorname { T r } ( \mathbf { F } )$ .
74
+
75
+ Experimental setting We use a similar setting as in the previous section, but we include larger models. We run experiments using Wide ResNet (Zagoruyko & Komodakis, 2016) (depth 44 and width 3, with or without BN layers), SimpleCNN (without BN layers), DenseNet $\mathrm { L } { = } 4 0$ , $\mathrm { K } { = } 1 2$ ) (Huang et al., 2017) and VGG-11 (Simonyan & Zisserman, 2015). We train these models on either the CIFAR-10 or the CIFAR-100 datasets. Due to larger computational cost, we replace ImageNet with the TinyImageNet dataset (Le & Yang, 2015) in these experiments.
76
+
77
+ To investigate if the correlation of $\operatorname { T r } ( \mathbf { F _ { i } } )$ and final generalization holds more generally, we apply Fisher penalty in two settings. First, we use a learning rate $1 0 – 3 0 \mathrm { x }$ smaller than the optimal one, which both incur up to $9 \%$ degradation in test accuracy and results in large value of $\operatorname { T r } ( \mathbf { F _ { i } } )$ . We also remove data augmentation from the CIFAR-10 and the CIFAR-100 datasets to ensure that training with small learning rate does not result in underfitting. In the second setting, we add Fisher penalty in training with an optimized learning rate using grid search $( \eta ^ { * } )$ and train with data augmentation.
78
+
79
+ Fisher penalty penalizes the gradient norm computed using labels sampled from $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } )$ . We hyFir size that a similar, but weaker, effect can be introducee compare FP to penalizing the input gradient norm $\begin{array} { r } { \| \pmb { g } _ { x } \| = \frac { \partial ^ { \smile } } { \partial \pmb { x } } \ell ( \pmb { x } , y ) } \end{array}$ norm regularizers., which we denote $\mathrm { G P _ { x } }$ (Varga et al., 2018; Rifai et al., 2011; Drucker & Le Cun, 1992). We also experiment with penalizing the vanilla mini-batch gradient Gulrajani et al. (2017), which we denote by GP. Finally, we experiment with penalizing the mini-batch gradient computed with random labels $\begin{array} { r } { \| \dot { \pmb g } _ { r } \| = \frac { \partial } { \partial \pmb x } \ell ( \pmb x , \hat { y } ) } \end{array}$ where $\hat { y }$ is sampled from a uniform distribution over the label set $( \mathrm { G P _ { r } } )$ . We are not aware of any prior work using GP or $\mathrm { G P _ { r } }$ in supervised training, with the exception of Alizadeh et al. (2020) where the authors penalized $\ell _ { 1 }$ norm of gradients to compress the network towards the end of training.
80
+
81
+ We tune the hyperparameters on the validation set. More specifically for $\alpha$ , we test 10 different values spaced uniformly between $1 0 ^ { - 1 } \times v$ to $1 0 ^ { 1 } \times v$ on a logarithmic scale with $v \in \mathbb { R } _ { + }$ . For TinyImageNet we test 5 alternatives instead. To pick the optimal learning rate, we evaluate 5 values spaced equally on a logarithmic scale. We include the remaining experimental details in the Appendix G.2.
82
+
83
+ Table 2: Fisher penalty (FP) improves generalization in 4 out of 5 settings when applied with the optimal learning rate $\eta ^ { * }$ and trained using standard data augmentation. In 3 out of 5 settings the difference between FP and $\eta ^ { * }$ is small (below $1 \%$ ), which is expected given that FP is aimed at reproducing the regularization effect of large $\eta$ , and we compare to training with the optimal $\eta ^ { * }$ .
84
+
85
+ <table><tr><td>Setting</td><td>m*</td><td>FP</td></tr><tr><td>DenseNet/C100 (aug.)</td><td>74.41±0.47%</td><td>74.19±0.51%</td></tr><tr><td>VGG11/C100 (aug.)</td><td>59.82±1.23%</td><td>65.08±0.53%</td></tr><tr><td>WResNet/C100 (aug.)</td><td>69.48±0.30%</td><td>71.53±1.22%</td></tr><tr><td>SimpleCNN/C10 (aug.)</td><td>87.16±0.16%</td><td>87.52±0.50%</td></tr><tr><td>WResNet/TinyImageNet (aug.)</td><td>54.70±0.04%</td><td>60.00±0.07 %</td></tr></table>
86
+
87
+ ![](images/43f0eb346c353e1372e8e5d3ed68da3c2418b55a49ba194fae26afc8ac5ec278.jpg)
88
+ Figure 3: Training with FP or $\mathrm { G P _ { x } }$ improves generalization and limits early peak of $\operatorname { T r } ( \mathbf { F } )$ . Each subfigure shows validation accuracy (left) and $\operatorname { T r } ( \mathbf { F } )$ (right) for training with $\eta ^ { * }$ or a small learning rate (blue) and for training with either $\mathrm { G P _ { x } }$ or FP (red). Curves were smoothed for clarity.
89
+
90
+ Fisher Penalty improves generalization Table 1 summarizes the results of the main experiment. First, we observe that a suboptimal learning rate $1 0 – 3 0 \mathrm { x }$ lower than the optimal) leads to dramatic overfitting. We observe a degradation of up to $9 \%$ in test accuracy, while achieving perfect training accuracy (see Table 6 in the Appendix).
91
+
92
+ Fisher penalty closes the gap in test accuracy between the small and optimal learning rate, and even achieves better performance than the optimal learning rate. A similar performance was observed when minimizing $\| g _ { r } \|$ . We will come back to this observation in the next section.
93
+
94
+ GP and $\mathrm { G P _ { x } }$ reduce the early value of $\operatorname { T r } ( \mathbf { F } )$ (see Table 4 in the Appendix). They, however, generally perform worse than $\operatorname { T r } ( \mathbf { F } )$ or $\mathrm { G P _ { r } }$ and do not fully close the gap between small and optimal learning rate. We hypothesize they improve generalization by a similar but less direct mechanism than $\operatorname { T r } ( \mathbf { F } )$ and $\mathrm { G P _ { r } }$ .
95
+
96
+ In the second experimental setting, we apply FP to a network trained with the optimal learning rate $\eta ^ { * }$ . According to Table 2, Fisher Penalty improves generalization in 4 out of 5 settings. The gap between the baseline and FP is small in 3 out of 5 settings (below $1 \%$ ), which is natural given that we already regularize training implicitly by using the optimal $\eta$ and data augmentation.
97
+
98
+ Geometry and generalization in the early phase of training Here, we investigate the temporal aspect of Fisher Penalty on CIFAR-10 and CIFAR-100. In particular, we study whether early penalization of $\operatorname { T r } ( \mathbf { F } )$ matters for final generalization.
99
+
100
+ First, we observe that all gradient-norm regularizers reduce the early value of $\operatorname { T r } ( \mathbf { F } )$ closer to $\operatorname { T r } ( \mathbf { F } )$ achieved when trained with the optimal learning rate $\eta ^ { * }$ . We show this effect with Wide ResNet and VGG-11 on CIFAR-100 in Figure 3, and for other experimental settings in the Appendix. We also tabulate the maximum achieved values of $\operatorname { T r } ( \mathbf { F } )$ over the optimization trajectory in Appendix A.2.
101
+
102
+ ![](images/8ce904557cc7e22826007bf7e77e02a0e24439f18434c27a2b85e5ee6489c3c7.jpg)
103
+ Figure 4: Each subplot summarizes an experiment in which we apply Fisher Penalty starting from a certain epoch $\mathbf { \dot { x } }$ axis) and measure the final test accuracy (y axis). Fisher Penalty has to be applied from the beginning of training to close the generalization gap to the optimal learning rate (c.f. the red horizontal line to the blue horizontal line).
104
+
105
+ To test the importance of explicitly penalizing $\operatorname { T r } ( \mathbf { F } )$ early in training, we start applying it after a certain number of epoch $E \in \{ 1 , 2 , 4 , 8 , 1 6 , 3 2 , 6 4 , 1 2 8 \}$ . We use the best hyperparameter set from the previous experiments. Figure 4 summarizes the results. For both datasets, we observe a consistent pattern. When FP is applied starting from a later epoch, final generalization is significantly worse, and the generalization gap arising from a suboptimal learning rate is not closed.
106
+
107
+ # 4.1 FISHER PENALTY REDUCES MEMORIZATION
108
+
109
+ It is not self-evident how regularizing $\operatorname { T r } ( \mathbf { F } )$ influences generalization. In this section, we provide evidence that regularizing $\operatorname { T r } ( \mathbf { F } )$ slows down learning on data with noisy labels. To study this, we replace labels of the examples in the CIFAR-100 dataset $2 5 \%$ or $50 \%$ of the training set) with labels sampled uniformly. While label noise in real datasets is not uniform, methods that perform well with uniform label noise generally are more robust to label noise in real datasets (Jiang et al., 2020a). We also know that datasets such as CIFAR-100 contain many labeling errors (Song et al., 2020). As such, examining how $\operatorname { T r } ( \mathbf { F } )$ reduces memorization of synthetic label noise provides an insight into how it improves generalization in our prior experiments.
110
+
111
+ We expect FP to reduce memorization. When the predictive distribution $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } )$ and the true label distribution $p ^ { * } ( y | \pmb { x } )$ are both uniform, $\operatorname { T r } ( \mathbf { F } )$ of the specific example $_ { \textbf { \em x } }$ is equivalent to the squared loss gradient norm of the sample example. The proposed Fisher penalty thus minimizes the contribution of the loss gradient from the training examples whose labels were sampled uniformly. In other words, the Fisher penalty implicitly suppresses learning noisy examples, under the assumption that clean examples’ label distributions are not uniform.
112
+
113
+ To study whether the above happens in practice, we compare FP to $\mathrm { G P _ { x } }$ , $\mathrm { G P _ { r } }$ , and mixup (Zhang et al., 2018). While mixup is not the state-of-the-art approach to learning with noisy labels, it is competitive among approaches that do not require additional data nor multiple stages of training. In particular, it is a component in several state-of-the-art approaches (Li et al., 2020; Song et al., 2020). For gradient norm based regularizers, we evaluate 6 different hyperparameter values spaced uniformly on a logarithmic scale, and for mixup we evaluate $\beta \in \{ 0 . 2 , 0 . 4 , 0 . 8 , 1 . 6 , 3 . 2 , 6 . 4 \}$ . We experiment with the Wide ResNet and VGG-11 models. We describe remaining experimental details in the Appendix G.3.
114
+
115
+ Results We begin by studying the learning dynamics on data with noisy labels through the lens of training accuracy and mini-batch gradient norm. We show the results for VGG-11 and ResNet-50 in Figure 5 and Figure 9 in the Appendix. We observe that FP limits the ability of the model to memorize data more strongly than it limits its ability to learn from clean data. We can further confirm our interpretation of the effect $\operatorname { T r } ( \mathbf { F } )$ has on training by studying the gradient norms. As visible in Figure 5, the gradient norm on examples with noisy labels is larger than on clean examples, and the ratio is closer to 1 when large regularization is applied.
116
+
117
+ We report test accuracy (at the best validation point) in Table 3. We observe that $\operatorname { T r } ( \mathbf { F } )$ reduces memorization competitively to mixup. Furthermore, FP performs similarly to $\mathrm { G P _ { r } }$ , which agrees with our interpretation of why FP limits learning on examples with noisy labels.
118
+
119
+ ![](images/7a321bba955d23a1a40fbb9eae9e586fa508ab1dd3635b670494059f72f4c041.jpg)
120
+ Figure 6: Small $\operatorname { T r } ( \mathbf { F } )$ during the early phase of training is more likely to reach wider minima. Left: two ResNet-56 models are trained with two different levels of regularization for 20 epochs on CIFAR-100. $\operatorname { T r } ( \mathbf { F } )$ at the end of 20 epochs $( \mathrm { { T r } ( { F _ { i } } ) ) }$ is shown. Middle: Each model is then continued trained using the low regularization configuration with different random seeds. A histogram of $\mathrm { T r } ( \mathbf { H } )$ at best test accuracy along the trajectory $( \mathrm { T r } ( \mathbf { H } _ { \mathbf { f } } ) ,$ ) is shown. Right: a histogram of test accuracy.
121
+
122
+ Table 3: Fisher Penalty (FP) and $\mathrm { G P _ { r } }$ both reduce memorization competitively to mixup. We measure test accuracy at the best validation point in training with either $2 5 \%$ or $50 \%$ examples with noisy labels in the CIFAR-100 dataset.
123
+
124
+ <table><tr><td>Noise</td><td>Setting</td><td>Baseline</td><td>Mixup</td><td>GPx</td><td>FP</td><td>GPr</td></tr><tr><td rowspan="2">25%</td><td>VGG-11/C100</td><td>41.74%</td><td>52.31%</td><td>45.94%</td><td>60.18%</td><td>58.46%</td></tr><tr><td>ResNet-52/C100</td><td>53.30%</td><td>61.61%</td><td>52.70%</td><td>58.31%</td><td>57.60%</td></tr><tr><td rowspan="2">50%</td><td>VGG-11/C100</td><td>30.05%</td><td>39.15%</td><td>34.26%</td><td> 51.33%</td><td>50.33%</td></tr><tr><td>ResNet-52/C100</td><td>43.35%</td><td> 51.71%</td><td>42.99%</td><td>47.99%</td><td>50.08%</td></tr></table>
125
+
126
+ ![](images/b5a5a955b191ef658f4f7bbc350b8eed0acf63330f974199503c4ddc5190a1a2.jpg)
127
+ Figure 5: Fisher penalty slows down training on data with noisy labels more strongly than it slows down training on clean data for VGG-11 on CIFAR-100. This likely happens because FP penalizes more strongly gradient norm on data with noisy labels. Left plot shows the training accuracy on examples with clean/noisy labels (solid/dashed line). Middle plot shows the gradient norm evaluated on examples with clean/noisy labels (solid/dashed). Right plot shows the ratio of gradient norm on clean to noisy data. Red to blue color represents the regularization coefficient (from $1 0 ^ { - 2 }$ to $1 0 ^ { 1 }$ ).
128
+
129
+ # 5 EARLY $\mathrm { T r } ( \mathbf F )$ INFLUENCES FINAL CURVATURE
130
+
131
+ To provide further insight why it is important to regularize $\operatorname { T r } ( \mathbf { F } )$ during the early phase of training, we establish a connection between the early phase of training and the wide minima hypothesis (Hochreiter & Schmidhuber, 1997; Keskar et al., 2017) which states that flat minima typically correspond to better generalization. Here, we use $\mathrm { T r } ( \mathbf { H } )$ as a measure of flatness.
132
+
133
+ Experimental setting We investigate how likely it is for an optimization trajectory to end up in a wide minimum in two scenarios. 1) When optimization exhibits small $\operatorname { T r } ( \mathbf { F } )$ early on. 2) When optimization exhibits large $\operatorname { T r } ( \mathbf { F } )$ early on. Specifically, we train two separate ResNet-26 models for 20 epochs using high and low regularization configurations. At epoch 20 we record $\operatorname { T r } ( \mathbf { F } )$ for each model. We then use these two models as initialization for 8 separate models each, and continue training using the low regularization configuration with different random seeds. The motivation behind this experiment is to show that the degree of regularization in the early phase biases the model towards minima with certain flatness $( \mathrm { T r } ( \mathbf { H } ) )$ even though no further high regularization configurations are used during the rest of the training. For all these runs, we record the best test accuracy along the optimization trajectory along with $\mathrm { T r } ( \mathbf { H } )$ at the point corresponding to the best test accuracy. We describe the remaining experimental details in Appendix G.4.
134
+
135
+ Results We present the result in Figure 6 for the CIFAR-100 datasets, and for CIFAR-10 in Appendix A.4. A training run that shows a lower $\operatorname { T r } ( \mathbf { F } )$ during the early phase is more likely to end up in a wider minimum as opposed to one that reaches large $\operatorname { T r } ( \mathbf { F } )$ during the early phase. This happens despite that the late phases of both sets of models use the low regularization configuration. The latter runs have a high variance in the best test accuracy and always end up in sharper minima. In Appendix G.4 we also show evolution of $\mathrm { T r } ( \mathbf { H } )$ throughout training, which suggests that this behavior can be attributed to curvature stabilization happening early during training.
136
+
137
+ # 6 RELATED WORK
138
+
139
+ SGD’s implicit regularization effect has been argued to be a critical component of the empirical success of DNNs (Neyshabur, 2017; Zhang et al., 2016). Much of it is attributed to the choice of hyperparameters (Keskar et al., 2017; Smith & Le, 2018; Jastrzebski et al., 2017), the low complexity bias induced by gradient descent (Xu, 2018; Jacot et al., 2018; Hu et al., 2020) or the cross-entropy loss function (Poggio et al., 2018; Soudry et al., 2018). However, a more mechanistic understanding of how SGD implicitly regularizes DNNs remains a largely unsolved problem.
140
+
141
+ Prior work on replicating SGD’s implicit regularization focused mainly on the loss curvature at the final minimum (Hochreiter & Schmidhuber, 1997). Chaudhari et al. (2019) propose a Langevin dynamics based algorithm for finding update directions that point towards wide minima. Wen et al. (2018) propose to find wide minima by averaging gradients at the neighborhood of the current parameter state. In contrast, we shift the focus to the FIM and the early phase of training. This new perspective allows us to more directly test our theory by explicitly penalizing $\operatorname { T r } ( \mathbf { F } )$ .
142
+
143
+ Penalizing $\operatorname { T r } ( \mathbf { F } )$ is related to regularizing the input gradient norm, which was shown to be an effective regularizer for deep neural networks (Drucker & Le Cun, 1992; Varga et al., 2018). Chatterjee (2020); Fort et al. (2020) show that SGD avoids memorization by extracting commonalities between examples due to following gradient descent directions shared between examples. Our work is complementary. We argue that SGD implicitly penalizes $\operatorname { T r } ( \mathbf { F } )$ , which also reduces memorization. Concurrently, Barrett & Dherin (2020) show that SGD implicitly penalizes the gradient norm for large learning rates and propose GP as an explicit regularizer. Similarly, we found that SGD implicitly regularizes $\operatorname { T r } ( \mathbf { F } )$ , which is the squared gradient norm under labels sampled from $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } )$ . In contrast to them, we connected the implicit regularization effect of SGD to large curvature in the early phase. We also found GP to be a generally less effective regularizer than FP.
144
+
145
+ # 7 CONCLUSION
146
+
147
+ Inspired by recent findings of rapid changes to the local curvature of the loss surface that happen in the early phase of training (Achille et al., 2019; Jastrz˛ebski et al., 2019; Lewkowycz et al., 2020), we investigated more closely the connection between the loss geometry in the early phase of training of neural networks and generalization.
148
+
149
+ We proposed and investigated a hypothesis that SGD influences generalization by implicitly penalizing the trace of the Fisher Information Matrix $( \mathrm { T r } ( \mathbf { F } ) )$ from the very beginning of training. We show that (1) the value of early $\operatorname { T r } ( \mathbf { F } )$ correlates with final generalization, and (2) explicitly regularizing $\operatorname { T r } ( \mathbf { F } )$ can substantially improve generalization.
150
+
151
+ To gain further insight into the mechanism by which penalizing $\operatorname { T r } ( \mathbf { F } )$ improves generalization, we investigated training on noisy data. We found that penalizing $\operatorname { T r } ( \mathbf { F } )$ reduces memorization by penalizing examples with noisy labels more strongly than clean ones, which seems to happen because it penalizes more strongly their gradient norm. This sheds new light onto implicit regularization effects in SGD, and suggests the utility of penalizing $\operatorname { T r } ( \mathbf { F } )$ as an explicit regularizer.
152
+
153
+ An interesting topic for the future is to put our findings in the context of transfer and continual learning. We hypothesize that catastrophic Fisher explosion (the initial growth of $\cdot$ to a large value) can negatively impact not only generalization, but also transferability of the model.
154
+
155
+ # REFERENCES
156
+
157
+ Alessandro Achille, Matteo Rovere, and Stefano Soatto. Critical learning periods in deep networks. In International Conference on Learning Representations, 2019.
158
+
159
+ Milad Alizadeh, Arash Behboodi, Mart van Baalen, Christos Louizos, Tijmen Blankevoort, and Max Welling. Gradient $\ell _ { 1 }$ regularization for quantization robustness. In International Conference on Learning Representations, 2020.
160
+
161
+ Anonymous. Gradient descent on neural networks typically occurs at the edge of stability. In Submitted to International Conference on Learning Representations, 2021. URL https:// openreview.net/forum?id=jh-rTtvkGeM. under review.
162
+
163
+ Devansh Arpit, Víctor Campos, and Yoshua Bengio. How to initialize your network? robust initialization for weightnorm & resnets. In Advances in Neural Information Processing Systems, 2019.
164
+
165
+ David G. T. Barrett and Benoit Dherin. Implicit gradient regularization, 2020.
166
+
167
+ Satrajit Chatterjee. Coherent gradients: An approach to understanding generalization in gradient descent-based optimization. In International Conference on Learning Representations, 2020.
168
+
169
+ Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys. Journal of Statistical Mechanics: Theory and Experiment, 2019.
170
+
171
+ François Chollet and others. Keras. GitHub, 2015.
172
+
173
+ Soham De and Samuel L. Smith. Batch normalization biases deep residual networks towards shallow paths, 2020.
174
+
175
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
176
+
177
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp Minima Can Generalize For Deep Nets. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research. PMLR, 2017.
178
+
179
+ H. Drucker and Y. Le Cun. Improving generalization performance using double backpropagation. IEEE Transactionsf on Neural Networks, 1992.
180
+
181
+ Stanislav Fort, Paweł Krzysztof Nowak, Stanislaw Jastrzebski, and Srini Narayanan. Stiffness: A new perspective on generalization in neural networks, 2020.
182
+
183
+ Jonathan Frankle, David J. Schwab, and Ari S. Morcos. The early phase of neural network training. In International Conference on Learning Representations, 2020.
184
+
185
+ Aditya Sharad Golatkar, Alessandro Achille, and Stefano Soatto. Time matters in regularizing deep networks: Weight decay and data augmentation affect early learning dynamics, matter little near convergence. In Advances in Neural Information Processing Systems 32. 2019.
186
+
187
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In Advances in Neural Information Processing Systems 30. 2017.
188
+
189
+ Guy Gur-Ari, Daniel A. Roberts, and Ethan Dyer. Gradient descent happens in a tiny subspace, 2018.
190
+
191
+ Haowei He, Gao Huang, and Yang Yuan. Asymmetric valleys: Beyond sharp and flat local minima. In Advances in Neural Information Processing Systems 32. 2019.
192
+
193
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015.
194
+
195
+ Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 1997.
196
+
197
+ Wei Hu, Lechao Xiao, Ben Adlam, and Jeffrey Pennington. The surprising simplicity of the early-time learning dynamics of neural networks, 2020.
198
+
199
+ G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger. Densely connected convolutional networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
200
+
201
+ Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 1990.
202
+
203
+ Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. CesaBianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31. Curran Associates, Inc., 2018.
204
+
205
+ Stanislaw Jastrzebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos J. Storkey. Three Factors Influencing Minima in SGD. 2017.
206
+
207
+ Stanislaw Jastrzebski, Maciej Szymczak, Stanislav Fort, Devansh Arpit, Jacek Tabor, Kyunghyun Cho\*, and Krzysztof Geras\*. The break-even point on optimization trajectories of deep neural networks. In International Conference on Learning Representations, 2020.
208
+
209
+ Stanisław Jastrz˛ebski, Zachary Kenton, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amost Storkey. On the relation between the sharpest directions of DNN loss and the SGD step length. In International Conference on Learning Representations, 2019.
210
+
211
+ Lu Jiang, Di Huang, Mason Liu, and Weilong Yang. Beyond synthetic noise: Deep learning on controlled noisy labels. In ICML, 2020a.
212
+
213
+ Yiding Jiang, Behnam Neyshabur, Dilip Krishnan, Hossein Mobahi, and Samy Bengio. Fantastic Generalization Measures and Where to Find Them. In International Conference on Learning Representations, 2020b.
214
+
215
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima. In 5th International Conference on Learning Representations, ICLR, 2017.
216
+
217
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
218
+
219
+ Y. Le and X. Yang. Tiny imagenet visual recognition challenge. 2015.
220
+
221
+ Guillaume Leclerc and Aleksander Madry. The two regimes of deep network training, 2020.
222
+
223
+ Aitor Lewkowycz, Yasaman Bahri, Ethan Dyer, Jascha Sohl-Dickstein, and Guy Gur-Ari. The large learning rate phase of deep learning: the catapult mechanism, 2020.
224
+
225
+ Junnan Li, Richard Socher, and Steven C.H. Hoi. Dividemix: Learning with noisy labels as semisupervised learning. In International Conference on Learning Representations, 2020.
226
+
227
+ Wesley J. Maddox, Gregory Benton, and Andrew Gordon Wilson. Rethinking parameter counting in deep models: Effective dimensionality revisited, 2020.
228
+
229
+ James Martens. New insights and perspectives on the natural gradient method, 2020.
230
+
231
+ Behnam Neyshabur. Implicit regularization in deep learning. 2017.
232
+
233
+ Tomaso Poggio, Kenji Kawaguchi, Qianli Liao, Brando Miranda, Lorenzo Rosasco, Xavier Boix, Jack Hidary, and Hrushikesh Mhaskar. Theory of deep learning iii: explaining the non-overfitting puzzle, 2018.
234
+
235
+ Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive autoencoders: Explicit invariance during feature extraction. In ICML, 2011.
236
+
237
+ Levent Sagun, Utku Evci, V. Ugur Guney, Yann Dauphin, and Leon Bottou. Empirical analysis of the hessian of over-parametrized neural networks, 2018.
238
+
239
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
240
+
241
+ Samuel L. Smith and Quoc V. Le. A bayesian perspective on generalization and stochastic gradient descent. In International Conference on Learning Representations, 2018.
242
+
243
+ Jiaming Song, Lunjia Hu, Michael Auli, Yann Dauphin, and Tengyu Ma. Robust and on-the-fly dataset denoising for image classification, 2020.
244
+
245
+ Daniel Soudry, Elad Hoffer, Mor Shpigel Nacson, Suriya Gunasekar, and Nathan Srebro. The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research, 2018.
246
+
247
+ Valentin Thomas, Fabian Pedregosa, Bart Merriënboer, Pierre-Antoine Manzagol, Yoshua Bengio, and Nicolas Le Roux. On the interplay between noise and curvature and its effect on optimization and generalization. In International Conference on Artificial Intelligence and Statistics. PMLR, 2020.
248
+
249
+ Yusuke Tsuzuku, Issei Sato, and Masashi Sugiyama. Normalized flat minima: Exploring scale invariant definition of flat minima for neural networks using pac-bayesian analysis, 2019.
250
+
251
+ Dániel Varga, Adrián Csiszárik, and Zsolt Zombori. Gradient regularization improves accuracy of discriminative models, 2018.
252
+
253
+ Wei Wen, Yandan Wang, Feng Yan, Cong Xu, Chunpeng Wu, Yiran Chen, and Hai Li. Smoothout: Smoothing out sharp minima to improve generalization in deep learning, 2018.
254
+
255
+ Zhiqin John Xu. Understanding training and generalization in deep learning by fourier analysis, 2018.
256
+
257
+ Yuichi Yoshida and Takeru Miyato. Spectral norm regularization for improving the generalizability of deep learning, 2017.
258
+
259
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In Proceedings of the British Machine Vision Conference (BMVC), 2016.
260
+
261
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations, 2016.
262
+
263
+ Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018.
264
+
265
+ Hongyi Zhang, Yann N. Dauphin, and Tengyu Ma. Residual learning without normalization via better initialization. In International Conference on Learning Representations, 2019.
266
+
267
+ # APPPENDIX
268
+
269
+ A ADDITIONAL RESULTS
270
+
271
+ # A.1 EARLY PHASE $\operatorname { T r } ( \mathbf { F } )$ CORRELATES WITH FINAL GENERALIZATION
272
+
273
+ In this section, we present the additional experimental results for Section 3. The experiments with varying batch size for CIFAR-100 and CIFAR-10 are shown in Figure 7. The conclusions are the same as discussed in the main text in Section 3.
274
+
275
+ ![](images/4afdbb1947f55d4032370085055a11399ea5d42f098e6eccfa388035053e29bc.jpg)
276
+ Figure 7: Association between early phase values of $\operatorname { T r } ( \mathbf { F } )$ and generalization, holds on the CIFAR10 and the CIFAR-100 datasets. Each point corresponds to multiple runs with randomly chosen seeds and a specific value of batch size. $\mathrm { T r } \mathbf { F } _ { i }$ is recorded during early phase (2-7 epochs, see main text for details), while the test accuracy is the maximum value along the entire optimization path (averaged across runs with the same batch size). The horizontal and vertical error bars show the standard deviation of values across runs. The plots show that early phase $\operatorname { T r } ( \mathbf { F } )$ is predictive of final generalization.
277
+
278
+ # A.2 FISHER PENALTY
279
+
280
+ We first show additional metrics for experiments summarized in Table 1. In Table 6 we show the final training accuracy. Table 4 confirms that generally all gradient norm regularizers reduce the maximum value of $\operatorname { T r } ( \mathbf { F } )$ (we measure $\operatorname { T r } ( \mathbf { F } )$ starting from after one epoch of training because $\operatorname { T r } ( \mathbf { F } )$ explodes in networks with batch normalization layers at initialization). Finally, Table 5 confirms that the regularizers incurred a relatively small additional computational cost.
281
+
282
+ ![](images/86f65c41dd28dda537c5a94df3abd78a9811447560c57fd1d2b5055918882c27.jpg)
283
+ Figure 8 is a counterpart of Figure 3 for the other two models on the CIFAR-10 and the CIFAR-100 datasets.
284
+ Figure 8: Same as Figure 3, but for DenseNet on CIFAR-100, and SimpleCNN on CIFAR-10. Curves were smoothed for visual clarity.
285
+
286
+ Table 4: The maximum value of $\operatorname { T r } ( \mathbf { F } )$ along the optimization trajectory for experiments on CIFAR-10 or CIFAR-100 included in Table 1.
287
+
288
+ <table><tr><td>Setting</td><td>n*</td><td>Baseline</td><td>GPx</td><td>GP</td><td>FP</td><td>GP</td></tr><tr><td>DenseNet/C100 (w/o aug.)</td><td>24.68</td><td>98.17</td><td>83.64</td><td>64.33</td><td>66.24</td><td>73.66</td></tr><tr><td>VGG11/C100 (w/o aug.)</td><td>50.88</td><td>148.19</td><td>102.95</td><td>58.53</td><td>64.93</td><td>62.96</td></tr><tr><td>WResNet/C100 (w/o aug.)</td><td>26.21</td><td>91.39</td><td>41.43</td><td>40.94</td><td>56.53</td><td>39.31</td></tr><tr><td>SCNN/C10 (w/o aug.)</td><td>24.21</td><td>52.05</td><td>47.96</td><td>25.03</td><td>19.63</td><td>25.35</td></tr></table>
289
+
290
+ Table 5: Time per epoch (in seconds) for experiments in Table 1.
291
+
292
+ <table><tr><td>Setting</td><td>m*</td><td>Baseline</td><td>GPx</td><td>GP</td><td>FP</td><td>GP</td></tr><tr><td>WResNet/TinyImageNet (aug.)</td><td>214.45</td><td>142.69</td><td>233.14</td><td>143.78</td><td>208.62</td><td>371.74</td></tr><tr><td>DenseNet/C100 (w/o aug.)</td><td>78.88</td><td>57.40</td><td>77.89</td><td>78.66</td><td>97.25</td><td>75.96</td></tr><tr><td>VGG11/C100 (w/o aug.)</td><td>30.50</td><td>35.27</td><td>31.54</td><td>32.52</td><td>43.41</td><td>42.40</td></tr><tr><td>WResNet/C100 (w/o aug.)</td><td>49.64</td><td>47.99</td><td>71.33</td><td>61.36</td><td>76.93</td><td>53.25</td></tr><tr><td>SCNN/C10 (w/o aug.)</td><td>18.64</td><td>19.51</td><td>26.09</td><td>19.91</td><td>21.21</td><td>20.55</td></tr></table>
293
+
294
+ Table 6: The final epoch training accuracy for experiments shown in Table 1. Experiments with small learning rate reach no lower accuracy than experiments corresponding to a large learning rate $\eta ^ { * }$ .
295
+
296
+ <table><tr><td>Setting</td><td>m*</td><td>Baseline</td><td>GPx</td><td>GP</td><td>FP</td><td>GP</td></tr><tr><td>WResNet/TinyImageNet (aug.)</td><td>99.84%</td><td>99.96%</td><td>99.97%</td><td>93.84%</td><td>81.05%</td><td>86.46%</td></tr><tr><td>DenseNet/C100 (w/o aug)</td><td>99.98%</td><td>99.97%</td><td>99.96%</td><td>99.91%</td><td>99.91%</td><td>99.39%</td></tr><tr><td>VGG11/C100 (w/o aug)</td><td>99.98%</td><td>99.98%</td><td>99.85%</td><td>99.62%</td><td>97.73%</td><td>86.32%</td></tr><tr><td>WResNet/C100 (w/o aug)</td><td>99.98%</td><td>99.98%</td><td>99.97%</td><td>99.96%</td><td>99.99%</td><td>99.94%</td></tr><tr><td>SCNN/C10 (w/o aug)</td><td>100.00%</td><td>100.00%</td><td>97.79%</td><td>100.00%</td><td>93.80%</td><td>94.64%</td></tr></table>
297
+
298
+ # A.3 FISHER PENALTY REDUCES MEMORIZATION
299
+
300
+ In this section, we describe additional experimental results for Section 4.1. Figure 9 is the same as Figure 5, but for ResNet-50.
301
+
302
+ ![](images/ee4d5e480ffe2a7bf5a738d6821a048af4c55570966df6f0d7babfee2233f1fa.jpg)
303
+ Figure 9: Same as Figure 5, but for ResNet-50.
304
+
305
+ # A.4 EARLY $\operatorname { T r } ( \mathbf { F } )$ INFLUENCES FINAL CURVATURE
306
+
307
+ In this section, we present additional experimental results for Section 5. The experiment on CIFAR-10 is shown in Figure 10. The conclusions are the same as discussed in the main text in Section 5.
308
+
309
+ ![](images/63ef5905624a61a4354e721d63489d6eb823dae11cee3b9edd580fc50bfa206e.jpg)
310
+ Figure 10: Small $\operatorname { T r } ( \mathbf { F } )$ during the early phase of training is more likely to reach wider minima as measured by $\mathrm { T r } ( \mathbf { H } )$ . Left: 2 models are trained with different levels of regularization for 20 epochs on CIFAR-10. $\operatorname { T r } ( \mathbf { F } )$ at the end of 20 epochs (denoted as $\operatorname { T r } ( \mathbf { F _ { i } } ) )$ ) is shown. Middle: Each model is then used as initialization and trained until convergence using the low regularization configuration with different random seeds. A histogram of $\mathrm { T r } ( \mathbf { H } )$ at the point corresponding to the best test accuracy along the trajectory (denoted by $\mathrm { T r } ( \mathbf { H } _ { \mathbf { f } } ) \dot { { \mathbf { \phi } } }$ ) is shown. Right: a histogram of the best test accuracy corresponding to middle figure is shown.
311
+
312
+ ![](images/056f59edf57a0b5750e6f703ffb0d8514f41e171c59f9478570a120a42f71370.jpg)
313
+ Figure 11: The value of $\mathrm { T r } ( \mathbf { H } )$ over the course of training. Each point corresponds to runs with different seeds and a specific value of learning rate $\eta$ and batch size $S$ . $\ell$ and TA respectively denote the minimum training loss and the maximum test accuracy along the entire trajectory for the corresponding runs (averaged across seeds). The plots show that flatter optimization trajectories become biased towards flatter minima early during training, at a coarse scale of hyper-parameter values (red vs blue).
314
+
315
+ Next, to understand why smaller $\operatorname { T r } ( \mathbf { F } )$ during early phase is more likely to end up in a wider final minimum, we track $\mathrm { T r } ( \mathbf { H } )$ during the entire coarse of training and show that it stabilizes early during training. In this experiment, we create two sets of hyper-parameters: coarse-grained and fine-grained. For CIFAR-10, we use batch size $S \in A \cup B$ , where $A = \{ 4 8 0 , 5 0 0 , 5 2 0 \}$ and $B = \{ 8 0 , 1 0 0 , 1 2 0 \}$ . For all batch size configurations, a learning rate of 0.02 is used. Overloading the symbols $A$ and $B$ for CIFAR-100, we use learning rate $\eta ~ \in ~ A \cup B$ , where $A = \{ 0 . 0 0 0 \bar { 8 } , 0 . 0 0 \bar { 1 } , 0 . 0 0 1 2 \}$ and $B = \{ 0 . 0 0 8 , 0 . 0 1 , 0 . 0 1 2 \}$ . For all learning rate configurations, a batch size of 100 is used. In both cases, the elements within each set ( $A$ and $B$ ) vary on a fine-grained scale, while the elements across the two sets vary on a coarse-grained scale. The remaining details and additional experiments can be found in Appendix G.4. The experiments are shown in Figure 11. Notice that after initialization (index 0 on $\mathbf { X }$ -axis), the first value is computed at epoch 10 (at which point previous experiments show that entanglement starts to hold with late phase).
316
+
317
+ We make three observations in this experiment. First, the relative ordering of $\mathrm { T r } ( \mathbf { H } )$ values for runs between sets $A$ vs $B$ stay the same after the first 10 epochs. Second, the degree of entanglement is higher between any two epochs when looking at runs across sets $A$ and $B$ , while it is weaker when looking at runs within any one the sets. Finally, test accuracies for set $B$ runs are always higher than those of set $A$ runs, but this trend is not strong for runs within any one set. Note that the minimum loss values are roughly at a similar scale for each dataset and they are all at or below $1 0 ^ { - 2 }$ .
318
+
319
+ # B COMPUTATION OF $\mathrm { T r } ( \mathbf { H } )$
320
+
321
+ We computed $\mathrm { T r } ( \mathbf { H } )$ in our experiments using the Hutchinson’s estimator Hutchinson (1990),
322
+
323
+ $$
324
+ \begin{array} { r l } & { T r ( \mathbf { H } ) = T r ( \mathbf { H } ) = T r ( \mathbf { H } ) } \\ & { \quad = T r ( \mathbf { H } \cdot \mathbf { B } [ \varrho \mathbf { z } ^ { T } ] ) } \\ & { \quad = \mathbb { E } [ T r ( \mathbf { H } \cdot \mathbf { z } \mathbf { z } ^ { T } ) ] } \\ & { \quad = \mathbb { E } [ T r ( \mathbf { H } \cdot \mathbf { z } ) ^ { T } ] } \\ & { \quad = \mathbb { E } [ \varrho ^ { T } \mathbf { H } \cdot \mathbf { z } ] } \\ & { \quad \approx \frac { 1 } { M } \frac { 1 } { \omega _ { \mathrm { m } } ^ { T } } \mathbf { z } ^ { T } \mathbf { H } \cdot \mathbf { z } _ { i } } \\ & { \quad = \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \tau _ { i } ^ { T } \frac { \partial } { \partial \theta } \left( \frac { \partial \mathcal { E } } { \partial \theta ^ { T } } \right) \cdot \mathbf { z } _ { i } } \\ & { \quad = \frac { 1 } { M } \frac { 1 } { \omega _ { \mathrm { m } } ^ { T } } z _ { i } ^ { T } \frac { \partial } { \partial \theta } \left( \frac { \partial \mathcal { E } ^ { T } } { \partial \theta } \mathbf { z } _ { i } \right) , } \end{array}
325
+ $$
326
+
327
+ where I is the identity matrix, $\mathbf { z }$ is a multi-variate standard Gaussian random variable, and $\mathbf { z } _ { i }$ ’s are i.i.d. instances of $\mathbf { z }$ . The larger the value of $M$ , the more accurate the approximation is. We used $M = 3 0$ . To make the above computation efficient, note that the gradient $\frac { \partial \ell } { \partial \theta }$ only needs to be computed once and it can be re-used in the summation over the $M$ samples.
328
+
329
+ # C APPROXIMATIONS IN FISHER PENALTY
330
+
331
+ In this section, we describe the approximations made in Fisher Penalty in detail. Recall, that $\operatorname { T r } ( \mathbf { F } )$ can be expressed as
332
+
333
+ $$
334
+ \mathrm { T r } ( \mathbf { F } ) = \mathbb { E } _ { \boldsymbol { x } \sim \mathcal { X } , \hat { \boldsymbol { y } } \sim p _ { \boldsymbol { \theta } } ( \boldsymbol { y } \vert \mathbf { x } ) } \left[ \Vert \frac { \partial } { \partial \boldsymbol { \theta } } \boldsymbol { \ell } ( \mathbf { x } , \hat { \boldsymbol { y } } ) \Vert _ { 2 } ^ { 2 } \right] .
335
+ $$
336
+
337
+ In the preliminary experiments, we found empirically that we can use the norm of the expected gradient rather than the expected norm of the gradient, which is a more direct expression of $\operatorname { T r } ( \mathbf { F } )$ :
338
+
339
+ $$
340
+ \begin{array} { r } { \nabla \mathbb { E } _ { x \sim \mathcal { X } , \hat { y } \sim p _ { \theta } ( y | x ) } \left[ \left\| \frac { \partial } { \partial \theta } \ell ( \pmb { x } , \hat { y } ) \right\| _ { 2 } ^ { 2 } \right] \approx \displaystyle \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \nabla \left\| \frac { \partial } { \partial \theta } \ell ( \pmb { x } _ { n } , \hat { y } _ { n m } ) \right\| _ { 2 } ^ { 2 } } \\ { \geq \nabla \left\| \frac { 1 } { N M } \sum _ { n = 1 } ^ { N } \sum _ { m = 1 } ^ { M } \frac { \partial } { \partial \theta } \ell ( \pmb { x } _ { n } , \hat { y } _ { n m } ) \right\| _ { 2 } ^ { 2 } , } \end{array}
341
+ $$
342
+
343
+ where $N$ and $M$ are the minibatch size and the number of samples from $p _ { \theta } ( y | \pmb { x } _ { n } )$ , respectively. This greatly improves the computational efficiency. With $N = B$ and $M = 1$ , we end up with the following learning objective function:
344
+
345
+ $$
346
+ \ell ^ { \prime } ( x _ { 1 : B } , y _ { 1 : B } ; \pmb \theta ) = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \ell ( { \pmb x } _ { i } , y _ { i } ; \pmb \theta ) + \alpha \left\| \frac { 1 } { B } \sum _ { i = 1 } ^ { B } g ( { \pmb x } _ { i } , \hat { y } _ { i } ) \right\| ^ { 2 } .
347
+ $$
348
+
349
+ We found empirically that $\begin{array} { r l } & { \left\| \frac { 1 } { B } \sum _ { i = 1 } ^ { B } g ( \pmb { x } _ { i } , \hat { y } _ { i } ) \right\| ^ { 2 } } \end{array}$ , which we denote by $\mathrm { T r } ( \mathbf { F } ^ { B } )$ , and $\operatorname { T r } ( \mathbf { F } )$ correlate well during training. To demonstrate this, we train SimpleCNN on the CIFAR-10 dataset with 5 different learning rates (from $1 0 ^ { - 3 }$ to $1 0 ^ { - 1 }$ ). The outcome is shown in Figure 12. We see that for most of the training, with the exception of the final phase, $\mathrm { T r } ( \mathbf { F } ^ { B } )$ and $\operatorname { T r } ( \mathbf { F } )$ correlate extremely well. Equally importantly, we find that using a large learning affects both $\mathrm { T r } ( \mathbf { F } ^ { B } )$ and $\operatorname { T r } ( \mathbf { F } )$ , which further suggests the two are closely connected.
350
+
351
+ ![](images/86d3ea80c56f74dc85b6c95e62926e6e682bf3498c67bb68d870bfb0a1ef8f6f.jpg)
352
+ Figure 12: Correlation between $\operatorname { T r } ( \mathbf { F } )$ and $\mathrm { T r } ( \mathbf { F } ^ { B } )$ for SimpleCNN trained on the CIFAR-10 dataset. Blue to red color denotes learning rates from $1 0 ^ { - 3 }$ to $1 0 ^ { - 1 }$ . The value of $\operatorname { T r } ( \mathbf { F } )$ and $\mathrm { T r } ( \mathbf { F } ^ { B } )$ correlate strongly for the most of the training trajectory. Using large learning rate reduces both $\operatorname { T r } ( \mathbf { F } )$ and $\mathrm { T r } ( \mathbf { F } ^ { \mathbf { \breve { B } } } )$ .
353
+
354
+ ![](images/4adecb439e7a7276cc7e9f8ef4e6fa3fa38b3957ffb8621bcfe30a68138dc2b6.jpg)
355
+ Figure 13: A comparison between the effect of recomputing Fisher Penalty gradient every 10 iterations (left) or every iteration (right), with respect to validation accuracy and $\operatorname { T r } ( \mathbf { F } )$ . We denote by $f$ the frequency with which we update the gradient. Both experiments result in approximately $80 \%$ test accuracy with the best configuration.
356
+
357
+ ![](images/b18b19773aee4f7fe7547a9e97644b4b1cd76d1e0ce056ce07e2cc6c1b475ab3.jpg)
358
+ Figure 14: Using Fisher Penalty without the approximation results in a similar generalization performance. We penalize the norm of the gradient rather than norm of the mini-batch gradient (as in Equation 2). We observe that this variant of Fisher Penalty improves generalization to a similar degree as the version of Fisher Penalty used in the paper (c.f. Figure 13.), achieving $\cdot$ test accuracy.
359
+
360
+ We also update the gradient of $\mathrm { T r } ( \mathbf { F } ^ { B } )$ only every 10 optimization steps. We found empirically it does not affect generalization performance nor the ability to regularize $\operatorname { T r } ( \mathbf { F } )$ in our setting. However, we acknowledge that it is plausible that this choice would have to be reconsidered in training with very large learning rates or with larger models.
361
+
362
+ Figure 13 compares learning curves of training with FP recomputed every optimization step, or every 10 optimization steps. For each, we tune the hyperparameter $\alpha$ , checking 10 values equally spaced between $1 0 ^ { - 2 }$ and $1 0 ^ { 0 }$ on a logarithmic scale. We observe that for the optimal value of $\alpha$ both validation accuracy and $\operatorname { T r } ( \mathbf { F } )$ are similar between the two runs. Both experiments achieve approximately $80 \%$ test accuracy.
363
+
364
+ Finally, to ensure that using the approximation in Equation 2 does not negatively affect how Fisher Penalty improves generalization or reduces the value of $\operatorname { T r } ( \mathbf { F } )$ , we experiment with a variant of Fisher Penalty without the approximation. Please recall that we always measure $\mathrm { T r } ( \mathbf { F } )$ (i.e. we do not use approximations in computing $\operatorname { T r } ( \mathbf { F } )$ that is reported in the plots), regardless of what variant of penalty is used in regularizing the training.
365
+
366
+ Specifically, we augment the loss function with the norm of the gradient computed on the first example in the mini-batch as follows
367
+
368
+ $$
369
+ \ell ^ { \prime } ( x _ { 1 : B } , y _ { 1 : B } ; \pmb \theta ) = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \ell ( { \pmb x } _ { i } , y _ { i } ; \pmb \theta ) + \alpha \left\| g ( { \pmb x } _ { 1 } , \hat { y } _ { 1 } ) \right\| ^ { 2 } .
370
+ $$
371
+
372
+ We apply this penalty in each optimization step. We tune the hyperparameter $\cdot$ , checking 10 values equally spaced between $\cdot$ and $\cdot$ on a logarithmic scale.
373
+
374
+ Figure 14 summarizes the results. We observe that the best value of $\cdot$ yields $7 9 . 7 \%$ test accuracy, compared to $\cdot$ test accuracy yielded by the Fisher Penalty. The effect on $\cdot$ is also very similar. We observe that the best run corresponds to maximum value of $\cdot$ of 24.16, compared to that of 21.38 achieved by Fisher Penalty. These results suggest that the approximation used in Fisher Penalty only improves the generalization and flattening effects of Fisher Penalty.
375
+
376
+ # D A CLOSER LOOK AT THE SURPRISING EFFECT OF LEARNING RATE ON THE LOSS GEOMETRY IN THE EARLY PHASE OF TRAINING
377
+
378
+ It is intuitive to hypothesize that the catastrophic Fisher explosion (the initial growth of the value of $\cdot$ ) occurs during training with a large learning rate, but is overlooked due to not sufficiently fine-grained computation of $\cdot$ . In this section we show evidence against this hypothesis based on the literature mentioned in the main text. We also run additional experiments in which we compute the value of $\operatorname { T r } ( \mathbf { F } )$ at each iteration.
379
+
380
+ The surprising effect of the learning rate on the geometry of the loss surface (e.g. the value of $\cdot$ ) was demonstrated in prior works (Jastrz˛ebski et al., 2019; Golatkar et al., 2019; Lewkowycz et al., 2020; Leclerc & Madry, 2020). In particular, Jastrzebski et al. (2020); Lewkowycz et al. (2020) show that training with large learning rate rapidly escapes regions of high curvature, where curvature is understood as the spectral norm of the Hessian evaluated at the current point of the loss surface. Perhaps the most direct experimental data against this hypothesis can be found in Anonymous (2021) in Figure 1, where training with Gradient Descent finds regions of the loss surface with large curvature for small learning rate rapidly in the early phase of training.
381
+
382
+ We also run the following experiment to provide further evidence against the hypothesis. We train SimpleCNN on the CIFAR-10 dataset using two different learning rates, while computing the value of $\cdot$ for every mini-batch. We use 128 random samples in each iteration to estimate $\cdot$ .
383
+
384
+ We find that training with a large learning rate never (even for a single optimization step) enters a region with the value of $\operatorname { T r } ( \mathbf { F } )$ as large as reached during training with a small learning rate. Figure 15 shows the experimental data.
385
+
386
+ We also found similar to hold when varying the batch size, see Section E, which further shows that the observed effects cannot be explained by the difference in learning speed incurred by using a small learning rate.
387
+
388
+ To summarize, both the published evidence of Jastrzebski et al. (2020); Lewkowycz et al. (2020); Anonymous (2021), as well as our additional experiments are inconsistent with the hypothesis that the results in this paper can be explained by differences in training speed between experiments using large and small learning rates.
389
+
390
+ ![](images/78bd5ee69baa2ac17885df8dfa174f463cb205a4563812370577ec74cf5bc94f.jpg)
391
+ Figure 15: Training with a large learning rate never (even for a single optimization step) enters a region with as large value of $\cdot$ as the maximum value of $\cdot$ reached during training with a small learning rate. We run the experiment using SimpleCNN on the CIFAR-10 dataset with two different learning rates. The left plot shows the value of $\operatorname { T r } ( \mathbf { F } )$ computed at each iteration, and the right plot shows training accuracy computed on the current mini-batch (curve has been smoothed for clarity).
392
+
393
+ # E CATASTROPHIC FISHER EXPLOSION HOLDS IN TRAINING WITH LARGE BATCH-SIZE
394
+
395
+ In this section, we show evidence that the conclusions transfer to large batch size training. Namely, we show that (1) catastrophic Fisher explosion also occurs in large batch size training, and (2) Fisher Penalty can improve generalization and close the generalization gap due to using a large batch size (Keskar et al., 2017).
396
+
397
+ ![](images/88d894bf26dc9f32949eedeb4378b3ac93541cec6b9b796aeb30490c170a5776.jpg)
398
+ Figure 16: Catastrophic Fisher explosion in large batch size training. Experiment run on the CIFAR10 and dataset the SimpleCNN model. The left plot shows the value of $\cdot$ computed at each iteration, and the right plot shows training accuracy computed on the current mini-batch (curve has been smoothed for clarity).
399
+
400
+ We first train SimpleCNN on the CIFAR-10 dataset using three different batch sizes, while computing the value of $\cdot$ for every mini-batch. We use 128 random samples in each iteration to estimate $\cdot$ . Figure 16 summarizes the experiment. We observe that training with a large batch size enters a region of the loss surface with a substantially larger value of $\cdot$ than the small batch size.
401
+
402
+ Next, we run a variant of one of the experiments in Table 1. Instead of using a suboptimal (smaller) learning rate, we use a suboptimal (larger) batch size. Specifically, we train SimpleCNN on the CIFAR-10 dataset (without augmentation) with a $\cdot$ larger batch size while keeping learning rate the same. Using a larger batch size results in $3 . 2 4 \%$ lower test accuracy ( $7 6 . 9 4 \%$ compared to ${ \bar { 7 } } 3 . 7 \%$ test accuracy, c.f. with Table 1).
403
+
404
+ We next experiment with Fisher Penalty. We apply the penalty in each optimization step and use the first 128 examples when computing the penalty. We also use a $2 \mathrm { x }$ lower learning rate, which stabilizes training but does not improve generalization on its own (training with this learning rate reaches $\cdot$ test accuracy). Figure 17 shows $\mathrm { T r } ( \mathbf { F } )$ and validation accuracy during training for different values of the penalty. We observe that Fisher Penalty improves test accuracy from $7 3 . 5 9 \%$ to $7 8 . 7 \%$ . Applying Fisher Penalty also effectively reduces the peak value of $\mathrm { T r } ( \mathbf { F } ) /$ i
405
+
406
+ Taken together, the results suggest that Catastrophic Fisher explosion holds in large batch size training; using a small batch size improves generalization by a similar mechanism as using a large batch size, which can be introduced explicitly in the form of Fisher Penalty.
407
+
408
+ ![](images/1818eda78f1a8287dcc03b60b299742cbf1e291c049c2bd0fa9c4a24f0810d00.jpg)
409
+ Figure 17: Fisher Penalty improves in large batch size training. Experiment run on the CIFAR-10 dataset (without augmentation) and the SimpleCNN model. Warmer color corresponds to larger coefficient used in Fisher Penalty.
410
+
411
+ # F $\mathrm { T r } ( \mathbf { H } )$ AND $\mathrm { T r } ( \mathbf F )$ CORRELATE STRONGLY
412
+
413
+ We demonstrate a strong correlation between $\mathrm { T r } ( \mathbf { H } )$ and $\operatorname { T r } ( \mathbf { F } )$ for DenseNet, ResNet-56 and SimpleCNN in Figure 18. We calculate $\operatorname { T r } ( \mathbf { F } )$ using a mini-batch. We see that $\operatorname { T r } ( \mathbf { F } )$ has a smaller magnitude (because we use the mini-batch gradient which has lower variance), but correlates extremely well with $\mathrm { T r } ( \mathbf { H } )$ .
414
+
415
+ ![](images/04b02357d2fd9445daf7f56873824a57c5c016a4ba2f86145670da52a9c6cee4.jpg)
416
+ Figure 18: Correlation between $\operatorname { T r } ( \mathbf { F } )$ and $\mathrm { T r } ( \mathbf { H } )$ .
417
+
418
+ # G ADDITIONAL EXPERIMENTAL DETAILS
419
+
420
+ G.1 EARLY PHASE $\operatorname { T r } ( \mathbf { F } )$ CORRELATES WITH FINAL GENERALIZATION
421
+
422
+ Here, we describe additional details for experiments in Section 3.
423
+
424
+ In the experiments with batch size, for CIFAR-10, we use batch sizes 100, 500 and 700, and $\epsilon = 1 . 2$ For CIFAR-100, we use batch sizes 100, 300 and 700, and $\epsilon = 3 . 5$ . These thresholds are crossed between 2 and 7 epochs across different hyperparameter settings. The remaining details for CIFAR100 and CIFAR-10 are the same as described in main text. The optimization details for these datasets are as follows.
425
+
426
+ ImageNet: No data augmentation was used in order to allow training loss to converge to small values. We use a batch size of 256. Training is done using SGD with momentum set to 0.9, weight decay set to $1 e - 4$ , and with base learning rate as per the aforementioned details. Learning rate is dropped by a factor of 0.1 after 29 epochs and training is ended at around 50 epochs at which most runs converge to small loss values. No batch normalization is used and weight are initialized using Fixup Zhang et al. (2019). For each hyperparameter setting, we run two experiments with different random seeds due to the computational overhead. We compute $\operatorname { T r } ( \mathbf { F } )$ using 2500 samples (similarly to ?).
427
+
428
+ CIFAR-10: We used random flipping as data augmentation. In the experiments with variation in learning rates, we use a batch size of 256. In the experiments with variation in batch size, we use a learning rate of 0.02. Training is done using SGD with momentum set to 0.9, weight decay set to $1 e - 5$ , and with base learning rate as per the aforementioned details. Learning rate is dropped by a factor of 0.5 at epochs 60, 120, and 170, and training is ended at 200 epochs at which most runs converge to small loss values. No batch normalization is used and weight are initialized using Arpit et al. (2019). For each hyperparameter setting, we run 32 experiments with different random seeds. We compute $\operatorname { T r } ( \mathbf { F } )$ using 5000 samples.
429
+
430
+ CIFAR-100: No data augmentation was used for CIFAR-100 to allow training loss to converge to small values. We used random flipping as data augmentation for CIFAR-10. In the experiments with variation in learning rates, we use a batch size of 100. In the experiments with variation in batch size, we use a learning rates of 0.02. Training is done using SGD with momentum set to 0.9, weight decay set to $1 e - 5$ , and with base learning rate as per the aforementioned details. Learning rate is dropped by a factor of 0.5 at epochs 60, 120, and 170, and training is ended at 200 epochs at which most runs converge to small loss values. No batch normalization is used and weight are initialized using Arpit et al. (2019). For each hyperparameter setting, we run 32 experiments with different random seeds. We compute $\operatorname { T r } ( \mathbf { F } )$ using 5000 samples.
431
+
432
+ # G.2 FISHER PENALTY
433
+
434
+ Here, we describe the remaining details for the experiments in Section 4. We first describe how we tune hyperparameters in these experiments. In the remainder of this section, we describe each setting used in detail .
435
+
436
+ Tuning hyperparameters In all experiments, we refer to the optimal learning rate $\eta ^ { * }$ as the learning rate optimized using grid search. In most experiments we check 5 different learning rate values uniformly spaced on a logarithmic scale, usually between $1 0 ^ { - 2 }$ and $1 0 ^ { 0 }$ . In some experiments we adapt the range to ensure that the range includes the optimal learning rate. We tune the learning rate only once for each configuration (i.e. we do not repeat it for different random seeds).
437
+
438
+ In the first setting, for most experiments involving gradient norm regularizers, we use $1 0 \times$ smaller learning rate than $\eta ^ { * }$ . For TinyImageNet, we use $3 0 \times$ smaller learning rate than $\eta ^ { * }$ . To pick the regularization coefficient $\alpha$ , we evaluate 10 different values uniformly spaced on a logarithmic scale between $1 0 ^ { - 1 } \times v$ to $1 0 ^ { 1 } \times v$ with $v \in \mathbb { R } _ { + }$ . We choose the best performing $\alpha$ according to best validation accuracy. We pick the value of $v$ manually with the aim that the optimal $\alpha$ is included in this range. We generally found that $v = 0 . 0 1$ works well for GP, $\mathrm { G P _ { r } }$ , and FP. For $\mathrm { G P _ { x } }$ we found in some experiments that it is necessary to pick larger values of $v$ .
439
+
440
+ Measuring $\operatorname { T r } ( \mathbf { F } )$ We measure $\operatorname { T r } ( \mathbf { F } )$ using the number of examples equal to the batch size used in training. For experiments with Batch Normalization layers, we use Batch Normalization in evaluation mode due to the practical reason that computing $\operatorname { T r } ( \mathbf { F } )$ uses batch size of 1, and hence $\operatorname { T r } ( \mathbf { F } )$ is not defined for a network with Batch Normalization layers in training mode.
441
+
442
+ DenseNet on the CIFAR-100 dataset We use the DenseNet $( \mathrm { L } { = } 4 0 , \mathrm { k } { = } 1 2$ ) configuration from Huang et al. (2017). We largely follow the experimental setting in Huang et al. (2017). We use the standard data augmentation (where noted) and data normalization for CIFAR-100. We hold out random 5000 examples as the validation set. We train the model using SGD with momentum of 0.9, a batch size of 128, and weight decay of 0.0001. Following Huang et al. (2017), we train for 300 epochs and decay the learning rate by a factor of 0.1 after epochs 150 and 225. To reduce variance, in testing we update Batch Normalization statistics using 100 batches from the training set.
443
+
444
+ Wide ResNet on the CIFAR-100 dataset We train Wide ResNet (depth 44 and width 3, without Batch Normalization layers). We largely follow experimental setting in He et al. (2015).We use the standard data augmentation and data normalization for CIFAR-100. We hold out random 5000 examples as the validation set. We train the model using SGD with momentum of 0.9, a batch size of 128, weight decay of 0.0010. Following He et al. (2015), we train for 300 epochs and decay the learning rate by a factor of 0.1 after epochs 150 and 225. We remove Batch Normalization layers. To ensure stable training we use the SkipInit initialization (De & Smith, 2020).
445
+
446
+ VGG-11 on the CIFAR-100 dataset We adapt the VGG-11 model (Simonyan & Zisserman, 2015) to CIFAR-100. We do not use dropout nor Batch Normalization layers. We hold out random 5000 examples as the validation set. We use the standard data augmentation (where noted) and data normalization for CIFAR-100. We train the model using SGD with momentum of 0.9, a batch size of 128, and weight decay of 0.0001. We train the model for 300 epochs, and decay the learning rate by a factor of 0.1 after every 40 epochs starting from epoch 80.
447
+
448
+ SimpleCNN on the CIFAR-10 dataset We also run experiments on the CNN example architecture from the Keras example repository (Chollet & others, $2 0 \dot { 1 } \dot { 5 } ) ^ { 1 }$ , which we change slightly. Specifically, we remove dropout and reduce the size of the final fully-connected layer to 128. We train it for 300 epochs and decay the learning rate by a factor of 0.1 after the epochs 150 and 225. We train the model using SGD with momentum of 0.9, a batch size of 128.
449
+
450
+ Wide ResNet on the TinyImageNet dataset We train Wide ResNet (depth 44 and width 3, with Batch Normalization layers) on TinyImageNet Le & Yang (2015). TinyImageNet consists of subset of 100,000 examples from ImageNet that we downsized to $3 2 \times 3 2$ pixels. We train the model using SGD with momentum of 0.9, a batch size of 128, and weight decay of 0.0001. We train for 300 epochs and decay the learning rate by a factor of 0.1 after epochs 150 and 225. We train the model using SGD with momentum of 0.9, a batch size of 128. We do not use validation in TinyImageNet due to its larger size. To reduce variance, in testing we update Batch Normalization statistics using 100 batches from the training set.
451
+
452
+ # G.3 FISHER PENALTY REDUCES MEMORIZATION
453
+
454
+ Here, we describe additional experimental details for Section 4.1. We use two configurations described in Section G.2: VGG-11 trained on CIFAR-100 dataset, and Wide ResNe trained on the CIFAR-100 dataset. We tune the regularization coefficient $\alpha$ in the range $\{ 0 . 0 1 , 0 . 1 , 0 . 3 1 , 1 0 \}$ , with the exception of $\mathrm { G P _ { x } }$ for which we use the range $\{ 1 0 , 3 0 , 1 0 0 , 3 0 0 , 1 0 0 0 \}$ . We tuned mixup coefficient in the range $\{ 0 . 4 , 0 . 8 , 1 . 6 , 3 . 2 , 6 . 4 \}$ . We removed weight decay in these experiments.
455
+
456
+ # G.4 EARLY $\operatorname { T r } ( \mathbf { F } )$ INFLUENCES FINAL CURVATURE
457
+
458
+ CIFAR-10: We used random flipping as data augmentation for CIFAR-10. We use a learning rate of 0.02 for all experiments. Training is done using SGD with momentum 0.9, weight decay $1 e - 5$ , and with batch size as shown in figures. Learning rate is drop by a factor of 0.5 at 80, 150, and 200 epochs, and training is ended at 250 epochs. No batch normalization is used and weight are initialized using Arpit et al. (2019). For each batch size, we run 32 experiments with different random seeds. We compute $\operatorname { T r } ( \mathbf { F } )$ using 5000 samples.
459
+
460
+ CIFAR-100: No data augmentation is used. We use a batch size of 100 for all experiments. Training is done using SGD with momentum 0.9, weight decay $1 e - 5$ , and with base learning rate as shown in figures. Learning rate is drop by a factor of 0.5 at 80, 150, and 200 epochs, and training is ended at 250 epochs. No batch normalization is used and weight are initialized using Arpit et al. (2019). For each learning rate, we run 32 experiments with different random seeds. We compute $\operatorname { T r } ( \mathbf { F } )$ using 5000 samples.
md/train/zQvxc8ul2rR/zQvxc8ul2rR.md ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stabilizing Deep $Q$ -Learning with ConvNets and Vision Transformers under Data Augmentation
2
+
3
+ Nicklas Hansen1 Hao $\mathbf { S u } ^ { 1 }$ Xiaolong Wang1 1University of California, San Diego nihansen@ucsd.edu {haosu,xiw012}@eng.ucsd.edu
4
+
5
+ # Abstract
6
+
7
+ While agents trained by Reinforcement Learning (RL) can solve increasingly challenging tasks directly from visual observations, generalizing learned skills to novel environments remains very challenging. Extensive use of data augmentation is a promising technique for improving generalization in RL, but it is often found to decrease sample efficiency and can even lead to divergence. In this paper, we investigate causes of instability when using data augmentation in common off-policy RL algorithms. We identify two problems, both rooted in high-variance $Q$ -targets. Based on our findings, we propose a simple yet effective technique for stabilizing this class of algorithms under augmentation. We perform extensive empirical evaluation of image-based RL using both ConvNets and Vision Transformers (ViT) on a family of benchmarks based on DeepMind Control Suite, as well as in robotic manipulation tasks. Our method greatly improves stability and sample efficiency of ConvNets under augmentation, and achieves generalization results competitive with state-of-the-art methods for image-based RL in environments with unseen visuals. We further show that our method scales to RL with ViT-based architectures, and that data augmentation may be especially important in this setting.†
8
+
9
+ # 1 Introduction
10
+
11
+ Reinforcement Learning (RL) from visual observations has achieved tremendous success in various applications such as video-games [43, 4, 70], robotic manipulation [37], and autonomous navigation [42, 83]. However, it is still very challenging for current methods to generalize the learned skills to novel environments, and policies trained by RL can easily overfit to the training environment [81, 13], especially for high-dimensional observation spaces such as images [8, 58].
12
+
13
+ Increasing the variability in training data via domain randomization [66, 50] and data augmentation [57, 35, 33, 51] has demonstrated encouraging results for learning policies invariant to changes in environment observations. Specifically, recent works on data augmentation [35, 33] both show improvements in sample efficiency from simple cropping and translation augmentations, but the studies also conclude that additional data augmentation in fact decrease sample efficiency and even cause divergence. While these augmentations have the potential to improve generalization, the increasingly varied data makes the optimization more challenging and risks instability. Unlike supervised learning, balancing the trade-off between stability and generalization in RL requires substantial trial and error.
14
+
15
+ In this paper, we illuminate causes of instability when applying data augmentation to common off-policy RL algorithms [43, 38, 15, 18]. Based on our findings, we provide an intuitive method for stabilizing this class of algorithms under use of strong data augmentation. Specifically, we find two main causes of instability in previous work’s application of data augmentation: (i) indiscriminate application of data augmentation resulting in high-variance $Q$ -targets; and (ii) that $Q$ -value estimation strictly from augmented data results in over-regularization.
16
+
17
+ To address these problems, we propose SVEA: Stabilized $Q$ -Value Estimation under Augmentation, a simple yet effective framework for data augmentation in off-policy RL that greatly improves stability of $Q$ -value estimation. Our method consists of the following three components: Firstly, by only applying augmentation in $Q$ -value estimation of the current state, without augmenting $Q$ -targets used for bootstrapping, SVEA circumvents erroneous bootstrapping caused by data augmentation; Secondly, we formulate a modified $Q$ -objective that optimizes $Q$ -value estimation jointly over both augmented and unaugmented copies of the observations; Lastly, for SVEA implemented with an actorcritic algorithm, we optimize the actor strictly on unaugmented data, and instead learn a generalizable policy indirectly through parameter-sharing. Our framework can be implemented efficiently without additional forward passes nor introducing additional learnable parameters.
18
+
19
+ We perform extensive empirical evaluation on the DeepMind Control Suite [64] and extensions of it, including the DMControl Generalization Benchmark [21] and the Distracting Control Suite [60], as well as a set of robotic manipulation tasks. Our method greatly improve $Q$ -value estimation with ConvNets under a set of strong data augmentations, and achieves sample efficiency, asymptotic performance, and generalization that is competitive or better than previous state-of-the-art methods in all tasks considered, at a lower computational cost. Finally, we show that our method scales to RL with Vision Transformers (ViT) [10]. We find that ViT-based architectures are especially prone to overfitting, and data augmentation may therefore be a key component for large-scale RL.
20
+
21
+ # 2 Related Work
22
+
23
+ Representation Learning. Learning visual invariances using data augmentation and self-supervised objectives has proven highly successful in computer vision [46, 45, 82, 74, 68, 65, 75, 27, 7]. For example, Chen et al. [7] perform an extensive study on data augmentation (e.g. random cropping and image distortions) for contrastive learning, and show that representations pre-trained with such transformations transfer effectively to downstream tasks. While our work also uses data augmentation for learning visual invariances, we leverage the $Q$ -objective of deep $Q$ -learning algorithms instead of auxiliary representation learning tasks.
24
+
25
+ Visual Learning for RL. Numerous methods have been proposed with the goal of improving sample efficiency [29, 56, 68, 76, 40, 59, 61, 54, 77] of image-based RL. Recently, using self-supervision to improve generalization in RL has also gained interest [80, 47, 55, 1, 22, 21, 72]. Notably, Zhang et al. [80] and Agarwal et al. [1] propose to learn behavioral similarity embeddings via auxiliary tasks (bisimulation metrics and contrastive learning, respectively), and Hansen et al. [21] learn visual invariances through an auxiliary prediction task. While these results are encouraging, it has also been shown in [29, 40, 22, 79, 41] that the best choice of auxiliary tasks depends on the particular RL task, and that joint optimization with sub-optimally chosen tasks can lead to gradient interference. We achieve competitive sample-efficiency and generalization results without the need for carefully chosen auxiliary tasks, and our method is therefore applicable to a larger variety of RL tasks.
26
+
27
+ Data Augmentation and Randomization for RL. Our work is directly inspired by previous work on generalization in RL by domain randomization [66, 50, 48, 52, 6] and data augmentation [36, 9, 71, 35, 33, 51, 61, 21]. For example, Tobin et al. [66] show that a neural network trained for object localization in a simulation with randomized visual augmentations improves real world generalization. Similarly, Lee et al.[36] show that application of a random convolutional layer to observations during training improve generalization in 3D navigation tasks. More recently, extensive studies on data augmentation [35, 33] have been conducted with RL, and conclude that, while small random crops and translations can improve sample efficiency, most data augmentations decrease sample efficiency and cause divergence. We illuminate main causes of instability, and propose a framework for data augmentation in deep $Q$ -learning algorithms that drastically improves stability and generalization.
28
+
29
+ Improving Deep $Q$ -Learning. While deep $Q$ -learning algorithms such as Deep $Q$ -Networks (DQN) [43] have achieved impressive results in image-based RL, the temporal difference objective is known to have inherent instabilities when used in conjunction with function approximation and off-policy data [63]. Therefore, a variety of algorithmic improvements have been proposed to improve convergence [24, 73, 25, 23, 53, 38, 15, 14, 28]. For example, Hasselt et al. [24] reduce overestimation of $Q$ -values by decomposing the target $Q$ -value estimation into action selection and action evaluation using separate networks. Lillicrap et al. [38] reduce target variance by defining the target $Q$ -network as a slow-moving average of the online $Q$ -network. Our method also improves $Q$ -value estimation, but we specifically address the instability of deep $Q$ -learning algorithms on augmented data.
30
+
31
+ # 3 Preliminaries
32
+
33
+ Problem formulation. We formulate the interaction between environment and policy as a Markov Decision Process (MDP) [2] $\mathcal { M } = \langle \boldsymbol { S } , \mathcal { A } , \mathcal { P } , \boldsymbol { r } , \boldsymbol { \gamma } \rangle$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $\mathcal { P } \colon \mathcal { S } \times \mathcal { A } \mapsto \mathcal { S }$ is the state transition function that defines a conditional probability distribution $\mathcal { P } \left( \cdot | \mathbf { s } _ { t } , \mathbf { a } _ { t } \right)$ over all possible next states given a state $\mathbf { s } _ { t } \in \cal { S }$ and action ${ \mathbf a } _ { t } \in \mathcal A$ taken at time $t$ , $r \colon S \times \mathcal { A } \mapsto \mathbb { R }$ is a reward function, and $\gamma \in [ 0 , 1 )$ is the discount factor. Because image observations only offer partial state observability [30], we define a state $\mathbf { s } _ { t }$ as a sequence of $k + 1$ consecutive frames $\left( \mathbf { o } _ { t } , \mathbf { o } _ { t - 1 } , \ldots , \mathbf { o } _ { t - k } \right)$ , $\mathbf { o } \in { \mathcal { O } }$ , where $\mathcal { O }$ is the high-dimensional image space, as proposed in Mnih et al. [43]. The goal is then to learn a policy $\pi \colon S \mapsto A$ that maximizes discounted return policy $\begin{array} { r } { R _ { t } = \mathbb { E } _ { \Gamma \sim \pi } [ \sum _ { t = 1 } ^ { T } \gamma ^ { t } r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) ] } \end{array}$ along a trto a state ctory with $\Gamma = ( \mathbf { s } _ { 0 } , \mathbf { s } _ { 1 } , \ldots , \mathbf { s } _ { T } )$ obtained bpled from follo, and ngis $\pi$ $\mathbf { s } _ { 0 } \in \mathcal { S }$ ${ \bf s } _ { T }$ $\mathcal { P }$ $\pi$ parameterized by a collection of learnable parameters $\theta$ . For clarity, we hereon generically denote parameterization with subscript, e.g. $\pi _ { \theta }$ . We further aim to learn parameters $\theta$ s.t. $\pi _ { \theta }$ generalizes well (i.e., obtains high discounted return) to unseen MDPs, which is generally unfeasible without further assumptions about the structure of the space of MDPs. In this work, we focus on generalization to MDPs $\overline { { \mathcal { M } } } = \langle \overline { { S } } , \mathcal { A } , \mathcal { P } , r , \gamma \rangle$ , where states $\overline { { \mathbf { S } } } _ { t } \in \overline { { S } }$ are constructed from observations $\mathbf { \bar { o } } _ { t } \in \overline { { \mathcal { O } } } , \mathcal { O } \subseteq \overline { { \mathcal { O } } }$ of a perturbed observation space $\overline { { \mathcal { O } } }$ (e.g. unseen visuals), and $\overline { { \mathcal { M } } } \sim \mathbb { M }$ for a space of MDPs M.
34
+
35
+ Deep $Q$ -Learning. Common model-free off-policy RL algorithms aim to estimate an optimal stateaction value function $Q ^ { * } \colon S \times A \mapsto \mathbb { R }$ as Q✓( $\begin{array} { r } { \tilde { \mathbf { s } } , \mathbf { a } ) \approx \bar { Q } ^ { * } ( \mathbf { s } , \mathbf { a } ) = \operatorname* { m a x } _ { \pi _ { \theta } } \mathbb { E } \left[ R _ { t } | \mathbf { s } _ { t } = \mathbf { s } , \mathbf { a } _ { t } = \mathbf { a } \right] } \end{array}$ using function approximation. In practice, this is achieved by means of the single-step Bellman residual $\begin{array} { r } { \Big ( r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) + \gamma \operatorname* { m a x } _ { \mathbf { a } _ { t } ^ { \prime } } Q _ { \psi } ^ { \mathrm { t g t } } ( \mathbf { s } _ { t + 1 } , \mathbf { a } _ { t } ^ { \prime } ) \Big ) - Q _ { \theta } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) } \end{array}$ [62], where $\psi$ parameterizes a target state-action value function $Q ^ { \mathrm { t g t } }$ . We can choose to minimize this residual (also known as the temporal difference error) directly wrt $\theta$ using a mean squared error loss, which gives us the objective
36
+
37
+ $$
38
+ \mathcal { L } _ { Q } ( \theta , \psi ) = \mathbb { E } _ { { \mathbf { s } } _ { t } , { \mathbf { a } } _ { t } , { \mathbf { s } } _ { t + 1 } \sim \mathcal { B } } \left[ \frac { 1 } { 2 } \left[ \left( r ( { \mathbf { s } } _ { t } , { \mathbf { a } } _ { t } ) + \gamma \operatorname* { m a x } _ { { \mathbf { a } } _ { t } ^ { \prime } } Q _ { \psi } ^ { \mathrm { g t } } ( { \mathbf { s } } _ { t + 1 } , { \mathbf { a } } _ { t } ^ { \prime } ) \right) - Q _ { \theta } ( { \mathbf { s } } _ { t } , { \mathbf { a } } _ { t } ) \right] ^ { 2 } \right] ,
39
+ $$
40
+
41
+ where $\boldsymbol { B }$ is a replay buffer with transitions collected by a behavioral policy [39]. From here, we can derive a greedy policy directly by selecting actions $\mathbf { a } _ { t } = \arg \operatorname* { m a x } _ { \mathbf { a } _ { t } } Q _ { \theta } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ . While $Q ^ { \mathrm { t g t } } = Q$ and periodically setting ${ \psi } \longleftarrow \theta$ exactly recovers the objective of DQN [43], several improvements have been proposed to improve stability of Eq. 1, such as Double Q-learning [24], Dueling $Q$ -networks [73], updating target parameters using a slow-moving average of the online $Q$ -network [38]:
42
+
43
+ $$
44
+ \psi _ { n + 1 } \longleftarrow ( 1 - \zeta ) \psi _ { n } + \zeta \theta _ { n }
45
+ $$
46
+
47
+ for an iteration step $n$ and a momentum coefficient $\zeta \in ( 0 , 1 ]$ , and others [25, 23, 53, 14, 28]. As computing $\mathrm { m a x } _ { { \bf a } _ { t } ^ { \prime } } Q _ { \psi } ^ { \mathrm { t g t } } ( { \bf s } _ { t + 1 } , { \bf a } _ { t } ^ { \prime } )$ in Eq. 1 is intractable for large and continuous action spaces, a number of prominent actor-critic algorithms that additionally learn a policy $\begin{array} { r } { \pi _ { \boldsymbol { \theta } } ( \mathbf { s } _ { t } ) \approx \arg \operatorname* { m a x } _ { \mathbf { a } _ { t } } Q _ { \boldsymbol { \theta } } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) } \end{array}$ have therefore been proposed [38, 15, 18].
48
+
49
+ Soft Actor-Critic (SAC) [18] is an off-policy actor-critic algorithm that learns a state-action value function $Q _ { \theta }$ and a stochastic policy $\pi _ { \theta }$ (and optionally a temperature parameter), where $Q _ { \theta }$ is optimized using a variant of the objective in Eq. 1 and $\pi _ { \theta }$ is optimized using a $\gamma$ -discounted maximum-entropy objective [84]. To improve stability, SAC is also commonly implemented using Double Q-learning and the slow-moving target parameters from Eq. 2. We will in the remainder of this work describe our method in the context of a generic off-policy RL algorithm that learns a parameterized state-action value function $Q _ { \theta }$ , while we in our experiments discussed in Section 6 evaluate of our method using SAC as base algorithm.
50
+
51
+ # 4 Pitfalls of Data Augmentation in Deep $Q$ -Learning
52
+
53
+ In this section, we aim to illuminate the main causes of instability from naïve application of data augmentation in $Q$ -value estimation. Our goal is to learn a $Q$ -function $Q _ { \theta }$ for an MDP $\mathcal { M }$ that generalizes to novel MDPs $\overline { { \mathcal { M } } } \sim \mathbb { M }$ with unseen visuals, and we leverage data augmentation as an optimality-invariant state transformation $\tau$ to induce a bisimulation relation [34, 17] between a state s and its transformed (augmented) counterpart $\mathbf { s } ^ { \mathrm { a u g } } = \tau ( \mathbf { s } , \nu )$ with parameters $\nu \sim \mathcal { V }$ .
54
+
55
+ Definition 1 (Optimality-Invariant State Transformation [33]). Given an MDP $\mathcal { M }$ , a state transformation $\tau \colon S \times \mathcal { V } \mapsto S$ is an optimality-invariant state transformation if $Q ( \mathbf { s } , \mathbf { a } ) = Q ( \tau ( \mathbf { s } , \nu ) , \mathbf { a } ) \ \forall \mathbf { s } \in$ $s$ ${ \sf S } , { \bf a } \in \mathcal { A } , \nu \in \mathcal { V }$ , where $\nu \in \mathcal V$ parameterizes the transformation $\tau$ .
56
+
57
+ Following our definitions of ${ \mathcal { M } } , { \overline { { { \mathcal { M } } } } }$ from Section 3, we can further extend the concept of optimalityinvariant transformations to MDPs, noting that a change of state space (e.g. perturbed visuals) itself can be described as a transformation $\overline { { \tau } } : \mathcal { S } \times \overline { { \mathcal { V } } } \mapsto \overline { { \mathcal { S } } }$ with unknown parameters $\overline { { \nu } } \in \overline { { \mathcal { V } } }$ . If we choose the set of parameters $\nu$ of a state transformation $\tau$ to be sufficiently large such that it intersects with $\overline { { \nu } }$ with high probability, we can therefore expect to improve generalization to state and observation spaces not seen during training. However, while naïve application of data augmentation as in previous work [35, 33, 61, 54] may potentially improve generalization, it can be harmful to $Q$ -value estimation. We hypothesize that this is primarily because it dramatically increases the size of the observed state space, and consequently also increases variance Var $[ Q ( \tau ( \mathbf { s } , \nu ) ) ] \geq \operatorname { V a r } \left[ Q ( \mathbf { s } ) \right]$ , $\nu \sim \mathcal { V }$ when $\nu$ is large. Concretely, we identify the following two issues:
58
+
59
+ Pitfall 1: Non-deterministic $Q$ -target. For deep $Q$ -learning algorithms, previous work [35, 33, 61, 54] applies augmentation to both state $\mathbf { s } _ { t } ^ { \mathrm { a u g } } \triangleq \tau ( \mathbf { s } _ { t } , \nu )$ and successor state $\mathbf { s } _ { t + 1 } ^ { \mathrm { a u g } } \triangleq \tau ( \mathbf { s } _ { t + 1 } , \nu ^ { \prime } )$ where $\nu , \nu ^ { \prime } \sim \mathcal { V }$ . Compared with DQN [43] that uses a deterministic (more precisely, periodically updated) $Q$ -target, this practice introduces a non-deterministic $Q$ -target $\begin{array} { r } { r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) + \gamma \operatorname* { m a x } _ { \mathbf { a } _ { t } ^ { \prime } } Q _ { \psi } ^ { \mathrm { t g t } } ( \mathbf { s } _ { t + 1 } ^ { \mathrm { a u g } } , \mathbf { a } _ { t } ^ { \prime } ) } \end{array}$ depending on the augmentation parameters . As observed in the original DQN paper, high-variance target values are detrimental to $Q$ -learning algorithms, and may cause divergence due to the “deadly triad” of function approximation, bootstrapping, and off-policy learning [63]. This motivates the work to introduce a slowly changing target network, and several other works have refined the $Q$ -target update rule [38, 15] to further reduce volatility. However, because data augmentation is inherently non-deterministic, it can greatly increase variance in $Q$ -target estimation and exacerbates the issue of volatility, as shown in Figure 1 (top). This is particularly troubling in actor-critic algorithms such as DDPG [38] and SAC [18], where the $Q$ -target is estimated from $( \mathbf { s } _ { t + 1 } , \mathbf { a } ^ { \prime } )$ , $\mathbf { a } ^ { \prime } \sim \bar { \pi } ( \cdot | \mathbf { s } _ { t + 1 } )$ , which introduces an additional source of error from $\pi$ that is non-negligible especially when $\mathbf { s } _ { t + 1 }$ is augmented.
60
+
61
+ Pitfall 2: Over-regularization. Data augmentation was originally introduced in the supervised learning regime as a regularizer to prevent overfitting of high-capacity models. However, for RL, even learning a policy in the training environment is hard. While data augmentation may improve generalization, it greatly increases the difficulty of policy learning, i.e., optimizing $\theta$ for $Q _ { \theta }$ and potentially a behavior network $\pi _ { \theta }$ . Particularly, when the temporal difference loss from Eq. 1 cannot be well minimized, the large amount of augmented states dominate the gradient, which significantly impacts $Q$ -value estimation of both augmented and unaugmented states. We refer to this issue as over-regularization by data augmentation. Figure 1 (bottom) shows the mean difference in $Q$ -predictions made with augmented vs. unaugmented data in fully converged DrQ [33] agents trained with shift augmentation. Augmentations such as affine-jitter, random convolution, and random overlay incur large differences in estimated $Q$ -values. While such difference can be reduced by regularizing the optimization with each individual augmentation, we emphasize that even the minimal shift augmentation used throughout training incurs non-zero difference. Since $\psi$ is commonly chosen to be a
62
+
63
+ ![](images/b40175f62be62da1ac5d48bbf80a7106a416e17fb2cb32bf957475fcb1f1e96d.jpg)
64
+ Figure 1. (Top) Mean $Q$ -target variance of DrQ [33] and SVEA (ours), both trained with conv augmentation [36]. (Bottom) Mean difference in $Q$ -value estimation on augmented vs. non-augmented data. We measure mean absolute error in $Q$ -value estimation from converged $_ \mathrm { D r Q }$ agents (trained with shift augmentation) on the same observations before and after augmentation. Both figures are averages across 5 seeds for each of the 5 tasks from DMControl-GB.
65
+
66
+ moving average of $\theta$ as in Eq. 2, such differences caused by over-regularization affect $Q _ { \theta }$ and $\boldsymbol { Q } _ { \psi } ^ { \mathrm { t g t } }$ equally, and optimization may therefore still diverge depending on the choice of data augmentation. As such, there is an inherent trade-off between accurate $Q$ -value estimation and generalization when using data augmentation. In the following section, we address these pitfalls.
67
+
68
+ ![](images/955e30f5fa34a2342cf672bd9d33410ddaef8680b742838ac5cb49140611d374.jpg)
69
+ Figure 2. Overview. An observation $\mathbf { s } _ { t }$ is transformed by data augmentation $\tau ( \cdot , \nu )$ , $\nu \sim \nu$ to produce a view ${ \bf s } _ { t } ^ { \mathrm { a u g } }$ . The $Q$ -function $Q _ { \theta }$ · ⇠ Vis then jointly optimized on both augmented and unaugmented data wrt the objective in Eq. 7, with the $Q$ -target of the Bellman equation computed from an unaugmented observation $\mathbf { s } _ { t + 1 }$ . We illustrate our data-mixing strategy by the $\otimes$ operator.
70
+
71
+ # 5 Method
72
+
73
+ We propose SVEA: Stabilized $Q$ -Value Estimation under Augmentation, a general framework for visual generalization in RL by use of data augmentation. SVEA applies data augmentation in a novel learning framework leveraging two data streams – with and without augmented data, respectively. Our method is compatible with any standard off-policy RL algorithm without changes to the underlying neural network that parameterizes the policy, and it requires no additional forward passes, auxiliary tasks, nor learnable parameters. While SVEA in principle does not make any assumptions about the structure of states $\mathbf { s } _ { t } \in \cal { S }$ , we here describe our method in the context of image-based RL.
74
+
75
+ # 5.1 Architectural Overview
76
+
77
+ An overview of the SVEA architecture is provided in Figure 2. Our method leverages properties of common neural network architectures used in off-policy RL without introducing additional learnable parameters. We subdivide the neural network layers and corresponding learnable parameters of a state-action value function into sub-networks $f _ { \theta }$ (denoted the state encoder) and $Q _ { \theta }$ (denoted the $Q$ -function) s.t $q _ { t } \triangleq Q _ { \theta } ( f _ { \theta } ( \mathbf { s } _ { t } ) , \mathbf { a } _ { t } )$ is the predicted $Q$ -value corresponding to a given stateaction pair $\left( \mathbf { s } _ { t } , \mathbf { a } _ { t } \right)$ . We similarly define the target state-action value function s.t. $q _ { t } ^ { \mathrm { t g t } } \triangleq r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) +$ $\gamma \operatorname* { m a x } _ { \mathbf { a } _ { t } ^ { \prime } } Q _ { \psi } ^ { \mathrm { t g t } } ( f _ { \psi } ^ { \mathrm { t g t } } ( \mathbf { s } _ { t + 1 } ) , \mathbf { a } ^ { \prime } )$ is the target $Q$ -value for $\left( \mathbf { s } _ { t } , \mathbf { a } _ { t } \right)$ , and we define parameters $\psi$ as an exponential moving average of $\theta$ as in Eq. 2. Depending on the choice of underlying algorithm, we may choose to additionally learn a parameterized policy $\pi _ { \theta }$ that shares encoder parameters with $Q _ { \theta }$ and selects actions $\mathbf { a } _ { t } \sim \dot { \pi } _ { \theta } \big ( \cdot | f _ { \theta } ( \mathbf { s } _ { t } ) \big )$ .
78
+
79
+ To circumvent erroneous bootstrapping from augmented data (as discussed in Section 4), we strictly apply data augmentation in $Q$ -value estimation of the current state $\mathbf { s } _ { t }$ , without applying data augmentation to the successor state $\mathbf { s } _ { t + 1 }$ used in Eq. 1 for bootstrapping with $\boldsymbol { Q } _ { \psi } ^ { \mathrm { t g t } }$ (and $\pi _ { \theta }$ if applicable), which addresses Pitfall 1. If $\pi _ { \theta }$ is learned (i.e., SVEA is implemented with an actor-critic algorithm), we also optimize it strictly from unaugmented data. To mitigate over-regularization in optimization of $f _ { \theta }$ and $Q _ { \theta }$ (Pitfall 2), we further employ a modified $Q$ -objective that leverages both augmented and unaugmented data, which we introduce in the following section.
80
+
81
+ # 5.2 Learning Objective
82
+
83
+ Our method redefines the temporal difference objective from Eq. 1 to better leverage data augmentation. First, recall that $\begin{array} { r } { q _ { t } ^ { \mathrm { t g t } } = r ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) + \gamma \operatorname* { m a x } _ { \mathbf { a } _ { t } ^ { \prime } } Q _ { \psi } ^ { \mathrm { t g t } } ( f _ { \psi } ^ { \mathrm { t g t } } ( \mathbf { s } _ { t + 1 } ) , \mathbf { a } ^ { \prime } ) } \end{array}$ . Instead of learning to predict $q _ { t } ^ { \mathrm { t g t } }$ only from state $\mathbf { s } _ { t }$ , we propose to minimize a nonnegative linear combination of $\mathcal { L } _ { Q }$ over two individual data streams, $\mathsf { s } _ { t }$ and $\mathbf { s } _ { t } ^ { \mathrm { a u g } } = \tau ( \mathbf { s } _ { t } , \boldsymbol \nu ) , \boldsymbol \nu \sim \mathcal { V }$ , which we define as the objective
84
+
85
+ $$
86
+ \begin{array} { r l } & { \mathcal { L } _ { Q } ^ { \mathrm { S V E A } } ( \theta , \psi ) \triangleq \alpha \mathcal { L } _ { Q } \left( \mathrm { s } _ { t } , q _ { t } ^ { \mathrm { g r } } ; \theta , \psi \right) + \beta \mathcal { L } _ { Q } \left( \mathrm { s } _ { t } ^ { \mathrm { a u g } } , q _ { t } ^ { \mathrm { g r } } ; \theta , \psi \right) } \\ & { \qquad = \mathbb { E } _ { \mathrm { s } _ { t } , \mathrm { a } _ { t } , \mathrm { s } _ { t + 1 } \sim \mathcal { B } } \left[ \alpha \left. Q _ { \theta } ( f _ { \theta } ( \mathrm { s } _ { t } ) , \mathrm { a } _ { t } ) - q _ { t } ^ { \mathrm { i g t } } \right. _ { 2 } ^ { 2 } + \beta \left. Q _ { \theta } ( f _ { \theta } ( \mathrm { s } _ { t } ^ { \mathrm { a u g } } ) , \mathrm { a } _ { t } ) - q _ { t } ^ { \mathrm { i g t } } \right. _ { 2 } ^ { 2 } \right] , } \end{array}
87
+ $$
88
+
89
+ where $\alpha , \beta$ are constant coefficients that balance the ratio of the unaugmented and augmented data streams, respectively, and $q _ { t } ^ { \mathrm { g } \mathrm { t } }$ is computed strictly from unaugmented data. $\mathcal { L } _ { Q } ^ { \bf S V E A } ( \theta , \psi )$ serves as a data-mixing strategy that oversamples unaugmented data as an implicit variance reduction technique.
90
+
91
+ As we will verify empirically in Section 6, data-mixing is a simple and effective technique for variance reduction that works well in tandem with our proposed modifications to bootstrapping. For $\alpha = \beta$ , the objective in Eq. 4 can be evaluated in a single, batched forward-pass by rewriting it as:
92
+
93
+ $$
94
+ \begin{array} { r l } & { \mathbf { g } _ { t } = \left[ \mathbf { s } _ { t } , \tau ( \mathbf { s } _ { t } , \nu ) \right] _ { \mathrm { N } } } \\ & { h _ { t } = \left[ q _ { t } ^ { \mathrm { t g t } } , q _ { t } ^ { \mathrm { t g t } } \right] _ { \mathrm { N } } } \\ & { \mathcal { L } _ { Q } ^ { \mathrm { S V E A } } ( \theta , \psi ) = \mathbb { E } _ { \mathbf { s } _ { t } , \mathbf { a } _ { t } , \mathbf { s } _ { t + 1 } \sim \mathcal { B } , \nu \sim \mathcal { V } } \left[ \left( \alpha + \beta \right) \Vert Q _ { \theta } ( f _ { \theta } ( \mathbf { g } _ { t } ) , \mathbf { a } _ { t } ) - h _ { t } \Vert _ { 2 } ^ { 2 } \right] , } \end{array}
95
+ $$
96
+
97
+ where $[ \cdot ] _ { \mathrm { N } }$ is a concatenation operator along the batch dimension $N$ for $\mathbf { s } _ { t } , \mathbf { s } _ { t } ^ { \mathrm { a u g } } \in \mathbb { R } ^ { N \times C \times H \times W }$ and $q _ { t } ^ { \mathrm { t g t } } \in \mathbb { R } ^ { N \times 1 }$ , which is illustrated as $\otimes$ in Figure 2. Empirically, we find $\alpha = 0 . 5 , \beta = 0 . 5$ to be both effective and practical to implement, which we adopt in the majority of our experiments. However, more sophisticated schemes for selecting $\alpha , \beta$ and/or varying them as training progresses could be interesting directions for future research. If the base algorithm of choice learns a policy $\pi _ { \theta }$ , its objective ${ \mathcal { L } } _ { \pi } ( \theta )$ is optimized solely on unaugmented states $\mathbf { s } _ { t }$ without changes to the objective, and a stop-grad operation is applied after $f _ { \theta }$ to prevent non-stationary gradients of ${ \mathcal { L } } _ { \pi } ( \theta )$ from interfering with $Q$ -value estimation, i.e., only the objective from Eq. 4 or optionally Eq. 7 updates $f _ { \theta }$ using stochastic gradient descexponential moving average of We summarize our method for described in Section 5.1, parametersa stop-grad operation is therefore simapplied to a generic off-policy algorit $\psi$ are updated usinarly applied after in Algorithm 1. $\theta$ $\bar { Q } _ { \psi } ^ { \mathrm { t g t } }$ $\alpha = \beta$
98
+
99
+ <table><tr><td>ugoritmn1GenericSvEAoll-polcyaigornn( naiveaugnientation, 0,0π,: randomly initialized network parameters,γ ← θ Initialize γ to be equal to θ n, S: learning rate and momentum coefficient</td></tr><tr><td>α, β: loss coefficients,default: (α = O.5,β = 0.5) 1: for timestep t = 1...T do</td></tr><tr><td>act:</td></tr><tr><td>2: at ~ Tθ (-Ife(st)) Sample action from policy 3: St~P(|st,at) &gt; Sample transition from environment</td></tr><tr><td>4: B ← BU(st,at,r(St,at),st) Add transition to replay buffer</td></tr><tr><td>update:</td></tr><tr><td>5: {Si,ai,r(si,ai),s&#x27;|i= 1...N} ~ B Sample batch of transitions 6:</td></tr><tr><td>Si=T(si,vi),S&#x27;= T(si,vi), vi,v ~V :Naive application of data augmentation</td></tr><tr><td>7: for transition i= 1..N do</td></tr><tr><td>8: 0π←0π-nVθπLπ (si;0π) (if applicable) √ Optimize πθ with SGD tgt</td></tr><tr><td>9: = r(si,ai)+γmaxaQ(f(s),ai) Compute Q-target qi aug</td></tr><tr><td>10: = T(si,Vi), Vi ~ V ● Apply stochastic data augmentation tgt</td></tr><tr><td>gi = [Si, Sg] [at,] 11: JN,h = Pack data streams N</td></tr><tr><td>12: (gi,hi;0,φ) Optimize fe and Qe with SGD</td></tr><tr><td>13: ←(1-5)φ+50 Update using EMA of θ</td></tr></table>
100
+
101
+ # 6 Experiments
102
+
103
+ We evaluate both sample efficiency, asymptotic performance, and generalization of our method and a set of strong baselines using both ConvNets and Vision Transformers (ViT) [10] in tasks from DeepMind Control Suite (DMControl) [64] as well as a set of robotic manipulation tasks. DMControl offers challenging and diverse continuous control tasks and is widely used as a benchmark for image-based
104
+
105
+ ![](images/6035530af162e3507028ffb18ef467537b0e7a32d799ae197812d5d50918047e.jpg)
106
+ Figure 3. Experimental setup. Agents are trained in a fixed environment and are expected to generalize to novel environments with e.g. random colors, backgrounds, and camera poses.
107
+
108
+ RL [19, 20, 76, 59, 35, 33]. To evaluate generalization of our method and baselines, we test methods under challenging distribution shifts (as illustrated in Figure 3) from the DMControl Generalization Benchmark (DMControl-GB) [21], the Distracting Control Suite (DistractingCS) [60], as well as distribution shifts unique to the robotic manipulation environment. Code is available at https://github.com/nicklashansen/dmcontrol-generalization-benchmark.
109
+
110
+ ![](images/ae147f596fd9a2e401e99807060cd85c7f23dd12b02be8cc4b36b50a914e9a93.jpg)
111
+ Figure 4. Data augmentations. Training performance of SVEA (top) and DrQ (bottom) under 6 common data augmentations. Mean of 5 seeds. Red line at 800 return is for visual guidance only. We omit visualization of std. deviations for clarity, but provide per-augmentation comparisons to DrQ (including std. deviations) across all tasks in Appendix B, and test performances in Appendix C.
112
+
113
+ ![](images/60cdd88e47c03d3588303badf1e67150a0ec90897c4e98072fb7bced890f841e.jpg)
114
+ Figure 5. Training and test performance. We compare SVEA to DrQ with and without random convolution augmentation, as well as a set of ablations. Data-mixing only indiscriminately applies our data-mixing strategy to all data streams, and $( \alpha = 0 , \beta = 1$ ) only augments $Q$ -predictions but without data-mixing. We find both components to contribute to SVEA’s success. Top: episode return on the training environment during training. Bottom: generalization measured by episode return on the color_hard benchmark of DMControl-GB. Mean of 5 seeds, shaded area is $\pm 1$ std. deviation.
115
+
116
+ Setup. We implement our method and baselines using SAC [18] as base algorithm, and we apply random shift augmentation to all methods by default. This makes our base algorithm equivalent to DrQ [33] when $_ { \mathrm { K = 1 , M = 1 } }$ ; we refer to the base algorithm as unaugmented and consider stability under additional data augmentation. We use the same network architecture and hyperparameters for all methods (whenever applicable), and adopt the setup from Hansen and Wang [21]. Observations are stacks of 3 RGB frames of size $8 4 \times 8 4 \times 3$ (and $9 6 \times 9 6 \times 3$ in ViT experiments). In the DMControlGB and DistractingCS benchmarks, all methods are trained for $5 0 0 \mathrm { k }$ frames and evaluated on all 5 tasks from DMControl-GB used in prior work, and we adopt the same experimental setup for robotic manipulation. See Appendix H for hyperparameters and further details on our experimental setup.
117
+
118
+ Baselines and data augmentations. We benchmark our method against the following strong baselines: (1) CURL [59], a contrastive learning method for RL; (2) RAD that applies a random crop; (3) $\mathbf { D r Q }$ that applies a random shift; (4) PAD [22] that adapts to test environments using self-supervision; (5) SODA [21] that applies data augmentation in auxiliary learning; as well as a number of ablations. We compare to the $_ { \mathrm { K = 1 , M = 1 } }$ setting of $_ \mathrm { D r Q }$ by default, but also provide comparison to varying $K , M$ . We experiment with a diverse set of data augmentations proposed in previous work on RL and computer vision, namely random shift [33], random convolution (denoted conv) [36], random overlay [21], random cutout [9], Gaussian blur, random affine-jitter, and random rotation [35, 16]. We provide samples for all data augmentations in Appendix C and test environments in Appendix E.
119
+
120
+ Table 1. Comparison to state-of-the-art. Test performance (episode return) of methods trained in a single, fixed environment and evaluated on (i) randomized colors, and (ii) natural video backgrounds from DMControl-GB. Results for CURL, RAD, PAD, and SODA are obtained from [21] and we report mean and std. deviation over 5 seeds. DrQ corresponds to our SAC base algorithm using random shift augmentation. SVEA matches or outperforms prior methods in all tasks considered.
121
+
122
+ <table><tr><td>DMControl-GB (random colors)</td><td>CURL</td><td>RAD</td><td>DrQ</td><td>PAD</td><td>SODA (conv)</td><td>SODA (overlay)</td><td>SVEA (conv)</td><td>SVEA (overlay)</td></tr><tr><td>walker,</td><td>445</td><td>400</td><td>520</td><td>468</td><td>697</td><td>692</td><td>760</td><td>749</td></tr><tr><td>walk</td><td>±99</td><td>±61</td><td>±91</td><td>±47</td><td>±66</td><td>±68</td><td>±145</td><td>±61</td></tr><tr><td>walker, stand</td><td>662 ±54</td><td>644 ±88</td><td>770 ±71</td><td>797 ±46</td><td>930 ±12</td><td>893 ±12</td><td>942 ±26</td><td>933 ±24</td></tr><tr><td>cartpole,</td><td>454</td><td>590</td><td>586</td><td>630</td><td>831</td><td>805</td><td>837</td><td>832</td></tr><tr><td>swingup ball_in_cup,</td><td>±110</td><td>±53</td><td>±52</td><td>±63</td><td>±21</td><td>±28</td><td>±23</td><td>±23</td></tr><tr><td>catch</td><td>231 ±92</td><td>541 ±29</td><td>365 ±210</td><td>563 ±50</td><td>892 ±37</td><td>949 ±19</td><td>961 ±7</td><td>959 ±5</td></tr><tr><td>finger,</td><td>691</td><td>667</td><td>776</td><td>803</td><td>901</td><td>793</td><td>977</td><td>972</td></tr><tr><td>spin</td><td>±12</td><td>±154</td><td>±134</td><td>±72</td><td>±51</td><td>±128</td><td>±5</td><td>±6</td></tr><tr><td>DMControl-GB</td><td>CURL</td><td>RAD</td><td>DrQ</td><td>PAD</td><td>SODA</td><td>SODA</td><td>SVEA</td><td>SVEA</td></tr><tr><td>(natural videos)</td><td></td><td></td><td></td><td></td><td>(conv)</td><td>(overlay)</td><td>(conv)</td><td>(overlay)</td></tr><tr><td>walker, walk</td><td>556</td><td>606</td><td>682</td><td>717</td><td>635</td><td>768</td><td>612</td><td>819</td></tr><tr><td>walker,</td><td>±133</td><td>±63</td><td>±89</td><td>±79</td><td>±48</td><td>±38</td><td>±144</td><td>±71</td></tr><tr><td>stand</td><td>852</td><td>745</td><td>873</td><td>935</td><td>903</td><td>955</td><td>795</td><td>961</td></tr><tr><td></td><td>±75</td><td>±146</td><td>±83</td><td>±20</td><td>±56</td><td>±13</td><td>±70</td><td>±8</td></tr><tr><td>cartpole,</td><td>404</td><td>373</td><td>485</td><td>521</td><td>474</td><td>758</td><td>606</td><td>782</td></tr><tr><td>swingup</td><td>±67</td><td>±72</td><td>±105</td><td>±76</td><td>±143</td><td>±62</td><td>±85</td><td>±27</td></tr><tr><td>ball_in_cup,</td><td>316</td><td></td><td>318</td><td>436</td><td></td><td></td><td></td><td></td></tr><tr><td>catch</td><td></td><td>481</td><td></td><td></td><td>539</td><td>875</td><td>659</td><td>871</td></tr><tr><td></td><td>±119</td><td>±26</td><td>±157</td><td>±55</td><td>±111</td><td>±56</td><td>±110</td><td>±106</td></tr><tr><td>finger,</td><td>502</td><td>400</td><td>533</td><td>691</td><td>363</td><td>695</td><td>764</td><td>808</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>spin</td><td>±19</td><td>±64</td><td>±119</td><td>±80</td><td>±185</td><td>±97</td><td>±86</td><td>±33</td></tr></table>
123
+
124
+ ![](images/ccaf208fa696a80df615be7f0b56c65de666be79650249c55231b1eb02a84a50.jpg)
125
+ Figure 6. (Left) Comparison with additional DrQ baselines. We compare SVEA implemented with DrQ $\scriptstyle [ K = 1 , \mathbf { M } = 1 ]$ as base algorithm to $_ \mathrm { D r Q }$ with varying values of its $K , M$ hyperparameters. All methods use the conv augmentation (in addition to shift augmentation used by DrQ). Results are averaged over 5 seeds for each of the 5 tasks from DMControl-GB [21] and shaded area is $\pm 1$ std. deviation across seeds. Increasing values of $K , M$ improve sample efficiency of $_ \mathrm { D r Q }$ , but at a high computational cost; DrQ uses approx. 6x wall-time to match the sample efficiency of SVEA. (Right) DistractingCS. Episode return as a function of randomization intensity at test-time, aggregated across 5 seeds for each of the 5 tasks from DMControl-GB. See Appendix E for per-task comparison.
126
+
127
+ # 6.1 Stability and Generalization on DMControl
128
+
129
+ Stability. We evaluate the stability of SVEA and DrQ under 6 common data augmentations; results are shown in Figure 4. While the sample efficiency of DrQ degrades substantially for most augmentations, SVEA is relatively unaffected by the choice of data augmentation and improves sample efficiency in 27 out of 30 instances. While the sample efficiency of DrQ can be improved by increasing its K,M parameters, we find that DrQ requires approx. 6x wall-time to match the sample efficiency of SVEA; see Figure 6 (left). We further ablate each component of SVEA and report both training and test curves in Figure 5; we find that both components are key to SVEA’s success. Because we empirically find the conv augmentation to be particularly difficult to optimize, we provide additional stability experiments in Section 6.2 and 6.3 using this augmentation. See Appendix A for additional ablations.
130
+
131
+ Generalization. We compare the test performance of SVEA to 5 recent state-of-the-art methods for image-based RL on the color_hard and video_easy benchmarks from DMControl-GB (results in Table 1), as well as the extremely challenging DistractingCS benchmark, where camera pose, background, and colors are continually changing throughout an episode (results in Figure 6 (right)). We here use conv and overlay augmentations for fair comparison to SODA, and we report additional results on the video_hard benchmark in Appendix F. SVEA outperforms all methods considered in 12 out of 15 instances on DMControl-GB, and at a lower computational cost than CURL, PAD, and SODA that all learn auxiliary tasks. On DistractingCS, we observe that SVEA improves generalization by $4 2 \%$ at low intensity, and its generalization degrades significantly slower than DrQ for high intensities. While generalization depends on the particular choice of data augmentation and test environments, this is an encouraging result considering that SVEA enables efficient policy learning with stronger augmentations than previous methods.
132
+
133
+ # 6.2 RL with Vision Transformers
134
+
135
+ Vision Transformers (ViT) [10] have recently achieved impressive results on downstream tasks in computer vision. We replace all convolutional layers from the previous experiments with a 4-layer ViT encoder that operates on raw pixels in $8 \times 8$ space-time patches, and evaluate our method using data augmentation in conjunction with ViT encoders. Importantly, we design the ViT architecture such that it roughly matches our CNN encoder in terms of learnable parameters. The ViT encoder is trained from scratch using RL, and we use the same experimental setup as in our ConvNet experiments. In particular, it is worth emphasizing that both our ViT and CNN encoders are trained using Adam [32] as optimizer and without weight decay. See Figure 7 (top) for an architectural overview, and refer to Appendix H for additional implementation details.
136
+
137
+ Our training and test results are shown in Figure 7 (bottom). We are, to the best of our knowledge, the first to successfully solve image-based RL tasks without CNNs. We observe that DrQ overfits significantly to the training environment compared to its CNN counterpart (94 test return on color_hard for DrQ with ViT vs. 569 with a ConvNet on the Walker, walk task). SVEA achieves comparable sample efficiency and improves generalization by ${ \bf 7 0 6 \% }$ and $\mathbf { 2 3 3 \% }$ on Walker, walk and Cartpole, swingup, respectively, over $\mathrm { D r Q } .$ while $\mathrm { D r Q } +$ conv remains unstable. Interestingly, we observe that our ViT-based implementation of SVEA achieves a mean episode return of 877 on the color_hard benchmark of the challenging Walker, walk task (vs. 760 using CNNs). SVEA might therefore be a promising technique for fu
138
+
139
+ ![](images/4d0b0c36ee63637c6da561c4c4c9fdb33f55066196e9d5de886574d5c991e683.jpg)
140
+ Figure 7. (Top) ViT architecture. Observations are divided into 144 non-overlapping space-time patches and linearly projected into tokens. Each token uses a learned positional encoding and we also use a learnable class token as in [10]. The ViT encoder consists of 4 stacked Transformer encoders [69]. (Bottom) RL with a ViT encoder. Training and test performance of SVEA and DrQ using ViT encoders. We report results for three tasks and test performance is evaluated on the color_hard benchmark of DMControl-GB. Mean of 5 seeds, shaded area is $\pm 1$ std. deviation.
141
+
142
+ ture research on RL with CNN-free architectures, where data augmentation appears to be especially important for generalization. We provide additional experiments with ViT encoders in Section 6.3 and make further comparison to ConvNet encoders in Appendix A.
143
+
144
+ Table 2. Generalization in robotic manipulation. Task success rates of SVEA and DrQ with CNN and ViT encoders in the training environment, as well as aggregated success rates across 25 different test environments with randomized camera pose, colors, lighting, and background. Mean of 5 seeds.
145
+
146
+ <table><tr><td>Robotic manipulation</td><td>Arch. (encoder)</td><td>reach (train)</td><td>reach (test)</td><td>mv.tgt. (train)</td><td>mv.tgt. (test)</td><td>push (train)</td><td>push (test)</td></tr><tr><td>DrQ</td><td>CNN</td><td>1.00</td><td>0.60</td><td>1.00</td><td>0.69</td><td>0.76</td><td>0.26</td></tr><tr><td>DrQ + conv</td><td>CNN</td><td>0.59</td><td>0.77</td><td>0.60</td><td>0.89</td><td>0.13</td><td>0.12</td></tr><tr><td>SVEA w/ conv</td><td>CNN</td><td>1.00</td><td>0.89</td><td>1.00</td><td>0.96</td><td>0.72</td><td>0.48</td></tr><tr><td>DrQ</td><td>ViT</td><td>0.93</td><td>0.14</td><td>1.00</td><td>0.16</td><td>0.73</td><td>0.05</td></tr><tr><td>DrQ + conv</td><td>ViT</td><td>0.26</td><td>0.67</td><td>0.48</td><td>0.82</td><td>0.08</td><td>0.07</td></tr><tr><td>SVEA w/ conv</td><td>ViT</td><td>0.98</td><td>0.71</td><td>1.00</td><td>0.81</td><td>0.82</td><td>0.17</td></tr></table>
147
+
148
+ # 6.3 Robotic Manipulation
149
+
150
+ We additionally consider a set of goal-conditioned robotic manipulation tasks using a simulated Kinova Gen3 arm: (i) reach, a task in which the robot needs to position its gripper above a goal indicated by a red mark; (ii) reach moving target, a task similar to (i) but where the robot needs to follow a red mark moving continuously in a zig-zag pattern at a random velocity; and (iii) push, a task in which the robot needs to push a cube to a red mark. The initial configuration of gripper, object, and goal is randomized, the agent uses 2D positional control, and policies are trained using dense rewards. Observations are stacks of RGB frames with no access to state information. Training and test environments are shown in Figure 8. See Appendix G for further details and environment samples.
151
+
152
+ Results are shown in Figure 9 and Figure 10. For both CNN and ViT encoders, SVEA trained with conv augmentation has similar sample efficiency and training performance as $_ \mathrm { D r Q }$ trained without augmentation, while $\mathrm { D r } \mathbf { Q } +$ conv exhibits poor sample efficiency and fails to solve the push task. Generalization results are shown in Table 2. We find that naïve application of data augmentation has a higher success rate in test environments than DrQ, despite being less
153
+
154
+ ![](images/5bf876677ceca00b4f2966ed501f9943b17360152f5f9f731869ffe5cba567f5.jpg)
155
+ Figure 8. Robotic manipulation. Agents are trained in a fixed environment and evaluated on challenging environments with randomized colors, lighting, background, and camera pose.
156
+
157
+ ![](images/73422ba04f39ccf27a137c21ba8b10fb1cc12ec3142313c6cb10028930f0ca77.jpg)
158
+ Figure 9. Stability with a CNN encoder. Training performance (episode return) of SVEA and $_ \mathrm { D r Q }$ in 3 robotic manipulation tasks. Mean and std. deviation of 5 seeds. Success rates are shown in Table 2.
159
+
160
+ ![](images/31568f196073e6e5432fcfbf80bf5d633c6bd6a7f055833c968203a3c7165b9a.jpg)
161
+ Figure 10. Stability with a ViT encoder. Training performance (episode return) of SVEA and $_ \mathrm { D r Q }$ in 3 robotic manipulation tasks. Mean and std. deviation of 5 seeds. Success rates are shown in Table 2. DrQ is especially unstable under augmentation when using a ViT encoder.
162
+
163
+ successful in the training environment, which we conjecture is because it is optimized only from augmented data. Conversely, SVEA achieves high success rates during both training and testing.
164
+
165
+ Conclusion. SVEA is found to greatly improve both stability and sample efficiency under augmentation, while achieving competitive generalization results. Our experiments indicate that our method scales to ViT-based architectures, and it may therefore be a promising technique for large-scale RL experiments where data augmentation is expected to play an increasingly important role.
166
+
167
+ Broader Impact. While our contribution aims to reduce computational cost of image-based RL, we remain concerned about the growing ecological and economical footprint of deep learning – and RL in particular – with increasingly large models such as ViT; see Appendix J for further discussion.
168
+
169
+ Acknowledgments and Funding Transparency. This work was supported by grants from DARPA LwLL, NSF CCF-2112665 (TILOS), NSF 1730158 CI-New: Cognitive Hardware and Software Ecosystem Community Infrastructure (CHASE-CI), NSF ACI-1541349 CC\*DNI Pacific Research Platform, NSF grant IIS-1763278, NSF CCF-2112665 (TILOS), as well as gifts from Qualcomm, TuSimple and Picsart.
170
+
171
+ # References
172
+
173
+ [1] Rishabh Agarwal, Marlos C. Machado, P. S. Castro, and Marc G. Bellemare. Contrastive behavioral similarity embeddings for generalization in reinforcement learning. ArXiv, abs/2101.05265, 2021.
174
+ [2] Richard Bellman. A markovian decision process. Journal of Mathematics and Mechanics, 6(5):679–684, 1957.
175
+ [3] Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency. Association for Computing Machinery, 2021.
176
+ [4] Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemyslaw Debiak, Christy Dennison, David Farhi, Quirin Fischer, et al. Dota 2 with large scale deep reinforcement learning. ArXiv, abs/1912.06680, 2019.
177
+ [5] T. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, J. Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, et al. Language models are few-shot learners. arXiv, abs/2005.14165, 2020.
178
+ [6] Yevgen Chebotar, A. Handa, Viktor Makoviychuk, M. Macklin, J. Issac, Nathan D. Ratliff, and D. Fox. Closing the sim-to-real loop: Adapting simulation randomization with real world experience. 2019 International Conference on Robotics and Automation (ICRA), pages 8973–8979, 2019.
179
+ [7] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations, 2020.
180
+ [8] K. Cobbe, Oleg Klimov, Christopher Hesse, Taehoon Kim, and John Schulman. Quantifying generalization in reinforcement learning. In Icml, 2019.
181
+ [9] Karl Cobbe, Oleg Klimov, Chris Hesse, Taehoon Kim, and John Schulman. Quantifying generalization in reinforcement learning, 2018.
182
+ [10] A. Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, M. Dehghani, Matthias Minderer, et al. An image is worth 16x16 words: Transformers for image recognition at scale. ArXiv, abs/2010.11929, 2020.
183
+ [11] Frederik Ebert, Chelsea Finn, Sudeep Dasari, Annie Xie, Alex Lee, and Sergey Levine. Visual foresight: Model-based deep reinforcement learning for vision-based robotic control, 2018.
184
+ [12] Lasse Espeholt, Hubert Soyer, R. Munos, K. Simonyan, V. Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. ArXiv, abs/1802.01561, 2018.
185
+ [13] Jesse Farebrother, Marlos C. Machado, and Michael H. Bowling. Generalization and regularization in dqn. ArXiv, abs/1810.00123, 2018.
186
+ [14] Meire Fortunato, M. G. Azar, Bilal Piot, Jacob Menick, Ian Osband, A. Graves, Vlad Mnih, R. Munos, et al. Noisy networks for exploration. ArXiv, abs/1706.10295, 2018.
187
+ [15] Scott Fujimoto, H. V. Hoof, and D. Meger. Addressing function approximation error in actor-critic methods. ArXiv, abs/1802.09477, 2018.
188
+ [16] Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations, 2018.
189
+ [17] R. Givan, T. Dean, and M. Greig. Equivalence notions and model minimization in markov decision processes. Artificial Intelligence, 147:163–223, 2003.
190
+ [18] Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018.
191
+ [19] Danijar Hafner, T. Lillicrap, Ian S. Fischer, R. Villegas, David R Ha, H. Lee, and James Davidson. Learning latent dynamics for planning from pixels. ArXiv, abs/1811.04551, 2019.
192
+ [20] Danijar Hafner, T. Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. ArXiv, abs/1912.01603, 2020.
193
+ [21] Nicklas Hansen and Xiaolong Wang. Generalization in reinforcement learning by soft data augmentation. In International Conference on Robotics and Automation, 2021.
194
+ [22] Nicklas Hansen, Rishabh Jangir, Yu Sun, Guillem Alenyà, Pieter Abbeel, Alexei A. Efros, Lerrel Pinto, and Xiaolong Wang. Self-supervised policy adaptation during deployment. In International Conference on Learning Representations, 2021.
195
+ [23] H. V. Hasselt, A. Guez, Matteo Hessel, V. Mnih, and D. Silver. Learning values across many orders of magnitude. In Nips, 2016.
196
+ [24] H. V. Hasselt, A. Guez, and D. Silver. Deep reinforcement learning with double q-learning. In Aaai, 2016.
197
+ [25] M. Hausknecht and P. Stone. Deep recurrent q-learning for partially observable mdps. In AAAI Fall Symposia, 2015.
198
+ [26] Kaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.
199
+ [27] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 9726–9735, 2020.
200
+ [28] Matteo Hessel, Joseph Modayil, H. V. Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, et al. Rainbow: Combining improvements in deep reinforcement learning. In Aaai, 2018.
201
+ [29] Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks, 2016.
202
+ [30] Leslie Pack Kaelbling, Michael L. Littman, and Anthony R. Cassandra. Planning and acting in partially observable stochastic domains. Artificial Intelligence, 1998.
203
+ [31] D. Kalashnikov, A. Irpan, P. Pastor, J. Ibarz, A. Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, et al. Qtopt: Scalable deep reinforcement learning for vision-based robotic manipulation. ArXiv, abs/1806.10293, 2018.
204
+ [32] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015.
205
+ [33] Ilya Kostrikov, Denis Yarats, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. International Conference on Learning Representations, 2020.
206
+ [34] K. G. Larsen and A. Skou. Bisimulation through probabilistic testing (preliminary report). In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1989.
207
+ [35] Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, and Aravind Srinivas. Reinforcement learning with augmented data. arXiv preprint arXiv:2004.14990, 2020.
208
+ [36] Kimin Lee, Kibok Lee, Jinwoo Shin, and Honglak Lee. A simple randomization technique for generalization in deep reinforcement learning. ArXiv, abs/1910.05396, 2019.
209
+ [37] 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.
210
+ [38] T. Lillicrap, J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. CoRR, abs/1509.02971, 2016.
211
+ [39] L. J. Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine Learning, 8:293–321, 2004.
212
+ [40] Xingyu Lin, Harjatin Singh Baweja, George Kantor, and David Held. Adaptive auxiliary task weighting for reinforcement learning. Advances in neural information processing systems, 32, 2019.
213
+ [41] Clare Lyle, Mark Rowland, Georg Ostrovski, and Will Dabney. On the effect of auxiliary tasks on representation dynamics. In Aistats, 2021.
214
+ [42] P. Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andy Ballard, Andrea Banino, Misha Denil, R. Goroshin, et al. Learning to navigate in complex environments. ArXiv, abs/1611.03673, 2017.
215
+ [43] 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.
216
+ [44] Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, pages 9191–9200, 2018.
217
+ [45] Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pages 69–84. Springer, 2016.
218
+ [46] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2536–2544, 2016.
219
+ [47] Deepak Pathak, Dhiraj Gandhi, and A. Gupta. Self-supervised exploration via disagreement. ArXiv, abs/1906.04161, 2019.
220
+ [48] Xue Bin Peng, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Sim-to-real transfer of robotic control with dynamics randomization. 2018 IEEE International Conference on Robotics and Automation (ICRA), May 2018.
221
+ [49] Lerrel Pinto and Abhinav Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. In 2016 IEEE international conference on robotics and automation (ICRA), pages 3406–3413. Ieee, 2016.
222
+ [50] Lerrel Pinto, Marcin Andrychowicz, Peter Welinder, Wojciech Zaremba, and Pieter Abbeel. Asymmetric actor critic for image-based robot learning. arXiv preprint arXiv:1710.06542, 2017.
223
+ [51] Roberta Raileanu, M. Goldstein, Denis Yarats, Ilya Kostrikov, and R. Fergus. Automatic data augmentation for generalization in deep reinforcement learning. ArXiv, abs/2006.12862, 2020.
224
+ [52] Fabio Ramos, Rafael Possas, and Dieter Fox. Bayessim: Adaptive domain randomization via probabilistic inference for robotics simulators. Robotics: Science and Systems XV, Jun 2019.
225
+ [53] Tom Schaul, John Quan, Ioannis Antonoglou, and D. Silver. Prioritized experience replay. CoRR, abs/1511.05952, 2016.
226
+ [54] Max Schwarzer, Ankesh Anand, Rishab Goel, R Devon Hjelm, Aaron Courville, and Philip Bachman. Data-efficient reinforcement learning with self-predictive representations. arXiv preprint arXiv:2007.05929, 2020.
227
+ [55] Ramanan Sekar, Oleh Rybkin, Kostas Daniilidis, Pieter Abbeel, Danijar Hafner, and Deepak Pathak. Planning to explore via self-supervised world models, 2020.
228
+ [56] Evan Shelhamer, Parsa Mahmoudieh, Max Argus, and Trevor Darrell. Loss is its own reward: Selfsupervision for reinforcement learning. ArXiv, abs/1612.07307, 2017.
229
+ [57] Connor Shorten and T. Khoshgoftaar. A survey on image data augmentation for deep learning. Journal of Big Data, 6:1–48, 2019.
230
+ [58] Xingyou Song, Yiding Jiang, Stephen Tu, Yilun Du, and Behnam Neyshabur. Observational overfitting in reinforcement learning. ArXiv, abs/1912.02975, 2020.
231
+ [59] Aravind Srinivas, Michael Laskin, and Pieter Abbeel. Curl: Contrastive unsupervised representations for reinforcement learning. arXiv preprint arXiv:2004.04136, 2020.
232
+ [60] Austin Stone, Oscar Ramirez, K. Konolige, and Rico Jonschkowski. The distracting control suite - a challenging benchmark for reinforcement learning from pixels. ArXiv, abs/2101.02722, 2021.
233
+ [61] Adam Stooke, Kimin Lee, Pieter Abbeel, and Michael Laskin. Decoupling representation learning from reinforcement learning. ArXiv, abs/2004.1499, 2020.
234
+ [62] R. Sutton. Learning to predict by the methods of temporal differences. Machine Learning, 3:9–44, 2005.
235
+ [63] Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. The MIT Press, second edition, 2018.
236
+ [64] Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, et al. Deepmind control suite. Technical report, DeepMind, 2018.
237
+ [65] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
238
+ [66] Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), Sep 2017.
239
+ [67] Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pages 5026–5033, 2012. doi: 10.1109/iros.2012.6386109.
240
+ [68] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding, 2018.
241
+ [69] Ashish Vaswani, Noam M. Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv, abs/1706.03762, 2017.
242
+ [70] Oriol Vinyals, I. Babuschkin, Wojciech Czarnecki, Micha "el Mathieu, Andrew Dudzik, J. Chung, D. Choi, Richard Powell, et al. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, pages 1–5, 2019.
243
+ [71] K. Wang, Bingyi Kang, Jie Shao, and Jiashi Feng. Improving generalization in reinforcement learning with mixture regularization. ArXiv, abs/2010.10814, 2020.
244
+ [72] Xudong Wang, Long Lian, and Stella X. Yu. Unsupervised visual attention and invariance for reinforcement learning. ArXiv, abs/2104.02921, 2021.
245
+ [73] Ziyu Wang, Tom Schaul, Matteo Hessel, H. V. Hasselt, Marc Lanctot, and N. D. Freitas. Dueling network architectures for deep reinforcement learning. ArXiv, abs/1511.06581, 2016.
246
+ [74] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018.
247
+ [75] Zhenlin Xu, Deyi Liu, Junlin Yang, and M. Niethammer. Robust and generalizable visual representation learning via random convolutions. ArXiv, abs/2007.13003, 2020.
248
+ [76] Denis Yarats, Amy Zhang, Ilya Kostrikov, Brandon Amos, Joelle Pineau, and Rob Fergus. Improving sample efficiency in model-free reinforcement learning from images, 2019.
249
+ [77] Denis Yarats, Rob Fergus, Alessandro Lazaric, and Lerrel Pinto. Reinforcement learning with prototypical representations. arXiv preprint arXiv:2102.11271, 2021.
250
+ [78] Sarah Young, Dhiraj Gandhi, Shubham Tulsiani, Abhinav Gupta, Pieter Abbeel, and Lerrel Pinto. Visual imitation made easy. CoRL, 2020.
251
+ [79] Tianhe Yu, Saurabh Kumar, A. Gupta, Sergey Levine, Karol Hausman, and Chelsea Finn. Gradient surgery for multi-task learning. ArXiv, abs/2001.06782, 2020.
252
+ [80] A. Zhang, Rowan McAllister, R. Calandra, Y. Gal, and Sergey Levine. Learning invariant representations for reinforcement learning without reconstruction. ArXiv, abs/2006.10742, 2020.
253
+ [81] C. Zhang, Oriol Vinyals, R. Munos, and S. Bengio. A study on overfitting in deep reinforcement learning. ArXiv, abs/1804.06893, 2018.
254
+ [82] Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pages 649–666. Springer, 2016.
255
+ [83] Yuke Zhu, Roozbeh Mottaghi, Eric Kolve, Joseph J Lim, Abhinav Gupta, Li Fei-Fei, and Ali Farhadi. Target-driven visual navigation in indoor scenes using deep reinforcement learning. In Icra, pages 3357– 3364. Ieee, 2017.
256
+ [84] Brian D Ziebart, Andrew Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In Proceedings of the 23rd National Conference on Artificial Intelligence, volume 3, 2008.